From 110f136f1540e37deab37254187ca40353427101 Mon Sep 17 00:00:00 2001 From: Shemona Singh Date: Tue, 28 Nov 2017 20:33:42 -0500 Subject: [PATCH] added codeignitter --- db/.DS_Store => .DS_Store | Bin application/.htaccess | 6 + application/cache/index.html | 11 + application/config/autoload.php | 135 + application/config/config.php | 523 + application/config/constants.php | 85 + application/config/database.php | 96 + application/config/doctypes.php | 24 + application/config/foreign_chars.php | 103 + application/config/hooks.php | 13 + application/config/index.html | 11 + application/config/memcached.php | 19 + application/config/migration.php | 84 + application/config/mimes.php | 183 + application/config/profiler.php | 14 + application/config/routes.php | 54 + application/config/smileys.php | 64 + application/config/user_agents.php | 214 + application/controllers/Welcome.php | 25 + application/controllers/index.html | 11 + application/core/index.html | 11 + application/helpers/index.html | 11 + application/hooks/index.html | 11 + application/index.html | 11 + application/language/english/index.html | 11 + application/language/index.html | 11 + application/libraries/index.html | 11 + application/logs/index.html | 11 + application/models/index.html | 11 + application/third_party/index.html | 11 + application/views/errors/cli/error_404.php | 8 + application/views/errors/cli/error_db.php | 8 + .../views/errors/cli/error_exception.php | 21 + .../views/errors/cli/error_general.php | 8 + application/views/errors/cli/error_php.php | 21 + application/views/errors/cli/index.html | 11 + application/views/errors/html/error_404.php | 64 + application/views/errors/html/error_db.php | 64 + .../views/errors/html/error_exception.php | 32 + .../views/errors/html/error_general.php | 64 + application/views/errors/html/error_php.php | 33 + application/views/errors/html/index.html | 11 + application/views/errors/index.html | 11 + application/views/index.html | 11 + application/views/welcome_message.php | 89 + composer.json | 30 +- composer.lock | 924 -- contributing.md | 95 + db/lamp_2017-11-05.sql | 66 - index.php | 315 + .../LICENSE => license.txt | 6 +- readme.rst | 70 + system/.htaccess | 6 + system/core/Benchmark.php | 133 + system/core/CodeIgniter.php | 559 + system/core/Common.php | 849 ++ system/core/Config.php | 379 + system/core/Controller.php | 96 + system/core/Exceptions.php | 274 + system/core/Hooks.php | 266 + system/core/Input.php | 895 ++ system/core/Lang.php | 203 + system/core/Loader.php | 1409 +++ system/core/Log.php | 296 + system/core/Model.php | 80 + system/core/Output.php | 842 ++ system/core/Router.php | 515 + system/core/Security.php | 1080 ++ system/core/URI.php | 643 + system/core/Utf8.php | 164 + system/core/compat/hash.php | 254 + system/core/compat/index.html | 11 + system/core/compat/mbstring.php | 149 + system/core/compat/password.php | 251 + system/core/compat/standard.php | 182 + system/core/index.html | 11 + system/database/DB.php | 218 + system/database/DB_cache.php | 221 + system/database/DB_driver.php | 1987 +++ system/database/DB_forge.php | 1032 ++ system/database/DB_query_builder.php | 2803 +++++ system/database/DB_result.php | 666 + system/database/DB_utility.php | 424 + .../database/drivers/cubrid/cubrid_driver.php | 405 + .../database/drivers/cubrid/cubrid_forge.php | 230 + .../database/drivers/cubrid/cubrid_result.php | 177 + .../drivers/cubrid/cubrid_utility.php | 79 + system/database/drivers/cubrid/index.html | 11 + .../database/drivers/ibase/ibase_driver.php | 413 + system/database/drivers/ibase/ibase_forge.php | 251 + .../database/drivers/ibase/ibase_result.php | 161 + .../database/drivers/ibase/ibase_utility.php | 69 + system/database/drivers/ibase/index.html | 11 + system/database/drivers/index.html | 11 + system/database/drivers/mssql/index.html | 11 + .../database/drivers/mssql/mssql_driver.php | 518 + system/database/drivers/mssql/mssql_forge.php | 151 + .../database/drivers/mssql/mssql_result.php | 198 + .../database/drivers/mssql/mssql_utility.php | 77 + system/database/drivers/mysql/index.html | 11 + .../database/drivers/mysql/mysql_driver.php | 494 + system/database/drivers/mysql/mysql_forge.php | 243 + .../database/drivers/mysql/mysql_result.php | 199 + .../database/drivers/mysql/mysql_utility.php | 211 + system/database/drivers/mysqli/index.html | 11 + .../database/drivers/mysqli/mysqli_driver.php | 544 + .../database/drivers/mysqli/mysqli_forge.php | 244 + .../database/drivers/mysqli/mysqli_result.php | 240 + .../drivers/mysqli/mysqli_utility.php | 215 + system/database/drivers/oci8/index.html | 11 + system/database/drivers/oci8/oci8_driver.php | 688 ++ system/database/drivers/oci8/oci8_forge.php | 187 + system/database/drivers/oci8/oci8_result.php | 229 + system/database/drivers/oci8/oci8_utility.php | 68 + system/database/drivers/odbc/index.html | 11 + system/database/drivers/odbc/odbc_driver.php | 425 + system/database/drivers/odbc/odbc_forge.php | 86 + system/database/drivers/odbc/odbc_result.php | 268 + system/database/drivers/odbc/odbc_utility.php | 63 + system/database/drivers/pdo/index.html | 11 + system/database/drivers/pdo/pdo_driver.php | 329 + system/database/drivers/pdo/pdo_forge.php | 65 + system/database/drivers/pdo/pdo_result.php | 198 + system/database/drivers/pdo/pdo_utility.php | 63 + .../drivers/pdo/subdrivers/index.html | 11 + .../drivers/pdo/subdrivers/pdo_4d_driver.php | 200 + .../drivers/pdo/subdrivers/pdo_4d_forge.php | 217 + .../pdo/subdrivers/pdo_cubrid_driver.php | 209 + .../pdo/subdrivers/pdo_cubrid_forge.php | 230 + .../pdo/subdrivers/pdo_dblib_driver.php | 353 + .../pdo/subdrivers/pdo_dblib_forge.php | 149 + .../pdo/subdrivers/pdo_firebird_driver.php | 279 + .../pdo/subdrivers/pdo_firebird_forge.php | 237 + .../drivers/pdo/subdrivers/pdo_ibm_driver.php | 244 + .../drivers/pdo/subdrivers/pdo_ibm_forge.php | 154 + .../pdo/subdrivers/pdo_informix_driver.php | 309 + .../pdo/subdrivers/pdo_informix_forge.php | 163 + .../pdo/subdrivers/pdo_mysql_driver.php | 374 + .../pdo/subdrivers/pdo_mysql_forge.php | 256 + .../drivers/pdo/subdrivers/pdo_oci_driver.php | 326 + .../drivers/pdo/subdrivers/pdo_oci_forge.php | 176 + .../pdo/subdrivers/pdo_odbc_driver.php | 229 + .../drivers/pdo/subdrivers/pdo_odbc_forge.php | 70 + .../pdo/subdrivers/pdo_pgsql_driver.php | 384 + .../pdo/subdrivers/pdo_pgsql_forge.php | 210 + .../pdo/subdrivers/pdo_sqlite_driver.php | 219 + .../pdo/subdrivers/pdo_sqlite_forge.php | 238 + .../pdo/subdrivers/pdo_sqlsrv_driver.php | 369 + .../pdo/subdrivers/pdo_sqlsrv_forge.php | 149 + system/database/drivers/postgre/index.html | 11 + .../drivers/postgre/postgre_driver.php | 620 + .../drivers/postgre/postgre_forge.php | 205 + .../drivers/postgre/postgre_result.php | 182 + .../drivers/postgre/postgre_utility.php | 78 + system/database/drivers/sqlite/index.html | 11 + .../database/drivers/sqlite/sqlite_driver.php | 330 + .../database/drivers/sqlite/sqlite_forge.php | 205 + .../database/drivers/sqlite/sqlite_result.php | 164 + .../drivers/sqlite/sqlite_utility.php | 61 + system/database/drivers/sqlite3/index.html | 11 + .../drivers/sqlite3/sqlite3_driver.php | 350 + .../drivers/sqlite3/sqlite3_forge.php | 225 + .../drivers/sqlite3/sqlite3_result.php | 194 + .../drivers/sqlite3/sqlite3_utility.php | 61 + system/database/drivers/sqlsrv/index.html | 11 + .../database/drivers/sqlsrv/sqlsrv_driver.php | 543 + .../database/drivers/sqlsrv/sqlsrv_forge.php | 149 + .../database/drivers/sqlsrv/sqlsrv_result.php | 193 + .../drivers/sqlsrv/sqlsrv_utility.php | 77 + system/database/index.html | 11 + system/fonts/index.html | 11 + system/fonts/texb.ttf | Bin 0 -> 143830 bytes system/helpers/array_helper.php | 115 + system/helpers/captcha_helper.php | 341 + system/helpers/cookie_helper.php | 113 + system/helpers/date_helper.php | 742 ++ system/helpers/directory_helper.php | 101 + system/helpers/download_helper.php | 158 + system/helpers/email_helper.php | 84 + system/helpers/file_helper.php | 453 + system/helpers/form_helper.php | 1055 ++ system/helpers/html_helper.php | 410 + system/helpers/index.html | 11 + system/helpers/inflector_helper.php | 276 + system/helpers/language_helper.php | 75 + system/helpers/number_helper.php | 94 + system/helpers/path_helper.php | 82 + system/helpers/security_helper.php | 137 + system/helpers/smiley_helper.php | 255 + system/helpers/string_helper.php | 304 + system/helpers/text_helper.php | 567 + system/helpers/typography_helper.php | 104 + system/helpers/url_helper.php | 569 + system/helpers/xml_helper.php | 90 + system/index.html | 11 + system/language/english/calendar_lang.php | 84 + system/language/english/date_lang.php | 94 + system/language/english/db_lang.php | 63 + system/language/english/email_lang.php | 58 + .../language/english/form_validation_lang.php | 68 + system/language/english/ftp_lang.php | 51 + system/language/english/imglib_lang.php | 57 + system/language/english/index.html | 11 + system/language/english/migration_lang.php | 47 + .../language/english/number_lang.php | 53 +- .../language/english/pagination_lang.php | 52 +- system/language/english/profiler_lang.php | 60 + system/language/english/unit_test_lang.php | 58 + system/language/english/upload_lang.php | 55 + system/language/index.html | 11 + system/libraries/Cache/Cache.php | 255 + system/libraries/Cache/drivers/Cache_apc.php | 217 + .../libraries/Cache/drivers/Cache_dummy.php | 172 + system/libraries/Cache/drivers/Cache_file.php | 286 + .../Cache/drivers/Cache_memcached.php | 303 + .../libraries/Cache/drivers/Cache_redis.php | 328 + .../Cache/drivers/Cache_wincache.php | 217 + system/libraries/Cache/drivers/index.html | 11 + system/libraries/Cache/index.html | 11 + system/libraries/Calendar.php | 546 + system/libraries/Cart.php | 567 + system/libraries/Driver.php | 342 + system/libraries/Email.php | 2466 ++++ system/libraries/Encrypt.php | 521 + system/libraries/Encryption.php | 943 ++ system/libraries/Form_validation.php | 1584 +++ system/libraries/Ftp.php | 667 + system/libraries/Image_lib.php | 1839 +++ system/libraries/Javascript.php | 856 ++ system/libraries/Javascript/Jquery.php | 1076 ++ system/libraries/Javascript/index.html | 11 + system/libraries/Migration.php | 477 + system/libraries/Pagination.php | 701 ++ system/libraries/Parser.php | 248 + system/libraries/Profiler.php | 574 + system/libraries/Session/Session.php | 985 ++ .../Session/SessionHandlerInterface.php | 59 + system/libraries/Session/Session_driver.php | 191 + .../drivers/Session_database_driver.php | 420 + .../Session/drivers/Session_files_driver.php | 406 + .../drivers/Session_memcached_driver.php | 376 + .../Session/drivers/Session_redis_driver.php | 399 + system/libraries/Session/drivers/index.html | 11 + system/libraries/Session/index.html | 11 + system/libraries/Table.php | 538 + system/libraries/Trackback.php | 556 + system/libraries/Typography.php | 424 + system/libraries/Unit_test.php | 406 + system/libraries/Upload.php | 1328 ++ system/libraries/User_agent.php | 681 ++ system/libraries/Xmlrpc.php | 1920 +++ system/libraries/Xmlrpcs.php | 625 + system/libraries/Zip.php | 532 + system/libraries/index.html | 11 + user_guide/.buildinfo | 4 + user_guide/DCO.html | 517 + user_guide/_downloads/ELDocs.tmbundle.zip | Bin 0 -> 3932 bytes user_guide/_images/appflowchart.gif | Bin 0 -> 25276 bytes user_guide/_images/smile.gif | Bin 0 -> 1156 bytes user_guide/_static/ajax-loader.gif | Bin 0 -> 673 bytes user_guide/_static/basic.css | 639 + user_guide/_static/ci-icon.ico | Bin 0 -> 5430 bytes user_guide/_static/comment-bright.png | Bin 0 -> 756 bytes user_guide/_static/comment-close.png | Bin 0 -> 829 bytes user_guide/_static/comment.png | Bin 0 -> 641 bytes user_guide/_static/css/badge_only.css | 2 + user_guide/_static/css/citheme.css | 88 + user_guide/_static/css/theme.css | 5 + user_guide/_static/doctools.js | 287 + user_guide/_static/down-pressed.png | Bin 0 -> 222 bytes user_guide/_static/down.png | Bin 0 -> 202 bytes user_guide/_static/file.png | Bin 0 -> 286 bytes user_guide/_static/fonts/FontAwesome.otf | Bin 0 -> 62856 bytes .../_static/fonts/fontawesome-webfont.eot | Bin 0 -> 38205 bytes .../_static/fonts/fontawesome-webfont.svg | 414 + .../_static/fonts/fontawesome-webfont.ttf | Bin 0 -> 80652 bytes .../_static/fonts/fontawesome-webfont.woff | Bin 0 -> 44432 bytes user_guide/_static/images/ci-icon.ico | Bin 0 -> 1150 bytes user_guide/_static/jquery-3.1.0.js | 10074 ++++++++++++++++ user_guide/_static/jquery.js | 4 + user_guide/_static/js/oldtheme.js | 47 + user_guide/_static/js/theme.js | 131 + user_guide/_static/minus.png | Bin 0 -> 90 bytes user_guide/_static/plus.png | Bin 0 -> 90 bytes user_guide/_static/pygments.css | 63 + user_guide/_static/searchtools.js | 758 ++ user_guide/_static/underscore-1.3.1.js | 999 ++ user_guide/_static/underscore.js | 31 + user_guide/_static/up-pressed.png | Bin 0 -> 214 bytes user_guide/_static/up.png | Bin 0 -> 203 bytes user_guide/_static/websupport.js | 808 ++ user_guide/changelog.html | 4123 +++++++ user_guide/contributing/index.html | 615 + user_guide/database/caching.html | 642 + user_guide/database/call_function.html | 529 + user_guide/database/configuration.html | 758 ++ user_guide/database/connecting.html | 641 + user_guide/database/db_driver_reference.html | 1483 +++ user_guide/database/examples.html | 597 + user_guide/database/forge.html | 1034 ++ user_guide/database/helpers.html | 592 + user_guide/database/index.html | 514 + user_guide/database/metadata.html | 614 + user_guide/database/queries.html | 658 + user_guide/database/query_builder.html | 2714 +++++ user_guide/database/results.html | 1231 ++ user_guide/database/transactions.html | 615 + user_guide/database/utilities.html | 993 ++ user_guide/documentation/index.html | 702 ++ user_guide/general/alternative_php.html | 566 + user_guide/general/ancillary_classes.html | 578 + user_guide/general/autoloader.html | 519 + user_guide/general/caching.html | 563 + user_guide/general/cli.html | 573 + user_guide/general/common_functions.html | 776 ++ .../general/compatibility_functions.html | 914 ++ user_guide/general/controllers.html | 845 ++ user_guide/general/core_classes.html | 612 + user_guide/general/creating_drivers.html | 524 + user_guide/general/creating_libraries.html | 753 ++ user_guide/general/credits.html | 502 + user_guide/general/drivers.html | 530 + user_guide/general/environments.html | 538 + user_guide/general/errors.html | 649 + user_guide/general/helpers.html | 629 + user_guide/general/hooks.html | 617 + user_guide/general/index.html | 523 + user_guide/general/libraries.html | 521 + user_guide/general/managing_apps.html | 554 + user_guide/general/models.html | 685 ++ user_guide/general/profiling.html | 624 + user_guide/general/requirements.html | 511 + user_guide/general/reserved_names.html | 583 + user_guide/general/routing.html | 689 ++ user_guide/general/security.html | 663 + user_guide/general/styleguide.html | 1128 ++ user_guide/general/urls.html | 599 + user_guide/general/views.html | 704 ++ user_guide/general/welcome.html | 520 + user_guide/genindex.html | 1935 +++ user_guide/helpers/array_helper.html | 660 + user_guide/helpers/captcha_helper.html | 670 + user_guide/helpers/cookie_helper.html | 608 + user_guide/helpers/date_helper.html | 1256 ++ user_guide/helpers/directory_helper.html | 587 + user_guide/helpers/download_helper.html | 556 + user_guide/helpers/email_helper.html | 598 + user_guide/helpers/file_helper.html | 829 ++ user_guide/helpers/form_helper.html | 1598 +++ user_guide/helpers/html_helper.html | 1091 ++ user_guide/helpers/index.html | 518 + user_guide/helpers/inflector_helper.html | 680 ++ user_guide/helpers/language_helper.html | 550 + user_guide/helpers/number_helper.html | 559 + user_guide/helpers/path_helper.html | 557 + user_guide/helpers/security_helper.html | 669 + user_guide/helpers/smiley_helper.html | 708 ++ user_guide/helpers/string_helper.html | 873 ++ user_guide/helpers/text_helper.html | 847 ++ user_guide/helpers/typography_helper.html | 607 + user_guide/helpers/url_helper.html | 1044 ++ user_guide/helpers/xml_helper.html | 559 + user_guide/index.html | 712 ++ user_guide/installation/downloads.html | 530 + user_guide/installation/index.html | 532 + user_guide/installation/troubleshooting.html | 511 + user_guide/installation/upgrade_120.html | 516 + user_guide/installation/upgrade_130.html | 619 + user_guide/installation/upgrade_131.html | 527 + user_guide/installation/upgrade_132.html | 525 + user_guide/installation/upgrade_133.html | 539 + user_guide/installation/upgrade_140.html | 567 + user_guide/installation/upgrade_141.html | 564 + user_guide/installation/upgrade_150.html | 591 + user_guide/installation/upgrade_152.html | 536 + user_guide/installation/upgrade_153.html | 523 + user_guide/installation/upgrade_154.html | 547 + user_guide/installation/upgrade_160.html | 566 + user_guide/installation/upgrade_161.html | 522 + user_guide/installation/upgrade_162.html | 537 + user_guide/installation/upgrade_163.html | 522 + user_guide/installation/upgrade_170.html | 549 + user_guide/installation/upgrade_171.html | 522 + user_guide/installation/upgrade_172.html | 539 + user_guide/installation/upgrade_200.html | 632 + user_guide/installation/upgrade_201.html | 532 + user_guide/installation/upgrade_202.html | 525 + user_guide/installation/upgrade_203.html | 555 + user_guide/installation/upgrade_210.html | 519 + user_guide/installation/upgrade_211.html | 523 + user_guide/installation/upgrade_212.html | 514 + user_guide/installation/upgrade_213.html | 514 + user_guide/installation/upgrade_214.html | 509 + user_guide/installation/upgrade_220.html | 518 + user_guide/installation/upgrade_221.html | 509 + user_guide/installation/upgrade_222.html | 509 + user_guide/installation/upgrade_223.html | 509 + user_guide/installation/upgrade_300.html | 1330 ++ user_guide/installation/upgrade_301.html | 513 + user_guide/installation/upgrade_302.html | 520 + user_guide/installation/upgrade_303.html | 547 + user_guide/installation/upgrade_304.html | 509 + user_guide/installation/upgrade_305.html | 509 + user_guide/installation/upgrade_306.html | 539 + user_guide/installation/upgrade_310.html | 527 + user_guide/installation/upgrade_311.html | 509 + user_guide/installation/upgrade_312.html | 534 + user_guide/installation/upgrade_313.html | 539 + user_guide/installation/upgrade_314.html | 509 + user_guide/installation/upgrade_315.html | 509 + user_guide/installation/upgrade_316.html | 523 + user_guide/installation/upgrade_b11.html | 567 + user_guide/installation/upgrading.html | 548 + user_guide/libraries/benchmark.html | 703 ++ user_guide/libraries/caching.html | 895 ++ user_guide/libraries/calendar.html | 972 ++ user_guide/libraries/cart.html | 1025 ++ user_guide/libraries/config.html | 834 ++ user_guide/libraries/email.html | 1218 ++ user_guide/libraries/encrypt.html | 787 ++ user_guide/libraries/encryption.html | 1405 +++ user_guide/libraries/file_uploading.html | 1025 ++ user_guide/libraries/form_validation.html | 1932 +++ user_guide/libraries/ftp.html | 1016 ++ user_guide/libraries/image_lib.html | 1255 ++ user_guide/libraries/index.html | 527 + user_guide/libraries/input.html | 1191 ++ user_guide/libraries/javascript.html | 802 ++ user_guide/libraries/language.html | 733 ++ user_guide/libraries/loader.html | 1213 ++ user_guide/libraries/migration.html | 758 ++ user_guide/libraries/output.html | 912 ++ user_guide/libraries/pagination.html | 784 ++ user_guide/libraries/parser.html | 850 ++ user_guide/libraries/security.html | 739 ++ user_guide/libraries/sessions.html | 1922 +++ user_guide/libraries/table.html | 911 ++ user_guide/libraries/trackback.html | 1035 ++ user_guide/libraries/typography.html | 657 + user_guide/libraries/unit_testing.html | 846 ++ user_guide/libraries/uri.html | 890 ++ user_guide/libraries/user_agent.html | 931 ++ user_guide/libraries/xmlrpc.html | 1151 ++ user_guide/libraries/zip.html | 846 ++ user_guide/license.html | 509 + user_guide/objects.inv | Bin 0 -> 7309 bytes user_guide/overview/appflow.html | 513 + user_guide/overview/at_a_glance.html | 599 + user_guide/overview/features.html | 538 + user_guide/overview/getting_started.html | 512 + user_guide/overview/goals.html | 522 + user_guide/overview/index.html | 504 + user_guide/overview/mvc.html | 519 + user_guide/search.html | 499 + user_guide/searchindex.js | 1 + user_guide/tutorial/conclusion.html | 515 + user_guide/tutorial/create_news_items.html | 629 + user_guide/tutorial/index.html | 525 + user_guide/tutorial/news_section.html | 685 ++ user_guide/tutorial/static_pages.html | 633 + vendor/autoload.php | 7 - vendor/bin/heroku-hhvm-apache2 | 1 - vendor/bin/heroku-hhvm-nginx | 1 - vendor/bin/heroku-php-apache2 | 1 - vendor/bin/heroku-php-nginx | 1 - vendor/composer/ClassLoader.php | 445 - vendor/composer/LICENSE | 21 - vendor/composer/autoload_classmap.php | 9 - vendor/composer/autoload_files.php | 10 - vendor/composer/autoload_namespaces.php | 11 - vendor/composer/autoload_psr4.php | 21 - vendor/composer/autoload_real.php | 70 - vendor/composer/autoload_static.php | 117 - vendor/composer/installed.json | 935 -- vendor/heroku/heroku-buildpack-php/.gitignore | 3 - .../heroku/heroku-buildpack-php/.travis.yml | 2 - .../heroku/heroku-buildpack-php/CHANGELOG.md | 867 -- vendor/heroku/heroku-buildpack-php/README.md | 55 - .../heroku/heroku-buildpack-php/bin/compile | 311 - vendor/heroku/heroku-buildpack-php/bin/detect | 8 - .../bin/heroku-hhvm-apache2 | 373 - .../bin/heroku-hhvm-nginx | 373 - .../bin/heroku-php-apache2 | 404 - .../heroku-buildpack-php/bin/heroku-php-nginx | 405 - .../heroku/heroku-buildpack-php/bin/release | 9 - .../heroku-buildpack-php/bin/test-compile | 14 - .../bin/util/autotune.php | 79 - .../bin/util/blackfire.sh | 15 - .../heroku-buildpack-php/bin/util/common.sh | 66 - .../heroku-buildpack-php/bin/util/newrelic.sh | 25 - .../bin/util/platform.php | 182 - .../heroku/heroku-buildpack-php/composer.json | 20 - .../conf/apache2/default_include.conf | 1 - .../conf/apache2/heroku.conf | 70 - .../conf/hhvm/php.ini.php | 16 - .../conf/nginx/default_include.conf.php | 8 - .../conf/nginx/heroku.conf.php | 72 - .../conf/php/php-fpm.conf | 533 - .../heroku-buildpack-php/requirements.txt | 2 - .../support/build/README.md | 215 - .../support/build/_conf/apache2/httpd.conf | 527 - .../support/build/_conf/nginx/nginx.conf | 36 - .../_conf/php/conf.d/010-ext-zend_opcache.ini | 7 - .../support/build/_conf/php/php.ini | 1900 --- .../support/build/_docker/README.md | 31 - .../support/build/_docker/cedar-14.Dockerfile | 13 - .../support/build/_docker/env.default | 8 - .../build/_docker/heroku-16.Dockerfile | 13 - .../support/build/_util/deploy.sh | 75 - .../support/build/_util/include/manifest.py | 27 - .../support/build/_util/include/manifest.sh | 19 - .../support/build/_util/mkrepo.sh | 102 - .../support/build/_util/remove.sh | 145 - .../support/build/_util/sync.sh | 287 - .../heroku-buildpack-php/support/build/apache | 77 - .../support/build/apache-2.4.29 | 4 - .../support/build/composer | 42 - .../support/build/composer-1.5.2 | 5 - .../extensions/no-debug-non-zts-20121212/apcu | 14 - .../no-debug-non-zts-20121212/apcu-4.0.11 | 5 - .../no-debug-non-zts-20121212/blackfire | 134 - .../blackfire-1.18.0 | 4 - .../no-debug-non-zts-20121212/cassandra | 28 - .../no-debug-non-zts-20121212/cassandra-1.2.2 | 5 - .../extensions/no-debug-non-zts-20121212/ev | 5 - .../no-debug-non-zts-20121212/ev-1.0.4 | 5 - .../no-debug-non-zts-20121212/event | 5 - .../no-debug-non-zts-20121212/event-2.3.0 | 5 - .../no-debug-non-zts-20121212/imagick | 5 - .../no-debug-non-zts-20121212/imagick-3.4.3 | 5 - .../no-debug-non-zts-20121212/memcached | 68 - .../no-debug-non-zts-20121212/memcached-2.2.0 | 5 - .../no-debug-non-zts-20121212/mongo | 5 - .../no-debug-non-zts-20121212/mongo-1.6.16 | 5 - .../no-debug-non-zts-20121212/mongodb | 5 - .../no-debug-non-zts-20121212/mongodb-1.3.1 | 5 - .../no-debug-non-zts-20121212/newrelic | 113 - .../newrelic-7.6.0.201 | 4 - .../no-debug-non-zts-20121212/oauth | 5 - .../no-debug-non-zts-20121212/oauth-1.2.3 | 5 - .../no-debug-non-zts-20121212/phalcon | 61 - .../no-debug-non-zts-20121212/phalcon-2.0.13 | 5 - .../no-debug-non-zts-20121212/phalcon-3.2.4 | 5 - .../extensions/no-debug-non-zts-20121212/pq | 24 - .../no-debug-non-zts-20121212/pq-1.1.1 | 5 - .../no-debug-non-zts-20121212/raphf | 5 - .../no-debug-non-zts-20121212/raphf-1.1.2 | 5 - .../no-debug-non-zts-20121212/rdkafka | 20 - .../no-debug-non-zts-20121212/rdkafka-3.0.4 | 5 - .../no-debug-non-zts-20121212/redis | 5 - .../no-debug-non-zts-20121212/redis-3.1.4 | 5 - .../extensions/no-debug-non-zts-20131226/amqp | 20 - .../no-debug-non-zts-20131226/amqp-1.9.3 | 5 - .../no-debug-non-zts-20131226/apcu-4.0.11 | 5 - .../no-debug-non-zts-20131226/blackfire | 4 - .../blackfire-1.18.0 | 4 - .../no-debug-non-zts-20131226/cassandra-1.3.2 | 5 - .../no-debug-non-zts-20131226/ev-1.0.4 | 5 - .../no-debug-non-zts-20131226/event-2.3.0 | 5 - .../no-debug-non-zts-20131226/imagick-3.4.3 | 5 - .../no-debug-non-zts-20131226/memcached-2.2.0 | 5 - .../no-debug-non-zts-20131226/mongo-1.6.16 | 5 - .../no-debug-non-zts-20131226/mongodb-1.3.1 | 5 - .../newrelic-7.6.0.201 | 4 - .../no-debug-non-zts-20131226/oauth-1.2.3 | 5 - .../no-debug-non-zts-20131226/phalcon-2.0.13 | 5 - .../no-debug-non-zts-20131226/phalcon-3.2.4 | 5 - .../no-debug-non-zts-20131226/pq-1.1.1 | 5 - .../no-debug-non-zts-20131226/raphf-1.1.2 | 5 - .../no-debug-non-zts-20131226/rdkafka-3.0.4 | 5 - .../no-debug-non-zts-20131226/redis-3.1.4 | 5 - .../no-debug-non-zts-20151012/amqp-1.9.3 | 5 - .../extensions/no-debug-non-zts-20151012/apcu | 79 - .../no-debug-non-zts-20151012/apcu-5.1.8 | 5 - .../no-debug-non-zts-20151012/blackfire | 4 - .../blackfire-1.18.0 | 4 - .../no-debug-non-zts-20151012/cassandra-1.3.2 | 5 - .../no-debug-non-zts-20151012/ev-1.0.4 | 5 - .../no-debug-non-zts-20151012/event-2.3.0 | 5 - .../no-debug-non-zts-20151012/imagick-3.4.3 | 5 - .../no-debug-non-zts-20151012/memcached-3.0.3 | 5 - .../no-debug-non-zts-20151012/mongodb-1.3.1 | 5 - .../newrelic-7.6.0.201 | 4 - .../no-debug-non-zts-20151012/oauth-2.0.2 | 5 - .../no-debug-non-zts-20151012/phalcon-3.2.4 | 5 - .../no-debug-non-zts-20151012/pq-2.1.2 | 5 - .../no-debug-non-zts-20151012/raphf-2.0.0 | 5 - .../no-debug-non-zts-20151012/rdkafka-3.0.4 | 5 - .../no-debug-non-zts-20151012/redis-3.1.4 | 5 - .../no-debug-non-zts-20160303/amqp-1.9.3 | 5 - .../no-debug-non-zts-20160303/apcu-5.1.8 | 5 - .../no-debug-non-zts-20160303/blackfire | 4 - .../blackfire-1.18.0 | 4 - .../no-debug-non-zts-20160303/cassandra-1.3.2 | 5 - .../no-debug-non-zts-20160303/ev-1.0.4 | 5 - .../no-debug-non-zts-20160303/event-2.3.0 | 5 - .../no-debug-non-zts-20160303/imagick-3.4.3 | 5 - .../no-debug-non-zts-20160303/memcached-3.0.3 | 5 - .../no-debug-non-zts-20160303/mongodb-1.3.1 | 5 - .../newrelic-7.6.0.201 | 4 - .../no-debug-non-zts-20160303/oauth-2.0.2 | 5 - .../no-debug-non-zts-20160303/phalcon-3.2.4 | 5 - .../no-debug-non-zts-20160303/pq-2.1.2 | 5 - .../no-debug-non-zts-20160303/raphf-2.0.0 | 5 - .../no-debug-non-zts-20160303/rdkafka-3.0.4 | 5 - .../no-debug-non-zts-20160303/redis-3.1.4 | 5 - .../support/build/extensions/pecl | 47 - .../heroku-buildpack-php/support/build/hhvm | 101 - .../support/build/hhvm-3.5.1 | 76 - .../support/build/libraries/libc-client | 46 - .../support/build/libraries/libc-client-2007f | 4 - .../support/build/libraries/libcassandra | 48 - .../build/libraries/libcassandra-2.7.1 | 4 - .../support/build/libraries/libmcrypt | 44 - .../support/build/libraries/libmcrypt-2.5.8 | 4 - .../support/build/libraries/libmemcached | 67 - .../build/libraries/libmemcached-1.0.18 | 4 - .../support/build/libraries/librdkafka | 47 - .../support/build/libraries/librdkafka-0.11.1 | 4 - .../heroku-buildpack-php/support/build/nginx | 71 - .../support/build/nginx-1.8.1 | 4 - .../heroku-buildpack-php/support/build/php | 202 - .../support/build/php-5.5.38 | 5 - .../support/build/php-5.6.32 | 5 - .../support/build/php-7.0.25 | 5 - .../support/build/php-7.1.11 | 5 - .../support/build/php-min | 67 - .../support/build/php-min-7.0.25 | 4 - .../support/installer/composer.json | 16 - .../installer/src/ComposerInstaller.php | 34 - .../installer/src/ComposerInstallerPlugin.php | 201 - .../support/installer/src/Downloader.php | 98 - vendor/monolog/monolog/.php_cs | 59 - vendor/monolog/monolog/CHANGELOG.md | 342 - vendor/monolog/monolog/LICENSE | 19 - vendor/monolog/monolog/README.md | 95 - vendor/monolog/monolog/composer.json | 66 - vendor/monolog/monolog/doc/01-usage.md | 231 - .../doc/02-handlers-formatters-processors.md | 157 - vendor/monolog/monolog/doc/03-utilities.md | 13 - vendor/monolog/monolog/doc/04-extending.md | 76 - vendor/monolog/monolog/doc/sockets.md | 39 - vendor/monolog/monolog/phpunit.xml.dist | 19 - .../monolog/src/Monolog/ErrorHandler.php | 230 - .../Monolog/Formatter/ChromePHPFormatter.php | 78 - .../Monolog/Formatter/ElasticaFormatter.php | 89 - .../Monolog/Formatter/FlowdockFormatter.php | 116 - .../Monolog/Formatter/FluentdFormatter.php | 85 - .../Monolog/Formatter/FormatterInterface.php | 36 - .../Formatter/GelfMessageFormatter.php | 138 - .../src/Monolog/Formatter/HtmlFormatter.php | 141 - .../src/Monolog/Formatter/JsonFormatter.php | 208 - .../src/Monolog/Formatter/LineFormatter.php | 179 - .../src/Monolog/Formatter/LogglyFormatter.php | 47 - .../Monolog/Formatter/LogstashFormatter.php | 166 - .../Monolog/Formatter/MongoDBFormatter.php | 105 - .../Monolog/Formatter/NormalizerFormatter.php | 297 - .../src/Monolog/Formatter/ScalarFormatter.php | 48 - .../Monolog/Formatter/WildfireFormatter.php | 113 - .../src/Monolog/Handler/AbstractHandler.php | 186 - .../Handler/AbstractProcessingHandler.php | 66 - .../Monolog/Handler/AbstractSyslogHandler.php | 101 - .../src/Monolog/Handler/AmqpHandler.php | 148 - .../Monolog/Handler/BrowserConsoleHandler.php | 230 - .../src/Monolog/Handler/BufferHandler.php | 117 - .../src/Monolog/Handler/ChromePHPHandler.php | 211 - .../src/Monolog/Handler/CouchDBHandler.php | 72 - .../src/Monolog/Handler/CubeHandler.php | 151 - .../monolog/src/Monolog/Handler/Curl/Util.php | 57 - .../Monolog/Handler/DeduplicationHandler.php | 169 - .../Handler/DoctrineCouchDBHandler.php | 45 - .../src/Monolog/Handler/DynamoDbHandler.php | 107 - .../Monolog/Handler/ElasticSearchHandler.php | 128 - .../src/Monolog/Handler/ErrorLogHandler.php | 82 - .../src/Monolog/Handler/FilterHandler.php | 140 - .../ActivationStrategyInterface.php | 28 - .../ChannelLevelActivationStrategy.php | 59 - .../ErrorLevelActivationStrategy.php | 34 - .../Monolog/Handler/FingersCrossedHandler.php | 163 - .../src/Monolog/Handler/FirePHPHandler.php | 195 - .../src/Monolog/Handler/FleepHookHandler.php | 126 - .../src/Monolog/Handler/FlowdockHandler.php | 127 - .../src/Monolog/Handler/GelfHandler.php | 73 - .../src/Monolog/Handler/GroupHandler.php | 104 - .../src/Monolog/Handler/HandlerInterface.php | 90 - .../src/Monolog/Handler/HandlerWrapper.php | 108 - .../src/Monolog/Handler/HipChatHandler.php | 350 - .../src/Monolog/Handler/IFTTTHandler.php | 69 - .../src/Monolog/Handler/LogEntriesHandler.php | 55 - .../src/Monolog/Handler/LogglyHandler.php | 102 - .../src/Monolog/Handler/MailHandler.php | 67 - .../src/Monolog/Handler/MandrillHandler.php | 68 - .../Handler/MissingExtensionException.php | 21 - .../src/Monolog/Handler/MongoDBHandler.php | 59 - .../Monolog/Handler/NativeMailerHandler.php | 185 - .../src/Monolog/Handler/NewRelicHandler.php | 202 - .../src/Monolog/Handler/NullHandler.php | 45 - .../src/Monolog/Handler/PHPConsoleHandler.php | 242 - .../src/Monolog/Handler/PsrHandler.php | 56 - .../src/Monolog/Handler/PushoverHandler.php | 185 - .../src/Monolog/Handler/RavenHandler.php | 232 - .../src/Monolog/Handler/RedisHandler.php | 97 - .../src/Monolog/Handler/RollbarHandler.php | 132 - .../Monolog/Handler/RotatingFileHandler.php | 178 - .../src/Monolog/Handler/SamplingHandler.php | 82 - .../src/Monolog/Handler/Slack/SlackRecord.php | 294 - .../src/Monolog/Handler/SlackHandler.php | 215 - .../Monolog/Handler/SlackWebhookHandler.php | 115 - .../src/Monolog/Handler/SlackbotHandler.php | 80 - .../src/Monolog/Handler/SocketHandler.php | 346 - .../src/Monolog/Handler/StreamHandler.php | 176 - .../Monolog/Handler/SwiftMailerHandler.php | 99 - .../src/Monolog/Handler/SyslogHandler.php | 67 - .../Monolog/Handler/SyslogUdp/UdpSocket.php | 56 - .../src/Monolog/Handler/SyslogUdpHandler.php | 103 - .../src/Monolog/Handler/TestHandler.php | 154 - .../Handler/WhatFailureGroupHandler.php | 61 - .../Monolog/Handler/ZendMonitorHandler.php | 95 - vendor/monolog/monolog/src/Monolog/Logger.php | 700 -- .../src/Monolog/Processor/GitProcessor.php | 64 - .../Processor/IntrospectionProcessor.php | 112 - .../Processor/MemoryPeakUsageProcessor.php | 35 - .../src/Monolog/Processor/MemoryProcessor.php | 63 - .../Processor/MemoryUsageProcessor.php | 35 - .../Monolog/Processor/MercurialProcessor.php | 63 - .../Monolog/Processor/ProcessIdProcessor.php | 31 - .../Processor/PsrLogMessageProcessor.php | 48 - .../src/Monolog/Processor/TagProcessor.php | 44 - .../src/Monolog/Processor/UidProcessor.php | 46 - .../src/Monolog/Processor/WebProcessor.php | 113 - .../monolog/monolog/src/Monolog/Registry.php | 134 - .../tests/Monolog/ErrorHandlerTest.php | 31 - .../Formatter/ChromePHPFormatterTest.php | 158 - .../Formatter/ElasticaFormatterTest.php | 79 - .../Formatter/FlowdockFormatterTest.php | 55 - .../Formatter/FluentdFormatterTest.php | 62 - .../Formatter/GelfMessageFormatterTest.php | 258 - .../Monolog/Formatter/JsonFormatterTest.php | 183 - .../Monolog/Formatter/LineFormatterTest.php | 222 - .../Monolog/Formatter/LogglyFormatterTest.php | 40 - .../Formatter/LogstashFormatterTest.php | 333 - .../Formatter/MongoDBFormatterTest.php | 262 - .../Formatter/NormalizerFormatterTest.php | 423 - .../Monolog/Formatter/ScalarFormatterTest.php | 110 - .../Formatter/WildfireFormatterTest.php | 142 - .../Monolog/Handler/AbstractHandlerTest.php | 115 - .../Handler/AbstractProcessingHandlerTest.php | 80 - .../tests/Monolog/Handler/AmqpHandlerTest.php | 136 - .../Handler/BrowserConsoleHandlerTest.php | 130 - .../Monolog/Handler/BufferHandlerTest.php | 158 - .../Monolog/Handler/ChromePHPHandlerTest.php | 156 - .../Monolog/Handler/CouchDBHandlerTest.php | 31 - .../Handler/DeduplicationHandlerTest.php | 165 - .../Handler/DoctrineCouchDBHandlerTest.php | 52 - .../Monolog/Handler/DynamoDbHandlerTest.php | 82 - .../Handler/ElasticSearchHandlerTest.php | 239 - .../Monolog/Handler/ErrorLogHandlerTest.php | 66 - .../Monolog/Handler/FilterHandlerTest.php | 170 - .../Handler/FingersCrossedHandlerTest.php | 279 - .../Monolog/Handler/FirePHPHandlerTest.php | 96 - .../tests/Monolog/Handler/Fixtures/.gitkeep | 0 .../Monolog/Handler/FleepHookHandlerTest.php | 85 - .../Monolog/Handler/FlowdockHandlerTest.php | 88 - .../Monolog/Handler/GelfHandlerLegacyTest.php | 95 - .../tests/Monolog/Handler/GelfHandlerTest.php | 117 - .../Handler/GelfMockMessagePublisher.php | 25 - .../Monolog/Handler/GroupHandlerTest.php | 112 - .../Monolog/Handler/HandlerWrapperTest.php | 130 - .../Monolog/Handler/HipChatHandlerTest.php | 279 - .../Monolog/Handler/LogEntriesHandlerTest.php | 84 - .../tests/Monolog/Handler/MailHandlerTest.php | 75 - .../tests/Monolog/Handler/MockRavenClient.php | 27 - .../Monolog/Handler/MongoDBHandlerTest.php | 65 - .../Handler/NativeMailerHandlerTest.php | 111 - .../Monolog/Handler/NewRelicHandlerTest.php | 200 - .../tests/Monolog/Handler/NullHandlerTest.php | 33 - .../Monolog/Handler/PHPConsoleHandlerTest.php | 273 - .../tests/Monolog/Handler/PsrHandlerTest.php | 50 - .../Monolog/Handler/PushoverHandlerTest.php | 141 - .../Monolog/Handler/RavenHandlerTest.php | 255 - .../Monolog/Handler/RedisHandlerTest.php | 127 - .../Monolog/Handler/RollbarHandlerTest.php | 84 - .../Handler/RotatingFileHandlerTest.php | 211 - .../Monolog/Handler/SamplingHandlerTest.php | 33 - .../Monolog/Handler/Slack/SlackRecordTest.php | 387 - .../Monolog/Handler/SlackHandlerTest.php | 155 - .../Handler/SlackWebhookHandlerTest.php | 107 - .../Monolog/Handler/SlackbotHandlerTest.php | 47 - .../Monolog/Handler/SocketHandlerTest.php | 309 - .../Monolog/Handler/StreamHandlerTest.php | 184 - .../Handler/SwiftMailerHandlerTest.php | 113 - .../Monolog/Handler/SyslogHandlerTest.php | 44 - .../Monolog/Handler/SyslogUdpHandlerTest.php | 76 - .../tests/Monolog/Handler/TestHandlerTest.php | 70 - .../tests/Monolog/Handler/UdpSocketTest.php | 64 - .../Handler/WhatFailureGroupHandlerTest.php | 121 - .../Handler/ZendMonitorHandlerTest.php | 69 - .../monolog/tests/Monolog/LoggerTest.php | 548 - .../Monolog/Processor/GitProcessorTest.php | 29 - .../Processor/IntrospectionProcessorTest.php | 123 - .../MemoryPeakUsageProcessorTest.php | 42 - .../Processor/MemoryUsageProcessorTest.php | 42 - .../Processor/MercurialProcessorTest.php | 41 - .../Processor/ProcessIdProcessorTest.php | 30 - .../Processor/PsrLogMessageProcessorTest.php | 43 - .../Monolog/Processor/TagProcessorTest.php | 49 - .../Monolog/Processor/UidProcessorTest.php | 33 - .../Monolog/Processor/WebProcessorTest.php | 113 - .../tests/Monolog/PsrLogCompatTest.php | 47 - .../monolog/tests/Monolog/RegistryTest.php | 153 - .../monolog/tests/Monolog/TestCase.php | 58 - vendor/pimple/pimple/.gitignore | 3 - vendor/pimple/pimple/.travis.yml | 40 - vendor/pimple/pimple/CHANGELOG | 55 - vendor/pimple/pimple/LICENSE | 19 - vendor/pimple/pimple/README.rst | 326 - vendor/pimple/pimple/composer.json | 29 - vendor/pimple/pimple/ext/pimple/.gitignore | 30 - vendor/pimple/pimple/ext/pimple/README.md | 12 - vendor/pimple/pimple/ext/pimple/config.m4 | 63 - vendor/pimple/pimple/ext/pimple/config.w32 | 13 - vendor/pimple/pimple/ext/pimple/php_pimple.h | 137 - vendor/pimple/pimple/ext/pimple/pimple.c | 1114 -- .../pimple/pimple/ext/pimple/pimple_compat.h | 81 - .../pimple/pimple/ext/pimple/tests/001.phpt | 45 - .../pimple/pimple/ext/pimple/tests/002.phpt | 15 - .../pimple/pimple/ext/pimple/tests/003.phpt | 16 - .../pimple/pimple/ext/pimple/tests/004.phpt | 30 - .../pimple/pimple/ext/pimple/tests/005.phpt | 27 - .../pimple/pimple/ext/pimple/tests/006.phpt | 51 - .../pimple/pimple/ext/pimple/tests/007.phpt | 22 - .../pimple/pimple/ext/pimple/tests/008.phpt | 29 - .../pimple/pimple/ext/pimple/tests/009.phpt | 13 - .../pimple/pimple/ext/pimple/tests/010.phpt | 45 - .../pimple/pimple/ext/pimple/tests/011.phpt | 19 - .../pimple/pimple/ext/pimple/tests/012.phpt | 28 - .../pimple/pimple/ext/pimple/tests/013.phpt | 33 - .../pimple/pimple/ext/pimple/tests/014.phpt | 30 - .../pimple/pimple/ext/pimple/tests/015.phpt | 17 - .../pimple/pimple/ext/pimple/tests/016.phpt | 24 - .../pimple/pimple/ext/pimple/tests/017.phpt | 17 - .../pimple/pimple/ext/pimple/tests/017_1.phpt | 17 - .../pimple/pimple/ext/pimple/tests/018.phpt | 23 - .../pimple/pimple/ext/pimple/tests/019.phpt | 18 - .../pimple/pimple/ext/pimple/tests/bench.phpb | 51 - .../pimple/ext/pimple/tests/bench_shared.phpb | 25 - vendor/pimple/pimple/phpunit.xml.dist | 14 - vendor/pimple/pimple/src/Pimple/Container.php | 298 - .../Exception/ExpectedInvokableException.php | 38 - .../Exception/FrozenServiceException.php | 45 - .../pimple/src/Pimple/Psr11/Container.php | 55 - .../src/Pimple/Psr11/ServiceLocator.php | 75 - .../pimple/src/Pimple/ServiceIterator.php | 69 - .../src/Pimple/ServiceProviderInterface.php | 46 - .../src/Pimple/Tests/Fixtures/Invokable.php | 38 - .../Pimple/Tests/Fixtures/NonInvokable.php | 34 - .../Tests/Fixtures/PimpleServiceProvider.php | 54 - .../src/Pimple/Tests/Fixtures/Service.php | 35 - .../PimpleServiceProviderInterfaceTest.php | 76 - .../pimple/src/Pimple/Tests/PimpleTest.php | 589 - .../src/Pimple/Tests/Psr11/ContainerTest.php | 77 - .../Pimple/Tests/Psr11/ServiceLocatorTest.php | 134 - .../src/Pimple/Tests/ServiceIteratorTest.php | 52 - vendor/psr/container/.gitignore | 3 - vendor/psr/container/LICENSE | 21 - vendor/psr/container/README.md | 5 - vendor/psr/container/composer.json | 27 - .../src/ContainerExceptionInterface.php | 13 - .../psr/container/src/ContainerInterface.php | 37 - .../src/NotFoundExceptionInterface.php | 13 - vendor/psr/log/.gitignore | 1 - vendor/psr/log/LICENSE | 19 - vendor/psr/log/Psr/Log/AbstractLogger.php | 128 - .../log/Psr/Log/InvalidArgumentException.php | 7 - vendor/psr/log/Psr/Log/LogLevel.php | 18 - .../psr/log/Psr/Log/LoggerAwareInterface.php | 18 - vendor/psr/log/Psr/Log/LoggerAwareTrait.php | 26 - vendor/psr/log/Psr/Log/LoggerInterface.php | 123 - vendor/psr/log/Psr/Log/LoggerTrait.php | 140 - vendor/psr/log/Psr/Log/NullLogger.php | 28 - .../log/Psr/Log/Test/LoggerInterfaceTest.php | 140 - vendor/psr/log/README.md | 45 - vendor/psr/log/composer.json | 26 - vendor/silex/silex/.gitignore | 5 - vendor/silex/silex/.travis.yml | 59 - vendor/silex/silex/LICENSE | 19 - vendor/silex/silex/README.rst | 64 - vendor/silex/silex/composer.json | 72 - vendor/silex/silex/doc/changelog.rst | 387 - vendor/silex/silex/doc/conf.py | 17 - vendor/silex/silex/doc/contributing.rst | 34 - .../silex/doc/cookbook/error_handler.rst | 38 - .../silex/silex/doc/cookbook/form_no_csrf.rst | 36 - .../doc/cookbook/guard_authentication.rst | 183 - vendor/silex/silex/doc/cookbook/index.rst | 40 - .../silex/doc/cookbook/json_request_body.rst | 95 - .../silex/doc/cookbook/multiple_loggers.rst | 69 - .../silex/doc/cookbook/session_storage.rst | 89 - .../silex/silex/doc/cookbook/sub_requests.rst | 137 - .../silex/doc/cookbook/validator_yaml.rst | 35 - vendor/silex/silex/doc/index.rst | 19 - vendor/silex/silex/doc/internals.rst | 84 - vendor/silex/silex/doc/intro.rst | 50 - vendor/silex/silex/doc/middlewares.rst | 162 - .../silex/doc/organizing_controllers.rst | 84 - vendor/silex/silex/doc/providers.rst | 262 - vendor/silex/silex/doc/providers/asset.rst | 67 - vendor/silex/silex/doc/providers/csrf.rst | 53 - vendor/silex/silex/doc/providers/doctrine.rst | 137 - vendor/silex/silex/doc/providers/form.rst | 216 - .../silex/silex/doc/providers/http_cache.rst | 128 - .../silex/doc/providers/http_fragment.rst | 70 - vendor/silex/silex/doc/providers/index.rst | 24 - vendor/silex/silex/doc/providers/locale.rst | 24 - vendor/silex/silex/doc/providers/monolog.rst | 115 - .../silex/silex/doc/providers/remember_me.rst | 69 - vendor/silex/silex/doc/providers/security.rst | 709 -- .../silex/silex/doc/providers/serializer.rst | 85 - .../doc/providers/service_controller.rst | 142 - vendor/silex/silex/doc/providers/session.rst | 120 - .../silex/silex/doc/providers/swiftmailer.rst | 156 - .../silex/silex/doc/providers/translation.rst | 193 - vendor/silex/silex/doc/providers/twig.rst | 237 - .../silex/silex/doc/providers/validator.rst | 217 - .../silex/silex/doc/providers/var_dumper.rst | 44 - vendor/silex/silex/doc/services.rst | 269 - vendor/silex/silex/doc/testing.rst | 222 - vendor/silex/silex/doc/usage.rst | 799 -- vendor/silex/silex/doc/web_servers.rst | 183 - vendor/silex/silex/phpunit.xml.dist | 24 - .../Silex/Api/BootableProviderInterface.php | 33 - .../Silex/Api/ControllerProviderInterface.php | 32 - .../Api/EventListenerProviderInterface.php | 25 - vendor/silex/silex/src/Silex/Api/LICENSE | 19 - .../silex/silex/src/Silex/Api/composer.json | 34 - .../src/Silex/AppArgumentValueResolver.php | 47 - vendor/silex/silex/src/Silex/Application.php | 506 - .../silex/src/Silex/Application/FormTrait.php | 55 - .../src/Silex/Application/MonologTrait.php | 36 - .../src/Silex/Application/SecurityTrait.php | 53 - .../Silex/Application/SwiftmailerTrait.php | 33 - .../Silex/Application/TranslationTrait.php | 51 - .../silex/src/Silex/Application/TwigTrait.php | 65 - .../Silex/Application/UrlGeneratorTrait.php | 48 - .../silex/src/Silex/CallbackResolver.php | 78 - vendor/silex/silex/src/Silex/Controller.php | 122 - .../silex/src/Silex/ControllerCollection.php | 239 - .../silex/src/Silex/ControllerResolver.php | 54 - .../Silex/EventListener/ConverterListener.php | 66 - .../src/Silex/EventListener/LogListener.php | 134 - .../EventListener/MiddlewareListener.php | 96 - .../StringToResponseListener.php | 51 - .../Exception/ControllerFrozenException.php | 21 - .../silex/src/Silex/ExceptionHandler.php | 56 - .../src/Silex/ExceptionListenerWrapper.php | 93 - .../Silex/Provider/AssetServiceProvider.php | 97 - .../Silex/Provider/CsrfServiceProvider.php | 48 - .../Provider/DoctrineServiceProvider.php | 129 - .../ExceptionHandlerServiceProvider.php | 32 - .../Provider/Form/SilexFormExtension.php | 122 - .../Silex/Provider/FormServiceProvider.php | 89 - .../Silex/Provider/HttpCache/HttpCache.php | 39 - .../Provider/HttpCacheServiceProvider.php | 61 - .../Provider/HttpFragmentServiceProvider.php | 86 - .../Provider/HttpKernelServiceProvider.php | 101 - vendor/silex/silex/src/Silex/Provider/LICENSE | 19 - .../Silex/Provider/Locale/LocaleListener.php | 84 - .../Silex/Provider/LocaleServiceProvider.php | 40 - .../Silex/Provider/MonologServiceProvider.php | 146 - .../Provider/RememberMeServiceProvider.php | 107 - .../Provider/Routing/LazyRequestMatcher.php | 55 - .../Routing/RedirectableUrlMatcher.php | 55 - .../Silex/Provider/RoutingServiceProvider.php | 87 - .../Provider/SecurityServiceProvider.php | 696 -- .../Provider/SerializerServiceProvider.php | 50 - .../ServiceControllerServiceProvider.php | 26 - .../Provider/Session/SessionListener.php | 39 - .../Provider/Session/TestSessionListener.php | 39 - .../Silex/Provider/SessionServiceProvider.php | 86 - .../Provider/SwiftmailerServiceProvider.php | 138 - .../Provider/TranslationServiceProvider.php | 98 - .../src/Silex/Provider/Twig/RuntimeLoader.php | 41 - .../Silex/Provider/TwigServiceProvider.php | 190 - .../Validator/ConstraintValidatorFactory.php | 63 - .../Provider/ValidatorServiceProvider.php | 62 - .../Provider/VarDumperServiceProvider.php | 58 - .../silex/src/Silex/Provider/composer.json | 31 - vendor/silex/silex/src/Silex/Route.php | 202 - .../silex/src/Silex/Route/SecurityTrait.php | 31 - .../src/Silex/ServiceControllerResolver.php | 60 - .../silex/src/Silex/ViewListenerWrapper.php | 87 - vendor/silex/silex/src/Silex/WebTestCase.php | 65 - .../Tests/Application/FormApplication.php | 19 - .../Silex/Tests/Application/FormTraitTest.php | 45 - .../Tests/Application/MonologApplication.php | 19 - .../Tests/Application/MonologTraitTest.php | 48 - .../Tests/Application/SecurityApplication.php | 19 - .../Tests/Application/SecurityTraitTest.php | 91 - .../Application/SwiftmailerApplication.php | 19 - .../Application/SwiftmailerTraitTest.php | 45 - .../Application/TranslationApplication.php | 19 - .../Application/TranslationTraitTest.php | 47 - .../Tests/Application/TwigApplication.php | 19 - .../Silex/Tests/Application/TwigTraitTest.php | 81 - .../Application/UrlGeneratorApplication.php | 19 - .../Application/UrlGeneratorTraitTest.php | 39 - .../tests/Silex/Tests/ApplicationTest.php | 725 -- .../Silex/Tests/CallbackResolverTest.php | 82 - .../Silex/Tests/CallbackServicesTest.php | 110 - .../Silex/Tests/ControllerCollectionTest.php | 328 - .../Silex/Tests/ControllerResolverTest.php | 39 - .../tests/Silex/Tests/ControllerTest.php | 133 - .../Tests/EventListener/LogListenerTest.php | 94 - .../Silex/Tests/ExceptionHandlerTest.php | 404 - .../Silex/Tests/Fixtures/Php7Controller.php | 22 - .../tests/Silex/Tests/Fixtures/manifest.json | 3 - .../tests/Silex/Tests/FunctionalTest.php | 59 - .../silex/tests/Silex/Tests/JsonTest.php | 57 - .../tests/Silex/Tests/LazyDispatcherTest.php | 60 - .../Silex/Tests/LazyRequestMatcherTest.php | 78 - .../silex/tests/Silex/Tests/LocaleTest.php | 84 - .../tests/Silex/Tests/MiddlewareTest.php | 308 - .../Provider/AssetServiceProviderTest.php | 52 - .../Provider/DoctrineServiceProviderTest.php | 117 - .../Provider/FormServiceProviderTest.php | 363 - .../DisableCsrfExtension.php | 22 - .../Provider/HttpCacheServiceProviderTest.php | 81 - .../HttpFragmentServiceProviderTest.php | 49 - .../Provider/MonologServiceProviderTest.php | 257 - .../RememberMeServiceProviderTest.php | 107 - .../Provider/RoutingServiceProviderTest.php | 122 - .../Provider/SecurityServiceProviderTest.php | 491 - .../TokenAuthenticator.php | 79 - .../SerializerServiceProviderTest.php | 37 - .../Provider/SessionServiceProviderTest.php | 126 - .../tests/Silex/Tests/Provider/SpoolStub.php | 47 - .../SwiftmailerServiceProviderTest.php | 134 - .../TranslationServiceProviderTest.php | 182 - .../Provider/TwigServiceProviderTest.php | 165 - .../Provider/ValidatorServiceProviderTest.php | 206 - .../Constraint/Custom.php | 29 - .../Constraint/CustomValidator.php | 32 - .../tests/Silex/Tests/Route/SecurityRoute.php | 19 - .../Silex/Tests/Route/SecurityTraitTest.php | 86 - .../silex/tests/Silex/Tests/RouterTest.php | 286 - .../ServiceControllerResolverRouterTest.php | 43 - .../Tests/ServiceControllerResolverTest.php | 90 - .../silex/tests/Silex/Tests/StreamTest.php | 53 - .../tests/Silex/Tests/WebTestCaseTest.php | 78 - vendor/symfony/debug/.gitignore | 3 - vendor/symfony/debug/BufferingLogger.php | 37 - vendor/symfony/debug/CHANGELOG.md | 59 - vendor/symfony/debug/Debug.php | 63 - vendor/symfony/debug/DebugClassLoader.php | 349 - vendor/symfony/debug/ErrorHandler.php | 716 -- .../Exception/ClassNotFoundException.php | 33 - .../debug/Exception/ContextErrorException.php | 40 - .../debug/Exception/FatalErrorException.php | 82 - .../debug/Exception/FatalThrowableError.php | 44 - .../debug/Exception/FlattenException.php | 263 - .../debug/Exception/OutOfMemoryException.php | 21 - .../debug/Exception/SilencedErrorContext.php | 67 - .../Exception/UndefinedFunctionException.php | 33 - .../Exception/UndefinedMethodException.php | 33 - vendor/symfony/debug/ExceptionHandler.php | 414 - .../ClassNotFoundFatalErrorHandler.php | 206 - .../FatalErrorHandlerInterface.php | 32 - .../UndefinedFunctionFatalErrorHandler.php | 84 - .../UndefinedMethodFatalErrorHandler.php | 66 - vendor/symfony/debug/LICENSE | 19 - vendor/symfony/debug/README.md | 13 - vendor/symfony/debug/Resources/ext/README.md | 134 - vendor/symfony/debug/Resources/ext/config.m4 | 63 - vendor/symfony/debug/Resources/ext/config.w32 | 13 - .../debug/Resources/ext/php_symfony_debug.h | 60 - .../debug/Resources/ext/symfony_debug.c | 283 - .../debug/Resources/ext/tests/001.phpt | 153 - .../debug/Resources/ext/tests/002.phpt | 63 - .../debug/Resources/ext/tests/002_1.phpt | 46 - .../debug/Resources/ext/tests/003.phpt | 85 - .../debug/Tests/DebugClassLoaderTest.php | 387 - .../symfony/debug/Tests/ErrorHandlerTest.php | 535 - .../Tests/Exception/FlattenExceptionTest.php | 301 - .../debug/Tests/ExceptionHandlerTest.php | 133 - .../ClassNotFoundFatalErrorHandlerTest.php | 176 - ...UndefinedFunctionFatalErrorHandlerTest.php | 81 - .../UndefinedMethodFatalErrorHandlerTest.php | 76 - .../debug/Tests/Fixtures/ClassAlias.php | 3 - .../debug/Tests/Fixtures/DeprecatedClass.php | 12 - .../Tests/Fixtures/DeprecatedInterface.php | 12 - .../Tests/Fixtures/ExtendedFinalMethod.php | 17 - .../debug/Tests/Fixtures/FinalClass.php | 10 - .../debug/Tests/Fixtures/FinalMethod.php | 17 - .../Tests/Fixtures/NonDeprecatedInterface.php | 7 - .../debug/Tests/Fixtures/PEARClass.php | 5 - .../symfony/debug/Tests/Fixtures/Throwing.php | 3 - .../debug/Tests/Fixtures/ToStringThrower.php | 24 - .../debug/Tests/Fixtures/casemismatch.php | 7 - .../debug/Tests/Fixtures/notPsr0Bis.php | 7 - .../Tests/Fixtures/psr4/Psr4CaseMismatch.php | 7 - .../debug/Tests/Fixtures/reallyNotPsr0.php | 7 - .../debug/Tests/Fixtures2/RequiredTwice.php | 7 - vendor/symfony/debug/Tests/HeaderMock.php | 38 - .../debug/Tests/MockExceptionHandler.php | 24 - vendor/symfony/debug/composer.json | 40 - vendor/symfony/debug/phpunit.xml.dist | 33 - vendor/symfony/event-dispatcher/.gitignore | 3 - vendor/symfony/event-dispatcher/CHANGELOG.md | 37 - .../ContainerAwareEventDispatcher.php | 209 - .../Debug/TraceableEventDispatcher.php | 322 - .../TraceableEventDispatcherInterface.php | 34 - .../Debug/WrappedListener.php | 114 - .../RegisterListenersPass.php | 131 - vendor/symfony/event-dispatcher/Event.php | 58 - .../event-dispatcher/EventDispatcher.php | 236 - .../EventDispatcherInterface.php | 100 - .../EventSubscriberInterface.php | 46 - .../symfony/event-dispatcher/GenericEvent.php | 186 - .../ImmutableEventDispatcher.php | 101 - vendor/symfony/event-dispatcher/LICENSE | 19 - vendor/symfony/event-dispatcher/README.md | 15 - .../Tests/AbstractEventDispatcherTest.php | 442 - .../ContainerAwareEventDispatcherTest.php | 210 - .../Debug/TraceableEventDispatcherTest.php | 242 - .../RegisterListenersPassTest.php | 167 - .../Tests/EventDispatcherTest.php | 22 - .../event-dispatcher/Tests/EventTest.php | 55 - .../Tests/GenericEventTest.php | 140 - .../Tests/ImmutableEventDispatcherTest.php | 106 - vendor/symfony/event-dispatcher/composer.json | 47 - .../symfony/event-dispatcher/phpunit.xml.dist | 31 - vendor/symfony/http-foundation/.gitignore | 3 - .../symfony/http-foundation/AcceptHeader.php | 170 - .../http-foundation/AcceptHeaderItem.php | 224 - .../symfony/http-foundation/ApacheRequest.php | 43 - .../http-foundation/BinaryFileResponse.php | 359 - vendor/symfony/http-foundation/CHANGELOG.md | 149 - vendor/symfony/http-foundation/Cookie.php | 289 - .../Exception/ConflictingHeadersException.php | 21 - .../Exception/RequestExceptionInterface.php | 21 - .../SuspiciousOperationException.php | 20 - .../ExpressionRequestMatcher.php | 47 - .../File/Exception/AccessDeniedException.php | 28 - .../File/Exception/FileException.php | 21 - .../File/Exception/FileNotFoundException.php | 28 - .../Exception/UnexpectedTypeException.php | 20 - .../File/Exception/UploadException.php | 21 - vendor/symfony/http-foundation/File/File.php | 136 - .../File/MimeType/ExtensionGuesser.php | 96 - .../MimeType/ExtensionGuesserInterface.php | 27 - .../MimeType/FileBinaryMimeTypeGuesser.php | 85 - .../File/MimeType/FileinfoMimeTypeGuesser.php | 69 - .../MimeType/MimeTypeExtensionGuesser.php | 809 -- .../File/MimeType/MimeTypeGuesser.php | 144 - .../MimeType/MimeTypeGuesserInterface.php | 35 - .../symfony/http-foundation/File/Stream.php | 28 - .../http-foundation/File/UploadedFile.php | 296 - vendor/symfony/http-foundation/FileBag.php | 143 - vendor/symfony/http-foundation/HeaderBag.php | 323 - vendor/symfony/http-foundation/IpUtils.php | 148 - .../symfony/http-foundation/JsonResponse.php | 220 - vendor/symfony/http-foundation/LICENSE | 19 - .../symfony/http-foundation/ParameterBag.php | 236 - vendor/symfony/http-foundation/README.md | 14 - .../http-foundation/RedirectResponse.php | 103 - vendor/symfony/http-foundation/Request.php | 2112 ---- .../http-foundation/RequestMatcher.php | 178 - .../RequestMatcherInterface.php | 29 - .../symfony/http-foundation/RequestStack.php | 103 - vendor/symfony/http-foundation/Response.php | 1286 -- .../http-foundation/ResponseHeaderBag.php | 339 - vendor/symfony/http-foundation/ServerBag.php | 102 - .../Session/Attribute/AttributeBag.php | 155 - .../Attribute/AttributeBagInterface.php | 72 - .../Attribute/NamespacedAttributeBag.php | 158 - .../Session/Flash/AutoExpireFlashBag.php | 173 - .../Session/Flash/FlashBag.php | 164 - .../Session/Flash/FlashBagInterface.php | 95 - .../http-foundation/Session/Session.php | 257 - .../Session/SessionBagInterface.php | 48 - .../Session/SessionInterface.php | 182 - .../Handler/MemcacheSessionHandler.php | 117 - .../Handler/MemcachedSessionHandler.php | 123 - .../Storage/Handler/MongoDbSessionHandler.php | 228 - .../Handler/NativeFileSessionHandler.php | 54 - .../Storage/Handler/NativeSessionHandler.php | 21 - .../Storage/Handler/NullSessionHandler.php | 70 - .../Storage/Handler/PdoSessionHandler.php | 740 -- .../Handler/WriteCheckSessionHandler.php | 91 - .../Session/Storage/MetadataBag.php | 168 - .../Storage/MockArraySessionStorage.php | 266 - .../Storage/MockFileSessionStorage.php | 136 - .../Session/Storage/NativeSessionStorage.php | 421 - .../Storage/PhpBridgeSessionStorage.php | 62 - .../Session/Storage/Proxy/AbstractProxy.php | 124 - .../Session/Storage/Proxy/NativeProxy.php | 36 - .../Storage/Proxy/SessionHandlerProxy.php | 91 - .../Storage/SessionStorageInterface.php | 139 - .../http-foundation/StreamedResponse.php | 130 - .../Tests/AcceptHeaderItemTest.php | 113 - .../Tests/AcceptHeaderTest.php | 103 - .../Tests/ApacheRequestTest.php | 93 - .../Tests/BinaryFileResponseTest.php | 352 - .../http-foundation/Tests/CookieTest.php | 223 - .../Tests/ExpressionRequestMatcherTest.php | 69 - .../http-foundation/Tests/File/FakeFile.php | 45 - .../http-foundation/Tests/File/FileTest.php | 180 - .../Tests/File/Fixtures/.unknownextension | 1 - .../Tests/File/Fixtures/directory/.empty | 0 .../Tests/File/Fixtures/other-file.example | 0 .../http-foundation/Tests/File/Fixtures/test | Bin 35 -> 0 bytes .../Tests/File/Fixtures/test.gif | Bin 35 -> 0 bytes .../Tests/File/MimeType/MimeTypeTest.php | 90 - .../Tests/File/UploadedFileTest.php | 273 - .../http-foundation/Tests/FileBagTest.php | 162 - .../http-foundation/Tests/HeaderBagTest.php | 205 - .../http-foundation/Tests/IpUtilsTest.php | 85 - .../Tests/JsonResponseTest.php | 257 - .../Tests/ParameterBagTest.php | 194 - .../Tests/RedirectResponseTest.php | 97 - .../Tests/RequestMatcherTest.php | 151 - .../Tests/RequestStackTest.php | 70 - .../http-foundation/Tests/RequestTest.php | 2207 ---- .../Tests/ResponseHeaderBagTest.php | 339 - .../http-foundation/Tests/ResponseTest.php | 981 -- .../Tests/ResponseTestCase.php | 89 - .../http-foundation/Tests/ServerBagTest.php | 170 - .../Session/Attribute/AttributeBagTest.php | 189 - .../Attribute/NamespacedAttributeBagTest.php | 185 - .../Session/Flash/AutoExpireFlashBagTest.php | 156 - .../Tests/Session/Flash/FlashBagTest.php | 135 - .../Tests/Session/SessionTest.php | 224 - .../Handler/MemcacheSessionHandlerTest.php | 133 - .../Handler/MemcachedSessionHandlerTest.php | 139 - .../Handler/MongoDbSessionHandlerTest.php | 332 - .../Handler/NativeFileSessionHandlerTest.php | 77 - .../Handler/NativeSessionHandlerTest.php | 34 - .../Handler/NullSessionHandlerTest.php | 59 - .../Storage/Handler/PdoSessionHandlerTest.php | 370 - .../Handler/WriteCheckSessionHandlerTest.php | 95 - .../Tests/Session/Storage/MetadataBagTest.php | 142 - .../Storage/MockArraySessionStorageTest.php | 131 - .../Storage/MockFileSessionStorageTest.php | 127 - .../Storage/NativeSessionStorageTest.php | 247 - .../Storage/PhpBridgeSessionStorageTest.php | 96 - .../Storage/Proxy/AbstractProxyTest.php | 145 - .../Session/Storage/Proxy/NativeProxyTest.php | 36 - .../Storage/Proxy/SessionHandlerProxyTest.php | 124 - .../Tests/StreamedResponseTest.php | 115 - .../Tests/schema/http-status-codes.rng | 31 - .../Tests/schema/iana-registry.rng | 198 - vendor/symfony/http-foundation/composer.json | 37 - .../symfony/http-foundation/phpunit.xml.dist | 31 - vendor/symfony/http-kernel/.gitignore | 5 - vendor/symfony/http-kernel/Bundle/Bundle.php | 231 - .../http-kernel/Bundle/BundleInterface.php | 84 - vendor/symfony/http-kernel/CHANGELOG.md | 134 - .../CacheClearer/CacheClearerInterface.php | 27 - .../CacheClearer/ChainCacheClearer.php | 55 - .../CacheClearer/Psr6CacheClearer.php | 58 - .../http-kernel/CacheWarmer/CacheWarmer.php | 32 - .../CacheWarmer/CacheWarmerAggregate.php | 74 - .../CacheWarmer/CacheWarmerInterface.php | 32 - .../CacheWarmer/WarmableInterface.php | 27 - vendor/symfony/http-kernel/Client.php | 204 - .../Config/EnvParametersResource.php | 97 - .../http-kernel/Config/FileLocator.php | 54 - .../Controller/ArgumentResolver.php | 94 - .../ArgumentResolver/DefaultValueResolver.php | 40 - .../RequestAttributeValueResolver.php | 40 - .../ArgumentResolver/RequestValueResolver.php | 40 - .../ArgumentResolver/ServiceValueResolver.php | 48 - .../ArgumentResolver/SessionValueResolver.php | 46 - .../VariadicValueResolver.php | 48 - .../Controller/ArgumentResolverInterface.php | 35 - .../ArgumentValueResolverInterface.php | 43 - .../ContainerControllerResolver.php | 91 - .../Controller/ControllerReference.php | 44 - .../Controller/ControllerResolver.php | 261 - .../ControllerResolverInterface.php | 59 - .../Controller/TraceableArgumentResolver.php | 44 - .../TraceableControllerResolver.php | 74 - .../ControllerMetadata/ArgumentMetadata.php | 115 - .../ArgumentMetadataFactory.php | 129 - .../ArgumentMetadataFactoryInterface.php | 27 - .../DataCollector/AjaxDataCollector.php | 33 - .../DataCollector/ConfigDataCollector.php | 326 - .../DataCollector/DataCollector.php | 128 - .../DataCollector/DataCollectorInterface.php | 39 - .../DataCollector/DumpDataCollector.php | 303 - .../DataCollector/EventDataCollector.php | 108 - .../DataCollector/ExceptionDataCollector.php | 104 - .../LateDataCollectorInterface.php | 25 - .../DataCollector/LoggerDataCollector.php | 262 - .../DataCollector/MemoryDataCollector.php | 112 - .../DataCollector/RequestDataCollector.php | 397 - .../DataCollector/RouterDataCollector.php | 102 - .../DataCollector/TimeDataCollector.php | 136 - .../DataCollector/Util/ValueExporter.php | 99 - .../http-kernel/Debug/FileLinkFormatter.php | 88 - .../Debug/TraceableEventDispatcher.php | 82 - .../AddAnnotatedClassesToCachePass.php | 153 - .../AddClassesToCachePass.php | 25 - .../ConfigurableExtension.php | 45 - .../ControllerArgumentValueResolverPass.php | 48 - .../DependencyInjection/Extension.php | 77 - .../FragmentRendererPass.php | 67 - .../LazyLoadingFragmentHandler.php | 79 - .../MergeExtensionConfigurationPass.php | 41 - ...RegisterControllerArgumentLocatorsPass.php | 159 - ...oveEmptyControllerArgumentLocatorsPass.php | 76 - .../Event/FilterControllerArgumentsEvent.php | 55 - .../Event/FilterControllerEvent.php | 61 - .../http-kernel/Event/FilterResponseEvent.php | 62 - .../http-kernel/Event/FinishRequestEvent.php | 21 - .../http-kernel/Event/GetResponseEvent.php | 65 - .../GetResponseForControllerResultEvent.php | 61 - .../Event/GetResponseForExceptionEvent.php | 90 - .../symfony/http-kernel/Event/KernelEvent.php | 94 - .../http-kernel/Event/PostResponseEvent.php | 46 - .../EventListener/AbstractSessionListener.php | 54 - .../AbstractTestSessionListener.php | 84 - .../AddRequestFormatsListener.php | 57 - .../EventListener/DebugHandlersListener.php | 146 - .../EventListener/DumpListener.php | 59 - .../EventListener/ExceptionListener.php | 116 - .../EventListener/FragmentListener.php | 101 - .../EventListener/LocaleListener.php | 83 - .../EventListener/ProfilerListener.php | 132 - .../EventListener/ResponseListener.php | 58 - .../EventListener/RouterListener.php | 138 - .../EventListener/SaveSessionListener.php | 66 - .../EventListener/SessionListener.php | 40 - .../StreamedResponseListener.php | 51 - .../EventListener/SurrogateListener.php | 70 - .../EventListener/TestSessionListener.php | 40 - .../EventListener/TranslatorListener.php | 69 - .../EventListener/ValidateRequestListener.php | 55 - .../Exception/AccessDeniedHttpException.php | 29 - .../Exception/BadRequestHttpException.php | 28 - .../Exception/ConflictHttpException.php | 28 - .../Exception/GoneHttpException.php | 28 - .../http-kernel/Exception/HttpException.php | 51 - .../Exception/HttpExceptionInterface.php | 34 - .../Exception/LengthRequiredHttpException.php | 28 - .../MethodNotAllowedHttpException.php | 31 - .../Exception/NotAcceptableHttpException.php | 28 - .../Exception/NotFoundHttpException.php | 28 - .../PreconditionFailedHttpException.php | 28 - .../PreconditionRequiredHttpException.php | 30 - .../ServiceUnavailableHttpException.php | 34 - .../TooManyRequestsHttpException.php | 36 - .../Exception/UnauthorizedHttpException.php | 31 - .../UnprocessableEntityHttpException.php | 28 - .../UnsupportedMediaTypeHttpException.php | 28 - .../AbstractSurrogateFragmentRenderer.php | 110 - .../Fragment/EsiFragmentRenderer.php | 28 - .../http-kernel/Fragment/FragmentHandler.php | 116 - .../Fragment/FragmentRendererInterface.php | 42 - .../Fragment/HIncludeFragmentRenderer.php | 165 - .../Fragment/InlineFragmentRenderer.php | 156 - .../Fragment/RoutableFragmentRenderer.php | 90 - .../Fragment/SsiFragmentRenderer.php | 28 - .../HttpCache/AbstractSurrogate.php | 136 - vendor/symfony/http-kernel/HttpCache/Esi.php | 115 - .../http-kernel/HttpCache/HttpCache.php | 731 -- .../HttpCache/ResponseCacheStrategy.php | 96 - .../ResponseCacheStrategyInterface.php | 41 - vendor/symfony/http-kernel/HttpCache/Ssi.php | 98 - .../symfony/http-kernel/HttpCache/Store.php | 506 - .../http-kernel/HttpCache/StoreInterface.php | 96 - .../HttpCache/SurrogateInterface.php | 103 - vendor/symfony/http-kernel/HttpKernel.php | 301 - .../http-kernel/HttpKernelInterface.php | 43 - vendor/symfony/http-kernel/Kernel.php | 864 -- vendor/symfony/http-kernel/KernelEvents.php | 119 - .../symfony/http-kernel/KernelInterface.php | 164 - vendor/symfony/http-kernel/LICENSE | 19 - .../http-kernel/Log/DebugLoggerInterface.php | 38 - .../Profiler/FileProfilerStorage.php | 292 - .../symfony/http-kernel/Profiler/Profile.php | 293 - .../symfony/http-kernel/Profiler/Profiler.php | 268 - .../Profiler/ProfilerStorageInterface.php | 59 - vendor/symfony/http-kernel/README.md | 16 - .../http-kernel/TerminableInterface.php | 35 - .../http-kernel/Tests/Bundle/BundleTest.php | 100 - .../CacheClearer/ChainCacheClearerTest.php | 58 - .../CacheClearer/Psr6CacheClearerTest.php | 69 - .../CacheWarmer/CacheWarmerAggregateTest.php | 101 - .../Tests/CacheWarmer/CacheWarmerTest.php | 68 - .../symfony/http-kernel/Tests/ClientTest.php | 183 - .../Config/EnvParametersResourceTest.php | 107 - .../Tests/Config/FileLocatorTest.php | 48 - .../Tests/Controller/ArgumentResolverTest.php | 349 - .../ContainerControllerResolverTest.php | 198 - .../Controller/ControllerResolverTest.php | 331 - .../ArgumentMetadataFactoryTest.php | 148 - .../ArgumentMetadataTest.php | 46 - .../Tests/DataCollector/Compiler.log | 4 - .../DataCollector/ConfigDataCollectorTest.php | 66 - .../Tests/DataCollector/DataCollectorTest.php | 38 - .../DataCollector/DumpDataCollectorTest.php | 115 - .../ExceptionDataCollectorTest.php | 40 - .../DataCollector/LoggerDataCollectorTest.php | 126 - .../DataCollector/MemoryDataCollectorTest.php | 59 - .../RequestDataCollectorTest.php | 287 - .../DataCollector/TimeDataCollectorTest.php | 55 - .../DataCollector/Util/ValueExporterTest.php | 51 - .../Tests/Debug/FileLinkFormatterTest.php | 67 - .../Debug/TraceableEventDispatcherTest.php | 121 - .../AddAnnotatedClassesToCachePassTest.php | 99 - ...ontrollerArgumentValueResolverPassTest.php | 67 - .../FragmentRendererPassTest.php | 105 - .../LazyLoadingFragmentHandlerTest.php | 66 - .../MergeExtensionConfigurationPassTest.php | 55 - ...sterControllerArgumentLocatorsPassTest.php | 344 - ...mptyControllerArgumentLocatorsPassTest.php | 148 - .../GetResponseForExceptionEventTest.php | 27 - .../AddRequestFormatsListenerTest.php | 84 - .../DebugHandlersListenerTest.php | 135 - .../Tests/EventListener/DumpListenerTest.php | 81 - .../EventListener/ExceptionListenerTest.php | 149 - .../EventListener/FragmentListenerTest.php | 122 - .../EventListener/LocaleListenerTest.php | 103 - .../EventListener/ProfilerListenerTest.php | 71 - .../EventListener/ResponseListenerTest.php | 95 - .../EventListener/RouterListenerTest.php | 188 - .../EventListener/SurrogateListenerTest.php | 67 - .../EventListener/TestSessionListenerTest.php | 145 - .../EventListener/TranslatorListenerTest.php | 118 - .../ValidateRequestListenerTest.php | 43 - .../AccessDeniedHttpExceptionTest.php | 13 - .../Exception/BadRequestHttpExceptionTest.php | 13 - .../Exception/ConflictHttpExceptionTest.php | 13 - .../Tests/Exception/GoneHttpExceptionTest.php | 13 - .../Tests/Exception/HttpExceptionTest.php | 53 - .../LengthRequiredHttpExceptionTest.php | 13 - .../MethodNotAllowedHttpExceptionTest.php | 24 - .../NotAcceptableHttpExceptionTest.php | 13 - .../Exception/NotFoundHttpExceptionTest.php | 13 - .../PreconditionFailedHttpExceptionTest.php | 13 - .../PreconditionRequiredHttpExceptionTest.php | 13 - .../ServiceUnavailableHttpExceptionTest.php | 29 - .../TooManyRequestsHttpExceptionTest.php | 29 - .../UnauthorizedHttpExceptionTest.php | 24 - .../UnprocessableEntityHttpExceptionTest.php | 28 - .../UnsupportedMediaTypeHttpExceptionTest.php | 23 - .../Tests/Fixtures/123/Kernel123.php | 37 - .../Fixtures/BaseBundle/Resources/foo.txt | 0 .../Fixtures/BaseBundle/Resources/hide.txt | 0 .../Fixtures/Bundle1Bundle/Resources/foo.txt | 0 .../Tests/Fixtures/Bundle1Bundle/bar.txt | 0 .../Tests/Fixtures/Bundle1Bundle/foo.txt | 0 .../Tests/Fixtures/Bundle2Bundle/foo.txt | 0 .../Fixtures/ChildBundle/Resources/foo.txt | 0 .../Fixtures/ChildBundle/Resources/hide.txt | 0 .../Controller/BasicTypesController.php | 19 - .../Fixtures/Controller/ExtendingRequest.php | 18 - .../Fixtures/Controller/ExtendingSession.php | 18 - .../Controller/NullableController.php | 19 - .../Controller/VariadicController.php | 19 - .../DataCollector/CloneVarDataCollector.php | 41 - .../ExtensionAbsentBundle.php | 18 - .../ExtensionLoadedExtension.php | 22 - .../ExtensionLoadedBundle.php | 18 - .../ExtensionNotValidExtension.php | 20 - .../ExtensionNotValidBundle.php | 18 - .../Command/BarCommand.php | 17 - .../Command/FooCommand.php | 22 - .../ExtensionPresentExtension.php | 22 - .../ExtensionPresentBundle.php | 18 - .../Tests/Fixtures/KernelForOverrideName.php | 28 - .../Tests/Fixtures/KernelForTest.php | 37 - .../Tests/Fixtures/KernelWithoutBundles.php | 33 - .../Fixtures/Resources/BaseBundle/hide.txt | 0 .../Fixtures/Resources/Bundle1Bundle/foo.txt | 0 .../Fixtures/Resources/ChildBundle/foo.txt | 0 .../Fixtures/Resources/FooBundle/foo.txt | 0 .../http-kernel/Tests/Fixtures/TestClient.php | 31 - .../Tests/Fixtures/TestEventDispatcher.php | 28 - .../Fragment/EsiFragmentRendererTest.php | 110 - .../Tests/Fragment/FragmentHandlerTest.php | 99 - .../Fragment/HIncludeFragmentRendererTest.php | 89 - .../Fragment/InlineFragmentRendererTest.php | 250 - .../Fragment/RoutableFragmentRendererTest.php | 94 - .../Fragment/SsiFragmentRendererTest.php | 97 - .../http-kernel/Tests/HttpCache/EsiTest.php | 248 - .../Tests/HttpCache/HttpCacheTest.php | 1482 --- .../Tests/HttpCache/HttpCacheTestCase.php | 185 - .../HttpCache/ResponseCacheStrategyTest.php | 222 - .../http-kernel/Tests/HttpCache/SsiTest.php | 215 - .../http-kernel/Tests/HttpCache/StoreTest.php | 301 - .../Tests/HttpCache/TestHttpKernel.php | 92 - .../HttpCache/TestMultipleHttpKernel.php | 81 - .../http-kernel/Tests/HttpKernelTest.php | 403 - .../symfony/http-kernel/Tests/KernelTest.php | 907 -- vendor/symfony/http-kernel/Tests/Logger.php | 88 - .../Profiler/FileProfilerStorageTest.php | 350 - .../Tests/Profiler/ProfilerTest.php | 91 - .../http-kernel/Tests/TestHttpKernel.php | 42 - .../http-kernel/Tests/UriSignerTest.php | 64 - vendor/symfony/http-kernel/UriSigner.php | 110 - vendor/symfony/http-kernel/composer.json | 70 - vendor/symfony/http-kernel/phpunit.xml.dist | 40 - vendor/symfony/polyfill-mbstring/LICENSE | 19 - vendor/symfony/polyfill-mbstring/Mbstring.php | 664 - vendor/symfony/polyfill-mbstring/README.md | 13 - .../Resources/unidata/lowerCase.php | 1101 -- .../Resources/unidata/upperCase.php | 1109 -- .../symfony/polyfill-mbstring/bootstrap.php | 56 - .../symfony/polyfill-mbstring/composer.json | 34 - vendor/symfony/routing/.gitignore | 3 - vendor/symfony/routing/Annotation/Route.php | 144 - vendor/symfony/routing/CHANGELOG.md | 219 - vendor/symfony/routing/CompiledRoute.php | 169 - .../RoutingResolverPass.php | 46 - .../routing/Exception/ExceptionInterface.php | 21 - .../Exception/InvalidParameterException.php | 21 - .../Exception/MethodNotAllowedException.php | 44 - .../MissingMandatoryParametersException.php | 22 - .../Exception/ResourceNotFoundException.php | 23 - .../Exception/RouteNotFoundException.php | 21 - .../ConfigurableRequirementsInterface.php | 55 - .../Generator/Dumper/GeneratorDumper.php | 43 - .../Dumper/GeneratorDumperInterface.php | 39 - .../Generator/Dumper/PhpGeneratorDumper.php | 118 - .../routing/Generator/UrlGenerator.php | 337 - .../Generator/UrlGeneratorInterface.php | 86 - vendor/symfony/routing/LICENSE | 19 - .../routing/Loader/AnnotationClassLoader.php | 268 - .../Loader/AnnotationDirectoryLoader.php | 89 - .../routing/Loader/AnnotationFileLoader.php | 145 - .../symfony/routing/Loader/ClosureLoader.php | 46 - .../ServiceRouterLoader.php | 40 - .../routing/Loader/DirectoryLoader.php | 58 - .../routing/Loader/ObjectRouteLoader.php | 95 - .../symfony/routing/Loader/PhpFileLoader.php | 66 - .../symfony/routing/Loader/XmlFileLoader.php | 342 - .../symfony/routing/Loader/YamlFileLoader.php | 216 - .../Loader/schema/routing/routing-1.0.xsd | 146 - .../Matcher/Dumper/DumperCollection.php | 161 - .../routing/Matcher/Dumper/DumperRoute.php | 64 - .../routing/Matcher/Dumper/MatcherDumper.php | 43 - .../Matcher/Dumper/MatcherDumperInterface.php | 39 - .../Matcher/Dumper/PhpMatcherDumper.php | 426 - .../Matcher/Dumper/StaticPrefixCollection.php | 238 - .../Matcher/RedirectableUrlMatcher.php | 65 - .../RedirectableUrlMatcherInterface.php | 31 - .../Matcher/RequestMatcherInterface.php | 39 - .../routing/Matcher/TraceableUrlMatcher.php | 141 - vendor/symfony/routing/Matcher/UrlMatcher.php | 264 - .../routing/Matcher/UrlMatcherInterface.php | 39 - vendor/symfony/routing/README.md | 13 - vendor/symfony/routing/RequestContext.php | 342 - .../routing/RequestContextAwareInterface.php | 29 - vendor/symfony/routing/Route.php | 587 - vendor/symfony/routing/RouteCollection.php | 277 - .../routing/RouteCollectionBuilder.php | 383 - vendor/symfony/routing/RouteCompiler.php | 319 - .../routing/RouteCompilerInterface.php | 32 - vendor/symfony/routing/Router.php | 386 - vendor/symfony/routing/RouterInterface.php | 32 - .../routing/Tests/Annotation/RouteTest.php | 50 - .../routing/Tests/CompiledRouteTest.php | 27 - .../RoutingResolverPassTest.php | 36 - .../AnnotatedClasses/AbstractClass.php | 16 - .../Fixtures/AnnotatedClasses/BarClass.php | 19 - .../Fixtures/AnnotatedClasses/BazClass.php | 19 - .../Fixtures/AnnotatedClasses/FooClass.php | 16 - .../Fixtures/AnnotatedClasses/FooTrait.php | 13 - .../Tests/Fixtures/CustomCompiledRoute.php | 18 - .../Tests/Fixtures/CustomRouteCompiler.php | 26 - .../Tests/Fixtures/CustomXmlFileLoader.php | 26 - .../OtherAnnotatedClasses/NoStartTagClass.php | 3 - .../OtherAnnotatedClasses/VariadicClass.php | 19 - .../Tests/Fixtures/RedirectableUrlMatcher.php | 30 - .../routing/Tests/Fixtures/annotated.php | 0 .../routing/Tests/Fixtures/bad_format.yml | 3 - vendor/symfony/routing/Tests/Fixtures/bar.xml | 0 .../Fixtures/directory/recurse/routes1.yml | 2 - .../Fixtures/directory/recurse/routes2.yml | 2 - .../Tests/Fixtures/directory/routes3.yml | 2 - .../Fixtures/directory_import/import.yml | 3 - .../Tests/Fixtures/dumper/url_matcher1.php | 312 - .../Tests/Fixtures/dumper/url_matcher2.php | 344 - .../Tests/Fixtures/dumper/url_matcher3.php | 53 - .../Tests/Fixtures/dumper/url_matcher4.php | 104 - .../Tests/Fixtures/dumper/url_matcher5.php | 153 - .../Tests/Fixtures/dumper/url_matcher6.php | 199 - .../Tests/Fixtures/dumper/url_matcher7.php | 223 - .../symfony/routing/Tests/Fixtures/empty.yml | 0 .../routing/Tests/Fixtures/file_resource.yml | 0 vendor/symfony/routing/Tests/Fixtures/foo.xml | 0 .../symfony/routing/Tests/Fixtures/foo1.xml | 0 .../routing/Tests/Fixtures/incomplete.yml | 2 - .../routing/Tests/Fixtures/list_defaults.xml | 20 - .../Tests/Fixtures/list_in_list_defaults.xml | 22 - .../Tests/Fixtures/list_in_map_defaults.xml | 22 - .../Tests/Fixtures/list_null_values.xml | 22 - .../routing/Tests/Fixtures/map_defaults.xml | 20 - .../Tests/Fixtures/map_in_list_defaults.xml | 22 - .../Tests/Fixtures/map_in_map_defaults.xml | 22 - .../Tests/Fixtures/map_null_values.xml | 22 - .../routing/Tests/Fixtures/missing_id.xml | 8 - .../routing/Tests/Fixtures/missing_path.xml | 8 - .../Tests/Fixtures/namespaceprefix.xml | 16 - .../Fixtures/nonesense_resource_plus_path.yml | 3 - .../nonesense_type_without_resource.yml | 3 - .../routing/Tests/Fixtures/nonvalid.xml | 10 - .../routing/Tests/Fixtures/nonvalid.yml | 1 - .../routing/Tests/Fixtures/nonvalid2.yml | 1 - .../routing/Tests/Fixtures/nonvalidkeys.yml | 3 - .../routing/Tests/Fixtures/nonvalidnode.xml | 8 - .../routing/Tests/Fixtures/nonvalidroute.xml | 12 - .../routing/Tests/Fixtures/null_values.xml | 12 - .../Tests/Fixtures/scalar_defaults.xml | 33 - .../Tests/Fixtures/special_route_name.yml | 2 - .../routing/Tests/Fixtures/validpattern.php | 18 - .../routing/Tests/Fixtures/validpattern.xml | 15 - .../routing/Tests/Fixtures/validpattern.yml | 13 - .../routing/Tests/Fixtures/validresource.php | 18 - .../routing/Tests/Fixtures/validresource.xml | 13 - .../routing/Tests/Fixtures/validresource.yml | 8 - .../Fixtures/with_define_path_variable.php | 5 - .../routing/Tests/Fixtures/withdoctype.xml | 3 - .../Dumper/PhpGeneratorDumperTest.php | 181 - .../Tests/Generator/UrlGeneratorTest.php | 692 -- .../Loader/AbstractAnnotationLoaderTest.php | 33 - .../Loader/AnnotationClassLoaderTest.php | 254 - .../Loader/AnnotationDirectoryLoaderTest.php | 80 - .../Tests/Loader/AnnotationFileLoaderTest.php | 80 - .../Tests/Loader/ClosureLoaderTest.php | 49 - .../Tests/Loader/DirectoryLoaderTest.php | 74 - .../Tests/Loader/ObjectRouteLoaderTest.php | 123 - .../Tests/Loader/PhpFileLoaderTest.php | 83 - .../Tests/Loader/XmlFileLoaderTest.php | 290 - .../Tests/Loader/YamlFileLoaderTest.php | 111 - .../Matcher/Dumper/DumperCollectionTest.php | 34 - .../Matcher/Dumper/PhpMatcherDumperTest.php | 386 - .../Dumper/StaticPrefixCollectionTest.php | 175 - .../Matcher/RedirectableUrlMatcherTest.php | 72 - .../Tests/Matcher/TraceableUrlMatcherTest.php | 122 - .../routing/Tests/Matcher/UrlMatcherTest.php | 430 - .../routing/Tests/RequestContextTest.php | 160 - .../Tests/RouteCollectionBuilderTest.php | 325 - .../routing/Tests/RouteCollectionTest.php | 305 - .../routing/Tests/RouteCompilerTest.php | 389 - vendor/symfony/routing/Tests/RouteTest.php | 258 - vendor/symfony/routing/Tests/RouterTest.php | 162 - vendor/symfony/routing/composer.json | 56 - vendor/symfony/routing/phpunit.xml.dist | 30 - vendor/symfony/twig-bridge/.gitignore | 3 - vendor/symfony/twig-bridge/AppVariable.php | 184 - vendor/symfony/twig-bridge/CHANGELOG.md | 90 - .../twig-bridge/Command/DebugCommand.php | 214 - .../twig-bridge/Command/LintCommand.php | 245 - .../DataCollector/TwigDataCollector.php | 162 - .../twig-bridge/Extension/AssetExtension.php | 81 - .../twig-bridge/Extension/CodeExtension.php | 264 - .../twig-bridge/Extension/DumpExtension.php | 84 - .../Extension/ExpressionExtension.php | 49 - .../twig-bridge/Extension/FormExtension.php | 194 - .../Extension/HttpFoundationExtension.php | 144 - .../Extension/HttpKernelExtension.php | 46 - .../Extension/HttpKernelRuntime.php | 64 - .../Extension/LogoutUrlExtension.php | 74 - .../Extension/ProfilerExtension.php | 60 - .../Extension/RoutingExtension.php | 119 - .../Extension/SecurityExtension.php | 68 - .../Extension/StopwatchExtension.php | 59 - .../Extension/TranslationExtension.php | 112 - .../Extension/WebLinkExtension.php | 139 - .../Extension/WorkflowExtension.php | 108 - .../twig-bridge/Extension/YamlExtension.php | 80 - .../symfony/twig-bridge/Form/TwigRenderer.php | 45 - .../twig-bridge/Form/TwigRendererEngine.php | 203 - .../Form/TwigRendererEngineInterface.php | 28 - .../Form/TwigRendererInterface.php | 28 - vendor/symfony/twig-bridge/LICENSE | 19 - vendor/symfony/twig-bridge/Node/DumpNode.php | 90 - .../twig-bridge/Node/FormThemeNode.php | 37 - .../twig-bridge/Node/RenderBlockNode.php | 45 - .../Node/SearchAndRenderBlockNode.php | 111 - .../twig-bridge/Node/StopwatchNode.php | 48 - .../Node/TransDefaultDomainNode.php | 32 - vendor/symfony/twig-bridge/Node/TransNode.php | 132 - .../symfony/twig-bridge/NodeVisitor/Scope.php | 125 - .../TranslationDefaultDomainNodeVisitor.php | 137 - .../NodeVisitor/TranslationNodeVisitor.php | 138 - vendor/symfony/twig-bridge/README.md | 13 - .../bootstrap_3_horizontal_layout.html.twig | 81 - .../views/Form/bootstrap_3_layout.html.twig | 283 - .../views/Form/form_div_layout.html.twig | 393 - .../views/Form/form_table_layout.html.twig | 44 - .../views/Form/foundation_5_layout.html.twig | 328 - .../twig-bridge/Tests/AppVariableTest.php | 270 - .../Tests/Command/LintCommandTest.php | 114 - .../Tests/Extension/CodeExtensionTest.php | 69 - .../Tests/Extension/DumpExtensionTest.php | 145 - .../Extension/ExpressionExtensionTest.php | 30 - .../Fixtures/StubFilesystemLoader.php | 25 - .../Extension/Fixtures/StubTranslator.php | 35 - .../templates/form/child_label.html.twig | 3 - .../templates/form/custom_widgets.html.twig | 25 - .../form/page_dynamic_extends.html.twig | 1 - .../templates/form/parent_label.html.twig | 3 - .../Fixtures/templates/form/theme.html.twig | 6 - .../templates/form/theme_extends.html.twig | 8 - .../templates/form/theme_use.html.twig | 8 - ...xtensionBootstrap3HorizontalLayoutTest.php | 103 - .../FormExtensionBootstrap3LayoutTest.php | 123 - .../Extension/FormExtensionDivLayoutTest.php | 211 - .../FormExtensionTableLayoutTest.php | 124 - .../Extension/HttpFoundationExtensionTest.php | 143 - .../Extension/HttpKernelExtensionTest.php | 92 - .../Tests/Extension/RoutingExtensionTest.php | 54 - .../Tests/Extension/RuntimeLoaderProvider.php | 27 - .../Extension/StopwatchExtensionTest.php | 76 - .../Extension/TranslationExtensionTest.php | 203 - .../Tests/Extension/WebLinkExtensionTest.php | 92 - .../Tests/Extension/WorkflowExtensionTest.php | 87 - .../Fixtures/extractor/syntax_error.twig | 1 - .../extractor/with_translations.html.twig | 1 - .../twig-bridge/Tests/Node/DumpNodeTest.php | 128 - .../twig-bridge/Tests/Node/FormThemeTest.php | 82 - .../Node/SearchAndRenderBlockNodeTest.php | 280 - .../twig-bridge/Tests/Node/TransNodeTest.php | 66 - .../Tests/NodeVisitor/ScopeTest.php | 25 - ...ranslationDefaultDomainNodeVisitorTest.php | 93 - .../TranslationNodeVisitorTest.php | 67 - .../Tests/NodeVisitor/TwigNodeProvider.php | 88 - .../TokenParser/FormThemeTokenParserTest.php | 105 - .../Tests/Translation/TwigExtractorTest.php | 152 - .../twig-bridge/Tests/TwigEngineTest.php | 81 - .../TokenParser/DumpTokenParser.php | 53 - .../TokenParser/FormThemeTokenParser.php | 65 - .../TokenParser/StopwatchTokenParser.php | 63 - .../TokenParser/TransChoiceTokenParser.php | 95 - .../TransDefaultDomainTokenParser.php | 51 - .../TokenParser/TransTokenParser.php | 96 - .../twig-bridge/Translation/TwigExtractor.php | 125 - vendor/symfony/twig-bridge/TwigEngine.php | 130 - vendor/symfony/twig-bridge/composer.json | 71 - vendor/symfony/twig-bridge/phpunit.xml.dist | 31 - vendor/twig/twig/.editorconfig | 18 - vendor/twig/twig/.gitignore | 3 - vendor/twig/twig/.php_cs.dist | 15 - vendor/twig/twig/.travis.yml | 29 - vendor/twig/twig/CHANGELOG | 1065 -- vendor/twig/twig/LICENSE | 31 - vendor/twig/twig/README.rst | 15 - vendor/twig/twig/composer.json | 56 - vendor/twig/twig/doc/advanced.rst | 917 -- vendor/twig/twig/doc/api.rst | 569 - vendor/twig/twig/doc/coding_standards.rst | 101 - vendor/twig/twig/doc/deprecated.rst | 18 - vendor/twig/twig/doc/filters/abs.rst | 18 - vendor/twig/twig/doc/filters/batch.rst | 48 - vendor/twig/twig/doc/filters/capitalize.rst | 11 - .../twig/doc/filters/convert_encoding.rst | 25 - vendor/twig/twig/doc/filters/date.rst | 82 - vendor/twig/twig/doc/filters/date_modify.rst | 20 - vendor/twig/twig/doc/filters/default.rst | 33 - vendor/twig/twig/doc/filters/escape.rst | 109 - vendor/twig/twig/doc/filters/first.rst | 22 - vendor/twig/twig/doc/filters/format.rst | 16 - vendor/twig/twig/doc/filters/index.rst | 37 - vendor/twig/twig/doc/filters/join.rst | 23 - vendor/twig/twig/doc/filters/json_encode.rst | 21 - vendor/twig/twig/doc/filters/keys.rst | 11 - vendor/twig/twig/doc/filters/last.rst | 22 - vendor/twig/twig/doc/filters/length.rst | 21 - vendor/twig/twig/doc/filters/lower.rst | 10 - vendor/twig/twig/doc/filters/merge.rst | 48 - vendor/twig/twig/doc/filters/nl2br.rst | 19 - .../twig/twig/doc/filters/number_format.rst | 50 - vendor/twig/twig/doc/filters/raw.rst | 36 - vendor/twig/twig/doc/filters/replace.rst | 19 - vendor/twig/twig/doc/filters/reverse.rst | 44 - vendor/twig/twig/doc/filters/round.rst | 34 - vendor/twig/twig/doc/filters/slice.rst | 68 - vendor/twig/twig/doc/filters/sort.rst | 18 - vendor/twig/twig/doc/filters/split.rst | 50 - vendor/twig/twig/doc/filters/striptags.rst | 29 - vendor/twig/twig/doc/filters/title.rst | 11 - vendor/twig/twig/doc/filters/trim.rst | 39 - vendor/twig/twig/doc/filters/upper.rst | 10 - vendor/twig/twig/doc/filters/url_encode.rst | 22 - vendor/twig/twig/doc/functions/attribute.rst | 23 - vendor/twig/twig/doc/functions/block.rst | 35 - vendor/twig/twig/doc/functions/constant.rst | 23 - vendor/twig/twig/doc/functions/cycle.rst | 28 - vendor/twig/twig/doc/functions/date.rst | 46 - vendor/twig/twig/doc/functions/dump.rst | 66 - vendor/twig/twig/doc/functions/include.rst | 77 - vendor/twig/twig/doc/functions/index.rst | 20 - vendor/twig/twig/doc/functions/max.rst | 17 - vendor/twig/twig/doc/functions/min.rst | 17 - vendor/twig/twig/doc/functions/parent.rst | 20 - vendor/twig/twig/doc/functions/random.rst | 23 - vendor/twig/twig/doc/functions/range.rst | 58 - vendor/twig/twig/doc/functions/source.rst | 26 - .../doc/functions/template_from_string.rst | 29 - vendor/twig/twig/doc/index.rst | 18 - vendor/twig/twig/doc/installation.rst | 34 - vendor/twig/twig/doc/internals.rst | 138 - vendor/twig/twig/doc/intro.rst | 78 - vendor/twig/twig/doc/recipes.rst | 527 - vendor/twig/twig/doc/tags/autoescape.rst | 61 - vendor/twig/twig/doc/tags/block.rst | 11 - vendor/twig/twig/doc/tags/do.rst | 9 - vendor/twig/twig/doc/tags/embed.rst | 175 - vendor/twig/twig/doc/tags/extends.rst | 265 - vendor/twig/twig/doc/tags/filter.rst | 21 - vendor/twig/twig/doc/tags/flush.rst | 14 - vendor/twig/twig/doc/tags/for.rst | 169 - vendor/twig/twig/doc/tags/from.rst | 8 - vendor/twig/twig/doc/tags/if.rst | 76 - vendor/twig/twig/doc/tags/import.rst | 57 - vendor/twig/twig/doc/tags/include.rst | 80 - vendor/twig/twig/doc/tags/index.rst | 25 - vendor/twig/twig/doc/tags/macro.rst | 96 - vendor/twig/twig/doc/tags/sandbox.rst | 30 - vendor/twig/twig/doc/tags/set.rst | 78 - vendor/twig/twig/doc/tags/spaceless.rst | 37 - vendor/twig/twig/doc/tags/use.rst | 117 - vendor/twig/twig/doc/tags/verbatim.rst | 16 - vendor/twig/twig/doc/tags/with.rst | 41 - vendor/twig/twig/doc/templates.rst | 890 -- vendor/twig/twig/doc/tests/constant.rst | 19 - vendor/twig/twig/doc/tests/defined.rst | 30 - vendor/twig/twig/doc/tests/divisibleby.rst | 10 - vendor/twig/twig/doc/tests/empty.rst | 22 - vendor/twig/twig/doc/tests/even.rst | 10 - vendor/twig/twig/doc/tests/index.rst | 15 - vendor/twig/twig/doc/tests/iterable.rst | 16 - vendor/twig/twig/doc/tests/null.rst | 12 - vendor/twig/twig/doc/tests/odd.rst | 10 - vendor/twig/twig/doc/tests/sameas.rst | 11 - vendor/twig/twig/lib/Twig/BaseNodeVisitor.php | 46 - .../twig/twig/lib/Twig/Cache/Filesystem.php | 91 - vendor/twig/twig/lib/Twig/Cache/Null.php | 38 - vendor/twig/twig/lib/Twig/CacheInterface.php | 58 - vendor/twig/twig/lib/Twig/Compiler.php | 241 - .../twig/lib/Twig/ContainerRuntimeLoader.php | 39 - vendor/twig/twig/lib/Twig/Environment.php | 965 -- vendor/twig/twig/lib/Twig/Error.php | 265 - vendor/twig/twig/lib/Twig/Error/Loader.php | 35 - vendor/twig/twig/lib/Twig/Error/Runtime.php | 22 - vendor/twig/twig/lib/Twig/Error/Syntax.php | 46 - .../twig/lib/Twig/ExistsLoaderInterface.php | 19 - .../twig/twig/lib/Twig/ExpressionParser.php | 716 -- vendor/twig/twig/lib/Twig/Extension.php | 46 - vendor/twig/twig/lib/Twig/Extension/Core.php | 1606 --- vendor/twig/twig/lib/Twig/Extension/Debug.php | 56 - .../twig/twig/lib/Twig/Extension/Escaper.php | 91 - .../lib/Twig/Extension/GlobalsInterface.php | 30 - .../Twig/Extension/InitRuntimeInterface.php | 32 - .../twig/lib/Twig/Extension/Optimizer.php | 27 - .../twig/twig/lib/Twig/Extension/Profiler.php | 44 - .../twig/twig/lib/Twig/Extension/Sandbox.php | 95 - .../twig/twig/lib/Twig/Extension/Staging.php | 94 - .../twig/lib/Twig/Extension/StringLoader.php | 39 - .../twig/twig/lib/Twig/ExtensionInterface.php | 63 - vendor/twig/twig/lib/Twig/ExtensionSet.php | 483 - .../twig/lib/Twig/FactoryRuntimeLoader.php | 39 - .../Twig/FileExtensionEscapingStrategy.php | 60 - vendor/twig/twig/lib/Twig/Filter.php | 142 - vendor/twig/twig/lib/Twig/Function.php | 132 - vendor/twig/twig/lib/Twig/Lexer.php | 395 - vendor/twig/twig/lib/Twig/Loader/Array.php | 81 - vendor/twig/twig/lib/Twig/Loader/Chain.php | 108 - .../twig/twig/lib/Twig/Loader/Filesystem.php | 284 - vendor/twig/twig/lib/Twig/LoaderInterface.php | 64 - vendor/twig/twig/lib/Twig/Markup.php | 44 - vendor/twig/twig/lib/Twig/Node.php | 185 - vendor/twig/twig/lib/Twig/Node/AutoEscape.php | 36 - vendor/twig/twig/lib/Twig/Node/Block.php | 41 - .../twig/lib/Twig/Node/BlockReference.php | 34 - vendor/twig/twig/lib/Twig/Node/Body.php | 21 - .../twig/twig/lib/Twig/Node/CheckSecurity.php | 80 - vendor/twig/twig/lib/Twig/Node/Do.php | 35 - vendor/twig/twig/lib/Twig/Node/Embed.php | 44 - vendor/twig/twig/lib/Twig/Node/Expression.php | 22 - .../twig/lib/Twig/Node/Expression/Array.php | 83 - .../lib/Twig/Node/Expression/AssignName.php | 25 - .../twig/lib/Twig/Node/Expression/Binary.php | 37 - .../lib/Twig/Node/Expression/Binary/Add.php | 20 - .../lib/Twig/Node/Expression/Binary/And.php | 20 - .../Node/Expression/Binary/BitwiseAnd.php | 20 - .../Twig/Node/Expression/Binary/BitwiseOr.php | 20 - .../Node/Expression/Binary/BitwiseXor.php | 20 - .../Twig/Node/Expression/Binary/Concat.php | 20 - .../lib/Twig/Node/Expression/Binary/Div.php | 20 - .../Twig/Node/Expression/Binary/EndsWith.php | 32 - .../lib/Twig/Node/Expression/Binary/Equal.php | 19 - .../Twig/Node/Expression/Binary/FloorDiv.php | 26 - .../Twig/Node/Expression/Binary/Greater.php | 19 - .../Node/Expression/Binary/GreaterEqual.php | 19 - .../lib/Twig/Node/Expression/Binary/In.php | 30 - .../lib/Twig/Node/Expression/Binary/Less.php | 19 - .../Twig/Node/Expression/Binary/LessEqual.php | 19 - .../Twig/Node/Expression/Binary/Matches.php | 30 - .../lib/Twig/Node/Expression/Binary/Mod.php | 20 - .../lib/Twig/Node/Expression/Binary/Mul.php | 20 - .../Twig/Node/Expression/Binary/NotEqual.php | 19 - .../lib/Twig/Node/Expression/Binary/NotIn.php | 30 - .../lib/Twig/Node/Expression/Binary/Or.php | 20 - .../lib/Twig/Node/Expression/Binary/Power.php | 19 - .../lib/Twig/Node/Expression/Binary/Range.php | 30 - .../Node/Expression/Binary/StartsWith.php | 32 - .../lib/Twig/Node/Expression/Binary/Sub.php | 20 - .../Twig/Node/Expression/BlockReference.php | 84 - .../twig/lib/Twig/Node/Expression/Call.php | 286 - .../lib/Twig/Node/Expression/Conditional.php | 33 - .../lib/Twig/Node/Expression/Constant.php | 25 - .../twig/lib/Twig/Node/Expression/Filter.php | 36 - .../Twig/Node/Expression/Filter/Default.php | 45 - .../lib/Twig/Node/Expression/Function.php | 39 - .../twig/lib/Twig/Node/Expression/GetAttr.php | 66 - .../lib/Twig/Node/Expression/MethodCall.php | 43 - .../twig/lib/Twig/Node/Expression/Name.php | 82 - .../lib/Twig/Node/Expression/NullCoalesce.php | 48 - .../twig/lib/Twig/Node/Expression/Parent.php | 44 - .../lib/Twig/Node/Expression/TempName.php | 28 - .../twig/lib/Twig/Node/Expression/Test.php | 37 - .../Twig/Node/Expression/Test/Constant.php | 48 - .../lib/Twig/Node/Expression/Test/Defined.php | 61 - .../Twig/Node/Expression/Test/Divisibleby.php | 35 - .../lib/Twig/Node/Expression/Test/Even.php | 34 - .../lib/Twig/Node/Expression/Test/Null.php | 33 - .../lib/Twig/Node/Expression/Test/Odd.php | 34 - .../lib/Twig/Node/Expression/Test/Sameas.php | 31 - .../twig/lib/Twig/Node/Expression/Unary.php | 29 - .../lib/Twig/Node/Expression/Unary/Neg.php | 20 - .../lib/Twig/Node/Expression/Unary/Not.php | 20 - .../lib/Twig/Node/Expression/Unary/Pos.php | 20 - vendor/twig/twig/lib/Twig/Node/Flush.php | 33 - vendor/twig/twig/lib/Twig/Node/For.php | 113 - vendor/twig/twig/lib/Twig/Node/ForLoop.php | 52 - vendor/twig/twig/lib/Twig/Node/If.php | 68 - vendor/twig/twig/lib/Twig/Node/Import.php | 51 - vendor/twig/twig/lib/Twig/Node/Include.php | 90 - vendor/twig/twig/lib/Twig/Node/Macro.php | 106 - vendor/twig/twig/lib/Twig/Node/Module.php | 452 - vendor/twig/twig/lib/Twig/Node/Print.php | 36 - vendor/twig/twig/lib/Twig/Node/Sandbox.php | 44 - .../twig/lib/Twig/Node/SandboxedPrint.php | 51 - vendor/twig/twig/lib/Twig/Node/Set.php | 98 - vendor/twig/twig/lib/Twig/Node/Spaceless.php | 37 - vendor/twig/twig/lib/Twig/Node/Text.php | 36 - vendor/twig/twig/lib/Twig/Node/With.php | 64 - .../twig/lib/Twig/NodeCaptureInterface.php | 21 - .../twig/lib/Twig/NodeOutputInterface.php | 21 - vendor/twig/twig/lib/Twig/NodeTraverser.php | 78 - .../twig/lib/Twig/NodeVisitor/Escaper.php | 152 - .../twig/lib/Twig/NodeVisitor/Optimizer.php | 207 - .../lib/Twig/NodeVisitor/SafeAnalysis.php | 146 - .../twig/lib/Twig/NodeVisitor/Sandbox.php | 75 - .../twig/lib/Twig/NodeVisitorInterface.php | 45 - vendor/twig/twig/lib/Twig/Parser.php | 350 - .../twig/lib/Twig/Profiler/Dumper/Base.php | 62 - .../lib/Twig/Profiler/Dumper/Blackfire.php | 70 - .../twig/lib/Twig/Profiler/Dumper/Html.php | 45 - .../twig/lib/Twig/Profiler/Dumper/Text.php | 33 - .../lib/Twig/Profiler/Node/EnterProfile.php | 39 - .../lib/Twig/Profiler/Node/LeaveProfile.php | 33 - .../Twig/Profiler/NodeVisitor/Profiler.php | 65 - .../twig/twig/lib/Twig/Profiler/Profile.php | 174 - .../twig/lib/Twig/RuntimeLoaderInterface.php | 29 - .../twig/lib/Twig/Sandbox/SecurityError.php | 21 - .../Sandbox/SecurityNotAllowedFilterError.php | 33 - .../SecurityNotAllowedFunctionError.php | 33 - .../Sandbox/SecurityNotAllowedMethodError.php | 40 - .../SecurityNotAllowedPropertyError.php | 40 - .../Sandbox/SecurityNotAllowedTagError.php | 33 - .../twig/lib/Twig/Sandbox/SecurityPolicy.php | 123 - .../Twig/Sandbox/SecurityPolicyInterface.php | 26 - vendor/twig/twig/lib/Twig/SimpleFilter.php | 21 - vendor/twig/twig/lib/Twig/SimpleFunction.php | 21 - vendor/twig/twig/lib/Twig/SimpleTest.php | 21 - vendor/twig/twig/lib/Twig/Source.php | 51 - .../lib/Twig/SourceContextLoaderInterface.php | 19 - vendor/twig/twig/lib/Twig/Template.php | 417 - vendor/twig/twig/lib/Twig/TemplateWrapper.php | 127 - vendor/twig/twig/lib/Twig/Test.php | 94 - .../lib/Twig/Test/IntegrationTestCase.php | 240 - .../twig/twig/lib/Twig/Test/NodeTestCase.php | 63 - vendor/twig/twig/lib/Twig/Token.php | 205 - vendor/twig/twig/lib/Twig/TokenParser.php | 33 - .../twig/lib/Twig/TokenParser/AutoEscape.php | 50 - .../twig/twig/lib/Twig/TokenParser/Block.php | 71 - vendor/twig/twig/lib/Twig/TokenParser/Do.php | 32 - .../twig/twig/lib/Twig/TokenParser/Embed.php | 65 - .../twig/lib/Twig/TokenParser/Extends.php | 44 - .../twig/twig/lib/Twig/TokenParser/Filter.php | 51 - .../twig/twig/lib/Twig/TokenParser/Flush.php | 32 - vendor/twig/twig/lib/Twig/TokenParser/For.php | 125 - .../twig/twig/lib/Twig/TokenParser/From.php | 60 - vendor/twig/twig/lib/Twig/TokenParser/If.php | 84 - .../twig/twig/lib/Twig/TokenParser/Import.php | 39 - .../twig/lib/Twig/TokenParser/Include.php | 65 - .../twig/twig/lib/Twig/TokenParser/Macro.php | 58 - .../twig/lib/Twig/TokenParser/Sandbox.php | 59 - vendor/twig/twig/lib/Twig/TokenParser/Set.php | 73 - .../twig/lib/Twig/TokenParser/Spaceless.php | 49 - vendor/twig/twig/lib/Twig/TokenParser/Use.php | 68 - .../twig/twig/lib/Twig/TokenParser/With.php | 50 - .../twig/lib/Twig/TokenParserInterface.php | 43 - vendor/twig/twig/lib/Twig/TokenStream.php | 150 - .../lib/Twig/Util/DeprecationCollector.php | 73 - .../lib/Twig/Util/TemplateDirIterator.php | 28 - vendor/twig/twig/phpunit.xml.dist | 33 - vendor/twig/twig/src/Cache/CacheInterface.php | 11 - .../twig/twig/src/Cache/FilesystemCache.php | 11 - vendor/twig/twig/src/Cache/NullCache.php | 11 - vendor/twig/twig/src/Compiler.php | 11 - vendor/twig/twig/src/Environment.php | 11 - vendor/twig/twig/src/Error/Error.php | 11 - vendor/twig/twig/src/Error/LoaderError.php | 11 - vendor/twig/twig/src/Error/RuntimeError.php | 11 - vendor/twig/twig/src/Error/SyntaxError.php | 11 - vendor/twig/twig/src/ExpressionParser.php | 11 - .../twig/src/Extension/AbstractExtension.php | 11 - .../twig/twig/src/Extension/CoreExtension.php | 11 - .../twig/src/Extension/DebugExtension.php | 11 - .../twig/src/Extension/EscaperExtension.php | 11 - .../twig/src/Extension/ExtensionInterface.php | 11 - .../twig/src/Extension/GlobalsInterface.php | 11 - .../src/Extension/InitRuntimeInterface.php | 11 - .../twig/src/Extension/OptimizerExtension.php | 11 - .../twig/src/Extension/ProfilerExtension.php | 11 - .../Extension/RuntimeExtensionInterface.php | 19 - .../twig/src/Extension/SandboxExtension.php | 11 - .../twig/src/Extension/StagingExtension.php | 11 - .../src/Extension/StringLoaderExtension.php | 11 - vendor/twig/twig/src/ExtensionSet.php | 11 - .../src/FileExtensionEscapingStrategy.php | 11 - vendor/twig/twig/src/Lexer.php | 11 - vendor/twig/twig/src/Loader/ArrayLoader.php | 11 - vendor/twig/twig/src/Loader/ChainLoader.php | 11 - .../twig/src/Loader/ExistsLoaderInterface.php | 11 - .../twig/twig/src/Loader/FilesystemLoader.php | 11 - .../twig/twig/src/Loader/LoaderInterface.php | 11 - .../Loader/SourceContextLoaderInterface.php | 11 - vendor/twig/twig/src/Markup.php | 11 - vendor/twig/twig/src/Node/AutoEscapeNode.php | 11 - vendor/twig/twig/src/Node/BlockNode.php | 11 - .../twig/twig/src/Node/BlockReferenceNode.php | 11 - vendor/twig/twig/src/Node/BodyNode.php | 11 - .../twig/twig/src/Node/CheckSecurityNode.php | 11 - vendor/twig/twig/src/Node/DoNode.php | 11 - vendor/twig/twig/src/Node/EmbedNode.php | 11 - .../Node/Expression/AbstractExpression.php | 11 - .../src/Node/Expression/ArrayExpression.php | 11 - .../Node/Expression/AssignNameExpression.php | 11 - .../Node/Expression/Binary/AbstractBinary.php | 11 - .../src/Node/Expression/Binary/AddBinary.php | 11 - .../src/Node/Expression/Binary/AndBinary.php | 11 - .../Expression/Binary/BitwiseAndBinary.php | 11 - .../Expression/Binary/BitwiseOrBinary.php | 11 - .../Expression/Binary/BitwiseXorBinary.php | 11 - .../Node/Expression/Binary/ConcatBinary.php | 11 - .../src/Node/Expression/Binary/DivBinary.php | 11 - .../Node/Expression/Binary/EndsWithBinary.php | 11 - .../Node/Expression/Binary/EqualBinary.php | 11 - .../Node/Expression/Binary/FloorDivBinary.php | 11 - .../Node/Expression/Binary/GreaterBinary.php | 11 - .../Expression/Binary/GreaterEqualBinary.php | 11 - .../src/Node/Expression/Binary/InBinary.php | 11 - .../src/Node/Expression/Binary/LessBinary.php | 11 - .../Expression/Binary/LessEqualBinary.php | 11 - .../Node/Expression/Binary/MatchesBinary.php | 11 - .../src/Node/Expression/Binary/ModBinary.php | 11 - .../src/Node/Expression/Binary/MulBinary.php | 11 - .../Node/Expression/Binary/NotEqualBinary.php | 11 - .../Node/Expression/Binary/NotInBinary.php | 11 - .../src/Node/Expression/Binary/OrBinary.php | 11 - .../Node/Expression/Binary/PowerBinary.php | 11 - .../Node/Expression/Binary/RangeBinary.php | 11 - .../Expression/Binary/StartsWithBinary.php | 11 - .../src/Node/Expression/Binary/SubBinary.php | 11 - .../Expression/BlockReferenceExpression.php | 11 - .../src/Node/Expression/CallExpression.php | 11 - .../Node/Expression/ConditionalExpression.php | 11 - .../Node/Expression/ConstantExpression.php | 11 - .../Node/Expression/Filter/DefaultFilter.php | 11 - .../src/Node/Expression/FilterExpression.php | 11 - .../Node/Expression/FunctionExpression.php | 11 - .../src/Node/Expression/GetAttrExpression.php | 11 - .../Node/Expression/MethodCallExpression.php | 11 - .../src/Node/Expression/NameExpression.php | 11 - .../Expression/NullCoalesceExpression.php | 11 - .../src/Node/Expression/ParentExpression.php | 11 - .../Node/Expression/TempNameExpression.php | 11 - .../src/Node/Expression/Test/ConstantTest.php | 11 - .../src/Node/Expression/Test/DefinedTest.php | 11 - .../Node/Expression/Test/DivisiblebyTest.php | 11 - .../src/Node/Expression/Test/EvenTest.php | 11 - .../src/Node/Expression/Test/NullTest.php | 11 - .../twig/src/Node/Expression/Test/OddTest.php | 11 - .../src/Node/Expression/Test/SameasTest.php | 11 - .../src/Node/Expression/TestExpression.php | 11 - .../Node/Expression/Unary/AbstractUnary.php | 11 - .../src/Node/Expression/Unary/NegUnary.php | 11 - .../src/Node/Expression/Unary/NotUnary.php | 11 - .../src/Node/Expression/Unary/PosUnary.php | 11 - vendor/twig/twig/src/Node/FlushNode.php | 11 - vendor/twig/twig/src/Node/ForLoopNode.php | 11 - vendor/twig/twig/src/Node/ForNode.php | 11 - vendor/twig/twig/src/Node/IfNode.php | 11 - vendor/twig/twig/src/Node/ImportNode.php | 11 - vendor/twig/twig/src/Node/IncludeNode.php | 11 - vendor/twig/twig/src/Node/MacroNode.php | 11 - vendor/twig/twig/src/Node/ModuleNode.php | 11 - vendor/twig/twig/src/Node/Node.php | 11 - .../twig/src/Node/NodeCaptureInterface.php | 11 - .../twig/src/Node/NodeOutputInterface.php | 11 - vendor/twig/twig/src/Node/PrintNode.php | 11 - vendor/twig/twig/src/Node/SandboxNode.php | 11 - .../twig/twig/src/Node/SandboxedPrintNode.php | 11 - vendor/twig/twig/src/Node/SetNode.php | 11 - vendor/twig/twig/src/Node/SetTempNode.php | 11 - vendor/twig/twig/src/Node/SpacelessNode.php | 11 - vendor/twig/twig/src/Node/TextNode.php | 11 - vendor/twig/twig/src/Node/WithNode.php | 11 - vendor/twig/twig/src/NodeTraverser.php | 11 - .../src/NodeVisitor/AbstractNodeVisitor.php | 11 - .../src/NodeVisitor/EscaperNodeVisitor.php | 11 - .../src/NodeVisitor/NodeVisitorInterface.php | 11 - .../src/NodeVisitor/OptimizerNodeVisitor.php | 11 - .../NodeVisitor/SafeAnalysisNodeVisitor.php | 11 - .../src/NodeVisitor/SandboxNodeVisitor.php | 11 - vendor/twig/twig/src/Parser.php | 11 - .../twig/src/Profiler/Dumper/BaseDumper.php | 11 - .../src/Profiler/Dumper/BlackfireDumper.php | 11 - .../twig/src/Profiler/Dumper/HtmlDumper.php | 11 - .../twig/src/Profiler/Dumper/TextDumper.php | 11 - .../src/Profiler/Node/EnterProfileNode.php | 11 - .../src/Profiler/Node/LeaveProfileNode.php | 11 - .../NodeVisitor/ProfilerNodeVisitor.php | 11 - vendor/twig/twig/src/Profiler/Profile.php | 11 - .../RuntimeLoader/ContainerRuntimeLoader.php | 11 - .../RuntimeLoader/FactoryRuntimeLoader.php | 11 - .../RuntimeLoader/RuntimeLoaderInterface.php | 11 - .../twig/twig/src/Sandbox/SecurityError.php | 11 - .../Sandbox/SecurityNotAllowedFilterError.php | 11 - .../SecurityNotAllowedFunctionError.php | 11 - .../Sandbox/SecurityNotAllowedMethodError.php | 11 - .../SecurityNotAllowedPropertyError.php | 11 - .../Sandbox/SecurityNotAllowedTagError.php | 11 - .../twig/twig/src/Sandbox/SecurityPolicy.php | 11 - .../src/Sandbox/SecurityPolicyInterface.php | 11 - vendor/twig/twig/src/Source.php | 11 - vendor/twig/twig/src/Template.php | 11 - vendor/twig/twig/src/TemplateWrapper.php | 11 - .../twig/src/Test/IntegrationTestCase.php | 11 - vendor/twig/twig/src/Test/NodeTestCase.php | 11 - vendor/twig/twig/src/Token.php | 11 - .../src/TokenParser/AbstractTokenParser.php | 11 - .../src/TokenParser/AutoEscapeTokenParser.php | 11 - .../twig/src/TokenParser/BlockTokenParser.php | 11 - .../twig/src/TokenParser/DoTokenParser.php | 11 - .../twig/src/TokenParser/EmbedTokenParser.php | 11 - .../src/TokenParser/ExtendsTokenParser.php | 11 - .../src/TokenParser/FilterTokenParser.php | 11 - .../twig/src/TokenParser/FlushTokenParser.php | 11 - .../twig/src/TokenParser/ForTokenParser.php | 11 - .../twig/src/TokenParser/FromTokenParser.php | 11 - .../twig/src/TokenParser/IfTokenParser.php | 11 - .../src/TokenParser/ImportTokenParser.php | 11 - .../src/TokenParser/IncludeTokenParser.php | 11 - .../twig/src/TokenParser/MacroTokenParser.php | 11 - .../src/TokenParser/SandboxTokenParser.php | 11 - .../twig/src/TokenParser/SetTokenParser.php | 11 - .../src/TokenParser/SpacelessTokenParser.php | 11 - .../src/TokenParser/TokenParserInterface.php | 11 - .../twig/src/TokenParser/UseTokenParser.php | 11 - .../twig/src/TokenParser/WithTokenParser.php | 11 - vendor/twig/twig/src/TokenStream.php | 11 - vendor/twig/twig/src/TwigFilter.php | 11 - vendor/twig/twig/src/TwigFunction.php | 11 - vendor/twig/twig/src/TwigTest.php | 11 - .../twig/src/Util/DeprecationCollector.php | 11 - .../twig/src/Util/TemplateDirIterator.php | 11 - .../test/Twig/Tests/Cache/FilesystemTest.php | 193 - .../twig/test/Twig/Tests/CompilerTest.php | 33 - .../Twig/Tests/ContainerRuntimeLoaderTest.php | 35 - .../test/Twig/Tests/CustomExtensionTest.php | 78 - .../twig/test/Twig/Tests/EnvironmentTest.php | 549 - .../twig/twig/test/Twig/Tests/ErrorTest.php | 212 - .../test/Twig/Tests/ExpressionParserTest.php | 377 - .../test/Twig/Tests/Extension/CoreTest.php | 347 - .../test/Twig/Tests/Extension/SandboxTest.php | 303 - .../Twig/Tests/FactoryRuntimeLoaderTest.php | 32 - .../FileExtensionEscapingStrategyTest.php | 51 - .../twig/test/Twig/Tests/FilesystemHelper.php | 26 - .../Twig/Tests/Fixtures/autoescape/block.test | 21 - .../Twig/Tests/Fixtures/autoescape/name.test | 22 - .../test/Twig/Tests/Fixtures/errors/base.html | 1 - .../Twig/Tests/Fixtures/errors/index.html | 7 - .../child_contents_outside_blocks.test | 15 - ...ltiline_array_with_undefined_variable.test | 18 - ...e_array_with_undefined_variable_again.test | 18 - ...line_function_with_undefined_variable.test | 12 - ...tiline_function_with_unknown_argument.test | 9 - ...multiline_tag_with_undefined_variable.test | 12 - .../syntax_error_in_reused_template.test | 10 - .../Fixtures/exceptions/unclosed_tag.test | 20 - .../Fixtures/exceptions/undefined_parent.test | 8 - .../undefined_template_in_child_template.test | 15 - .../Fixtures/exceptions/undefined_trait.test | 9 - .../Tests/Fixtures/expressions/_self.test | 8 - .../Tests/Fixtures/expressions/array.test | 61 - .../Fixtures/expressions/array_call.test | 14 - .../Tests/Fixtures/expressions/binary.test | 46 - .../Tests/Fixtures/expressions/bitwise.test | 14 - .../Fixtures/expressions/comparison.test | 14 - .../Fixtures/expressions/divisibleby.test | 17 - .../Tests/Fixtures/expressions/dotdot.test | 20 - .../Tests/Fixtures/expressions/ends_with.test | 26 - .../Tests/Fixtures/expressions/grouping.test | 8 - .../Tests/Fixtures/expressions/literals.test | 22 - .../Fixtures/expressions/magic_call.test | 27 - .../Tests/Fixtures/expressions/matches.test | 12 - .../Fixtures/expressions/method_call.test | 28 - .../expressions/negative_numbers.test | 18 - .../expressions/operators_as_variables.test | 16 - .../Tests/Fixtures/expressions/postfix.test | 22 - .../Tests/Fixtures/expressions/power.test | 20 - .../Tests/Fixtures/expressions/sameas.test | 21 - .../Fixtures/expressions/starts_with.test | 27 - .../Tests/Fixtures/expressions/strings.test | 10 - .../expressions/ternary_operator.test | 18 - .../expressions/ternary_operator_noelse.test | 10 - .../expressions/ternary_operator_nothen.test | 10 - .../two_word_operators_as_variables.test | 8 - .../Tests/Fixtures/expressions/unary.test | 12 - .../expressions/unary_macro_arguments.test | 22 - .../expressions/unary_precedence.test | 14 - .../extensions/anonymous_functions.test | 10 - .../test/Twig/Tests/Fixtures/filters/abs.test | 30 - .../Twig/Tests/Fixtures/filters/batch.test | 31 - .../Tests/Fixtures/filters/batch_float.test | 29 - .../filters/batch_with_empty_fill.test | 37 - .../filters/batch_with_exact_elements.test | 33 - .../Fixtures/filters/batch_with_fill.test | 37 - .../Fixtures/filters/batch_with_keys.test | 10 - .../filters/batch_with_zero_elements.test | 10 - .../Fixtures/filters/convert_encoding.test | 8 - .../Twig/Tests/Fixtures/filters/date.test | 90 - .../Fixtures/filters/date_default_format.test | 14 - .../filters/date_default_format_interval.test | 14 - .../Fixtures/filters/date_immutable.test | 35 - .../Tests/Fixtures/filters/date_interval.test | 17 - .../Tests/Fixtures/filters/date_modify.test | 14 - .../Fixtures/filters/date_namedargs.test | 13 - .../Twig/Tests/Fixtures/filters/default.test | 150 - .../Fixtures/filters/dynamic_filter.test | 10 - .../Twig/Tests/Fixtures/filters/escape.test | 8 - .../Fixtures/filters/escape_html_attr.test | 8 - .../Fixtures/filters/escape_javascript.test | 8 - .../filters/escape_non_supported_charset.test | 8 - .../Twig/Tests/Fixtures/filters/first.test | 17 - .../Tests/Fixtures/filters/force_escape.test | 18 - .../Twig/Tests/Fixtures/filters/format.test | 8 - .../Twig/Tests/Fixtures/filters/join.test | 12 - .../Tests/Fixtures/filters/json_encode.test | 12 - .../Twig/Tests/Fixtures/filters/last.test | 17 - .../Twig/Tests/Fixtures/filters/length.test | 31 - .../Tests/Fixtures/filters/length_utf8.test | 10 - .../Twig/Tests/Fixtures/filters/merge.test | 18 - .../Twig/Tests/Fixtures/filters/nl2br.test | 14 - .../Tests/Fixtures/filters/number_format.test | 18 - .../filters/number_format_default.test | 21 - .../Twig/Tests/Fixtures/filters/replace.test | 12 - .../Fixtures/filters/replace_invalid_arg.test | 8 - .../Twig/Tests/Fixtures/filters/reverse.test | 18 - .../Twig/Tests/Fixtures/filters/round.test | 22 - .../Twig/Tests/Fixtures/filters/slice.test | 54 - .../Twig/Tests/Fixtures/filters/sort.test | 12 - .../Tests/Fixtures/filters/special_chars.test | 8 - .../Twig/Tests/Fixtures/filters/split.test | 20 - .../Tests/Fixtures/filters/split_utf8.test | 22 - .../Tests/Fixtures/filters/static_calls.test | 10 - .../Twig/Tests/Fixtures/filters/trim.test | 24 - .../Tests/Fixtures/filters/urlencode.test | 14 - .../Tests/Fixtures/functions/attribute.test | 18 - .../Twig/Tests/Fixtures/functions/block.test | 12 - .../functions/block_with_template.test | 22 - .../functions/block_without_name.test | 12 - .../functions/block_without_parent.test | 11 - .../Tests/Fixtures/functions/constant.test | 10 - .../Twig/Tests/Fixtures/functions/cycle.test | 16 - .../Twig/Tests/Fixtures/functions/date.test | 27 - .../Fixtures/functions/date_namedargs.test | 11 - .../Twig/Tests/Fixtures/functions/dump.test | 16 - .../Tests/Fixtures/functions/dump_array.test | 19 - .../Fixtures/functions/dynamic_function.test | 10 - .../functions/include/assignment.test | 13 - .../functions/include/autoescaping.test | 10 - .../Fixtures/functions/include/basic.test | 17 - .../functions/include/expression.test | 17 - .../functions/include/ignore_missing.test | 10 - .../Fixtures/functions/include/missing.test | 8 - .../functions/include/missing_nested.test | 16 - .../Fixtures/functions/include/sandbox.test | 13 - .../functions/include/sandbox_disabling.test | 16 - .../sandbox_disabling_ignore_missing.test | 13 - .../functions/include/template_instance.test | 10 - .../functions/include/templates_as_array.test | 12 - .../functions/include/with_context.test | 16 - .../functions/include/with_variables.test | 12 - .../Tests/Fixtures/functions/magic_call.test | 8 - .../Fixtures/functions/magic_static_call.test | 10 - .../Twig/Tests/Fixtures/functions/max.test | 12 - .../Twig/Tests/Fixtures/functions/min.test | 12 - .../Twig/Tests/Fixtures/functions/range.test | 8 - .../recursive_block_with_inheritance.test | 21 - .../Twig/Tests/Fixtures/functions/source.test | 17 - .../Fixtures/functions/special_chars.test | 8 - .../Fixtures/functions/static_calls.test | 10 - .../functions/template_from_string.test | 15 - .../Tests/Fixtures/macros/default_values.test | 16 - .../Tests/Fixtures/macros/nested_calls.test | 18 - .../Fixtures/macros/reserved_variables.test | 14 - .../Twig/Tests/Fixtures/macros/simple.test | 22 - .../Twig/Tests/Fixtures/macros/varargs.test | 21 - .../Fixtures/macros/varargs_argument.test | 7 - .../Tests/Fixtures/macros/with_filters.test | 14 - .../regression/combined_debug_info.test | 15 - .../Fixtures/regression/empty_token.test | 8 - .../Tests/Fixtures/regression/issue_1143.test | 23 - .../Fixtures/regression/multi_word_tests.test | 10 - .../regression/simple_xml_element.test | 17 - .../regression/strings_like_numbers.test | 8 - .../Tests/Fixtures/tags/autoescape/basic.test | 22 - .../Fixtures/tags/autoescape/blocks.test | 12 - .../tags/autoescape/double_escaping.test | 10 - .../Fixtures/tags/autoescape/functions.test | 83 - .../Fixtures/tags/autoescape/literal.test | 45 - .../Fixtures/tags/autoescape/nested.test | 26 - .../Fixtures/tags/autoescape/objects.test | 26 - .../Tests/Fixtures/tags/autoescape/raw.test | 10 - .../Fixtures/tags/autoescape/strategy.test | 11 - .../Tests/Fixtures/tags/autoescape/type.test | 69 - .../tags/autoescape/with_filters.test | 131 - .../autoescape/with_filters_arguments.test | 23 - .../autoescape/with_pre_escape_filters.test | 68 - .../with_preserves_safety_filters.test | 50 - .../Twig/Tests/Fixtures/tags/block/basic.test | 11 - .../tags/block/block_unique_name.test | 11 - .../Fixtures/tags/block/special_chars.test | 10 - .../Twig/Tests/Fixtures/tags/embed/basic.test | 35 - .../tags/embed/complex_dynamic_parent.test | 35 - .../Fixtures/tags/embed/dynamic_parent.test | 35 - .../Tests/Fixtures/tags/embed/error_line.test | 16 - .../Tests/Fixtures/tags/embed/multiple.test | 50 - .../Tests/Fixtures/tags/embed/nested.test | 42 - .../Fixtures/tags/embed/with_extends.test | 60 - .../Tests/Fixtures/tags/filter/basic.test | 10 - .../Fixtures/tags/filter/json_encode.test | 8 - .../Tests/Fixtures/tags/filter/multiple.test | 10 - .../Tests/Fixtures/tags/filter/nested.test | 16 - .../Fixtures/tags/filter/with_for_tag.test | 13 - .../Fixtures/tags/filter/with_if_tag.test | 29 - .../Tests/Fixtures/tags/for/condition.test | 14 - .../Twig/Tests/Fixtures/tags/for/context.test | 18 - .../Twig/Tests/Fixtures/tags/for/else.test | 23 - .../Fixtures/tags/for/inner_variables.test | 17 - .../Twig/Tests/Fixtures/tags/for/keys.test | 11 - .../Fixtures/tags/for/keys_and_values.test | 11 - .../Tests/Fixtures/tags/for/loop_context.test | 19 - .../Fixtures/tags/for/loop_context_local.test | 10 - .../Fixtures/tags/for/loop_not_defined.test | 10 - .../tags/for/loop_not_defined_cond.test | 9 - .../Tests/Fixtures/tags/for/nested_else.test | 17 - .../Twig/Tests/Fixtures/tags/for/objects.test | 43 - .../Fixtures/tags/for/objects_countable.test | 47 - .../Tests/Fixtures/tags/for/recursive.test | 18 - .../Twig/Tests/Fixtures/tags/for/values.test | 11 - .../test/Twig/Tests/Fixtures/tags/from.test | 14 - .../Twig/Tests/Fixtures/tags/if/basic.test | 22 - .../Tests/Fixtures/tags/if/expression.test | 22 - .../Tests/Fixtures/tags/include/basic.test | 16 - .../Fixtures/tags/include/expression.test | 16 - .../Fixtures/tags/include/ignore_missing.test | 10 - .../Tests/Fixtures/tags/include/missing.test | 8 - .../Fixtures/tags/include/missing_nested.test | 16 - .../Tests/Fixtures/tags/include/only.test | 16 - .../tags/include/template_instance.test | 10 - .../tags/include/templates_as_array.test | 12 - .../Fixtures/tags/include/with_variables.test | 12 - .../Fixtures/tags/inheritance/basic.test | 14 - .../Fixtures/tags/inheritance/block_expr.test | 32 - .../tags/inheritance/block_expr2.test | 34 - .../tags/inheritance/conditional.test | 14 - .../Fixtures/tags/inheritance/dynamic.test | 14 - .../Fixtures/tags/inheritance/empty.test | 10 - .../tags/inheritance/extends_as_array.test | 12 - .../extends_as_array_with_empty_name.test | 12 - .../extends_as_array_with_null_name.test | 12 - .../Fixtures/tags/inheritance/multiple.test | 12 - .../tags/inheritance/multiple_dynamic.test | 22 - .../tags/inheritance/nested_blocks.test | 22 - .../nested_blocks_parent_only.test | 15 - .../tags/inheritance/nested_inheritance.test | 16 - .../Fixtures/tags/inheritance/parent.test | 12 - .../tags/inheritance/parent_change.test | 16 - .../tags/inheritance/parent_in_a_block.test | 8 - .../tags/inheritance/parent_isolation.test | 20 - .../tags/inheritance/parent_nested.test | 28 - .../inheritance/parent_without_extends.test | 8 - .../parent_without_extends_but_traits.test | 14 - .../tags/inheritance/template_instance.test | 14 - .../Tests/Fixtures/tags/inheritance/use.test | 44 - .../Twig/Tests/Fixtures/tags/macro/basic.test | 17 - .../Fixtures/tags/macro/endmacro_name.test | 16 - .../Tests/Fixtures/tags/macro/external.test | 17 - .../Twig/Tests/Fixtures/tags/macro/from.test | 18 - .../Tests/Fixtures/tags/macro/global.test | 14 - .../Fixtures/tags/macro/self_import.test | 17 - .../Fixtures/tags/macro/special_chars.test | 14 - .../Fixtures/tags/macro/super_globals.test | 14 - .../Fixtures/tags/sandbox/not_valid1.test | 11 - .../Fixtures/tags/sandbox/not_valid2.test | 14 - .../Tests/Fixtures/tags/sandbox/simple.test | 22 - .../Twig/Tests/Fixtures/tags/set/basic.test | 20 - .../Fixtures/tags/set/capture-empty.test | 9 - .../Twig/Tests/Fixtures/tags/set/capture.test | 10 - .../Tests/Fixtures/tags/set/expression.test | 12 - .../Tests/Fixtures/tags/spaceless/simple.test | 12 - .../Tests/Fixtures/tags/special_chars.test | 8 - .../Twig/Tests/Fixtures/tags/trim_block.test | 74 - .../Twig/Tests/Fixtures/tags/use/aliases.test | 12 - .../Twig/Tests/Fixtures/tags/use/basic.test | 12 - .../Twig/Tests/Fixtures/tags/use/deep.test | 22 - .../Tests/Fixtures/tags/use/deep_empty.test | 10 - .../Tests/Fixtures/tags/use/inheritance.test | 25 - .../Tests/Fixtures/tags/use/inheritance2.test | 24 - .../Tests/Fixtures/tags/use/multiple.test | 21 - .../Fixtures/tags/use/multiple_aliases.test | 23 - .../Tests/Fixtures/tags/use/parent_block.test | 24 - .../Fixtures/tags/use/parent_block2.test | 24 - .../Fixtures/tags/use/parent_block3.test | 38 - .../Fixtures/tags/use/use_with_parent.test | 24 - .../Tests/Fixtures/tags/verbatim/basic.test | 10 - .../tags/verbatim/whitespace_control.test | 56 - .../Twig/Tests/Fixtures/tags/with/basic.test | 13 - .../Tests/Fixtures/tags/with/expression.test | 10 - .../Twig/Tests/Fixtures/tags/with/nested.test | 15 - .../Fixtures/tags/with/with_no_hash.test | 10 - .../Tests/Fixtures/tags/with/with_only.test | 10 - .../test/Twig/Tests/Fixtures/tests/array.test | 24 - .../Twig/Tests/Fixtures/tests/constant.test | 14 - .../Twig/Tests/Fixtures/tests/defined.test | 129 - .../Fixtures/tests/defined_for_attribute.test | 35 - .../Fixtures/tests/defined_for_blocks.test | 38 - .../defined_for_blocks_with_template.test | 17 - .../Fixtures/tests/defined_for_constants.test | 14 - .../test/Twig/Tests/Fixtures/tests/empty.test | 42 - .../test/Twig/Tests/Fixtures/tests/even.test | 14 - .../test/Twig/Tests/Fixtures/tests/in.test | 128 - .../Tests/Fixtures/tests/in_with_objects.test | 19 - .../Twig/Tests/Fixtures/tests/iterable.test | 19 - .../Tests/Fixtures/tests/null_coalesce.test | 30 - .../test/Twig/Tests/Fixtures/tests/odd.test | 10 - .../twig/test/Twig/Tests/IntegrationTest.php | 311 - .../autoescape/filename.legacy.test | 18 - .../functions/undefined_block.legacy.test | 12 - .../twig/twig/test/Twig/Tests/LexerTest.php | 337 - .../twig/test/Twig/Tests/Loader/ArrayTest.php | 86 - .../twig/test/Twig/Tests/Loader/ChainTest.php | 90 - .../test/Twig/Tests/Loader/FilesystemTest.php | 223 - .../array_inheritance_empty_parent.html.twig | 3 - ...y_inheritance_nonexistent_parent.html.twig | 3 - .../array_inheritance_null_parent.html.twig | 3 - .../array_inheritance_valid_parent.html.twig | 3 - .../Fixtures/inheritance/parent.html.twig | 1 - .../inheritance/spare_parent.html.twig | 1 - .../Tests/Loader/Fixtures/named/index.html | 1 - .../Loader/Fixtures/named_bis/index.html | 1 - .../Loader/Fixtures/named_final/index.html | 1 - .../Fixtures/named_quater/named_absolute.html | 1 - .../Loader/Fixtures/named_ter/index.html | 1 - .../Tests/Loader/Fixtures/normal/index.html | 1 - .../Loader/Fixtures/normal_bis/index.html | 1 - .../Loader/Fixtures/normal_final/index.html | 1 - .../Loader/Fixtures/normal_ter/index.html | 1 - .../Loader/Fixtures/phar/phar-sample.phar | Bin 6786 -> 0 bytes .../Fixtures/themes/theme1/blocks.html.twig | 3 - .../Fixtures/themes/theme2/blocks.html.twig | 3 - .../test/Twig/Tests/NativeExtensionTest.php | 29 - .../test/Twig/Tests/Node/AutoEscapeTest.php | 32 - .../Twig/Tests/Node/BlockReferenceTest.php | 31 - .../twig/test/Twig/Tests/Node/BlockTest.php | 39 - .../twig/twig/test/Twig/Tests/Node/DoTest.php | 32 - .../Twig/Tests/Node/Expression/ArrayTest.php | 37 - .../Tests/Node/Expression/AssignNameTest.php | 29 - .../Tests/Node/Expression/Binary/AddTest.php | 34 - .../Tests/Node/Expression/Binary/AndTest.php | 34 - .../Node/Expression/Binary/ConcatTest.php | 34 - .../Tests/Node/Expression/Binary/DivTest.php | 34 - .../Node/Expression/Binary/FloorDivTest.php | 34 - .../Tests/Node/Expression/Binary/ModTest.php | 34 - .../Tests/Node/Expression/Binary/MulTest.php | 34 - .../Tests/Node/Expression/Binary/OrTest.php | 34 - .../Tests/Node/Expression/Binary/SubTest.php | 34 - .../Twig/Tests/Node/Expression/CallTest.php | 151 - .../Tests/Node/Expression/ConditionalTest.php | 38 - .../Tests/Node/Expression/ConstantTest.php | 30 - .../Twig/Tests/Node/Expression/FilterTest.php | 151 - .../Tests/Node/Expression/FunctionTest.php | 111 - .../Tests/Node/Expression/GetAttrTest.php | 50 - .../Twig/Tests/Node/Expression/NameTest.php | 39 - .../Node/Expression/NullCoalesceTest.php | 22 - .../Twig/Tests/Node/Expression/ParentTest.php | 28 - .../Twig/Tests/Node/Expression/TestTest.php | 79 - .../Tests/Node/Expression/Unary/NegTest.php | 32 - .../Tests/Node/Expression/Unary/NotTest.php | 31 - .../Tests/Node/Expression/Unary/PosTest.php | 31 - .../twig/test/Twig/Tests/Node/ForTest.php | 191 - .../twig/twig/test/Twig/Tests/Node/IfTest.php | 88 - .../twig/test/Twig/Tests/Node/ImportTest.php | 40 - .../twig/test/Twig/Tests/Node/IncludeTest.php | 83 - .../twig/test/Twig/Tests/Node/MacroTest.php | 60 - .../twig/test/Twig/Tests/Node/ModuleTest.php | 199 - .../twig/test/Twig/Tests/Node/PrintTest.php | 29 - .../twig/test/Twig/Tests/Node/SandboxTest.php | 44 - .../Twig/Tests/Node/SandboxedPrintTest.php | 33 - .../twig/test/Twig/Tests/Node/SetTest.php | 69 - .../test/Twig/Tests/Node/SpacelessTest.php | 37 - .../twig/test/Twig/Tests/Node/TextTest.php | 28 - .../Twig/Tests/NodeVisitor/OptimizerTest.php | 105 - .../twig/twig/test/Twig/Tests/ParserTest.php | 190 - .../Tests/Profiler/Dumper/AbstractTest.php | 101 - .../Tests/Profiler/Dumper/BlackfireTest.php | 32 - .../Twig/Tests/Profiler/Dumper/HtmlTest.php | 30 - .../Twig/Tests/Profiler/Dumper/TextTest.php | 30 - .../test/Twig/Tests/Profiler/ProfileTest.php | 110 - .../twig/test/Twig/Tests/TemplateTest.php | 699 -- .../test/Twig/Tests/TemplateWrapperTest.php | 64 - .../twig/test/Twig/Tests/TokenStreamTest.php | 70 - .../Tests/Util/DeprecationCollectorTest.php | 42 - .../twig/test/Twig/Tests/escapingTest.php | 320 - www/index.php | 0 2546 files changed, 207142 insertions(+), 177918 deletions(-) rename db/.DS_Store => .DS_Store (100%) create mode 100755 application/.htaccess create mode 100755 application/cache/index.html create mode 100755 application/config/autoload.php create mode 100755 application/config/config.php create mode 100755 application/config/constants.php create mode 100755 application/config/database.php create mode 100755 application/config/doctypes.php create mode 100755 application/config/foreign_chars.php create mode 100755 application/config/hooks.php create mode 100755 application/config/index.html create mode 100755 application/config/memcached.php create mode 100755 application/config/migration.php create mode 100755 application/config/mimes.php create mode 100755 application/config/profiler.php create mode 100755 application/config/routes.php create mode 100755 application/config/smileys.php create mode 100755 application/config/user_agents.php create mode 100755 application/controllers/Welcome.php create mode 100755 application/controllers/index.html create mode 100755 application/core/index.html create mode 100755 application/helpers/index.html create mode 100755 application/hooks/index.html create mode 100755 application/index.html create mode 100755 application/language/english/index.html create mode 100755 application/language/index.html create mode 100755 application/libraries/index.html create mode 100755 application/logs/index.html create mode 100755 application/models/index.html create mode 100755 application/third_party/index.html create mode 100755 application/views/errors/cli/error_404.php create mode 100755 application/views/errors/cli/error_db.php create mode 100755 application/views/errors/cli/error_exception.php create mode 100755 application/views/errors/cli/error_general.php create mode 100755 application/views/errors/cli/error_php.php create mode 100755 application/views/errors/cli/index.html create mode 100755 application/views/errors/html/error_404.php create mode 100755 application/views/errors/html/error_db.php create mode 100755 application/views/errors/html/error_exception.php create mode 100755 application/views/errors/html/error_general.php create mode 100755 application/views/errors/html/error_php.php create mode 100755 application/views/errors/html/index.html create mode 100755 application/views/errors/index.html create mode 100755 application/views/index.html create mode 100755 application/views/welcome_message.php mode change 100644 => 100755 composer.json delete mode 100644 composer.lock create mode 100755 contributing.md delete mode 100644 db/lamp_2017-11-05.sql create mode 100755 index.php rename vendor/heroku/heroku-buildpack-php/LICENSE => license.txt (90%) mode change 100644 => 100755 create mode 100755 readme.rst create mode 100755 system/.htaccess create mode 100755 system/core/Benchmark.php create mode 100755 system/core/CodeIgniter.php create mode 100755 system/core/Common.php create mode 100755 system/core/Config.php create mode 100755 system/core/Controller.php create mode 100755 system/core/Exceptions.php create mode 100755 system/core/Hooks.php create mode 100755 system/core/Input.php create mode 100755 system/core/Lang.php create mode 100755 system/core/Loader.php create mode 100755 system/core/Log.php create mode 100755 system/core/Model.php create mode 100755 system/core/Output.php create mode 100755 system/core/Router.php create mode 100755 system/core/Security.php create mode 100755 system/core/URI.php create mode 100755 system/core/Utf8.php create mode 100755 system/core/compat/hash.php create mode 100755 system/core/compat/index.html create mode 100755 system/core/compat/mbstring.php create mode 100755 system/core/compat/password.php create mode 100755 system/core/compat/standard.php create mode 100755 system/core/index.html create mode 100755 system/database/DB.php create mode 100755 system/database/DB_cache.php create mode 100755 system/database/DB_driver.php create mode 100755 system/database/DB_forge.php create mode 100755 system/database/DB_query_builder.php create mode 100755 system/database/DB_result.php create mode 100755 system/database/DB_utility.php create mode 100755 system/database/drivers/cubrid/cubrid_driver.php create mode 100755 system/database/drivers/cubrid/cubrid_forge.php create mode 100755 system/database/drivers/cubrid/cubrid_result.php create mode 100755 system/database/drivers/cubrid/cubrid_utility.php create mode 100755 system/database/drivers/cubrid/index.html create mode 100755 system/database/drivers/ibase/ibase_driver.php create mode 100755 system/database/drivers/ibase/ibase_forge.php create mode 100755 system/database/drivers/ibase/ibase_result.php create mode 100755 system/database/drivers/ibase/ibase_utility.php create mode 100755 system/database/drivers/ibase/index.html create mode 100755 system/database/drivers/index.html create mode 100755 system/database/drivers/mssql/index.html create mode 100755 system/database/drivers/mssql/mssql_driver.php create mode 100755 system/database/drivers/mssql/mssql_forge.php create mode 100755 system/database/drivers/mssql/mssql_result.php create mode 100755 system/database/drivers/mssql/mssql_utility.php create mode 100755 system/database/drivers/mysql/index.html create mode 100755 system/database/drivers/mysql/mysql_driver.php create mode 100755 system/database/drivers/mysql/mysql_forge.php create mode 100755 system/database/drivers/mysql/mysql_result.php create mode 100755 system/database/drivers/mysql/mysql_utility.php create mode 100755 system/database/drivers/mysqli/index.html create mode 100755 system/database/drivers/mysqli/mysqli_driver.php create mode 100755 system/database/drivers/mysqli/mysqli_forge.php create mode 100755 system/database/drivers/mysqli/mysqli_result.php create mode 100755 system/database/drivers/mysqli/mysqli_utility.php create mode 100755 system/database/drivers/oci8/index.html create mode 100755 system/database/drivers/oci8/oci8_driver.php create mode 100755 system/database/drivers/oci8/oci8_forge.php create mode 100755 system/database/drivers/oci8/oci8_result.php create mode 100755 system/database/drivers/oci8/oci8_utility.php create mode 100755 system/database/drivers/odbc/index.html create mode 100755 system/database/drivers/odbc/odbc_driver.php create mode 100755 system/database/drivers/odbc/odbc_forge.php create mode 100755 system/database/drivers/odbc/odbc_result.php create mode 100755 system/database/drivers/odbc/odbc_utility.php create mode 100755 system/database/drivers/pdo/index.html create mode 100755 system/database/drivers/pdo/pdo_driver.php create mode 100755 system/database/drivers/pdo/pdo_forge.php create mode 100755 system/database/drivers/pdo/pdo_result.php create mode 100755 system/database/drivers/pdo/pdo_utility.php create mode 100755 system/database/drivers/pdo/subdrivers/index.html create mode 100755 system/database/drivers/pdo/subdrivers/pdo_4d_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_4d_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_informix_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_informix_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_oci_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_oci_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php create mode 100755 system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php create mode 100755 system/database/drivers/postgre/index.html create mode 100755 system/database/drivers/postgre/postgre_driver.php create mode 100755 system/database/drivers/postgre/postgre_forge.php create mode 100755 system/database/drivers/postgre/postgre_result.php create mode 100755 system/database/drivers/postgre/postgre_utility.php create mode 100755 system/database/drivers/sqlite/index.html create mode 100755 system/database/drivers/sqlite/sqlite_driver.php create mode 100755 system/database/drivers/sqlite/sqlite_forge.php create mode 100755 system/database/drivers/sqlite/sqlite_result.php create mode 100755 system/database/drivers/sqlite/sqlite_utility.php create mode 100755 system/database/drivers/sqlite3/index.html create mode 100755 system/database/drivers/sqlite3/sqlite3_driver.php create mode 100755 system/database/drivers/sqlite3/sqlite3_forge.php create mode 100755 system/database/drivers/sqlite3/sqlite3_result.php create mode 100755 system/database/drivers/sqlite3/sqlite3_utility.php create mode 100755 system/database/drivers/sqlsrv/index.html create mode 100755 system/database/drivers/sqlsrv/sqlsrv_driver.php create mode 100755 system/database/drivers/sqlsrv/sqlsrv_forge.php create mode 100755 system/database/drivers/sqlsrv/sqlsrv_result.php create mode 100755 system/database/drivers/sqlsrv/sqlsrv_utility.php create mode 100755 system/database/index.html create mode 100755 system/fonts/index.html create mode 100755 system/fonts/texb.ttf create mode 100755 system/helpers/array_helper.php create mode 100755 system/helpers/captcha_helper.php create mode 100755 system/helpers/cookie_helper.php create mode 100755 system/helpers/date_helper.php create mode 100755 system/helpers/directory_helper.php create mode 100755 system/helpers/download_helper.php create mode 100755 system/helpers/email_helper.php create mode 100755 system/helpers/file_helper.php create mode 100755 system/helpers/form_helper.php create mode 100755 system/helpers/html_helper.php create mode 100755 system/helpers/index.html create mode 100755 system/helpers/inflector_helper.php create mode 100755 system/helpers/language_helper.php create mode 100755 system/helpers/number_helper.php create mode 100755 system/helpers/path_helper.php create mode 100755 system/helpers/security_helper.php create mode 100755 system/helpers/smiley_helper.php create mode 100755 system/helpers/string_helper.php create mode 100755 system/helpers/text_helper.php create mode 100755 system/helpers/typography_helper.php create mode 100755 system/helpers/url_helper.php create mode 100755 system/helpers/xml_helper.php create mode 100755 system/index.html create mode 100755 system/language/english/calendar_lang.php create mode 100755 system/language/english/date_lang.php create mode 100755 system/language/english/db_lang.php create mode 100755 system/language/english/email_lang.php create mode 100755 system/language/english/form_validation_lang.php create mode 100755 system/language/english/ftp_lang.php create mode 100755 system/language/english/imglib_lang.php create mode 100755 system/language/english/index.html create mode 100755 system/language/english/migration_lang.php rename vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php => system/language/english/number_lang.php (50%) mode change 100644 => 100755 rename vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php => system/language/english/pagination_lang.php (50%) mode change 100644 => 100755 create mode 100755 system/language/english/profiler_lang.php create mode 100755 system/language/english/unit_test_lang.php create mode 100755 system/language/english/upload_lang.php create mode 100755 system/language/index.html create mode 100755 system/libraries/Cache/Cache.php create mode 100755 system/libraries/Cache/drivers/Cache_apc.php create mode 100755 system/libraries/Cache/drivers/Cache_dummy.php create mode 100755 system/libraries/Cache/drivers/Cache_file.php create mode 100755 system/libraries/Cache/drivers/Cache_memcached.php create mode 100755 system/libraries/Cache/drivers/Cache_redis.php create mode 100755 system/libraries/Cache/drivers/Cache_wincache.php create mode 100755 system/libraries/Cache/drivers/index.html create mode 100755 system/libraries/Cache/index.html create mode 100755 system/libraries/Calendar.php create mode 100755 system/libraries/Cart.php create mode 100755 system/libraries/Driver.php create mode 100755 system/libraries/Email.php create mode 100755 system/libraries/Encrypt.php create mode 100755 system/libraries/Encryption.php create mode 100755 system/libraries/Form_validation.php create mode 100755 system/libraries/Ftp.php create mode 100755 system/libraries/Image_lib.php create mode 100755 system/libraries/Javascript.php create mode 100755 system/libraries/Javascript/Jquery.php create mode 100755 system/libraries/Javascript/index.html create mode 100755 system/libraries/Migration.php create mode 100755 system/libraries/Pagination.php create mode 100755 system/libraries/Parser.php create mode 100755 system/libraries/Profiler.php create mode 100755 system/libraries/Session/Session.php create mode 100755 system/libraries/Session/SessionHandlerInterface.php create mode 100755 system/libraries/Session/Session_driver.php create mode 100755 system/libraries/Session/drivers/Session_database_driver.php create mode 100755 system/libraries/Session/drivers/Session_files_driver.php create mode 100755 system/libraries/Session/drivers/Session_memcached_driver.php create mode 100755 system/libraries/Session/drivers/Session_redis_driver.php create mode 100755 system/libraries/Session/drivers/index.html create mode 100755 system/libraries/Session/index.html create mode 100755 system/libraries/Table.php create mode 100755 system/libraries/Trackback.php create mode 100755 system/libraries/Typography.php create mode 100755 system/libraries/Unit_test.php create mode 100755 system/libraries/Upload.php create mode 100755 system/libraries/User_agent.php create mode 100755 system/libraries/Xmlrpc.php create mode 100755 system/libraries/Xmlrpcs.php create mode 100755 system/libraries/Zip.php create mode 100755 system/libraries/index.html create mode 100755 user_guide/.buildinfo create mode 100755 user_guide/DCO.html create mode 100755 user_guide/_downloads/ELDocs.tmbundle.zip create mode 100755 user_guide/_images/appflowchart.gif create mode 100755 user_guide/_images/smile.gif create mode 100755 user_guide/_static/ajax-loader.gif create mode 100755 user_guide/_static/basic.css create mode 100755 user_guide/_static/ci-icon.ico create mode 100755 user_guide/_static/comment-bright.png create mode 100755 user_guide/_static/comment-close.png create mode 100755 user_guide/_static/comment.png create mode 100755 user_guide/_static/css/badge_only.css create mode 100755 user_guide/_static/css/citheme.css create mode 100755 user_guide/_static/css/theme.css create mode 100755 user_guide/_static/doctools.js create mode 100755 user_guide/_static/down-pressed.png create mode 100755 user_guide/_static/down.png create mode 100755 user_guide/_static/file.png create mode 100755 user_guide/_static/fonts/FontAwesome.otf create mode 100755 user_guide/_static/fonts/fontawesome-webfont.eot create mode 100755 user_guide/_static/fonts/fontawesome-webfont.svg create mode 100755 user_guide/_static/fonts/fontawesome-webfont.ttf create mode 100755 user_guide/_static/fonts/fontawesome-webfont.woff create mode 100755 user_guide/_static/images/ci-icon.ico create mode 100755 user_guide/_static/jquery-3.1.0.js create mode 100755 user_guide/_static/jquery.js create mode 100755 user_guide/_static/js/oldtheme.js create mode 100755 user_guide/_static/js/theme.js create mode 100755 user_guide/_static/minus.png create mode 100755 user_guide/_static/plus.png create mode 100755 user_guide/_static/pygments.css create mode 100755 user_guide/_static/searchtools.js create mode 100755 user_guide/_static/underscore-1.3.1.js create mode 100755 user_guide/_static/underscore.js create mode 100755 user_guide/_static/up-pressed.png create mode 100755 user_guide/_static/up.png create mode 100755 user_guide/_static/websupport.js create mode 100755 user_guide/changelog.html create mode 100755 user_guide/contributing/index.html create mode 100755 user_guide/database/caching.html create mode 100755 user_guide/database/call_function.html create mode 100755 user_guide/database/configuration.html create mode 100755 user_guide/database/connecting.html create mode 100755 user_guide/database/db_driver_reference.html create mode 100755 user_guide/database/examples.html create mode 100755 user_guide/database/forge.html create mode 100755 user_guide/database/helpers.html create mode 100755 user_guide/database/index.html create mode 100755 user_guide/database/metadata.html create mode 100755 user_guide/database/queries.html create mode 100755 user_guide/database/query_builder.html create mode 100755 user_guide/database/results.html create mode 100755 user_guide/database/transactions.html create mode 100755 user_guide/database/utilities.html create mode 100755 user_guide/documentation/index.html create mode 100755 user_guide/general/alternative_php.html create mode 100755 user_guide/general/ancillary_classes.html create mode 100755 user_guide/general/autoloader.html create mode 100755 user_guide/general/caching.html create mode 100755 user_guide/general/cli.html create mode 100755 user_guide/general/common_functions.html create mode 100755 user_guide/general/compatibility_functions.html create mode 100755 user_guide/general/controllers.html create mode 100755 user_guide/general/core_classes.html create mode 100755 user_guide/general/creating_drivers.html create mode 100755 user_guide/general/creating_libraries.html create mode 100755 user_guide/general/credits.html create mode 100755 user_guide/general/drivers.html create mode 100755 user_guide/general/environments.html create mode 100755 user_guide/general/errors.html create mode 100755 user_guide/general/helpers.html create mode 100755 user_guide/general/hooks.html create mode 100755 user_guide/general/index.html create mode 100755 user_guide/general/libraries.html create mode 100755 user_guide/general/managing_apps.html create mode 100755 user_guide/general/models.html create mode 100755 user_guide/general/profiling.html create mode 100755 user_guide/general/requirements.html create mode 100755 user_guide/general/reserved_names.html create mode 100755 user_guide/general/routing.html create mode 100755 user_guide/general/security.html create mode 100755 user_guide/general/styleguide.html create mode 100755 user_guide/general/urls.html create mode 100755 user_guide/general/views.html create mode 100755 user_guide/general/welcome.html create mode 100755 user_guide/genindex.html create mode 100755 user_guide/helpers/array_helper.html create mode 100755 user_guide/helpers/captcha_helper.html create mode 100755 user_guide/helpers/cookie_helper.html create mode 100755 user_guide/helpers/date_helper.html create mode 100755 user_guide/helpers/directory_helper.html create mode 100755 user_guide/helpers/download_helper.html create mode 100755 user_guide/helpers/email_helper.html create mode 100755 user_guide/helpers/file_helper.html create mode 100755 user_guide/helpers/form_helper.html create mode 100755 user_guide/helpers/html_helper.html create mode 100755 user_guide/helpers/index.html create mode 100755 user_guide/helpers/inflector_helper.html create mode 100755 user_guide/helpers/language_helper.html create mode 100755 user_guide/helpers/number_helper.html create mode 100755 user_guide/helpers/path_helper.html create mode 100755 user_guide/helpers/security_helper.html create mode 100755 user_guide/helpers/smiley_helper.html create mode 100755 user_guide/helpers/string_helper.html create mode 100755 user_guide/helpers/text_helper.html create mode 100755 user_guide/helpers/typography_helper.html create mode 100755 user_guide/helpers/url_helper.html create mode 100755 user_guide/helpers/xml_helper.html create mode 100755 user_guide/index.html create mode 100755 user_guide/installation/downloads.html create mode 100755 user_guide/installation/index.html create mode 100755 user_guide/installation/troubleshooting.html create mode 100755 user_guide/installation/upgrade_120.html create mode 100755 user_guide/installation/upgrade_130.html create mode 100755 user_guide/installation/upgrade_131.html create mode 100755 user_guide/installation/upgrade_132.html create mode 100755 user_guide/installation/upgrade_133.html create mode 100755 user_guide/installation/upgrade_140.html create mode 100755 user_guide/installation/upgrade_141.html create mode 100755 user_guide/installation/upgrade_150.html create mode 100755 user_guide/installation/upgrade_152.html create mode 100755 user_guide/installation/upgrade_153.html create mode 100755 user_guide/installation/upgrade_154.html create mode 100755 user_guide/installation/upgrade_160.html create mode 100755 user_guide/installation/upgrade_161.html create mode 100755 user_guide/installation/upgrade_162.html create mode 100755 user_guide/installation/upgrade_163.html create mode 100755 user_guide/installation/upgrade_170.html create mode 100755 user_guide/installation/upgrade_171.html create mode 100755 user_guide/installation/upgrade_172.html create mode 100755 user_guide/installation/upgrade_200.html create mode 100755 user_guide/installation/upgrade_201.html create mode 100755 user_guide/installation/upgrade_202.html create mode 100755 user_guide/installation/upgrade_203.html create mode 100755 user_guide/installation/upgrade_210.html create mode 100755 user_guide/installation/upgrade_211.html create mode 100755 user_guide/installation/upgrade_212.html create mode 100755 user_guide/installation/upgrade_213.html create mode 100755 user_guide/installation/upgrade_214.html create mode 100755 user_guide/installation/upgrade_220.html create mode 100755 user_guide/installation/upgrade_221.html create mode 100755 user_guide/installation/upgrade_222.html create mode 100755 user_guide/installation/upgrade_223.html create mode 100755 user_guide/installation/upgrade_300.html create mode 100755 user_guide/installation/upgrade_301.html create mode 100755 user_guide/installation/upgrade_302.html create mode 100755 user_guide/installation/upgrade_303.html create mode 100755 user_guide/installation/upgrade_304.html create mode 100755 user_guide/installation/upgrade_305.html create mode 100755 user_guide/installation/upgrade_306.html create mode 100755 user_guide/installation/upgrade_310.html create mode 100755 user_guide/installation/upgrade_311.html create mode 100755 user_guide/installation/upgrade_312.html create mode 100755 user_guide/installation/upgrade_313.html create mode 100755 user_guide/installation/upgrade_314.html create mode 100755 user_guide/installation/upgrade_315.html create mode 100755 user_guide/installation/upgrade_316.html create mode 100755 user_guide/installation/upgrade_b11.html create mode 100755 user_guide/installation/upgrading.html create mode 100755 user_guide/libraries/benchmark.html create mode 100755 user_guide/libraries/caching.html create mode 100755 user_guide/libraries/calendar.html create mode 100755 user_guide/libraries/cart.html create mode 100755 user_guide/libraries/config.html create mode 100755 user_guide/libraries/email.html create mode 100755 user_guide/libraries/encrypt.html create mode 100755 user_guide/libraries/encryption.html create mode 100755 user_guide/libraries/file_uploading.html create mode 100755 user_guide/libraries/form_validation.html create mode 100755 user_guide/libraries/ftp.html create mode 100755 user_guide/libraries/image_lib.html create mode 100755 user_guide/libraries/index.html create mode 100755 user_guide/libraries/input.html create mode 100755 user_guide/libraries/javascript.html create mode 100755 user_guide/libraries/language.html create mode 100755 user_guide/libraries/loader.html create mode 100755 user_guide/libraries/migration.html create mode 100755 user_guide/libraries/output.html create mode 100755 user_guide/libraries/pagination.html create mode 100755 user_guide/libraries/parser.html create mode 100755 user_guide/libraries/security.html create mode 100755 user_guide/libraries/sessions.html create mode 100755 user_guide/libraries/table.html create mode 100755 user_guide/libraries/trackback.html create mode 100755 user_guide/libraries/typography.html create mode 100755 user_guide/libraries/unit_testing.html create mode 100755 user_guide/libraries/uri.html create mode 100755 user_guide/libraries/user_agent.html create mode 100755 user_guide/libraries/xmlrpc.html create mode 100755 user_guide/libraries/zip.html create mode 100755 user_guide/license.html create mode 100755 user_guide/objects.inv create mode 100755 user_guide/overview/appflow.html create mode 100755 user_guide/overview/at_a_glance.html create mode 100755 user_guide/overview/features.html create mode 100755 user_guide/overview/getting_started.html create mode 100755 user_guide/overview/goals.html create mode 100755 user_guide/overview/index.html create mode 100755 user_guide/overview/mvc.html create mode 100755 user_guide/search.html create mode 100755 user_guide/searchindex.js create mode 100755 user_guide/tutorial/conclusion.html create mode 100755 user_guide/tutorial/create_news_items.html create mode 100755 user_guide/tutorial/index.html create mode 100755 user_guide/tutorial/news_section.html create mode 100755 user_guide/tutorial/static_pages.html delete mode 100644 vendor/autoload.php delete mode 120000 vendor/bin/heroku-hhvm-apache2 delete mode 120000 vendor/bin/heroku-hhvm-nginx delete mode 120000 vendor/bin/heroku-php-apache2 delete mode 120000 vendor/bin/heroku-php-nginx delete mode 100644 vendor/composer/ClassLoader.php delete mode 100644 vendor/composer/LICENSE delete mode 100644 vendor/composer/autoload_classmap.php delete mode 100644 vendor/composer/autoload_files.php delete mode 100644 vendor/composer/autoload_namespaces.php delete mode 100644 vendor/composer/autoload_psr4.php delete mode 100644 vendor/composer/autoload_real.php delete mode 100644 vendor/composer/autoload_static.php delete mode 100644 vendor/composer/installed.json delete mode 100644 vendor/heroku/heroku-buildpack-php/.gitignore delete mode 100644 vendor/heroku/heroku-buildpack-php/.travis.yml delete mode 100644 vendor/heroku/heroku-buildpack-php/CHANGELOG.md delete mode 100644 vendor/heroku/heroku-buildpack-php/README.md delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/compile delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/detect delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-apache2 delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-nginx delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/heroku-php-nginx delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/release delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/test-compile delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/util/autotune.php delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/util/blackfire.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/util/common.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/util/newrelic.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/bin/util/platform.php delete mode 100644 vendor/heroku/heroku-buildpack-php/composer.json delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/apache2/default_include.conf delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/apache2/heroku.conf delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php delete mode 100644 vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf delete mode 100644 vendor/heroku/heroku-buildpack-php/requirements.txt delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/README.md delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_conf/apache2/httpd.conf delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_conf/nginx/nginx.conf delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_conf/php/conf.d/010-ext-zend_opcache.ini delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_conf/php/php.ini delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_docker/README.md delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_docker/cedar-14.Dockerfile delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_docker/env.default delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_docker/heroku-16.Dockerfile delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/_util/deploy.sh delete mode 100644 vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.py delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/_util/mkrepo.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/_util/remove.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/_util/sync.sh delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/apache delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/apache-2.4.29 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/composer delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/composer-1.5.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu-4.0.11 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire-1.18.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra-1.2.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev-1.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event-2.3.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick-3.4.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached-2.2.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo-1.6.16 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb-1.3.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic-7.6.0.201 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth-1.2.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-2.0.13 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-3.2.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq-1.1.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf-1.1.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka-3.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis-3.1.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp-1.9.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/apcu-4.0.11 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire-1.18.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/cassandra-1.3.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/ev-1.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/event-2.3.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/imagick-3.4.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/memcached-2.2.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongo-1.6.16 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongodb-1.3.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/newrelic-7.6.0.201 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/oauth-1.2.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-2.0.13 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-3.2.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/pq-1.1.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/raphf-1.1.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/rdkafka-3.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/redis-3.1.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/amqp-1.9.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu-5.1.8 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire-1.18.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/cassandra-1.3.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/ev-1.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/event-2.3.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/imagick-3.4.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/memcached-3.0.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/mongodb-1.3.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/newrelic-7.6.0.201 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/oauth-2.0.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/phalcon-3.2.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/pq-2.1.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/raphf-2.0.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/rdkafka-3.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/redis-3.1.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/amqp-1.9.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/apcu-5.1.8 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire-1.18.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/cassandra-1.3.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/ev-1.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/event-2.3.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/imagick-3.4.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/memcached-3.0.3 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/mongodb-1.3.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/newrelic-7.6.0.201 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/oauth-2.0.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/phalcon-3.2.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/pq-2.1.2 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/raphf-2.0.0 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/rdkafka-3.0.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/redis-3.1.4 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/extensions/pecl delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/hhvm delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/hhvm-3.5.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client-2007f delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra-2.7.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt-2.5.8 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached-1.0.18 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka-0.11.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/nginx delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/nginx-1.8.1 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-5.5.38 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-5.6.32 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-7.0.25 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-7.1.11 delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-min delete mode 100755 vendor/heroku/heroku-buildpack-php/support/build/php-min-7.0.25 delete mode 100644 vendor/heroku/heroku-buildpack-php/support/installer/composer.json delete mode 100644 vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstaller.php delete mode 100644 vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstallerPlugin.php delete mode 100644 vendor/heroku/heroku-buildpack-php/support/installer/src/Downloader.php delete mode 100644 vendor/monolog/monolog/.php_cs delete mode 100644 vendor/monolog/monolog/CHANGELOG.md delete mode 100644 vendor/monolog/monolog/LICENSE delete mode 100644 vendor/monolog/monolog/README.md delete mode 100644 vendor/monolog/monolog/composer.json delete mode 100644 vendor/monolog/monolog/doc/01-usage.md delete mode 100644 vendor/monolog/monolog/doc/02-handlers-formatters-processors.md delete mode 100644 vendor/monolog/monolog/doc/03-utilities.md delete mode 100644 vendor/monolog/monolog/doc/04-extending.md delete mode 100644 vendor/monolog/monolog/doc/sockets.md delete mode 100644 vendor/monolog/monolog/phpunit.xml.dist delete mode 100644 vendor/monolog/monolog/src/Monolog/ErrorHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Logger.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php delete mode 100644 vendor/monolog/monolog/src/Monolog/Registry.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/LoggerTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/RegistryTest.php delete mode 100644 vendor/monolog/monolog/tests/Monolog/TestCase.php delete mode 100644 vendor/pimple/pimple/.gitignore delete mode 100644 vendor/pimple/pimple/.travis.yml delete mode 100644 vendor/pimple/pimple/CHANGELOG delete mode 100644 vendor/pimple/pimple/LICENSE delete mode 100644 vendor/pimple/pimple/README.rst delete mode 100644 vendor/pimple/pimple/composer.json delete mode 100644 vendor/pimple/pimple/ext/pimple/.gitignore delete mode 100644 vendor/pimple/pimple/ext/pimple/README.md delete mode 100644 vendor/pimple/pimple/ext/pimple/config.m4 delete mode 100644 vendor/pimple/pimple/ext/pimple/config.w32 delete mode 100644 vendor/pimple/pimple/ext/pimple/php_pimple.h delete mode 100644 vendor/pimple/pimple/ext/pimple/pimple.c delete mode 100644 vendor/pimple/pimple/ext/pimple/pimple_compat.h delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/001.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/002.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/003.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/004.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/005.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/006.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/007.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/008.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/009.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/010.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/011.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/012.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/013.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/014.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/015.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/016.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/017.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/017_1.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/018.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/019.phpt delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/bench.phpb delete mode 100644 vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb delete mode 100644 vendor/pimple/pimple/phpunit.xml.dist delete mode 100644 vendor/pimple/pimple/src/Pimple/Container.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Psr11/Container.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php delete mode 100644 vendor/pimple/pimple/src/Pimple/ServiceIterator.php delete mode 100644 vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php delete mode 100644 vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php delete mode 100644 vendor/psr/container/.gitignore delete mode 100644 vendor/psr/container/LICENSE delete mode 100644 vendor/psr/container/README.md delete mode 100644 vendor/psr/container/composer.json delete mode 100644 vendor/psr/container/src/ContainerExceptionInterface.php delete mode 100644 vendor/psr/container/src/ContainerInterface.php delete mode 100644 vendor/psr/container/src/NotFoundExceptionInterface.php delete mode 100644 vendor/psr/log/.gitignore delete mode 100644 vendor/psr/log/LICENSE delete mode 100644 vendor/psr/log/Psr/Log/AbstractLogger.php delete mode 100644 vendor/psr/log/Psr/Log/InvalidArgumentException.php delete mode 100644 vendor/psr/log/Psr/Log/LogLevel.php delete mode 100644 vendor/psr/log/Psr/Log/LoggerAwareInterface.php delete mode 100644 vendor/psr/log/Psr/Log/LoggerAwareTrait.php delete mode 100644 vendor/psr/log/Psr/Log/LoggerInterface.php delete mode 100644 vendor/psr/log/Psr/Log/LoggerTrait.php delete mode 100644 vendor/psr/log/Psr/Log/NullLogger.php delete mode 100644 vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php delete mode 100644 vendor/psr/log/README.md delete mode 100644 vendor/psr/log/composer.json delete mode 100644 vendor/silex/silex/.gitignore delete mode 100644 vendor/silex/silex/.travis.yml delete mode 100644 vendor/silex/silex/LICENSE delete mode 100644 vendor/silex/silex/README.rst delete mode 100644 vendor/silex/silex/composer.json delete mode 100644 vendor/silex/silex/doc/changelog.rst delete mode 100644 vendor/silex/silex/doc/conf.py delete mode 100644 vendor/silex/silex/doc/contributing.rst delete mode 100644 vendor/silex/silex/doc/cookbook/error_handler.rst delete mode 100644 vendor/silex/silex/doc/cookbook/form_no_csrf.rst delete mode 100644 vendor/silex/silex/doc/cookbook/guard_authentication.rst delete mode 100644 vendor/silex/silex/doc/cookbook/index.rst delete mode 100644 vendor/silex/silex/doc/cookbook/json_request_body.rst delete mode 100644 vendor/silex/silex/doc/cookbook/multiple_loggers.rst delete mode 100644 vendor/silex/silex/doc/cookbook/session_storage.rst delete mode 100644 vendor/silex/silex/doc/cookbook/sub_requests.rst delete mode 100644 vendor/silex/silex/doc/cookbook/validator_yaml.rst delete mode 100644 vendor/silex/silex/doc/index.rst delete mode 100644 vendor/silex/silex/doc/internals.rst delete mode 100644 vendor/silex/silex/doc/intro.rst delete mode 100644 vendor/silex/silex/doc/middlewares.rst delete mode 100644 vendor/silex/silex/doc/organizing_controllers.rst delete mode 100644 vendor/silex/silex/doc/providers.rst delete mode 100644 vendor/silex/silex/doc/providers/asset.rst delete mode 100644 vendor/silex/silex/doc/providers/csrf.rst delete mode 100644 vendor/silex/silex/doc/providers/doctrine.rst delete mode 100644 vendor/silex/silex/doc/providers/form.rst delete mode 100644 vendor/silex/silex/doc/providers/http_cache.rst delete mode 100644 vendor/silex/silex/doc/providers/http_fragment.rst delete mode 100644 vendor/silex/silex/doc/providers/index.rst delete mode 100644 vendor/silex/silex/doc/providers/locale.rst delete mode 100644 vendor/silex/silex/doc/providers/monolog.rst delete mode 100644 vendor/silex/silex/doc/providers/remember_me.rst delete mode 100644 vendor/silex/silex/doc/providers/security.rst delete mode 100644 vendor/silex/silex/doc/providers/serializer.rst delete mode 100644 vendor/silex/silex/doc/providers/service_controller.rst delete mode 100644 vendor/silex/silex/doc/providers/session.rst delete mode 100644 vendor/silex/silex/doc/providers/swiftmailer.rst delete mode 100644 vendor/silex/silex/doc/providers/translation.rst delete mode 100644 vendor/silex/silex/doc/providers/twig.rst delete mode 100644 vendor/silex/silex/doc/providers/validator.rst delete mode 100644 vendor/silex/silex/doc/providers/var_dumper.rst delete mode 100644 vendor/silex/silex/doc/services.rst delete mode 100644 vendor/silex/silex/doc/testing.rst delete mode 100644 vendor/silex/silex/doc/usage.rst delete mode 100644 vendor/silex/silex/doc/web_servers.rst delete mode 100644 vendor/silex/silex/phpunit.xml.dist delete mode 100644 vendor/silex/silex/src/Silex/Api/BootableProviderInterface.php delete mode 100644 vendor/silex/silex/src/Silex/Api/ControllerProviderInterface.php delete mode 100644 vendor/silex/silex/src/Silex/Api/EventListenerProviderInterface.php delete mode 100644 vendor/silex/silex/src/Silex/Api/LICENSE delete mode 100644 vendor/silex/silex/src/Silex/Api/composer.json delete mode 100644 vendor/silex/silex/src/Silex/AppArgumentValueResolver.php delete mode 100644 vendor/silex/silex/src/Silex/Application.php delete mode 100644 vendor/silex/silex/src/Silex/Application/FormTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/MonologTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/SecurityTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/TranslationTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/TwigTrait.php delete mode 100644 vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php delete mode 100644 vendor/silex/silex/src/Silex/CallbackResolver.php delete mode 100644 vendor/silex/silex/src/Silex/Controller.php delete mode 100644 vendor/silex/silex/src/Silex/ControllerCollection.php delete mode 100644 vendor/silex/silex/src/Silex/ControllerResolver.php delete mode 100644 vendor/silex/silex/src/Silex/EventListener/ConverterListener.php delete mode 100644 vendor/silex/silex/src/Silex/EventListener/LogListener.php delete mode 100644 vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php delete mode 100644 vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php delete mode 100644 vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php delete mode 100644 vendor/silex/silex/src/Silex/ExceptionHandler.php delete mode 100644 vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/CsrfServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/ExceptionHandlerServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Form/SilexFormExtension.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/HttpCache/HttpCache.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/LICENSE delete mode 100644 vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/LocaleServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Routing/LazyRequestMatcher.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Session/SessionListener.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Session/TestSessionListener.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Twig/RuntimeLoader.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/VarDumperServiceProvider.php delete mode 100644 vendor/silex/silex/src/Silex/Provider/composer.json delete mode 100644 vendor/silex/silex/src/Silex/Route.php delete mode 100644 vendor/silex/silex/src/Silex/Route/SecurityTrait.php delete mode 100644 vendor/silex/silex/src/Silex/ServiceControllerResolver.php delete mode 100644 vendor/silex/silex/src/Silex/ViewListenerWrapper.php delete mode 100644 vendor/silex/silex/src/Silex/WebTestCase.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/FormApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/FormTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/MonologApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/SecurityApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/TranslationApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/TranslationTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/TwigApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorApplication.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ControllerTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/EventListener/LogListenerTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Fixtures/Php7Controller.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Fixtures/manifest.json delete mode 100644 vendor/silex/silex/tests/Silex/Tests/FunctionalTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/JsonTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/LazyDispatcherTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/LazyRequestMatcherTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/LocaleTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SerializerServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/Custom.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/CustomValidator.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Route/SecurityRoute.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/RouterTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverRouterTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/StreamTest.php delete mode 100644 vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php delete mode 100644 vendor/symfony/debug/.gitignore delete mode 100644 vendor/symfony/debug/BufferingLogger.php delete mode 100644 vendor/symfony/debug/CHANGELOG.md delete mode 100644 vendor/symfony/debug/Debug.php delete mode 100644 vendor/symfony/debug/DebugClassLoader.php delete mode 100644 vendor/symfony/debug/ErrorHandler.php delete mode 100644 vendor/symfony/debug/Exception/ClassNotFoundException.php delete mode 100644 vendor/symfony/debug/Exception/ContextErrorException.php delete mode 100644 vendor/symfony/debug/Exception/FatalErrorException.php delete mode 100644 vendor/symfony/debug/Exception/FatalThrowableError.php delete mode 100644 vendor/symfony/debug/Exception/FlattenException.php delete mode 100644 vendor/symfony/debug/Exception/OutOfMemoryException.php delete mode 100644 vendor/symfony/debug/Exception/SilencedErrorContext.php delete mode 100644 vendor/symfony/debug/Exception/UndefinedFunctionException.php delete mode 100644 vendor/symfony/debug/Exception/UndefinedMethodException.php delete mode 100644 vendor/symfony/debug/ExceptionHandler.php delete mode 100644 vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php delete mode 100644 vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php delete mode 100644 vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php delete mode 100644 vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php delete mode 100644 vendor/symfony/debug/LICENSE delete mode 100644 vendor/symfony/debug/README.md delete mode 100644 vendor/symfony/debug/Resources/ext/README.md delete mode 100644 vendor/symfony/debug/Resources/ext/config.m4 delete mode 100644 vendor/symfony/debug/Resources/ext/config.w32 delete mode 100644 vendor/symfony/debug/Resources/ext/php_symfony_debug.h delete mode 100644 vendor/symfony/debug/Resources/ext/symfony_debug.c delete mode 100644 vendor/symfony/debug/Resources/ext/tests/001.phpt delete mode 100644 vendor/symfony/debug/Resources/ext/tests/002.phpt delete mode 100644 vendor/symfony/debug/Resources/ext/tests/002_1.phpt delete mode 100644 vendor/symfony/debug/Resources/ext/tests/003.phpt delete mode 100644 vendor/symfony/debug/Tests/DebugClassLoaderTest.php delete mode 100644 vendor/symfony/debug/Tests/ErrorHandlerTest.php delete mode 100644 vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php delete mode 100644 vendor/symfony/debug/Tests/ExceptionHandlerTest.php delete mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php delete mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php delete mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/ClassAlias.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/DeprecatedInterface.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/FinalClass.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/FinalMethod.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/NonDeprecatedInterface.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/PEARClass.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/Throwing.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/casemismatch.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/notPsr0Bis.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/psr4/Psr4CaseMismatch.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures/reallyNotPsr0.php delete mode 100644 vendor/symfony/debug/Tests/Fixtures2/RequiredTwice.php delete mode 100644 vendor/symfony/debug/Tests/HeaderMock.php delete mode 100644 vendor/symfony/debug/Tests/MockExceptionHandler.php delete mode 100644 vendor/symfony/debug/composer.json delete mode 100644 vendor/symfony/debug/phpunit.xml.dist delete mode 100644 vendor/symfony/event-dispatcher/.gitignore delete mode 100644 vendor/symfony/event-dispatcher/CHANGELOG.md delete mode 100644 vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php delete mode 100644 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php delete mode 100644 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php delete mode 100644 vendor/symfony/event-dispatcher/Debug/WrappedListener.php delete mode 100644 vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php delete mode 100644 vendor/symfony/event-dispatcher/Event.php delete mode 100644 vendor/symfony/event-dispatcher/EventDispatcher.php delete mode 100644 vendor/symfony/event-dispatcher/EventDispatcherInterface.php delete mode 100644 vendor/symfony/event-dispatcher/EventSubscriberInterface.php delete mode 100644 vendor/symfony/event-dispatcher/GenericEvent.php delete mode 100644 vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php delete mode 100644 vendor/symfony/event-dispatcher/LICENSE delete mode 100644 vendor/symfony/event-dispatcher/README.md delete mode 100644 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/EventTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/GenericEventTest.php delete mode 100644 vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php delete mode 100644 vendor/symfony/event-dispatcher/composer.json delete mode 100644 vendor/symfony/event-dispatcher/phpunit.xml.dist delete mode 100644 vendor/symfony/http-foundation/.gitignore delete mode 100644 vendor/symfony/http-foundation/AcceptHeader.php delete mode 100644 vendor/symfony/http-foundation/AcceptHeaderItem.php delete mode 100644 vendor/symfony/http-foundation/ApacheRequest.php delete mode 100644 vendor/symfony/http-foundation/BinaryFileResponse.php delete mode 100644 vendor/symfony/http-foundation/CHANGELOG.md delete mode 100644 vendor/symfony/http-foundation/Cookie.php delete mode 100644 vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php delete mode 100644 vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php delete mode 100644 vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php delete mode 100644 vendor/symfony/http-foundation/ExpressionRequestMatcher.php delete mode 100644 vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php delete mode 100644 vendor/symfony/http-foundation/File/Exception/FileException.php delete mode 100644 vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php delete mode 100644 vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php delete mode 100644 vendor/symfony/http-foundation/File/Exception/UploadException.php delete mode 100644 vendor/symfony/http-foundation/File/File.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php delete mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php delete mode 100644 vendor/symfony/http-foundation/File/Stream.php delete mode 100644 vendor/symfony/http-foundation/File/UploadedFile.php delete mode 100644 vendor/symfony/http-foundation/FileBag.php delete mode 100644 vendor/symfony/http-foundation/HeaderBag.php delete mode 100644 vendor/symfony/http-foundation/IpUtils.php delete mode 100644 vendor/symfony/http-foundation/JsonResponse.php delete mode 100644 vendor/symfony/http-foundation/LICENSE delete mode 100644 vendor/symfony/http-foundation/ParameterBag.php delete mode 100644 vendor/symfony/http-foundation/README.md delete mode 100644 vendor/symfony/http-foundation/RedirectResponse.php delete mode 100644 vendor/symfony/http-foundation/Request.php delete mode 100644 vendor/symfony/http-foundation/RequestMatcher.php delete mode 100644 vendor/symfony/http-foundation/RequestMatcherInterface.php delete mode 100644 vendor/symfony/http-foundation/RequestStack.php delete mode 100644 vendor/symfony/http-foundation/Response.php delete mode 100644 vendor/symfony/http-foundation/ResponseHeaderBag.php delete mode 100644 vendor/symfony/http-foundation/ServerBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php delete mode 100644 vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Flash/FlashBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php delete mode 100644 vendor/symfony/http-foundation/Session/Session.php delete mode 100644 vendor/symfony/http-foundation/Session/SessionBagInterface.php delete mode 100644 vendor/symfony/http-foundation/Session/SessionInterface.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/MetadataBag.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php delete mode 100644 vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php delete mode 100644 vendor/symfony/http-foundation/StreamedResponse.php delete mode 100644 vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ApacheRequestTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/CookieTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/File/FakeFile.php delete mode 100644 vendor/symfony/http-foundation/Tests/File/FileTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension delete mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty delete mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example delete mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/test delete mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif delete mode 100644 vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/FileBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/HeaderBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/IpUtilsTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/JsonResponseTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ParameterBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/RedirectResponseTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/RequestMatcherTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/RequestStackTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/RequestTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ResponseTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/ResponseTestCase.php delete mode 100644 vendor/symfony/http-foundation/Tests/ServerBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/SessionTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/StreamedResponseTest.php delete mode 100644 vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng delete mode 100644 vendor/symfony/http-foundation/Tests/schema/iana-registry.rng delete mode 100644 vendor/symfony/http-foundation/composer.json delete mode 100644 vendor/symfony/http-foundation/phpunit.xml.dist delete mode 100644 vendor/symfony/http-kernel/.gitignore delete mode 100644 vendor/symfony/http-kernel/Bundle/Bundle.php delete mode 100644 vendor/symfony/http-kernel/Bundle/BundleInterface.php delete mode 100644 vendor/symfony/http-kernel/CHANGELOG.md delete mode 100644 vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php delete mode 100644 vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php delete mode 100644 vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php delete mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php delete mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php delete mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php delete mode 100644 vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php delete mode 100644 vendor/symfony/http-kernel/Client.php delete mode 100644 vendor/symfony/http-kernel/Config/EnvParametersResource.php delete mode 100644 vendor/symfony/http-kernel/Config/FileLocator.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php delete mode 100644 vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php delete mode 100644 vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ControllerReference.php delete mode 100644 vendor/symfony/http-kernel/Controller/ControllerResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php delete mode 100644 vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php delete mode 100644 vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php delete mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php delete mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php delete mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/DataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/EventDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php delete mode 100644 vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php delete mode 100644 vendor/symfony/http-kernel/Debug/FileLinkFormatter.php delete mode 100644 vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/Extension.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php delete mode 100644 vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php delete mode 100644 vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/FilterControllerEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/FilterResponseEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/FinishRequestEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/GetResponseEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/KernelEvent.php delete mode 100644 vendor/symfony/http-kernel/Event/PostResponseEvent.php delete mode 100644 vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/DumpListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/ExceptionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/FragmentListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/LocaleListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/ProfilerListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/ResponseListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/RouterListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/SaveSessionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/SessionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/SurrogateListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/TestSessionListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/TranslatorListener.php delete mode 100644 vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php delete mode 100644 vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/BadRequestHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/ConflictHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/GoneHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/HttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php delete mode 100644 vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/NotFoundHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php delete mode 100644 vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php delete mode 100644 vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/Fragment/FragmentHandler.php delete mode 100644 vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php delete mode 100644 vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/Esi.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/HttpCache.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/Ssi.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/Store.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/StoreInterface.php delete mode 100644 vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php delete mode 100644 vendor/symfony/http-kernel/HttpKernel.php delete mode 100644 vendor/symfony/http-kernel/HttpKernelInterface.php delete mode 100644 vendor/symfony/http-kernel/Kernel.php delete mode 100644 vendor/symfony/http-kernel/KernelEvents.php delete mode 100644 vendor/symfony/http-kernel/KernelInterface.php delete mode 100644 vendor/symfony/http-kernel/LICENSE delete mode 100644 vendor/symfony/http-kernel/Log/DebugLoggerInterface.php delete mode 100644 vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php delete mode 100644 vendor/symfony/http-kernel/Profiler/Profile.php delete mode 100644 vendor/symfony/http-kernel/Profiler/Profiler.php delete mode 100644 vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php delete mode 100644 vendor/symfony/http-kernel/README.md delete mode 100644 vendor/symfony/http-kernel/TerminableInterface.php delete mode 100644 vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/ClientTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/Compiler.log delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/Util/ValueExporterTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Event/GetResponseForExceptionEventTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/hide.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/bar.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle2Bundle/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/hide.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/BasicTypesController.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingRequest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingSession.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/NullableController.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/VariadicController.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/BaseBundle/hide.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/ChildBundle/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/FooBundle/foo.txt delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php delete mode 100644 vendor/symfony/http-kernel/Tests/HttpKernelTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/KernelTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Logger.php delete mode 100644 vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php delete mode 100644 vendor/symfony/http-kernel/Tests/TestHttpKernel.php delete mode 100644 vendor/symfony/http-kernel/Tests/UriSignerTest.php delete mode 100644 vendor/symfony/http-kernel/UriSigner.php delete mode 100644 vendor/symfony/http-kernel/composer.json delete mode 100644 vendor/symfony/http-kernel/phpunit.xml.dist delete mode 100644 vendor/symfony/polyfill-mbstring/LICENSE delete mode 100644 vendor/symfony/polyfill-mbstring/Mbstring.php delete mode 100644 vendor/symfony/polyfill-mbstring/README.md delete mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php delete mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php delete mode 100644 vendor/symfony/polyfill-mbstring/bootstrap.php delete mode 100644 vendor/symfony/polyfill-mbstring/composer.json delete mode 100644 vendor/symfony/routing/.gitignore delete mode 100644 vendor/symfony/routing/Annotation/Route.php delete mode 100644 vendor/symfony/routing/CHANGELOG.md delete mode 100644 vendor/symfony/routing/CompiledRoute.php delete mode 100644 vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php delete mode 100644 vendor/symfony/routing/Exception/ExceptionInterface.php delete mode 100644 vendor/symfony/routing/Exception/InvalidParameterException.php delete mode 100644 vendor/symfony/routing/Exception/MethodNotAllowedException.php delete mode 100644 vendor/symfony/routing/Exception/MissingMandatoryParametersException.php delete mode 100644 vendor/symfony/routing/Exception/ResourceNotFoundException.php delete mode 100644 vendor/symfony/routing/Exception/RouteNotFoundException.php delete mode 100644 vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php delete mode 100644 vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php delete mode 100644 vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php delete mode 100644 vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php delete mode 100644 vendor/symfony/routing/Generator/UrlGenerator.php delete mode 100644 vendor/symfony/routing/Generator/UrlGeneratorInterface.php delete mode 100644 vendor/symfony/routing/LICENSE delete mode 100644 vendor/symfony/routing/Loader/AnnotationClassLoader.php delete mode 100644 vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php delete mode 100644 vendor/symfony/routing/Loader/AnnotationFileLoader.php delete mode 100644 vendor/symfony/routing/Loader/ClosureLoader.php delete mode 100644 vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php delete mode 100644 vendor/symfony/routing/Loader/DirectoryLoader.php delete mode 100644 vendor/symfony/routing/Loader/ObjectRouteLoader.php delete mode 100644 vendor/symfony/routing/Loader/PhpFileLoader.php delete mode 100644 vendor/symfony/routing/Loader/XmlFileLoader.php delete mode 100644 vendor/symfony/routing/Loader/YamlFileLoader.php delete mode 100644 vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd delete mode 100644 vendor/symfony/routing/Matcher/Dumper/DumperCollection.php delete mode 100644 vendor/symfony/routing/Matcher/Dumper/DumperRoute.php delete mode 100644 vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php delete mode 100644 vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php delete mode 100644 vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php delete mode 100644 vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php delete mode 100644 vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php delete mode 100644 vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php delete mode 100644 vendor/symfony/routing/Matcher/RequestMatcherInterface.php delete mode 100644 vendor/symfony/routing/Matcher/TraceableUrlMatcher.php delete mode 100644 vendor/symfony/routing/Matcher/UrlMatcher.php delete mode 100644 vendor/symfony/routing/Matcher/UrlMatcherInterface.php delete mode 100644 vendor/symfony/routing/README.md delete mode 100644 vendor/symfony/routing/RequestContext.php delete mode 100644 vendor/symfony/routing/RequestContextAwareInterface.php delete mode 100644 vendor/symfony/routing/Route.php delete mode 100644 vendor/symfony/routing/RouteCollection.php delete mode 100644 vendor/symfony/routing/RouteCollectionBuilder.php delete mode 100644 vendor/symfony/routing/RouteCompiler.php delete mode 100644 vendor/symfony/routing/RouteCompilerInterface.php delete mode 100644 vendor/symfony/routing/Router.php delete mode 100644 vendor/symfony/routing/RouterInterface.php delete mode 100644 vendor/symfony/routing/Tests/Annotation/RouteTest.php delete mode 100644 vendor/symfony/routing/Tests/CompiledRouteTest.php delete mode 100644 vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomCompiledRoute.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/annotated.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/bad_format.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/bar.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/empty.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/file_resource.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/foo.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/foo1.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/incomplete.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/list_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/list_null_values.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/map_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/map_null_values.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/missing_id.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/missing_path.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/null_values.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/special_route_name.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.xml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.yml delete mode 100644 vendor/symfony/routing/Tests/Fixtures/with_define_path_variable.php delete mode 100644 vendor/symfony/routing/Tests/Fixtures/withdoctype.xml delete mode 100644 vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php delete mode 100644 vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/Dumper/DumperCollectionTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php delete mode 100644 vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php delete mode 100644 vendor/symfony/routing/Tests/RequestContextTest.php delete mode 100644 vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php delete mode 100644 vendor/symfony/routing/Tests/RouteCollectionTest.php delete mode 100644 vendor/symfony/routing/Tests/RouteCompilerTest.php delete mode 100644 vendor/symfony/routing/Tests/RouteTest.php delete mode 100644 vendor/symfony/routing/Tests/RouterTest.php delete mode 100644 vendor/symfony/routing/composer.json delete mode 100644 vendor/symfony/routing/phpunit.xml.dist delete mode 100644 vendor/symfony/twig-bridge/.gitignore delete mode 100644 vendor/symfony/twig-bridge/AppVariable.php delete mode 100644 vendor/symfony/twig-bridge/CHANGELOG.md delete mode 100644 vendor/symfony/twig-bridge/Command/DebugCommand.php delete mode 100644 vendor/symfony/twig-bridge/Command/LintCommand.php delete mode 100644 vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php delete mode 100644 vendor/symfony/twig-bridge/Extension/AssetExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/CodeExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/DumpExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/ExpressionExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/FormExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php delete mode 100644 vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/ProfilerExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/RoutingExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/SecurityExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/StopwatchExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/TranslationExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/WebLinkExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/WorkflowExtension.php delete mode 100644 vendor/symfony/twig-bridge/Extension/YamlExtension.php delete mode 100644 vendor/symfony/twig-bridge/Form/TwigRenderer.php delete mode 100644 vendor/symfony/twig-bridge/Form/TwigRendererEngine.php delete mode 100644 vendor/symfony/twig-bridge/Form/TwigRendererEngineInterface.php delete mode 100644 vendor/symfony/twig-bridge/Form/TwigRendererInterface.php delete mode 100644 vendor/symfony/twig-bridge/LICENSE delete mode 100644 vendor/symfony/twig-bridge/Node/DumpNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/FormThemeNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/RenderBlockNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/StopwatchNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php delete mode 100644 vendor/symfony/twig-bridge/Node/TransNode.php delete mode 100644 vendor/symfony/twig-bridge/NodeVisitor/Scope.php delete mode 100644 vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php delete mode 100644 vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php delete mode 100644 vendor/symfony/twig-bridge/README.md delete mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig delete mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig delete mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig delete mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig delete mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/AppVariableTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/CodeExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/DumpExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/ExpressionExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubFilesystemLoader.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubTranslator.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/child_label.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/page_dynamic_extends.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/parent_label.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_use.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/HttpFoundationExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/HttpKernelExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/RoutingExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/StopwatchExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/WebLinkExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Fixtures/extractor/syntax_error.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Fixtures/extractor/with_translations.html.twig delete mode 100644 vendor/symfony/twig-bridge/Tests/Node/DumpNodeTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/NodeVisitor/ScopeTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationNodeVisitorTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/NodeVisitor/TwigNodeProvider.php delete mode 100644 vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/Translation/TwigExtractorTest.php delete mode 100644 vendor/symfony/twig-bridge/Tests/TwigEngineTest.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php delete mode 100644 vendor/symfony/twig-bridge/Translation/TwigExtractor.php delete mode 100644 vendor/symfony/twig-bridge/TwigEngine.php delete mode 100644 vendor/symfony/twig-bridge/composer.json delete mode 100644 vendor/symfony/twig-bridge/phpunit.xml.dist delete mode 100644 vendor/twig/twig/.editorconfig delete mode 100644 vendor/twig/twig/.gitignore delete mode 100644 vendor/twig/twig/.php_cs.dist delete mode 100644 vendor/twig/twig/.travis.yml delete mode 100644 vendor/twig/twig/CHANGELOG delete mode 100644 vendor/twig/twig/LICENSE delete mode 100644 vendor/twig/twig/README.rst delete mode 100644 vendor/twig/twig/composer.json delete mode 100644 vendor/twig/twig/doc/advanced.rst delete mode 100644 vendor/twig/twig/doc/api.rst delete mode 100644 vendor/twig/twig/doc/coding_standards.rst delete mode 100644 vendor/twig/twig/doc/deprecated.rst delete mode 100644 vendor/twig/twig/doc/filters/abs.rst delete mode 100644 vendor/twig/twig/doc/filters/batch.rst delete mode 100644 vendor/twig/twig/doc/filters/capitalize.rst delete mode 100644 vendor/twig/twig/doc/filters/convert_encoding.rst delete mode 100644 vendor/twig/twig/doc/filters/date.rst delete mode 100644 vendor/twig/twig/doc/filters/date_modify.rst delete mode 100644 vendor/twig/twig/doc/filters/default.rst delete mode 100644 vendor/twig/twig/doc/filters/escape.rst delete mode 100644 vendor/twig/twig/doc/filters/first.rst delete mode 100644 vendor/twig/twig/doc/filters/format.rst delete mode 100644 vendor/twig/twig/doc/filters/index.rst delete mode 100644 vendor/twig/twig/doc/filters/join.rst delete mode 100644 vendor/twig/twig/doc/filters/json_encode.rst delete mode 100644 vendor/twig/twig/doc/filters/keys.rst delete mode 100644 vendor/twig/twig/doc/filters/last.rst delete mode 100644 vendor/twig/twig/doc/filters/length.rst delete mode 100644 vendor/twig/twig/doc/filters/lower.rst delete mode 100644 vendor/twig/twig/doc/filters/merge.rst delete mode 100644 vendor/twig/twig/doc/filters/nl2br.rst delete mode 100644 vendor/twig/twig/doc/filters/number_format.rst delete mode 100644 vendor/twig/twig/doc/filters/raw.rst delete mode 100644 vendor/twig/twig/doc/filters/replace.rst delete mode 100644 vendor/twig/twig/doc/filters/reverse.rst delete mode 100644 vendor/twig/twig/doc/filters/round.rst delete mode 100644 vendor/twig/twig/doc/filters/slice.rst delete mode 100644 vendor/twig/twig/doc/filters/sort.rst delete mode 100644 vendor/twig/twig/doc/filters/split.rst delete mode 100644 vendor/twig/twig/doc/filters/striptags.rst delete mode 100644 vendor/twig/twig/doc/filters/title.rst delete mode 100644 vendor/twig/twig/doc/filters/trim.rst delete mode 100644 vendor/twig/twig/doc/filters/upper.rst delete mode 100644 vendor/twig/twig/doc/filters/url_encode.rst delete mode 100644 vendor/twig/twig/doc/functions/attribute.rst delete mode 100644 vendor/twig/twig/doc/functions/block.rst delete mode 100644 vendor/twig/twig/doc/functions/constant.rst delete mode 100644 vendor/twig/twig/doc/functions/cycle.rst delete mode 100644 vendor/twig/twig/doc/functions/date.rst delete mode 100644 vendor/twig/twig/doc/functions/dump.rst delete mode 100644 vendor/twig/twig/doc/functions/include.rst delete mode 100644 vendor/twig/twig/doc/functions/index.rst delete mode 100644 vendor/twig/twig/doc/functions/max.rst delete mode 100644 vendor/twig/twig/doc/functions/min.rst delete mode 100644 vendor/twig/twig/doc/functions/parent.rst delete mode 100644 vendor/twig/twig/doc/functions/random.rst delete mode 100644 vendor/twig/twig/doc/functions/range.rst delete mode 100644 vendor/twig/twig/doc/functions/source.rst delete mode 100644 vendor/twig/twig/doc/functions/template_from_string.rst delete mode 100644 vendor/twig/twig/doc/index.rst delete mode 100644 vendor/twig/twig/doc/installation.rst delete mode 100644 vendor/twig/twig/doc/internals.rst delete mode 100644 vendor/twig/twig/doc/intro.rst delete mode 100644 vendor/twig/twig/doc/recipes.rst delete mode 100644 vendor/twig/twig/doc/tags/autoescape.rst delete mode 100644 vendor/twig/twig/doc/tags/block.rst delete mode 100644 vendor/twig/twig/doc/tags/do.rst delete mode 100644 vendor/twig/twig/doc/tags/embed.rst delete mode 100644 vendor/twig/twig/doc/tags/extends.rst delete mode 100644 vendor/twig/twig/doc/tags/filter.rst delete mode 100644 vendor/twig/twig/doc/tags/flush.rst delete mode 100644 vendor/twig/twig/doc/tags/for.rst delete mode 100644 vendor/twig/twig/doc/tags/from.rst delete mode 100644 vendor/twig/twig/doc/tags/if.rst delete mode 100644 vendor/twig/twig/doc/tags/import.rst delete mode 100644 vendor/twig/twig/doc/tags/include.rst delete mode 100644 vendor/twig/twig/doc/tags/index.rst delete mode 100644 vendor/twig/twig/doc/tags/macro.rst delete mode 100644 vendor/twig/twig/doc/tags/sandbox.rst delete mode 100644 vendor/twig/twig/doc/tags/set.rst delete mode 100644 vendor/twig/twig/doc/tags/spaceless.rst delete mode 100644 vendor/twig/twig/doc/tags/use.rst delete mode 100644 vendor/twig/twig/doc/tags/verbatim.rst delete mode 100644 vendor/twig/twig/doc/tags/with.rst delete mode 100644 vendor/twig/twig/doc/templates.rst delete mode 100644 vendor/twig/twig/doc/tests/constant.rst delete mode 100644 vendor/twig/twig/doc/tests/defined.rst delete mode 100644 vendor/twig/twig/doc/tests/divisibleby.rst delete mode 100644 vendor/twig/twig/doc/tests/empty.rst delete mode 100644 vendor/twig/twig/doc/tests/even.rst delete mode 100644 vendor/twig/twig/doc/tests/index.rst delete mode 100644 vendor/twig/twig/doc/tests/iterable.rst delete mode 100644 vendor/twig/twig/doc/tests/null.rst delete mode 100644 vendor/twig/twig/doc/tests/odd.rst delete mode 100644 vendor/twig/twig/doc/tests/sameas.rst delete mode 100644 vendor/twig/twig/lib/Twig/BaseNodeVisitor.php delete mode 100644 vendor/twig/twig/lib/Twig/Cache/Filesystem.php delete mode 100644 vendor/twig/twig/lib/Twig/Cache/Null.php delete mode 100644 vendor/twig/twig/lib/Twig/CacheInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Compiler.php delete mode 100644 vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php delete mode 100644 vendor/twig/twig/lib/Twig/Environment.php delete mode 100644 vendor/twig/twig/lib/Twig/Error.php delete mode 100644 vendor/twig/twig/lib/Twig/Error/Loader.php delete mode 100644 vendor/twig/twig/lib/Twig/Error/Runtime.php delete mode 100644 vendor/twig/twig/lib/Twig/Error/Syntax.php delete mode 100644 vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/ExpressionParser.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Core.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Debug.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Escaper.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Optimizer.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Profiler.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Sandbox.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/Staging.php delete mode 100644 vendor/twig/twig/lib/Twig/Extension/StringLoader.php delete mode 100644 vendor/twig/twig/lib/Twig/ExtensionInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/ExtensionSet.php delete mode 100644 vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php delete mode 100644 vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php delete mode 100644 vendor/twig/twig/lib/Twig/Filter.php delete mode 100644 vendor/twig/twig/lib/Twig/Function.php delete mode 100644 vendor/twig/twig/lib/Twig/Lexer.php delete mode 100644 vendor/twig/twig/lib/Twig/Loader/Array.php delete mode 100644 vendor/twig/twig/lib/Twig/Loader/Chain.php delete mode 100644 vendor/twig/twig/lib/Twig/Loader/Filesystem.php delete mode 100644 vendor/twig/twig/lib/Twig/LoaderInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Markup.php delete mode 100644 vendor/twig/twig/lib/Twig/Node.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/AutoEscape.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Block.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/BlockReference.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Body.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/CheckSecurity.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Do.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Embed.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Array.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Call.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Constant.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Filter.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Function.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Name.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Parent.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/TempName.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Unary.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Flush.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/For.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/ForLoop.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/If.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Import.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Include.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Macro.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Module.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Print.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Sandbox.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Set.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Spaceless.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/Text.php delete mode 100644 vendor/twig/twig/lib/Twig/Node/With.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeCaptureInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeOutputInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeTraverser.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php delete mode 100644 vendor/twig/twig/lib/Twig/NodeVisitorInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Parser.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php delete mode 100644 vendor/twig/twig/lib/Twig/Profiler/Profile.php delete mode 100644 vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php delete mode 100644 vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/SimpleFilter.php delete mode 100644 vendor/twig/twig/lib/Twig/SimpleFunction.php delete mode 100644 vendor/twig/twig/lib/Twig/SimpleTest.php delete mode 100644 vendor/twig/twig/lib/Twig/Source.php delete mode 100644 vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/Template.php delete mode 100644 vendor/twig/twig/lib/Twig/TemplateWrapper.php delete mode 100644 vendor/twig/twig/lib/Twig/Test.php delete mode 100644 vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php delete mode 100644 vendor/twig/twig/lib/Twig/Test/NodeTestCase.php delete mode 100644 vendor/twig/twig/lib/Twig/Token.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Block.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Do.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Embed.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Extends.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Filter.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Flush.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/For.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/From.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/If.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Import.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Include.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Macro.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Set.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/Use.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParser/With.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenParserInterface.php delete mode 100644 vendor/twig/twig/lib/Twig/TokenStream.php delete mode 100644 vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php delete mode 100644 vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php delete mode 100644 vendor/twig/twig/phpunit.xml.dist delete mode 100644 vendor/twig/twig/src/Cache/CacheInterface.php delete mode 100644 vendor/twig/twig/src/Cache/FilesystemCache.php delete mode 100644 vendor/twig/twig/src/Cache/NullCache.php delete mode 100644 vendor/twig/twig/src/Compiler.php delete mode 100644 vendor/twig/twig/src/Environment.php delete mode 100644 vendor/twig/twig/src/Error/Error.php delete mode 100644 vendor/twig/twig/src/Error/LoaderError.php delete mode 100644 vendor/twig/twig/src/Error/RuntimeError.php delete mode 100644 vendor/twig/twig/src/Error/SyntaxError.php delete mode 100644 vendor/twig/twig/src/ExpressionParser.php delete mode 100644 vendor/twig/twig/src/Extension/AbstractExtension.php delete mode 100644 vendor/twig/twig/src/Extension/CoreExtension.php delete mode 100644 vendor/twig/twig/src/Extension/DebugExtension.php delete mode 100644 vendor/twig/twig/src/Extension/EscaperExtension.php delete mode 100644 vendor/twig/twig/src/Extension/ExtensionInterface.php delete mode 100644 vendor/twig/twig/src/Extension/GlobalsInterface.php delete mode 100644 vendor/twig/twig/src/Extension/InitRuntimeInterface.php delete mode 100644 vendor/twig/twig/src/Extension/OptimizerExtension.php delete mode 100644 vendor/twig/twig/src/Extension/ProfilerExtension.php delete mode 100644 vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php delete mode 100644 vendor/twig/twig/src/Extension/SandboxExtension.php delete mode 100644 vendor/twig/twig/src/Extension/StagingExtension.php delete mode 100644 vendor/twig/twig/src/Extension/StringLoaderExtension.php delete mode 100644 vendor/twig/twig/src/ExtensionSet.php delete mode 100644 vendor/twig/twig/src/FileExtensionEscapingStrategy.php delete mode 100644 vendor/twig/twig/src/Lexer.php delete mode 100644 vendor/twig/twig/src/Loader/ArrayLoader.php delete mode 100644 vendor/twig/twig/src/Loader/ChainLoader.php delete mode 100644 vendor/twig/twig/src/Loader/ExistsLoaderInterface.php delete mode 100644 vendor/twig/twig/src/Loader/FilesystemLoader.php delete mode 100644 vendor/twig/twig/src/Loader/LoaderInterface.php delete mode 100644 vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php delete mode 100644 vendor/twig/twig/src/Markup.php delete mode 100644 vendor/twig/twig/src/Node/AutoEscapeNode.php delete mode 100644 vendor/twig/twig/src/Node/BlockNode.php delete mode 100644 vendor/twig/twig/src/Node/BlockReferenceNode.php delete mode 100644 vendor/twig/twig/src/Node/BodyNode.php delete mode 100644 vendor/twig/twig/src/Node/CheckSecurityNode.php delete mode 100644 vendor/twig/twig/src/Node/DoNode.php delete mode 100644 vendor/twig/twig/src/Node/EmbedNode.php delete mode 100644 vendor/twig/twig/src/Node/Expression/AbstractExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/ArrayExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/AssignNameExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/InBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/CallExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/ConditionalExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/ConstantExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php delete mode 100644 vendor/twig/twig/src/Node/Expression/FilterExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/FunctionExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/GetAttrExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/MethodCallExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/NameExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/ParentExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/TempNameExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/EvenTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/NullTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/OddTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Test/SameasTest.php delete mode 100644 vendor/twig/twig/src/Node/Expression/TestExpression.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php delete mode 100644 vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php delete mode 100644 vendor/twig/twig/src/Node/FlushNode.php delete mode 100644 vendor/twig/twig/src/Node/ForLoopNode.php delete mode 100644 vendor/twig/twig/src/Node/ForNode.php delete mode 100644 vendor/twig/twig/src/Node/IfNode.php delete mode 100644 vendor/twig/twig/src/Node/ImportNode.php delete mode 100644 vendor/twig/twig/src/Node/IncludeNode.php delete mode 100644 vendor/twig/twig/src/Node/MacroNode.php delete mode 100644 vendor/twig/twig/src/Node/ModuleNode.php delete mode 100644 vendor/twig/twig/src/Node/Node.php delete mode 100644 vendor/twig/twig/src/Node/NodeCaptureInterface.php delete mode 100644 vendor/twig/twig/src/Node/NodeOutputInterface.php delete mode 100644 vendor/twig/twig/src/Node/PrintNode.php delete mode 100644 vendor/twig/twig/src/Node/SandboxNode.php delete mode 100644 vendor/twig/twig/src/Node/SandboxedPrintNode.php delete mode 100644 vendor/twig/twig/src/Node/SetNode.php delete mode 100644 vendor/twig/twig/src/Node/SetTempNode.php delete mode 100644 vendor/twig/twig/src/Node/SpacelessNode.php delete mode 100644 vendor/twig/twig/src/Node/TextNode.php delete mode 100644 vendor/twig/twig/src/Node/WithNode.php delete mode 100644 vendor/twig/twig/src/NodeTraverser.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php delete mode 100644 vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php delete mode 100644 vendor/twig/twig/src/Parser.php delete mode 100644 vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php delete mode 100644 vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php delete mode 100644 vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php delete mode 100644 vendor/twig/twig/src/Profiler/Dumper/TextDumper.php delete mode 100644 vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php delete mode 100644 vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php delete mode 100644 vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php delete mode 100644 vendor/twig/twig/src/Profiler/Profile.php delete mode 100644 vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php delete mode 100644 vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php delete mode 100644 vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityPolicy.php delete mode 100644 vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php delete mode 100644 vendor/twig/twig/src/Source.php delete mode 100644 vendor/twig/twig/src/Template.php delete mode 100644 vendor/twig/twig/src/TemplateWrapper.php delete mode 100644 vendor/twig/twig/src/Test/IntegrationTestCase.php delete mode 100644 vendor/twig/twig/src/Test/NodeTestCase.php delete mode 100644 vendor/twig/twig/src/Token.php delete mode 100644 vendor/twig/twig/src/TokenParser/AbstractTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/BlockTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/DoTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/EmbedTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/FilterTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/FlushTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/ForTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/FromTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/IfTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/ImportTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/IncludeTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/MacroTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/SandboxTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/SetTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/SpacelessTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/TokenParserInterface.php delete mode 100644 vendor/twig/twig/src/TokenParser/UseTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenParser/WithTokenParser.php delete mode 100644 vendor/twig/twig/src/TokenStream.php delete mode 100644 vendor/twig/twig/src/TwigFilter.php delete mode 100644 vendor/twig/twig/src/TwigFunction.php delete mode 100644 vendor/twig/twig/src/TwigTest.php delete mode 100644 vendor/twig/twig/src/Util/DeprecationCollector.php delete mode 100644 vendor/twig/twig/src/Util/TemplateDirIterator.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Cache/FilesystemTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/CompilerTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/ErrorTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/extensions/anonymous_functions.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_static_call.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/IntegrationTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test delete mode 100644 vendor/twig/twig/test/Twig/Tests/LexerTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig delete mode 100644 vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/DoTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ForTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/IfTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SetTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Node/TextTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/ParserTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/TemplateTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php delete mode 100644 vendor/twig/twig/test/Twig/Tests/escapingTest.php delete mode 100644 www/index.php diff --git a/db/.DS_Store b/.DS_Store similarity index 100% rename from db/.DS_Store rename to .DS_Store diff --git a/application/.htaccess b/application/.htaccess new file mode 100755 index 0000000..6c63ed4 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/application/cache/index.html b/application/cache/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/cache/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100755 index 0000000..7cdc901 --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,135 @@ + 'ua'); +*/ +$autoload['libraries'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Drivers +| ------------------------------------------------------------------- +| These classes are located in system/libraries/ or in your +| application/libraries/ directory, but are also placed inside their +| own subdirectory and they extend the CI_Driver_Library class. They +| offer multiple interchangeable driver options. +| +| Prototype: +| +| $autoload['drivers'] = array('cache'); +| +| You can also supply an alternative property name to be assigned in +| the controller: +| +| $autoload['drivers'] = array('cache' => 'cch'); +| +*/ +$autoload['drivers'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Helper Files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['helper'] = array('url', 'file'); +*/ +$autoload['helper'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Config files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['config'] = array('config1', 'config2'); +| +| NOTE: This item is intended for use ONLY if you have created custom +| config files. Otherwise, leave it blank. +| +*/ +$autoload['config'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Language files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['language'] = array('lang1', 'lang2'); +| +| NOTE: Do not include the "_lang" part of your file. For example +| "codeigniter_lang.php" would be referenced as array('codeigniter'); +| +*/ +$autoload['language'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Models +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['model'] = array('first_model', 'second_model'); +| +| You can also supply an alternative model name to be assigned +| in the controller: +| +| $autoload['model'] = array('first_model' => 'first'); +*/ +$autoload['model'] = array(); diff --git a/application/config/config.php b/application/config/config.php new file mode 100755 index 0000000..1031522 --- /dev/null +++ b/application/config/config.php @@ -0,0 +1,523 @@ +]+$/i +| +| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! +| +*/ +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; + +/* +|-------------------------------------------------------------------------- +| Enable Query Strings +|-------------------------------------------------------------------------- +| +| By default CodeIgniter uses search-engine friendly segment based URLs: +| example.com/who/what/where/ +| +| You can optionally enable standard query string based URLs: +| example.com?who=me&what=something&where=here +| +| Options are: TRUE or FALSE (boolean) +| +| The other items let you set the query string 'words' that will +| invoke your controllers and its functions: +| example.com/index.php?c=controller&m=function +| +| Please note that some of the helpers won't work as expected when +| this feature is enabled, since CodeIgniter is designed primarily to +| use segment based URLs. +| +*/ +$config['enable_query_strings'] = FALSE; +$config['controller_trigger'] = 'c'; +$config['function_trigger'] = 'm'; +$config['directory_trigger'] = 'd'; + +/* +|-------------------------------------------------------------------------- +| Allow $_GET array +|-------------------------------------------------------------------------- +| +| By default CodeIgniter enables access to the $_GET array. If for some +| reason you would like to disable it, set 'allow_get_array' to FALSE. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['allow_get_array'] = TRUE; + +/* +|-------------------------------------------------------------------------- +| Error Logging Threshold +|-------------------------------------------------------------------------- +| +| You can enable error logging by setting a threshold over zero. The +| threshold determines what gets logged. Threshold options are: +| +| 0 = Disables logging, Error logging TURNED OFF +| 1 = Error Messages (including PHP errors) +| 2 = Debug Messages +| 3 = Informational Messages +| 4 = All Messages +| +| You can also pass an array with threshold levels to show individual error types +| +| array(2) = Debug Messages, without Error Messages +| +| For a live site you'll usually only enable Errors (1) to be logged otherwise +| your log files will fill up very fast. +| +*/ +$config['log_threshold'] = 0; + +/* +|-------------------------------------------------------------------------- +| Error Logging Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/logs/ directory. Use a full server path with trailing slash. +| +*/ +$config['log_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Extension +|-------------------------------------------------------------------------- +| +| The default filename extension for log files. The default 'php' allows for +| protecting the log files via basic scripting, when they are to be stored +| under a publicly accessible directory. +| +| Note: Leaving it blank will default to 'php'. +| +*/ +$config['log_file_extension'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Permissions +|-------------------------------------------------------------------------- +| +| The file system permissions to be applied on newly created log files. +| +| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal +| integer notation (i.e. 0700, 0644, etc.) +*/ +$config['log_file_permissions'] = 0644; + +/* +|-------------------------------------------------------------------------- +| Date Format for Logs +|-------------------------------------------------------------------------- +| +| Each item that is logged has an associated date. You can use PHP date +| codes to set your own date formatting +| +*/ +$config['log_date_format'] = 'Y-m-d H:i:s'; + +/* +|-------------------------------------------------------------------------- +| Error Views Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ directory. Use a full server path with trailing slash. +| +*/ +$config['error_views_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/cache/ directory. Use a full server path with trailing slash. +| +*/ +$config['cache_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Include Query String +|-------------------------------------------------------------------------- +| +| Whether to take the URL query string into consideration when generating +| output cache files. Valid options are: +| +| FALSE = Disabled +| TRUE = Enabled, take all query parameters into account. +| Please be aware that this may result in numerous cache +| files generated for the same page over and over again. +| array('q') = Enabled, but only take into account the specified list +| of query parameters. +| +*/ +$config['cache_query_string'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Encryption Key +|-------------------------------------------------------------------------- +| +| If you use the Encryption class, you must set an encryption key. +| See the user guide for more info. +| +| https://codeigniter.com/user_guide/libraries/encryption.html +| +*/ +$config['encryption_key'] = ''; + +/* +|-------------------------------------------------------------------------- +| Session Variables +|-------------------------------------------------------------------------- +| +| 'sess_driver' +| +| The storage driver to use: files, database, redis, memcached +| +| 'sess_cookie_name' +| +| The session cookie name, must contain only [0-9a-z_-] characters +| +| 'sess_expiration' +| +| The number of SECONDS you want the session to last. +| Setting to 0 (zero) means expire when the browser is closed. +| +| 'sess_save_path' +| +| The location to save sessions to, driver dependent. +| +| For the 'files' driver, it's a path to a writable directory. +| WARNING: Only absolute paths are supported! +| +| For the 'database' driver, it's a table name. +| Please read up the manual for the format with other session drivers. +| +| IMPORTANT: You are REQUIRED to set a valid save path! +| +| 'sess_match_ip' +| +| Whether to match the user's IP address when reading the session data. +| +| WARNING: If you're using the database driver, don't forget to update +| your session table's PRIMARY KEY when changing this setting. +| +| 'sess_time_to_update' +| +| How many seconds between CI regenerating the session ID. +| +| 'sess_regenerate_destroy' +| +| Whether to destroy session data associated with the old session ID +| when auto-regenerating the session ID. When set to FALSE, the data +| will be later deleted by the garbage collector. +| +| Other session cookie settings are shared with the rest of the application, +| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. +| +*/ +$config['sess_driver'] = 'files'; +$config['sess_cookie_name'] = 'ci_session'; +$config['sess_expiration'] = 7200; +$config['sess_save_path'] = NULL; +$config['sess_match_ip'] = FALSE; +$config['sess_time_to_update'] = 300; +$config['sess_regenerate_destroy'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cookie Related Variables +|-------------------------------------------------------------------------- +| +| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions +| 'cookie_domain' = Set to .your-domain.com for site-wide cookies +| 'cookie_path' = Typically will be a forward slash +| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. +| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) +| +| Note: These settings (with the exception of 'cookie_prefix' and +| 'cookie_httponly') will also affect sessions. +| +*/ +$config['cookie_prefix'] = ''; +$config['cookie_domain'] = ''; +$config['cookie_path'] = '/'; +$config['cookie_secure'] = FALSE; +$config['cookie_httponly'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Standardize newlines +|-------------------------------------------------------------------------- +| +| Determines whether to standardize newline characters in input data, +| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['standardize_newlines'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Global XSS Filtering +|-------------------------------------------------------------------------- +| +| Determines whether the XSS filter is always active when GET, POST or +| COOKIE data is encountered +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['global_xss_filtering'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cross Site Request Forgery +|-------------------------------------------------------------------------- +| Enables a CSRF cookie token to be set. When set to TRUE, token will be +| checked on a submitted form. If you are accepting user data, it is strongly +| recommended CSRF protection be enabled. +| +| 'csrf_token_name' = The token name +| 'csrf_cookie_name' = The cookie name +| 'csrf_expire' = The number in seconds the token should expire. +| 'csrf_regenerate' = Regenerate token on every submission +| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks +*/ +$config['csrf_protection'] = FALSE; +$config['csrf_token_name'] = 'csrf_test_name'; +$config['csrf_cookie_name'] = 'csrf_cookie_name'; +$config['csrf_expire'] = 7200; +$config['csrf_regenerate'] = TRUE; +$config['csrf_exclude_uris'] = array(); + +/* +|-------------------------------------------------------------------------- +| Output Compression +|-------------------------------------------------------------------------- +| +| Enables Gzip output compression for faster page loads. When enabled, +| the output class will test whether your server supports Gzip. +| Even if it does, however, not all browsers support compression +| so enable only if you are reasonably sure your visitors can handle it. +| +| Only used if zlib.output_compression is turned off in your php.ini. +| Please do not use it together with httpd-level output compression. +| +| VERY IMPORTANT: If you are getting a blank page when compression is enabled it +| means you are prematurely outputting something to your browser. It could +| even be a line of whitespace at the end of one of your scripts. For +| compression to work, nothing can be sent before the output buffer is called +| by the output class. Do not 'echo' any values with compression enabled. +| +*/ +$config['compress_output'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Master Time Reference +|-------------------------------------------------------------------------- +| +| Options are 'local' or any PHP supported timezone. This preference tells +| the system whether to use your server's local time as the master 'now' +| reference, or convert it to the configured one timezone. See the 'date +| helper' page of the user guide for information regarding date handling. +| +*/ +$config['time_reference'] = 'local'; + +/* +|-------------------------------------------------------------------------- +| Rewrite PHP Short Tags +|-------------------------------------------------------------------------- +| +| If your PHP installation does not have short tag support enabled CI +| can rewrite the tags on-the-fly, enabling you to utilize that syntax +| in your view files. Options are TRUE or FALSE (boolean) +| +| Note: You need to have eval() enabled for this to work. +| +*/ +$config['rewrite_short_tags'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Reverse Proxy IPs +|-------------------------------------------------------------------------- +| +| If your server is behind a reverse proxy, you must whitelist the proxy +| IP addresses from which CodeIgniter should trust headers such as +| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify +| the visitor's IP address. +| +| You can use both an array or a comma-separated list of proxy addresses, +| as well as specifying whole subnets. Here are a few examples: +| +| Comma-separated: '10.0.1.200,192.168.5.0/24' +| Array: array('10.0.1.200', '192.168.5.0/24') +*/ +$config['proxy_ips'] = ''; diff --git a/application/config/constants.php b/application/config/constants.php new file mode 100755 index 0000000..18d3b4b --- /dev/null +++ b/application/config/constants.php @@ -0,0 +1,85 @@ +db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. +| +| The $active_group variable lets you choose which connection group to +| make active. By default there is only one group (the 'default' group). +| +| The $query_builder variables lets you determine whether or not to load +| the query builder class. +*/ +$active_group = 'default'; +$query_builder = TRUE; + +$db['default'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => '', + 'password' => '', + 'database' => '', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); diff --git a/application/config/doctypes.php b/application/config/doctypes.php new file mode 100755 index 0000000..59a7991 --- /dev/null +++ b/application/config/doctypes.php @@ -0,0 +1,24 @@ + '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'xhtml-basic11' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', + 'mathml1' => '', + 'mathml2' => '', + 'svg10' => '', + 'svg11' => '', + 'svg11-basic' => '', + 'svg11-tiny' => '', + 'xhtml-math-svg-xh' => '', + 'xhtml-math-svg-sh' => '', + 'xhtml-rdfa-1' => '', + 'xhtml-rdfa-2' => '' +); diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php new file mode 100755 index 0000000..ac406e3 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,103 @@ + 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a', + '/Б/' => 'B', + '/б/' => 'b', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Д/' => 'D', + '/д/' => 'd', + '/Ð|Ď|Đ|Δ/' => 'Dj', + '/ð|ď|đ|δ/' => 'dj', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', + '/Ф/' => 'F', + '/ф/' => 'f', + '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G', + '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Ķ|Κ|К/' => 'K', + '/ķ|κ|к/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l', + '/М/' => 'M', + '/м/' => 'm', + '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N', + '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o', + '/П/' => 'P', + '/п/' => 'p', + '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R', + '/ŕ|ŗ|ř|ρ|р/' => 'r', + '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', + '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', + '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', + '/ț|ţ|ť|ŧ|т/' => 't', + '/Þ|þ/' => 'th', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', + '/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', + '/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y', + '/В/' => 'V', + '/в/' => 'v', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Ź|Ż|Ž|Ζ|З/' => 'Z', + '/ź|ż|ž|ζ|з/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f', + '/ξ/' => 'ks', + '/π/' => 'p', + '/β/' => 'v', + '/μ/' => 'm', + '/ψ/' => 'ps', + '/Ё/' => 'Yo', + '/ё/' => 'yo', + '/Є/' => 'Ye', + '/є/' => 'ye', + '/Ї/' => 'Yi', + '/Ж/' => 'Zh', + '/ж/' => 'zh', + '/Х/' => 'Kh', + '/х/' => 'kh', + '/Ц/' => 'Ts', + '/ц/' => 'ts', + '/Ч/' => 'Ch', + '/ч/' => 'ch', + '/Ш/' => 'Sh', + '/ш/' => 'sh', + '/Щ/' => 'Shch', + '/щ/' => 'shch', + '/Ъ|ъ|Ь|ь/' => '', + '/Ю/' => 'Yu', + '/ю/' => 'yu', + '/Я/' => 'Ya', + '/я/' => 'ya' +); diff --git a/application/config/hooks.php b/application/config/hooks.php new file mode 100755 index 0000000..a8f38a5 --- /dev/null +++ b/application/config/hooks.php @@ -0,0 +1,13 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100755 index 0000000..5c23b39 --- /dev/null +++ b/application/config/memcached.php @@ -0,0 +1,19 @@ + array( + 'hostname' => '127.0.0.1', + 'port' => '11211', + 'weight' => '1', + ), +); diff --git a/application/config/migration.php b/application/config/migration.php new file mode 100755 index 0000000..4b585a6 --- /dev/null +++ b/application/config/migration.php @@ -0,0 +1,84 @@ +migration->current() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH.'migrations/'; diff --git a/application/config/mimes.php b/application/config/mimes.php new file mode 100755 index 0000000..0176533 --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,183 @@ + array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), + 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => array('application/octet-stream', 'application/x-msdownload'), + 'class' => 'application/octet-stream', + 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'), + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'), + 'ai' => array('application/pdf', 'application/postscript'), + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'), + 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'), + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => array('application/x-javascript', 'text/plain'), + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'), + 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), + 'aif' => array('audio/x-aiff', 'audio/aiff'), + 'aiff' => array('audio/x-aiff', 'audio/aiff'), + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => array('text/css', 'text/plain'), + 'html' => array('text/html', 'text/plain'), + 'htm' => array('text/html', 'text/plain'), + 'shtml' => array('text/html', 'text/plain'), + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => array('application/xml', 'text/xml', 'text/plain'), + 'xsl' => array('application/xml', 'text/xsl', 'text/xml'), + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'), + 'movie' => 'video/x-sgi-movie', + 'doc' => array('application/msword', 'application/vnd.ms-office'), + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'), + 'dot' => array('application/msword', 'application/vnd.ms-office'), + 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => array('application/json', 'text/json'), + 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), + 'p10' => array('application/x-pkcs10', 'application/pkcs10'), + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'), + 'crl' => array('application/pkix-crl', 'application/pkcs-crl'), + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), + '3g2' => 'video/3gpp2', + '3gp' => array('video/3gp', 'video/3gpp'), + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => array('video/mp4', 'video/x-f4v'), + 'flv' => 'video/x-flv', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'), + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'), + 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'), + 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'), + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'), + 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'), + 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'), + 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), + 'vcf' => 'text/x-vcard', + 'srt' => array('text/srt', 'text/plain'), + 'vtt' => array('text/vtt', 'text/plain'), + 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'), + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'otf' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web' +); diff --git a/application/config/profiler.php b/application/config/profiler.php new file mode 100755 index 0000000..3db22e3 --- /dev/null +++ b/application/config/profiler.php @@ -0,0 +1,14 @@ + my_controller/index +| my-controller/my-method -> my_controller/my_method +*/ +$route['default_controller'] = 'welcome'; +$route['404_override'] = ''; +$route['translate_uri_dashes'] = FALSE; diff --git a/application/config/smileys.php b/application/config/smileys.php new file mode 100755 index 0000000..abf9a89 --- /dev/null +++ b/application/config/smileys.php @@ -0,0 +1,64 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'), + ':question:' => array('question.gif', '19', '19', 'question') + +); diff --git a/application/config/user_agents.php b/application/config/user_agents.php new file mode 100755 index 0000000..798086b --- /dev/null +++ b/application/config/user_agents.php @@ -0,0 +1,214 @@ + 'Windows 10', + 'windows nt 6.3' => 'Windows 8.1', + 'windows nt 6.2' => 'Windows 8', + 'windows nt 6.1' => 'Windows 7', + 'windows nt 6.0' => 'Windows Vista', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows phone' => 'Windows Phone', + 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS', + 'symbian' => 'Symbian OS' +); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'OPR' => 'Opera', + 'Flock' => 'Flock', + 'Edge' => 'Spartan', + 'Chrome' => 'Chrome', + // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string + 'Opera.*?Version' => 'Opera', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Trident.* rv' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse', + 'Maxthon' => 'Maxthon', + 'Ubuntu' => 'Ubuntu Web Browser' +); + +$mobiles = array( + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', +// 'openwave' => 'Open Wave', +// 'opera mini' => 'Opera Mini', +// 'operamini' => 'Opera Mini', +// 'elaine' => 'Palm', + 'palmsource' => 'Palm', +// 'digital paths' => 'Palm', +// 'avantgo' => 'Avantgo', +// 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', +// 'nokia' => 'Nokia', +// 'ericsson' => 'Ericsson', +// 'blackberry' => 'BlackBerry', +// 'motorola' => 'Motorola' + + // Phones and Manufacturers + 'motorola' => 'Motorola', + 'nokia' => 'Nokia', + 'palm' => 'Palm', + 'iphone' => 'Apple iPhone', + 'ipad' => 'iPad', + 'ipod' => 'Apple iPod Touch', + 'sony' => 'Sony Ericsson', + 'ericsson' => 'Sony Ericsson', + 'blackberry' => 'BlackBerry', + 'cocoon' => 'O2 Cocoon', + 'blazer' => 'Treo', + 'lg' => 'LG', + 'amoi' => 'Amoi', + 'xda' => 'XDA', + 'mda' => 'MDA', + 'vario' => 'Vario', + 'htc' => 'HTC', + 'samsung' => 'Samsung', + 'sharp' => 'Sharp', + 'sie-' => 'Siemens', + 'alcatel' => 'Alcatel', + 'benq' => 'BenQ', + 'ipaq' => 'HP iPaq', + 'mot-' => 'Motorola', + 'playstation portable' => 'PlayStation Portable', + 'playstation 3' => 'PlayStation 3', + 'playstation vita' => 'PlayStation Vita', + 'hiptop' => 'Danger Hiptop', + 'nec-' => 'NEC', + 'panasonic' => 'Panasonic', + 'philips' => 'Philips', + 'sagem' => 'Sagem', + 'sanyo' => 'Sanyo', + 'spv' => 'SPV', + 'zte' => 'ZTE', + 'sendo' => 'Sendo', + 'nintendo dsi' => 'Nintendo DSi', + 'nintendo ds' => 'Nintendo DS', + 'nintendo 3ds' => 'Nintendo 3DS', + 'wii' => 'Nintendo Wii', + 'open web' => 'Open Web', + 'openweb' => 'OpenWeb', + + // Operating Systems + 'android' => 'Android', + 'symbian' => 'Symbian', + 'SymbianOS' => 'SymbianOS', + 'elaine' => 'Palm', + 'series60' => 'Symbian S60', + 'windows ce' => 'Windows CE', + + // Browsers + 'obigo' => 'Obigo', + 'netfront' => 'Netfront Browser', + 'openwave' => 'Openwave Browser', + 'mobilexplorer' => 'Mobile Explorer', + 'operamini' => 'Opera Mini', + 'opera mini' => 'Opera Mini', + 'opera mobi' => 'Opera Mobile', + 'fennec' => 'Firefox Mobile', + + // Other + 'digital paths' => 'Digital Paths', + 'avantgo' => 'AvantGo', + 'xiino' => 'Xiino', + 'novarra' => 'Novarra Transcoder', + 'vodafone' => 'Vodafone', + 'docomo' => 'NTT DoCoMo', + 'o2' => 'O2', + + // Fallback + 'mobile' => 'Generic Mobile', + 'wireless' => 'Generic Mobile', + 'j2me' => 'Generic Mobile', + 'midp' => 'Generic Mobile', + 'cldc' => 'Generic Mobile', + 'up.link' => 'Generic Mobile', + 'up.browser' => 'Generic Mobile', + 'smartphone' => 'Generic Mobile', + 'cellphone' => 'Generic Mobile' +); + +// There are hundreds of bots but these are the most common. +$robots = array( + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'baiduspider' => 'Baiduspider', + 'bingbot' => 'Bing', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'ask jeeves' => 'Ask Jeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos', + 'yandex' => 'YandexBot', + 'mediapartners-google' => 'MediaPartners Google', + 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', + 'adsbot-google' => 'AdsBot Google', + 'feedfetcher-google' => 'Feedfetcher Google', + 'curious george' => 'Curious George', + 'ia_archiver' => 'Alexa Crawler', + 'MJ12bot' => 'Majestic-12', + 'Uptimebot' => 'Uptimebot' +); diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php new file mode 100755 index 0000000..9213c0c --- /dev/null +++ b/application/controllers/Welcome.php @@ -0,0 +1,25 @@ + + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function index() + { + $this->load->view('welcome_message'); + } +} diff --git a/application/controllers/index.html b/application/controllers/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/controllers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/core/index.html b/application/core/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/core/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/helpers/index.html b/application/helpers/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/helpers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/hooks/index.html b/application/hooks/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/hooks/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/index.html b/application/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/english/index.html b/application/language/english/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/language/english/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/index.html b/application/language/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/language/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/libraries/index.html b/application/libraries/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/libraries/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/logs/index.html b/application/logs/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/logs/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/models/index.html b/application/models/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/models/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/third_party/index.html b/application/third_party/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/third_party/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php new file mode 100755 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_404.php @@ -0,0 +1,8 @@ + + +An uncaught Exception was encountered + +Type: +Message: +Filename: getFile(), "\n"; ?> +Line Number: getLine(); ?> + + + +Backtrace: +getTrace() as $error): ?> + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php new file mode 100755 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_general.php @@ -0,0 +1,8 @@ + + +A PHP Error was encountered + +Severity: +Message: +Filename: +Line Number: + + + +Backtrace: + + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/cli/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php new file mode 100755 index 0000000..756ea9d --- /dev/null +++ b/application/views/errors/html/error_404.php @@ -0,0 +1,64 @@ + + + + +404 Page Not Found + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php new file mode 100755 index 0000000..f5a43f6 --- /dev/null +++ b/application/views/errors/html/error_db.php @@ -0,0 +1,64 @@ + + + + +Database Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php new file mode 100755 index 0000000..8784886 --- /dev/null +++ b/application/views/errors/html/error_exception.php @@ -0,0 +1,32 @@ + + +
+ +

An uncaught Exception was encountered

+ +

Type:

+

Message:

+

Filename: getFile(); ?>

+

Line Number: getLine(); ?>

+ + + +

Backtrace:

+ getTrace() as $error): ?> + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php new file mode 100755 index 0000000..fc3b2eb --- /dev/null +++ b/application/views/errors/html/error_general.php @@ -0,0 +1,64 @@ + + + + +Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php new file mode 100755 index 0000000..b146f9c --- /dev/null +++ b/application/views/errors/html/error_php.php @@ -0,0 +1,33 @@ + + +
+ +

A PHP Error was encountered

+ +

Severity:

+

Message:

+

Filename:

+

Line Number:

+ + + +

Backtrace:

+ + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/index.html b/application/views/errors/html/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/html/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/index.html b/application/views/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/application/views/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php new file mode 100755 index 0000000..f511563 --- /dev/null +++ b/application/views/welcome_message.php @@ -0,0 +1,89 @@ + + + + + Welcome to CodeIgniter + + + + + +
+

Welcome to CodeIgniter!

+ +
+

The page you are looking at is being generated dynamically by CodeIgniter.

+ +

If you would like to edit this page you'll find it located at:

+ application/views/welcome_message.php + +

The corresponding controller for this page is found at:

+ application/controllers/Welcome.php + +

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

+
+ + +
+ + + \ No newline at end of file diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 index 1a39344..30630e2 --- a/composer.json +++ b/composer.json @@ -1,11 +1,23 @@ { - "require" : { - "silex/silex": "^2.0.4", - "monolog/monolog": "^1.22", - "twig/twig": "^2.0", - "symfony/twig-bridge": "^3" - }, - "require-dev": { - "heroku/heroku-buildpack-php": "*" - } + "description": "The CodeIgniter framework", + "name": "codeigniter/framework", + "type": "project", + "homepage": "https://codeigniter.com", + "license": "MIT", + "support": { + "forum": "http://forum.codeigniter.com/", + "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", + "slack": "https://codeigniterchat.slack.com", + "source": "https://github.com/bcit-ci/CodeIgniter" + }, + "require": { + "php": ">=5.3.7" + }, + "suggest": { + "paragonie/random_compat": "Provides better randomness in PHP 5.x" + }, + "require-dev": { + "mikey179/vfsStream": "1.1.*", + "phpunit/phpunit": "4.* || 5.*" + } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 4da0243..0000000 --- a/composer.lock +++ /dev/null @@ -1,924 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "e66fd5c3f8342ff9ed1f0d21aab6ef81", - "packages": [ - { - "name": "monolog/monolog", - "version": "1.23.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2017-06-19T01:22:40+00:00" - }, - { - "name": "pimple/pimple", - "version": "v3.2.2", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/container": "^1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ], - "time": "2017-07-23T07:32:15+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "silex/silex", - "version": "v2.2.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Silex.git", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Silex/zipball/ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "pimple/pimple": "~3.0", - "symfony/event-dispatcher": "~2.8|^3.0", - "symfony/http-foundation": "~2.8|^3.0", - "symfony/http-kernel": "~2.8|^3.0", - "symfony/routing": "~2.8|^3.0" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35 || >= 5.0, <5.4.3" - }, - "replace": { - "silex/api": "self.version", - "silex/providers": "self.version" - }, - "require-dev": { - "doctrine/dbal": "~2.2", - "monolog/monolog": "^1.4.1", - "swiftmailer/swiftmailer": "~5", - "symfony/asset": "~2.8|^3.0", - "symfony/browser-kit": "~2.8|^3.0", - "symfony/config": "~2.8|^3.0", - "symfony/css-selector": "~2.8|^3.0", - "symfony/debug": "~2.8|^3.0", - "symfony/doctrine-bridge": "~2.8|^3.0", - "symfony/dom-crawler": "~2.8|^3.0", - "symfony/expression-language": "~2.8|^3.0", - "symfony/finder": "~2.8|^3.0", - "symfony/form": "~2.8|^3.0", - "symfony/intl": "~2.8|^3.0", - "symfony/monolog-bridge": "~2.8|^3.0", - "symfony/options-resolver": "~2.8|^3.0", - "symfony/phpunit-bridge": "^3.2", - "symfony/process": "~2.8|^3.0", - "symfony/security": "~2.8|^3.0", - "symfony/serializer": "~2.8|^3.0", - "symfony/translation": "~2.8|^3.0", - "symfony/twig-bridge": "~2.8|^3.0", - "symfony/validator": "~2.8|^3.0", - "symfony/var-dumper": "~2.8|^3.0", - "symfony/web-link": "^3.3", - "twig/twig": "~1.28|~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Silex\\": "src/Silex" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "description": "The PHP micro-framework based on the Symfony Components", - "homepage": "http://silex.sensiolabs.org", - "keywords": [ - "microframework" - ], - "time": "2017-07-23T07:40:14+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "symfony/expression-language": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com", - "time": "2017-10-05T23:10:23+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "654f047a78756964bf91b619554f956517394018" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/654f047a78756964bf91b619554f956517394018", - "reference": "654f047a78756964bf91b619554f956517394018", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/var-dumper": "<3.3", - "twig/twig": "<1.34|<2.4,>=2" - }, - "require-dev": { - "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", - "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com", - "time": "2017-10-05T23:40:19+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/routing", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/dependency-injection": "For loading routes from a service", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Routing Component", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ], - "time": "2017-10-02T07:25:00+00:00" - }, - { - "name": "symfony/twig-bridge", - "version": "v3.3.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/twig-bridge.git", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/cc40b1ea0efd030d422c762328345883a0404de4", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" - }, - "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" - }, - "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", - "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/web-link": "~3.3", - "symfony/yaml": "~2.8|~3.0" - }, - "suggest": { - "symfony/asset": "For using the AssetExtension", - "symfony/expression-language": "For using the ExpressionExtension", - "symfony/finder": "", - "symfony/form": "For using the FormExtension", - "symfony/http-kernel": "For using the HttpKernelExtension", - "symfony/routing": "For using the RoutingExtension", - "symfony/security": "For using the SecurityExtension", - "symfony/stopwatch": "For using the StopwatchExtension", - "symfony/templating": "For using the TwigEngine", - "symfony/translation": "For using the TranslationExtension", - "symfony/var-dumper": "For using the DumpExtension", - "symfony/web-link": "For using the WebLinkExtension", - "symfony/yaml": "For using the YamlExtension" - }, - "type": "symfony-bridge", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Bridge\\Twig\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Twig Bridge", - "homepage": "https://symfony.com", - "time": "2017-10-02T06:42:24+00:00" - }, - { - "name": "twig/twig", - "version": "v2.4.4", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/eddb97148ad779f27e670e1e3f19fb323aedafeb", - "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb", - "shasum": "" - }, - "require": { - "php": "^7.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.3@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_": "lib/" - }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2017-09-27T18:10:31+00:00" - } - ], - "packages-dev": [ - { - "name": "heroku/heroku-buildpack-php", - "version": "v126", - "source": { - "type": "git", - "url": "https://github.com/heroku/heroku-buildpack-php.git", - "reference": "8288ddb4b717019f5e39db384e3a9a5b41d73e93" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/8288ddb4b717019f5e39db384e3a9a5b41d73e93", - "reference": "8288ddb4b717019f5e39db384e3a9a5b41d73e93", - "shasum": "" - }, - "bin": [ - "bin/heroku-hhvm-apache2", - "bin/heroku-hhvm-nginx", - "bin/heroku-php-apache2", - "bin/heroku-php-nginx" - ], - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "David Zuelke", - "email": "dz@heroku.com" - } - ], - "description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP/HHVM and Apache2/Nginx as on Heroku", - "homepage": "https://github.com/heroku/heroku-buildpack-php", - "keywords": [ - "apache", - "apache2", - "foreman", - "heroku", - "hhvm", - "nginx", - "php" - ], - "time": "2017-10-28T00:17:41+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/contributing.md b/contributing.md new file mode 100755 index 0000000..2037e04 --- /dev/null +++ b/contributing.md @@ -0,0 +1,95 @@ +# Contributing to CodeIgniter + + +CodeIgniter is a community driven project and accepts contributions of code and documentation from the community. These contributions are made in the form of Issues or [Pull Requests](http://help.github.com/send-pull-requests/) on the [CodeIgniter repository](https://github.com/bcit-ci/CodeIgniter>) on GitHub. + +Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first: + +1. There is not already an open Issue +2. The issue has already been fixed (check the develop branch, or look for closed Issues) +3. Is it something really obvious that you can fix yourself? + +Reporting issues is helpful but an even better approach is to send a Pull Request, which is done by "Forking" the main repository and committing to your own copy. This will require you to use the version control system called Git. + +## Guidelines + +Before we look into how, here are the guidelines. If your Pull Requests fail +to pass these guidelines it will be declined and you will need to re-submit +when you’ve made the changes. This might sound a bit tough, but it is required +for us to maintain quality of the code-base. + +### PHP Style + +All code must meet the [Style Guide](https://codeigniter.com/user_guide/general/styleguide.html), which is +essentially the [Allman indent style](https://en.wikipedia.org/wiki/Indent_style#Allman_style), underscores and readable operators. This makes certain that all code is the same format as the existing code and means it will be as readable as possible. + +### Documentation + +If you change anything that requires a change to documentation then you will need to add it. New classes, methods, parameters, changing default values, etc are all things that will require a change to documentation. The change-log must also be updated for every change. Also PHPDoc blocks must be maintained. + +### Compatibility + +CodeIgniter recommends PHP 5.4 or newer to be used, but it should be +compatible with PHP 5.2.4 so all code supplied must stick to this +requirement. If PHP 5.3 (and above) functions or features are used then +there must be a fallback for PHP 5.2.4. + +### Branching + +CodeIgniter uses the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the "develop" branch. This is +where the next planned version will be developed. The "master" branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g: an emergency security patch) can be applied to master to create a new version, without worrying about other features holding it up. For this reason all commits need to be made to "develop" and any sent to "master" will be closed automatically. If you have multiple changes to submit, please place all changes into their own branch on your fork. + +One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests. + +### Signing + +You must sign your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open source project. git makes this trivial as you merely have to use `--signoff` on your commits to your CodeIgniter fork. + +`git commit --signoff` + +or simply + +`git commit -s` + +This will sign your commits with the information setup in your git config, e.g. + +`Signed-off-by: John Q Public ` + +If you are using [Tower](http://www.git-tower.com/) there is a "Sign-Off" checkbox in the commit window. You could even alias git commit to use the `-s` flag so you don’t have to think about it. + +By signing your work in this manner, you certify to a "Developer's Certificate of Origin". The current version of this certificate is in the `DCO.txt` file in the root of this repository. + + +## How-to Guide + +There are two ways to make changes, the easy way and the hard way. Either way you will need to [create a GitHub account](https://github.com/signup/free). + +Easy way GitHub allows in-line editing of files for making simple typo changes and quick-fixes. This is not the best way as you are unable to test the code works. If you do this you could be introducing syntax errors, etc, but for a Git-phobic user this is good for a quick-fix. + +Hard way The best way to contribute is to "clone" your fork of CodeIgniter to your development area. That sounds like some jargon, but "forking" on GitHub means "making a copy of that repo to your account" and "cloning" means "copying that code to your environment so you can work on it". + +1. Set up Git (Windows, Mac & Linux) +2. Go to the CodeIgniter repo +3. Fork it +4. Clone your CodeIgniter repo: git@github.com:/CodeIgniter.git +5. Checkout the "develop" branch At this point you are ready to start making changes. +6. Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them. +7. Commit the files +8. Push your develop branch to your fork +9. Send a pull request [http://help.github.com/send-pull-requests/](http://help.github.com/send-pull-requests/) + +The Reactor Engineers will now be alerted about the change and at least one of the team will respond. If your change fails to meet the guidelines it will be bounced, or feedback will be provided to help you improve it. + +Once the Reactor Engineer handling your pull request is happy with it they will merge it into develop and your patch will be part of the next release. + +### Keeping your fork up-to-date + +Unlike systems like Subversion, Git can have multiple remotes. A remote is the name for a URL of a Git repository. By default your fork will have a remote named "origin" which points to your fork, but you can add another remote named "codeigniter" which points to `git://github.com/bcit-ci/CodeIgniter.git`. This is a read-only remote but you can pull from this develop branch to update your own. + +If you are using command-line you can do the following: + +1. `git remote add codeigniter git://github.com/bcit-ci/CodeIgniter.git` +2. `git pull codeigniter develop` +3. `git push origin develop` + +Now your fork is up to date. This should be done regularly, or before you send a pull request at least. \ No newline at end of file diff --git a/db/lamp_2017-11-05.sql b/db/lamp_2017-11-05.sql deleted file mode 100644 index 5fb4656..0000000 --- a/db/lamp_2017-11-05.sql +++ /dev/null @@ -1,66 +0,0 @@ -# ************************************************************ -# Sequel Pro SQL dump -# Version 4541 -# -# http://www.sequelpro.com/ -# https://github.com/sequelpro/sequelpro -# -# Host: 127.0.0.1 (MySQL 5.7.20) -# Database: lamp -# Generation Time: 2017-11-05 19:36:41 +0000 -# ************************************************************ - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - - -# Dump of table Tweets -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Tweets`; - -CREATE TABLE `Tweets` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `tweet_id` bigint(11) DEFAULT NULL, - `tweet` char(11) DEFAULT NULL, - `date_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - - - -# Dump of table Users -# ------------------------------------------------------------ - -DROP TABLE IF EXISTS `Users`; - -CREATE TABLE `Users` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `first_name` text, - `last_name` text, - `username` char(20) DEFAULT '', - `password` text, - `email` text, - `picture` text, - `bio` char(140) DEFAULT '', - `url` text, - `location` text, - `date_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - - - - -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/index.php b/index.php new file mode 100755 index 0000000..c27a78e --- /dev/null +++ b/index.php @@ -0,0 +1,315 @@ +=')) + { + error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + } + else + { + error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); + } + break; + + default: + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); + echo 'The application environment is not set correctly.'; + exit(1); // EXIT_ERROR +} + +/* + *--------------------------------------------------------------- + * SYSTEM DIRECTORY NAME + *--------------------------------------------------------------- + * + * This variable must contain the name of your "system" directory. + * Set the path if it is not in the same directory as this file. + */ + $system_path = 'system'; + +/* + *--------------------------------------------------------------- + * APPLICATION DIRECTORY NAME + *--------------------------------------------------------------- + * + * If you want this front controller to use a different "application" + * directory than the default one you can set its name here. The directory + * can also be renamed or relocated anywhere on your server. If you do, + * use an absolute (full) server path. + * For more info please see the user guide: + * + * https://codeigniter.com/user_guide/general/managing_apps.html + * + * NO TRAILING SLASH! + */ + $application_folder = 'application'; + +/* + *--------------------------------------------------------------- + * VIEW DIRECTORY NAME + *--------------------------------------------------------------- + * + * If you want to move the view directory out of the application + * directory, set the path to it here. The directory can be renamed + * and relocated anywhere on your server. If blank, it will default + * to the standard location inside your application directory. + * If you do move this, use an absolute (full) server path. + * + * NO TRAILING SLASH! + */ + $view_folder = ''; + + +/* + * -------------------------------------------------------------------- + * DEFAULT CONTROLLER + * -------------------------------------------------------------------- + * + * Normally you will set your default controller in the routes.php file. + * You can, however, force a custom routing by hard-coding a + * specific controller class/function here. For most applications, you + * WILL NOT set your routing here, but it's an option for those + * special instances where you might want to override the standard + * routing in a specific front controller that shares a common CI installation. + * + * IMPORTANT: If you set the routing here, NO OTHER controller will be + * callable. In essence, this preference limits your application to ONE + * specific controller. Leave the function name blank if you need + * to call functions dynamically via the URI. + * + * Un-comment the $routing array below to use this feature + */ + // The directory name, relative to the "controllers" directory. Leave blank + // if your controller is not in a sub-directory within the "controllers" one + // $routing['directory'] = ''; + + // The controller class file name. Example: mycontroller + // $routing['controller'] = ''; + + // The controller function you wish to be called. + // $routing['function'] = ''; + + +/* + * ------------------------------------------------------------------- + * CUSTOM CONFIG VALUES + * ------------------------------------------------------------------- + * + * The $assign_to_config array below will be passed dynamically to the + * config class when initialized. This allows you to set custom config + * items or override any default config values found in the config.php file. + * This can be handy as it permits you to share one application between + * multiple front controller files, with each file containing different + * config values. + * + * Un-comment the $assign_to_config array below to use this feature + */ + // $assign_to_config['name_of_config_item'] = 'value of config item'; + + + +// -------------------------------------------------------------------- +// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE +// -------------------------------------------------------------------- + +/* + * --------------------------------------------------------------- + * Resolve the system path for increased reliability + * --------------------------------------------------------------- + */ + + // Set the current directory correctly for CLI requests + if (defined('STDIN')) + { + chdir(dirname(__FILE__)); + } + + if (($_temp = realpath($system_path)) !== FALSE) + { + $system_path = $_temp.DIRECTORY_SEPARATOR; + } + else + { + // Ensure there's a trailing slash + $system_path = strtr( + rtrim($system_path, '/\\'), + '/\\', + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR + ).DIRECTORY_SEPARATOR; + } + + // Is the system path correct? + if ( ! is_dir($system_path)) + { + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); + echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); + exit(3); // EXIT_CONFIG + } + +/* + * ------------------------------------------------------------------- + * Now that we know the path, set the main path constants + * ------------------------------------------------------------------- + */ + // The name of THIS file + define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); + + // Path to the system directory + define('BASEPATH', $system_path); + + // Path to the front controller (this file) directory + define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); + + // Name of the "system" directory + define('SYSDIR', basename(BASEPATH)); + + // The path to the "application" directory + if (is_dir($application_folder)) + { + if (($_temp = realpath($application_folder)) !== FALSE) + { + $application_folder = $_temp; + } + else + { + $application_folder = strtr( + rtrim($application_folder, '/\\'), + '/\\', + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR + ); + } + } + elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) + { + $application_folder = BASEPATH.strtr( + trim($application_folder, '/\\'), + '/\\', + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR + ); + } + else + { + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); + echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; + exit(3); // EXIT_CONFIG + } + + define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); + + // The path to the "views" directory + if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) + { + $view_folder = APPPATH.'views'; + } + elseif (is_dir($view_folder)) + { + if (($_temp = realpath($view_folder)) !== FALSE) + { + $view_folder = $_temp; + } + else + { + $view_folder = strtr( + rtrim($view_folder, '/\\'), + '/\\', + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR + ); + } + } + elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) + { + $view_folder = APPPATH.strtr( + trim($view_folder, '/\\'), + '/\\', + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR + ); + } + else + { + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); + echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; + exit(3); // EXIT_CONFIG + } + + define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR); + +/* + * -------------------------------------------------------------------- + * LOAD THE BOOTSTRAP FILE + * -------------------------------------------------------------------- + * + * And away we go... + */ +require_once BASEPATH.'core/CodeIgniter.php'; diff --git a/vendor/heroku/heroku-buildpack-php/LICENSE b/license.txt old mode 100644 new mode 100755 similarity index 90% rename from vendor/heroku/heroku-buildpack-php/LICENSE rename to license.txt index 22c3fcd..934e126 --- a/vendor/heroku/heroku-buildpack-php/LICENSE +++ b/license.txt @@ -1,4 +1,6 @@ -Copyright (c) 2014 Heroku, Inc. +The MIT License (MIT) + +Copyright (c) 2014 - 2017, British Columbia Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -16,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE. \ No newline at end of file diff --git a/readme.rst b/readme.rst new file mode 100755 index 0000000..b652008 --- /dev/null +++ b/readme.rst @@ -0,0 +1,70 @@ +################### +What is CodeIgniter +################### + +CodeIgniter is an Application Development Framework - a toolkit - for people +who build web sites using PHP. Its goal is to enable you to develop projects +much faster than you could if you were writing code from scratch, by providing +a rich set of libraries for commonly needed tasks, as well as a simple +interface and logical structure to access these libraries. CodeIgniter lets +you creatively focus on your project by minimizing the amount of code needed +for a given task. + +******************* +Release Information +******************* + +This repo contains in-development code for future releases. To download the +latest stable release please visit the `CodeIgniter Downloads +`_ page. + +************************** +Changelog and New Features +************************** + +You can find a list of all changes for each release in the `user +guide change log `_. + +******************* +Server Requirements +******************* + +PHP version 5.6 or newer is recommended. + +It should work on 5.3.7 as well, but we strongly advise you NOT to run +such old versions of PHP, because of potential security and performance +issues, as well as missing features. + +************ +Installation +************ + +Please see the `installation section `_ +of the CodeIgniter User Guide. + +******* +License +******* + +Please see the `license +agreement `_. + +********* +Resources +********* + +- `User Guide `_ +- `Language File Translations `_ +- `Community Forums `_ +- `Community Wiki `_ +- `Community Slack Channel `_ + +Report security issues to our `Security Panel `_ +or via our `page on HackerOne `_, thank you. + +*************** +Acknowledgement +*************** + +The CodeIgniter team would like to thank EllisLab, all the +contributors to the CodeIgniter project and you, the CodeIgniter user. diff --git a/system/.htaccess b/system/.htaccess new file mode 100755 index 0000000..97c65d2 --- /dev/null +++ b/system/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php new file mode 100755 index 0000000..b3ac79c --- /dev/null +++ b/system/core/Benchmark.php @@ -0,0 +1,133 @@ +marker[$name] = microtime(TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Elapsed time + * + * Calculates the time difference between two marked points. + * + * If the first parameter is empty this function instead returns the + * {elapsed_time} pseudo-variable. This permits the full system + * execution time to be shown in a template. The output class will + * swap the real value for this variable. + * + * @param string $point1 A particular marked point + * @param string $point2 A particular marked point + * @param int $decimals Number of decimal places + * + * @return string Calculated elapsed time on success, + * an '{elapsed_string}' if $point1 is empty + * or an empty string if $point1 is not found. + */ + public function elapsed_time($point1 = '', $point2 = '', $decimals = 4) + { + if ($point1 === '') + { + return '{elapsed_time}'; + } + + if ( ! isset($this->marker[$point1])) + { + return ''; + } + + if ( ! isset($this->marker[$point2])) + { + $this->marker[$point2] = microtime(TRUE); + } + + return number_format($this->marker[$point2] - $this->marker[$point1], $decimals); + } + + // -------------------------------------------------------------------- + + /** + * Memory Usage + * + * Simply returns the {memory_usage} marker. + * + * This permits it to be put it anywhere in a template + * without the memory being calculated until the end. + * The output class will swap the real value for this variable. + * + * @return string '{memory_usage}' + */ + public function memory_usage() + { + return '{memory_usage}'; + } + +} diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php new file mode 100755 index 0000000..0d03293 --- /dev/null +++ b/system/core/CodeIgniter.php @@ -0,0 +1,559 @@ + '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal) + { + if (strpos($_registered, $key) === FALSE) + { + continue; + } + + foreach (array_keys($$superglobal) as $var) + { + if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE)) + { + $GLOBALS[$var] = NULL; + } + } + } + } +} + + +/* + * ------------------------------------------------------ + * Define a custom error handler so we can log PHP errors + * ------------------------------------------------------ + */ + set_error_handler('_error_handler'); + set_exception_handler('_exception_handler'); + register_shutdown_function('_shutdown_handler'); + +/* + * ------------------------------------------------------ + * Set the subclass_prefix + * ------------------------------------------------------ + * + * Normally the "subclass_prefix" is set in the config file. + * The subclass prefix allows CI to know if a core class is + * being extended via a library in the local application + * "libraries" folder. Since CI allows config items to be + * overridden via data set in the main index.php file, + * before proceeding we need to know if a subclass_prefix + * override exists. If so, we will set this value now, + * before any classes are loaded + * Note: Since the config file data is cached it doesn't + * hurt to load it here. + */ + if ( ! empty($assign_to_config['subclass_prefix'])) + { + get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix'])); + } + +/* + * ------------------------------------------------------ + * Should we use a Composer autoloader? + * ------------------------------------------------------ + */ + if ($composer_autoload = config_item('composer_autoload')) + { + if ($composer_autoload === TRUE) + { + file_exists(APPPATH.'vendor/autoload.php') + ? require_once(APPPATH.'vendor/autoload.php') + : log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); + } + elseif (file_exists($composer_autoload)) + { + require_once($composer_autoload); + } + else + { + log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload); + } + } + +/* + * ------------------------------------------------------ + * Start the timer... tick tock tick tock... + * ------------------------------------------------------ + */ + $BM =& load_class('Benchmark', 'core'); + $BM->mark('total_execution_time_start'); + $BM->mark('loading_time:_base_classes_start'); + +/* + * ------------------------------------------------------ + * Instantiate the hooks class + * ------------------------------------------------------ + */ + $EXT =& load_class('Hooks', 'core'); + +/* + * ------------------------------------------------------ + * Is there a "pre_system" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('pre_system'); + +/* + * ------------------------------------------------------ + * Instantiate the config class + * ------------------------------------------------------ + * + * Note: It is important that Config is loaded first as + * most other classes depend on it either directly or by + * depending on another class that uses it. + * + */ + $CFG =& load_class('Config', 'core'); + + // Do we have any manually set config items in the index.php file? + if (isset($assign_to_config) && is_array($assign_to_config)) + { + foreach ($assign_to_config as $key => $value) + { + $CFG->set_item($key, $value); + } + } + +/* + * ------------------------------------------------------ + * Important charset-related stuff + * ------------------------------------------------------ + * + * Configure mbstring and/or iconv if they are enabled + * and set MB_ENABLED and ICONV_ENABLED constants, so + * that we don't repeatedly do extension_loaded() or + * function_exists() calls. + * + * Note: UTF-8 class depends on this. It used to be done + * in it's constructor, but it's _not_ class-specific. + * + */ + $charset = strtoupper(config_item('charset')); + ini_set('default_charset', $charset); + + if (extension_loaded('mbstring')) + { + define('MB_ENABLED', TRUE); + // mbstring.internal_encoding is deprecated starting with PHP 5.6 + // and it's usage triggers E_DEPRECATED messages. + @ini_set('mbstring.internal_encoding', $charset); + // This is required for mb_convert_encoding() to strip invalid characters. + // That's utilized by CI_Utf8, but it's also done for consistency with iconv. + mb_substitute_character('none'); + } + else + { + define('MB_ENABLED', FALSE); + } + + // There's an ICONV_IMPL constant, but the PHP manual says that using + // iconv's predefined constants is "strongly discouraged". + if (extension_loaded('iconv')) + { + define('ICONV_ENABLED', TRUE); + // iconv.internal_encoding is deprecated starting with PHP 5.6 + // and it's usage triggers E_DEPRECATED messages. + @ini_set('iconv.internal_encoding', $charset); + } + else + { + define('ICONV_ENABLED', FALSE); + } + + if (is_php('5.6')) + { + ini_set('php.internal_encoding', $charset); + } + +/* + * ------------------------------------------------------ + * Load compatibility features + * ------------------------------------------------------ + */ + + require_once(BASEPATH.'core/compat/mbstring.php'); + require_once(BASEPATH.'core/compat/hash.php'); + require_once(BASEPATH.'core/compat/password.php'); + require_once(BASEPATH.'core/compat/standard.php'); + +/* + * ------------------------------------------------------ + * Instantiate the UTF-8 class + * ------------------------------------------------------ + */ + $UNI =& load_class('Utf8', 'core'); + +/* + * ------------------------------------------------------ + * Instantiate the URI class + * ------------------------------------------------------ + */ + $URI =& load_class('URI', 'core'); + +/* + * ------------------------------------------------------ + * Instantiate the routing class and set the routing + * ------------------------------------------------------ + */ + $RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL); + +/* + * ------------------------------------------------------ + * Instantiate the output class + * ------------------------------------------------------ + */ + $OUT =& load_class('Output', 'core'); + +/* + * ------------------------------------------------------ + * Is there a valid cache file? If so, we're done... + * ------------------------------------------------------ + */ + if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE) + { + exit; + } + +/* + * ----------------------------------------------------- + * Load the security class for xss and csrf support + * ----------------------------------------------------- + */ + $SEC =& load_class('Security', 'core'); + +/* + * ------------------------------------------------------ + * Load the Input class and sanitize globals + * ------------------------------------------------------ + */ + $IN =& load_class('Input', 'core'); + +/* + * ------------------------------------------------------ + * Load the Language class + * ------------------------------------------------------ + */ + $LANG =& load_class('Lang', 'core'); + +/* + * ------------------------------------------------------ + * Load the app controller and local controller + * ------------------------------------------------------ + * + */ + // Load the base controller class + require_once BASEPATH.'core/Controller.php'; + + /** + * Reference to the CI_Controller method. + * + * Returns current CI instance object + * + * @return CI_Controller + */ + function &get_instance() + { + return CI_Controller::get_instance(); + } + + if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) + { + require_once APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'; + } + + // Set a mark point for benchmarking + $BM->mark('loading_time:_base_classes_end'); + +/* + * ------------------------------------------------------ + * Sanity checks + * ------------------------------------------------------ + * + * The Router class has already validated the request, + * leaving us with 3 options here: + * + * 1) an empty class name, if we reached the default + * controller, but it didn't exist; + * 2) a query string which doesn't go through a + * file_exists() check + * 3) a regular request for a non-existing page + * + * We handle all of these as a 404 error. + * + * Furthermore, none of the methods in the app controller + * or the loader class can be called via the URI, nor can + * controller methods that begin with an underscore. + */ + + $e404 = FALSE; + $class = ucfirst($RTR->class); + $method = $RTR->method; + + if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php')) + { + $e404 = TRUE; + } + else + { + require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php'); + + if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method)) + { + $e404 = TRUE; + } + elseif (method_exists($class, '_remap')) + { + $params = array($method, array_slice($URI->rsegments, 2)); + $method = '_remap'; + } + elseif ( ! method_exists($class, $method)) + { + $e404 = TRUE; + } + /** + * DO NOT CHANGE THIS, NOTHING ELSE WORKS! + * + * - method_exists() returns true for non-public methods, which passes the previous elseif + * - is_callable() returns false for PHP 4-style constructors, even if there's a __construct() + * - method_exists($class, '__construct') won't work because CI_Controller::__construct() is inherited + * - People will only complain if this doesn't work, even though it is documented that it shouldn't. + * + * ReflectionMethod::isConstructor() is the ONLY reliable check, + * knowing which method will be executed as a constructor. + */ + elseif ( ! is_callable(array($class, $method))) + { + $reflection = new ReflectionMethod($class, $method); + if ( ! $reflection->isPublic() OR $reflection->isConstructor()) + { + $e404 = TRUE; + } + } + } + + if ($e404) + { + if ( ! empty($RTR->routes['404_override'])) + { + if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2) + { + $error_method = 'index'; + } + + $error_class = ucfirst($error_class); + + if ( ! class_exists($error_class, FALSE)) + { + if (file_exists(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php')) + { + require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php'); + $e404 = ! class_exists($error_class, FALSE); + } + // Were we in a directory? If so, check for a global override + elseif ( ! empty($RTR->directory) && file_exists(APPPATH.'controllers/'.$error_class.'.php')) + { + require_once(APPPATH.'controllers/'.$error_class.'.php'); + if (($e404 = ! class_exists($error_class, FALSE)) === FALSE) + { + $RTR->directory = ''; + } + } + } + else + { + $e404 = FALSE; + } + } + + // Did we reset the $e404 flag? If so, set the rsegments, starting from index 1 + if ( ! $e404) + { + $class = $error_class; + $method = $error_method; + + $URI->rsegments = array( + 1 => $class, + 2 => $method + ); + } + else + { + show_404($RTR->directory.$class.'/'.$method); + } + } + + if ($method !== '_remap') + { + $params = array_slice($URI->rsegments, 2); + } + +/* + * ------------------------------------------------------ + * Is there a "pre_controller" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('pre_controller'); + +/* + * ------------------------------------------------------ + * Instantiate the requested controller + * ------------------------------------------------------ + */ + // Mark a start point so we can benchmark the controller + $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start'); + + $CI = new $class(); + +/* + * ------------------------------------------------------ + * Is there a "post_controller_constructor" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('post_controller_constructor'); + +/* + * ------------------------------------------------------ + * Call the requested method + * ------------------------------------------------------ + */ + call_user_func_array(array(&$CI, $method), $params); + + // Mark a benchmark end point + $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end'); + +/* + * ------------------------------------------------------ + * Is there a "post_controller" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('post_controller'); + +/* + * ------------------------------------------------------ + * Send the final rendered output to the browser + * ------------------------------------------------------ + */ + if ($EXT->call_hook('display_override') === FALSE) + { + $OUT->_display(); + } + +/* + * ------------------------------------------------------ + * Is there a "post_system" hook? + * ------------------------------------------------------ + */ + $EXT->call_hook('post_system'); diff --git a/system/core/Common.php b/system/core/Common.php new file mode 100755 index 0000000..d6a1fdb --- /dev/null +++ b/system/core/Common.php @@ -0,0 +1,849 @@ +='); + } + + return $_is_php[$version]; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('is_really_writable')) +{ + /** + * Tests for file writability + * + * is_writable() returns TRUE on Windows servers when you really can't write to + * the file, based on the read-only attribute. is_writable() is also unreliable + * on Unix servers if safe_mode is on. + * + * @link https://bugs.php.net/bug.php?id=54709 + * @param string + * @return bool + */ + function is_really_writable($file) + { + // If we're on a Unix server with safe_mode off we call is_writable + if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') OR ! ini_get('safe_mode'))) + { + return is_writable($file); + } + + /* For Windows servers and safe_mode "on" installations we'll actually + * write a file then read it. Bah... + */ + if (is_dir($file)) + { + $file = rtrim($file, '/').'/'.md5(mt_rand()); + if (($fp = @fopen($file, 'ab')) === FALSE) + { + return FALSE; + } + + fclose($fp); + @chmod($file, 0777); + @unlink($file); + return TRUE; + } + elseif ( ! is_file($file) OR ($fp = @fopen($file, 'ab')) === FALSE) + { + return FALSE; + } + + fclose($fp); + return TRUE; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('load_class')) +{ + /** + * Class registry + * + * This function acts as a singleton. If the requested class does not + * exist it is instantiated and set to a static variable. If it has + * previously been instantiated the variable is returned. + * + * @param string the class name being requested + * @param string the directory where the class should be found + * @param mixed an optional argument to pass to the class constructor + * @return object + */ + function &load_class($class, $directory = 'libraries', $param = NULL) + { + static $_classes = array(); + + // Does the class exist? If so, we're done... + if (isset($_classes[$class])) + { + return $_classes[$class]; + } + + $name = FALSE; + + // Look for the class first in the local application/libraries folder + // then in the native system/libraries folder + foreach (array(APPPATH, BASEPATH) as $path) + { + if (file_exists($path.$directory.'/'.$class.'.php')) + { + $name = 'CI_'.$class; + + if (class_exists($name, FALSE) === FALSE) + { + require_once($path.$directory.'/'.$class.'.php'); + } + + break; + } + } + + // Is the request a class extension? If so we load it too + if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php')) + { + $name = config_item('subclass_prefix').$class; + + if (class_exists($name, FALSE) === FALSE) + { + require_once(APPPATH.$directory.'/'.$name.'.php'); + } + } + + // Did we find the class? + if ($name === FALSE) + { + // Note: We use exit() rather than show_error() in order to avoid a + // self-referencing loop with the Exceptions class + set_status_header(503); + echo 'Unable to locate the specified class: '.$class.'.php'; + exit(5); // EXIT_UNK_CLASS + } + + // Keep track of what we just loaded + is_loaded($class); + + $_classes[$class] = isset($param) + ? new $name($param) + : new $name(); + return $_classes[$class]; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('is_loaded')) +{ + /** + * Keeps track of which libraries have been loaded. This function is + * called by the load_class() function above + * + * @param string + * @return array + */ + function &is_loaded($class = '') + { + static $_is_loaded = array(); + + if ($class !== '') + { + $_is_loaded[strtolower($class)] = $class; + } + + return $_is_loaded; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('get_config')) +{ + /** + * Loads the main config.php file + * + * This function lets us grab the config file even if the Config class + * hasn't been instantiated yet + * + * @param array + * @return array + */ + function &get_config(Array $replace = array()) + { + static $config; + + if (empty($config)) + { + $file_path = APPPATH.'config/config.php'; + $found = FALSE; + if (file_exists($file_path)) + { + $found = TRUE; + require($file_path); + } + + // Is the config file in the environment folder? + if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) + { + require($file_path); + } + elseif ( ! $found) + { + set_status_header(503); + echo 'The configuration file does not exist.'; + exit(3); // EXIT_CONFIG + } + + // Does the $config array exist in the file? + if ( ! isset($config) OR ! is_array($config)) + { + set_status_header(503); + echo 'Your config file does not appear to be formatted correctly.'; + exit(3); // EXIT_CONFIG + } + } + + // Are any values being dynamically added or replaced? + foreach ($replace as $key => $val) + { + $config[$key] = $val; + } + + return $config; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('config_item')) +{ + /** + * Returns the specified config item + * + * @param string + * @return mixed + */ + function config_item($item) + { + static $_config; + + if (empty($_config)) + { + // references cannot be directly assigned to static variables, so we use an array + $_config[0] =& get_config(); + } + + return isset($_config[0][$item]) ? $_config[0][$item] : NULL; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('get_mimes')) +{ + /** + * Returns the MIME types array from config/mimes.php + * + * @return array + */ + function &get_mimes() + { + static $_mimes; + + if (empty($_mimes)) + { + $_mimes = file_exists(APPPATH.'config/mimes.php') + ? include(APPPATH.'config/mimes.php') + : array(); + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + $_mimes = array_merge($_mimes, include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')); + } + } + + return $_mimes; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('is_https')) +{ + /** + * Is HTTPS? + * + * Determines if the application is accessed via an encrypted + * (HTTPS) connection. + * + * @return bool + */ + function is_https() + { + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') + { + return TRUE; + } + elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') + { + return TRUE; + } + elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') + { + return TRUE; + } + + return FALSE; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('is_cli')) +{ + + /** + * Is CLI? + * + * Test to see if a request was made from the command line. + * + * @return bool + */ + function is_cli() + { + return (PHP_SAPI === 'cli' OR defined('STDIN')); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('show_error')) +{ + /** + * Error Handler + * + * This function lets us invoke the exception class and + * display errors using the standard error template located + * in application/views/errors/error_general.php + * This function will send the error page directly to the + * browser and exit. + * + * @param string + * @param int + * @param string + * @return void + */ + function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') + { + $status_code = abs($status_code); + if ($status_code < 100) + { + $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN + $status_code = 500; + } + else + { + $exit_status = 1; // EXIT_ERROR + } + + $_error =& load_class('Exceptions', 'core'); + echo $_error->show_error($heading, $message, 'error_general', $status_code); + exit($exit_status); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('show_404')) +{ + /** + * 404 Page Handler + * + * This function is similar to the show_error() function above + * However, instead of the standard error template it displays + * 404 errors. + * + * @param string + * @param bool + * @return void + */ + function show_404($page = '', $log_error = TRUE) + { + $_error =& load_class('Exceptions', 'core'); + $_error->show_404($page, $log_error); + exit(4); // EXIT_UNKNOWN_FILE + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('log_message')) +{ + /** + * Error Logging Interface + * + * We use this as a simple mechanism to access the logging + * class and send messages to be logged. + * + * @param string the error level: 'error', 'debug' or 'info' + * @param string the error message + * @return void + */ + function log_message($level, $message) + { + static $_log; + + if ($_log === NULL) + { + // references cannot be directly assigned to static variables, so we use an array + $_log[0] =& load_class('Log', 'core'); + } + + $_log[0]->write_log($level, $message); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('set_status_header')) +{ + /** + * Set HTTP Status Header + * + * @param int the status code + * @param string + * @return void + */ + function set_status_header($code = 200, $text = '') + { + if (is_cli()) + { + return; + } + + if (empty($code) OR ! is_numeric($code)) + { + show_error('Status codes must be numeric', 500); + } + + if (empty($text)) + { + is_int($code) OR $code = (int) $code; + $stati = array( + 100 => 'Continue', + 101 => 'Switching Protocols', + + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed', + 422 => 'Unprocessable Entity', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 511 => 'Network Authentication Required', + ); + + if (isset($stati[$code])) + { + $text = $stati[$code]; + } + else + { + show_error('No status text available. Please check your status code number or supply your own message text.', 500); + } + } + + if (strpos(PHP_SAPI, 'cgi') === 0) + { + header('Status: '.$code.' '.$text, TRUE); + return; + } + + $server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE)) + ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; + header($server_protocol.' '.$code.' '.$text, TRUE, $code); + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('_error_handler')) +{ + /** + * Error Handler + * + * This is the custom error handler that is declared at the (relative) + * top of CodeIgniter.php. The main reason we use this is to permit + * PHP errors to be logged in our own log files since the user may + * not have access to server logs. Since this function effectively + * intercepts PHP errors, however, we also need to display errors + * based on the current error_reporting level. + * We do that with the use of a PHP error template. + * + * @param int $severity + * @param string $message + * @param string $filepath + * @param int $line + * @return void + */ + function _error_handler($severity, $message, $filepath, $line) + { + $is_error = (((E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity); + + // When an error occurred, set the status header to '500 Internal Server Error' + // to indicate to the client something went wrong. + // This can't be done within the $_error->show_php_error method because + // it is only called when the display_errors flag is set (which isn't usually + // the case in a production environment) or when errors are ignored because + // they are above the error_reporting threshold. + if ($is_error) + { + set_status_header(500); + } + + // Should we ignore the error? We'll get the current error_reporting + // level and add its bits with the severity bits to find out. + if (($severity & error_reporting()) !== $severity) + { + return; + } + + $_error =& load_class('Exceptions', 'core'); + $_error->log_exception($severity, $message, $filepath, $line); + + // Should we display the error? + if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) + { + $_error->show_php_error($severity, $message, $filepath, $line); + } + + // If the error is fatal, the execution of the script should be stopped because + // errors can't be recovered from. Halting the script conforms with PHP's + // default error handling. See http://www.php.net/manual/en/errorfunc.constants.php + if ($is_error) + { + exit(1); // EXIT_ERROR + } + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('_exception_handler')) +{ + /** + * Exception Handler + * + * Sends uncaught exceptions to the logger and displays them + * only if display_errors is On so that they don't show up in + * production environments. + * + * @param Exception $exception + * @return void + */ + function _exception_handler($exception) + { + $_error =& load_class('Exceptions', 'core'); + $_error->log_exception('error', 'Exception: '.$exception->getMessage(), $exception->getFile(), $exception->getLine()); + + is_cli() OR set_status_header(500); + // Should we display the error? + if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) + { + $_error->show_exception($exception); + } + + exit(1); // EXIT_ERROR + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('_shutdown_handler')) +{ + /** + * Shutdown Handler + * + * This is the shutdown handler that is declared at the top + * of CodeIgniter.php. The main reason we use this is to simulate + * a complete custom exception handler. + * + * E_STRICT is purposively neglected because such events may have + * been caught. Duplication or none? None is preferred for now. + * + * @link http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a + * @return void + */ + function _shutdown_handler() + { + $last_error = error_get_last(); + if (isset($last_error) && + ($last_error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING))) + { + _error_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']); + } + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('remove_invisible_characters')) +{ + /** + * Remove Invisible Characters + * + * This prevents sandwiching null characters + * between ascii characters, like Java\0script. + * + * @param string + * @param bool + * @return string + */ + function remove_invisible_characters($str, $url_encoded = TRUE) + { + $non_displayables = array(); + + // every control character except newline (dec 10), + // carriage return (dec 13) and horizontal tab (dec 09) + if ($url_encoded) + { + $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15 + $non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31 + $non_displayables[] = '/%7f/i'; // url encoded 127 + } + + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 + + do + { + $str = preg_replace($non_displayables, '', $str, -1, $count); + } + while ($count); + + return $str; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('html_escape')) +{ + /** + * Returns HTML escaped variable. + * + * @param mixed $var The input string or array of strings to be escaped. + * @param bool $double_encode $double_encode set to FALSE prevents escaping twice. + * @return mixed The escaped string or array of strings as a result. + */ + function html_escape($var, $double_encode = TRUE) + { + if (empty($var)) + { + return $var; + } + + if (is_array($var)) + { + foreach (array_keys($var) as $key) + { + $var[$key] = html_escape($var[$key], $double_encode); + } + + return $var; + } + + return htmlspecialchars($var, ENT_QUOTES, config_item('charset'), $double_encode); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('_stringify_attributes')) +{ + /** + * Stringify attributes for use in HTML tags. + * + * Helper function used to convert a string, array, or object + * of attributes to a string. + * + * @param mixed string, array, object + * @param bool + * @return string + */ + function _stringify_attributes($attributes, $js = FALSE) + { + $atts = NULL; + + if (empty($attributes)) + { + return $atts; + } + + if (is_string($attributes)) + { + return ' '.$attributes; + } + + $attributes = (array) $attributes; + + foreach ($attributes as $key => $val) + { + $atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"'; + } + + return rtrim($atts, ','); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('function_usable')) +{ + /** + * Function usable + * + * Executes a function_exists() check, and if the Suhosin PHP + * extension is loaded - checks whether the function that is + * checked might be disabled in there as well. + * + * This is useful as function_exists() will return FALSE for + * functions disabled via the *disable_functions* php.ini + * setting, but not for *suhosin.executor.func.blacklist* and + * *suhosin.executor.disable_eval*. These settings will just + * terminate script execution if a disabled function is executed. + * + * The above described behavior turned out to be a bug in Suhosin, + * but even though a fix was committed for 0.9.34 on 2012-02-12, + * that version is yet to be released. This function will therefore + * be just temporary, but would probably be kept for a few years. + * + * @link http://www.hardened-php.net/suhosin/ + * @param string $function_name Function to check for + * @return bool TRUE if the function exists and is safe to call, + * FALSE otherwise. + */ + function function_usable($function_name) + { + static $_suhosin_func_blacklist; + + if (function_exists($function_name)) + { + if ( ! isset($_suhosin_func_blacklist)) + { + $_suhosin_func_blacklist = extension_loaded('suhosin') + ? explode(',', trim(ini_get('suhosin.executor.func.blacklist'))) + : array(); + } + + return ! in_array($function_name, $_suhosin_func_blacklist, TRUE); + } + + return FALSE; + } +} diff --git a/system/core/Config.php b/system/core/Config.php new file mode 100755 index 0000000..cda6224 --- /dev/null +++ b/system/core/Config.php @@ -0,0 +1,379 @@ +config =& get_config(); + + // Set the base_url automatically if none was provided + if (empty($this->config['base_url'])) + { + if (isset($_SERVER['SERVER_ADDR'])) + { + if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE) + { + $server_addr = '['.$_SERVER['SERVER_ADDR'].']'; + } + else + { + $server_addr = $_SERVER['SERVER_ADDR']; + } + + $base_url = (is_https() ? 'https' : 'http').'://'.$server_addr + .substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME']))); + } + else + { + $base_url = 'http://localhost/'; + } + + $this->set_item('base_url', $base_url); + } + + log_message('info', 'Config Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Load Config File + * + * @param string $file Configuration file name + * @param bool $use_sections Whether configuration values should be loaded into their own section + * @param bool $fail_gracefully Whether to just return FALSE or display an error message + * @return bool TRUE if the file was loaded correctly or FALSE on failure + */ + public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) + { + $file = ($file === '') ? 'config' : str_replace('.php', '', $file); + $loaded = FALSE; + + foreach ($this->_config_paths as $path) + { + foreach (array($file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location) + { + $file_path = $path.'config/'.$location.'.php'; + if (in_array($file_path, $this->is_loaded, TRUE)) + { + return TRUE; + } + + if ( ! file_exists($file_path)) + { + continue; + } + + include($file_path); + + if ( ! isset($config) OR ! is_array($config)) + { + if ($fail_gracefully === TRUE) + { + return FALSE; + } + + show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); + } + + if ($use_sections === TRUE) + { + $this->config[$file] = isset($this->config[$file]) + ? array_merge($this->config[$file], $config) + : $config; + } + else + { + $this->config = array_merge($this->config, $config); + } + + $this->is_loaded[] = $file_path; + $config = NULL; + $loaded = TRUE; + log_message('debug', 'Config file loaded: '.$file_path); + } + } + + if ($loaded === TRUE) + { + return TRUE; + } + elseif ($fail_gracefully === TRUE) + { + return FALSE; + } + + show_error('The configuration file '.$file.'.php does not exist.'); + } + + // -------------------------------------------------------------------- + + /** + * Fetch a config file item + * + * @param string $item Config item name + * @param string $index Index name + * @return string|null The configuration item or NULL if the item doesn't exist + */ + public function item($item, $index = '') + { + if ($index == '') + { + return isset($this->config[$item]) ? $this->config[$item] : NULL; + } + + return isset($this->config[$index], $this->config[$index][$item]) ? $this->config[$index][$item] : NULL; + } + + // -------------------------------------------------------------------- + + /** + * Fetch a config file item with slash appended (if not empty) + * + * @param string $item Config item name + * @return string|null The configuration item or NULL if the item doesn't exist + */ + public function slash_item($item) + { + if ( ! isset($this->config[$item])) + { + return NULL; + } + elseif (trim($this->config[$item]) === '') + { + return ''; + } + + return rtrim($this->config[$item], '/').'/'; + } + + // -------------------------------------------------------------------- + + /** + * Site URL + * + * Returns base_url . index_page [. uri_string] + * + * @uses CI_Config::_uri_string() + * + * @param string|string[] $uri URI string or an array of segments + * @param string $protocol + * @return string + */ + public function site_url($uri = '', $protocol = NULL) + { + $base_url = $this->slash_item('base_url'); + + if (isset($protocol)) + { + // For protocol-relative links + if ($protocol === '') + { + $base_url = substr($base_url, strpos($base_url, '//')); + } + else + { + $base_url = $protocol.substr($base_url, strpos($base_url, '://')); + } + } + + if (empty($uri)) + { + return $base_url.$this->item('index_page'); + } + + $uri = $this->_uri_string($uri); + + if ($this->item('enable_query_strings') === FALSE) + { + $suffix = isset($this->config['url_suffix']) ? $this->config['url_suffix'] : ''; + + if ($suffix !== '') + { + if (($offset = strpos($uri, '?')) !== FALSE) + { + $uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset); + } + else + { + $uri .= $suffix; + } + } + + return $base_url.$this->slash_item('index_page').$uri; + } + elseif (strpos($uri, '?') === FALSE) + { + $uri = '?'.$uri; + } + + return $base_url.$this->item('index_page').$uri; + } + + // ------------------------------------------------------------- + + /** + * Base URL + * + * Returns base_url [. uri_string] + * + * @uses CI_Config::_uri_string() + * + * @param string|string[] $uri URI string or an array of segments + * @param string $protocol + * @return string + */ + public function base_url($uri = '', $protocol = NULL) + { + $base_url = $this->slash_item('base_url'); + + if (isset($protocol)) + { + // For protocol-relative links + if ($protocol === '') + { + $base_url = substr($base_url, strpos($base_url, '//')); + } + else + { + $base_url = $protocol.substr($base_url, strpos($base_url, '://')); + } + } + + return $base_url.$this->_uri_string($uri); + } + + // ------------------------------------------------------------- + + /** + * Build URI string + * + * @used-by CI_Config::site_url() + * @used-by CI_Config::base_url() + * + * @param string|string[] $uri URI string or an array of segments + * @return string + */ + protected function _uri_string($uri) + { + if ($this->item('enable_query_strings') === FALSE) + { + is_array($uri) && $uri = implode('/', $uri); + return ltrim($uri, '/'); + } + elseif (is_array($uri)) + { + return http_build_query($uri); + } + + return $uri; + } + + // -------------------------------------------------------------------- + + /** + * System URL + * + * @deprecated 3.0.0 Encourages insecure practices + * @return string + */ + public function system_url() + { + $x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH)); + return $this->slash_item('base_url').end($x).'/'; + } + + // -------------------------------------------------------------------- + + /** + * Set a config file item + * + * @param string $item Config item key + * @param string $value Config item value + * @return void + */ + public function set_item($item, $value) + { + $this->config[$item] = $value; + } + +} diff --git a/system/core/Controller.php b/system/core/Controller.php new file mode 100755 index 0000000..59a9167 --- /dev/null +++ b/system/core/Controller.php @@ -0,0 +1,96 @@ + $class) + { + $this->$var =& load_class($class); + } + + $this->load =& load_class('Loader', 'core'); + $this->load->initialize(); + log_message('info', 'Controller Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Get the CI singleton + * + * @static + * @return object + */ + public static function &get_instance() + { + return self::$instance; + } + +} diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php new file mode 100755 index 0000000..5269096 --- /dev/null +++ b/system/core/Exceptions.php @@ -0,0 +1,274 @@ + 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + ); + + /** + * Class constructor + * + * @return void + */ + public function __construct() + { + $this->ob_level = ob_get_level(); + // Note: Do not log messages from this constructor. + } + + // -------------------------------------------------------------------- + + /** + * Exception Logger + * + * Logs PHP generated error messages + * + * @param int $severity Log level + * @param string $message Error message + * @param string $filepath File path + * @param int $line Line number + * @return void + */ + public function log_exception($severity, $message, $filepath, $line) + { + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; + log_message('error', 'Severity: '.$severity.' --> '.$message.' '.$filepath.' '.$line); + } + + // -------------------------------------------------------------------- + + /** + * 404 Error Handler + * + * @uses CI_Exceptions::show_error() + * + * @param string $page Page URI + * @param bool $log_error Whether to log the error + * @return void + */ + public function show_404($page = '', $log_error = TRUE) + { + if (is_cli()) + { + $heading = 'Not Found'; + $message = 'The controller/method pair you requested was not found.'; + } + else + { + $heading = '404 Page Not Found'; + $message = 'The page you requested was not found.'; + } + + // By default we log this, but allow a dev to skip it + if ($log_error) + { + log_message('error', $heading.': '.$page); + } + + echo $this->show_error($heading, $message, 'error_404', 404); + exit(4); // EXIT_UNKNOWN_FILE + } + + // -------------------------------------------------------------------- + + /** + * General Error Page + * + * Takes an error message as input (either as a string or an array) + * and displays it using the specified template. + * + * @param string $heading Page heading + * @param string|string[] $message Error message + * @param string $template Template name + * @param int $status_code (default: 500) + * + * @return string Error page output + */ + public function show_error($heading, $message, $template = 'error_general', $status_code = 500) + { + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } + + if (is_cli()) + { + $message = "\t".(is_array($message) ? implode("\n\t", $message) : $message); + $template = 'cli'.DIRECTORY_SEPARATOR.$template; + } + else + { + set_status_header($status_code); + $message = '

'.(is_array($message) ? implode('

', $message) : $message).'

'; + $template = 'html'.DIRECTORY_SEPARATOR.$template; + } + + if (ob_get_level() > $this->ob_level + 1) + { + ob_end_flush(); + } + ob_start(); + include($templates_path.$template.'.php'); + $buffer = ob_get_contents(); + ob_end_clean(); + return $buffer; + } + + // -------------------------------------------------------------------- + + public function show_exception($exception) + { + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } + + $message = $exception->getMessage(); + if (empty($message)) + { + $message = '(null)'; + } + + if (is_cli()) + { + $templates_path .= 'cli'.DIRECTORY_SEPARATOR; + } + else + { + $templates_path .= 'html'.DIRECTORY_SEPARATOR; + } + + if (ob_get_level() > $this->ob_level + 1) + { + ob_end_flush(); + } + + ob_start(); + include($templates_path.'error_exception.php'); + $buffer = ob_get_contents(); + ob_end_clean(); + echo $buffer; + } + + // -------------------------------------------------------------------- + + /** + * Native PHP error handler + * + * @param int $severity Error level + * @param string $message Error message + * @param string $filepath File path + * @param int $line Line number + * @return void + */ + public function show_php_error($severity, $message, $filepath, $line) + { + $templates_path = config_item('error_views_path'); + if (empty($templates_path)) + { + $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + } + + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; + + // For safety reasons we don't show the full file path in non-CLI requests + if ( ! is_cli()) + { + $filepath = str_replace('\\', '/', $filepath); + if (FALSE !== strpos($filepath, '/')) + { + $x = explode('/', $filepath); + $filepath = $x[count($x)-2].'/'.end($x); + } + + $template = 'html'.DIRECTORY_SEPARATOR.'error_php'; + } + else + { + $template = 'cli'.DIRECTORY_SEPARATOR.'error_php'; + } + + if (ob_get_level() > $this->ob_level + 1) + { + ob_end_flush(); + } + ob_start(); + include($templates_path.$template.'.php'); + $buffer = ob_get_contents(); + ob_end_clean(); + echo $buffer; + } + +} diff --git a/system/core/Hooks.php b/system/core/Hooks.php new file mode 100755 index 0000000..f2d6f21 --- /dev/null +++ b/system/core/Hooks.php @@ -0,0 +1,266 @@ +item('enable_hooks') === FALSE) + { + return; + } + + // Grab the "hooks" definition file. + if (file_exists(APPPATH.'config/hooks.php')) + { + include(APPPATH.'config/hooks.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); + } + + // If there are no hooks, we're done. + if ( ! isset($hook) OR ! is_array($hook)) + { + return; + } + + $this->hooks =& $hook; + $this->enabled = TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Call Hook + * + * Calls a particular hook. Called by CodeIgniter.php. + * + * @uses CI_Hooks::_run_hook() + * + * @param string $which Hook name + * @return bool TRUE on success or FALSE on failure + */ + public function call_hook($which = '') + { + if ( ! $this->enabled OR ! isset($this->hooks[$which])) + { + return FALSE; + } + + if (is_array($this->hooks[$which]) && ! isset($this->hooks[$which]['function'])) + { + foreach ($this->hooks[$which] as $val) + { + $this->_run_hook($val); + } + } + else + { + $this->_run_hook($this->hooks[$which]); + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Run Hook + * + * Runs a particular hook + * + * @param array $data Hook details + * @return bool TRUE on success or FALSE on failure + */ + protected function _run_hook($data) + { + // Closures/lambda functions and array($object, 'method') callables + if (is_callable($data)) + { + is_array($data) + ? $data[0]->{$data[1]}() + : $data(); + + return TRUE; + } + elseif ( ! is_array($data)) + { + return FALSE; + } + + // ----------------------------------- + // Safety - Prevents run-away loops + // ----------------------------------- + + // If the script being called happens to have the same + // hook call within it a loop can happen + if ($this->_in_progress === TRUE) + { + return; + } + + // ----------------------------------- + // Set file path + // ----------------------------------- + + if ( ! isset($data['filepath'], $data['filename'])) + { + return FALSE; + } + + $filepath = APPPATH.$data['filepath'].'/'.$data['filename']; + + if ( ! file_exists($filepath)) + { + return FALSE; + } + + // Determine and class and/or function names + $class = empty($data['class']) ? FALSE : $data['class']; + $function = empty($data['function']) ? FALSE : $data['function']; + $params = isset($data['params']) ? $data['params'] : ''; + + if (empty($function)) + { + return FALSE; + } + + // Set the _in_progress flag + $this->_in_progress = TRUE; + + // Call the requested class and/or function + if ($class !== FALSE) + { + // The object is stored? + if (isset($this->_objects[$class])) + { + if (method_exists($this->_objects[$class], $function)) + { + $this->_objects[$class]->$function($params); + } + else + { + return $this->_in_progress = FALSE; + } + } + else + { + class_exists($class, FALSE) OR require_once($filepath); + + if ( ! class_exists($class, FALSE) OR ! method_exists($class, $function)) + { + return $this->_in_progress = FALSE; + } + + // Store the object and execute the method + $this->_objects[$class] = new $class(); + $this->_objects[$class]->$function($params); + } + } + else + { + function_exists($function) OR require_once($filepath); + + if ( ! function_exists($function)) + { + return $this->_in_progress = FALSE; + } + + $function($params); + } + + $this->_in_progress = FALSE; + return TRUE; + } + +} diff --git a/system/core/Input.php b/system/core/Input.php new file mode 100755 index 0000000..af4f87c --- /dev/null +++ b/system/core/Input.php @@ -0,0 +1,895 @@ +_allow_get_array = (config_item('allow_get_array') === TRUE); + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); + $this->_standardize_newlines = (bool) config_item('standardize_newlines'); + + $this->security =& load_class('Security', 'core'); + + // Do we need the UTF-8 class? + if (UTF8_ENABLED === TRUE) + { + $this->uni =& load_class('Utf8', 'core'); + } + + // Sanitize global arrays + $this->_sanitize_globals(); + + // CSRF Protection check + if ($this->_enable_csrf === TRUE && ! is_cli()) + { + $this->security->csrf_verify(); + } + + log_message('info', 'Input Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Fetch from array + * + * Internal method used to retrieve values from global arrays. + * + * @param array &$array $_GET, $_POST, $_COOKIE, $_SERVER, etc. + * @param mixed $index Index for item to be fetched from $array + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL) + { + is_bool($xss_clean) OR $xss_clean = $this->_enable_xss; + + // If $index is NULL, it means that the whole $array is requested + isset($index) OR $index = array_keys($array); + + // allow fetching multiple keys at once + if (is_array($index)) + { + $output = array(); + foreach ($index as $key) + { + $output[$key] = $this->_fetch_from_array($array, $key, $xss_clean); + } + + return $output; + } + + if (isset($array[$index])) + { + $value = $array[$index]; + } + elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation + { + $value = $array; + for ($i = 0; $i < $count; $i++) + { + $key = trim($matches[0][$i], '[]'); + if ($key === '') // Empty notation will return the value as array + { + break; + } + + if (isset($value[$key])) + { + $value = $value[$key]; + } + else + { + return NULL; + } + } + } + else + { + return NULL; + } + + return ($xss_clean === TRUE) + ? $this->security->xss_clean($value) + : $value; + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from the GET array + * + * @param mixed $index Index for item to be fetched from $_GET + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function get($index = NULL, $xss_clean = NULL) + { + return $this->_fetch_from_array($_GET, $index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from the POST array + * + * @param mixed $index Index for item to be fetched from $_POST + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function post($index = NULL, $xss_clean = NULL) + { + return $this->_fetch_from_array($_POST, $index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from POST data with fallback to GET + * + * @param string $index Index for item to be fetched from $_POST or $_GET + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function post_get($index, $xss_clean = NULL) + { + return isset($_POST[$index]) + ? $this->post($index, $xss_clean) + : $this->get($index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from GET data with fallback to POST + * + * @param string $index Index for item to be fetched from $_GET or $_POST + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function get_post($index, $xss_clean = NULL) + { + return isset($_GET[$index]) + ? $this->get($index, $xss_clean) + : $this->post($index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from the COOKIE array + * + * @param mixed $index Index for item to be fetched from $_COOKIE + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function cookie($index = NULL, $xss_clean = NULL) + { + return $this->_fetch_from_array($_COOKIE, $index, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Fetch an item from the SERVER array + * + * @param mixed $index Index for item to be fetched from $_SERVER + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function server($index, $xss_clean = NULL) + { + return $this->_fetch_from_array($_SERVER, $index, $xss_clean); + } + + // ------------------------------------------------------------------------ + + /** + * Fetch an item from the php://input stream + * + * Useful when you need to access PUT, DELETE or PATCH request data. + * + * @param string $index Index for item to be fetched + * @param bool $xss_clean Whether to apply XSS filtering + * @return mixed + */ + public function input_stream($index = NULL, $xss_clean = NULL) + { + // Prior to PHP 5.6, the input stream can only be read once, + // so we'll need to check if we have already done that first. + if ( ! is_array($this->_input_stream)) + { + // $this->raw_input_stream will trigger __get(). + parse_str($this->raw_input_stream, $this->_input_stream); + is_array($this->_input_stream) OR $this->_input_stream = array(); + } + + return $this->_fetch_from_array($this->_input_stream, $index, $xss_clean); + } + + // ------------------------------------------------------------------------ + + /** + * Set cookie + * + * Accepts an arbitrary number of parameters (up to 7) or an associative + * array in the first parameter containing all the values. + * + * @param string|mixed[] $name Cookie name or an array containing parameters + * @param string $value Cookie value + * @param int $expire Cookie expiration time in seconds + * @param string $domain Cookie domain (e.g.: '.yourdomain.com') + * @param string $path Cookie path (default: '/') + * @param string $prefix Cookie name prefix + * @param bool $secure Whether to only transfer cookies via SSL + * @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript) + * @return void + */ + public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) + { + if (is_array($name)) + { + // always leave 'name' in last place, as the loop will break otherwise, due to $$item + foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item) + { + if (isset($name[$item])) + { + $$item = $name[$item]; + } + } + } + + if ($prefix === '' && config_item('cookie_prefix') !== '') + { + $prefix = config_item('cookie_prefix'); + } + + if ($domain == '' && config_item('cookie_domain') != '') + { + $domain = config_item('cookie_domain'); + } + + if ($path === '/' && config_item('cookie_path') !== '/') + { + $path = config_item('cookie_path'); + } + + $secure = ($secure === NULL && config_item('cookie_secure') !== NULL) + ? (bool) config_item('cookie_secure') + : (bool) $secure; + + $httponly = ($httponly === NULL && config_item('cookie_httponly') !== NULL) + ? (bool) config_item('cookie_httponly') + : (bool) $httponly; + + if ( ! is_numeric($expire)) + { + $expire = time() - 86500; + } + else + { + $expire = ($expire > 0) ? time() + $expire : 0; + } + + setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly); + } + + // -------------------------------------------------------------------- + + /** + * Fetch the IP Address + * + * Determines and validates the visitor's IP address. + * + * @return string IP address + */ + public function ip_address() + { + if ($this->ip_address !== FALSE) + { + return $this->ip_address; + } + + $proxy_ips = config_item('proxy_ips'); + if ( ! empty($proxy_ips) && ! is_array($proxy_ips)) + { + $proxy_ips = explode(',', str_replace(' ', '', $proxy_ips)); + } + + $this->ip_address = $this->server('REMOTE_ADDR'); + + if ($proxy_ips) + { + foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header) + { + if (($spoof = $this->server($header)) !== NULL) + { + // Some proxies typically list the whole chain of IP + // addresses through which the client has reached us. + // e.g. client_ip, proxy_ip1, proxy_ip2, etc. + sscanf($spoof, '%[^,]', $spoof); + + if ( ! $this->valid_ip($spoof)) + { + $spoof = NULL; + } + else + { + break; + } + } + } + + if ($spoof) + { + for ($i = 0, $c = count($proxy_ips); $i < $c; $i++) + { + // Check if we have an IP address or a subnet + if (strpos($proxy_ips[$i], '/') === FALSE) + { + // An IP address (and not a subnet) is specified. + // We can compare right away. + if ($proxy_ips[$i] === $this->ip_address) + { + $this->ip_address = $spoof; + break; + } + + continue; + } + + // We have a subnet ... now the heavy lifting begins + isset($separator) OR $separator = $this->valid_ip($this->ip_address, 'ipv6') ? ':' : '.'; + + // If the proxy entry doesn't match the IP protocol - skip it + if (strpos($proxy_ips[$i], $separator) === FALSE) + { + continue; + } + + // Convert the REMOTE_ADDR IP address to binary, if needed + if ( ! isset($ip, $sprintf)) + { + if ($separator === ':') + { + // Make sure we're have the "full" IPv6 format + $ip = explode(':', + str_replace('::', + str_repeat(':', 9 - substr_count($this->ip_address, ':')), + $this->ip_address + ) + ); + + for ($j = 0; $j < 8; $j++) + { + $ip[$j] = intval($ip[$j], 16); + } + + $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b'; + } + else + { + $ip = explode('.', $this->ip_address); + $sprintf = '%08b%08b%08b%08b'; + } + + $ip = vsprintf($sprintf, $ip); + } + + // Split the netmask length off the network address + sscanf($proxy_ips[$i], '%[^/]/%d', $netaddr, $masklen); + + // Again, an IPv6 address is most likely in a compressed form + if ($separator === ':') + { + $netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr)); + for ($j = 0; $j < 8; $j++) + { + $netaddr[$j] = intval($netaddr[$j], 16); + } + } + else + { + $netaddr = explode('.', $netaddr); + } + + // Convert to binary and finally compare + if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0) + { + $this->ip_address = $spoof; + break; + } + } + } + } + + if ( ! $this->valid_ip($this->ip_address)) + { + return $this->ip_address = '0.0.0.0'; + } + + return $this->ip_address; + } + + // -------------------------------------------------------------------- + + /** + * Validate IP Address + * + * @param string $ip IP address + * @param string $which IP protocol: 'ipv4' or 'ipv6' + * @return bool + */ + public function valid_ip($ip, $which = '') + { + switch (strtolower($which)) + { + case 'ipv4': + $which = FILTER_FLAG_IPV4; + break; + case 'ipv6': + $which = FILTER_FLAG_IPV6; + break; + default: + $which = NULL; + break; + } + + return (bool) filter_var($ip, FILTER_VALIDATE_IP, $which); + } + + // -------------------------------------------------------------------- + + /** + * Fetch User Agent string + * + * @return string|null User Agent string or NULL if it doesn't exist + */ + public function user_agent($xss_clean = NULL) + { + return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Sanitize Globals + * + * Internal method serving for the following purposes: + * + * - Unsets $_GET data, if query strings are not enabled + * - Cleans POST, COOKIE and SERVER data + * - Standardizes newline characters to PHP_EOL + * + * @return void + */ + protected function _sanitize_globals() + { + // Is $_GET data allowed? If not we'll set the $_GET to an empty array + if ($this->_allow_get_array === FALSE) + { + $_GET = array(); + } + elseif (is_array($_GET)) + { + foreach ($_GET as $key => $val) + { + $_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); + } + } + + // Clean $_POST Data + if (is_array($_POST)) + { + foreach ($_POST as $key => $val) + { + $_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); + } + } + + // Clean $_COOKIE Data + if (is_array($_COOKIE)) + { + // Also get rid of specially treated cookies that might be set by a server + // or silly application, that are of no use to a CI application anyway + // but that when present will trip our 'Disallowed Key Characters' alarm + // http://www.ietf.org/rfc/rfc2109.txt + // note that the key names below are single quoted strings, and are not PHP variables + unset( + $_COOKIE['$Version'], + $_COOKIE['$Path'], + $_COOKIE['$Domain'] + ); + + foreach ($_COOKIE as $key => $val) + { + if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE) + { + $_COOKIE[$cookie_key] = $this->_clean_input_data($val); + } + else + { + unset($_COOKIE[$key]); + } + } + } + + // Sanitize PHP_SELF + $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']); + + log_message('debug', 'Global POST, GET and COOKIE data sanitized'); + } + + // -------------------------------------------------------------------- + + /** + * Clean Input Data + * + * Internal method that aids in escaping data and + * standardizing newline characters to PHP_EOL. + * + * @param string|string[] $str Input string(s) + * @return string + */ + protected function _clean_input_data($str) + { + if (is_array($str)) + { + $new_array = array(); + foreach (array_keys($str) as $key) + { + $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]); + } + return $new_array; + } + + /* We strip slashes if magic quotes is on to keep things consistent + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) + { + $str = stripslashes($str); + } + + // Clean UTF-8 if supported + if (UTF8_ENABLED === TRUE) + { + $str = $this->uni->clean_string($str); + } + + // Remove control characters + $str = remove_invisible_characters($str, FALSE); + + // Standardize newlines if needed + if ($this->_standardize_newlines === TRUE) + { + return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Clean Keys + * + * Internal method that helps to prevent malicious users + * from trying to exploit keys we make sure that keys are + * only named with alpha-numeric text and a few other items. + * + * @param string $str Input string + * @param bool $fatal Whether to terminate script exection + * or to return FALSE if an invalid + * key is encountered + * @return string|bool + */ + protected function _clean_input_keys($str, $fatal = TRUE) + { + if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str)) + { + if ($fatal === TRUE) + { + return FALSE; + } + else + { + set_status_header(503); + echo 'Disallowed Key Characters.'; + exit(7); // EXIT_USER_INPUT + } + } + + // Clean UTF-8 if supported + if (UTF8_ENABLED === TRUE) + { + return $this->uni->clean_string($str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Request Headers + * + * @param bool $xss_clean Whether to apply XSS filtering + * @return array + */ + public function request_headers($xss_clean = FALSE) + { + // If header is already defined, return it immediately + if ( ! empty($this->headers)) + { + return $this->_fetch_from_array($this->headers, NULL, $xss_clean); + } + + // In Apache, you can simply call apache_request_headers() + if (function_exists('apache_request_headers')) + { + $this->headers = apache_request_headers(); + } + else + { + isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE']; + + foreach ($_SERVER as $key => $val) + { + if (sscanf($key, 'HTTP_%s', $header) === 1) + { + // take SOME_HEADER and turn it into Some-Header + $header = str_replace('_', ' ', strtolower($header)); + $header = str_replace(' ', '-', ucwords($header)); + + $this->headers[$header] = $_SERVER[$key]; + } + } + } + + return $this->_fetch_from_array($this->headers, NULL, $xss_clean); + } + + // -------------------------------------------------------------------- + + /** + * Get Request Header + * + * Returns the value of a single member of the headers class member + * + * @param string $index Header name + * @param bool $xss_clean Whether to apply XSS filtering + * @return string|null The requested header on success or NULL on failure + */ + public function get_request_header($index, $xss_clean = FALSE) + { + static $headers; + + if ( ! isset($headers)) + { + empty($this->headers) && $this->request_headers(); + foreach ($this->headers as $key => $value) + { + $headers[strtolower($key)] = $value; + } + } + + $index = strtolower($index); + + if ( ! isset($headers[$index])) + { + return NULL; + } + + return ($xss_clean === TRUE) + ? $this->security->xss_clean($headers[$index]) + : $headers[$index]; + } + + // -------------------------------------------------------------------- + + /** + * Is AJAX request? + * + * Test to see if a request contains the HTTP_X_REQUESTED_WITH header. + * + * @return bool + */ + public function is_ajax_request() + { + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); + } + + // -------------------------------------------------------------------- + + /** + * Is CLI request? + * + * Test to see if a request was made from the command line. + * + * @deprecated 3.0.0 Use is_cli() instead + * @return bool + */ + public function is_cli_request() + { + return is_cli(); + } + + // -------------------------------------------------------------------- + + /** + * Get Request Method + * + * Return the request method + * + * @param bool $upper Whether to return in upper or lower case + * (default: FALSE) + * @return string + */ + public function method($upper = FALSE) + { + return ($upper) + ? strtoupper($this->server('REQUEST_METHOD')) + : strtolower($this->server('REQUEST_METHOD')); + } + + // ------------------------------------------------------------------------ + + /** + * Magic __get() + * + * Allows read access to protected properties + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + if ($name === 'raw_input_stream') + { + isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input'); + return $this->_raw_input_stream; + } + elseif ($name === 'ip_address') + { + return $this->ip_address; + } + } + +} diff --git a/system/core/Lang.php b/system/core/Lang.php new file mode 100755 index 0000000..569b023 --- /dev/null +++ b/system/core/Lang.php @@ -0,0 +1,203 @@ +load($value, $idiom, $return, $add_suffix, $alt_path); + } + + return; + } + + $langfile = str_replace('.php', '', $langfile); + + if ($add_suffix === TRUE) + { + $langfile = preg_replace('/_lang$/', '', $langfile).'_lang'; + } + + $langfile .= '.php'; + + if (empty($idiom) OR ! preg_match('/^[a-z_-]+$/i', $idiom)) + { + $config =& get_config(); + $idiom = empty($config['language']) ? 'english' : $config['language']; + } + + if ($return === FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom) + { + return; + } + + // Load the base file, so any others found can override it + $basepath = BASEPATH.'language/'.$idiom.'/'.$langfile; + if (($found = file_exists($basepath)) === TRUE) + { + include($basepath); + } + + // Do we have an alternative path to look in? + if ($alt_path !== '') + { + $alt_path .= 'language/'.$idiom.'/'.$langfile; + if (file_exists($alt_path)) + { + include($alt_path); + $found = TRUE; + } + } + else + { + foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) + { + $package_path .= 'language/'.$idiom.'/'.$langfile; + if ($basepath !== $package_path && file_exists($package_path)) + { + include($package_path); + $found = TRUE; + break; + } + } + } + + if ($found !== TRUE) + { + show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); + } + + if ( ! isset($lang) OR ! is_array($lang)) + { + log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); + + if ($return === TRUE) + { + return array(); + } + return; + } + + if ($return === TRUE) + { + return $lang; + } + + $this->is_loaded[$langfile] = $idiom; + $this->language = array_merge($this->language, $lang); + + log_message('info', 'Language file loaded: language/'.$idiom.'/'.$langfile); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Language line + * + * Fetches a single line of text from the language array + * + * @param string $line Language line key + * @param bool $log_errors Whether to log an error message if the line is not found + * @return string Translation + */ + public function line($line, $log_errors = TRUE) + { + $value = isset($this->language[$line]) ? $this->language[$line] : FALSE; + + // Because killer robots like unicorns! + if ($value === FALSE && $log_errors === TRUE) + { + log_message('error', 'Could not find the language line "'.$line.'"'); + } + + return $value; + } + +} diff --git a/system/core/Loader.php b/system/core/Loader.php new file mode 100755 index 0000000..085c5b5 --- /dev/null +++ b/system/core/Loader.php @@ -0,0 +1,1409 @@ + TRUE); + + /** + * List of paths to load libraries from + * + * @var array + */ + protected $_ci_library_paths = array(APPPATH, BASEPATH); + + /** + * List of paths to load models from + * + * @var array + */ + protected $_ci_model_paths = array(APPPATH); + + /** + * List of paths to load helpers from + * + * @var array + */ + protected $_ci_helper_paths = array(APPPATH, BASEPATH); + + /** + * List of cached variables + * + * @var array + */ + protected $_ci_cached_vars = array(); + + /** + * List of loaded classes + * + * @var array + */ + protected $_ci_classes = array(); + + /** + * List of loaded models + * + * @var array + */ + protected $_ci_models = array(); + + /** + * List of loaded helpers + * + * @var array + */ + protected $_ci_helpers = array(); + + /** + * List of class name mappings + * + * @var array + */ + protected $_ci_varmap = array( + 'unit_test' => 'unit', + 'user_agent' => 'agent' + ); + + // -------------------------------------------------------------------- + + /** + * Class constructor + * + * Sets component load paths, gets the initial output buffering level. + * + * @return void + */ + public function __construct() + { + $this->_ci_ob_level = ob_get_level(); + $this->_ci_classes =& is_loaded(); + + log_message('info', 'Loader Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Initializer + * + * @todo Figure out a way to move this to the constructor + * without breaking *package_path*() methods. + * @uses CI_Loader::_ci_autoloader() + * @used-by CI_Controller::__construct() + * @return void + */ + public function initialize() + { + $this->_ci_autoloader(); + } + + // -------------------------------------------------------------------- + + /** + * Is Loaded + * + * A utility method to test if a class is in the self::$_ci_classes array. + * + * @used-by Mainly used by Form Helper function _get_validation_object(). + * + * @param string $class Class name to check for + * @return string|bool Class object name if loaded or FALSE + */ + public function is_loaded($class) + { + return array_search(ucfirst($class), $this->_ci_classes, TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Library Loader + * + * Loads and instantiates libraries. + * Designed to be called from application controllers. + * + * @param mixed $library Library name + * @param array $params Optional parameters to pass to the library class constructor + * @param string $object_name An optional object name to assign to + * @return object + */ + public function library($library, $params = NULL, $object_name = NULL) + { + if (empty($library)) + { + return $this; + } + elseif (is_array($library)) + { + foreach ($library as $key => $value) + { + if (is_int($key)) + { + $this->library($value, $params); + } + else + { + $this->library($key, $params, $value); + } + } + + return $this; + } + + if ($params !== NULL && ! is_array($params)) + { + $params = NULL; + } + + $this->_ci_load_library($library, $params, $object_name); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Model Loader + * + * Loads and instantiates models. + * + * @param string $model Model name + * @param string $name An optional object name to assign to + * @param bool $db_conn An optional database connection configuration to initialize + * @return object + */ + public function model($model, $name = '', $db_conn = FALSE) + { + if (empty($model)) + { + return $this; + } + elseif (is_array($model)) + { + foreach ($model as $key => $value) + { + is_int($key) ? $this->model($value, '', $db_conn) : $this->model($key, $value, $db_conn); + } + + return $this; + } + + $path = ''; + + // Is the model in a sub-folder? If so, parse out the filename and path. + if (($last_slash = strrpos($model, '/')) !== FALSE) + { + // The path is in front of the last slash + $path = substr($model, 0, ++$last_slash); + + // And the model name behind it + $model = substr($model, $last_slash); + } + + if (empty($name)) + { + $name = $model; + } + + if (in_array($name, $this->_ci_models, TRUE)) + { + return $this; + } + + $CI =& get_instance(); + if (isset($CI->$name)) + { + throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name); + } + + if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE)) + { + if ($db_conn === TRUE) + { + $db_conn = ''; + } + + $this->database($db_conn, FALSE, TRUE); + } + + // Note: All of the code under this condition used to be just: + // + // load_class('Model', 'core'); + // + // However, load_class() instantiates classes + // to cache them for later use and that prevents + // MY_Model from being an abstract class and is + // sub-optimal otherwise anyway. + if ( ! class_exists('CI_Model', FALSE)) + { + $app_path = APPPATH.'core'.DIRECTORY_SEPARATOR; + if (file_exists($app_path.'Model.php')) + { + require_once($app_path.'Model.php'); + if ( ! class_exists('CI_Model', FALSE)) + { + throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); + } + } + elseif ( ! class_exists('CI_Model', FALSE)) + { + require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); + } + + $class = config_item('subclass_prefix').'Model'; + if (file_exists($app_path.$class.'.php')) + { + require_once($app_path.$class.'.php'); + if ( ! class_exists($class, FALSE)) + { + throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class); + } + } + } + + $model = ucfirst($model); + if ( ! class_exists($model, FALSE)) + { + foreach ($this->_ci_model_paths as $mod_path) + { + if ( ! file_exists($mod_path.'models/'.$path.$model.'.php')) + { + continue; + } + + require_once($mod_path.'models/'.$path.$model.'.php'); + if ( ! class_exists($model, FALSE)) + { + throw new RuntimeException($mod_path."models/".$path.$model.".php exists, but doesn't declare class ".$model); + } + + break; + } + + if ( ! class_exists($model, FALSE)) + { + throw new RuntimeException('Unable to locate the model you have specified: '.$model); + } + } + elseif ( ! is_subclass_of($model, 'CI_Model')) + { + throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); + } + + $this->_ci_models[] = $name; + $CI->$name = new $model(); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Database Loader + * + * @param mixed $params Database configuration options + * @param bool $return Whether to return the database object + * @param bool $query_builder Whether to enable Query Builder + * (overrides the configuration setting) + * + * @return object|bool Database object if $return is set to TRUE, + * FALSE on failure, CI_Loader instance in any other case + */ + public function database($params = '', $return = FALSE, $query_builder = NULL) + { + // Grab the super object + $CI =& get_instance(); + + // Do we even need to load the database class? + if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id)) + { + return FALSE; + } + + require_once(BASEPATH.'database/DB.php'); + + if ($return === TRUE) + { + return DB($params, $query_builder); + } + + // Initialize the db variable. Needed to prevent + // reference errors with some configurations + $CI->db = ''; + + // Load the DB class + $CI->db =& DB($params, $query_builder); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Load the Database Utilities Class + * + * @param object $db Database object + * @param bool $return Whether to return the DB Utilities class object or not + * @return object + */ + public function dbutil($db = NULL, $return = FALSE) + { + $CI =& get_instance(); + + if ( ! is_object($db) OR ! ($db instanceof CI_DB)) + { + class_exists('CI_DB', FALSE) OR $this->database(); + $db =& $CI->db; + } + + require_once(BASEPATH.'database/DB_utility.php'); + require_once(BASEPATH.'database/drivers/'.$db->dbdriver.'/'.$db->dbdriver.'_utility.php'); + $class = 'CI_DB_'.$db->dbdriver.'_utility'; + + if ($return === TRUE) + { + return new $class($db); + } + + $CI->dbutil = new $class($db); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Load the Database Forge Class + * + * @param object $db Database object + * @param bool $return Whether to return the DB Forge class object or not + * @return object + */ + public function dbforge($db = NULL, $return = FALSE) + { + $CI =& get_instance(); + if ( ! is_object($db) OR ! ($db instanceof CI_DB)) + { + class_exists('CI_DB', FALSE) OR $this->database(); + $db =& $CI->db; + } + + require_once(BASEPATH.'database/DB_forge.php'); + require_once(BASEPATH.'database/drivers/'.$db->dbdriver.'/'.$db->dbdriver.'_forge.php'); + + if ( ! empty($db->subdriver)) + { + $driver_path = BASEPATH.'database/drivers/'.$db->dbdriver.'/subdrivers/'.$db->dbdriver.'_'.$db->subdriver.'_forge.php'; + if (file_exists($driver_path)) + { + require_once($driver_path); + $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; + } + } + else + { + $class = 'CI_DB_'.$db->dbdriver.'_forge'; + } + + if ($return === TRUE) + { + return new $class($db); + } + + $CI->dbforge = new $class($db); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * View Loader + * + * Loads "view" files. + * + * @param string $view View name + * @param array $vars An associative array of data + * to be extracted for use in the view + * @param bool $return Whether to return the view output + * or leave it to the Output class + * @return object|string + */ + public function view($view, $vars = array(), $return = FALSE) + { + return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return)); + } + + // -------------------------------------------------------------------- + + /** + * Generic File Loader + * + * @param string $path File path + * @param bool $return Whether to return the file output + * @return object|string + */ + public function file($path, $return = FALSE) + { + return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return)); + } + + // -------------------------------------------------------------------- + + /** + * Set Variables + * + * Once variables are set they become available within + * the controller class and its "view" files. + * + * @param array|object|string $vars + * An associative array or object containing values + * to be set, or a value's name if string + * @param string $val Value to set, only used if $vars is a string + * @return object + */ + public function vars($vars, $val = '') + { + $vars = is_string($vars) + ? array($vars => $val) + : $this->_ci_prepare_view_vars($vars); + + foreach ($vars as $key => $val) + { + $this->_ci_cached_vars[$key] = $val; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Clear Cached Variables + * + * Clears the cached variables. + * + * @return CI_Loader + */ + public function clear_vars() + { + $this->_ci_cached_vars = array(); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get Variable + * + * Check if a variable is set and retrieve it. + * + * @param string $key Variable name + * @return mixed The variable or NULL if not found + */ + public function get_var($key) + { + return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL; + } + + // -------------------------------------------------------------------- + + /** + * Get Variables + * + * Retrieves all loaded variables. + * + * @return array + */ + public function get_vars() + { + return $this->_ci_cached_vars; + } + + // -------------------------------------------------------------------- + + /** + * Helper Loader + * + * @param string|string[] $helpers Helper name(s) + * @return object + */ + public function helper($helpers = array()) + { + is_array($helpers) OR $helpers = array($helpers); + foreach ($helpers as &$helper) + { + $filename = basename($helper); + $filepath = ($filename === $helper) ? '' : substr($helper, 0, strlen($helper) - strlen($filename)); + $filename = strtolower(preg_replace('#(_helper)?(\.php)?$#i', '', $filename)).'_helper'; + $helper = $filepath.$filename; + + if (isset($this->_ci_helpers[$helper])) + { + continue; + } + + // Is this a helper extension request? + $ext_helper = config_item('subclass_prefix').$filename; + $ext_loaded = FALSE; + foreach ($this->_ci_helper_paths as $path) + { + if (file_exists($path.'helpers/'.$ext_helper.'.php')) + { + include_once($path.'helpers/'.$ext_helper.'.php'); + $ext_loaded = TRUE; + } + } + + // If we have loaded extensions - check if the base one is here + if ($ext_loaded === TRUE) + { + $base_helper = BASEPATH.'helpers/'.$helper.'.php'; + if ( ! file_exists($base_helper)) + { + show_error('Unable to load the requested file: helpers/'.$helper.'.php'); + } + + include_once($base_helper); + $this->_ci_helpers[$helper] = TRUE; + log_message('info', 'Helper loaded: '.$helper); + continue; + } + + // No extensions found ... try loading regular helpers and/or overrides + foreach ($this->_ci_helper_paths as $path) + { + if (file_exists($path.'helpers/'.$helper.'.php')) + { + include_once($path.'helpers/'.$helper.'.php'); + + $this->_ci_helpers[$helper] = TRUE; + log_message('info', 'Helper loaded: '.$helper); + break; + } + } + + // unable to load the helper + if ( ! isset($this->_ci_helpers[$helper])) + { + show_error('Unable to load the requested file: helpers/'.$helper.'.php'); + } + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Load Helpers + * + * An alias for the helper() method in case the developer has + * written the plural form of it. + * + * @uses CI_Loader::helper() + * @param string|string[] $helpers Helper name(s) + * @return object + */ + public function helpers($helpers = array()) + { + return $this->helper($helpers); + } + + // -------------------------------------------------------------------- + + /** + * Language Loader + * + * Loads language files. + * + * @param string|string[] $files List of language file names to load + * @param string Language name + * @return object + */ + public function language($files, $lang = '') + { + get_instance()->lang->load($files, $lang); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Config Loader + * + * Loads a config file (an alias for CI_Config::load()). + * + * @uses CI_Config::load() + * @param string $file Configuration file name + * @param bool $use_sections Whether configuration values should be loaded into their own section + * @param bool $fail_gracefully Whether to just return FALSE or display an error message + * @return bool TRUE if the file was loaded correctly or FALSE on failure + */ + public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE) + { + return get_instance()->config->load($file, $use_sections, $fail_gracefully); + } + + // -------------------------------------------------------------------- + + /** + * Driver Loader + * + * Loads a driver library. + * + * @param string|string[] $library Driver name(s) + * @param array $params Optional parameters to pass to the driver + * @param string $object_name An optional object name to assign to + * + * @return object|bool Object or FALSE on failure if $library is a string + * and $object_name is set. CI_Loader instance otherwise. + */ + public function driver($library, $params = NULL, $object_name = NULL) + { + if (is_array($library)) + { + foreach ($library as $key => $value) + { + if (is_int($key)) + { + $this->driver($value, $params); + } + else + { + $this->driver($key, $params, $value); + } + } + + return $this; + } + elseif (empty($library)) + { + return FALSE; + } + + if ( ! class_exists('CI_Driver_Library', FALSE)) + { + // We aren't instantiating an object here, just making the base class available + require BASEPATH.'libraries/Driver.php'; + } + + // We can save the loader some time since Drivers will *always* be in a subfolder, + // and typically identically named to the library + if ( ! strpos($library, '/')) + { + $library = ucfirst($library).'/'.$library; + } + + return $this->library($library, $params, $object_name); + } + + // -------------------------------------------------------------------- + + /** + * Add Package Path + * + * Prepends a parent path to the library, model, helper and config + * path arrays. + * + * @see CI_Loader::$_ci_library_paths + * @see CI_Loader::$_ci_model_paths + * @see CI_Loader::$_ci_helper_paths + * @see CI_Config::$_config_paths + * + * @param string $path Path to add + * @param bool $view_cascade (default: TRUE) + * @return object + */ + public function add_package_path($path, $view_cascade = TRUE) + { + $path = rtrim($path, '/').'/'; + + array_unshift($this->_ci_library_paths, $path); + array_unshift($this->_ci_model_paths, $path); + array_unshift($this->_ci_helper_paths, $path); + + $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; + + // Add config file path + $config =& $this->_ci_get_component('config'); + $config->_config_paths[] = $path; + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get Package Paths + * + * Return a list of all package paths. + * + * @param bool $include_base Whether to include BASEPATH (default: FALSE) + * @return array + */ + public function get_package_paths($include_base = FALSE) + { + return ($include_base === TRUE) ? $this->_ci_library_paths : $this->_ci_model_paths; + } + + // -------------------------------------------------------------------- + + /** + * Remove Package Path + * + * Remove a path from the library, model, helper and/or config + * path arrays if it exists. If no path is provided, the most recently + * added path will be removed removed. + * + * @param string $path Path to remove + * @return object + */ + public function remove_package_path($path = '') + { + $config =& $this->_ci_get_component('config'); + + if ($path === '') + { + array_shift($this->_ci_library_paths); + array_shift($this->_ci_model_paths); + array_shift($this->_ci_helper_paths); + array_shift($this->_ci_view_paths); + array_pop($config->_config_paths); + } + else + { + $path = rtrim($path, '/').'/'; + foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) + { + if (($key = array_search($path, $this->{$var})) !== FALSE) + { + unset($this->{$var}[$key]); + } + } + + if (isset($this->_ci_view_paths[$path.'views/'])) + { + unset($this->_ci_view_paths[$path.'views/']); + } + + if (($key = array_search($path, $config->_config_paths)) !== FALSE) + { + unset($config->_config_paths[$key]); + } + } + + // make sure the application default paths are still in the array + $this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH))); + $this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH))); + $this->_ci_model_paths = array_unique(array_merge($this->_ci_model_paths, array(APPPATH))); + $this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH.'views/' => TRUE)); + $config->_config_paths = array_unique(array_merge($config->_config_paths, array(APPPATH))); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Internal CI Data Loader + * + * Used to load views and files. + * + * Variables are prefixed with _ci_ to avoid symbol collision with + * variables made available to view files. + * + * @used-by CI_Loader::view() + * @used-by CI_Loader::file() + * @param array $_ci_data Data to load + * @return object + */ + protected function _ci_load($_ci_data) + { + // Set the default data variables + foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val) + { + $$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE; + } + + $file_exists = FALSE; + + // Set the path to the requested file + if (is_string($_ci_path) && $_ci_path !== '') + { + $_ci_x = explode('/', $_ci_path); + $_ci_file = end($_ci_x); + } + else + { + $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); + $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; + + foreach ($this->_ci_view_paths as $_ci_view_file => $cascade) + { + if (file_exists($_ci_view_file.$_ci_file)) + { + $_ci_path = $_ci_view_file.$_ci_file; + $file_exists = TRUE; + break; + } + + if ( ! $cascade) + { + break; + } + } + } + + if ( ! $file_exists && ! file_exists($_ci_path)) + { + show_error('Unable to load the requested file: '.$_ci_file); + } + + // This allows anything loaded using $this->load (views, files, etc.) + // to become accessible from within the Controller and Model functions. + $_ci_CI =& get_instance(); + foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) + { + if ( ! isset($this->$_ci_key)) + { + $this->$_ci_key =& $_ci_CI->$_ci_key; + } + } + + /* + * Extract and cache variables + * + * You can either set variables using the dedicated $this->load->vars() + * function or via the second parameter of this function. We'll merge + * the two types and cache them so that views that are embedded within + * other views can have access to these variables. + */ + empty($_ci_vars) OR $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars); + extract($this->_ci_cached_vars); + + /* + * Buffer the output + * + * We buffer the output for two reasons: + * 1. Speed. You get a significant speed boost. + * 2. So that the final rendered template can be post-processed by + * the output class. Why do we need post processing? For one thing, + * in order to show the elapsed page load time. Unless we can + * intercept the content right before it's sent to the browser and + * then stop the timer it won't be accurate. + */ + ob_start(); + + // If the PHP installation does not support short tags we'll + // do a little string replacement, changing the short tags + // to standard PHP echo statements. + if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) + { + echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace(' $this->_ci_ob_level + 1) + { + ob_end_flush(); + } + else + { + $_ci_CI->output->append_output(ob_get_contents()); + @ob_end_clean(); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Internal CI Library Loader + * + * @used-by CI_Loader::library() + * @uses CI_Loader::_ci_init_library() + * + * @param string $class Class name to load + * @param mixed $params Optional parameters to pass to the class constructor + * @param string $object_name Optional object name to assign to + * @return void + */ + protected function _ci_load_library($class, $params = NULL, $object_name = NULL) + { + // Get the class name, and while we're at it trim any slashes. + // The directory path can be included as part of the class name, + // but we don't want a leading slash + $class = str_replace('.php', '', trim($class, '/')); + + // Was the path included with the class name? + // We look for a slash to determine this + if (($last_slash = strrpos($class, '/')) !== FALSE) + { + // Extract the path + $subdir = substr($class, 0, ++$last_slash); + + // Get the filename from the path + $class = substr($class, $last_slash); + } + else + { + $subdir = ''; + } + + $class = ucfirst($class); + + // Is this a stock library? There are a few special conditions if so ... + if (file_exists(BASEPATH.'libraries/'.$subdir.$class.'.php')) + { + return $this->_ci_load_stock_library($class, $subdir, $params, $object_name); + } + + // Safety: Was the class already loaded by a previous call? + if (class_exists($class, FALSE)) + { + $property = $object_name; + if (empty($property)) + { + $property = strtolower($class); + isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; + } + + $CI =& get_instance(); + if (isset($CI->$property)) + { + log_message('debug', $class.' class already loaded. Second attempt ignored.'); + return; + } + + return $this->_ci_init_library($class, '', $params, $object_name); + } + + // Let's search for the requested library file and load it. + foreach ($this->_ci_library_paths as $path) + { + // BASEPATH has already been checked for + if ($path === BASEPATH) + { + continue; + } + + $filepath = $path.'libraries/'.$subdir.$class.'.php'; + // Does the file exist? No? Bummer... + if ( ! file_exists($filepath)) + { + continue; + } + + include_once($filepath); + return $this->_ci_init_library($class, '', $params, $object_name); + } + + // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? + if ($subdir === '') + { + return $this->_ci_load_library($class.'/'.$class, $params, $object_name); + } + + // If we got this far we were unable to find the requested class. + log_message('error', 'Unable to load the requested class: '.$class); + show_error('Unable to load the requested class: '.$class); + } + + // -------------------------------------------------------------------- + + /** + * Internal CI Stock Library Loader + * + * @used-by CI_Loader::_ci_load_library() + * @uses CI_Loader::_ci_init_library() + * + * @param string $library_name Library name to load + * @param string $file_path Path to the library filename, relative to libraries/ + * @param mixed $params Optional parameters to pass to the class constructor + * @param string $object_name Optional object name to assign to + * @return void + */ + protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name) + { + $prefix = 'CI_'; + + if (class_exists($prefix.$library_name, FALSE)) + { + if (class_exists(config_item('subclass_prefix').$library_name, FALSE)) + { + $prefix = config_item('subclass_prefix'); + } + + $property = $object_name; + if (empty($property)) + { + $property = strtolower($library_name); + isset($this->_ci_varmap[$property]) && $property = $this->_ci_varmap[$property]; + } + + $CI =& get_instance(); + if ( ! isset($CI->$property)) + { + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + + log_message('debug', $library_name.' class already loaded. Second attempt ignored.'); + return; + } + + $paths = $this->_ci_library_paths; + array_pop($paths); // BASEPATH + array_pop($paths); // APPPATH (needs to be the first path checked) + array_unshift($paths, APPPATH); + + foreach ($paths as $path) + { + if (file_exists($path = $path.'libraries/'.$file_path.$library_name.'.php')) + { + // Override + include_once($path); + if (class_exists($prefix.$library_name, FALSE)) + { + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + + log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name); + } + } + + include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); + + // Check for extensions + $subclass = config_item('subclass_prefix').$library_name; + foreach ($paths as $path) + { + if (file_exists($path = $path.'libraries/'.$file_path.$subclass.'.php')) + { + include_once($path); + if (class_exists($subclass, FALSE)) + { + $prefix = config_item('subclass_prefix'); + break; + } + + log_message('debug', $path.' exists, but does not declare '.$subclass); + } + } + + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + + // -------------------------------------------------------------------- + + /** + * Internal CI Library Instantiator + * + * @used-by CI_Loader::_ci_load_stock_library() + * @used-by CI_Loader::_ci_load_library() + * + * @param string $class Class name + * @param string $prefix Class name prefix + * @param array|null|bool $config Optional configuration to pass to the class constructor: + * FALSE to skip; + * NULL to search in config paths; + * array containing configuration data + * @param string $object_name Optional object name to assign to + * @return void + */ + protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL) + { + // Is there an associated config file for this class? Note: these should always be lowercase + if ($config === NULL) + { + // Fetch the config paths containing any package paths + $config_component = $this->_ci_get_component('config'); + + if (is_array($config_component->_config_paths)) + { + $found = FALSE; + foreach ($config_component->_config_paths as $path) + { + // We test for both uppercase and lowercase, for servers that + // are case-sensitive with regard to file names. Load global first, + // override with environment next + if (file_exists($path.'config/'.strtolower($class).'.php')) + { + include($path.'config/'.strtolower($class).'.php'); + $found = TRUE; + } + elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) + { + include($path.'config/'.ucfirst(strtolower($class)).'.php'); + $found = TRUE; + } + + if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) + { + include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); + $found = TRUE; + } + elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) + { + include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); + $found = TRUE; + } + + // Break on the first found configuration, thus package + // files are not overridden by default paths + if ($found === TRUE) + { + break; + } + } + } + } + + $class_name = $prefix.$class; + + // Is the class name valid? + if ( ! class_exists($class_name, FALSE)) + { + log_message('error', 'Non-existent class: '.$class_name); + show_error('Non-existent class: '.$class_name); + } + + // Set the variable name we will assign the class to + // Was a custom class name supplied? If so we'll use it + if (empty($object_name)) + { + $object_name = strtolower($class); + if (isset($this->_ci_varmap[$object_name])) + { + $object_name = $this->_ci_varmap[$object_name]; + } + } + + // Don't overwrite existing properties + $CI =& get_instance(); + if (isset($CI->$object_name)) + { + if ($CI->$object_name instanceof $class_name) + { + log_message('debug', $class_name." has already been instantiated as '".$object_name."'. Second attempt aborted."); + return; + } + + show_error("Resource '".$object_name."' already exists and is not a ".$class_name." instance."); + } + + // Save the class name and object name + $this->_ci_classes[$object_name] = $class; + + // Instantiate the class + $CI->$object_name = isset($config) + ? new $class_name($config) + : new $class_name(); + } + + // -------------------------------------------------------------------- + + /** + * CI Autoloader + * + * Loads component listed in the config/autoload.php file. + * + * @used-by CI_Loader::initialize() + * @return void + */ + protected function _ci_autoloader() + { + if (file_exists(APPPATH.'config/autoload.php')) + { + include(APPPATH.'config/autoload.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); + } + + if ( ! isset($autoload)) + { + return; + } + + // Autoload packages + if (isset($autoload['packages'])) + { + foreach ($autoload['packages'] as $package_path) + { + $this->add_package_path($package_path); + } + } + + // Load any custom config file + if (count($autoload['config']) > 0) + { + foreach ($autoload['config'] as $val) + { + $this->config($val); + } + } + + // Autoload helpers and languages + foreach (array('helper', 'language') as $type) + { + if (isset($autoload[$type]) && count($autoload[$type]) > 0) + { + $this->$type($autoload[$type]); + } + } + + // Autoload drivers + if (isset($autoload['drivers'])) + { + $this->driver($autoload['drivers']); + } + + // Load libraries + if (isset($autoload['libraries']) && count($autoload['libraries']) > 0) + { + // Load the database driver. + if (in_array('database', $autoload['libraries'])) + { + $this->database(); + $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); + } + + // Load all other libraries + $this->library($autoload['libraries']); + } + + // Autoload models + if (isset($autoload['model'])) + { + $this->model($autoload['model']); + } + } + + // -------------------------------------------------------------------- + + /** + * Prepare variables for _ci_vars, to be later extract()-ed inside views + * + * Converts objects to associative arrays and filters-out internal + * variable names (i.e. keys prefixed with '_ci_'). + * + * @param mixed $vars + * @return array + */ + protected function _ci_prepare_view_vars($vars) + { + if ( ! is_array($vars)) + { + $vars = is_object($vars) + ? get_object_vars($vars) + : array(); + } + + foreach (array_keys($vars) as $key) + { + if (strncmp($key, '_ci_', 4) === 0) + { + unset($vars[$key]); + } + } + + return $vars; + } + + // -------------------------------------------------------------------- + + /** + * CI Component getter + * + * Get a reference to a specific library or model. + * + * @param string $component Component name + * @return bool + */ + protected function &_ci_get_component($component) + { + $CI =& get_instance(); + return $CI->$component; + } +} diff --git a/system/core/Log.php b/system/core/Log.php new file mode 100755 index 0000000..d443aed --- /dev/null +++ b/system/core/Log.php @@ -0,0 +1,296 @@ + 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4); + + /** + * mbstring.func_overload flag + * + * @var bool + */ + protected static $func_overload; + + // -------------------------------------------------------------------- + + /** + * Class constructor + * + * @return void + */ + public function __construct() + { + $config =& get_config(); + + isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); + + $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; + $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') + ? ltrim($config['log_file_extension'], '.') : 'php'; + + file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE); + + if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) + { + $this->_enabled = FALSE; + } + + if (is_numeric($config['log_threshold'])) + { + $this->_threshold = (int) $config['log_threshold']; + } + elseif (is_array($config['log_threshold'])) + { + $this->_threshold = 0; + $this->_threshold_array = array_flip($config['log_threshold']); + } + + if ( ! empty($config['log_date_format'])) + { + $this->_date_fmt = $config['log_date_format']; + } + + if ( ! empty($config['log_file_permissions']) && is_int($config['log_file_permissions'])) + { + $this->_file_permissions = $config['log_file_permissions']; + } + } + + // -------------------------------------------------------------------- + + /** + * Write Log File + * + * Generally this function will be called using the global log_message() function + * + * @param string $level The error level: 'error', 'debug' or 'info' + * @param string $msg The error message + * @return bool + */ + public function write_log($level, $msg) + { + if ($this->_enabled === FALSE) + { + return FALSE; + } + + $level = strtoupper($level); + + if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) + && ! isset($this->_threshold_array[$this->_levels[$level]])) + { + return FALSE; + } + + $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext; + $message = ''; + + if ( ! file_exists($filepath)) + { + $newfile = TRUE; + // Only add protection to php files + if ($this->_file_ext === 'php') + { + $message .= "\n\n"; + } + } + + if ( ! $fp = @fopen($filepath, 'ab')) + { + return FALSE; + } + + flock($fp, LOCK_EX); + + // Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format + if (strpos($this->_date_fmt, 'u') !== FALSE) + { + $microtime_full = microtime(TRUE); + $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000); + $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full)); + $date = $date->format($this->_date_fmt); + } + else + { + $date = date($this->_date_fmt); + } + + $message .= $this->_format_line($level, $date, $msg); + + for ($written = 0, $length = self::strlen($message); $written < $length; $written += $result) + { + if (($result = fwrite($fp, self::substr($message, $written))) === FALSE) + { + break; + } + } + + flock($fp, LOCK_UN); + fclose($fp); + + if (isset($newfile) && $newfile === TRUE) + { + chmod($filepath, $this->_file_permissions); + } + + return is_int($result); + } + + // -------------------------------------------------------------------- + + /** + * Format the log line. + * + * This is for extensibility of log formatting + * If you want to change the log format, extend the CI_Log class and override this method + * + * @param string $level The error level + * @param string $date Formatted date string + * @param string $message The log message + * @return string Formatted log line with a new line character '\n' at the end + */ + protected function _format_line($level, $date, $message) + { + return $level.' - '.$date.' --> '.$message."\n"; + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe strlen() + * + * @param string $str + * @return int + */ + protected static function strlen($str) + { + return (self::$func_overload) + ? mb_strlen($str, '8bit') + : strlen($str); + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe substr() + * + * @param string $str + * @param int $start + * @param int $length + * @return string + */ + protected static function substr($str, $start, $length = NULL) + { + if (self::$func_overload) + { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); + return mb_substr($str, $start, $length, '8bit'); + } + + return isset($length) + ? substr($str, $start, $length) + : substr($str, $start); + } +} diff --git a/system/core/Model.php b/system/core/Model.php new file mode 100755 index 0000000..c809e7b --- /dev/null +++ b/system/core/Model.php @@ -0,0 +1,80 @@ +$key; + } + +} diff --git a/system/core/Output.php b/system/core/Output.php new file mode 100755 index 0000000..a3155fe --- /dev/null +++ b/system/core/Output.php @@ -0,0 +1,842 @@ +_zlib_oc = (bool) ini_get('zlib.output_compression'); + $this->_compress_output = ( + $this->_zlib_oc === FALSE + && config_item('compress_output') === TRUE + && extension_loaded('zlib') + ); + + isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); + + // Get mime types for later + $this->mimes =& get_mimes(); + + log_message('info', 'Output Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Get Output + * + * Returns the current output string. + * + * @return string + */ + public function get_output() + { + return $this->final_output; + } + + // -------------------------------------------------------------------- + + /** + * Set Output + * + * Sets the output string. + * + * @param string $output Output data + * @return CI_Output + */ + public function set_output($output) + { + $this->final_output = $output; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Append Output + * + * Appends data onto the output string. + * + * @param string $output Data to append + * @return CI_Output + */ + public function append_output($output) + { + $this->final_output .= $output; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Header + * + * Lets you set a server header which will be sent with the final output. + * + * Note: If a file is cached, headers will not be sent. + * @todo We need to figure out how to permit headers to be cached. + * + * @param string $header Header + * @param bool $replace Whether to replace the old header value, if already set + * @return CI_Output + */ + public function set_header($header, $replace = TRUE) + { + // If zlib.output_compression is enabled it will compress the output, + // but it will not modify the content-length header to compensate for + // the reduction, causing the browser to hang waiting for more data. + // We'll just skip content-length in those cases. + if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) === 0) + { + return $this; + } + + $this->headers[] = array($header, $replace); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Content-Type Header + * + * @param string $mime_type Extension of the file we're outputting + * @param string $charset Character set (default: NULL) + * @return CI_Output + */ + public function set_content_type($mime_type, $charset = NULL) + { + if (strpos($mime_type, '/') === FALSE) + { + $extension = ltrim($mime_type, '.'); + + // Is this extension supported? + if (isset($this->mimes[$extension])) + { + $mime_type =& $this->mimes[$extension]; + + if (is_array($mime_type)) + { + $mime_type = current($mime_type); + } + } + } + + $this->mime_type = $mime_type; + + if (empty($charset)) + { + $charset = config_item('charset'); + } + + $header = 'Content-Type: '.$mime_type + .(empty($charset) ? '' : '; charset='.$charset); + + $this->headers[] = array($header, TRUE); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get Current Content-Type Header + * + * @return string 'text/html', if not already set + */ + public function get_content_type() + { + for ($i = 0, $c = count($this->headers); $i < $c; $i++) + { + if (sscanf($this->headers[$i][0], 'Content-Type: %[^;]', $content_type) === 1) + { + return $content_type; + } + } + + return 'text/html'; + } + + // -------------------------------------------------------------------- + + /** + * Get Header + * + * @param string $header + * @return string + */ + public function get_header($header) + { + // Combine headers already sent with our batched headers + $headers = array_merge( + // We only need [x][0] from our multi-dimensional array + array_map('array_shift', $this->headers), + headers_list() + ); + + if (empty($headers) OR empty($header)) + { + return NULL; + } + + // Count backwards, in order to get the last matching header + for ($c = count($headers) - 1; $c > -1; $c--) + { + if (strncasecmp($header, $headers[$c], $l = self::strlen($header)) === 0) + { + return trim(self::substr($headers[$c], $l+1)); + } + } + + return NULL; + } + + // -------------------------------------------------------------------- + + /** + * Set HTTP Status Header + * + * As of version 1.7.2, this is an alias for common function + * set_status_header(). + * + * @param int $code Status code (default: 200) + * @param string $text Optional message + * @return CI_Output + */ + public function set_status_header($code = 200, $text = '') + { + set_status_header($code, $text); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Enable/disable Profiler + * + * @param bool $val TRUE to enable or FALSE to disable + * @return CI_Output + */ + public function enable_profiler($val = TRUE) + { + $this->enable_profiler = is_bool($val) ? $val : TRUE; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Profiler Sections + * + * Allows override of default/config settings for + * Profiler section display. + * + * @param array $sections Profiler sections + * @return CI_Output + */ + public function set_profiler_sections($sections) + { + if (isset($sections['query_toggle_count'])) + { + $this->_profiler_sections['query_toggle_count'] = (int) $sections['query_toggle_count']; + unset($sections['query_toggle_count']); + } + + foreach ($sections as $section => $enable) + { + $this->_profiler_sections[$section] = ($enable !== FALSE); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Set Cache + * + * @param int $time Cache expiration time in minutes + * @return CI_Output + */ + public function cache($time) + { + $this->cache_expiration = is_numeric($time) ? $time : 0; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Display Output + * + * Processes and sends finalized output data to the browser along + * with any server headers and profile data. It also stops benchmark + * timers so the page rendering speed and memory usage can be shown. + * + * Note: All "view" data is automatically put into $this->final_output + * by controller class. + * + * @uses CI_Output::$final_output + * @param string $output Output data override + * @return void + */ + public function _display($output = '') + { + // Note: We use load_class() because we can't use $CI =& get_instance() + // since this function is sometimes called by the caching mechanism, + // which happens before the CI super object is available. + $BM =& load_class('Benchmark', 'core'); + $CFG =& load_class('Config', 'core'); + + // Grab the super object if we can. + if (class_exists('CI_Controller', FALSE)) + { + $CI =& get_instance(); + } + + // -------------------------------------------------------------------- + + // Set the output data + if ($output === '') + { + $output =& $this->final_output; + } + + // -------------------------------------------------------------------- + + // Do we need to write a cache file? Only if the controller does not have its + // own _output() method and we are not dealing with a cache file, which we + // can determine by the existence of the $CI object above + if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output')) + { + $this->_write_cache($output); + } + + // -------------------------------------------------------------------- + + // Parse out the elapsed time and memory usage, + // then swap the pseudo-variables with the data + + $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end'); + + if ($this->parse_exec_vars === TRUE) + { + $memory = round(memory_get_usage() / 1024 / 1024, 2).'MB'; + $output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $output); + } + + // -------------------------------------------------------------------- + + // Is compression requested? + if (isset($CI) // This means that we're not serving a cache file, if we were, it would already be compressed + && $this->_compress_output === TRUE + && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) + { + ob_start('ob_gzhandler'); + } + + // -------------------------------------------------------------------- + + // Are there any server headers to send? + if (count($this->headers) > 0) + { + foreach ($this->headers as $header) + { + @header($header[0], $header[1]); + } + } + + // -------------------------------------------------------------------- + + // Does the $CI object exist? + // If not we know we are dealing with a cache file so we'll + // simply echo out the data and exit. + if ( ! isset($CI)) + { + if ($this->_compress_output === TRUE) + { + if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) + { + header('Content-Encoding: gzip'); + header('Content-Length: '.self::strlen($output)); + } + else + { + // User agent doesn't support gzip compression, + // so we'll have to decompress our cache + $output = gzinflate(self::substr($output, 10, -8)); + } + } + + echo $output; + log_message('info', 'Final output sent to browser'); + log_message('debug', 'Total execution time: '.$elapsed); + return; + } + + // -------------------------------------------------------------------- + + // Do we need to generate profile data? + // If so, load the Profile class and run it. + if ($this->enable_profiler === TRUE) + { + $CI->load->library('profiler'); + if ( ! empty($this->_profiler_sections)) + { + $CI->profiler->set_sections($this->_profiler_sections); + } + + // If the output data contains closing and tags + // we will remove them and add them back after we insert the profile data + $output = preg_replace('|.*?|is', '', $output, -1, $count).$CI->profiler->run(); + if ($count > 0) + { + $output .= ''; + } + } + + // Does the controller contain a function named _output()? + // If so send the output there. Otherwise, echo it. + if (method_exists($CI, '_output')) + { + $CI->_output($output); + } + else + { + echo $output; // Send it to the browser! + } + + log_message('info', 'Final output sent to browser'); + log_message('debug', 'Total execution time: '.$elapsed); + } + + // -------------------------------------------------------------------- + + /** + * Write Cache + * + * @param string $output Output data to cache + * @return void + */ + public function _write_cache($output) + { + $CI =& get_instance(); + $path = $CI->config->item('cache_path'); + $cache_path = ($path === '') ? APPPATH.'cache/' : $path; + + if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) + { + log_message('error', 'Unable to write cache file: '.$cache_path); + return; + } + + $uri = $CI->config->item('base_url') + .$CI->config->item('index_page') + .$CI->uri->uri_string(); + + if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING'])) + { + if (is_array($cache_query_string)) + { + $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); + } + else + { + $uri .= '?'.$_SERVER['QUERY_STRING']; + } + } + + $cache_path .= md5($uri); + + if ( ! $fp = @fopen($cache_path, 'w+b')) + { + log_message('error', 'Unable to write cache file: '.$cache_path); + return; + } + + if ( ! flock($fp, LOCK_EX)) + { + log_message('error', 'Unable to secure a file lock for file at: '.$cache_path); + fclose($fp); + return; + } + + // If output compression is enabled, compress the cache + // itself, so that we don't have to do that each time + // we're serving it + if ($this->_compress_output === TRUE) + { + $output = gzencode($output); + + if ($this->get_header('content-type') === NULL) + { + $this->set_content_type($this->mime_type); + } + } + + $expire = time() + ($this->cache_expiration * 60); + + // Put together our serialized info. + $cache_info = serialize(array( + 'expire' => $expire, + 'headers' => $this->headers + )); + + $output = $cache_info.'ENDCI--->'.$output; + + for ($written = 0, $length = self::strlen($output); $written < $length; $written += $result) + { + if (($result = fwrite($fp, self::substr($output, $written))) === FALSE) + { + break; + } + } + + flock($fp, LOCK_UN); + fclose($fp); + + if ( ! is_int($result)) + { + @unlink($cache_path); + log_message('error', 'Unable to write the complete cache content at: '.$cache_path); + return; + } + + chmod($cache_path, 0640); + log_message('debug', 'Cache file written: '.$cache_path); + + // Send HTTP cache-control headers to browser to match file cache settings. + $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire); + } + + // -------------------------------------------------------------------- + + /** + * Update/serve cached output + * + * @uses CI_Config + * @uses CI_URI + * + * @param object &$CFG CI_Config class instance + * @param object &$URI CI_URI class instance + * @return bool TRUE on success or FALSE on failure + */ + public function _display_cache(&$CFG, &$URI) + { + $cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path'); + + // Build the file path. The file name is an MD5 hash of the full URI + $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; + + if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING'])) + { + if (is_array($cache_query_string)) + { + $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); + } + else + { + $uri .= '?'.$_SERVER['QUERY_STRING']; + } + } + + $filepath = $cache_path.md5($uri); + + if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, 'rb')) + { + return FALSE; + } + + flock($fp, LOCK_SH); + + $cache = (filesize($filepath) > 0) ? fread($fp, filesize($filepath)) : ''; + + flock($fp, LOCK_UN); + fclose($fp); + + // Look for embedded serialized file info. + if ( ! preg_match('/^(.*)ENDCI--->/', $cache, $match)) + { + return FALSE; + } + + $cache_info = unserialize($match[1]); + $expire = $cache_info['expire']; + + $last_modified = filemtime($filepath); + + // Has the file expired? + if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path)) + { + // If so we'll delete it. + @unlink($filepath); + log_message('debug', 'Cache file has expired. File deleted.'); + return FALSE; + } + + // Send the HTTP cache control headers + $this->set_cache_header($last_modified, $expire); + + // Add headers from cache file. + foreach ($cache_info['headers'] as $header) + { + $this->set_header($header[0], $header[1]); + } + + // Display the cache + $this->_display(self::substr($cache, self::strlen($match[0]))); + log_message('debug', 'Cache file is current. Sending it to browser.'); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Delete cache + * + * @param string $uri URI string + * @return bool + */ + public function delete_cache($uri = '') + { + $CI =& get_instance(); + $cache_path = $CI->config->item('cache_path'); + if ($cache_path === '') + { + $cache_path = APPPATH.'cache/'; + } + + if ( ! is_dir($cache_path)) + { + log_message('error', 'Unable to find cache path: '.$cache_path); + return FALSE; + } + + if (empty($uri)) + { + $uri = $CI->uri->uri_string(); + + if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING'])) + { + if (is_array($cache_query_string)) + { + $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string))); + } + else + { + $uri .= '?'.$_SERVER['QUERY_STRING']; + } + } + } + + $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/')); + + if ( ! @unlink($cache_path)) + { + log_message('error', 'Unable to delete cache file for '.$uri); + return FALSE; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Set Cache Header + * + * Set the HTTP headers to match the server-side file cache settings + * in order to reduce bandwidth. + * + * @param int $last_modified Timestamp of when the page was last modified + * @param int $expiration Timestamp of when should the requested page expire from cache + * @return void + */ + public function set_cache_header($last_modified, $expiration) + { + $max_age = $expiration - $_SERVER['REQUEST_TIME']; + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) + { + $this->set_status_header(304); + exit; + } + + header('Pragma: public'); + header('Cache-Control: max-age='.$max_age.', public'); + header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT'); + header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT'); + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe strlen() + * + * @param string $str + * @return int + */ + protected static function strlen($str) + { + return (self::$func_overload) + ? mb_strlen($str, '8bit') + : strlen($str); + } + + // -------------------------------------------------------------------- + + /** + * Byte-safe substr() + * + * @param string $str + * @param int $start + * @param int $length + * @return string + */ + protected static function substr($str, $start, $length = NULL) + { + if (self::$func_overload) + { + // mb_substr($str, $start, null, '8bit') returns an empty + // string on PHP 5.3 + isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); + return mb_substr($str, $start, $length, '8bit'); + } + + return isset($length) + ? substr($str, $start, $length) + : substr($str, $start); + } +} diff --git a/system/core/Router.php b/system/core/Router.php new file mode 100755 index 0000000..1abe4c4 --- /dev/null +++ b/system/core/Router.php @@ -0,0 +1,515 @@ +config =& load_class('Config', 'core'); + $this->uri =& load_class('URI', 'core'); + + $this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE); + + // If a directory override is configured, it has to be set before any dynamic routing logic + is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']); + $this->_set_routing(); + + // Set any routing overrides that may exist in the main index file + if (is_array($routing)) + { + empty($routing['controller']) OR $this->set_class($routing['controller']); + empty($routing['function']) OR $this->set_method($routing['function']); + } + + log_message('info', 'Router Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Set route mapping + * + * Determines what should be served based on the URI request, + * as well as any "routes" that have been set in the routing config file. + * + * @return void + */ + protected function _set_routing() + { + // Load the routes.php file. It would be great if we could + // skip this for enable_query_strings = TRUE, but then + // default_controller would be empty ... + if (file_exists(APPPATH.'config/routes.php')) + { + include(APPPATH.'config/routes.php'); + } + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); + } + + // Validate & get reserved routes + if (isset($route) && is_array($route)) + { + isset($route['default_controller']) && $this->default_controller = $route['default_controller']; + isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes']; + unset($route['default_controller'], $route['translate_uri_dashes']); + $this->routes = $route; + } + + // Are query strings enabled in the config file? Normally CI doesn't utilize query strings + // since URI segments are more search-engine friendly, but they can optionally be used. + // If this feature is enabled, we will gather the directory/class/method a little differently + if ($this->enable_query_strings) + { + // If the directory is set at this time, it means an override exists, so skip the checks + if ( ! isset($this->directory)) + { + $_d = $this->config->item('directory_trigger'); + $_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : ''; + + if ($_d !== '') + { + $this->uri->filter_uri($_d); + $this->set_directory($_d); + } + } + + $_c = trim($this->config->item('controller_trigger')); + if ( ! empty($_GET[$_c])) + { + $this->uri->filter_uri($_GET[$_c]); + $this->set_class($_GET[$_c]); + + $_f = trim($this->config->item('function_trigger')); + if ( ! empty($_GET[$_f])) + { + $this->uri->filter_uri($_GET[$_f]); + $this->set_method($_GET[$_f]); + } + + $this->uri->rsegments = array( + 1 => $this->class, + 2 => $this->method + ); + } + else + { + $this->_set_default_controller(); + } + + // Routing rules don't apply to query strings and we don't need to detect + // directories, so we're done here + return; + } + + // Is there anything to parse? + if ($this->uri->uri_string !== '') + { + $this->_parse_routes(); + } + else + { + $this->_set_default_controller(); + } + } + + // -------------------------------------------------------------------- + + /** + * Set request route + * + * Takes an array of URI segments as input and sets the class/method + * to be called. + * + * @used-by CI_Router::_parse_routes() + * @param array $segments URI segments + * @return void + */ + protected function _set_request($segments = array()) + { + $segments = $this->_validate_request($segments); + // If we don't have any segments left - try the default controller; + // WARNING: Directories get shifted out of the segments array! + if (empty($segments)) + { + $this->_set_default_controller(); + return; + } + + if ($this->translate_uri_dashes === TRUE) + { + $segments[0] = str_replace('-', '_', $segments[0]); + if (isset($segments[1])) + { + $segments[1] = str_replace('-', '_', $segments[1]); + } + } + + $this->set_class($segments[0]); + if (isset($segments[1])) + { + $this->set_method($segments[1]); + } + else + { + $segments[1] = 'index'; + } + + array_unshift($segments, NULL); + unset($segments[0]); + $this->uri->rsegments = $segments; + } + + // -------------------------------------------------------------------- + + /** + * Set default controller + * + * @return void + */ + protected function _set_default_controller() + { + if (empty($this->default_controller)) + { + show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.'); + } + + // Is the method being specified? + if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2) + { + $method = 'index'; + } + + if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($class).'.php')) + { + // This will trigger 404 later + return; + } + + $this->set_class($class); + $this->set_method($method); + + // Assign routed segments, index starting from 1 + $this->uri->rsegments = array( + 1 => $class, + 2 => $method + ); + + log_message('debug', 'No URI present. Default controller set.'); + } + + // -------------------------------------------------------------------- + + /** + * Validate request + * + * Attempts validate the URI request and determine the controller path. + * + * @used-by CI_Router::_set_request() + * @param array $segments URI segments + * @return mixed URI segments + */ + protected function _validate_request($segments) + { + $c = count($segments); + $directory_override = isset($this->directory); + + // Loop through our segments and return as soon as a controller + // is found or when such a directory doesn't exist + while ($c-- > 0) + { + $test = $this->directory + .ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]); + + if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') + && $directory_override === FALSE + && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]) + ) + { + $this->set_directory(array_shift($segments), TRUE); + continue; + } + + return $segments; + } + + // This means that all segments were actually directories + return $segments; + } + + // -------------------------------------------------------------------- + + /** + * Parse Routes + * + * Matches any routes that may exist in the config/routes.php file + * against the URI to determine if the class/method need to be remapped. + * + * @return void + */ + protected function _parse_routes() + { + // Turn the segment array into a URI string + $uri = implode('/', $this->uri->segments); + + // Get HTTP verb + $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli'; + + // Loop through the route array looking for wildcards + foreach ($this->routes as $key => $val) + { + // Check if route format is using HTTP verbs + if (is_array($val)) + { + $val = array_change_key_case($val, CASE_LOWER); + if (isset($val[$http_verb])) + { + $val = $val[$http_verb]; + } + else + { + continue; + } + } + + // Convert wildcards to RegEx + $key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key); + + // Does the RegEx match? + if (preg_match('#^'.$key.'$#', $uri, $matches)) + { + // Are we using callbacks to process back-references? + if ( ! is_string($val) && is_callable($val)) + { + // Remove the original string from the matches array. + array_shift($matches); + + // Execute the callback using the values in matches as its parameters. + $val = call_user_func_array($val, $matches); + } + // Are we using the default routing method for back-references? + elseif (strpos($val, '$') !== FALSE && strpos($key, '(') !== FALSE) + { + $val = preg_replace('#^'.$key.'$#', $val, $uri); + } + + $this->_set_request(explode('/', $val)); + return; + } + } + + // If we got this far it means we didn't encounter a + // matching route so we'll set the site default route + $this->_set_request(array_values($this->uri->segments)); + } + + // -------------------------------------------------------------------- + + /** + * Set class name + * + * @param string $class Class name + * @return void + */ + public function set_class($class) + { + $this->class = str_replace(array('/', '.'), '', $class); + } + + // -------------------------------------------------------------------- + + /** + * Fetch the current class + * + * @deprecated 3.0.0 Read the 'class' property instead + * @return string + */ + public function fetch_class() + { + return $this->class; + } + + // -------------------------------------------------------------------- + + /** + * Set method name + * + * @param string $method Method name + * @return void + */ + public function set_method($method) + { + $this->method = $method; + } + + // -------------------------------------------------------------------- + + /** + * Fetch the current method + * + * @deprecated 3.0.0 Read the 'method' property instead + * @return string + */ + public function fetch_method() + { + return $this->method; + } + + // -------------------------------------------------------------------- + + /** + * Set directory name + * + * @param string $dir Directory name + * @param bool $append Whether we're appending rather than setting the full value + * @return void + */ + public function set_directory($dir, $append = FALSE) + { + if ($append !== TRUE OR empty($this->directory)) + { + $this->directory = str_replace('.', '', trim($dir, '/')).'/'; + } + else + { + $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; + } + } + + // -------------------------------------------------------------------- + + /** + * Fetch directory + * + * Feches the sub-directory (if any) that contains the requested + * controller class. + * + * @deprecated 3.0.0 Read the 'directory' property instead + * @return string + */ + public function fetch_directory() + { + return $this->directory; + } + +} diff --git a/system/core/Security.php b/system/core/Security.php new file mode 100755 index 0000000..082ffa9 --- /dev/null +++ b/system/core/Security.php @@ -0,0 +1,1080 @@ +', '<', '>', + "'", '"', '&', '$', '#', + '{', '}', '[', ']', '=', + ';', '?', '%20', '%22', + '%3c', // < + '%253c', // < + '%3e', // > + '%0e', // > + '%28', // ( + '%29', // ) + '%2528', // ( + '%26', // & + '%24', // $ + '%3f', // ? + '%3b', // ; + '%3d' // = + ); + + /** + * Character set + * + * Will be overridden by the constructor. + * + * @var string + */ + public $charset = 'UTF-8'; + + /** + * XSS Hash + * + * Random Hash for protecting URLs. + * + * @var string + */ + protected $_xss_hash; + + /** + * CSRF Hash + * + * Random hash for Cross Site Request Forgery protection cookie + * + * @var string + */ + protected $_csrf_hash; + + /** + * CSRF Expire time + * + * Expiration time for Cross Site Request Forgery protection cookie. + * Defaults to two hours (in seconds). + * + * @var int + */ + protected $_csrf_expire = 7200; + + /** + * CSRF Token name + * + * Token name for Cross Site Request Forgery protection cookie. + * + * @var string + */ + protected $_csrf_token_name = 'ci_csrf_token'; + + /** + * CSRF Cookie name + * + * Cookie name for Cross Site Request Forgery protection cookie. + * + * @var string + */ + protected $_csrf_cookie_name = 'ci_csrf_token'; + + /** + * List of never allowed strings + * + * @var array + */ + protected $_never_allowed_str = array( + 'document.cookie' => '[removed]', + 'document.write' => '[removed]', + '.parentNode' => '[removed]', + '.innerHTML' => '[removed]', + '-moz-binding' => '[removed]', + '' => '-->', + ' '<![CDATA[', + '' => '<comment>', + '<%' => '<%' + ); + + /** + * List of never allowed regex replacements + * + * @var array + */ + protected $_never_allowed_regex = array( + 'javascript\s*:', + '(document|(document\.)?window)\.(location|on\w*)', + 'expression\s*(\(|&\#40;)', // CSS and IE + 'vbscript\s*:', // IE, surprise! + 'wscript\s*:', // IE + 'jscript\s*:', // IE + 'vbs\s*:', // IE + 'Redirect\s+30\d', + "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?" + ); + + /** + * Class constructor + * + * @return void + */ + public function __construct() + { + // Is CSRF protection enabled? + if (config_item('csrf_protection')) + { + // CSRF config + foreach (array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key) + { + if (NULL !== ($val = config_item($key))) + { + $this->{'_'.$key} = $val; + } + } + + // Append application specific cookie prefix + if ($cookie_prefix = config_item('cookie_prefix')) + { + $this->_csrf_cookie_name = $cookie_prefix.$this->_csrf_cookie_name; + } + + // Set the CSRF hash + $this->_csrf_set_hash(); + } + + $this->charset = strtoupper(config_item('charset')); + + log_message('info', 'Security Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * CSRF Verify + * + * @return CI_Security + */ + public function csrf_verify() + { + // If it's not a POST request we will set the CSRF cookie + if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') + { + return $this->csrf_set_cookie(); + } + + // Check if URI has been whitelisted from CSRF checks + if ($exclude_uris = config_item('csrf_exclude_uris')) + { + $uri = load_class('URI', 'core'); + foreach ($exclude_uris as $excluded) + { + if (preg_match('#^'.$excluded.'$#i'.(UTF8_ENABLED ? 'u' : ''), $uri->uri_string())) + { + return $this; + } + } + } + + // Check CSRF token validity, but don't error on mismatch just yet - we'll want to regenerate + $valid = isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]) + && hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]); + + // We kill this since we're done and we don't want to pollute the _POST array + unset($_POST[$this->_csrf_token_name]); + + // Regenerate on every submission? + if (config_item('csrf_regenerate')) + { + // Nothing should last forever + unset($_COOKIE[$this->_csrf_cookie_name]); + $this->_csrf_hash = NULL; + } + + $this->_csrf_set_hash(); + $this->csrf_set_cookie(); + + if ($valid !== TRUE) + { + $this->csrf_show_error(); + } + + log_message('info', 'CSRF token verified'); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * CSRF Set Cookie + * + * @codeCoverageIgnore + * @return CI_Security + */ + public function csrf_set_cookie() + { + $expire = time() + $this->_csrf_expire; + $secure_cookie = (bool) config_item('cookie_secure'); + + if ($secure_cookie && ! is_https()) + { + return FALSE; + } + + setcookie( + $this->_csrf_cookie_name, + $this->_csrf_hash, + $expire, + config_item('cookie_path'), + config_item('cookie_domain'), + $secure_cookie, + config_item('cookie_httponly') + ); + log_message('info', 'CSRF cookie sent'); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Show CSRF Error + * + * @return void + */ + public function csrf_show_error() + { + show_error('The action you have requested is not allowed.', 403); + } + + // -------------------------------------------------------------------- + + /** + * Get CSRF Hash + * + * @see CI_Security::$_csrf_hash + * @return string CSRF hash + */ + public function get_csrf_hash() + { + return $this->_csrf_hash; + } + + // -------------------------------------------------------------------- + + /** + * Get CSRF Token Name + * + * @see CI_Security::$_csrf_token_name + * @return string CSRF token name + */ + public function get_csrf_token_name() + { + return $this->_csrf_token_name; + } + + // -------------------------------------------------------------------- + + /** + * XSS Clean + * + * Sanitizes data so that Cross Site Scripting Hacks can be + * prevented. This method does a fair amount of work but + * it is extremely thorough, designed to prevent even the + * most obscure XSS attempts. Nothing is ever 100% foolproof, + * of course, but I haven't been able to get anything passed + * the filter. + * + * Note: Should only be used to deal with data upon submission. + * It's not something that should be used for general + * runtime processing. + * + * @link http://channel.bitflux.ch/wiki/XSS_Prevention + * Based in part on some code and ideas from Bitflux. + * + * @link http://ha.ckers.org/xss.html + * To help develop this script I used this great list of + * vulnerabilities along with a few other hacks I've + * harvested from examining vulnerabilities in other programs. + * + * @param string|string[] $str Input data + * @param bool $is_image Whether the input is an image + * @return string + */ + public function xss_clean($str, $is_image = FALSE) + { + // Is the string an array? + if (is_array($str)) + { + foreach ($str as $key => &$value) + { + $str[$key] = $this->xss_clean($value); + } + + return $str; + } + + // Remove Invisible Characters + $str = remove_invisible_characters($str); + + /* + * URL Decode + * + * Just in case stuff like this is submitted: + * + * Google + * + * Note: Use rawurldecode() so it does not remove plus signs + */ + if (stripos($str, '%') !== false) + { + do + { + $oldstr = $str; + $str = rawurldecode($str); + $str = preg_replace_callback('#%(?:\s*[0-9a-f]){2,}#i', array($this, '_urldecodespaces'), $str); + } + while ($oldstr !== $str); + unset($oldstr); + } + + /* + * Convert character entities to ASCII + * + * This permits our tests below to work reliably. + * We only convert entities that are within tags since + * these are the ones that will pose security problems. + */ + $str = preg_replace_callback("/[^a-z0-9>]+[a-z0-9]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str); + $str = preg_replace_callback('/<\w+.*/si', array($this, '_decode_entity'), $str); + + // Remove Invisible Characters Again! + $str = remove_invisible_characters($str); + + /* + * Convert all tabs to spaces + * + * This prevents strings like this: ja vascript + * NOTE: we deal with spaces between characters later. + * NOTE: preg_replace was found to be amazingly slow here on + * large blocks of data, so we use str_replace. + */ + $str = str_replace("\t", ' ', $str); + + // Capture converted string for later comparison + $converted_string = $str; + + // Remove Strings that are never allowed + $str = $this->_do_never_allowed($str); + + /* + * Makes PHP tags safe + * + * Note: XML tags are inadvertently replaced too: + * + * '), array('<?', '?>'), $str); + } + + /* + * Compact any exploded words + * + * This corrects words like: j a v a s c r i p t + * These words are compacted back to their correct state. + */ + $words = array( + 'javascript', 'expression', 'vbscript', 'jscript', 'wscript', + 'vbs', 'script', 'base64', 'applet', 'alert', 'document', + 'write', 'cookie', 'window', 'confirm', 'prompt', 'eval' + ); + + foreach ($words as $word) + { + $word = implode('\s*', str_split($word)).'\s*'; + + // We only want to do this when it is followed by a non-word character + // That way valid stuff like "dealer to" does not become "dealerto" + $str = preg_replace_callback('#('.substr($word, 0, -3).')(\W)#is', array($this, '_compact_exploded_words'), $str); + } + + /* + * Remove disallowed Javascript in links or img tags + * We used to do some version comparisons and use of stripos(), + * but it is dog slow compared to these simplified non-capturing + * preg_match(), especially if the pattern exists in the string + * + * Note: It was reported that not only space characters, but all in + * the following pattern can be parsed as separators between a tag name + * and its attributes: [\d\s"\'`;,\/\=\(\x00\x0B\x09\x0C] + * ... however, remove_invisible_characters() above already strips the + * hex-encoded ones, so we'll skip them below. + */ + do + { + $original = $str; + + if (preg_match('/]+([^>]*?)(?:>|$)#si', array($this, '_js_link_removal'), $str); + } + + if (preg_match('/]*?)(?:\s?/?>|$)#si', array($this, '_js_img_removal'), $str); + } + + if (preg_match('/script|xss/i', $str)) + { + $str = preg_replace('##si', '[removed]', $str); + } + } + while ($original !== $str); + unset($original); + + /* + * Sanitize naughty HTML elements + * + * If a tag containing any of the words in the list + * below is found, the tag gets converted to entities. + * + * So this: + * Becomes: <blink> + */ + $pattern = '#' + .'<((?/*\s*)((?[a-z0-9]+)(?=[^a-z0-9]|$)|.+)' // tag start and name, followed by a non-tag character + .'[^\s\042\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator + // optional attributes + .'(?(?:[\s\042\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons + .'[^\s\042\047>/=]+' // attribute characters + // optional attribute-value + .'(?:\s*=' // attribute-value separator + .'(?:[^\s\042\047=><`]+|\s*\042[^\042]*\042|\s*\047[^\047]*\047|\s*(?U:[^\s\042\047=><`]*))' // single, double or non-quoted value + .')?' // end optional attribute-value group + .')*)' // end optional attributes group + .'[^>]*)(?\>)?#isS'; + + // Note: It would be nice to optimize this for speed, BUT + // only matching the naughty elements here results in + // false positives and in turn - vulnerabilities! + do + { + $old_str = $str; + $str = preg_replace_callback($pattern, array($this, '_sanitize_naughty_html'), $str); + } + while ($old_str !== $str); + unset($old_str); + + /* + * Sanitize naughty scripting elements + * + * Similar to above, only instead of looking for + * tags it looks for PHP and JavaScript commands + * that are disallowed. Rather than removing the + * code, it simply converts the parenthesis to entities + * rendering the code un-executable. + * + * For example: eval('some code') + * Becomes: eval('some code') + */ + $str = preg_replace( + '#(alert|prompt|confirm|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', + '\\1\\2(\\3)', + $str + ); + + // Final clean up + // This adds a bit of extra precaution in case + // something got through the above filters + $str = $this->_do_never_allowed($str); + + /* + * Images are Handled in a Special Way + * - Essentially, we want to know that after all of the character + * conversion is done whether any unwanted, likely XSS, code was found. + * If not, we return TRUE, as the image is clean. + * However, if the string post-conversion does not matched the + * string post-removal of XSS, then it fails, as there was unwanted XSS + * code found and removed/changed during processing. + */ + if ($is_image === TRUE) + { + return ($str === $converted_string); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * XSS Hash + * + * Generates the XSS hash if needed and returns it. + * + * @see CI_Security::$_xss_hash + * @return string XSS hash + */ + public function xss_hash() + { + if ($this->_xss_hash === NULL) + { + $rand = $this->get_random_bytes(16); + $this->_xss_hash = ($rand === FALSE) + ? md5(uniqid(mt_rand(), TRUE)) + : bin2hex($rand); + } + + return $this->_xss_hash; + } + + // -------------------------------------------------------------------- + + /** + * Get random bytes + * + * @param int $length Output length + * @return string + */ + public function get_random_bytes($length) + { + if (empty($length) OR ! ctype_digit((string) $length)) + { + return FALSE; + } + + if (function_exists('random_bytes')) + { + try + { + // The cast is required to avoid TypeError + return random_bytes((int) $length); + } + catch (Exception $e) + { + // If random_bytes() can't do the job, we can't either ... + // There's no point in using fallbacks. + log_message('error', $e->getMessage()); + return FALSE; + } + } + + // Unfortunately, none of the following PRNGs is guaranteed to exist ... + if (defined('MCRYPT_DEV_URANDOM') && ($output = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM)) !== FALSE) + { + return $output; + } + + + if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) + { + // Try not to waste entropy ... + is_php('5.4') && stream_set_chunk_size($fp, $length); + $output = fread($fp, $length); + fclose($fp); + if ($output !== FALSE) + { + return $output; + } + } + + if (function_exists('openssl_random_pseudo_bytes')) + { + return openssl_random_pseudo_bytes($length); + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * HTML Entities Decode + * + * A replacement for html_entity_decode() + * + * The reason we are not using html_entity_decode() by itself is because + * while it is not technically correct to leave out the semicolon + * at the end of an entity most browsers will still interpret the entity + * correctly. html_entity_decode() does not convert entities without + * semicolons, so we are left with our own little solution here. Bummer. + * + * @link http://php.net/html-entity-decode + * + * @param string $str Input + * @param string $charset Character set + * @return string + */ + public function entity_decode($str, $charset = NULL) + { + if (strpos($str, '&') === FALSE) + { + return $str; + } + + static $_entities; + + isset($charset) OR $charset = $this->charset; + $flag = is_php('5.4') + ? ENT_COMPAT | ENT_HTML5 + : ENT_COMPAT; + + if ( ! isset($_entities)) + { + $_entities = array_map('strtolower', get_html_translation_table(HTML_ENTITIES, $flag, $charset)); + + // If we're not on PHP 5.4+, add the possibly dangerous HTML 5 + // entities to the array manually + if ($flag === ENT_COMPAT) + { + $_entities[':'] = ':'; + $_entities['('] = '('; + $_entities[')'] = ')'; + $_entities["\n"] = ' '; + $_entities["\t"] = ' '; + } + } + + do + { + $str_compare = $str; + + // Decode standard entities, avoiding false positives + if (preg_match_all('/&[a-z]{2,}(?![a-z;])/i', $str, $matches)) + { + $replace = array(); + $matches = array_unique(array_map('strtolower', $matches[0])); + foreach ($matches as &$match) + { + if (($char = array_search($match.';', $_entities, TRUE)) !== FALSE) + { + $replace[$match] = $char; + } + } + + $str = str_replace(array_keys($replace), array_values($replace), $str); + } + + // Decode numeric & UTF16 two byte entities + $str = html_entity_decode( + preg_replace('/(&#(?:x0*[0-9a-f]{2,5}(?![0-9a-f;])|(?:0*\d{2,4}(?![0-9;]))))/iS', '$1;', $str), + $flag, + $charset + ); + + if ($flag === ENT_COMPAT) + { + $str = str_replace(array_values($_entities), array_keys($_entities), $str); + } + } + while ($str_compare !== $str); + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Sanitize Filename + * + * @param string $str Input file name + * @param bool $relative_path Whether to preserve paths + * @return string + */ + public function sanitize_filename($str, $relative_path = FALSE) + { + $bad = $this->filename_bad_chars; + + if ( ! $relative_path) + { + $bad[] = './'; + $bad[] = '/'; + } + + $str = remove_invisible_characters($str, FALSE); + + do + { + $old = $str; + $str = str_replace($bad, '', $str); + } + while ($old !== $str); + + return stripslashes($str); + } + + // ---------------------------------------------------------------- + + /** + * Strip Image Tags + * + * @param string $str + * @return string + */ + public function strip_image_tags($str) + { + return preg_replace( + array( + '##i', + '#`]+)).*?\>#i' + ), + '\\2', + $str + ); + } + + // ---------------------------------------------------------------- + + /** + * URL-decode taking spaces into account + * + * @see https://github.com/bcit-ci/CodeIgniter/issues/4877 + * @param array $matches + * @return string + */ + protected function _urldecodespaces($matches) + { + $input = $matches[0]; + $nospaces = preg_replace('#\s+#', '', $input); + return ($nospaces === $input) + ? $input + : rawurldecode($nospaces); + } + + // ---------------------------------------------------------------- + + /** + * Compact Exploded Words + * + * Callback method for xss_clean() to remove whitespace from + * things like 'j a v a s c r i p t'. + * + * @used-by CI_Security::xss_clean() + * @param array $matches + * @return string + */ + protected function _compact_exploded_words($matches) + { + return preg_replace('/\s+/s', '', $matches[1]).$matches[2]; + } + + // -------------------------------------------------------------------- + + /** + * Sanitize Naughty HTML + * + * Callback method for xss_clean() to remove naughty HTML elements. + * + * @used-by CI_Security::xss_clean() + * @param array $matches + * @return string + */ + protected function _sanitize_naughty_html($matches) + { + static $naughty_tags = array( + 'alert', 'area', 'prompt', 'confirm', 'applet', 'audio', 'basefont', 'base', 'behavior', 'bgsound', + 'blink', 'body', 'embed', 'expression', 'form', 'frameset', 'frame', 'head', 'html', 'ilayer', + 'iframe', 'input', 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object', + 'plaintext', 'style', 'script', 'textarea', 'title', 'math', 'video', 'svg', 'xml', 'xss' + ); + + static $evil_attributes = array( + 'on\w+', 'style', 'xmlns', 'formaction', 'form', 'xlink:href', 'FSCommand', 'seekSegmentTime' + ); + + // First, escape unclosed tags + if (empty($matches['closeTag'])) + { + return '<'.$matches[1]; + } + // Is the element that we caught naughty? If so, escape it + elseif (in_array(strtolower($matches['tagName']), $naughty_tags, TRUE)) + { + return '<'.$matches[1].'>'; + } + // For other tags, see if their attributes are "evil" and strip those + elseif (isset($matches['attributes'])) + { + // We'll store the already fitlered attributes here + $attributes = array(); + + // Attribute-catching pattern + $attributes_pattern = '#' + .'(?[^\s\042\047>/=]+)' // attribute characters + // optional attribute-value + .'(?:\s*=(?[^\s\042\047=><`]+|\s*\042[^\042]*\042|\s*\047[^\047]*\047|\s*(?U:[^\s\042\047=><`]*)))' // attribute-value separator + .'#i'; + + // Blacklist pattern for evil attribute names + $is_evil_pattern = '#^('.implode('|', $evil_attributes).')$#i'; + + // Each iteration filters a single attribute + do + { + // Strip any non-alpha characters that may precede an attribute. + // Browsers often parse these incorrectly and that has been a + // of numerous XSS issues we've had. + $matches['attributes'] = preg_replace('#^[^a-z]+#i', '', $matches['attributes']); + + if ( ! preg_match($attributes_pattern, $matches['attributes'], $attribute, PREG_OFFSET_CAPTURE)) + { + // No (valid) attribute found? Discard everything else inside the tag + break; + } + + if ( + // Is it indeed an "evil" attribute? + preg_match($is_evil_pattern, $attribute['name'][0]) + // Or does it have an equals sign, but no value and not quoted? Strip that too! + OR (trim($attribute['value'][0]) === '') + ) + { + $attributes[] = 'xss=removed'; + } + else + { + $attributes[] = $attribute[0][0]; + } + + $matches['attributes'] = substr($matches['attributes'], $attribute[0][1] + strlen($attribute[0][0])); + } + while ($matches['attributes'] !== ''); + + $attributes = empty($attributes) + ? '' + : ' '.implode(' ', $attributes); + return '<'.$matches['slash'].$matches['tagName'].$attributes.'>'; + } + + return $matches[0]; + } + + // -------------------------------------------------------------------- + + /** + * JS Link Removal + * + * Callback method for xss_clean() to sanitize links. + * + * This limits the PCRE backtracks, making it more performance friendly + * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in + * PHP 5.2+ on link-heavy strings. + * + * @used-by CI_Security::xss_clean() + * @param array $match + * @return string + */ + protected function _js_link_removal($match) + { + return str_replace( + $match[1], + preg_replace( + '#href=.*?(?:(?:alert|prompt|confirm)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|_filter_attributes($match[1]) + ), + $match[0] + ); + } + + // -------------------------------------------------------------------- + + /** + * JS Image Removal + * + * Callback method for xss_clean() to sanitize image tags. + * + * This limits the PCRE backtracks, making it more performance friendly + * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in + * PHP 5.2+ on image tag heavy strings. + * + * @used-by CI_Security::xss_clean() + * @param array $match + * @return string + */ + protected function _js_img_removal($match) + { + return str_replace( + $match[1], + preg_replace( + '#src=.*?(?:(?:alert|prompt|confirm|eval)(?:\(|&\#40;)|javascript:|livescript:|mocha:|charset=|window\.|document\.|\.cookie|_filter_attributes($match[1]) + ), + $match[0] + ); + } + + // -------------------------------------------------------------------- + + /** + * Attribute Conversion + * + * @used-by CI_Security::xss_clean() + * @param array $match + * @return string + */ + protected function _convert_attribute($match) + { + return str_replace(array('>', '<', '\\'), array('>', '<', '\\\\'), $match[0]); + } + + // -------------------------------------------------------------------- + + /** + * Filter Attributes + * + * Filters tag attributes for consistency and safety. + * + * @used-by CI_Security::_js_img_removal() + * @used-by CI_Security::_js_link_removal() + * @param string $str + * @return string + */ + protected function _filter_attributes($str) + { + $out = ''; + if (preg_match_all('#\s*[a-z\-]+\s*=\s*(\042|\047)([^\\1]*?)\\1#is', $str, $matches)) + { + foreach ($matches[0] as $match) + { + $out .= preg_replace('#/\*.*?\*/#s', '', $match); + } + } + + return $out; + } + + // -------------------------------------------------------------------- + + /** + * HTML Entity Decode Callback + * + * @used-by CI_Security::xss_clean() + * @param array $match + * @return string + */ + protected function _decode_entity($match) + { + // Protect GET variables in URLs + // 901119URL5918AMP18930PROTECT8198 + $match = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-/]+)|i', $this->xss_hash().'\\1=\\2', $match[0]); + + // Decode, then un-protect URL GET vars + return str_replace( + $this->xss_hash(), + '&', + $this->entity_decode($match, $this->charset) + ); + } + + // -------------------------------------------------------------------- + + /** + * Do Never Allowed + * + * @used-by CI_Security::xss_clean() + * @param string + * @return string + */ + protected function _do_never_allowed($str) + { + $str = str_replace(array_keys($this->_never_allowed_str), $this->_never_allowed_str, $str); + + foreach ($this->_never_allowed_regex as $regex) + { + $str = preg_replace('#'.$regex.'#is', '[removed]', $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Set CSRF Hash and Cookie + * + * @return string + */ + protected function _csrf_set_hash() + { + if ($this->_csrf_hash === NULL) + { + // If the cookie exists we will use its value. + // We don't necessarily want to regenerate it with + // each page load since a page could contain embedded + // sub-pages causing this feature to fail + if (isset($_COOKIE[$this->_csrf_cookie_name]) && is_string($_COOKIE[$this->_csrf_cookie_name]) + && preg_match('#^[0-9a-f]{32}$#iS', $_COOKIE[$this->_csrf_cookie_name]) === 1) + { + return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name]; + } + + $rand = $this->get_random_bytes(16); + $this->_csrf_hash = ($rand === FALSE) + ? md5(uniqid(mt_rand(), TRUE)) + : bin2hex($rand); + } + + return $this->_csrf_hash; + } + +} diff --git a/system/core/URI.php b/system/core/URI.php new file mode 100755 index 0000000..3ccdfa7 --- /dev/null +++ b/system/core/URI.php @@ -0,0 +1,643 @@ +config =& load_class('Config', 'core'); + + // If query strings are enabled, we don't need to parse any segments. + // However, they don't make sense under CLI. + if (is_cli() OR $this->config->item('enable_query_strings') !== TRUE) + { + $this->_permitted_uri_chars = $this->config->item('permitted_uri_chars'); + + // If it's a CLI request, ignore the configuration + if (is_cli()) + { + $uri = $this->_parse_argv(); + } + else + { + $protocol = $this->config->item('uri_protocol'); + empty($protocol) && $protocol = 'REQUEST_URI'; + + switch ($protocol) + { + case 'AUTO': // For BC purposes only + case 'REQUEST_URI': + $uri = $this->_parse_request_uri(); + break; + case 'QUERY_STRING': + $uri = $this->_parse_query_string(); + break; + case 'PATH_INFO': + default: + $uri = isset($_SERVER[$protocol]) + ? $_SERVER[$protocol] + : $this->_parse_request_uri(); + break; + } + } + + $this->_set_uri_string($uri); + } + + log_message('info', 'URI Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Set URI String + * + * @param string $str + * @return void + */ + protected function _set_uri_string($str) + { + // Filter out control characters and trim slashes + $this->uri_string = trim(remove_invisible_characters($str, FALSE), '/'); + + if ($this->uri_string !== '') + { + // Remove the URL suffix, if present + if (($suffix = (string) $this->config->item('url_suffix')) !== '') + { + $slen = strlen($suffix); + + if (substr($this->uri_string, -$slen) === $suffix) + { + $this->uri_string = substr($this->uri_string, 0, -$slen); + } + } + + $this->segments[0] = NULL; + // Populate the segments array + foreach (explode('/', trim($this->uri_string, '/')) as $val) + { + $val = trim($val); + // Filter segments for security + $this->filter_uri($val); + + if ($val !== '') + { + $this->segments[] = $val; + } + } + + unset($this->segments[0]); + } + } + + // -------------------------------------------------------------------- + + /** + * Parse REQUEST_URI + * + * Will parse REQUEST_URI and automatically detect the URI from it, + * while fixing the query string if necessary. + * + * @return string + */ + protected function _parse_request_uri() + { + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) + { + return ''; + } + + // parse_url() returns false if no host is present, but the path or query string + // contains a colon followed by a number + $uri = parse_url('http://dummy'.$_SERVER['REQUEST_URI']); + $query = isset($uri['query']) ? $uri['query'] : ''; + $uri = isset($uri['path']) ? $uri['path'] : ''; + + if (isset($_SERVER['SCRIPT_NAME'][0])) + { + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) + { + $uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME'])); + } + elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) + { + $uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); + } + } + + // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct + // URI is found, and also fixes the QUERY_STRING server var and $_GET array. + if (trim($uri, '/') === '' && strncmp($query, '/', 1) === 0) + { + $query = explode('?', $query, 2); + $uri = $query[0]; + $_SERVER['QUERY_STRING'] = isset($query[1]) ? $query[1] : ''; + } + else + { + $_SERVER['QUERY_STRING'] = $query; + } + + parse_str($_SERVER['QUERY_STRING'], $_GET); + + if ($uri === '/' OR $uri === '') + { + return '/'; + } + + // Do some final cleaning of the URI and return it + return $this->_remove_relative_directory($uri); + } + + // -------------------------------------------------------------------- + + /** + * Parse QUERY_STRING + * + * Will parse QUERY_STRING and automatically detect the URI from it. + * + * @return string + */ + protected function _parse_query_string() + { + $uri = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); + + if (trim($uri, '/') === '') + { + return ''; + } + elseif (strncmp($uri, '/', 1) === 0) + { + $uri = explode('?', $uri, 2); + $_SERVER['QUERY_STRING'] = isset($uri[1]) ? $uri[1] : ''; + $uri = $uri[0]; + } + + parse_str($_SERVER['QUERY_STRING'], $_GET); + + return $this->_remove_relative_directory($uri); + } + + // -------------------------------------------------------------------- + + /** + * Parse CLI arguments + * + * Take each command line argument and assume it is a URI segment. + * + * @return string + */ + protected function _parse_argv() + { + $args = array_slice($_SERVER['argv'], 1); + return $args ? implode('/', $args) : ''; + } + + // -------------------------------------------------------------------- + + /** + * Remove relative directory (../) and multi slashes (///) + * + * Do some final cleaning of the URI and return it, currently only used in self::_parse_request_uri() + * + * @param string $uri + * @return string + */ + protected function _remove_relative_directory($uri) + { + $uris = array(); + $tok = strtok($uri, '/'); + while ($tok !== FALSE) + { + if (( ! empty($tok) OR $tok === '0') && $tok !== '..') + { + $uris[] = $tok; + } + $tok = strtok('/'); + } + + return implode('/', $uris); + } + + // -------------------------------------------------------------------- + + /** + * Filter URI + * + * Filters segments for malicious characters. + * + * @param string $str + * @return void + */ + public function filter_uri(&$str) + { + if ( ! empty($str) && ! empty($this->_permitted_uri_chars) && ! preg_match('/^['.$this->_permitted_uri_chars.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $str)) + { + show_error('The URI you submitted has disallowed characters.', 400); + } + } + + // -------------------------------------------------------------------- + + /** + * Fetch URI Segment + * + * @see CI_URI::$segments + * @param int $n Index + * @param mixed $no_result What to return if the segment index is not found + * @return mixed + */ + public function segment($n, $no_result = NULL) + { + return isset($this->segments[$n]) ? $this->segments[$n] : $no_result; + } + + // -------------------------------------------------------------------- + + /** + * Fetch URI "routed" Segment + * + * Returns the re-routed URI segment (assuming routing rules are used) + * based on the index provided. If there is no routing, will return + * the same result as CI_URI::segment(). + * + * @see CI_URI::$rsegments + * @see CI_URI::segment() + * @param int $n Index + * @param mixed $no_result What to return if the segment index is not found + * @return mixed + */ + public function rsegment($n, $no_result = NULL) + { + return isset($this->rsegments[$n]) ? $this->rsegments[$n] : $no_result; + } + + // -------------------------------------------------------------------- + + /** + * URI to assoc + * + * Generates an associative array of URI data starting at the supplied + * segment index. For example, if this is your URI: + * + * example.com/user/search/name/joe/location/UK/gender/male + * + * You can use this method to generate an array with this prototype: + * + * array ( + * name => joe + * location => UK + * gender => male + * ) + * + * @param int $n Index (default: 3) + * @param array $default Default values + * @return array + */ + public function uri_to_assoc($n = 3, $default = array()) + { + return $this->_uri_to_assoc($n, $default, 'segment'); + } + + // -------------------------------------------------------------------- + + /** + * Routed URI to assoc + * + * Identical to CI_URI::uri_to_assoc(), only it uses the re-routed + * segment array. + * + * @see CI_URI::uri_to_assoc() + * @param int $n Index (default: 3) + * @param array $default Default values + * @return array + */ + public function ruri_to_assoc($n = 3, $default = array()) + { + return $this->_uri_to_assoc($n, $default, 'rsegment'); + } + + // -------------------------------------------------------------------- + + /** + * Internal URI-to-assoc + * + * Generates a key/value pair from the URI string or re-routed URI string. + * + * @used-by CI_URI::uri_to_assoc() + * @used-by CI_URI::ruri_to_assoc() + * @param int $n Index (default: 3) + * @param array $default Default values + * @param string $which Array name ('segment' or 'rsegment') + * @return array + */ + protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment') + { + if ( ! is_numeric($n)) + { + return $default; + } + + if (isset($this->keyval[$which], $this->keyval[$which][$n])) + { + return $this->keyval[$which][$n]; + } + + $total_segments = "total_{$which}s"; + $segment_array = "{$which}_array"; + + if ($this->$total_segments() < $n) + { + return (count($default) === 0) + ? array() + : array_fill_keys($default, NULL); + } + + $segments = array_slice($this->$segment_array(), ($n - 1)); + $i = 0; + $lastval = ''; + $retval = array(); + foreach ($segments as $seg) + { + if ($i % 2) + { + $retval[$lastval] = $seg; + } + else + { + $retval[$seg] = NULL; + $lastval = $seg; + } + + $i++; + } + + if (count($default) > 0) + { + foreach ($default as $val) + { + if ( ! array_key_exists($val, $retval)) + { + $retval[$val] = NULL; + } + } + } + + // Cache the array for reuse + isset($this->keyval[$which]) OR $this->keyval[$which] = array(); + $this->keyval[$which][$n] = $retval; + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Assoc to URI + * + * Generates a URI string from an associative array. + * + * @param array $array Input array of key/value pairs + * @return string URI string + */ + public function assoc_to_uri($array) + { + $temp = array(); + foreach ((array) $array as $key => $val) + { + $temp[] = $key; + $temp[] = $val; + } + + return implode('/', $temp); + } + + // -------------------------------------------------------------------- + + /** + * Slash segment + * + * Fetches an URI segment with a slash. + * + * @param int $n Index + * @param string $where Where to add the slash ('trailing' or 'leading') + * @return string + */ + public function slash_segment($n, $where = 'trailing') + { + return $this->_slash_segment($n, $where, 'segment'); + } + + // -------------------------------------------------------------------- + + /** + * Slash routed segment + * + * Fetches an URI routed segment with a slash. + * + * @param int $n Index + * @param string $where Where to add the slash ('trailing' or 'leading') + * @return string + */ + public function slash_rsegment($n, $where = 'trailing') + { + return $this->_slash_segment($n, $where, 'rsegment'); + } + + // -------------------------------------------------------------------- + + /** + * Internal Slash segment + * + * Fetches an URI Segment and adds a slash to it. + * + * @used-by CI_URI::slash_segment() + * @used-by CI_URI::slash_rsegment() + * + * @param int $n Index + * @param string $where Where to add the slash ('trailing' or 'leading') + * @param string $which Array name ('segment' or 'rsegment') + * @return string + */ + protected function _slash_segment($n, $where = 'trailing', $which = 'segment') + { + $leading = $trailing = '/'; + + if ($where === 'trailing') + { + $leading = ''; + } + elseif ($where === 'leading') + { + $trailing = ''; + } + + return $leading.$this->$which($n).$trailing; + } + + // -------------------------------------------------------------------- + + /** + * Segment Array + * + * @return array CI_URI::$segments + */ + public function segment_array() + { + return $this->segments; + } + + // -------------------------------------------------------------------- + + /** + * Routed Segment Array + * + * @return array CI_URI::$rsegments + */ + public function rsegment_array() + { + return $this->rsegments; + } + + // -------------------------------------------------------------------- + + /** + * Total number of segments + * + * @return int + */ + public function total_segments() + { + return count($this->segments); + } + + // -------------------------------------------------------------------- + + /** + * Total number of routed segments + * + * @return int + */ + public function total_rsegments() + { + return count($this->rsegments); + } + + // -------------------------------------------------------------------- + + /** + * Fetch URI string + * + * @return string CI_URI::$uri_string + */ + public function uri_string() + { + return $this->uri_string; + } + + // -------------------------------------------------------------------- + + /** + * Fetch Re-routed URI string + * + * @return string + */ + public function ruri_string() + { + return ltrim(load_class('Router', 'core')->directory, '/').implode('/', $this->rsegments); + } + +} diff --git a/system/core/Utf8.php b/system/core/Utf8.php new file mode 100755 index 0000000..dfbbfff --- /dev/null +++ b/system/core/Utf8.php @@ -0,0 +1,164 @@ +is_ascii($str) === FALSE) + { + if (MB_ENABLED) + { + $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8'); + } + elseif (ICONV_ENABLED) + { + $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); + } + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Remove ASCII control characters + * + * Removes all ASCII control characters except horizontal tabs, + * line feeds, and carriage returns, as all others can cause + * problems in XML. + * + * @param string $str String to clean + * @return string + */ + public function safe_ascii_for_xml($str) + { + return remove_invisible_characters($str, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Convert to UTF-8 + * + * Attempts to convert a string to UTF-8. + * + * @param string $str Input string + * @param string $encoding Input encoding + * @return string $str encoded in UTF-8 or FALSE on failure + */ + public function convert_to_utf8($str, $encoding) + { + if (MB_ENABLED) + { + return mb_convert_encoding($str, 'UTF-8', $encoding); + } + elseif (ICONV_ENABLED) + { + return @iconv($encoding, 'UTF-8', $str); + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Is ASCII? + * + * Tests if a string is standard 7-bit ASCII or not. + * + * @param string $str String to check + * @return bool + */ + public function is_ascii($str) + { + return (preg_match('/[^\x00-\x7F]/S', $str) === 0); + } + +} diff --git a/system/core/compat/hash.php b/system/core/compat/hash.php new file mode 100755 index 0000000..c65203a --- /dev/null +++ b/system/core/compat/hash.php @@ -0,0 +1,254 @@ + 32, + 'haval128,3' => 128, + 'haval160,3' => 128, + 'haval192,3' => 128, + 'haval224,3' => 128, + 'haval256,3' => 128, + 'haval128,4' => 128, + 'haval160,4' => 128, + 'haval192,4' => 128, + 'haval224,4' => 128, + 'haval256,4' => 128, + 'haval128,5' => 128, + 'haval160,5' => 128, + 'haval192,5' => 128, + 'haval224,5' => 128, + 'haval256,5' => 128, + 'md2' => 16, + 'md4' => 64, + 'md5' => 64, + 'ripemd128' => 64, + 'ripemd160' => 64, + 'ripemd256' => 64, + 'ripemd320' => 64, + 'salsa10' => 64, + 'salsa20' => 64, + 'sha1' => 64, + 'sha224' => 64, + 'sha256' => 64, + 'sha384' => 128, + 'sha512' => 128, + 'snefru' => 32, + 'snefru256' => 32, + 'tiger128,3' => 64, + 'tiger160,3' => 64, + 'tiger192,3' => 64, + 'tiger128,4' => 64, + 'tiger160,4' => 64, + 'tiger192,4' => 64, + 'whirlpool' => 64 + ); + + if (isset($block_sizes[$algo], $password[$block_sizes[$algo]])) + { + $password = hash($algo, $password, TRUE); + } + + $hash = ''; + // Note: Blocks are NOT 0-indexed + for ($bc = (int) ceil($length / $hash_length), $bi = 1; $bi <= $bc; $bi++) + { + $key = $derived_key = hash_hmac($algo, $salt.pack('N', $bi), $password, TRUE); + for ($i = 1; $i < $iterations; $i++) + { + $derived_key ^= $key = hash_hmac($algo, $key, $password, TRUE); + } + + $hash .= $derived_key; + } + + // This is not RFC-compatible, but we're aiming for natural PHP compatibility + if ( ! $raw_output) + { + $hash = bin2hex($hash); + } + + return defined('MB_OVERLOAD_STRING') + ? mb_substr($hash, 0, $length, '8bit') + : substr($hash, 0, $length); + } +} diff --git a/system/core/compat/index.html b/system/core/compat/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/core/compat/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/core/compat/mbstring.php b/system/core/compat/mbstring.php new file mode 100755 index 0000000..1b2f2c6 --- /dev/null +++ b/system/core/compat/mbstring.php @@ -0,0 +1,149 @@ + 0, 'algoName' => 'unknown', 'options' => array()) + : array('algo' => 1, 'algoName' => 'bcrypt', 'options' => array('cost' => $hash)); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('password_hash')) +{ + /** + * password_hash() + * + * @link http://php.net/password_hash + * @param string $password + * @param int $algo + * @param array $options + * @return mixed + */ + function password_hash($password, $algo, array $options = array()) + { + static $func_overload; + isset($func_overload) OR $func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); + + if ($algo !== 1) + { + trigger_error('password_hash(): Unknown hashing algorithm: '.(int) $algo, E_USER_WARNING); + return NULL; + } + + if (isset($options['cost']) && ($options['cost'] < 4 OR $options['cost'] > 31)) + { + trigger_error('password_hash(): Invalid bcrypt cost parameter specified: '.(int) $options['cost'], E_USER_WARNING); + return NULL; + } + + if (isset($options['salt']) && ($saltlen = ($func_overload ? mb_strlen($options['salt'], '8bit') : strlen($options['salt']))) < 22) + { + trigger_error('password_hash(): Provided salt is too short: '.$saltlen.' expecting 22', E_USER_WARNING); + return NULL; + } + elseif ( ! isset($options['salt'])) + { + if (function_exists('random_bytes')) + { + try + { + $options['salt'] = random_bytes(16); + } + catch (Exception $e) + { + log_message('error', 'compat/password: Error while trying to use random_bytes(): '.$e->getMessage()); + return FALSE; + } + } + elseif (defined('MCRYPT_DEV_URANDOM')) + { + $options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); + } + elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom'))) + { + if (($fp = fopen($dev, 'rb')) === FALSE) + { + log_message('error', 'compat/password: Unable to open '.$dev.' for reading.'); + return FALSE; + } + + // Try not to waste entropy ... + is_php('5.4') && stream_set_chunk_size($fp, 16); + + $options['salt'] = ''; + for ($read = 0; $read < 16; $read = ($func_overload) ? mb_strlen($options['salt'], '8bit') : strlen($options['salt'])) + { + if (($read = fread($fp, 16 - $read)) === FALSE) + { + log_message('error', 'compat/password: Error while reading from '.$dev.'.'); + return FALSE; + } + $options['salt'] .= $read; + } + + fclose($fp); + } + elseif (function_exists('openssl_random_pseudo_bytes')) + { + $is_secure = NULL; + $options['salt'] = openssl_random_pseudo_bytes(16, $is_secure); + if ($is_secure !== TRUE) + { + log_message('error', 'compat/password: openssl_random_pseudo_bytes() set the $cryto_strong flag to FALSE'); + return FALSE; + } + } + else + { + log_message('error', 'compat/password: No CSPRNG available.'); + return FALSE; + } + + $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); + } + elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt'])) + { + $options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '=')); + } + + isset($options['cost']) OR $options['cost'] = 10; + + return (strlen($password = crypt($password, sprintf('$2y$%02d$%s', $options['cost'], $options['salt']))) === 60) + ? $password + : FALSE; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('password_needs_rehash')) +{ + /** + * password_needs_rehash() + * + * @link http://php.net/password_needs_rehash + * @param string $hash + * @param int $algo + * @param array $options + * @return bool + */ + function password_needs_rehash($hash, $algo, array $options = array()) + { + $info = password_get_info($hash); + + if ($algo !== $info['algo']) + { + return TRUE; + } + elseif ($algo === 1) + { + $options['cost'] = isset($options['cost']) ? (int) $options['cost'] : 10; + return ($info['options']['cost'] !== $options['cost']); + } + + // Odd at first glance, but according to a comment in PHP's own unit tests, + // because it is an unknown algorithm - it's valid and therefore doesn't + // need rehashing. + return FALSE; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('password_verify')) +{ + /** + * password_verify() + * + * @link http://php.net/password_verify + * @param string $password + * @param string $hash + * @return bool + */ + function password_verify($password, $hash) + { + if (strlen($hash) !== 60 OR strlen($password = crypt($password, $hash)) !== 60) + { + return FALSE; + } + + $compare = 0; + for ($i = 0; $i < 60; $i++) + { + $compare |= (ord($password[$i]) ^ ord($hash[$i])); + } + + return ($compare === 0); + } +} diff --git a/system/core/compat/standard.php b/system/core/compat/standard.php new file mode 100755 index 0000000..7db2efb --- /dev/null +++ b/system/core/compat/standard.php @@ -0,0 +1,182 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/DB.php b/system/database/DB.php new file mode 100755 index 0000000..c19eef7 --- /dev/null +++ b/system/database/DB.php @@ -0,0 +1,218 @@ +load->get_package_paths() as $path) + { + if ($path !== APPPATH) + { + if (file_exists($file_path = $path.'config/'.ENVIRONMENT.'/database.php')) + { + include($file_path); + } + elseif (file_exists($file_path = $path.'config/database.php')) + { + include($file_path); + } + } + } + } + + if ( ! isset($db) OR count($db) === 0) + { + show_error('No database connection settings were found in the database config file.'); + } + + if ($params !== '') + { + $active_group = $params; + } + + if ( ! isset($active_group)) + { + show_error('You have not specified a database connection group via $active_group in your config/database.php file.'); + } + elseif ( ! isset($db[$active_group])) + { + show_error('You have specified an invalid database connection group ('.$active_group.') in your config/database.php file.'); + } + + $params = $db[$active_group]; + } + elseif (is_string($params)) + { + /** + * Parse the URL from the DSN string + * Database settings can be passed as discreet + * parameters or as a data source name in the first + * parameter. DSNs must have this prototype: + * $dsn = 'driver://username:password@hostname/database'; + */ + if (($dsn = @parse_url($params)) === FALSE) + { + show_error('Invalid DB Connection String'); + } + + $params = array( + 'dbdriver' => $dsn['scheme'], + 'hostname' => isset($dsn['host']) ? rawurldecode($dsn['host']) : '', + 'port' => isset($dsn['port']) ? rawurldecode($dsn['port']) : '', + 'username' => isset($dsn['user']) ? rawurldecode($dsn['user']) : '', + 'password' => isset($dsn['pass']) ? rawurldecode($dsn['pass']) : '', + 'database' => isset($dsn['path']) ? rawurldecode(substr($dsn['path'], 1)) : '' + ); + + // Were additional config items set? + if (isset($dsn['query'])) + { + parse_str($dsn['query'], $extra); + + foreach ($extra as $key => $val) + { + if (is_string($val) && in_array(strtoupper($val), array('TRUE', 'FALSE', 'NULL'))) + { + $val = var_export($val, TRUE); + } + + $params[$key] = $val; + } + } + } + + // No DB specified yet? Beat them senseless... + if (empty($params['dbdriver'])) + { + show_error('You have not selected a database type to connect to.'); + } + + // Load the DB classes. Note: Since the query builder class is optional + // we need to dynamically create a class that extends proper parent class + // based on whether we're using the query builder class or not. + if ($query_builder_override !== NULL) + { + $query_builder = $query_builder_override; + } + // Backwards compatibility work-around for keeping the + // $active_record config variable working. Should be + // removed in v3.1 + elseif ( ! isset($query_builder) && isset($active_record)) + { + $query_builder = $active_record; + } + + require_once(BASEPATH.'database/DB_driver.php'); + + if ( ! isset($query_builder) OR $query_builder === TRUE) + { + require_once(BASEPATH.'database/DB_query_builder.php'); + if ( ! class_exists('CI_DB', FALSE)) + { + /** + * CI_DB + * + * Acts as an alias for both CI_DB_driver and CI_DB_query_builder. + * + * @see CI_DB_query_builder + * @see CI_DB_driver + */ + class CI_DB extends CI_DB_query_builder { } + } + } + elseif ( ! class_exists('CI_DB', FALSE)) + { + /** + * @ignore + */ + class CI_DB extends CI_DB_driver { } + } + + // Load the DB driver + $driver_file = BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'; + + file_exists($driver_file) OR show_error('Invalid DB driver'); + require_once($driver_file); + + // Instantiate the DB adapter + $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; + $DB = new $driver($params); + + // Check for a subdriver + if ( ! empty($DB->subdriver)) + { + $driver_file = BASEPATH.'database/drivers/'.$DB->dbdriver.'/subdrivers/'.$DB->dbdriver.'_'.$DB->subdriver.'_driver.php'; + + if (file_exists($driver_file)) + { + require_once($driver_file); + $driver = 'CI_DB_'.$DB->dbdriver.'_'.$DB->subdriver.'_driver'; + $DB = new $driver($params); + } + } + + $DB->initialize(); + return $DB; +} diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php new file mode 100755 index 0000000..7c8ee5f --- /dev/null +++ b/system/database/DB_cache.php @@ -0,0 +1,221 @@ +CI and load the file helper since we use it a lot + $this->CI =& get_instance(); + $this->db =& $db; + $this->CI->load->helper('file'); + + $this->check_path(); + } + + // -------------------------------------------------------------------- + + /** + * Set Cache Directory Path + * + * @param string $path Path to the cache directory + * @return bool + */ + public function check_path($path = '') + { + if ($path === '') + { + if ($this->db->cachedir === '') + { + return $this->db->cache_off(); + } + + $path = $this->db->cachedir; + } + + // Add a trailing slash to the path if needed + $path = realpath($path) + ? rtrim(realpath($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR + : rtrim($path, '/').'/'; + + if ( ! is_dir($path)) + { + log_message('debug', 'DB cache path error: '.$path); + + // If the path is wrong we'll turn off caching + return $this->db->cache_off(); + } + + if ( ! is_really_writable($path)) + { + log_message('debug', 'DB cache dir not writable: '.$path); + + // If the path is not really writable we'll turn off caching + return $this->db->cache_off(); + } + + $this->db->cachedir = $path; + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Retrieve a cached query + * + * The URI being requested will become the name of the cache sub-folder. + * An MD5 hash of the SQL statement will become the cache file name. + * + * @param string $sql + * @return string + */ + public function read($sql) + { + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); + + if ( ! is_file($filepath) OR FALSE === ($cachedata = file_get_contents($filepath))) + { + return FALSE; + } + + return unserialize($cachedata); + } + + // -------------------------------------------------------------------- + + /** + * Write a query to a cache file + * + * @param string $sql + * @param object $object + * @return bool + */ + public function write($sql, $object) + { + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; + $filename = md5($sql); + + if ( ! is_dir($dir_path) && ! @mkdir($dir_path, 0750)) + { + return FALSE; + } + + if (write_file($dir_path.$filename, serialize($object)) === FALSE) + { + return FALSE; + } + + chmod($dir_path.$filename, 0640); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Delete cache files within a particular directory + * + * @param string $segment_one + * @param string $segment_two + * @return void + */ + public function delete($segment_one = '', $segment_two = '') + { + if ($segment_one === '') + { + $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + } + + if ($segment_two === '') + { + $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + } + + $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; + delete_files($dir_path, TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Delete all existing cache files + * + * @return void + */ + public function delete_all() + { + delete_files($this->db->cachedir, TRUE, TRUE); + } + +} diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php new file mode 100755 index 0000000..0b13a2f --- /dev/null +++ b/system/database/DB_driver.php @@ -0,0 +1,1987 @@ + $val) + { + $this->$key = $val; + } + } + + log_message('info', 'Database Driver Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Initialize Database Settings + * + * @return bool + */ + public function initialize() + { + /* If an established connection is available, then there's + * no need to connect and select the database. + * + * Depending on the database driver, conn_id can be either + * boolean TRUE, a resource or an object. + */ + if ($this->conn_id) + { + return TRUE; + } + + // ---------------------------------------------------------------- + + // Connect to the database and set the connection ID + $this->conn_id = $this->db_connect($this->pconnect); + + // No connection resource? Check if there is a failover else throw an error + if ( ! $this->conn_id) + { + // Check if there is a failover set + if ( ! empty($this->failover) && is_array($this->failover)) + { + // Go over all the failovers + foreach ($this->failover as $failover) + { + // Replace the current settings with those of the failover + foreach ($failover as $key => $val) + { + $this->$key = $val; + } + + // Try to connect + $this->conn_id = $this->db_connect($this->pconnect); + + // If a connection is made break the foreach loop + if ($this->conn_id) + { + break; + } + } + } + + // We still don't have a connection? + if ( ! $this->conn_id) + { + log_message('error', 'Unable to connect to the database'); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_connect'); + } + + return FALSE; + } + } + + // Now we set the character set and that's all + return $this->db_set_charset($this->char_set); + } + + // -------------------------------------------------------------------- + + /** + * DB connect + * + * This is just a dummy method that all drivers will override. + * + * @return mixed + */ + public function db_connect() + { + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Persistent database connection + * + * @return mixed + */ + public function db_pconnect() + { + return $this->db_connect(TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout. + * + * This is just a dummy method to allow drivers without such + * functionality to not declare it, while others will override it. + * + * @return void + */ + public function reconnect() + { + } + + // -------------------------------------------------------------------- + + /** + * Select database + * + * This is just a dummy method to allow drivers without such + * functionality to not declare it, while others will override it. + * + * @return bool + */ + public function db_select() + { + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Last error + * + * @return array + */ + public function error() + { + return array('code' => NULL, 'message' => NULL); + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @param string + * @return bool + */ + public function db_set_charset($charset) + { + if (method_exists($this, '_db_set_charset') && ! $this->_db_set_charset($charset)) + { + log_message('error', 'Unable to set database connection charset: '.$charset); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_set_charset', $charset); + } + + return FALSE; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * The name of the platform in use (mysql, mssql, etc...) + * + * @return string + */ + public function platform() + { + return $this->dbdriver; + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * Returns a string containing the version of the database being used. + * Most drivers will override this method. + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if (FALSE === ($sql = $this->_version())) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; + } + + $query = $this->query($sql)->row(); + return $this->data_cache['version'] = $query->ver; + } + + // -------------------------------------------------------------------- + + /** + * Version number query string + * + * @return string + */ + protected function _version() + { + return 'SELECT VERSION() AS ver'; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * Accepts an SQL string as input and returns a result object upon + * successful execution of a "read" type query. Returns boolean TRUE + * upon successful execution of a "write" type query. Returns boolean + * FALSE upon failure, and if the $db_debug variable is set to TRUE + * will raise an error. + * + * @param string $sql + * @param array $binds = FALSE An array of binding data + * @param bool $return_object = NULL + * @return mixed + */ + public function query($sql, $binds = FALSE, $return_object = NULL) + { + if ($sql === '') + { + log_message('error', 'Invalid query: '.$sql); + return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; + } + elseif ( ! is_bool($return_object)) + { + $return_object = ! $this->is_write_type($sql); + } + + // Verify table prefix and replace if necessary + if ($this->dbprefix !== '' && $this->swap_pre !== '' && $this->dbprefix !== $this->swap_pre) + { + $sql = preg_replace('/(\W)'.$this->swap_pre.'(\S+?)/', '\\1'.$this->dbprefix.'\\2', $sql); + } + + // Compile binds if needed + if ($binds !== FALSE) + { + $sql = $this->compile_binds($sql, $binds); + } + + // Is query caching enabled? If the query is a "read type" + // we will load the caching class and return the previously + // cached query if it exists + if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init()) + { + $this->load_rdriver(); + if (FALSE !== ($cache = $this->CACHE->read($sql))) + { + return $cache; + } + } + + // Save the query for debugging + if ($this->save_queries === TRUE) + { + $this->queries[] = $sql; + } + + // Start the Query Timer + $time_start = microtime(TRUE); + + // Run the Query + if (FALSE === ($this->result_id = $this->simple_query($sql))) + { + if ($this->save_queries === TRUE) + { + $this->query_times[] = 0; + } + + // This will trigger a rollback if transactions are being used + if ($this->_trans_depth !== 0) + { + $this->_trans_status = FALSE; + } + + // Grab the error now, as we might run some additional queries before displaying the error + $error = $this->error(); + + // Log errors + log_message('error', 'Query error: '.$error['message'].' - Invalid query: '.$sql); + + if ($this->db_debug) + { + // We call this function in order to roll-back queries + // if transactions are enabled. If we don't call this here + // the error message will trigger an exit, causing the + // transactions to remain in limbo. + while ($this->_trans_depth !== 0) + { + $trans_depth = $this->_trans_depth; + $this->trans_complete(); + if ($trans_depth === $this->_trans_depth) + { + log_message('error', 'Database: Failure during an automated transaction commit/rollback!'); + break; + } + } + + // Display errors + return $this->display_error(array('Error Number: '.$error['code'], $error['message'], $sql)); + } + + return FALSE; + } + + // Stop and aggregate the query time results + $time_end = microtime(TRUE); + $this->benchmark += $time_end - $time_start; + + if ($this->save_queries === TRUE) + { + $this->query_times[] = $time_end - $time_start; + } + + // Increment the query counter + $this->query_count++; + + // Will we have a result object instantiated? If not - we'll simply return TRUE + if ($return_object !== TRUE) + { + // If caching is enabled we'll auto-cleanup any existing files related to this particular URI + if ($this->cache_on === TRUE && $this->cache_autodel === TRUE && $this->_cache_init()) + { + $this->CACHE->delete(); + } + + return TRUE; + } + + // Load and instantiate the result driver + $driver = $this->load_rdriver(); + $RES = new $driver($this); + + // Is query caching enabled? If so, we'll serialize the + // result object and save it to a cache file. + if ($this->cache_on === TRUE && $this->_cache_init()) + { + // We'll create a new instance of the result object + // only without the platform specific driver since + // we can't use it with cached data (the query result + // resource ID won't be any good once we've cached the + // result object, so we'll have to compile the data + // and save it) + $CR = new CI_DB_result($this); + $CR->result_object = $RES->result_object(); + $CR->result_array = $RES->result_array(); + $CR->num_rows = $RES->num_rows(); + + // Reset these since cached objects can not utilize resource IDs. + $CR->conn_id = NULL; + $CR->result_id = NULL; + + $this->CACHE->write($sql, $CR); + } + + return $RES; + } + + // -------------------------------------------------------------------- + + /** + * Load the result drivers + * + * @return string the name of the result class + */ + public function load_rdriver() + { + $driver = 'CI_DB_'.$this->dbdriver.'_result'; + + if ( ! class_exists($driver, FALSE)) + { + require_once(BASEPATH.'database/DB_result.php'); + require_once(BASEPATH.'database/drivers/'.$this->dbdriver.'/'.$this->dbdriver.'_result.php'); + } + + return $driver; + } + + // -------------------------------------------------------------------- + + /** + * Simple Query + * This is a simplified version of the query() function. Internally + * we only use it when running transaction commands since they do + * not require all the features of the main query() function. + * + * @param string the sql query + * @return mixed + */ + public function simple_query($sql) + { + if ( ! $this->conn_id) + { + if ( ! $this->initialize()) + { + return FALSE; + } + } + + return $this->_execute($sql); + } + + // -------------------------------------------------------------------- + + /** + * Disable Transactions + * This permits transactions to be disabled at run-time. + * + * @return void + */ + public function trans_off() + { + $this->trans_enabled = FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Enable/disable Transaction Strict Mode + * + * When strict mode is enabled, if you are running multiple groups of + * transactions, if one group fails all subsequent groups will be + * rolled back. + * + * If strict mode is disabled, each group is treated autonomously, + * meaning a failure of one group will not affect any others + * + * @param bool $mode = TRUE + * @return void + */ + public function trans_strict($mode = TRUE) + { + $this->trans_strict = is_bool($mode) ? $mode : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Start Transaction + * + * @param bool $test_mode = FALSE + * @return bool + */ + public function trans_start($test_mode = FALSE) + { + if ( ! $this->trans_enabled) + { + return FALSE; + } + + return $this->trans_begin($test_mode); + } + + // -------------------------------------------------------------------- + + /** + * Complete Transaction + * + * @return bool + */ + public function trans_complete() + { + if ( ! $this->trans_enabled) + { + return FALSE; + } + + // The query() function will set this flag to FALSE in the event that a query failed + if ($this->_trans_status === FALSE OR $this->_trans_failure === TRUE) + { + $this->trans_rollback(); + + // If we are NOT running in strict mode, we will reset + // the _trans_status flag so that subsequent groups of + // transactions will be permitted. + if ($this->trans_strict === FALSE) + { + $this->_trans_status = TRUE; + } + + log_message('debug', 'DB Transaction Failure'); + return FALSE; + } + + return $this->trans_commit(); + } + + // -------------------------------------------------------------------- + + /** + * Lets you retrieve the transaction flag to determine if it has failed + * + * @return bool + */ + public function trans_status() + { + return $this->_trans_status; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @param bool $test_mode + * @return bool + */ + public function trans_begin($test_mode = FALSE) + { + if ( ! $this->trans_enabled) + { + return FALSE; + } + // When transactions are nested we only begin/commit/rollback the outermost ones + elseif ($this->_trans_depth > 0) + { + $this->_trans_depth++; + return TRUE; + } + + // Reset the transaction failure flag. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. + $this->_trans_failure = ($test_mode === TRUE); + + if ($this->_trans_begin()) + { + $this->_trans_status = TRUE; + $this->_trans_depth++; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + public function trans_commit() + { + if ( ! $this->trans_enabled OR $this->_trans_depth === 0) + { + return FALSE; + } + // When transactions are nested we only begin/commit/rollback the outermost ones + elseif ($this->_trans_depth > 1 OR $this->_trans_commit()) + { + $this->_trans_depth--; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + public function trans_rollback() + { + if ( ! $this->trans_enabled OR $this->_trans_depth === 0) + { + return FALSE; + } + // When transactions are nested we only begin/commit/rollback the outermost ones + elseif ($this->_trans_depth > 1 OR $this->_trans_rollback()) + { + $this->_trans_depth--; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Compile Bindings + * + * @param string the sql statement + * @param array an array of bind data + * @return string + */ + public function compile_binds($sql, $binds) + { + if (empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE) + { + return $sql; + } + elseif ( ! is_array($binds)) + { + $binds = array($binds); + $bind_count = 1; + } + else + { + // Make sure we're using numeric keys + $binds = array_values($binds); + $bind_count = count($binds); + } + + // We'll need the marker length later + $ml = strlen($this->bind_marker); + + // Make sure not to replace a chunk inside a string that happens to match the bind marker + if ($c = preg_match_all("/'[^']*'|\"[^\"]*\"/i", $sql, $matches)) + { + $c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', + str_replace($matches[0], + str_replace($this->bind_marker, str_repeat(' ', $ml), $matches[0]), + $sql, $c), + $matches, PREG_OFFSET_CAPTURE); + + // Bind values' count must match the count of markers in the query + if ($bind_count !== $c) + { + return $sql; + } + } + elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) + { + return $sql; + } + + do + { + $c--; + $escaped_value = $this->escape($binds[$c]); + if (is_array($escaped_value)) + { + $escaped_value = '('.implode(',', $escaped_value).')'; + } + $sql = substr_replace($sql, $escaped_value, $matches[0][$c][1], $ml); + } + while ($c !== 0); + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Determines if a query is a "write" type. + * + * @param string An SQL query string + * @return bool + */ + public function is_write_type($sql) + { + return (bool) preg_match('/^\s*"?(SET|INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|TRUNCATE|LOAD|COPY|ALTER|RENAME|GRANT|REVOKE|LOCK|UNLOCK|REINDEX|MERGE)\s/i', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Calculate the aggregate query elapsed time + * + * @param int The number of decimal places + * @return string + */ + public function elapsed_time($decimals = 6) + { + return number_format($this->benchmark, $decimals); + } + + // -------------------------------------------------------------------- + + /** + * Returns the total number of queries + * + * @return int + */ + public function total_queries() + { + return $this->query_count; + } + + // -------------------------------------------------------------------- + + /** + * Returns the last query that was executed + * + * @return string + */ + public function last_query() + { + return end($this->queries); + } + + // -------------------------------------------------------------------- + + /** + * "Smart" Escape String + * + * Escapes data based on type + * Sets boolean and null types + * + * @param string + * @return mixed + */ + public function escape($str) + { + if (is_array($str)) + { + $str = array_map(array(&$this, 'escape'), $str); + return $str; + } + elseif (is_string($str) OR (is_object($str) && method_exists($str, '__toString'))) + { + return "'".$this->escape_str($str)."'"; + } + elseif (is_bool($str)) + { + return ($str === FALSE) ? 0 : 1; + } + elseif ($str === NULL) + { + return 'NULL'; + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Escape String + * + * @param string|string[] $str Input string + * @param bool $like Whether or not the string will be used in a LIKE condition + * @return string + */ + public function escape_str($str, $like = FALSE) + { + if (is_array($str)) + { + foreach ($str as $key => $val) + { + $str[$key] = $this->escape_str($val, $like); + } + + return $str; + } + + $str = $this->_escape_str($str); + + // escape LIKE condition wildcards + if ($like === TRUE) + { + return str_replace( + array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str + ); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Escape LIKE String + * + * Calls the individual driver for platform + * specific escaping for LIKE conditions + * + * @param string|string[] + * @return mixed + */ + public function escape_like_str($str) + { + return $this->escape_str($str, TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return str_replace("'", "''", remove_invisible_characters($str, FALSE)); + } + + // -------------------------------------------------------------------- + + /** + * Primary + * + * Retrieves the primary key. It assumes that the row in the first + * position is the primary key + * + * @param string $table Table name + * @return string + */ + public function primary($table) + { + $fields = $this->list_fields($table); + return is_array($fields) ? current($fields) : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * "Count All" query + * + * Generates a platform-specific query string that counts all records in + * the specified database + * + * @param string + * @return int + */ + public function count_all($table = '') + { + if ($table === '') + { + return 0; + } + + $query = $this->query($this->_count_string.$this->escape_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); + if ($query->num_rows() === 0) + { + return 0; + } + + $query = $query->row(); + $this->_reset_select(); + return (int) $query->numrows; + } + + // -------------------------------------------------------------------- + + /** + * Returns an array of table names + * + * @param string $constrain_by_prefix = FALSE + * @return array + */ + public function list_tables($constrain_by_prefix = FALSE) + { + // Is there a cached result? + if (isset($this->data_cache['table_names'])) + { + return $this->data_cache['table_names']; + } + + if (FALSE === ($sql = $this->_list_tables($constrain_by_prefix))) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; + } + + $this->data_cache['table_names'] = array(); + $query = $this->query($sql); + + foreach ($query->result_array() as $row) + { + // Do we know from which column to get the table name? + if ( ! isset($key)) + { + if (isset($row['table_name'])) + { + $key = 'table_name'; + } + elseif (isset($row['TABLE_NAME'])) + { + $key = 'TABLE_NAME'; + } + else + { + /* We have no other choice but to just get the first element's key. + * Due to array_shift() accepting its argument by reference, if + * E_STRICT is on, this would trigger a warning. So we'll have to + * assign it first. + */ + $key = array_keys($row); + $key = array_shift($key); + } + } + + $this->data_cache['table_names'][] = $row[$key]; + } + + return $this->data_cache['table_names']; + } + + // -------------------------------------------------------------------- + + /** + * Determine if a particular table exists + * + * @param string $table_name + * @return bool + */ + public function table_exists($table_name) + { + return in_array($this->protect_identifiers($table_name, TRUE, FALSE, FALSE), $this->list_tables()); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * @param string $table Table name + * @return array + */ + public function list_fields($table) + { + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (FALSE === ($sql = $this->_list_columns($table))) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; + } + + $query = $this->query($sql); + $this->data_cache['field_names'][$table] = array(); + + foreach ($query->result_array() as $row) + { + // Do we know from where to get the column's name? + if ( ! isset($key)) + { + if (isset($row['column_name'])) + { + $key = 'column_name'; + } + elseif (isset($row['COLUMN_NAME'])) + { + $key = 'COLUMN_NAME'; + } + else + { + // We have no other choice but to just get the first element's key. + $key = key($row); + } + } + + $this->data_cache['field_names'][$table][] = $row[$key]; + } + + return $this->data_cache['field_names'][$table]; + } + + // -------------------------------------------------------------------- + + /** + * Determine if a particular field exists + * + * @param string + * @param string + * @return bool + */ + public function field_exists($field_name, $table_name) + { + return in_array($field_name, $this->list_fields($table_name)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table the table name + * @return array + */ + public function field_data($table) + { + $query = $this->query($this->_field_data($this->protect_identifiers($table, TRUE, NULL, FALSE))); + return ($query) ? $query->field_data() : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Escape the SQL Identifiers + * + * This function escapes column and table names + * + * @param mixed + * @return mixed + */ + public function escape_identifiers($item) + { + if ($this->_escape_char === '' OR empty($item) OR in_array($item, $this->_reserved_identifiers)) + { + return $item; + } + elseif (is_array($item)) + { + foreach ($item as $key => $value) + { + $item[$key] = $this->escape_identifiers($value); + } + + return $item; + } + // Avoid breaking functions and literal values inside queries + elseif (ctype_digit($item) OR $item[0] === "'" OR ($this->_escape_char !== '"' && $item[0] === '"') OR strpos($item, '(') !== FALSE) + { + return $item; + } + + static $preg_ec = array(); + + if (empty($preg_ec)) + { + if (is_array($this->_escape_char)) + { + $preg_ec = array( + preg_quote($this->_escape_char[0], '/'), + preg_quote($this->_escape_char[1], '/'), + $this->_escape_char[0], + $this->_escape_char[1] + ); + } + else + { + $preg_ec[0] = $preg_ec[1] = preg_quote($this->_escape_char, '/'); + $preg_ec[2] = $preg_ec[3] = $this->_escape_char; + } + } + + foreach ($this->_reserved_identifiers as $id) + { + if (strpos($item, '.'.$id) !== FALSE) + { + return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?\./i', $preg_ec[2].'$1'.$preg_ec[3].'.', $item); + } + } + + return preg_replace('/'.$preg_ec[0].'?([^'.$preg_ec[1].'\.]+)'.$preg_ec[1].'?(\.)?/i', $preg_ec[2].'$1'.$preg_ec[3].'$2', $item); + } + + // -------------------------------------------------------------------- + + /** + * Generate an insert string + * + * @param string the table upon which the query will be performed + * @param array an associative array data of key/values + * @return string + */ + public function insert_string($table, $data) + { + $fields = $values = array(); + + foreach ($data as $key => $val) + { + $fields[] = $this->escape_identifiers($key); + $values[] = $this->escape($val); + } + + return $this->_insert($this->protect_identifiers($table, TRUE, NULL, FALSE), $fields, $values); + } + + // -------------------------------------------------------------------- + + /** + * Insert statement + * + * Generates a platform-specific insert string from the supplied data + * + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + protected function _insert($table, $keys, $values) + { + return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; + } + + // -------------------------------------------------------------------- + + /** + * Generate an update string + * + * @param string the table upon which the query will be performed + * @param array an associative array data of key/values + * @param mixed the "where" statement + * @return string + */ + public function update_string($table, $data, $where) + { + if (empty($where)) + { + return FALSE; + } + + $this->where($where); + + $fields = array(); + foreach ($data as $key => $val) + { + $fields[$this->protect_identifiers($key)] = $this->escape($val); + } + + $sql = $this->_update($this->protect_identifiers($table, TRUE, NULL, FALSE), $fields); + $this->_reset_write(); + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string the table name + * @param array the update data + * @return string + */ + protected function _update($table, $values) + { + foreach ($values as $key => $val) + { + $valstr[] = $key.' = '.$val; + } + + return 'UPDATE '.$table.' SET '.implode(', ', $valstr) + .$this->_compile_wh('qb_where') + .$this->_compile_order_by() + .($this->qb_limit ? ' LIMIT '.$this->qb_limit : ''); + } + + // -------------------------------------------------------------------- + + /** + * Tests whether the string has an SQL operator + * + * @param string + * @return bool + */ + protected function _has_operator($str) + { + return (bool) preg_match('/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i', trim($str)); + } + + // -------------------------------------------------------------------- + + /** + * Returns the SQL string operator + * + * @param string + * @return string + */ + protected function _get_operator($str) + { + static $_operators; + + if (empty($_operators)) + { + $_les = ($this->_like_escape_str !== '') + ? '\s+'.preg_quote(trim(sprintf($this->_like_escape_str, $this->_like_escape_chr)), '/') + : ''; + $_operators = array( + '\s*(?:<|>|!)?=\s*', // =, <=, >=, != + '\s*<>?\s*', // <, <> + '\s*>\s*', // > + '\s+IS NULL', // IS NULL + '\s+IS NOT NULL', // IS NOT NULL + '\s+EXISTS\s*\(.*\)', // EXISTS(sql) + '\s+NOT EXISTS\s*\(.*\)', // NOT EXISTS(sql) + '\s+BETWEEN\s+', // BETWEEN value AND value + '\s+IN\s*\(.*\)', // IN(list) + '\s+NOT IN\s*\(.*\)', // NOT IN (list) + '\s+LIKE\s+\S.*('.$_les.')?', // LIKE 'expr'[ ESCAPE '%s'] + '\s+NOT LIKE\s+\S.*('.$_les.')?' // NOT LIKE 'expr'[ ESCAPE '%s'] + ); + + } + + return preg_match('/'.implode('|', $_operators).'/i', $str, $match) + ? $match[0] : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Enables a native PHP function to be run, using a platform agnostic wrapper. + * + * @param string $function Function name + * @return mixed + */ + public function call_function($function) + { + $driver = ($this->dbdriver === 'postgre') ? 'pg_' : $this->dbdriver.'_'; + + if (FALSE === strpos($driver, $function)) + { + $function = $driver.$function; + } + + if ( ! function_exists($function)) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; + } + + return (func_num_args() > 1) + ? call_user_func_array($function, array_slice(func_get_args(), 1)) + : call_user_func($function); + } + + // -------------------------------------------------------------------- + + /** + * Set Cache Directory Path + * + * @param string the path to the cache directory + * @return void + */ + public function cache_set_path($path = '') + { + $this->cachedir = $path; + } + + // -------------------------------------------------------------------- + + /** + * Enable Query Caching + * + * @return bool cache_on value + */ + public function cache_on() + { + return $this->cache_on = TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Disable Query Caching + * + * @return bool cache_on value + */ + public function cache_off() + { + return $this->cache_on = FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Delete the cache files associated with a particular URI + * + * @param string $segment_one = '' + * @param string $segment_two = '' + * @return bool + */ + public function cache_delete($segment_one = '', $segment_two = '') + { + return $this->_cache_init() + ? $this->CACHE->delete($segment_one, $segment_two) + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Delete All cache files + * + * @return bool + */ + public function cache_delete_all() + { + return $this->_cache_init() + ? $this->CACHE->delete_all() + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Initialize the Cache Class + * + * @return bool + */ + protected function _cache_init() + { + if ( ! class_exists('CI_DB_Cache', FALSE)) + { + require_once(BASEPATH.'database/DB_cache.php'); + } + elseif (is_object($this->CACHE)) + { + return TRUE; + } + + $this->CACHE = new CI_DB_Cache($this); // pass db object to support multiple db connections and returned db objects + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + public function close() + { + if ($this->conn_id) + { + $this->_close(); + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * This method would be overridden by most of the drivers. + * + * @return void + */ + protected function _close() + { + $this->conn_id = FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Display an error message + * + * @param string the error message + * @param string any "swap" values + * @param bool whether to localize the message + * @return string sends the application/views/errors/error_db.php template + */ + public function display_error($error = '', $swap = '', $native = FALSE) + { + $LANG =& load_class('Lang', 'core'); + $LANG->load('db'); + + $heading = $LANG->line('db_error_heading'); + + if ($native === TRUE) + { + $message = (array) $error; + } + else + { + $message = is_array($error) ? $error : array(str_replace('%s', $swap, $LANG->line($error))); + } + + // Find the most likely culprit of the error by going through + // the backtrace until the source file is no longer in the + // database folder. + $trace = debug_backtrace(); + foreach ($trace as $call) + { + if (isset($call['file'], $call['class'])) + { + // We'll need this on Windows, as APPPATH and BASEPATH will always use forward slashes + if (DIRECTORY_SEPARATOR !== '/') + { + $call['file'] = str_replace('\\', '/', $call['file']); + } + + if (strpos($call['file'], BASEPATH.'database') === FALSE && strpos($call['class'], 'Loader') === FALSE) + { + // Found it - use a relative path for safety + $message[] = 'Filename: '.str_replace(array(APPPATH, BASEPATH), '', $call['file']); + $message[] = 'Line Number: '.$call['line']; + break; + } + } + } + + $error =& load_class('Exceptions', 'core'); + echo $error->show_error($heading, $message, 'error_db'); + exit(8); // EXIT_DATABASE + } + + // -------------------------------------------------------------------- + + /** + * Protect Identifiers + * + * This function is used extensively by the Query Builder class, and by + * a couple functions in this class. + * It takes a column or table name (optionally with an alias) and inserts + * the table prefix onto it. Some logic is necessary in order to deal with + * column names that include the path. Consider a query like this: + * + * SELECT hostname.database.table.column AS c FROM hostname.database.table + * + * Or a query with aliasing: + * + * SELECT m.member_id, m.member_name FROM members AS m + * + * Since the column name can include up to four segments (host, DB, table, column) + * or also have an alias prefix, we need to do a bit of work to figure this out and + * insert the table prefix (if it exists) in the proper position, and escape only + * the correct identifiers. + * + * @param string + * @param bool + * @param mixed + * @param bool + * @return string + */ + public function protect_identifiers($item, $prefix_single = FALSE, $protect_identifiers = NULL, $field_exists = TRUE) + { + if ( ! is_bool($protect_identifiers)) + { + $protect_identifiers = $this->_protect_identifiers; + } + + if (is_array($item)) + { + $escaped_array = array(); + foreach ($item as $k => $v) + { + $escaped_array[$this->protect_identifiers($k)] = $this->protect_identifiers($v, $prefix_single, $protect_identifiers, $field_exists); + } + + return $escaped_array; + } + + // This is basically a bug fix for queries that use MAX, MIN, etc. + // If a parenthesis is found we know that we do not need to + // escape the data or add a prefix. There's probably a more graceful + // way to deal with this, but I'm not thinking of it -- Rick + // + // Added exception for single quotes as well, we don't want to alter + // literal strings. -- Narf + if (strcspn($item, "()'") !== strlen($item)) + { + return $item; + } + + // Convert tabs or multiple spaces into single spaces + $item = preg_replace('/\s+/', ' ', trim($item)); + + // If the item has an alias declaration we remove it and set it aside. + // Note: strripos() is used in order to support spaces in table names + if ($offset = strripos($item, ' AS ')) + { + $alias = ($protect_identifiers) + ? substr($item, $offset, 4).$this->escape_identifiers(substr($item, $offset + 4)) + : substr($item, $offset); + $item = substr($item, 0, $offset); + } + elseif ($offset = strrpos($item, ' ')) + { + $alias = ($protect_identifiers) + ? ' '.$this->escape_identifiers(substr($item, $offset + 1)) + : substr($item, $offset); + $item = substr($item, 0, $offset); + } + else + { + $alias = ''; + } + + // Break the string apart if it contains periods, then insert the table prefix + // in the correct location, assuming the period doesn't indicate that we're dealing + // with an alias. While we're at it, we will escape the components + if (strpos($item, '.') !== FALSE) + { + $parts = explode('.', $item); + + // Does the first segment of the exploded item match + // one of the aliases previously identified? If so, + // we have nothing more to do other than escape the item + // + // NOTE: The ! empty() condition prevents this method + // from breaking when QB isn't enabled. + if ( ! empty($this->qb_aliased_tables) && in_array($parts[0], $this->qb_aliased_tables)) + { + if ($protect_identifiers === TRUE) + { + foreach ($parts as $key => $val) + { + if ( ! in_array($val, $this->_reserved_identifiers)) + { + $parts[$key] = $this->escape_identifiers($val); + } + } + + $item = implode('.', $parts); + } + + return $item.$alias; + } + + // Is there a table prefix defined in the config file? If not, no need to do anything + if ($this->dbprefix !== '') + { + // We now add the table prefix based on some logic. + // Do we have 4 segments (hostname.database.table.column)? + // If so, we add the table prefix to the column name in the 3rd segment. + if (isset($parts[3])) + { + $i = 2; + } + // Do we have 3 segments (database.table.column)? + // If so, we add the table prefix to the column name in 2nd position + elseif (isset($parts[2])) + { + $i = 1; + } + // Do we have 2 segments (table.column)? + // If so, we add the table prefix to the column name in 1st segment + else + { + $i = 0; + } + + // This flag is set when the supplied $item does not contain a field name. + // This can happen when this function is being called from a JOIN. + if ($field_exists === FALSE) + { + $i++; + } + + // Verify table prefix and replace if necessary + if ($this->swap_pre !== '' && strpos($parts[$i], $this->swap_pre) === 0) + { + $parts[$i] = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $parts[$i]); + } + // We only add the table prefix if it does not already exist + elseif (strpos($parts[$i], $this->dbprefix) !== 0) + { + $parts[$i] = $this->dbprefix.$parts[$i]; + } + + // Put the parts back together + $item = implode('.', $parts); + } + + if ($protect_identifiers === TRUE) + { + $item = $this->escape_identifiers($item); + } + + return $item.$alias; + } + + // Is there a table prefix? If not, no need to insert it + if ($this->dbprefix !== '') + { + // Verify table prefix and replace if necessary + if ($this->swap_pre !== '' && strpos($item, $this->swap_pre) === 0) + { + $item = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $item); + } + // Do we prefix an item with no segments? + elseif ($prefix_single === TRUE && strpos($item, $this->dbprefix) !== 0) + { + $item = $this->dbprefix.$item; + } + } + + if ($protect_identifiers === TRUE && ! in_array($item, $this->_reserved_identifiers)) + { + $item = $this->escape_identifiers($item); + } + + return $item.$alias; + } + + // -------------------------------------------------------------------- + + /** + * Dummy method that allows Query Builder class to be disabled + * and keep count_all() working. + * + * @return void + */ + protected function _reset_select() + { + } + +} diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php new file mode 100755 index 0000000..3cb02ca --- /dev/null +++ b/system/database/DB_forge.php @@ -0,0 +1,1032 @@ +db =& $db; + log_message('info', 'Database Forge Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * Create database + * + * @param string $db_name + * @return bool + */ + public function create_database($db_name) + { + if ($this->_create_database === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + elseif ( ! $this->db->query(sprintf($this->_create_database, $this->db->escape_identifiers($db_name), $this->db->char_set, $this->db->dbcollat))) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + + if ( ! empty($this->db->data_cache['db_names'])) + { + $this->db->data_cache['db_names'][] = $db_name; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $db_name + * @return bool + */ + public function drop_database($db_name) + { + if ($this->_drop_database === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + elseif ( ! $this->db->query(sprintf($this->_drop_database, $this->db->escape_identifiers($db_name)))) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + + if ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($db_name), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Add Key + * + * @param string $key + * @param bool $primary + * @return CI_DB_forge + */ + public function add_key($key, $primary = FALSE) + { + // DO NOT change this! This condition is only applicable + // for PRIMARY keys because you can only have one such, + // and therefore all fields you add to it will be included + // in the same, composite PRIMARY KEY. + // + // It's not the same for regular indexes. + if ($primary === TRUE && is_array($key)) + { + foreach ($key as $one) + { + $this->add_key($one, $primary); + } + + return $this; + } + + if ($primary === TRUE) + { + $this->primary_keys[] = $key; + } + else + { + $this->keys[] = $key; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Add Field + * + * @param array $field + * @return CI_DB_forge + */ + public function add_field($field) + { + if (is_string($field)) + { + if ($field === 'id') + { + $this->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 9, + 'auto_increment' => TRUE + ) + )); + $this->add_key('id', TRUE); + } + else + { + if (strpos($field, ' ') === FALSE) + { + show_error('Field information is required for that operation.'); + } + + $this->fields[] = $field; + } + } + + if (is_array($field)) + { + $this->fields = array_merge($this->fields, $field); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Create Table + * + * @param string $table Table name + * @param bool $if_not_exists Whether to add IF NOT EXISTS condition + * @param array $attributes Associative array of table attributes + * @return bool + */ + public function create_table($table, $if_not_exists = FALSE, array $attributes = array()) + { + if ($table === '') + { + show_error('A table name is required for that operation.'); + } + else + { + $table = $this->db->dbprefix.$table; + } + + if (count($this->fields) === 0) + { + show_error('Field information is required.'); + } + + $sql = $this->_create_table($table, $if_not_exists, $attributes); + + if (is_bool($sql)) + { + $this->_reset(); + if ($sql === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + } + + if (($result = $this->db->query($sql)) !== FALSE) + { + isset($this->db->data_cache['table_names']) && $this->db->data_cache['table_names'][] = $table; + + // Most databases don't support creating indexes from within the CREATE TABLE statement + if ( ! empty($this->keys)) + { + for ($i = 0, $sqls = $this->_process_indexes($table), $c = count($sqls); $i < $c; $i++) + { + $this->db->query($sqls[$i]); + } + } + } + + $this->_reset(); + return $result; + } + + // -------------------------------------------------------------------- + + /** + * Create Table + * + * @param string $table Table name + * @param bool $if_not_exists Whether to add 'IF NOT EXISTS' condition + * @param array $attributes Associative array of table attributes + * @return mixed + */ + protected function _create_table($table, $if_not_exists, $attributes) + { + if ($if_not_exists === TRUE && $this->_create_table_if === FALSE) + { + if ($this->db->table_exists($table)) + { + return TRUE; + } + else + { + $if_not_exists = FALSE; + } + } + + $sql = ($if_not_exists) + ? sprintf($this->_create_table_if, $this->db->escape_identifiers($table)) + : 'CREATE TABLE'; + + $columns = $this->_process_fields(TRUE); + for ($i = 0, $c = count($columns); $i < $c; $i++) + { + $columns[$i] = ($columns[$i]['_literal'] !== FALSE) + ? "\n\t".$columns[$i]['_literal'] + : "\n\t".$this->_process_column($columns[$i]); + } + + $columns = implode(',', $columns) + .$this->_process_primary_keys($table); + + // Are indexes created from within the CREATE TABLE statement? (e.g. in MySQL) + if ($this->_create_table_keys === TRUE) + { + $columns .= $this->_process_indexes($table); + } + + // _create_table will usually have the following format: "%s %s (%s\n)" + $sql = sprintf($this->_create_table.'%s', + $sql, + $this->db->escape_identifiers($table), + $columns, + $this->_create_table_attr($attributes) + ); + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * CREATE TABLE attributes + * + * @param array $attributes Associative array of table attributes + * @return string + */ + protected function _create_table_attr($attributes) + { + $sql = ''; + + foreach (array_keys($attributes) as $key) + { + if (is_string($key)) + { + $sql .= ' '.strtoupper($key).' '.$attributes[$key]; + } + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Drop Table + * + * @param string $table_name Table name + * @param bool $if_exists Whether to add an IF EXISTS condition + * @return bool + */ + public function drop_table($table_name, $if_exists = FALSE) + { + if ($table_name === '') + { + return ($this->db->db_debug) ? $this->db->display_error('db_table_name_required') : FALSE; + } + + if (($query = $this->_drop_table($this->db->dbprefix.$table_name, $if_exists)) === TRUE) + { + return TRUE; + } + + $query = $this->db->query($query); + + // Update table list cache + if ($query && ! empty($this->db->data_cache['table_names'])) + { + $key = array_search(strtolower($this->db->dbprefix.$table_name), array_map('strtolower', $this->db->data_cache['table_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['table_names'][$key]); + } + } + + return $query; + } + + // -------------------------------------------------------------------- + + /** + * Drop Table + * + * Generates a platform-specific DROP TABLE string + * + * @param string $table Table name + * @param bool $if_exists Whether to add an IF EXISTS condition + * @return mixed (Returns a platform-specific DROP table string, or TRUE to indicate there's nothing to do) + */ + protected function _drop_table($table, $if_exists) + { + $sql = 'DROP TABLE'; + + if ($if_exists) + { + if ($this->_drop_table_if === FALSE) + { + if ( ! $this->db->table_exists($table)) + { + return TRUE; + } + } + else + { + $sql = sprintf($this->_drop_table_if, $this->db->escape_identifiers($table)); + } + } + + return $sql.' '.$this->db->escape_identifiers($table); + } + + // -------------------------------------------------------------------- + + /** + * Rename Table + * + * @param string $table_name Old table name + * @param string $new_table_name New table name + * @return bool + */ + public function rename_table($table_name, $new_table_name) + { + if ($table_name === '' OR $new_table_name === '') + { + show_error('A table name is required for that operation.'); + return FALSE; + } + elseif ($this->_rename_table === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + $result = $this->db->query(sprintf($this->_rename_table, + $this->db->escape_identifiers($this->db->dbprefix.$table_name), + $this->db->escape_identifiers($this->db->dbprefix.$new_table_name)) + ); + + if ($result && ! empty($this->db->data_cache['table_names'])) + { + $key = array_search(strtolower($this->db->dbprefix.$table_name), array_map('strtolower', $this->db->data_cache['table_names']), TRUE); + if ($key !== FALSE) + { + $this->db->data_cache['table_names'][$key] = $this->db->dbprefix.$new_table_name; + } + } + + return $result; + } + + // -------------------------------------------------------------------- + + /** + * Column Add + * + * @todo Remove deprecated $_after option in 3.1+ + * @param string $table Table name + * @param array $field Column definition + * @param string $_after Column for AFTER clause (deprecated) + * @return bool + */ + public function add_column($table, $field, $_after = NULL) + { + // Work-around for literal column definitions + is_array($field) OR $field = array($field); + + foreach (array_keys($field) as $k) + { + // Backwards-compatibility work-around for MySQL/CUBRID AFTER clause (remove in 3.1+) + if ($_after !== NULL && is_array($field[$k]) && ! isset($field[$k]['after'])) + { + $field[$k]['after'] = $_after; + } + + $this->add_field(array($k => $field[$k])); + } + + $sqls = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->_process_fields()); + $this->_reset(); + if ($sqls === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + for ($i = 0, $c = count($sqls); $i < $c; $i++) + { + if ($this->db->query($sqls[$i]) === FALSE) + { + return FALSE; + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Column Drop + * + * @param string $table Table name + * @param string $column_name Column name + * @return bool + */ + public function drop_column($table, $column_name) + { + $sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name); + if ($sql === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + return $this->db->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Column Modify + * + * @param string $table Table name + * @param string $field Column definition + * @return bool + */ + public function modify_column($table, $field) + { + // Work-around for literal column definitions + is_array($field) OR $field = array($field); + + foreach (array_keys($field) as $k) + { + $this->add_field(array($k => $field[$k])); + } + + if (count($this->fields) === 0) + { + show_error('Field information is required.'); + } + + $sqls = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->_process_fields()); + $this->_reset(); + if ($sqls === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + for ($i = 0, $c = count($sqls); $i < $c; $i++) + { + if ($this->db->query($sqls[$i]) === FALSE) + { + return FALSE; + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' '; + + // DROP has everything it needs now. + if ($alter_type === 'DROP') + { + return $sql.'DROP COLUMN '.$this->db->escape_identifiers($field); + } + + $sql .= ($alter_type === 'ADD') + ? 'ADD ' + : $alter_type.' COLUMN '; + + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + $sqls[] = $sql + .($field[$i]['_literal'] !== FALSE ? $field[$i]['_literal'] : $this->_process_column($field[$i])); + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Process fields + * + * @param bool $create_table + * @return array + */ + protected function _process_fields($create_table = FALSE) + { + $fields = array(); + + foreach ($this->fields as $key => $attributes) + { + if (is_int($key) && ! is_array($attributes)) + { + $fields[] = array('_literal' => $attributes); + continue; + } + + $attributes = array_change_key_case($attributes, CASE_UPPER); + + if ($create_table === TRUE && empty($attributes['TYPE'])) + { + continue; + } + + isset($attributes['TYPE']) && $this->_attr_type($attributes); + + $field = array( + 'name' => $key, + 'new_name' => isset($attributes['NAME']) ? $attributes['NAME'] : NULL, + 'type' => isset($attributes['TYPE']) ? $attributes['TYPE'] : NULL, + 'length' => '', + 'unsigned' => '', + 'null' => '', + 'unique' => '', + 'default' => '', + 'auto_increment' => '', + '_literal' => FALSE + ); + + isset($attributes['TYPE']) && $this->_attr_unsigned($attributes, $field); + + if ($create_table === FALSE) + { + if (isset($attributes['AFTER'])) + { + $field['after'] = $attributes['AFTER']; + } + elseif (isset($attributes['FIRST'])) + { + $field['first'] = (bool) $attributes['FIRST']; + } + } + + $this->_attr_default($attributes, $field); + + if (isset($attributes['NULL'])) + { + if ($attributes['NULL'] === TRUE) + { + $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; + } + else + { + $field['null'] = ' NOT NULL'; + } + } + elseif ($create_table === TRUE) + { + $field['null'] = ' NOT NULL'; + } + + $this->_attr_auto_increment($attributes, $field); + $this->_attr_unique($attributes, $field); + + if (isset($attributes['COMMENT'])) + { + $field['comment'] = $this->db->escape($attributes['COMMENT']); + } + + if (isset($attributes['TYPE']) && ! empty($attributes['CONSTRAINT'])) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'ENUM': + case 'SET': + $attributes['CONSTRAINT'] = $this->db->escape($attributes['CONSTRAINT']); + default: + $field['length'] = is_array($attributes['CONSTRAINT']) + ? '('.implode(',', $attributes['CONSTRAINT']).')' + : '('.$attributes['CONSTRAINT'].')'; + break; + } + } + + $fields[] = $field; + } + + return $fields; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['default'] + .$field['null'] + .$field['auto_increment'] + .$field['unique']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + // Usually overridden by drivers + } + + // -------------------------------------------------------------------- + + /** + * Field attribute UNSIGNED + * + * Depending on the _unsigned property value: + * + * - TRUE will always set $field['unsigned'] to 'UNSIGNED' + * - FALSE will always set $field['unsigned'] to '' + * - array(TYPE) will set $field['unsigned'] to 'UNSIGNED', + * if $attributes['TYPE'] is found in the array + * - array(TYPE => UTYPE) will change $field['type'], + * from TYPE to UTYPE in case of a match + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_unsigned(&$attributes, &$field) + { + if (empty($attributes['UNSIGNED']) OR $attributes['UNSIGNED'] !== TRUE) + { + return; + } + + // Reset the attribute in order to avoid issues if we do type conversion + $attributes['UNSIGNED'] = FALSE; + + if (is_array($this->_unsigned)) + { + foreach (array_keys($this->_unsigned) as $key) + { + if (is_int($key) && strcasecmp($attributes['TYPE'], $this->_unsigned[$key]) === 0) + { + $field['unsigned'] = ' UNSIGNED'; + return; + } + elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) + { + $field['type'] = $key; + return; + } + } + + return; + } + + $field['unsigned'] = ($this->_unsigned === TRUE) ? ' UNSIGNED' : ''; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute DEFAULT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_default(&$attributes, &$field) + { + if ($this->_default === FALSE) + { + return; + } + + if (array_key_exists('DEFAULT', $attributes)) + { + if ($attributes['DEFAULT'] === NULL) + { + $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null; + + // Override the NULL attribute if that's our default + $attributes['NULL'] = TRUE; + $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; + } + else + { + $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); + } + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute UNIQUE + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_unique(&$attributes, &$field) + { + if ( ! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === TRUE) + { + $field['unique'] = ' UNIQUE'; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' AUTO_INCREMENT'; + } + } + + // -------------------------------------------------------------------- + + /** + * Process primary keys + * + * @param string $table Table name + * @return string + */ + protected function _process_primary_keys($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->primary_keys); $i < $c; $i++) + { + if ( ! isset($this->fields[$this->primary_keys[$i]])) + { + unset($this->primary_keys[$i]); + } + } + + if (count($this->primary_keys) > 0) + { + $sql .= ",\n\tCONSTRAINT ".$this->db->escape_identifiers('pk_'.$table) + .' PRIMARY KEY('.implode(', ', $this->db->escape_identifiers($this->primary_keys)).')'; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table Table name + * @return string[] list of SQL statements + */ + protected function _process_indexes($table) + { + $sqls = array(); + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers($table.'_'.implode('_', $this->keys[$i])) + .' ON '.$this->db->escape_identifiers($table) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).');'; + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Reset + * + * Resets table creation vars + * + * @return void + */ + protected function _reset() + { + $this->fields = $this->keys = $this->primary_keys = array(); + } + +} diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php new file mode 100755 index 0000000..81603bf --- /dev/null +++ b/system/database/DB_query_builder.php @@ -0,0 +1,2803 @@ +_protect_identifiers; + + foreach ($select as $val) + { + $val = trim($val); + + if ($val !== '') + { + $this->qb_select[] = $val; + $this->qb_no_escape[] = $escape; + + if ($this->qb_caching === TRUE) + { + $this->qb_cache_select[] = $val; + $this->qb_cache_exists[] = 'select'; + $this->qb_cache_no_escape[] = $escape; + } + } + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Select Max + * + * Generates a SELECT MAX(field) portion of a query + * + * @param string the field + * @param string an alias + * @return CI_DB_query_builder + */ + public function select_max($select = '', $alias = '') + { + return $this->_max_min_avg_sum($select, $alias, 'MAX'); + } + + // -------------------------------------------------------------------- + + /** + * Select Min + * + * Generates a SELECT MIN(field) portion of a query + * + * @param string the field + * @param string an alias + * @return CI_DB_query_builder + */ + public function select_min($select = '', $alias = '') + { + return $this->_max_min_avg_sum($select, $alias, 'MIN'); + } + + // -------------------------------------------------------------------- + + /** + * Select Average + * + * Generates a SELECT AVG(field) portion of a query + * + * @param string the field + * @param string an alias + * @return CI_DB_query_builder + */ + public function select_avg($select = '', $alias = '') + { + return $this->_max_min_avg_sum($select, $alias, 'AVG'); + } + + // -------------------------------------------------------------------- + + /** + * Select Sum + * + * Generates a SELECT SUM(field) portion of a query + * + * @param string the field + * @param string an alias + * @return CI_DB_query_builder + */ + public function select_sum($select = '', $alias = '') + { + return $this->_max_min_avg_sum($select, $alias, 'SUM'); + } + + // -------------------------------------------------------------------- + + /** + * SELECT [MAX|MIN|AVG|SUM]() + * + * @used-by select_max() + * @used-by select_min() + * @used-by select_avg() + * @used-by select_sum() + * + * @param string $select Field name + * @param string $alias + * @param string $type + * @return CI_DB_query_builder + */ + protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') + { + if ( ! is_string($select) OR $select === '') + { + $this->display_error('db_invalid_query'); + } + + $type = strtoupper($type); + + if ( ! in_array($type, array('MAX', 'MIN', 'AVG', 'SUM'))) + { + show_error('Invalid function type: '.$type); + } + + if ($alias === '') + { + $alias = $this->_create_alias_from_table(trim($select)); + } + + $sql = $type.'('.$this->protect_identifiers(trim($select)).') AS '.$this->escape_identifiers(trim($alias)); + + $this->qb_select[] = $sql; + $this->qb_no_escape[] = NULL; + + if ($this->qb_caching === TRUE) + { + $this->qb_cache_select[] = $sql; + $this->qb_cache_exists[] = 'select'; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Determines the alias name based on the table + * + * @param string $item + * @return string + */ + protected function _create_alias_from_table($item) + { + if (strpos($item, '.') !== FALSE) + { + $item = explode('.', $item); + return end($item); + } + + return $item; + } + + // -------------------------------------------------------------------- + + /** + * DISTINCT + * + * Sets a flag which tells the query string compiler to add DISTINCT + * + * @param bool $val + * @return CI_DB_query_builder + */ + public function distinct($val = TRUE) + { + $this->qb_distinct = is_bool($val) ? $val : TRUE; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * From + * + * Generates the FROM portion of the query + * + * @param mixed $from can be a string or array + * @return CI_DB_query_builder + */ + public function from($from) + { + foreach ((array) $from as $val) + { + if (strpos($val, ',') !== FALSE) + { + foreach (explode(',', $val) as $v) + { + $v = trim($v); + $this->_track_aliases($v); + + $this->qb_from[] = $v = $this->protect_identifiers($v, TRUE, NULL, FALSE); + + if ($this->qb_caching === TRUE) + { + $this->qb_cache_from[] = $v; + $this->qb_cache_exists[] = 'from'; + } + } + } + else + { + $val = trim($val); + + // Extract any aliases that might exist. We use this information + // in the protect_identifiers to know whether to add a table prefix + $this->_track_aliases($val); + + $this->qb_from[] = $val = $this->protect_identifiers($val, TRUE, NULL, FALSE); + + if ($this->qb_caching === TRUE) + { + $this->qb_cache_from[] = $val; + $this->qb_cache_exists[] = 'from'; + } + } + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * JOIN + * + * Generates the JOIN portion of the query + * + * @param string + * @param string the join condition + * @param string the type of join + * @param string whether not to try to escape identifiers + * @return CI_DB_query_builder + */ + public function join($table, $cond, $type = '', $escape = NULL) + { + if ($type !== '') + { + $type = strtoupper(trim($type)); + + if ( ! in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'), TRUE)) + { + $type = ''; + } + else + { + $type .= ' '; + } + } + + // Extract any aliases that might exist. We use this information + // in the protect_identifiers to know whether to add a table prefix + $this->_track_aliases($table); + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + if ( ! $this->_has_operator($cond)) + { + $cond = ' USING ('.($escape ? $this->escape_identifiers($cond) : $cond).')'; + } + elseif ($escape === FALSE) + { + $cond = ' ON '.$cond; + } + else + { + // Split multiple conditions + if (preg_match_all('/\sAND\s|\sOR\s/i', $cond, $joints, PREG_OFFSET_CAPTURE)) + { + $conditions = array(); + $joints = $joints[0]; + array_unshift($joints, array('', 0)); + + for ($i = count($joints) - 1, $pos = strlen($cond); $i >= 0; $i--) + { + $joints[$i][1] += strlen($joints[$i][0]); // offset + $conditions[$i] = substr($cond, $joints[$i][1], $pos - $joints[$i][1]); + $pos = $joints[$i][1] - strlen($joints[$i][0]); + $joints[$i] = $joints[$i][0]; + } + } + else + { + $conditions = array($cond); + $joints = array(''); + } + + $cond = ' ON '; + for ($i = 0, $c = count($conditions); $i < $c; $i++) + { + $operator = $this->_get_operator($conditions[$i]); + $cond .= $joints[$i]; + $cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)".preg_quote($operator)."(.*)/i", $conditions[$i], $match) + ? $match[1].$this->protect_identifiers($match[2]).$operator.$this->protect_identifiers($match[3]) + : $conditions[$i]; + } + } + + // Do we want to escape the table name? + if ($escape === TRUE) + { + $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // Assemble the JOIN statement + $this->qb_join[] = $join = $type.'JOIN '.$table.$cond; + + if ($this->qb_caching === TRUE) + { + $this->qb_cache_join[] = $join; + $this->qb_cache_exists[] = 'join'; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * WHERE + * + * Generates the WHERE portion of the query. + * Separates multiple calls with 'AND'. + * + * @param mixed + * @param mixed + * @param bool + * @return CI_DB_query_builder + */ + public function where($key, $value = NULL, $escape = NULL) + { + return $this->_wh('qb_where', $key, $value, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR WHERE + * + * Generates the WHERE portion of the query. + * Separates multiple calls with 'OR'. + * + * @param mixed + * @param mixed + * @param bool + * @return CI_DB_query_builder + */ + public function or_where($key, $value = NULL, $escape = NULL) + { + return $this->_wh('qb_where', $key, $value, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * WHERE, HAVING + * + * @used-by where() + * @used-by or_where() + * @used-by having() + * @used-by or_having() + * + * @param string $qb_key 'qb_where' or 'qb_having' + * @param mixed $key + * @param mixed $value + * @param string $type + * @param bool $escape + * @return CI_DB_query_builder + */ + protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = NULL) + { + $qb_cache_key = ($qb_key === 'qb_having') ? 'qb_cache_having' : 'qb_cache_where'; + + if ( ! is_array($key)) + { + $key = array($key => $value); + } + + // If the escape value was not set will base it on the global setting + is_bool($escape) OR $escape = $this->_protect_identifiers; + + foreach ($key as $k => $v) + { + $prefix = (count($this->$qb_key) === 0 && count($this->$qb_cache_key) === 0) + ? $this->_group_get_type('') + : $this->_group_get_type($type); + + if ($v !== NULL) + { + if ($escape === TRUE) + { + $v = ' '.$this->escape($v); + } + + if ( ! $this->_has_operator($k)) + { + $k .= ' = '; + } + } + elseif ( ! $this->_has_operator($k)) + { + // value appears not to have been set, assign the test to IS NULL + $k .= ' IS NULL'; + } + elseif (preg_match('/\s*(!?=|<>|\sIS(?:\s+NOT)?\s)\s*$/i', $k, $match, PREG_OFFSET_CAPTURE)) + { + $k = substr($k, 0, $match[0][1]).($match[1][0] === '=' ? ' IS NULL' : ' IS NOT NULL'); + } + + $this->{$qb_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape); + if ($this->qb_caching === TRUE) + { + $this->{$qb_cache_key}[] = array('condition' => $prefix.$k.$v, 'escape' => $escape); + $this->qb_cache_exists[] = substr($qb_key, 3); + } + + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * WHERE IN + * + * Generates a WHERE field IN('item', 'item') SQL query, + * joined with 'AND' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function where_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_where_in($key, $values, FALSE, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR WHERE IN + * + * Generates a WHERE field IN('item', 'item') SQL query, + * joined with 'OR' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_where_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_where_in($key, $values, FALSE, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * WHERE NOT IN + * + * Generates a WHERE field NOT IN('item', 'item') SQL query, + * joined with 'AND' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function where_not_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_where_in($key, $values, TRUE, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR WHERE NOT IN + * + * Generates a WHERE field NOT IN('item', 'item') SQL query, + * joined with 'OR' if appropriate. + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL) + { + return $this->_where_in($key, $values, TRUE, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * Internal WHERE IN + * + * @used-by where_in() + * @used-by or_where_in() + * @used-by where_not_in() + * @used-by or_where_not_in() + * + * @param string $key The field to search + * @param array $values The values searched on + * @param bool $not If the statement would be IN or NOT IN + * @param string $type + * @param bool $escape + * @return CI_DB_query_builder + */ + protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL) + { + if ($key === NULL OR $values === NULL) + { + return $this; + } + + if ( ! is_array($values)) + { + $values = array($values); + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + $not = ($not) ? ' NOT' : ''; + + if ($escape === TRUE) + { + $where_in = array(); + foreach ($values as $value) + { + $where_in[] = $this->escape($value); + } + } + else + { + $where_in = array_values($values); + } + + $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) + ? $this->_group_get_type('') + : $this->_group_get_type($type); + + $where_in = array( + 'condition' => $prefix.$key.$not.' IN('.implode(', ', $where_in).')', + 'escape' => $escape + ); + + $this->qb_where[] = $where_in; + if ($this->qb_caching === TRUE) + { + $this->qb_cache_where[] = $where_in; + $this->qb_cache_exists[] = 'where'; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * LIKE + * + * Generates a %LIKE% portion of the query. + * Separates multiple calls with 'AND'. + * + * @param mixed $field + * @param string $match + * @param string $side + * @param bool $escape + * @return CI_DB_query_builder + */ + public function like($field, $match = '', $side = 'both', $escape = NULL) + { + return $this->_like($field, $match, 'AND ', $side, '', $escape); + } + + // -------------------------------------------------------------------- + + /** + * NOT LIKE + * + * Generates a NOT LIKE portion of the query. + * Separates multiple calls with 'AND'. + * + * @param mixed $field + * @param string $match + * @param string $side + * @param bool $escape + * @return CI_DB_query_builder + */ + public function not_like($field, $match = '', $side = 'both', $escape = NULL) + { + return $this->_like($field, $match, 'AND ', $side, 'NOT', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR LIKE + * + * Generates a %LIKE% portion of the query. + * Separates multiple calls with 'OR'. + * + * @param mixed $field + * @param string $match + * @param string $side + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_like($field, $match = '', $side = 'both', $escape = NULL) + { + return $this->_like($field, $match, 'OR ', $side, '', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR NOT LIKE + * + * Generates a NOT LIKE portion of the query. + * Separates multiple calls with 'OR'. + * + * @param mixed $field + * @param string $match + * @param string $side + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_not_like($field, $match = '', $side = 'both', $escape = NULL) + { + return $this->_like($field, $match, 'OR ', $side, 'NOT', $escape); + } + + // -------------------------------------------------------------------- + + /** + * Internal LIKE + * + * @used-by like() + * @used-by or_like() + * @used-by not_like() + * @used-by or_not_like() + * + * @param mixed $field + * @param string $match + * @param string $type + * @param string $side + * @param string $not + * @param bool $escape + * @return CI_DB_query_builder + */ + protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = NULL) + { + if ( ! is_array($field)) + { + $field = array($field => $match); + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + // lowercase $side in case somebody writes e.g. 'BEFORE' instead of 'before' (doh) + $side = strtolower($side); + + foreach ($field as $k => $v) + { + $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) + ? $this->_group_get_type('') : $this->_group_get_type($type); + + if ($escape === TRUE) + { + $v = $this->escape_like_str($v); + } + + if ($side === 'none') + { + $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}'"; + } + elseif ($side === 'before') + { + $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}'"; + } + elseif ($side === 'after') + { + $like_statement = "{$prefix} {$k} {$not} LIKE '{$v}%'"; + } + else + { + $like_statement = "{$prefix} {$k} {$not} LIKE '%{$v}%'"; + } + + // some platforms require an escape sequence definition for LIKE wildcards + if ($escape === TRUE && $this->_like_escape_str !== '') + { + $like_statement .= sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + $this->qb_where[] = array('condition' => $like_statement, 'escape' => $escape); + if ($this->qb_caching === TRUE) + { + $this->qb_cache_where[] = array('condition' => $like_statement, 'escape' => $escape); + $this->qb_cache_exists[] = 'where'; + } + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Starts a query group. + * + * @param string $not (Internal use only) + * @param string $type (Internal use only) + * @return CI_DB_query_builder + */ + public function group_start($not = '', $type = 'AND ') + { + $type = $this->_group_get_type($type); + + $this->qb_where_group_started = TRUE; + $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) ? '' : $type; + $where = array( + 'condition' => $prefix.$not.str_repeat(' ', ++$this->qb_where_group_count).' (', + 'escape' => FALSE + ); + + $this->qb_where[] = $where; + if ($this->qb_caching) + { + $this->qb_cache_where[] = $where; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Starts a query group, but ORs the group + * + * @return CI_DB_query_builder + */ + public function or_group_start() + { + return $this->group_start('', 'OR '); + } + + // -------------------------------------------------------------------- + + /** + * Starts a query group, but NOTs the group + * + * @return CI_DB_query_builder + */ + public function not_group_start() + { + return $this->group_start('NOT ', 'AND '); + } + + // -------------------------------------------------------------------- + + /** + * Starts a query group, but OR NOTs the group + * + * @return CI_DB_query_builder + */ + public function or_not_group_start() + { + return $this->group_start('NOT ', 'OR '); + } + + // -------------------------------------------------------------------- + + /** + * Ends a query group + * + * @return CI_DB_query_builder + */ + public function group_end() + { + $this->qb_where_group_started = FALSE; + $where = array( + 'condition' => str_repeat(' ', $this->qb_where_group_count--).')', + 'escape' => FALSE + ); + + $this->qb_where[] = $where; + if ($this->qb_caching) + { + $this->qb_cache_where[] = $where; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Group_get_type + * + * @used-by group_start() + * @used-by _like() + * @used-by _wh() + * @used-by _where_in() + * + * @param string $type + * @return string + */ + protected function _group_get_type($type) + { + if ($this->qb_where_group_started) + { + $type = ''; + $this->qb_where_group_started = FALSE; + } + + return $type; + } + + // -------------------------------------------------------------------- + + /** + * GROUP BY + * + * @param string $by + * @param bool $escape + * @return CI_DB_query_builder + */ + public function group_by($by, $escape = NULL) + { + is_bool($escape) OR $escape = $this->_protect_identifiers; + + if (is_string($by)) + { + $by = ($escape === TRUE) + ? explode(',', $by) + : array($by); + } + + foreach ($by as $val) + { + $val = trim($val); + + if ($val !== '') + { + $val = array('field' => $val, 'escape' => $escape); + + $this->qb_groupby[] = $val; + if ($this->qb_caching === TRUE) + { + $this->qb_cache_groupby[] = $val; + $this->qb_cache_exists[] = 'groupby'; + } + } + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * HAVING + * + * Separates multiple calls with 'AND'. + * + * @param string $key + * @param string $value + * @param bool $escape + * @return CI_DB_query_builder + */ + public function having($key, $value = NULL, $escape = NULL) + { + return $this->_wh('qb_having', $key, $value, 'AND ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * OR HAVING + * + * Separates multiple calls with 'OR'. + * + * @param string $key + * @param string $value + * @param bool $escape + * @return CI_DB_query_builder + */ + public function or_having($key, $value = NULL, $escape = NULL) + { + return $this->_wh('qb_having', $key, $value, 'OR ', $escape); + } + + // -------------------------------------------------------------------- + + /** + * ORDER BY + * + * @param string $orderby + * @param string $direction ASC, DESC or RANDOM + * @param bool $escape + * @return CI_DB_query_builder + */ + public function order_by($orderby, $direction = '', $escape = NULL) + { + $direction = strtoupper(trim($direction)); + + if ($direction === 'RANDOM') + { + $direction = ''; + + // Do we have a seed value? + $orderby = ctype_digit((string) $orderby) + ? sprintf($this->_random_keyword[1], $orderby) + : $this->_random_keyword[0]; + } + elseif (empty($orderby)) + { + return $this; + } + elseif ($direction !== '') + { + $direction = in_array($direction, array('ASC', 'DESC'), TRUE) ? ' '.$direction : ''; + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + if ($escape === FALSE) + { + $qb_orderby[] = array('field' => $orderby, 'direction' => $direction, 'escape' => FALSE); + } + else + { + $qb_orderby = array(); + foreach (explode(',', $orderby) as $field) + { + $qb_orderby[] = ($direction === '' && preg_match('/\s+(ASC|DESC)$/i', rtrim($field), $match, PREG_OFFSET_CAPTURE)) + ? array('field' => ltrim(substr($field, 0, $match[0][1])), 'direction' => ' '.$match[1][0], 'escape' => TRUE) + : array('field' => trim($field), 'direction' => $direction, 'escape' => TRUE); + } + } + + $this->qb_orderby = array_merge($this->qb_orderby, $qb_orderby); + if ($this->qb_caching === TRUE) + { + $this->qb_cache_orderby = array_merge($this->qb_cache_orderby, $qb_orderby); + $this->qb_cache_exists[] = 'orderby'; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * @param int $value LIMIT value + * @param int $offset OFFSET value + * @return CI_DB_query_builder + */ + public function limit($value, $offset = 0) + { + is_null($value) OR $this->qb_limit = (int) $value; + empty($offset) OR $this->qb_offset = (int) $offset; + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Sets the OFFSET value + * + * @param int $offset OFFSET value + * @return CI_DB_query_builder + */ + public function offset($offset) + { + empty($offset) OR $this->qb_offset = (int) $offset; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * LIMIT string + * + * Generates a platform-specific LIMIT clause. + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + return $sql.' LIMIT '.($this->qb_offset ? $this->qb_offset.', ' : '').(int) $this->qb_limit; + } + + // -------------------------------------------------------------------- + + /** + * The "set" function. + * + * Allows key/value pairs to be set for inserting or updating + * + * @param mixed + * @param string + * @param bool + * @return CI_DB_query_builder + */ + public function set($key, $value = '', $escape = NULL) + { + $key = $this->_object_to_array($key); + + if ( ! is_array($key)) + { + $key = array($key => $value); + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + foreach ($key as $k => $v) + { + $this->qb_set[$this->protect_identifiers($k, FALSE, $escape)] = ($escape) + ? $this->escape($v) : $v; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get SELECT query string + * + * Compiles a SELECT query string and returns the sql. + * + * @param string the table name to select from (optional) + * @param bool TRUE: resets QB values; FALSE: leave QB values alone + * @return string + */ + public function get_compiled_select($table = '', $reset = TRUE) + { + if ($table !== '') + { + $this->_track_aliases($table); + $this->from($table); + } + + $select = $this->_compile_select(); + + if ($reset === TRUE) + { + $this->_reset_select(); + } + + return $select; + } + + // -------------------------------------------------------------------- + + /** + * Get + * + * Compiles the select statement based on the other functions called + * and runs the query + * + * @param string the table + * @param string the limit clause + * @param string the offset clause + * @return CI_DB_result + */ + public function get($table = '', $limit = NULL, $offset = NULL) + { + if ($table !== '') + { + $this->_track_aliases($table); + $this->from($table); + } + + if ( ! empty($limit)) + { + $this->limit($limit, $offset); + } + + $result = $this->query($this->_compile_select()); + $this->_reset_select(); + return $result; + } + + // -------------------------------------------------------------------- + + /** + * "Count All Results" query + * + * Generates a platform-specific query string that counts all records + * returned by an Query Builder query. + * + * @param string + * @param bool the reset clause + * @return int + */ + public function count_all_results($table = '', $reset = TRUE) + { + if ($table !== '') + { + $this->_track_aliases($table); + $this->from($table); + } + + // ORDER BY usage is often problematic here (most notably + // on Microsoft SQL Server) and ultimately unnecessary + // for selecting COUNT(*) ... + $qb_orderby = $this->qb_orderby; + $qb_cache_orderby = $this->qb_cache_orderby; + $this->qb_orderby = $this->qb_cache_orderby = NULL; + + $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset) + ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") + : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); + + if ($reset === TRUE) + { + $this->_reset_select(); + } + else + { + $this->qb_orderby = $qb_orderby; + $this->qb_cache_orderby = $qb_cache_orderby; + } + + if ($result->num_rows() === 0) + { + return 0; + } + + $row = $result->row(); + return (int) $row->numrows; + } + + // -------------------------------------------------------------------- + + /** + * Get_Where + * + * Allows the where clause, limit and offset to be added directly + * + * @param string $table + * @param string $where + * @param int $limit + * @param int $offset + * @return CI_DB_result + */ + public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL) + { + if ($table !== '') + { + $this->from($table); + } + + if ($where !== NULL) + { + $this->where($where); + } + + if ( ! empty($limit)) + { + $this->limit($limit, $offset); + } + + $result = $this->query($this->_compile_select()); + $this->_reset_select(); + return $result; + } + + // -------------------------------------------------------------------- + + /** + * Insert_Batch + * + * Compiles batch insert strings and runs the queries + * + * @param string $table Table to insert into + * @param array $set An associative array of insert values + * @param bool $escape Whether to escape values and identifiers + * @return int Number of rows inserted or FALSE on failure + */ + public function insert_batch($table, $set = NULL, $escape = NULL, $batch_size = 100) + { + if ($set === NULL) + { + if (empty($this->qb_set)) + { + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; + } + } + else + { + if (empty($set)) + { + return ($this->db_debug) ? $this->display_error('insert_batch() called with no data') : FALSE; + } + + $this->set_insert_batch($set, '', $escape); + } + + if (strlen($table) === 0) + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + + // Batch this baby + $affected_rows = 0; + for ($i = 0, $total = count($this->qb_set); $i < $total; $i += $batch_size) + { + if ($this->query($this->_insert_batch($this->protect_identifiers($table, TRUE, $escape, FALSE), $this->qb_keys, array_slice($this->qb_set, $i, $batch_size)))) + { + $affected_rows += $this->affected_rows(); + } + } + + $this->_reset_write(); + return $affected_rows; + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _insert_batch($table, $keys, $values) + { + return 'INSERT INTO '.$table.' ('.implode(', ', $keys).') VALUES '.implode(', ', $values); + } + + // -------------------------------------------------------------------- + + /** + * The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts + * + * @param mixed + * @param string + * @param bool + * @return CI_DB_query_builder + */ + public function set_insert_batch($key, $value = '', $escape = NULL) + { + $key = $this->_object_to_array_batch($key); + + if ( ! is_array($key)) + { + $key = array($key => $value); + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + $keys = array_keys($this->_object_to_array(reset($key))); + sort($keys); + + foreach ($key as $row) + { + $row = $this->_object_to_array($row); + if (count(array_diff($keys, array_keys($row))) > 0 OR count(array_diff(array_keys($row), $keys)) > 0) + { + // batch function above returns an error on an empty array + $this->qb_set[] = array(); + return; + } + + ksort($row); // puts $row in the same order as our keys + + if ($escape !== FALSE) + { + $clean = array(); + foreach ($row as $value) + { + $clean[] = $this->escape($value); + } + + $row = $clean; + } + + $this->qb_set[] = '('.implode(',', $row).')'; + } + + foreach ($keys as $k) + { + $this->qb_keys[] = $this->protect_identifiers($k, FALSE, $escape); + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Get INSERT query string + * + * Compiles an insert query and returns the sql + * + * @param string the table to insert into + * @param bool TRUE: reset QB values; FALSE: leave QB values alone + * @return string + */ + public function get_compiled_insert($table = '', $reset = TRUE) + { + if ($this->_validate_insert($table) === FALSE) + { + return FALSE; + } + + $sql = $this->_insert( + $this->protect_identifiers( + $this->qb_from[0], TRUE, NULL, FALSE + ), + array_keys($this->qb_set), + array_values($this->qb_set) + ); + + if ($reset === TRUE) + { + $this->_reset_write(); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Insert + * + * Compiles an insert string and runs the query + * + * @param string the table to insert data into + * @param array an associative array of insert values + * @param bool $escape Whether to escape values and identifiers + * @return bool TRUE on success, FALSE on failure + */ + public function insert($table = '', $set = NULL, $escape = NULL) + { + if ($set !== NULL) + { + $this->set($set, '', $escape); + } + + if ($this->_validate_insert($table) === FALSE) + { + return FALSE; + } + + $sql = $this->_insert( + $this->protect_identifiers( + $this->qb_from[0], TRUE, $escape, FALSE + ), + array_keys($this->qb_set), + array_values($this->qb_set) + ); + + $this->_reset_write(); + return $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Validate Insert + * + * This method is used by both insert() and get_compiled_insert() to + * validate that the there data is actually being set and that table + * has been chosen to be inserted into. + * + * @param string the table to insert data into + * @return string + */ + protected function _validate_insert($table = '') + { + if (count($this->qb_set) === 0) + { + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; + } + + if ($table !== '') + { + $this->qb_from[0] = $table; + } + elseif ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Replace + * + * Compiles an replace into string and runs the query + * + * @param string the table to replace data into + * @param array an associative array of insert values + * @return bool TRUE on success, FALSE on failure + */ + public function replace($table = '', $set = NULL) + { + if ($set !== NULL) + { + $this->set($set); + } + + if (count($this->qb_set) === 0) + { + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; + } + + if ($table === '') + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + + $sql = $this->_replace($this->protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->qb_set), array_values($this->qb_set)); + + $this->_reset_write(); + return $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'REPLACE INTO '.$table.' ('.implode(', ', $keys).') VALUES ('.implode(', ', $values).')'; + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * Note: This is only used (and overridden) by MySQL and CUBRID. + * + * @return string + */ + protected function _from_tables() + { + return implode(', ', $this->qb_from); + } + + // -------------------------------------------------------------------- + + /** + * Get UPDATE query string + * + * Compiles an update query and returns the sql + * + * @param string the table to update + * @param bool TRUE: reset QB values; FALSE: leave QB values alone + * @return string + */ + public function get_compiled_update($table = '', $reset = TRUE) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + if ($this->_validate_update($table) === FALSE) + { + return FALSE; + } + + $sql = $this->_update($this->qb_from[0], $this->qb_set); + + if ($reset === TRUE) + { + $this->_reset_write(); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * UPDATE + * + * Compiles an update string and runs the query. + * + * @param string $table + * @param array $set An associative array of update values + * @param mixed $where + * @param int $limit + * @return bool TRUE on success, FALSE on failure + */ + public function update($table = '', $set = NULL, $where = NULL, $limit = NULL) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + if ($set !== NULL) + { + $this->set($set); + } + + if ($this->_validate_update($table) === FALSE) + { + return FALSE; + } + + if ($where !== NULL) + { + $this->where($where); + } + + if ( ! empty($limit)) + { + $this->limit($limit); + } + + $sql = $this->_update($this->qb_from[0], $this->qb_set); + $this->_reset_write(); + return $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Validate Update + * + * This method is used by both update() and get_compiled_update() to + * validate that data is actually being set and that a table has been + * chosen to be update. + * + * @param string the table to update data on + * @return bool + */ + protected function _validate_update($table) + { + if (count($this->qb_set) === 0) + { + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; + } + + if ($table !== '') + { + $this->qb_from = array($this->protect_identifiers($table, TRUE, NULL, FALSE)); + } + elseif ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Update_Batch + * + * Compiles an update string and runs the query + * + * @param string the table to retrieve the results from + * @param array an associative array of update values + * @param string the where key + * @return int number of rows affected or FALSE on failure + */ + public function update_batch($table, $set = NULL, $index = NULL, $batch_size = 100) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + if ($index === NULL) + { + return ($this->db_debug) ? $this->display_error('db_must_use_index') : FALSE; + } + + if ($set === NULL) + { + if (empty($this->qb_set_ub)) + { + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; + } + } + else + { + if (empty($set)) + { + return ($this->db_debug) ? $this->display_error('update_batch() called with no data') : FALSE; + } + + $this->set_update_batch($set, $index); + } + + if (strlen($table) === 0) + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + + // Batch this baby + $affected_rows = 0; + for ($i = 0, $total = count($this->qb_set_ub); $i < $total; $i += $batch_size) + { + if ($this->query($this->_update_batch($this->protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->qb_set_ub, $i, $batch_size), $index))) + { + $affected_rows += $this->affected_rows(); + } + + $this->qb_where = array(); + } + + $this->_reset_write(); + return $affected_rows; + } + + // -------------------------------------------------------------------- + + /** + * Update_Batch statement + * + * Generates a platform-specific batch update string from the supplied data + * + * @param string $table Table name + * @param array $values Update data + * @param string $index WHERE key + * @return string + */ + protected function _update_batch($table, $values, $index) + { + $ids = array(); + foreach ($values as $key => $val) + { + $ids[] = $val[$index]['value']; + + foreach (array_keys($val) as $field) + { + if ($field !== $index) + { + $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['field'].' = '.$val[$index]['value'].' THEN '.$val[$field]['value']; + } + } + } + + $cases = ''; + foreach ($final as $k => $v) + { + $cases .= $k." = CASE \n" + .implode("\n", $v)."\n" + .'ELSE '.$k.' END, '; + } + + $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE); + + return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where'); + } + + // -------------------------------------------------------------------- + + /** + * The "set_update_batch" function. Allows key/value pairs to be set for batch updating + * + * @param array + * @param string + * @param bool + * @return CI_DB_query_builder + */ + public function set_update_batch($key, $index = '', $escape = NULL) + { + $key = $this->_object_to_array_batch($key); + + if ( ! is_array($key)) + { + // @todo error + } + + is_bool($escape) OR $escape = $this->_protect_identifiers; + + foreach ($key as $k => $v) + { + $index_set = FALSE; + $clean = array(); + foreach ($v as $k2 => $v2) + { + if ($k2 === $index) + { + $index_set = TRUE; + } + + $clean[$k2] = array( + 'field' => $this->protect_identifiers($k2, FALSE, $escape), + 'value' => ($escape === FALSE ? $v2 : $this->escape($v2)) + ); + } + + if ($index_set === FALSE) + { + return $this->display_error('db_batch_missing_index'); + } + + $this->qb_set_ub[] = $clean; + } + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Empty Table + * + * Compiles a delete string and runs "DELETE FROM table" + * + * @param string the table to empty + * @return bool TRUE on success, FALSE on failure + */ + public function empty_table($table = '') + { + if ($table === '') + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + else + { + $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + $sql = $this->_delete($table); + $this->_reset_write(); + return $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Truncate + * + * Compiles a truncate string and runs the query + * If the database does not support the truncate() command + * This function maps to "DELETE FROM table" + * + * @param string the table to truncate + * @return bool TRUE on success, FALSE on failure + */ + public function truncate($table = '') + { + if ($table === '') + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + else + { + $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + $sql = $this->_truncate($table); + $this->_reset_write(); + return $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the truncate() command, + * then this method maps to 'DELETE FROM table' + * + * @param string the table name + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Get DELETE query string + * + * Compiles a delete query string and returns the sql + * + * @param string the table to delete from + * @param bool TRUE: reset QB values; FALSE: leave QB values alone + * @return string + */ + public function get_compiled_delete($table = '', $reset = TRUE) + { + $this->return_delete_sql = TRUE; + $sql = $this->delete($table, '', NULL, $reset); + $this->return_delete_sql = FALSE; + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Delete + * + * Compiles a delete string and runs the query + * + * @param mixed the table(s) to delete from. String or array + * @param mixed the where clause + * @param mixed the limit clause + * @param bool + * @return mixed + */ + public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + if ($table === '') + { + if ( ! isset($this->qb_from[0])) + { + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; + } + + $table = $this->qb_from[0]; + } + elseif (is_array($table)) + { + empty($where) && $reset_data = FALSE; + + foreach ($table as $single_table) + { + $this->delete($single_table, $where, $limit, $reset_data); + } + + return; + } + else + { + $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + if ($where !== '') + { + $this->where($where); + } + + if ( ! empty($limit)) + { + $this->limit($limit); + } + + if (count($this->qb_where) === 0) + { + return ($this->db_debug) ? $this->display_error('db_del_must_use_where') : FALSE; + } + + $sql = $this->_delete($table); + if ($reset_data) + { + $this->_reset_write(); + } + + return ($this->return_delete_sql === TRUE) ? $sql : $this->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string the table name + * @return string + */ + protected function _delete($table) + { + return 'DELETE FROM '.$table.$this->_compile_wh('qb_where') + .($this->qb_limit ? ' LIMIT '.$this->qb_limit : ''); + } + + // -------------------------------------------------------------------- + + /** + * DB Prefix + * + * Prepends a database prefix if one exists in configuration + * + * @param string the table + * @return string + */ + public function dbprefix($table = '') + { + if ($table === '') + { + $this->display_error('db_table_name_required'); + } + + return $this->dbprefix.$table; + } + + // -------------------------------------------------------------------- + + /** + * Set DB Prefix + * + * Set's the DB Prefix to something new without needing to reconnect + * + * @param string the prefix + * @return string + */ + public function set_dbprefix($prefix = '') + { + return $this->dbprefix = $prefix; + } + + // -------------------------------------------------------------------- + + /** + * Track Aliases + * + * Used to track SQL statements written with aliased tables. + * + * @param string The table to inspect + * @return string + */ + protected function _track_aliases($table) + { + if (is_array($table)) + { + foreach ($table as $t) + { + $this->_track_aliases($t); + } + return; + } + + // Does the string contain a comma? If so, we need to separate + // the string into discreet statements + if (strpos($table, ',') !== FALSE) + { + return $this->_track_aliases(explode(',', $table)); + } + + // if a table alias is used we can recognize it by a space + if (strpos($table, ' ') !== FALSE) + { + // if the alias is written with the AS keyword, remove it + $table = preg_replace('/\s+AS\s+/i', ' ', $table); + + // Grab the alias + $table = trim(strrchr($table, ' ')); + + // Store the alias, if it doesn't already exist + if ( ! in_array($table, $this->qb_aliased_tables, TRUE)) + { + $this->qb_aliased_tables[] = $table; + if ($this->qb_caching === TRUE && ! in_array($table, $this->qb_cache_aliased_tables, TRUE)) + { + $this->qb_cache_aliased_tables[] = $table; + $this->qb_cache_exists[] = 'aliased_tables'; + } + } + } + } + + // -------------------------------------------------------------------- + + /** + * Compile the SELECT statement + * + * Generates a query string based on which functions were used. + * Should not be called directly. + * + * @param bool $select_override + * @return string + */ + protected function _compile_select($select_override = FALSE) + { + // Combine any cached components with the current statements + $this->_merge_cache(); + + // Write the "select" portion of the query + if ($select_override !== FALSE) + { + $sql = $select_override; + } + else + { + $sql = ( ! $this->qb_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; + + if (count($this->qb_select) === 0) + { + $sql .= '*'; + } + else + { + // Cycle through the "select" portion of the query and prep each column name. + // The reason we protect identifiers here rather than in the select() function + // is because until the user calls the from() function we don't know if there are aliases + foreach ($this->qb_select as $key => $val) + { + $no_escape = isset($this->qb_no_escape[$key]) ? $this->qb_no_escape[$key] : NULL; + $this->qb_select[$key] = $this->protect_identifiers($val, FALSE, $no_escape); + } + + $sql .= implode(', ', $this->qb_select); + } + } + + // Write the "FROM" portion of the query + if (count($this->qb_from) > 0) + { + $sql .= "\nFROM ".$this->_from_tables(); + } + + // Write the "JOIN" portion of the query + if (count($this->qb_join) > 0) + { + $sql .= "\n".implode("\n", $this->qb_join); + } + + $sql .= $this->_compile_wh('qb_where') + .$this->_compile_group_by() + .$this->_compile_wh('qb_having') + .$this->_compile_order_by(); // ORDER BY + + // LIMIT + if ($this->qb_limit OR $this->qb_offset) + { + return $this->_limit($sql."\n"); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Compile WHERE, HAVING statements + * + * Escapes identifiers in WHERE and HAVING statements at execution time. + * + * Required so that aliases are tracked properly, regardless of whether + * where(), or_where(), having(), or_having are called prior to from(), + * join() and dbprefix is added only if needed. + * + * @param string $qb_key 'qb_where' or 'qb_having' + * @return string SQL statement + */ + protected function _compile_wh($qb_key) + { + if (count($this->$qb_key) > 0) + { + for ($i = 0, $c = count($this->$qb_key); $i < $c; $i++) + { + // Is this condition already compiled? + if (is_string($this->{$qb_key}[$i])) + { + continue; + } + elseif ($this->{$qb_key}[$i]['escape'] === FALSE) + { + $this->{$qb_key}[$i] = $this->{$qb_key}[$i]['condition']; + continue; + } + + // Split multiple conditions + $conditions = preg_split( + '/((?:^|\s+)AND\s+|(?:^|\s+)OR\s+)/i', + $this->{$qb_key}[$i]['condition'], + -1, + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY + ); + + for ($ci = 0, $cc = count($conditions); $ci < $cc; $ci++) + { + if (($op = $this->_get_operator($conditions[$ci])) === FALSE + OR ! preg_match('/^(\(?)(.*)('.preg_quote($op, '/').')\s*(.*(? '(test <= foo)', /* the whole thing */ + // 1 => '(', /* optional */ + // 2 => 'test', /* the field name */ + // 3 => ' <= ', /* $op */ + // 4 => 'foo', /* optional, if $op is e.g. 'IS NULL' */ + // 5 => ')' /* optional */ + // ); + + if ( ! empty($matches[4])) + { + $this->_is_literal($matches[4]) OR $matches[4] = $this->protect_identifiers(trim($matches[4])); + $matches[4] = ' '.$matches[4]; + } + + $conditions[$ci] = $matches[1].$this->protect_identifiers(trim($matches[2])) + .' '.trim($matches[3]).$matches[4].$matches[5]; + } + + $this->{$qb_key}[$i] = implode('', $conditions); + } + + return ($qb_key === 'qb_having' ? "\nHAVING " : "\nWHERE ") + .implode("\n", $this->$qb_key); + } + + return ''; + } + + // -------------------------------------------------------------------- + + /** + * Compile GROUP BY + * + * Escapes identifiers in GROUP BY statements at execution time. + * + * Required so that aliases are tracked properly, regardless of whether + * group_by() is called prior to from(), join() and dbprefix is added + * only if needed. + * + * @return string SQL statement + */ + protected function _compile_group_by() + { + if (count($this->qb_groupby) > 0) + { + for ($i = 0, $c = count($this->qb_groupby); $i < $c; $i++) + { + // Is it already compiled? + if (is_string($this->qb_groupby[$i])) + { + continue; + } + + $this->qb_groupby[$i] = ($this->qb_groupby[$i]['escape'] === FALSE OR $this->_is_literal($this->qb_groupby[$i]['field'])) + ? $this->qb_groupby[$i]['field'] + : $this->protect_identifiers($this->qb_groupby[$i]['field']); + } + + return "\nGROUP BY ".implode(', ', $this->qb_groupby); + } + + return ''; + } + + // -------------------------------------------------------------------- + + /** + * Compile ORDER BY + * + * Escapes identifiers in ORDER BY statements at execution time. + * + * Required so that aliases are tracked properly, regardless of whether + * order_by() is called prior to from(), join() and dbprefix is added + * only if needed. + * + * @return string SQL statement + */ + protected function _compile_order_by() + { + if (empty($this->qb_orderby)) + { + return ''; + } + + for ($i = 0, $c = count($this->qb_orderby); $i < $c; $i++) + { + if (is_string($this->qb_orderby[$i])) + { + continue; + } + + if ($this->qb_orderby[$i]['escape'] !== FALSE && ! $this->_is_literal($this->qb_orderby[$i]['field'])) + { + $this->qb_orderby[$i]['field'] = $this->protect_identifiers($this->qb_orderby[$i]['field']); + } + + $this->qb_orderby[$i] = $this->qb_orderby[$i]['field'].$this->qb_orderby[$i]['direction']; + } + + return "\nORDER BY ".implode(', ', $this->qb_orderby); + } + + // -------------------------------------------------------------------- + + /** + * Object to Array + * + * Takes an object as input and converts the class variables to array key/vals + * + * @param object + * @return array + */ + protected function _object_to_array($object) + { + if ( ! is_object($object)) + { + return $object; + } + + $array = array(); + foreach (get_object_vars($object) as $key => $val) + { + // There are some built in keys we need to ignore for this conversion + if ( ! is_object($val) && ! is_array($val) && $key !== '_parent_name') + { + $array[$key] = $val; + } + } + + return $array; + } + + // -------------------------------------------------------------------- + + /** + * Object to Array + * + * Takes an object as input and converts the class variables to array key/vals + * + * @param object + * @return array + */ + protected function _object_to_array_batch($object) + { + if ( ! is_object($object)) + { + return $object; + } + + $array = array(); + $out = get_object_vars($object); + $fields = array_keys($out); + + foreach ($fields as $val) + { + // There are some built in keys we need to ignore for this conversion + if ($val !== '_parent_name') + { + $i = 0; + foreach ($out[$val] as $data) + { + $array[$i++][$val] = $data; + } + } + } + + return $array; + } + + // -------------------------------------------------------------------- + + /** + * Start Cache + * + * Starts QB caching + * + * @return CI_DB_query_builder + */ + public function start_cache() + { + $this->qb_caching = TRUE; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Stop Cache + * + * Stops QB caching + * + * @return CI_DB_query_builder + */ + public function stop_cache() + { + $this->qb_caching = FALSE; + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Flush Cache + * + * Empties the QB cache + * + * @return CI_DB_query_builder + */ + public function flush_cache() + { + $this->_reset_run(array( + 'qb_cache_select' => array(), + 'qb_cache_from' => array(), + 'qb_cache_join' => array(), + 'qb_cache_where' => array(), + 'qb_cache_groupby' => array(), + 'qb_cache_having' => array(), + 'qb_cache_orderby' => array(), + 'qb_cache_set' => array(), + 'qb_cache_exists' => array(), + 'qb_cache_no_escape' => array(), + 'qb_cache_aliased_tables' => array() + )); + + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Merge Cache + * + * When called, this function merges any cached QB arrays with + * locally called ones. + * + * @return void + */ + protected function _merge_cache() + { + if (count($this->qb_cache_exists) === 0) + { + return; + } + elseif (in_array('select', $this->qb_cache_exists, TRUE)) + { + $qb_no_escape = $this->qb_cache_no_escape; + } + + foreach (array_unique($this->qb_cache_exists) as $val) // select, from, etc. + { + $qb_variable = 'qb_'.$val; + $qb_cache_var = 'qb_cache_'.$val; + $qb_new = $this->$qb_cache_var; + + for ($i = 0, $c = count($this->$qb_variable); $i < $c; $i++) + { + if ( ! in_array($this->{$qb_variable}[$i], $qb_new, TRUE)) + { + $qb_new[] = $this->{$qb_variable}[$i]; + if ($val === 'select') + { + $qb_no_escape[] = $this->qb_no_escape[$i]; + } + } + } + + $this->$qb_variable = $qb_new; + if ($val === 'select') + { + $this->qb_no_escape = $qb_no_escape; + } + } + } + + // -------------------------------------------------------------------- + + /** + * Is literal + * + * Determines if a string represents a literal value or a field name + * + * @param string $str + * @return bool + */ + protected function _is_literal($str) + { + $str = trim($str); + + if (empty($str) OR ctype_digit($str) OR (string) (float) $str === $str OR in_array(strtoupper($str), array('TRUE', 'FALSE'), TRUE)) + { + return TRUE; + } + + static $_str; + + if (empty($_str)) + { + $_str = ($this->_escape_char !== '"') + ? array('"', "'") : array("'"); + } + + return in_array($str[0], $_str, TRUE); + } + + // -------------------------------------------------------------------- + + /** + * Reset Query Builder values. + * + * Publicly-visible method to reset the QB values. + * + * @return CI_DB_query_builder + */ + public function reset_query() + { + $this->_reset_select(); + $this->_reset_write(); + return $this; + } + + // -------------------------------------------------------------------- + + /** + * Resets the query builder values. Called by the get() function + * + * @param array An array of fields to reset + * @return void + */ + protected function _reset_run($qb_reset_items) + { + foreach ($qb_reset_items as $item => $default_value) + { + $this->$item = $default_value; + } + } + + // -------------------------------------------------------------------- + + /** + * Resets the query builder values. Called by the get() function + * + * @return void + */ + protected function _reset_select() + { + $this->_reset_run(array( + 'qb_select' => array(), + 'qb_from' => array(), + 'qb_join' => array(), + 'qb_where' => array(), + 'qb_groupby' => array(), + 'qb_having' => array(), + 'qb_orderby' => array(), + 'qb_aliased_tables' => array(), + 'qb_no_escape' => array(), + 'qb_distinct' => FALSE, + 'qb_limit' => FALSE, + 'qb_offset' => FALSE + )); + } + + // -------------------------------------------------------------------- + + /** + * Resets the query builder "write" values. + * + * Called by the insert() update() insert_batch() update_batch() and delete() functions + * + * @return void + */ + protected function _reset_write() + { + $this->_reset_run(array( + 'qb_set' => array(), + 'qb_set_ub' => array(), + 'qb_from' => array(), + 'qb_join' => array(), + 'qb_where' => array(), + 'qb_orderby' => array(), + 'qb_keys' => array(), + 'qb_limit' => FALSE + )); + } + +} diff --git a/system/database/DB_result.php b/system/database/DB_result.php new file mode 100755 index 0000000..98d8876 --- /dev/null +++ b/system/database/DB_result.php @@ -0,0 +1,666 @@ +conn_id = $driver_object->conn_id; + $this->result_id = $driver_object->result_id; + } + + // -------------------------------------------------------------------- + + /** + * Number of rows in the result set + * + * @return int + */ + public function num_rows() + { + if (is_int($this->num_rows)) + { + return $this->num_rows; + } + elseif (count($this->result_array) > 0) + { + return $this->num_rows = count($this->result_array); + } + elseif (count($this->result_object) > 0) + { + return $this->num_rows = count($this->result_object); + } + + return $this->num_rows = count($this->result_array()); + } + + // -------------------------------------------------------------------- + + /** + * Query result. Acts as a wrapper function for the following functions. + * + * @param string $type 'object', 'array' or a custom class name + * @return array + */ + public function result($type = 'object') + { + if ($type === 'array') + { + return $this->result_array(); + } + elseif ($type === 'object') + { + return $this->result_object(); + } + else + { + return $this->custom_result_object($type); + } + } + + // -------------------------------------------------------------------- + + /** + * Custom query result. + * + * @param string $class_name + * @return array + */ + public function custom_result_object($class_name) + { + if (isset($this->custom_result_object[$class_name])) + { + return $this->custom_result_object[$class_name]; + } + elseif ( ! $this->result_id OR $this->num_rows === 0) + { + return array(); + } + + // Don't fetch the result set again if we already have it + $_data = NULL; + if (($c = count($this->result_array)) > 0) + { + $_data = 'result_array'; + } + elseif (($c = count($this->result_object)) > 0) + { + $_data = 'result_object'; + } + + if ($_data !== NULL) + { + for ($i = 0; $i < $c; $i++) + { + $this->custom_result_object[$class_name][$i] = new $class_name(); + + foreach ($this->{$_data}[$i] as $key => $value) + { + $this->custom_result_object[$class_name][$i]->$key = $value; + } + } + + return $this->custom_result_object[$class_name]; + } + + is_null($this->row_data) OR $this->data_seek(0); + $this->custom_result_object[$class_name] = array(); + + while ($row = $this->_fetch_object($class_name)) + { + $this->custom_result_object[$class_name][] = $row; + } + + return $this->custom_result_object[$class_name]; + } + + // -------------------------------------------------------------------- + + /** + * Query result. "object" version. + * + * @return array + */ + public function result_object() + { + if (count($this->result_object) > 0) + { + return $this->result_object; + } + + // In the event that query caching is on, the result_id variable + // will not be a valid resource so we'll simply return an empty + // array. + if ( ! $this->result_id OR $this->num_rows === 0) + { + return array(); + } + + if (($c = count($this->result_array)) > 0) + { + for ($i = 0; $i < $c; $i++) + { + $this->result_object[$i] = (object) $this->result_array[$i]; + } + + return $this->result_object; + } + + is_null($this->row_data) OR $this->data_seek(0); + while ($row = $this->_fetch_object()) + { + $this->result_object[] = $row; + } + + return $this->result_object; + } + + // -------------------------------------------------------------------- + + /** + * Query result. "array" version. + * + * @return array + */ + public function result_array() + { + if (count($this->result_array) > 0) + { + return $this->result_array; + } + + // In the event that query caching is on, the result_id variable + // will not be a valid resource so we'll simply return an empty + // array. + if ( ! $this->result_id OR $this->num_rows === 0) + { + return array(); + } + + if (($c = count($this->result_object)) > 0) + { + for ($i = 0; $i < $c; $i++) + { + $this->result_array[$i] = (array) $this->result_object[$i]; + } + + return $this->result_array; + } + + is_null($this->row_data) OR $this->data_seek(0); + while ($row = $this->_fetch_assoc()) + { + $this->result_array[] = $row; + } + + return $this->result_array; + } + + // -------------------------------------------------------------------- + + /** + * Row + * + * A wrapper method. + * + * @param mixed $n + * @param string $type 'object' or 'array' + * @return mixed + */ + public function row($n = 0, $type = 'object') + { + if ( ! is_numeric($n)) + { + // We cache the row data for subsequent uses + is_array($this->row_data) OR $this->row_data = $this->row_array(0); + + // array_key_exists() instead of isset() to allow for NULL values + if (empty($this->row_data) OR ! array_key_exists($n, $this->row_data)) + { + return NULL; + } + + return $this->row_data[$n]; + } + + if ($type === 'object') return $this->row_object($n); + elseif ($type === 'array') return $this->row_array($n); + else return $this->custom_row_object($n, $type); + } + + // -------------------------------------------------------------------- + + /** + * Assigns an item into a particular column slot + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function set_row($key, $value = NULL) + { + // We cache the row data for subsequent uses + if ( ! is_array($this->row_data)) + { + $this->row_data = $this->row_array(0); + } + + if (is_array($key)) + { + foreach ($key as $k => $v) + { + $this->row_data[$k] = $v; + } + return; + } + + if ($key !== '' && $value !== NULL) + { + $this->row_data[$key] = $value; + } + } + + // -------------------------------------------------------------------- + + /** + * Returns a single result row - custom object version + * + * @param int $n + * @param string $type + * @return object + */ + public function custom_row_object($n, $type) + { + isset($this->custom_result_object[$type]) OR $this->custom_result_object($type); + + if (count($this->custom_result_object[$type]) === 0) + { + return NULL; + } + + if ($n !== $this->current_row && isset($this->custom_result_object[$type][$n])) + { + $this->current_row = $n; + } + + return $this->custom_result_object[$type][$this->current_row]; + } + + // -------------------------------------------------------------------- + + /** + * Returns a single result row - object version + * + * @param int $n + * @return object + */ + public function row_object($n = 0) + { + $result = $this->result_object(); + if (count($result) === 0) + { + return NULL; + } + + if ($n !== $this->current_row && isset($result[$n])) + { + $this->current_row = $n; + } + + return $result[$this->current_row]; + } + + // -------------------------------------------------------------------- + + /** + * Returns a single result row - array version + * + * @param int $n + * @return array + */ + public function row_array($n = 0) + { + $result = $this->result_array(); + if (count($result) === 0) + { + return NULL; + } + + if ($n !== $this->current_row && isset($result[$n])) + { + $this->current_row = $n; + } + + return $result[$this->current_row]; + } + + // -------------------------------------------------------------------- + + /** + * Returns the "first" row + * + * @param string $type + * @return mixed + */ + public function first_row($type = 'object') + { + $result = $this->result($type); + return (count($result) === 0) ? NULL : $result[0]; + } + + // -------------------------------------------------------------------- + + /** + * Returns the "last" row + * + * @param string $type + * @return mixed + */ + public function last_row($type = 'object') + { + $result = $this->result($type); + return (count($result) === 0) ? NULL : $result[count($result) - 1]; + } + + // -------------------------------------------------------------------- + + /** + * Returns the "next" row + * + * @param string $type + * @return mixed + */ + public function next_row($type = 'object') + { + $result = $this->result($type); + if (count($result) === 0) + { + return NULL; + } + + return isset($result[$this->current_row + 1]) + ? $result[++$this->current_row] + : NULL; + } + + // -------------------------------------------------------------------- + + /** + * Returns the "previous" row + * + * @param string $type + * @return mixed + */ + public function previous_row($type = 'object') + { + $result = $this->result($type); + if (count($result) === 0) + { + return NULL; + } + + if (isset($result[$this->current_row - 1])) + { + --$this->current_row; + } + return $result[$this->current_row]; + } + + // -------------------------------------------------------------------- + + /** + * Returns an unbuffered row and move pointer to next row + * + * @param string $type 'array', 'object' or a custom class name + * @return mixed + */ + public function unbuffered_row($type = 'object') + { + if ($type === 'array') + { + return $this->_fetch_assoc(); + } + elseif ($type === 'object') + { + return $this->_fetch_object(); + } + + return $this->_fetch_object($type); + } + + // -------------------------------------------------------------------- + + /** + * The following methods are normally overloaded by the identically named + * methods in the platform-specific driver -- except when query caching + * is used. When caching is enabled we do not load the other driver. + * These functions are primarily here to prevent undefined function errors + * when a cached result object is in use. They are not otherwise fully + * operational due to the unavailability of the database resource IDs with + * cached results. + */ + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * Overridden by driver result classes. + * + * @return int + */ + public function num_fields() + { + return 0; + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names. + * + * Overridden by driver result classes. + * + * @return array + */ + public function list_fields() + { + return array(); + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data. + * + * Overridden by driver result classes. + * + * @return array + */ + public function field_data() + { + return array(); + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * Overridden by driver result classes. + * + * @return void + */ + public function free_result() + { + $this->result_id = FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * Overridden by driver result classes. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array. + * + * Overridden by driver result classes. + * + * @return array + */ + protected function _fetch_assoc() + { + return array(); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object. + * + * Overridden by driver result classes. + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return new $class_name(); + } + +} diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php new file mode 100755 index 0000000..25d842c --- /dev/null +++ b/system/database/DB_utility.php @@ -0,0 +1,424 @@ +db =& $db; + log_message('info', 'Database Utility Class Initialized'); + } + + // -------------------------------------------------------------------- + + /** + * List databases + * + * @return array + */ + public function list_databases() + { + // Is there a cached result? + if (isset($this->db->data_cache['db_names'])) + { + return $this->db->data_cache['db_names']; + } + elseif ($this->_list_databases === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + $this->db->data_cache['db_names'] = array(); + + $query = $this->db->query($this->_list_databases); + if ($query === FALSE) + { + return $this->db->data_cache['db_names']; + } + + for ($i = 0, $query = $query->result_array(), $c = count($query); $i < $c; $i++) + { + $this->db->data_cache['db_names'][] = current($query[$i]); + } + + return $this->db->data_cache['db_names']; + } + + // -------------------------------------------------------------------- + + /** + * Determine if a particular database exists + * + * @param string $database_name + * @return bool + */ + public function database_exists($database_name) + { + return in_array($database_name, $this->list_databases()); + } + + // -------------------------------------------------------------------- + + /** + * Optimize Table + * + * @param string $table_name + * @return mixed + */ + public function optimize_table($table_name) + { + if ($this->_optimize_table === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + $query = $this->db->query(sprintf($this->_optimize_table, $this->db->escape_identifiers($table_name))); + if ($query !== FALSE) + { + $query = $query->result_array(); + return current($query); + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Optimize Database + * + * @return mixed + */ + public function optimize_database() + { + if ($this->_optimize_table === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + $result = array(); + foreach ($this->db->list_tables() as $table_name) + { + $res = $this->db->query(sprintf($this->_optimize_table, $this->db->escape_identifiers($table_name))); + if (is_bool($res)) + { + return $res; + } + + // Build the result array... + $res = $res->result_array(); + $res = current($res); + $key = str_replace($this->db->database.'.', '', current($res)); + $keys = array_keys($res); + unset($res[$keys[0]]); + + $result[$key] = $res; + } + + return $result; + } + + // -------------------------------------------------------------------- + + /** + * Repair Table + * + * @param string $table_name + * @return mixed + */ + public function repair_table($table_name) + { + if ($this->_repair_table === FALSE) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE; + } + + $query = $this->db->query(sprintf($this->_repair_table, $this->db->escape_identifiers($table_name))); + if (is_bool($query)) + { + return $query; + } + + $query = $query->result_array(); + return current($query); + } + + // -------------------------------------------------------------------- + + /** + * Generate CSV from a query result object + * + * @param object $query Query result object + * @param string $delim Delimiter (default: ,) + * @param string $newline Newline character (default: \n) + * @param string $enclosure Enclosure (default: ") + * @return string + */ + public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"') + { + if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) + { + show_error('You must submit a valid result object'); + } + + $out = ''; + // First generate the headings from the table column names + foreach ($query->list_fields() as $name) + { + $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim; + } + + $out = substr($out, 0, -strlen($delim)).$newline; + + // Next blast through the result array and build out the rows + while ($row = $query->unbuffered_row('array')) + { + $line = array(); + foreach ($row as $item) + { + $line[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure; + } + $out .= implode($delim, $line).$newline; + } + + return $out; + } + + // -------------------------------------------------------------------- + + /** + * Generate XML data from a query result object + * + * @param object $query Query result object + * @param array $params Any preferences + * @return string + */ + public function xml_from_result($query, $params = array()) + { + if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) + { + show_error('You must submit a valid result object'); + } + + // Set our default values + foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) + { + if ( ! isset($params[$key])) + { + $params[$key] = $val; + } + } + + // Create variables for convenience + extract($params); + + // Load the xml helper + get_instance()->load->helper('xml'); + + // Generate the result + $xml = '<'.$root.'>'.$newline; + while ($row = $query->unbuffered_row()) + { + $xml .= $tab.'<'.$element.'>'.$newline; + foreach ($row as $key => $val) + { + $xml .= $tab.$tab.'<'.$key.'>'.xml_convert($val).''.$newline; + } + $xml .= $tab.''.$newline; + } + + return $xml.''.$newline; + } + + // -------------------------------------------------------------------- + + /** + * Database Backup + * + * @param array $params + * @return string + */ + public function backup($params = array()) + { + // If the parameters have not been submitted as an + // array then we know that it is simply the table + // name, which is a valid short cut. + if (is_string($params)) + { + $params = array('tables' => $params); + } + + // Set up our default preferences + $prefs = array( + 'tables' => array(), + 'ignore' => array(), + 'filename' => '', + 'format' => 'gzip', // gzip, zip, txt + 'add_drop' => TRUE, + 'add_insert' => TRUE, + 'newline' => "\n", + 'foreign_key_checks' => TRUE + ); + + // Did the user submit any preferences? If so set them.... + if (count($params) > 0) + { + foreach ($prefs as $key => $val) + { + if (isset($params[$key])) + { + $prefs[$key] = $params[$key]; + } + } + } + + // Are we backing up a complete database or individual tables? + // If no table names were submitted we'll fetch the entire table list + if (count($prefs['tables']) === 0) + { + $prefs['tables'] = $this->db->list_tables(); + } + + // Validate the format + if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE)) + { + $prefs['format'] = 'txt'; + } + + // Is the encoder supported? If not, we'll either issue an + // error or use plain text depending on the debug settings + if (($prefs['format'] === 'gzip' && ! function_exists('gzencode')) + OR ($prefs['format'] === 'zip' && ! function_exists('gzcompress'))) + { + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsupported_compression'); + } + + $prefs['format'] = 'txt'; + } + + // Was a Zip file requested? + if ($prefs['format'] === 'zip') + { + // Set the filename if not provided (only needed with Zip files) + if ($prefs['filename'] === '') + { + $prefs['filename'] = (count($prefs['tables']) === 1 ? $prefs['tables'] : $this->db->database) + .date('Y-m-d_H-i', time()).'.sql'; + } + else + { + // If they included the .zip file extension we'll remove it + if (preg_match('|.+?\.zip$|', $prefs['filename'])) + { + $prefs['filename'] = str_replace('.zip', '', $prefs['filename']); + } + + // Tack on the ".sql" file extension if needed + if ( ! preg_match('|.+?\.sql$|', $prefs['filename'])) + { + $prefs['filename'] .= '.sql'; + } + } + + // Load the Zip class and output it + $CI =& get_instance(); + $CI->load->library('zip'); + $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); + return $CI->zip->get_zip(); + } + elseif ($prefs['format'] === 'txt') // Was a text file requested? + { + return $this->_backup($prefs); + } + elseif ($prefs['format'] === 'gzip') // Was a Gzip file requested? + { + return gzencode($this->_backup($prefs)); + } + + return; + } + +} diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php new file mode 100755 index 0000000..6e8aff7 --- /dev/null +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -0,0 +1,405 @@ +dsn, $matches)) + { + if (stripos($matches[2], 'autocommit=off') !== FALSE) + { + $this->auto_commit = FALSE; + } + } + else + { + // If no port is defined by the user, use the default value + empty($this->port) OR $this->port = 33000; + } + } + + // -------------------------------------------------------------------- + + /** + * Non-persistent database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:([^:]*):([^:]*):(\?.+)?$/', $this->dsn, $matches)) + { + $func = ($persistent !== TRUE) ? 'cubrid_connect_with_url' : 'cubrid_pconnect_with_url'; + return ($matches[2] === '' && $matches[3] === '' && $this->username !== '' && $this->password !== '') + ? $func($this->dsn, $this->username, $this->password) + : $func($this->dsn); + } + + $func = ($persistent !== TRUE) ? 'cubrid_connect' : 'cubrid_pconnect'; + return ($this->username !== '') + ? $func($this->hostname, $this->port, $this->database, $this->username, $this->password) + : $func($this->hostname, $this->port, $this->database); + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @return void + */ + public function reconnect() + { + if (cubrid_ping($this->conn_id) === FALSE) + { + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + return ( ! $this->conn_id OR ($version = cubrid_get_server_info($this->conn_id)) === FALSE) + ? FALSE + : $this->data_cache['version'] = $version; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return cubrid_query($sql, $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + if (($autocommit = cubrid_get_autocommit($this->conn_id)) === NULL) + { + return FALSE; + } + elseif ($autocommit === TRUE) + { + return cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE); + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if ( ! cubrid_commit($this->conn_id)) + { + return FALSE; + } + + if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id)) + { + return cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE); + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if ( ! cubrid_rollback($this->conn_id)) + { + return FALSE; + } + + if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id)) + { + cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE); + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return cubrid_real_escape_string($str, $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return cubrid_affected_rows(); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return cubrid_insert_id($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SHOW TABLES'; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->Field; + + sscanf($query[$i]->Type, '%[a-z](%d)', + $retval[$i]->type, + $retval[$i]->max_length + ); + + $retval[$i]->default = $query[$i]->Default; + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => cubrid_errno($this->conn_id), 'message' => cubrid_error($this->conn_id)); + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + cubrid_close($this->conn_id); + } + +} diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php new file mode 100755 index 0000000..27bfc14 --- /dev/null +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -0,0 +1,230 @@ + 'INTEGER', + 'SMALLINT' => 'INTEGER', + 'INT' => 'BIGINT', + 'INTEGER' => 'BIGINT', + 'BIGINT' => 'NUMERIC', + 'FLOAT' => 'DOUBLE', + 'REAL' => 'DOUBLE' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $sqls[] = $sql.' CHANGE '.$field[$i]['_literal']; + } + else + { + $alter_type = empty($field[$i]['new_name']) ? ' MODIFY ' : ' CHANGE '; + $sqls[] = $sql.$alter_type.$this->_process_column($field[$i]); + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'LONGTEXT': + $attributes['TYPE'] = 'STRING'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table (ignored) + * @return string + */ + protected function _process_indexes($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sql .= ",\n\tKEY ".$this->db->escape_identifiers(implode('_', $this->keys[$i])) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).')'; + } + + $this->keys = array(); + + return $sql; + } + +} diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php new file mode 100755 index 0000000..251b70a --- /dev/null +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -0,0 +1,177 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = cubrid_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return cubrid_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + return cubrid_column_names($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = cubrid_field_name($this->result_id, $i); + $retval[$i]->type = cubrid_field_type($this->result_id, $i); + $retval[$i]->max_length = cubrid_field_len($this->result_id, $i); + $retval[$i]->primary_key = (int) (strpos(cubrid_field_flags($this->result_id, $i), 'primary_key') !== FALSE); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id) OR + (get_resource_type($this->result_id) === 'Unknown' && preg_match('/Resource id #/', strval($this->result_id)))) + { + cubrid_close_request($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return cubrid_data_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return cubrid_fetch_assoc($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return cubrid_fetch_object($this->result_id, $class_name); + } + +} diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php new file mode 100755 index 0000000..555ae7a --- /dev/null +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -0,0 +1,79 @@ +db->data_cache['db_names'])) + { + return $this->db->data_cache['db_names']; + } + + return $this->db->data_cache['db_names'] = cubrid_list_dbs($this->db->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * CUBRID Export + * + * @param array Preferences + * @return mixed + */ + protected function _backup($params = array()) + { + // No SQL based support in CUBRID as of version 8.4.0. Database or + // table backup can be performed using CUBRID Manager + // database administration tool. + return $this->db->display_error('db_unsupported_feature'); + } +} diff --git a/system/database/drivers/cubrid/index.html b/system/database/drivers/cubrid/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/cubrid/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php new file mode 100755 index 0000000..3069d66 --- /dev/null +++ b/system/database/drivers/ibase/ibase_driver.php @@ -0,0 +1,413 @@ +hostname.':'.$this->database, $this->username, $this->password, $this->char_set) + : ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if (($service = ibase_service_attach($this->hostname, $this->username, $this->password))) + { + $this->data_cache['version'] = ibase_server_info($service, IBASE_SVC_SERVER_VERSION); + + // Don't keep the service open + ibase_service_detach($service); + return $this->data_cache['version']; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return ibase_query(isset($this->_ibase_trans) ? $this->_ibase_trans : $this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + if (($trans_handle = ibase_trans($this->conn_id)) === FALSE) + { + return FALSE; + } + + $this->_ibase_trans = $trans_handle; + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if (ibase_commit($this->_ibase_trans)) + { + $this->_ibase_trans = NULL; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if (ibase_rollback($this->_ibase_trans)) + { + $this->_ibase_trans = NULL; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return ibase_affected_rows($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @param string $generator_name + * @param int $inc_by + * @return int + */ + public function insert_id($generator_name, $inc_by = 0) + { + //If a generator hasn't been used before it will return 0 + return ibase_gen_id('"'.$generator_name.'"', $inc_by); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT TRIM("RDB$RELATION_NAME") AS TABLE_NAME FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql.' AND TRIM("RDB$RELATION_NAME") AS TABLE_NAME LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT TRIM("RDB$FIELD_NAME") AS COLUMN_NAME FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name", + CASE "fields"."RDB$FIELD_TYPE" + WHEN 7 THEN \'SMALLINT\' + WHEN 8 THEN \'INTEGER\' + WHEN 9 THEN \'QUAD\' + WHEN 10 THEN \'FLOAT\' + WHEN 11 THEN \'DFLOAT\' + WHEN 12 THEN \'DATE\' + WHEN 13 THEN \'TIME\' + WHEN 14 THEN \'CHAR\' + WHEN 16 THEN \'INT64\' + WHEN 27 THEN \'DOUBLE\' + WHEN 35 THEN \'TIMESTAMP\' + WHEN 37 THEN \'VARCHAR\' + WHEN 40 THEN \'CSTRING\' + WHEN 261 THEN \'BLOB\' + ELSE NULL + END AS "type", + "fields"."RDB$FIELD_LENGTH" AS "max_length", + "rfields"."RDB$DEFAULT_VALUE" AS "default" + FROM "RDB$RELATION_FIELDS" "rfields" + JOIN "RDB$FIELDS" "fields" ON "rfields"."RDB$FIELD_SOURCE" = "fields"."RDB$FIELD_NAME" + WHERE "rfields"."RDB$RELATION_NAME" = '.$this->escape($table).' + ORDER BY "rfields"."RDB$FIELD_POSITION"'; + + return (($query = $this->query($sql)) !== FALSE) + ? $query->result_object() + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => ibase_errcode(), 'message' => ibase_errmsg()); + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + // Limit clause depends on if Interbase or Firebird + if (stripos($this->version(), 'firebird') !== FALSE) + { + $select = 'FIRST '.$this->qb_limit + .($this->qb_offset ? ' SKIP '.$this->qb_offset : ''); + } + else + { + $select = 'ROWS ' + .($this->qb_offset ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit); + } + + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql, 1); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + ibase_close($this->conn_id); + } + +} diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php new file mode 100755 index 0000000..31352f1 --- /dev/null +++ b/system/database/drivers/ibase/ibase_forge.php @@ -0,0 +1,251 @@ + 'INTEGER', + 'INTEGER' => 'INT64', + 'FLOAT' => 'DOUBLE PRECISION' + ); + + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + + // -------------------------------------------------------------------- + + /** + * Create database + * + * @param string $db_name + * @return bool + */ + public function create_database($db_name) + { + // Firebird databases are flat files, so a path is required + + // Hostname is needed for remote access + empty($this->db->hostname) OR $db_name = $this->hostname.':'.$db_name; + + return parent::create_database('"'.$db_name.'"'); + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $db_name (ignored) + * @return bool + */ + public function drop_database($db_name) + { + if ( ! ibase_drop_db($this->conn_id)) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + return FALSE; + } + + if (isset($field[$i]['type'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identififers($field[$i]['name']) + .' TYPE '.$field[$i]['type'].$field[$i]['length']; + } + + if ( ! empty($field[$i]['default'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' SET DEFAULT '.$field[$i]['default']; + } + + if (isset($field[$i]['null'])) + { + $sqls[] = 'UPDATE "RDB$RELATION_FIELDS" SET "RDB$NULL_FLAG" = ' + .($field[$i]['null'] === TRUE ? 'NULL' : '1') + .' WHERE "RDB$FIELD_NAME" = '.$this->db->escape($field[$i]['name']) + .' AND "RDB$RELATION_NAME" = '.$this->db->escape($table); + } + + if ( ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'].$field['length'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INT': + $attributes['TYPE'] = 'INTEGER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'INT64'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported + } + +} diff --git a/system/database/drivers/ibase/ibase_result.php b/system/database/drivers/ibase/ibase_result.php new file mode 100755 index 0000000..7d7dd79 --- /dev/null +++ b/system/database/drivers/ibase/ibase_result.php @@ -0,0 +1,161 @@ +result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $num_fields = $this->num_fields(); $i < $num_fields; $i++) + { + $info = ibase_field_info($this->result_id, $i); + $field_names[] = $info['name']; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $info = ibase_field_info($this->result_id, $i); + + $retval[$i] = new stdClass(); + $retval[$i]->name = $info['name']; + $retval[$i]->type = $info['type']; + $retval[$i]->max_length = $info['length']; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + ibase_free_result($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return ibase_fetch_assoc($this->result_id, IBASE_FETCH_BLOBS); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + $row = ibase_fetch_object($this->result_id, IBASE_FETCH_BLOBS); + + if ($class_name === 'stdClass' OR ! $row) + { + return $row; + } + + $class_name = new $class_name(); + foreach ($row as $key => $value) + { + $class_name->$key = $value; + } + + return $class_name; + } + +} diff --git a/system/database/drivers/ibase/ibase_utility.php b/system/database/drivers/ibase/ibase_utility.php new file mode 100755 index 0000000..3c15210 --- /dev/null +++ b/system/database/drivers/ibase/ibase_utility.php @@ -0,0 +1,69 @@ +db->hostname, $this->db->username, $this->db->password)) + { + $res = ibase_backup($service, $this->db->database, $filename.'.fbk'); + + // Close the service connection + ibase_service_detach($service); + return $res; + } + + return FALSE; + } + +} diff --git a/system/database/drivers/ibase/index.html b/system/database/drivers/ibase/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/ibase/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/index.html b/system/database/drivers/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/mssql/index.html b/system/database/drivers/mssql/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/mssql/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php new file mode 100755 index 0000000..cb89f3b --- /dev/null +++ b/system/database/drivers/mssql/mssql_driver.php @@ -0,0 +1,518 @@ +port)) + { + $this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':').$this->port; + } + } + + // -------------------------------------------------------------------- + + /** + * Non-persistent database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + $this->conn_id = ($persistent) + ? mssql_pconnect($this->hostname, $this->username, $this->password) + : mssql_connect($this->hostname, $this->username, $this->password); + + if ( ! $this->conn_id) + { + return FALSE; + } + + // ---------------------------------------------------------------- + + // Select the DB... assuming a database name is specified in the config file + if ($this->database !== '' && ! $this->db_select()) + { + log_message('error', 'Unable to select database: '.$this->database); + + return ($this->db_debug === TRUE) + ? $this->display_error('db_unable_to_select', $this->database) + : FALSE; + } + + // Determine how identifiers are escaped + $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi'); + $query = $query->row_array(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + // Note: Escaping is required in the event that the DB name + // contains reserved characters. + if (mssql_select_db('['.$database.']', $this->conn_id)) + { + $this->database = $database; + $this->data_cache = array(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return mixed resource if rows are returned, bool otherwise + */ + protected function _execute($sql) + { + return mssql_query($sql, $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return $this->simple_query('BEGIN TRAN'); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return $this->simple_query('COMMIT TRAN'); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return $this->simple_query('ROLLBACK TRAN'); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return mssql_rows_affected($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * Returns the last id created in the Identity column. + * + * @return string + */ + public function insert_id() + { + $query = version_compare($this->version(), '8', '>=') + ? 'SELECT SCOPE_IDENTITY() AS last_id' + : 'SELECT @@IDENTITY AS last_id'; + + $query = $this->query($query); + $query = $query->row(); + return $query->last_id; + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return (ini_set('mssql.charset', $charset) !== FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Version number query string + * + * @return string + */ + protected function _version() + { + return "SELECT SERVERPROPERTY('ProductVersion') AS ver"; + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT '.$this->escape_identifiers('name') + .' FROM '.$this->escape_identifiers('sysobjects') + .' WHERE '.$this->escape_identifiers('type')." = 'U'"; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + $sql .= ' AND '.$this->escape_identifiers('name')." LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql.' ORDER BY '.$this->escape_identifiers('name'); + } + + // -------------------------------------------------------------------- + + /** + * List column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + // We need this because the error info is discarded by the + // server the first time you request it, and query() already + // calls error() once for logging purposes when a query fails. + static $error = array('code' => 0, 'message' => NULL); + + $message = mssql_get_last_message(); + if ( ! empty($message)) + { + $error['code'] = $this->query('SELECT @@ERROR AS code')->row()->code; + $error['message'] = $message; + } + + return $error; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE TABLE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + return 'WITH ci_delete AS (SELECT TOP '.$this->qb_limit.' * FROM '.$table.$this->_compile_wh('qb_where').') DELETE FROM ci_delete'; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + $limit = $this->qb_offset + $this->qb_limit; + + // As of SQL Server 2005 (9.0.*) ROW_NUMBER() is supported, + // however an ORDER BY clause is required for it to work + if (version_compare($this->version(), '9', '>=') && $this->qb_offset && ! empty($this->qb_orderby)) + { + $orderby = $this->_compile_order_by(); + + // We have to strip the ORDER BY clause + $sql = trim(substr($sql, 0, strrpos($sql, $orderby))); + + // Get the fields to select from our subquery, so that we can avoid CI_rownum appearing in the actual results + if (count($this->qb_select) === 0 OR strpos(implode(',', $this->qb_select), '*') !== FALSE) + { + $select = '*'; // Inevitable + } + else + { + // Use only field names and their aliases, everything else is out of our scope. + $select = array(); + $field_regexp = ($this->_quoted_identifier) + ? '("[^\"]+")' : '(\[[^\]]+\])'; + for ($i = 0, $c = count($this->qb_select); $i < $c; $i++) + { + $select[] = preg_match('/(?:\s|\.)'.$field_regexp.'$/i', $this->qb_select[$i], $m) + ? $m[1] : $this->qb_select[$i]; + } + $select = implode(', ', $select); + } + + return 'SELECT '.$select." FROM (\n\n" + .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql) + ."\n\n) ".$this->escape_identifiers('CI_subquery') + ."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit; + } + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$limit.' ', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + // Multiple-value inserts are only supported as of SQL Server 2008 + if (version_compare($this->version(), '10', '>=')) + { + return parent::_insert_batch($table, $keys, $values); + } + + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + mssql_close($this->conn_id); + } + +} diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php new file mode 100755 index 0000000..6b61098 --- /dev/null +++ b/system/database/drivers/mssql/mssql_forge.php @@ -0,0 +1,151 @@ + 'SMALLINT', + 'SMALLINT' => 'INT', + 'INT' => 'BIGINT', + 'REAL' => 'FLOAT' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' ALTER COLUMN '; + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + $sqls[] = $sql.$this->_process_column($field[$i]); + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE) + { + unset($attributes['CONSTRAINT']); + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INTEGER': + $attributes['TYPE'] = 'INT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' IDENTITY(1,1)'; + } + } + +} diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php new file mode 100755 index 0000000..38a0a05 --- /dev/null +++ b/system/database/drivers/mssql/mssql_result.php @@ -0,0 +1,198 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = mssql_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return mssql_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + mssql_field_seek($this->result_id, 0); + while ($field = mssql_fetch_field($this->result_id)) + { + $field_names[] = $field->name; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field = mssql_fetch_field($this->result_id, $i); + + $retval[$i] = new stdClass(); + $retval[$i]->name = $field->name; + $retval[$i]->type = $field->type; + $retval[$i]->max_length = $field->max_length; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + mssql_free_result($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return mssql_data_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return mssql_fetch_assoc($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + $row = mssql_fetch_object($this->result_id); + + if ($class_name === 'stdClass' OR ! $row) + { + return $row; + } + + $class_name = new $class_name(); + foreach ($row as $key => $value) + { + $class_name->$key = $value; + } + + return $class_name; + } + +} diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php new file mode 100755 index 0000000..95ce88f --- /dev/null +++ b/system/database/drivers/mssql/mssql_utility.php @@ -0,0 +1,77 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/mysql/index.html b/system/database/drivers/mysql/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/mysql/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php new file mode 100755 index 0000000..71dad67 --- /dev/null +++ b/system/database/drivers/mysql/mysql_driver.php @@ -0,0 +1,494 @@ +port)) + { + $this->hostname .= ':'.$this->port; + } + } + + // -------------------------------------------------------------------- + + /** + * Non-persistent database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + $client_flags = ($this->compress === FALSE) ? 0 : MYSQL_CLIENT_COMPRESS; + + if ($this->encrypt === TRUE) + { + $client_flags = $client_flags | MYSQL_CLIENT_SSL; + } + + // Error suppression is necessary mostly due to PHP 5.5+ issuing E_DEPRECATED messages + $this->conn_id = ($persistent === TRUE) + ? mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags) + : mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags); + + // ---------------------------------------------------------------- + + // Select the DB... assuming a database name is specified in the config file + if ($this->database !== '' && ! $this->db_select()) + { + log_message('error', 'Unable to select database: '.$this->database); + + return ($this->db_debug === TRUE) + ? $this->display_error('db_unable_to_select', $this->database) + : FALSE; + } + + if (isset($this->stricton) && is_resource($this->conn_id)) + { + if ($this->stricton) + { + $this->simple_query('SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'); + } + else + { + $this->simple_query( + 'SET SESSION sql_mode = + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( + @@sql_mode, + "STRICT_ALL_TABLES,", ""), + ",STRICT_ALL_TABLES", ""), + "STRICT_ALL_TABLES", ""), + "STRICT_TRANS_TABLES,", ""), + ",STRICT_TRANS_TABLES", ""), + "STRICT_TRANS_TABLES", "")' + ); + } + } + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @return void + */ + public function reconnect() + { + if (mysql_ping($this->conn_id) === FALSE) + { + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + if (mysql_select_db($database, $this->conn_id)) + { + $this->database = $database; + $this->data_cache = array(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return mysql_set_charset($charset, $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if ( ! $this->conn_id OR ($version = mysql_get_server_info($this->conn_id)) === FALSE) + { + return FALSE; + } + + return $this->data_cache['version'] = $version; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return mixed + */ + protected function _execute($sql) + { + return mysql_query($this->_prep_query($sql), $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Prep the query + * + * If needed, each database adapter can prep the query string + * + * @param string $sql an SQL query + * @return string + */ + protected function _prep_query($sql) + { + // mysql_affected_rows() returns 0 for "DELETE FROM TABLE" queries. This hack + // modifies the query so that it a proper number of affected rows is returned. + if ($this->delete_hack === TRUE && preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) + { + return trim($sql).' WHERE 1=1'; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + $this->simple_query('SET AUTOCOMMIT=0'); + return $this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if ($this->simple_query('COMMIT')) + { + $this->simple_query('SET AUTOCOMMIT=1'); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if ($this->simple_query('ROLLBACK')) + { + $this->simple_query('SET AUTOCOMMIT=1'); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return mysql_real_escape_string($str, $this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return mysql_affected_rows($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return mysql_insert_id($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database); + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->Field; + + sscanf($query[$i]->Type, '%[a-z](%d)', + $retval[$i]->type, + $retval[$i]->max_length + ); + + $retval[$i]->default = $query[$i]->Default; + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => mysql_errno($this->conn_id), 'message' => mysql_error($this->conn_id)); + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + // Error suppression to avoid annoying E_WARNINGs in cases + // where the connection has already been closed for some reason. + @mysql_close($this->conn_id); + } + +} diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php new file mode 100755 index 0000000..7ed8f8d --- /dev/null +++ b/system/database/drivers/mysql/mysql_forge.php @@ -0,0 +1,243 @@ +db->char_set) && ! strpos($sql, 'CHARACTER SET') && ! strpos($sql, 'CHARSET')) + { + $sql .= ' DEFAULT CHARACTER SET = '.$this->db->char_set; + } + + if ( ! empty($this->db->dbcollat) && ! strpos($sql, 'COLLATE')) + { + $sql .= ' COLLATE = '.$this->db->dbcollat; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP') + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $field[$i] = ($alter_type === 'ADD') + ? "\n\tADD ".$field[$i]['_literal'] + : "\n\tMODIFY ".$field[$i]['_literal']; + } + else + { + if ($alter_type === 'ADD') + { + $field[$i]['_literal'] = "\n\tADD "; + } + else + { + $field[$i]['_literal'] = empty($field[$i]['new_name']) ? "\n\tMODIFY " : "\n\tCHANGE "; + } + + $field[$i] = $field[$i]['_literal'].$this->_process_column($field[$i]); + } + } + + return array($sql.implode(',', $field)); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment']) + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table (ignored) + * @return string + */ + protected function _process_indexes($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sql .= ",\n\tKEY ".$this->db->escape_identifiers(implode('_', $this->keys[$i])) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).')'; + } + + $this->keys = array(); + + return $sql; + } + +} diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php new file mode 100755 index 0000000..7aa265e --- /dev/null +++ b/system/database/drivers/mysql/mysql_result.php @@ -0,0 +1,199 @@ +num_rows = mysql_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of rows in the result set + * + * @return int + */ + public function num_rows() + { + return $this->num_rows; + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return mysql_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + mysql_field_seek($this->result_id, 0); + while ($field = mysql_fetch_field($this->result_id)) + { + $field_names[] = $field->name; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = mysql_field_name($this->result_id, $i); + $retval[$i]->type = mysql_field_type($this->result_id, $i); + $retval[$i]->max_length = mysql_field_len($this->result_id, $i); + $retval[$i]->primary_key = (int) (strpos(mysql_field_flags($this->result_id, $i), 'primary_key') !== FALSE); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + mysql_free_result($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return $this->num_rows + ? mysql_data_seek($this->result_id, $n) + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return mysql_fetch_assoc($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return mysql_fetch_object($this->result_id, $class_name); + } + +} diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php new file mode 100755 index 0000000..bc01fc5 --- /dev/null +++ b/system/database/drivers/mysql/mysql_utility.php @@ -0,0 +1,211 @@ +db->query('SHOW CREATE TABLE '.$this->db->escape_identifiers($this->db->database.'.'.$table)); + + // No result means the table name was invalid + if ($query === FALSE) + { + continue; + } + + // Write out the table schema + $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; + + if ($add_drop === TRUE) + { + $output .= 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table).';'.$newline.$newline; + } + + $i = 0; + $result = $query->result_array(); + foreach ($result[0] as $val) + { + if ($i++ % 2) + { + $output .= $val.';'.$newline.$newline; + } + } + + // If inserts are not needed we're done... + if ($add_insert === FALSE) + { + continue; + } + + // Grab all the data from the current table + $query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table)); + + if ($query->num_rows() === 0) + { + continue; + } + + // Fetch the field names and determine if the field is an + // integer type. We use this info to decide whether to + // surround the data with quotes or not + + $i = 0; + $field_str = ''; + $is_int = array(); + while ($field = mysql_fetch_field($query->result_id)) + { + // Most versions of MySQL store timestamp as a string + $is_int[$i] = in_array(strtolower(mysql_field_type($query->result_id, $i)), + array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'), + TRUE); + + // Create a string of field names + $field_str .= $this->db->escape_identifiers($field->name).', '; + $i++; + } + + // Trim off the end comma + $field_str = preg_replace('/, $/' , '', $field_str); + + // Build the insert string + foreach ($query->result_array() as $row) + { + $val_str = ''; + + $i = 0; + foreach ($row as $v) + { + // Is the value NULL? + if ($v === NULL) + { + $val_str .= 'NULL'; + } + else + { + // Escape the data if it's not an integer + $val_str .= ($is_int[$i] === FALSE) ? $this->db->escape($v) : $v; + } + + // Append a comma + $val_str .= ', '; + $i++; + } + + // Remove the comma at the end of the string + $val_str = preg_replace('/, $/' , '', $val_str); + + // Build the INSERT string + $output .= 'INSERT INTO '.$this->db->protect_identifiers($table).' ('.$field_str.') VALUES ('.$val_str.');'.$newline; + } + + $output .= $newline.$newline; + } + + // Do we need to include a statement to re-enable foreign key checks? + if ($foreign_key_checks === FALSE) + { + $output .= 'SET foreign_key_checks = 1;'.$newline; + } + + return $output; + } + +} diff --git a/system/database/drivers/mysqli/index.html b/system/database/drivers/mysqli/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/mysqli/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php new file mode 100755 index 0000000..b59e894 --- /dev/null +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -0,0 +1,544 @@ +hostname[0] === '/') + { + $hostname = NULL; + $port = NULL; + $socket = $this->hostname; + } + else + { + $hostname = ($persistent === TRUE) + ? 'p:'.$this->hostname : $this->hostname; + $port = empty($this->port) ? NULL : $this->port; + $socket = NULL; + } + + $client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0; + $this->_mysqli = mysqli_init(); + + $this->_mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10); + + if (isset($this->stricton)) + { + if ($this->stricton) + { + $this->_mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode = CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'); + } + else + { + $this->_mysqli->options(MYSQLI_INIT_COMMAND, + 'SET SESSION sql_mode = + REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( + @@sql_mode, + "STRICT_ALL_TABLES,", ""), + ",STRICT_ALL_TABLES", ""), + "STRICT_ALL_TABLES", ""), + "STRICT_TRANS_TABLES,", ""), + ",STRICT_TRANS_TABLES", ""), + "STRICT_TRANS_TABLES", "")' + ); + } + } + + if (is_array($this->encrypt)) + { + $ssl = array(); + empty($this->encrypt['ssl_key']) OR $ssl['key'] = $this->encrypt['ssl_key']; + empty($this->encrypt['ssl_cert']) OR $ssl['cert'] = $this->encrypt['ssl_cert']; + empty($this->encrypt['ssl_ca']) OR $ssl['ca'] = $this->encrypt['ssl_ca']; + empty($this->encrypt['ssl_capath']) OR $ssl['capath'] = $this->encrypt['ssl_capath']; + empty($this->encrypt['ssl_cipher']) OR $ssl['cipher'] = $this->encrypt['ssl_cipher']; + + if ( ! empty($ssl)) + { + if (isset($this->encrypt['ssl_verify'])) + { + if ($this->encrypt['ssl_verify']) + { + defined('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT') && $this->_mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, TRUE); + } + // Apparently (when it exists), setting MYSQLI_OPT_SSL_VERIFY_SERVER_CERT + // to FALSE didn't do anything, so PHP 5.6.16 introduced yet another + // constant ... + // + // https://secure.php.net/ChangeLog-5.php#5.6.16 + // https://bugs.php.net/bug.php?id=68344 + elseif (defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')) + { + $client_flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; + } + } + + $client_flags |= MYSQLI_CLIENT_SSL; + $this->_mysqli->ssl_set( + isset($ssl['key']) ? $ssl['key'] : NULL, + isset($ssl['cert']) ? $ssl['cert'] : NULL, + isset($ssl['ca']) ? $ssl['ca'] : NULL, + isset($ssl['capath']) ? $ssl['capath'] : NULL, + isset($ssl['cipher']) ? $ssl['cipher'] : NULL + ); + } + } + + if ($this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags)) + { + // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails + if ( + ($client_flags & MYSQLI_CLIENT_SSL) + && version_compare($this->_mysqli->client_info, '5.7.3', '<=') + && empty($this->_mysqli->query("SHOW STATUS LIKE 'ssl_cipher'")->fetch_object()->Value) + ) + { + $this->_mysqli->close(); + $message = 'MySQLi was configured for an SSL connection, but got an unencrypted connection instead!'; + log_message('error', $message); + return ($this->db_debug) ? $this->display_error($message, '', TRUE) : FALSE; + } + + return $this->_mysqli; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @return void + */ + public function reconnect() + { + if ($this->conn_id !== FALSE && $this->conn_id->ping() === FALSE) + { + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + if ($this->conn_id->select_db($database)) + { + $this->database = $database; + $this->data_cache = array(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return $this->conn_id->set_charset($charset); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + return $this->data_cache['version'] = $this->conn_id->server_info; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return mixed + */ + protected function _execute($sql) + { + return $this->conn_id->query($this->_prep_query($sql)); + } + + // -------------------------------------------------------------------- + + /** + * Prep the query + * + * If needed, each database adapter can prep the query string + * + * @param string $sql an SQL query + * @return string + */ + protected function _prep_query($sql) + { + // mysqli_affected_rows() returns 0 for "DELETE FROM TABLE" queries. This hack + // modifies the query so that it a proper number of affected rows is returned. + if ($this->delete_hack === TRUE && preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sql)) + { + return trim($sql).' WHERE 1=1'; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + $this->conn_id->autocommit(FALSE); + return is_php('5.5') + ? $this->conn_id->begin_transaction() + : $this->simple_query('START TRANSACTION'); // can also be BEGIN or BEGIN WORK + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if ($this->conn_id->commit()) + { + $this->conn_id->autocommit(TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if ($this->conn_id->rollback()) + { + $this->conn_id->autocommit(TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return $this->conn_id->real_escape_string($str); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return $this->conn_id->affected_rows; + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return $this->conn_id->insert_id; + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database); + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->Field; + + sscanf($query[$i]->Type, '%[a-z](%d)', + $retval[$i]->type, + $retval[$i]->max_length + ); + + $retval[$i]->default = $query[$i]->Default; + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + if ( ! empty($this->_mysqli->connect_errno)) + { + return array( + 'code' => $this->_mysqli->connect_errno, + 'message' => $this->_mysqli->connect_error + ); + } + + return array('code' => $this->conn_id->errno, 'message' => $this->conn_id->error); + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + $this->conn_id->close(); + } + +} diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php new file mode 100755 index 0000000..c5b23b6 --- /dev/null +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -0,0 +1,244 @@ +db->char_set) && ! strpos($sql, 'CHARACTER SET') && ! strpos($sql, 'CHARSET')) + { + $sql .= ' DEFAULT CHARACTER SET = '.$this->db->char_set; + } + + if ( ! empty($this->db->dbcollat) && ! strpos($sql, 'COLLATE')) + { + $sql .= ' COLLATE = '.$this->db->dbcollat; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP') + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $field[$i] = ($alter_type === 'ADD') + ? "\n\tADD ".$field[$i]['_literal'] + : "\n\tMODIFY ".$field[$i]['_literal']; + } + else + { + if ($alter_type === 'ADD') + { + $field[$i]['_literal'] = "\n\tADD "; + } + else + { + $field[$i]['_literal'] = empty($field[$i]['new_name']) ? "\n\tMODIFY " : "\n\tCHANGE "; + } + + $field[$i] = $field[$i]['_literal'].$this->_process_column($field[$i]); + } + } + + return array($sql.implode(',', $field)); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment']) + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table (ignored) + * @return string + */ + protected function _process_indexes($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sql .= ",\n\tKEY ".$this->db->escape_identifiers(implode('_', $this->keys[$i])) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).')'; + } + + $this->keys = array(); + + return $sql; + } + +} diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php new file mode 100755 index 0000000..0b3d9c2 --- /dev/null +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -0,0 +1,240 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = $this->result_id->num_rows; + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return $this->result_id->field_count; + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + $this->result_id->field_seek(0); + while ($field = $this->result_id->fetch_field()) + { + $field_names[] = $field->name; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + $field_data = $this->result_id->fetch_fields(); + for ($i = 0, $c = count($field_data); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $field_data[$i]->name; + $retval[$i]->type = static::_get_field_type($field_data[$i]->type); + $retval[$i]->max_length = $field_data[$i]->max_length; + $retval[$i]->primary_key = (int) ($field_data[$i]->flags & MYSQLI_PRI_KEY_FLAG); + $retval[$i]->default = $field_data[$i]->def; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Get field type + * + * Extracts field type info from the bitflags returned by + * mysqli_result::fetch_fields() + * + * @used-by CI_DB_mysqli_result::field_data() + * @param int $flags + * @return string + */ + private static function _get_field_type($flags) + { + static $map; + isset($map) OR $map = array( + MYSQLI_TYPE_DECIMAL => 'decimal', + MYSQLI_TYPE_BIT => 'bit', + MYSQLI_TYPE_TINY => 'tinyint', + MYSQLI_TYPE_SHORT => 'smallint', + MYSQLI_TYPE_INT24 => 'mediumint', + MYSQLI_TYPE_LONG => 'int', + MYSQLI_TYPE_LONGLONG => 'bigint', + MYSQLI_TYPE_FLOAT => 'float', + MYSQLI_TYPE_DOUBLE => 'double', + MYSQLI_TYPE_TIMESTAMP => 'timestamp', + MYSQLI_TYPE_DATE => 'date', + MYSQLI_TYPE_TIME => 'time', + MYSQLI_TYPE_DATETIME => 'datetime', + MYSQLI_TYPE_YEAR => 'year', + MYSQLI_TYPE_NEWDATE => 'date', + MYSQLI_TYPE_INTERVAL => 'interval', + MYSQLI_TYPE_ENUM => 'enum', + MYSQLI_TYPE_SET => 'set', + MYSQLI_TYPE_TINY_BLOB => 'tinyblob', + MYSQLI_TYPE_MEDIUM_BLOB => 'mediumblob', + MYSQLI_TYPE_BLOB => 'blob', + MYSQLI_TYPE_LONG_BLOB => 'longblob', + MYSQLI_TYPE_STRING => 'char', + MYSQLI_TYPE_VAR_STRING => 'varchar', + MYSQLI_TYPE_GEOMETRY => 'geometry' + ); + + foreach ($map as $flag => $name) + { + if ($flags & $flag) + { + return $name; + } + } + + return $flags; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_object($this->result_id)) + { + $this->result_id->free(); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return $this->result_id->data_seek($n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return $this->result_id->fetch_assoc(); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return $this->result_id->fetch_object($class_name); + } + +} diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php new file mode 100755 index 0000000..1699b61 --- /dev/null +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -0,0 +1,215 @@ +db->query('SHOW CREATE TABLE '.$this->db->escape_identifiers($this->db->database.'.'.$table)); + + // No result means the table name was invalid + if ($query === FALSE) + { + continue; + } + + // Write out the table schema + $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; + + if ($add_drop === TRUE) + { + $output .= 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table).';'.$newline.$newline; + } + + $i = 0; + $result = $query->result_array(); + foreach ($result[0] as $val) + { + if ($i++ % 2) + { + $output .= $val.';'.$newline.$newline; + } + } + + // If inserts are not needed we're done... + if ($add_insert === FALSE) + { + continue; + } + + // Grab all the data from the current table + $query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table)); + + if ($query->num_rows() === 0) + { + continue; + } + + // Fetch the field names and determine if the field is an + // integer type. We use this info to decide whether to + // surround the data with quotes or not + + $i = 0; + $field_str = ''; + $is_int = array(); + while ($field = $query->result_id->fetch_field()) + { + // Most versions of MySQL store timestamp as a string + $is_int[$i] = ($field->type & MYSQLI_TYPE_TINY) + OR ($field->type & MYSQLI_TYPE_SHORT) + OR ($field->type & MYSQLI_TYPE_INT24) + OR ($field->type & MYSQLI_TYPE_LONG) + OR ($field->type & MYSQLI_TYPE_LONGLONG); + + // Create a string of field names + $field_str .= $this->db->escape_identifiers($field->name).', '; + $i++; + } + + // Trim off the end comma + $field_str = preg_replace('/, $/' , '', $field_str); + + // Build the insert string + foreach ($query->result_array() as $row) + { + $val_str = ''; + + $i = 0; + foreach ($row as $v) + { + // Is the value NULL? + if ($v === NULL) + { + $val_str .= 'NULL'; + } + else + { + // Escape the data if it's not an integer + $val_str .= ($is_int[$i] === FALSE) ? $this->db->escape($v) : $v; + } + + // Append a comma + $val_str .= ', '; + $i++; + } + + // Remove the comma at the end of the string + $val_str = preg_replace('/, $/' , '', $val_str); + + // Build the INSERT string + $output .= 'INSERT INTO '.$this->db->protect_identifiers($table).' ('.$field_str.') VALUES ('.$val_str.');'.$newline; + } + + $output .= $newline.$newline; + } + + // Do we need to include a statement to re-enable foreign key checks? + if ($foreign_key_checks === FALSE) + { + $output .= 'SET foreign_key_checks = 1;'.$newline; + } + + return $output; + } + +} diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/oci8/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php new file mode 100755 index 0000000..fb2f6b3 --- /dev/null +++ b/system/database/drivers/oci8/oci8_driver.php @@ -0,0 +1,688 @@ + '/^\(DESCRIPTION=(\(.+\)){2,}\)$/', // TNS + // Easy Connect string (Oracle 10g+) + 'ec' => '/^(\/\/)?[a-z0-9.:_-]+(:[1-9][0-9]{0,4})?(\/[a-z0-9$_]+)?(:[^\/])?(\/[a-z0-9$_]+)?$/i', + 'in' => '/^[a-z0-9$_]+$/i' // Instance name (defined in tnsnames.ora) + ); + + /* Space characters don't have any effect when actually + * connecting, but can be a hassle while validating the DSN. + */ + $this->dsn = str_replace(array("\n", "\r", "\t", ' '), '', $this->dsn); + + if ($this->dsn !== '') + { + foreach ($valid_dsns as $regexp) + { + if (preg_match($regexp, $this->dsn)) + { + return; + } + } + } + + // Legacy support for TNS in the hostname configuration field + $this->hostname = str_replace(array("\n", "\r", "\t", ' '), '', $this->hostname); + if (preg_match($valid_dsns['tns'], $this->hostname)) + { + $this->dsn = $this->hostname; + return; + } + elseif ($this->hostname !== '' && strpos($this->hostname, '/') === FALSE && strpos($this->hostname, ':') === FALSE + && (( ! empty($this->port) && ctype_digit($this->port)) OR $this->database !== '')) + { + /* If the hostname field isn't empty, doesn't contain + * ':' and/or '/' and if port and/or database aren't + * empty, then the hostname field is most likely indeed + * just a hostname. Therefore we'll try and build an + * Easy Connect string from these 3 settings, assuming + * that the database field is a service name. + */ + $this->dsn = $this->hostname + .(( ! empty($this->port) && ctype_digit($this->port)) ? ':'.$this->port : '') + .($this->database !== '' ? '/'.ltrim($this->database, '/') : ''); + + if (preg_match($valid_dsns['ec'], $this->dsn)) + { + return; + } + } + + /* At this point, we can only try and validate the hostname and + * database fields separately as DSNs. + */ + if (preg_match($valid_dsns['ec'], $this->hostname) OR preg_match($valid_dsns['in'], $this->hostname)) + { + $this->dsn = $this->hostname; + return; + } + + $this->database = str_replace(array("\n", "\r", "\t", ' '), '', $this->database); + foreach ($valid_dsns as $regexp) + { + if (preg_match($regexp, $this->database)) + { + return; + } + } + + /* Well - OK, an empty string should work as well. + * PHP will try to use environment variables to + * determine which Oracle instance to connect to. + */ + $this->dsn = ''; + } + + // -------------------------------------------------------------------- + + /** + * Non-persistent database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + $func = ($persistent === TRUE) ? 'oci_pconnect' : 'oci_connect'; + return empty($this->char_set) + ? $func($this->username, $this->password, $this->dsn) + : $func($this->username, $this->password, $this->dsn, $this->char_set); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if ( ! $this->conn_id OR ($version_string = oci_server_version($this->conn_id)) === FALSE) + { + return FALSE; + } + elseif (preg_match('#Release\s(\d+(?:\.\d+)+)#', $version_string, $match)) + { + return $this->data_cache['version'] = $match[1]; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + /* Oracle must parse the query before it is run. All of the actions with + * the query are based on the statement id returned by oci_parse(). + */ + if ($this->_reset_stmt_id === TRUE) + { + $this->stmt_id = oci_parse($this->conn_id, $sql); + } + + oci_set_prefetch($this->stmt_id, 1000); + return oci_execute($this->stmt_id, $this->commit_mode); + } + + // -------------------------------------------------------------------- + + /** + * Get cursor. Returns a cursor from the database + * + * @return resource + */ + public function get_cursor() + { + return $this->curs_id = oci_new_cursor($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Stored Procedure. Executes a stored procedure + * + * @param string package name in which the stored procedure is in + * @param string stored procedure name to execute + * @param array parameters + * @return mixed + * + * params array keys + * + * KEY OPTIONAL NOTES + * name no the name of the parameter should be in : format + * value no the value of the parameter. If this is an OUT or IN OUT parameter, + * this should be a reference to a variable + * type yes the type of the parameter + * length yes the max size of the parameter + */ + public function stored_procedure($package, $procedure, array $params) + { + if ($package === '' OR $procedure === '') + { + log_message('error', 'Invalid query: '.$package.'.'.$procedure); + return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; + } + + // Build the query string + $sql = 'BEGIN '.$package.'.'.$procedure.'('; + + $have_cursor = FALSE; + foreach ($params as $param) + { + $sql .= $param['name'].','; + + if (isset($param['type']) && $param['type'] === OCI_B_CURSOR) + { + $have_cursor = TRUE; + } + } + $sql = trim($sql, ',').'); END;'; + + $this->_reset_stmt_id = FALSE; + $this->stmt_id = oci_parse($this->conn_id, $sql); + $this->_bind_params($params); + $result = $this->query($sql, FALSE, $have_cursor); + $this->_reset_stmt_id = TRUE; + return $result; + } + + // -------------------------------------------------------------------- + + /** + * Bind parameters + * + * @param array $params + * @return void + */ + protected function _bind_params($params) + { + if ( ! is_array($params) OR ! is_resource($this->stmt_id)) + { + return; + } + + foreach ($params as $param) + { + foreach (array('name', 'value', 'type', 'length') as $val) + { + if ( ! isset($param[$val])) + { + $param[$val] = ''; + } + } + + oci_bind_by_name($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); + } + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + $this->commit_mode = OCI_NO_AUTO_COMMIT; + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + $this->commit_mode = OCI_COMMIT_ON_SUCCESS; + + return oci_commit($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + $this->commit_mode = OCI_COMMIT_ON_SUCCESS; + return oci_rollback($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return oci_num_rows($this->stmt_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + // not supported in oracle + return $this->display_error('db_unsupported_function'); + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "TABLE_NAME" FROM "ALL_TABLES"'; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql.' WHERE "TABLE_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + if (strpos($table, '.') !== FALSE) + { + sscanf($table, '%[^.].%s', $owner, $table); + } + else + { + $owner = $this->username; + } + + return 'SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS + WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).' + AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (strpos($table, '.') !== FALSE) + { + sscanf($table, '%[^.].%s', $owner, $table); + } + else + { + $owner = $this->username; + } + + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHAR_LENGTH, DATA_PRECISION, DATA_LENGTH, DATA_DEFAULT, NULLABLE + FROM ALL_TAB_COLUMNS + WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).' + AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + + $length = ($query[$i]->CHAR_LENGTH > 0) + ? $query[$i]->CHAR_LENGTH : $query[$i]->DATA_PRECISION; + if ($length === NULL) + { + $length = $query[$i]->DATA_LENGTH; + } + $retval[$i]->max_length = $length; + + $default = $query[$i]->DATA_DEFAULT; + if ($default === NULL && $query[$i]->NULLABLE === 'N') + { + $default = ''; + } + $retval[$i]->default = $default; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + // oci_error() returns an array that already contains + // 'code' and 'message' keys, but it can return false + // if there was no error .... + if (is_resource($this->curs_id)) + { + $error = oci_error($this->curs_id); + } + elseif (is_resource($this->stmt_id)) + { + $error = oci_error($this->stmt_id); + } + elseif (is_resource($this->conn_id)) + { + $error = oci_error($this->conn_id); + } + else + { + $error = oci_error(); + } + + return is_array($error) + ? $error + : array('code' => '', 'message' => ''); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _insert_batch($table, $keys, $values) + { + $keys = implode(', ', $keys); + $sql = "INSERT ALL\n"; + + for ($i = 0, $c = count($values); $i < $c; $i++) + { + $sql .= ' INTO '.$table.' ('.$keys.') VALUES '.$values[$i]."\n"; + } + + return $sql.'SELECT * FROM dual'; + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE TABLE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + $this->where('rownum <= ',$this->qb_limit, FALSE); + $this->qb_limit = FALSE; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + if (version_compare($this->version(), '12.1', '>=')) + { + // OFFSET-FETCH can be used only with the ORDER BY clause + empty($this->qb_orderby) && $sql .= ' ORDER BY 1'; + + return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY'; + } + + $this->limit_used = TRUE; + return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')' + .($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1) : ''); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + oci_close($this->conn_id); + } + +} diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php new file mode 100755 index 0000000..724a76d --- /dev/null +++ b/system/database/drivers/oci8/oci8_forge.php @@ -0,0 +1,187 @@ +db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $field[$i] = "\n\t".$field[$i]['_literal']; + } + else + { + $field[$i]['_literal'] = "\n\t".$this->_process_column($field[$i]); + + if ( ! empty($field[$i]['comment'])) + { + $sqls[] = 'COMMENT ON COLUMN ' + .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name']) + .' IS '.$field[$i]['comment']; + } + + if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + + $field[$i] = "\n\t".$field[$i]['_literal']; + } + } + + $sql .= ' '.$alter_type.' '; + $sql .= (count($field) === 1) + ? $field[0] + : '('.implode(',', $field).')'; + + // RENAME COLUMN must be executed after MODIFY + array_unshift($sqls, $sql); + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported - sequences and triggers must be used instead + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'INT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'NUMBER'; + return; + default: return; + } + } +} diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php new file mode 100755 index 0000000..0c35433 --- /dev/null +++ b/system/database/drivers/oci8/oci8_result.php @@ -0,0 +1,229 @@ +stmt_id = $driver_object->stmt_id; + $this->curs_id = $driver_object->curs_id; + $this->limit_used = $driver_object->limit_used; + $this->commit_mode =& $driver_object->commit_mode; + $driver_object->stmt_id = FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + $count = oci_num_fields($this->stmt_id); + + // if we used a limit we subtract it + return ($this->limit_used) ? $count - 1 : $count; + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) + { + $field_names[] = oci_field_name($this->stmt_id, $c); + } + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) + { + $F = new stdClass(); + $F->name = oci_field_name($this->stmt_id, $c); + $F->type = oci_field_type($this->stmt_id, $c); + $F->max_length = oci_field_size($this->stmt_id, $c); + + $retval[] = $F; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + oci_free_statement($this->result_id); + $this->result_id = FALSE; + } + + if (is_resource($this->stmt_id)) + { + oci_free_statement($this->stmt_id); + } + + if (is_resource($this->curs_id)) + { + oci_cancel($this->curs_id); + $this->curs_id = NULL; + } + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; + return oci_fetch_assoc($id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + $row = ($this->curs_id) + ? oci_fetch_object($this->curs_id) + : oci_fetch_object($this->stmt_id); + + if ($class_name === 'stdClass' OR ! $row) + { + return $row; + } + + $class_name = new $class_name(); + foreach ($row as $key => $value) + { + $class_name->$key = $value; + } + + return $class_name; + } + +} diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php new file mode 100755 index 0000000..ce0dfc5 --- /dev/null +++ b/system/database/drivers/oci8/oci8_utility.php @@ -0,0 +1,68 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/odbc/index.html b/system/database/drivers/odbc/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/odbc/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php new file mode 100755 index 0000000..ef982fc --- /dev/null +++ b/system/database/drivers/odbc/odbc_driver.php @@ -0,0 +1,425 @@ +dsn)) + { + $this->dsn = $this->hostname; + } + } + + // -------------------------------------------------------------------- + + /** + * Non-persistent database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + return ($persistent === TRUE) + ? odbc_pconnect($this->dsn, $this->username, $this->password) + : odbc_connect($this->dsn, $this->username, $this->password); + } + + // -------------------------------------------------------------------- + + /** + * Compile Bindings + * + * @param string $sql SQL statement + * @param array $binds An array of values to bind + * @return string + */ + public function compile_binds($sql, $binds) + { + if (empty($binds) OR empty($this->bind_marker) OR strpos($sql, $this->bind_marker) === FALSE) + { + return $sql; + } + elseif ( ! is_array($binds)) + { + $binds = array($binds); + $bind_count = 1; + } + else + { + // Make sure we're using numeric keys + $binds = array_values($binds); + $bind_count = count($binds); + } + + // We'll need the marker length later + $ml = strlen($this->bind_marker); + + // Make sure not to replace a chunk inside a string that happens to match the bind marker + if ($c = preg_match_all("/'[^']*'|\"[^\"]*\"/i", $sql, $matches)) + { + $c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', + str_replace($matches[0], + str_replace($this->bind_marker, str_repeat(' ', $ml), $matches[0]), + $sql, $c), + $matches, PREG_OFFSET_CAPTURE); + + // Bind values' count must match the count of markers in the query + if ($bind_count !== $c) + { + return $sql; + } + } + elseif (($c = preg_match_all('/'.preg_quote($this->bind_marker, '/').'/i', $sql, $matches, PREG_OFFSET_CAPTURE)) !== $bind_count) + { + return $sql; + } + + if ($this->bind_marker !== '?') + { + do + { + $c--; + $sql = substr_replace($sql, '?', $matches[0][$c][1], $ml); + } + while ($c !== 0); + } + + if (FALSE !== ($this->odbc_result = odbc_prepare($this->conn_id, $sql))) + { + $this->binds = array_values($binds); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + if ( ! isset($this->odbc_result)) + { + return odbc_exec($this->conn_id, $sql); + } + elseif ($this->odbc_result === FALSE) + { + return FALSE; + } + + if (TRUE === ($success = odbc_execute($this->odbc_result, $this->binds))) + { + // For queries that return result sets, return the result_id resource on success + $this->is_write_type($sql) OR $success = $this->odbc_result; + } + + $this->odbc_result = NULL; + $this->binds = array(); + + return $success; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return odbc_autocommit($this->conn_id, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if (odbc_commit($this->conn_id)) + { + odbc_autocommit($this->conn_id, TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if (odbc_rollback($this->conn_id)) + { + odbc_autocommit($this->conn_id, TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Determines if a query is a "write" type. + * + * @param string An SQL query string + * @return bool + */ + public function is_write_type($sql) + { + if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#is', $sql)) + { + return FALSE; + } + + return parent::is_write_type($sql); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + $this->display_error('db_unsupported_feature'); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return odbc_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return bool + */ + public function insert_id() + { + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '".$this->schema."'"; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql." AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @param string $table + * @return string + */ + protected function _field_data($table) + { + return 'SELECT TOP 1 FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => odbc_error($this->conn_id), 'message' => odbc_errormsg($this->conn_id)); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + odbc_close($this->conn_id); + } +} diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php new file mode 100755 index 0000000..77b2fdf --- /dev/null +++ b/system/database/drivers/odbc/odbc_forge.php @@ -0,0 +1,86 @@ +num_rows)) + { + return $this->num_rows; + } + elseif (($this->num_rows = odbc_num_rows($this->result_id)) !== -1) + { + return $this->num_rows; + } + + // Work-around for ODBC subdrivers that don't support num_rows() + if (count($this->result_array) > 0) + { + return $this->num_rows = count($this->result_array); + } + elseif (count($this->result_object) > 0) + { + return $this->num_rows = count($this->result_object); + } + + return $this->num_rows = count($this->result_array()); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return odbc_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + $num_fields = $this->num_fields(); + + if ($num_fields > 0) + { + for ($i = 1; $i <= $num_fields; $i++) + { + $field_names[] = odbc_field_name($this->result_id, $i); + } + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $odbc_index = 1, $c = $this->num_fields(); $i < $c; $i++, $odbc_index++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = odbc_field_name($this->result_id, $odbc_index); + $retval[$i]->type = odbc_field_type($this->result_id, $odbc_index); + $retval[$i]->max_length = odbc_field_len($this->result_id, $odbc_index); + $retval[$i]->primary_key = 0; + $retval[$i]->default = ''; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + odbc_free_result($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return odbc_fetch_array($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + $row = odbc_fetch_object($this->result_id); + + if ($class_name === 'stdClass' OR ! $row) + { + return $row; + } + + $class_name = new $class_name(); + foreach ($row as $key => $value) + { + $class_name->$key = $value; + } + + return $class_name; + } + +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('odbc_fetch_array')) +{ + /** + * ODBC Fetch array + * + * Emulates the native odbc_fetch_array() function when + * it is not available (odbc_fetch_array() requires unixODBC) + * + * @param resource &$result + * @param int $rownumber + * @return array + */ + function odbc_fetch_array(&$result, $rownumber = 1) + { + $rs = array(); + if ( ! odbc_fetch_into($result, $rs, $rownumber)) + { + return FALSE; + } + + $rs_assoc = array(); + foreach ($rs as $k => $v) + { + $field_name = odbc_field_name($result, $k+1); + $rs_assoc[$field_name] = $v; + } + + return $rs_assoc; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('odbc_fetch_object')) +{ + /** + * ODBC Fetch object + * + * Emulates the native odbc_fetch_object() function when + * it is not available. + * + * @param resource &$result + * @param int $rownumber + * @return object + */ + function odbc_fetch_object(&$result, $rownumber = 1) + { + $rs = array(); + if ( ! odbc_fetch_into($result, $rs, $rownumber)) + { + return FALSE; + } + + $rs_object = new stdClass(); + foreach ($rs as $k => $v) + { + $field_name = odbc_field_name($result, $k+1); + $rs_object->$field_name = $v; + } + + return $rs_object; + } +} diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php new file mode 100755 index 0000000..643f6ec --- /dev/null +++ b/system/database/drivers/odbc/odbc_utility.php @@ -0,0 +1,63 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/pdo/index.html b/system/database/drivers/pdo/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/pdo/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php new file mode 100755 index 0000000..6afc999 --- /dev/null +++ b/system/database/drivers/pdo/pdo_driver.php @@ -0,0 +1,329 @@ +dsn, $match) && count($match) === 2) + { + // If there is a minimum valid dsn string pattern found, we're done + // This is for general PDO users, who tend to have a full DSN string. + $this->subdriver = $match[1]; + return; + } + // Legacy support for DSN specified in the hostname field + elseif (preg_match('/([^:]+):/', $this->hostname, $match) && count($match) === 2) + { + $this->dsn = $this->hostname; + $this->hostname = NULL; + $this->subdriver = $match[1]; + return; + } + elseif (in_array($this->subdriver, array('mssql', 'sybase'), TRUE)) + { + $this->subdriver = 'dblib'; + } + elseif ($this->subdriver === '4D') + { + $this->subdriver = '4d'; + } + elseif ( ! in_array($this->subdriver, array('4d', 'cubrid', 'dblib', 'firebird', 'ibm', 'informix', 'mysql', 'oci', 'odbc', 'pgsql', 'sqlite', 'sqlsrv'), TRUE)) + { + log_message('error', 'PDO: Invalid or non-existent subdriver'); + + if ($this->db_debug) + { + show_error('Invalid or non-existent PDO subdriver'); + } + } + + $this->dsn = NULL; + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return object + */ + public function db_connect($persistent = FALSE) + { + if ($persistent === TRUE) + { + $this->options[PDO::ATTR_PERSISTENT] = TRUE; + } + + try + { + return new PDO($this->dsn, $this->username, $this->password, $this->options); + } + catch (PDOException $e) + { + if ($this->db_debug && empty($this->failover)) + { + $this->display_error($e->getMessage(), '', TRUE); + } + + return FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + // Not all subdrivers support the getAttribute() method + try + { + return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); + } + catch (PDOException $e) + { + return parent::version(); + } + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql SQL query + * @return mixed + */ + protected function _execute($sql) + { + return $this->conn_id->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return $this->conn_id->beginTransaction(); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return $this->conn_id->commit(); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return $this->conn_id->rollBack(); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + // Escape the string + $str = $this->conn_id->quote($str); + + // If there are duplicated quotes, trim them away + return ($str[0] === "'") + ? substr($str, 1, -1) + : $str; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return is_object($this->result_id) ? $this->result_id->rowCount() : 0; + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @param string $name + * @return int + */ + public function insert_id($name = NULL) + { + return $this->conn_id->lastInsertId($name); + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @param string $table + * @return string + */ + protected function _field_data($table) + { + return 'SELECT TOP 1 * FROM '.$this->protect_identifiers($table); + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + $error = array('code' => '00000', 'message' => ''); + $pdo_error = $this->conn_id->errorInfo(); + + if (empty($pdo_error[0])) + { + return $error; + } + + $error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0]; + if (isset($pdo_error[2])) + { + $error['message'] = $pdo_error[2]; + } + + return $error; + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE TABLE '.$table; + } + +} diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php new file mode 100755 index 0000000..685b677 --- /dev/null +++ b/system/database/drivers/pdo/pdo_forge.php @@ -0,0 +1,65 @@ +num_rows)) + { + return $this->num_rows; + } + elseif (count($this->result_array) > 0) + { + return $this->num_rows = count($this->result_array); + } + elseif (count($this->result_object) > 0) + { + return $this->num_rows = count($this->result_object); + } + elseif (($num_rows = $this->result_id->rowCount()) > 0) + { + return $this->num_rows = $num_rows; + } + + return $this->num_rows = count($this->result_array()); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return $this->result_id->columnCount(); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return bool + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + // Might trigger an E_WARNING due to not all subdrivers + // supporting getColumnMeta() + $field_names[$i] = @$this->result_id->getColumnMeta($i); + $field_names[$i] = $field_names[$i]['name']; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + try + { + $retval = array(); + + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field = $this->result_id->getColumnMeta($i); + + $retval[$i] = new stdClass(); + $retval[$i]->name = $field['name']; + $retval[$i]->type = $field['native_type']; + $retval[$i]->max_length = ($field['len'] > 0) ? $field['len'] : NULL; + $retval[$i]->primary_key = (int) ( ! empty($field['flags']) && in_array('primary_key', $field['flags'], TRUE)); + } + + return $retval; + } + catch (Exception $e) + { + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsupported_feature'); + } + + return FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_object($this->result_id)) + { + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return $this->result_id->fetch(PDO::FETCH_ASSOC); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return $this->result_id->fetchObject($class_name); + } + +} diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php new file mode 100755 index 0000000..5029cac --- /dev/null +++ b/system/database/drivers/pdo/pdo_utility.php @@ -0,0 +1,63 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/index.html b/system/database/drivers/pdo/subdrivers/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php new file mode 100755 index 0000000..7eaeaa1 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php @@ -0,0 +1,200 @@ +dsn)) + { + $this->dsn = '4D:host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + empty($this->port) OR $this->dsn .= ';port='.$this->port; + empty($this->database) OR $this->dsn .= ';dbname='.$this->database; + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + } + elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 3) === FALSE) + { + $this->dsn .= ';charset='.$this->char_set; + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT '.$this->escape_identifiers('TABLE_NAME').' FROM '.$this->escape_identifiers('_USER_TABLES'); + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' WHERE '.$this->escape_identifiers('TABLE_NAME')." LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT '.$this->escape_identifiers('COLUMN_NAME').' FROM '.$this->escape_identifiers('_USER_COLUMNS') + .' WHERE '.$this->escape_identifiers('TABLE_NAME').' = '.$this->escape($table); + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @param string $table + * @return string + */ + protected function _field_data($table) + { + return 'SELECT * FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE).' LIMIT 1'; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + return $sql.' LIMIT '.$this->qb_limit.($this->qb_offset ? ' OFFSET '.$this->qb_offset : ''); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php new file mode 100755 index 0000000..3f636d3 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php @@ -0,0 +1,217 @@ + 'INT', + 'SMALLINT' => 'INT', + 'INT' => 'INT64', + 'INT32' => 'INT64' + ); + + /** + * DEFAULT value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_default = FALSE; + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + // No method of modifying columns is supported + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'].$field['length'] + .$field['null'] + .$field['unique'] + .$field['auto_increment']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INTEGER': + $attributes['TYPE'] = 'INT'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'INT64'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute UNIQUE + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_unique(&$attributes, &$field) + { + if ( ! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === TRUE) + { + $field['unique'] = ' UNIQUE'; + + // UNIQUE must be used with NOT NULL + $field['null'] = ' NOT NULL'; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) + { + if (stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' AUTO_INCREMENT'; + } + elseif (strcasecmp($field['type'], 'UUID') === 0) + { + $field['auto_increment'] = ' AUTO_GENERATE'; + } + } + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php new file mode 100755 index 0000000..fc49e0d --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php @@ -0,0 +1,209 @@ +dsn)) + { + $this->dsn = 'cubrid:host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + empty($this->port) OR $this->dsn .= ';port='.$this->port; + empty($this->database) OR $this->dsn .= ';dbname='.$this->database; + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SHOW TABLES'; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->Field; + + sscanf($query[$i]->Type, '%[a-z](%d)', + $retval[$i]->type, + $retval[$i]->max_length + ); + + $retval[$i]->default = $query[$i]->Default; + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php new file mode 100755 index 0000000..276cbb6 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php @@ -0,0 +1,230 @@ + 'INTEGER', + 'SMALLINT' => 'INTEGER', + 'INT' => 'BIGINT', + 'INTEGER' => 'BIGINT', + 'BIGINT' => 'NUMERIC', + 'FLOAT' => 'DOUBLE', + 'REAL' => 'DOUBLE' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $sqls[] = $sql.' CHANGE '.$field[$i]['_literal']; + } + else + { + $alter_type = empty($field[$i]['new_name']) ? ' MODIFY ' : ' CHANGE '; + $sqls[] = $sql.$alter_type.$this->_process_column($field[$i]); + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'LONGTEXT': + $attributes['TYPE'] = 'STRING'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table (ignored) + * @return string + */ + protected function _process_indexes($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sql .= ",\n\tKEY ".$this->db->escape_identifiers(implode('_', $this->keys[$i])) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).')'; + } + + $this->keys = array(); + + return $sql; + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php new file mode 100755 index 0000000..b9b86f7 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -0,0 +1,353 @@ +dsn)) + { + $this->dsn = $params['subdriver'].':host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + if ( ! empty($this->port)) + { + $this->dsn .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':').$this->port; + } + + empty($this->database) OR $this->dsn .= ';dbname='.$this->database; + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + empty($this->appname) OR $this->dsn .= ';appname='.$this->appname; + } + else + { + if ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE) + { + $this->dsn .= ';charset='.$this->char_set; + } + + $this->subdriver = 'dblib'; + } + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return object + */ + public function db_connect($persistent = FALSE) + { + if ($persistent === TRUE) + { + log_message('debug', "dblib driver doesn't support persistent connections"); + } + + $this->conn_id = parent::db_connect(FALSE); + + if ( ! is_object($this->conn_id)) + { + return $this->conn_id; + } + + // Determine how identifiers are escaped + $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi'); + $query = $query->row_array(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT '.$this->escape_identifiers('name') + .' FROM '.$this->escape_identifiers('sysobjects') + .' WHERE '.$this->escape_identifiers('type')." = 'U'"; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' AND '.$this->escape_identifiers('name')." LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql.' ORDER BY '.$this->escape_identifiers('name'); + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + return 'WITH ci_delete AS (SELECT TOP '.$this->qb_limit.' * FROM '.$table.$this->_compile_wh('qb_where').') DELETE FROM ci_delete'; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + $limit = $this->qb_offset + $this->qb_limit; + + // As of SQL Server 2005 (9.0.*) ROW_NUMBER() is supported, + // however an ORDER BY clause is required for it to work + if (version_compare($this->version(), '9', '>=') && $this->qb_offset && ! empty($this->qb_orderby)) + { + $orderby = $this->_compile_order_by(); + + // We have to strip the ORDER BY clause + $sql = trim(substr($sql, 0, strrpos($sql, $orderby))); + + // Get the fields to select from our subquery, so that we can avoid CI_rownum appearing in the actual results + if (count($this->qb_select) === 0 OR strpos(implode(',', $this->qb_select), '*') !== FALSE) + { + $select = '*'; // Inevitable + } + else + { + // Use only field names and their aliases, everything else is out of our scope. + $select = array(); + $field_regexp = ($this->_quoted_identifier) + ? '("[^\"]+")' : '(\[[^\]]+\])'; + for ($i = 0, $c = count($this->qb_select); $i < $c; $i++) + { + $select[] = preg_match('/(?:\s|\.)'.$field_regexp.'$/i', $this->qb_select[$i], $m) + ? $m[1] : $this->qb_select[$i]; + } + $select = implode(', ', $select); + } + + return 'SELECT '.$select." FROM (\n\n" + .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql) + ."\n\n) ".$this->escape_identifiers('CI_subquery') + ."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit; + } + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$limit.' ', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + // Multiple-value inserts are only supported as of SQL Server 2008 + if (version_compare($this->version(), '10', '>=')) + { + return parent::_insert_batch($table, $keys, $values); + } + + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + return $this->data_cache['version'] = $this->conn_id->query("SELECT SERVERPROPERTY('ProductVersion') AS ver")->fetchColumn(0); + } +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php new file mode 100755 index 0000000..d0cca38 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php @@ -0,0 +1,149 @@ + 'SMALLINT', + 'SMALLINT' => 'INT', + 'INT' => 'BIGINT', + 'REAL' => 'FLOAT' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' ALTER COLUMN '; + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + $sqls[] = $sql.$this->_process_column($field[$i]); + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE) + { + unset($attributes['CONSTRAINT']); + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INTEGER': + $attributes['TYPE'] = 'INT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' IDENTITY(1,1)'; + } + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php new file mode 100755 index 0000000..cb93f19 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php @@ -0,0 +1,279 @@ +dsn)) + { + $this->dsn = 'firebird:'; + + if ( ! empty($this->database)) + { + $this->dsn .= 'dbname='.$this->database; + } + elseif ( ! empty($this->hostname)) + { + $this->dsn .= 'dbname='.$this->hostname; + } + + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + empty($this->role) OR $this->dsn .= ';role='.$this->role; + } + elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 9) === FALSE) + { + $this->dsn .= ';charset='.$this->char_set; + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT "RDB$FIELD_NAME" FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name", + CASE "fields"."RDB$FIELD_TYPE" + WHEN 7 THEN \'SMALLINT\' + WHEN 8 THEN \'INTEGER\' + WHEN 9 THEN \'QUAD\' + WHEN 10 THEN \'FLOAT\' + WHEN 11 THEN \'DFLOAT\' + WHEN 12 THEN \'DATE\' + WHEN 13 THEN \'TIME\' + WHEN 14 THEN \'CHAR\' + WHEN 16 THEN \'INT64\' + WHEN 27 THEN \'DOUBLE\' + WHEN 35 THEN \'TIMESTAMP\' + WHEN 37 THEN \'VARCHAR\' + WHEN 40 THEN \'CSTRING\' + WHEN 261 THEN \'BLOB\' + ELSE NULL + END AS "type", + "fields"."RDB$FIELD_LENGTH" AS "max_length", + "rfields"."RDB$DEFAULT_VALUE" AS "default" + FROM "RDB$RELATION_FIELDS" "rfields" + JOIN "RDB$FIELDS" "fields" ON "rfields"."RDB$FIELD_SOURCE" = "fields"."RDB$FIELD_NAME" + WHERE "rfields"."RDB$RELATION_NAME" = '.$this->escape($table).' + ORDER BY "rfields"."RDB$FIELD_POSITION"'; + + return (($query = $this->query($sql)) !== FALSE) + ? $query->result_object() + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + // Limit clause depends on if Interbase or Firebird + if (stripos($this->version(), 'firebird') !== FALSE) + { + $select = 'FIRST '.$this->qb_limit + .($this->qb_offset > 0 ? ' SKIP '.$this->qb_offset : ''); + } + else + { + $select = 'ROWS ' + .($this->qb_offset > 0 ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit); + } + + return preg_replace('`SELECT`i', 'SELECT '.$select, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php new file mode 100755 index 0000000..20c5a68 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php @@ -0,0 +1,237 @@ + 'INTEGER', + 'INTEGER' => 'INT64', + 'FLOAT' => 'DOUBLE PRECISION' + ); + + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + + // -------------------------------------------------------------------- + + /** + * Create database + * + * @param string $db_name + * @return string + */ + public function create_database($db_name) + { + // Firebird databases are flat files, so a path is required + + // Hostname is needed for remote access + empty($this->db->hostname) OR $db_name = $this->hostname.':'.$db_name; + + return parent::create_database('"'.$db_name.'"'); + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $db_name (ignored) + * @return bool + */ + public function drop_database($db_name) + { + if ( ! ibase_drop_db($this->conn_id)) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + return FALSE; + } + + if (isset($field[$i]['type'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TYPE '.$field[$i]['type'].$field[$i]['length']; + } + + if ( ! empty($field[$i]['default'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' SET DEFAULT '.$field[$i]['default']; + } + + if (isset($field[$i]['null'])) + { + $sqls[] = 'UPDATE "RDB$RELATION_FIELDS" SET "RDB$NULL_FLAG" = ' + .($field[$i]['null'] === TRUE ? 'NULL' : '1') + .' WHERE "RDB$FIELD_NAME" = '.$this->db->escape($field[$i]['name']) + .' AND "RDB$RELATION_NAME" = '.$this->db->escape($table); + } + + if ( ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'].$field['length'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INT': + $attributes['TYPE'] = 'INTEGER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'INT64'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php new file mode 100755 index 0000000..26b556a --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php @@ -0,0 +1,244 @@ +dsn)) + { + $this->dsn = 'ibm:'; + + // Pre-defined DSN + if (empty($this->hostname) && empty($this->HOSTNAME) && empty($this->port) && empty($this->PORT)) + { + if (isset($this->DSN)) + { + $this->dsn .= 'DSN='.$this->DSN; + } + elseif ( ! empty($this->database)) + { + $this->dsn .= 'DSN='.$this->database; + } + + return; + } + + $this->dsn .= 'DRIVER='.(isset($this->DRIVER) ? '{'.$this->DRIVER.'}' : '{IBM DB2 ODBC DRIVER}').';'; + + if (isset($this->DATABASE)) + { + $this->dsn .= 'DATABASE='.$this->DATABASE.';'; + } + elseif ( ! empty($this->database)) + { + $this->dsn .= 'DATABASE='.$this->database.';'; + } + + if (isset($this->HOSTNAME)) + { + $this->dsn .= 'HOSTNAME='.$this->HOSTNAME.';'; + } + else + { + $this->dsn .= 'HOSTNAME='.(empty($this->hostname) ? '127.0.0.1;' : $this->hostname.';'); + } + + if (isset($this->PORT)) + { + $this->dsn .= 'PORT='.$this->port.';'; + } + elseif ( ! empty($this->port)) + { + $this->dsn .= ';PORT='.$this->port.';'; + } + + $this->dsn .= 'PROTOCOL='.(isset($this->PROTOCOL) ? $this->PROTOCOL.';' : 'TCPIP;'); + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "tabname" FROM "syscat"."tables" + WHERE "type" = \'T\' AND LOWER("tabschema") = '.$this->escape(strtolower($this->database)); + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' AND "tabname" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return array + */ + protected function _list_columns($table = '') + { + return 'SELECT "colname" FROM "syscat"."columns" + WHERE LOWER("tabschema") = '.$this->escape(strtolower($this->database)).' + AND LOWER("tabname") = '.$this->escape(strtolower($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "colname" AS "name", "typename" AS "type", "default" AS "default", "length" AS "max_length", + CASE "keyseq" WHEN NULL THEN 0 ELSE 1 END AS "primary_key" + FROM "syscat"."columns" + WHERE LOWER("tabschema") = '.$this->escape(strtolower($this->database)).' + AND LOWER("tabname") = '.$this->escape(strtolower($table)).' + ORDER BY "colno"'; + + return (($query = $this->query($sql)) !== FALSE) + ? $query->result_object() + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + $sql .= ' FETCH FIRST '.($this->qb_limit + $this->qb_offset).' ROWS ONLY'; + + return ($this->qb_offset) + ? 'SELECT * FROM ('.$sql.') WHERE rownum > '.$this->qb_offset + : $sql; + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php new file mode 100755 index 0000000..4238ca0 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php @@ -0,0 +1,154 @@ + 'INTEGER', + 'INT' => 'BIGINT', + 'INTEGER' => 'BIGINT' + ); + + /** + * DEFAULT value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_default = FALSE; + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'CHANGE') + { + $alter_type = 'MODIFY'; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute UNIQUE + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_unique(&$attributes, &$field) + { + if ( ! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === TRUE) + { + $field['unique'] = ' UNIQUE'; + + // UNIQUE must be used with NOT NULL + $field['null'] = ' NOT NULL'; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php new file mode 100755 index 0000000..050171f --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php @@ -0,0 +1,309 @@ +dsn)) + { + $this->dsn = 'informix:'; + + // Pre-defined DSN + if (empty($this->hostname) && empty($this->host) && empty($this->port) && empty($this->service)) + { + if (isset($this->DSN)) + { + $this->dsn .= 'DSN='.$this->DSN; + } + elseif ( ! empty($this->database)) + { + $this->dsn .= 'DSN='.$this->database; + } + + return; + } + + if (isset($this->host)) + { + $this->dsn .= 'host='.$this->host; + } + else + { + $this->dsn .= 'host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + } + + if (isset($this->service)) + { + $this->dsn .= '; service='.$this->service; + } + elseif ( ! empty($this->port)) + { + $this->dsn .= '; service='.$this->port; + } + + empty($this->database) OR $this->dsn .= '; database='.$this->database; + empty($this->server) OR $this->dsn .= '; server='.$this->server; + + $this->dsn .= '; protocol='.(isset($this->protocol) ? $this->protocol : 'onsoctcp') + .'; EnableScrollableCursors=1'; + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "tabname" FROM "systables" + WHERE "tabid" > 99 AND "tabtype" = \'T\' AND LOWER("owner") = '.$this->escape(strtolower($this->username)); + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' AND "tabname" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + if (strpos($table, '.') !== FALSE) + { + sscanf($table, '%[^.].%s', $owner, $table); + } + else + { + $owner = $this->username; + } + + return 'SELECT "colname" FROM "systables", "syscolumns" + WHERE "systables"."tabid" = "syscolumns"."tabid" + AND "systables"."tabtype" = \'T\' + AND LOWER("systables"."owner") = '.$this->escape(strtolower($owner)).' + AND LOWER("systables"."tabname") = '.$this->escape(strtolower($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "syscolumns"."colname" AS "name", + CASE "syscolumns"."coltype" + WHEN 0 THEN \'CHAR\' + WHEN 1 THEN \'SMALLINT\' + WHEN 2 THEN \'INTEGER\' + WHEN 3 THEN \'FLOAT\' + WHEN 4 THEN \'SMALLFLOAT\' + WHEN 5 THEN \'DECIMAL\' + WHEN 6 THEN \'SERIAL\' + WHEN 7 THEN \'DATE\' + WHEN 8 THEN \'MONEY\' + WHEN 9 THEN \'NULL\' + WHEN 10 THEN \'DATETIME\' + WHEN 11 THEN \'BYTE\' + WHEN 12 THEN \'TEXT\' + WHEN 13 THEN \'VARCHAR\' + WHEN 14 THEN \'INTERVAL\' + WHEN 15 THEN \'NCHAR\' + WHEN 16 THEN \'NVARCHAR\' + WHEN 17 THEN \'INT8\' + WHEN 18 THEN \'SERIAL8\' + WHEN 19 THEN \'SET\' + WHEN 20 THEN \'MULTISET\' + WHEN 21 THEN \'LIST\' + WHEN 22 THEN \'Unnamed ROW\' + WHEN 40 THEN \'LVARCHAR\' + WHEN 41 THEN \'BLOB/CLOB/BOOLEAN\' + WHEN 4118 THEN \'Named ROW\' + ELSE "syscolumns"."coltype" + END AS "type", + "syscolumns"."collength" as "max_length", + CASE "sysdefaults"."type" + WHEN \'L\' THEN "sysdefaults"."default" + ELSE NULL + END AS "default" + FROM "syscolumns", "systables", "sysdefaults" + WHERE "syscolumns"."tabid" = "systables"."tabid" + AND "systables"."tabid" = "sysdefaults"."tabid" + AND "syscolumns"."colno" = "sysdefaults"."colno" + AND "systables"."tabtype" = \'T\' + AND LOWER("systables"."owner") = '.$this->escape(strtolower($this->username)).' + AND LOWER("systables"."tabname") = '.$this->escape(strtolower($table)).' + ORDER BY "syscolumns"."colno"'; + + return (($query = $this->query($sql)) !== FALSE) + ? $query->result_object() + : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE TABLE ONLY '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql $SQL Query + * @return string + */ + protected function _limit($sql) + { + $select = 'SELECT '.($this->qb_offset ? 'SKIP '.$this->qb_offset : '').'FIRST '.$this->qb_limit.' '; + return preg_replace('/^(SELECT\s)/i', $select, $sql, 1); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php new file mode 100755 index 0000000..2ddc2a9 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php @@ -0,0 +1,163 @@ + 'INTEGER', + 'INT' => 'BIGINT', + 'INTEGER' => 'BIGINT', + 'REAL' => 'DOUBLE PRECISION', + 'SMALLFLOAT' => 'DOUBLE PRECISION' + ); + + /** + * DEFAULT value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_default = ', '; + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'CHANGE') + { + $alter_type = 'MODIFY'; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'BYTE': + case 'TEXT': + case 'BLOB': + case 'CLOB': + $attributes['UNIQUE'] = FALSE; + if (isset($attributes['DEFAULT'])) + { + unset($attributes['DEFAULT']); + } + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute UNIQUE + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_unique(&$attributes, &$field) + { + if ( ! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === TRUE) + { + $field['unique'] = ' UNIQUE CONSTRAINT '.$this->db->escape_identifiers($field['name']); + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php new file mode 100755 index 0000000..64b13d8 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php @@ -0,0 +1,374 @@ +dsn)) + { + $this->dsn = 'mysql:host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + empty($this->port) OR $this->dsn .= ';port='.$this->port; + empty($this->database) OR $this->dsn .= ';dbname='.$this->database; + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + } + elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE) + { + $this->dsn .= ';charset='.$this->char_set; + } + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return object + */ + public function db_connect($persistent = FALSE) + { + if (isset($this->stricton)) + { + if ($this->stricton) + { + $sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")'; + } + else + { + $sql = 'REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( + @@sql_mode, + "STRICT_ALL_TABLES,", ""), + ",STRICT_ALL_TABLES", ""), + "STRICT_ALL_TABLES", ""), + "STRICT_TRANS_TABLES,", ""), + ",STRICT_TRANS_TABLES", ""), + "STRICT_TRANS_TABLES", "")'; + } + + if ( ! empty($sql)) + { + if (empty($this->options[PDO::MYSQL_ATTR_INIT_COMMAND])) + { + $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET SESSION sql_mode = '.$sql; + } + else + { + $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] .= ', @@session.sql_mode = '.$sql; + } + } + } + + if ($this->compress === TRUE) + { + $this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE; + } + + if (is_array($this->encrypt)) + { + $ssl = array(); + empty($this->encrypt['ssl_key']) OR $ssl[PDO::MYSQL_ATTR_SSL_KEY] = $this->encrypt['ssl_key']; + empty($this->encrypt['ssl_cert']) OR $ssl[PDO::MYSQL_ATTR_SSL_CERT] = $this->encrypt['ssl_cert']; + empty($this->encrypt['ssl_ca']) OR $ssl[PDO::MYSQL_ATTR_SSL_CA] = $this->encrypt['ssl_ca']; + empty($this->encrypt['ssl_capath']) OR $ssl[PDO::MYSQL_ATTR_SSL_CAPATH] = $this->encrypt['ssl_capath']; + empty($this->encrypt['ssl_cipher']) OR $ssl[PDO::MYSQL_ATTR_SSL_CIPHER] = $this->encrypt['ssl_cipher']; + + // DO NOT use array_merge() here! + // It re-indexes numeric keys and the PDO_MYSQL_ATTR_SSL_* constants are integers. + empty($ssl) OR $this->options += $ssl; + } + + // Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails + if ( + ($pdo = parent::db_connect($persistent)) !== FALSE + && ! empty($ssl) + && version_compare($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), '5.7.3', '<=') + && empty($pdo->query("SHOW STATUS LIKE 'ssl_cipher'")->fetchObject()->Value) + ) + { + $message = 'PDO_MYSQL was configured for an SSL connection, but got an unencrypted connection instead!'; + log_message('error', $message); + return ($this->db_debug) ? $this->display_error($message, '', TRUE) : FALSE; + } + + return $pdo; + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + if (FALSE !== $this->simple_query('USE '.$this->escape_identifiers($database))) + { + $this->database = $database; + $this->data_cache = array(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); + return $this->conn_id->beginTransaction(); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + if ($this->conn_id->commit()) + { + $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + if ($this->conn_id->rollBack()) + { + $this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SHOW TABLES'; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->Field; + + sscanf($query[$i]->Type, '%[a-z](%d)', + $retval[$i]->type, + $retval[$i]->max_length + ); + + $retval[$i]->default = $query[$i]->Default; + $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI'); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php new file mode 100755 index 0000000..c7a92b8 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php @@ -0,0 +1,256 @@ +db->char_set) && ! strpos($sql, 'CHARACTER SET') && ! strpos($sql, 'CHARSET')) + { + $sql .= ' DEFAULT CHARACTER SET = '.$this->db->char_set; + } + + if ( ! empty($this->db->dbcollat) && ! strpos($sql, 'COLLATE')) + { + $sql .= ' COLLATE = '.$this->db->dbcollat; + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP') + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $field[$i] = ($alter_type === 'ADD') + ? "\n\tADD ".$field[$i]['_literal'] + : "\n\tMODIFY ".$field[$i]['_literal']; + } + else + { + if ($alter_type === 'ADD') + { + $field[$i]['_literal'] = "\n\tADD "; + } + else + { + $field[$i]['_literal'] = empty($field[$i]['new_name']) ? "\n\tMODIFY " : "\n\tCHANGE "; + } + + $field[$i] = $field[$i]['_literal'].$this->_process_column($field[$i]); + } + } + + return array($sql.implode(',', $field)); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + $extra_clause = isset($field['after']) + ? ' AFTER '.$this->db->escape_identifiers($field['after']) : ''; + + if (empty($extra_clause) && isset($field['first']) && $field['first'] === TRUE) + { + $extra_clause = ' FIRST'; + } + + return $this->db->escape_identifiers($field['name']) + .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) + .' '.$field['type'].$field['length'] + .$field['unsigned'] + .$field['null'] + .$field['default'] + .$field['auto_increment'] + .$field['unique'] + .(empty($field['comment']) ? '' : ' COMMENT '.$field['comment']) + .$extra_clause; + } + + // -------------------------------------------------------------------- + + /** + * Process indexes + * + * @param string $table (ignored) + * @return string + */ + protected function _process_indexes($table) + { + $sql = ''; + + for ($i = 0, $c = count($this->keys); $i < $c; $i++) + { + if (is_array($this->keys[$i])) + { + for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) + { + if ( ! isset($this->fields[$this->keys[$i][$i2]])) + { + unset($this->keys[$i][$i2]); + continue; + } + } + } + elseif ( ! isset($this->fields[$this->keys[$i]])) + { + unset($this->keys[$i]); + continue; + } + + is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); + + $sql .= ",\n\tKEY ".$this->db->escape_identifiers(implode('_', $this->keys[$i])) + .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).')'; + } + + $this->keys = array(); + + return $sql; + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php new file mode 100755 index 0000000..abf9167 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php @@ -0,0 +1,326 @@ +dsn)) + { + $this->dsn = 'oci:dbname='; + + // Oracle has a slightly different PDO DSN format (Easy Connect), + // which also supports pre-defined DSNs. + if (empty($this->hostname) && empty($this->port)) + { + $this->dsn .= $this->database; + } + else + { + $this->dsn .= '//'.(empty($this->hostname) ? '127.0.0.1' : $this->hostname) + .(empty($this->port) ? '' : ':'.$this->port).'/'; + + empty($this->database) OR $this->dsn .= $this->database; + } + + empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set; + } + elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 4) === FALSE) + { + $this->dsn .= ';charset='.$this->char_set; + } + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + $version_string = parent::version(); + if (preg_match('#Release\s(?\d+(?:\.\d+)+)#', $version_string, $match)) + { + return $this->data_cache['version'] = $match[1]; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "TABLE_NAME" FROM "ALL_TABLES"'; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql.' WHERE "TABLE_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + if (strpos($table, '.') !== FALSE) + { + sscanf($table, '%[^.].%s', $owner, $table); + } + else + { + $owner = $this->username; + } + + return 'SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS + WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).' + AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (strpos($table, '.') !== FALSE) + { + sscanf($table, '%[^.].%s', $owner, $table); + } + else + { + $owner = $this->username; + } + + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHAR_LENGTH, DATA_PRECISION, DATA_LENGTH, DATA_DEFAULT, NULLABLE + FROM ALL_TAB_COLUMNS + WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).' + AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + + $length = ($query[$i]->CHAR_LENGTH > 0) + ? $query[$i]->CHAR_LENGTH : $query[$i]->DATA_PRECISION; + if ($length === NULL) + { + $length = $query[$i]->DATA_LENGTH; + } + $retval[$i]->max_length = $length; + + $default = $query[$i]->DATA_DEFAULT; + if ($default === NULL && $query[$i]->NULLABLE === 'N') + { + $default = ''; + } + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _insert_batch($table, $keys, $values) + { + $keys = implode(', ', $keys); + $sql = "INSERT ALL\n"; + + for ($i = 0, $c = count($values); $i < $c; $i++) + { + $sql .= ' INTO '.$table.' ('.$keys.') VALUES '.$values[$i]."\n"; + } + + return $sql.'SELECT * FROM dual'; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + $this->where('rownum <= ',$this->qb_limit, FALSE); + $this->qb_limit = FALSE; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + if (version_compare($this->version(), '12.1', '>=')) + { + // OFFSET-FETCH can be used only with the ORDER BY clause + empty($this->qb_orderby) && $sql .= ' ORDER BY 1'; + + return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY'; + } + + return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($this->qb_offset + $this->qb_limit + 1).')' + .($this->qb_offset ? ' WHERE rnum >= '.($this->qb_offset + 1): ''); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php new file mode 100755 index 0000000..813207b --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -0,0 +1,176 @@ +db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + $field[$i] = "\n\t".$field[$i]['_literal']; + } + else + { + $field[$i]['_literal'] = "\n\t".$this->_process_column($field[$i]); + + if ( ! empty($field[$i]['comment'])) + { + $sqls[] = 'COMMENT ON COLUMN ' + .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name']) + .' IS '.$field[$i]['comment']; + } + + if ($alter_type === 'MODIFY' && ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + } + } + + $sql .= ' '.$alter_type.' '; + $sql .= (count($field) === 1) + ? $field[0] + : '('.implode(',', $field).')'; + + // RENAME COLUMN must be executed after MODIFY + array_unshift($sqls, $sql); + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + // Not supported - sequences and triggers must be used instead + } + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'INT': + $attributes['TYPE'] = 'NUMBER'; + return; + case 'BIGINT': + $attributes['TYPE'] = 'NUMBER'; + return; + default: return; + } + } +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php new file mode 100755 index 0000000..066dd96 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php @@ -0,0 +1,229 @@ +dsn)) + { + $this->dsn = 'odbc:'; + + // Pre-defined DSN + if (empty($this->hostname) && empty($this->HOSTNAME) && empty($this->port) && empty($this->PORT)) + { + if (isset($this->DSN)) + { + $this->dsn .= 'DSN='.$this->DSN; + } + elseif ( ! empty($this->database)) + { + $this->dsn .= 'DSN='.$this->database; + } + + return; + } + + // If the DSN is not pre-configured - try to build an IBM DB2 connection string + $this->dsn .= 'DRIVER='.(isset($this->DRIVER) ? '{'.$this->DRIVER.'}' : '{IBM DB2 ODBC DRIVER}').';'; + + if (isset($this->DATABASE)) + { + $this->dsn .= 'DATABASE='.$this->DATABASE.';'; + } + elseif ( ! empty($this->database)) + { + $this->dsn .= 'DATABASE='.$this->database.';'; + } + + if (isset($this->HOSTNAME)) + { + $this->dsn .= 'HOSTNAME='.$this->HOSTNAME.';'; + } + else + { + $this->dsn .= 'HOSTNAME='.(empty($this->hostname) ? '127.0.0.1;' : $this->hostname.';'); + } + + if (isset($this->PORT)) + { + $this->dsn .= 'PORT='.$this->port.';'; + } + elseif ( ! empty($this->port)) + { + $this->dsn .= ';PORT='.$this->port.';'; + } + + $this->dsn .= 'PROTOCOL='.(isset($this->PROTOCOL) ? $this->PROTOCOL.';' : 'TCPIP;'); + } + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + $this->display_error('db_unsupported_feature'); + } + + // -------------------------------------------------------------------- + + /** + * Determines if a query is a "write" type. + * + * @param string An SQL query string + * @return bool + */ + public function is_write_type($sql) + { + if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#is', $sql)) + { + return FALSE; + } + + return parent::is_write_type($sql); + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '".$this->schema."'"; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql." AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT column_name FROM information_schema.columns WHERE table_name = '.$this->escape($table); + } +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php new file mode 100755 index 0000000..a2a3bad --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php @@ -0,0 +1,70 @@ +dsn)) + { + $this->dsn = 'pgsql:host='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + empty($this->port) OR $this->dsn .= ';port='.$this->port; + empty($this->database) OR $this->dsn .= ';dbname='.$this->database; + + if ( ! empty($this->username)) + { + $this->dsn .= ';username='.$this->username; + empty($this->password) OR $this->dsn .= ';password='.$this->password; + } + } + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return object + */ + public function db_connect($persistent = FALSE) + { + $this->conn_id = parent::db_connect($persistent); + + if (is_object($this->conn_id) && ! empty($this->schema)) + { + $this->simple_query('SET search_path TO '.$this->schema.',public'); + } + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @param string $name + * @return int + */ + public function insert_id($name = NULL) + { + if ($name === NULL && version_compare($this->version(), '8.1', '>=')) + { + $query = $this->query('SELECT LASTVAL() AS ins_id'); + $query = $query->row(); + return $query->ins_id; + } + + return $this->conn_id->lastInsertId($name); + } + + // -------------------------------------------------------------------- + + /** + * Determines if a query is a "write" type. + * + * @param string An SQL query string + * @return bool + */ + public function is_write_type($sql) + { + if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#is', $sql)) + { + return FALSE; + } + + return parent::is_write_type($sql); + } + + // -------------------------------------------------------------------- + + /** + * "Smart" Escape String + * + * Escapes data based on type + * + * @param string $str + * @return mixed + */ + public function escape($str) + { + if (is_bool($str)) + { + return ($str) ? 'TRUE' : 'FALSE'; + } + + return parent::escape($str); + } + + // -------------------------------------------------------------------- + + /** + * ORDER BY + * + * @param string $orderby + * @param string $direction ASC, DESC or RANDOM + * @param bool $escape + * @return object + */ + public function order_by($orderby, $direction = '', $escape = NULL) + { + $direction = strtoupper(trim($direction)); + if ($direction === 'RANDOM') + { + if ( ! is_float($orderby) && ctype_digit((string) $orderby)) + { + $orderby = ($orderby > 1) + ? (float) '0.'.$orderby + : (float) $orderby; + } + + if (is_float($orderby)) + { + $this->simple_query('SET SEED '.$orderby); + } + + $orderby = $this->_random_keyword[0]; + $direction = ''; + $escape = FALSE; + } + + return parent::order_by($orderby, $direction, $escape); + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "table_name" FROM "information_schema"."tables" WHERE "table_schema" = \''.$this->schema."'"; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql.' AND "table_name" LIKE \'' + .$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * List column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT "column_name" + FROM "information_schema"."columns" + WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default" + FROM "information_schema"."columns" + WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->column_name; + $retval[$i]->type = $query[$i]->data_type; + $retval[$i]->max_length = ($query[$i]->character_maximum_length > 0) ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision; + $retval[$i]->default = $query[$i]->column_default; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Update_Batch statement + * + * Generates a platform-specific batch update string from the supplied data + * + * @param string $table Table name + * @param array $values Update data + * @param string $index WHERE key + * @return string + */ + protected function _update_batch($table, $values, $index) + { + $ids = array(); + foreach ($values as $key => $val) + { + $ids[] = $val[$index]['value']; + + foreach (array_keys($val) as $field) + { + if ($field !== $index) + { + $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['value'].' THEN '.$val[$field]['value']; + } + } + } + + $cases = ''; + foreach ($final as $k => $v) + { + $cases .= $k.' = (CASE '.$val[$index]['field']."\n" + .implode("\n", $v)."\n" + .'ELSE '.$k.' END), '; + } + + $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE); + + return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where'); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + return $sql.' LIMIT '.$this->qb_limit.($this->qb_offset ? ' OFFSET '.$this->qb_offset : ''); + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php new file mode 100755 index 0000000..b00af4a --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -0,0 +1,210 @@ + 'INTEGER', + 'SMALLINT' => 'INTEGER', + 'INT' => 'BIGINT', + 'INT4' => 'BIGINT', + 'INTEGER' => 'BIGINT', + 'INT8' => 'NUMERIC', + 'BIGINT' => 'NUMERIC', + 'REAL' => 'DOUBLE PRECISION', + 'FLOAT' => 'DOUBLE PRECISION' + ); + + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + + // -------------------------------------------------------------------- + + /** + * Class constructor + * + * @param object &$db Database object + * @return void + */ + public function __construct(&$db) + { + parent::__construct($db); + + if (version_compare($this->db->version(), '9.0', '>')) + { + $this->create_table_if = 'CREATE TABLE IF NOT EXISTS'; + } + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + return FALSE; + } + + if (version_compare($this->db->version(), '8', '>=') && isset($field[$i]['type'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TYPE '.$field[$i]['type'].$field[$i]['length']; + } + + if ( ! empty($field[$i]['default'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' SET DEFAULT '.$field[$i]['default']; + } + + if (isset($field[$i]['null'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL'); + } + + if ( ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + + if ( ! empty($field[$i]['comment'])) + { + $sqls[] = 'COMMENT ON COLUMN ' + .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name']) + .' IS '.$field[$i]['comment']; + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + // Reset field lengths for data types that don't support it + if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== FALSE) + { + $attributes['CONSTRAINT'] = NULL; + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $field['type'] = ($field['type'] === 'NUMERIC') + ? 'BIGSERIAL' + : 'SERIAL'; + } + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php new file mode 100755 index 0000000..9b70f3e --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php @@ -0,0 +1,219 @@ +dsn)) + { + $this->dsn = 'sqlite:'; + + if (empty($this->database) && empty($this->hostname)) + { + $this->database = ':memory:'; + } + + $this->database = empty($this->database) ? $this->hostname : $this->database; + } + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\''; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + return $sql.' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * @param string $table Table name + * @return array + */ + public function list_fields($table) + { + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $this->data_cache['field_names'][$table] = array(); + foreach ($result->result_array() as $row) + { + $this->data_cache['field_names'][$table][] = $row['name']; + } + + return $this->data_cache['field_names'][$table]; + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $query = $query->result_array(); + if (empty($query)) + { + return FALSE; + } + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]['name']; + $retval[$i]->type = $query[$i]['type']; + $retval[$i]->max_length = NULL; + $retval[$i]->default = $query[$i]['dflt_value']; + $retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Replace statement + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'INSERT OR '.parent::_replace($table, $keys, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php new file mode 100755 index 0000000..18c475b --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php @@ -0,0 +1,238 @@ +db->version(), '3.3', '<')) + { + $this->_create_table_if = FALSE; + $this->_drop_table_if = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Create database + * + * @param string $db_name (ignored) + * @return bool + */ + public function create_database($db_name) + { + // In SQLite, a database is created when you connect to the database. + // We'll return TRUE so that an error isn't generated + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $db_name (ignored) + * @return bool + */ + public function drop_database($db_name) + { + // In SQLite, a database is dropped when we delete a file + if (file_exists($this->db->database)) + { + // We need to close the pseudo-connection first + $this->db->close(); + if ( ! @unlink($this->db->database)) + { + return $this->db->db_debug ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + return $this->db->db_debug ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP' OR $alter_type === 'CHANGE') + { + // drop_column(): + // BEGIN TRANSACTION; + // CREATE TEMPORARY TABLE t1_backup(a,b); + // INSERT INTO t1_backup SELECT a,b FROM t1; + // DROP TABLE t1; + // CREATE TABLE t1(a,b); + // INSERT INTO t1 SELECT a,b FROM t1_backup; + // DROP TABLE t1_backup; + // COMMIT; + + return FALSE; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'] + .$field['auto_increment'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'ENUM': + case 'SET': + $attributes['TYPE'] = 'TEXT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['type'] = 'INTEGER PRIMARY KEY'; + $field['default'] = ''; + $field['null'] = ''; + $field['unique'] = ''; + $field['auto_increment'] = ' AUTOINCREMENT'; + + $this->primary_keys = array(); + } + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php new file mode 100755 index 0000000..a9fb4d1 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php @@ -0,0 +1,369 @@ +dsn)) + { + $this->dsn = 'sqlsrv:Server='.(empty($this->hostname) ? '127.0.0.1' : $this->hostname); + + empty($this->port) OR $this->dsn .= ','.$this->port; + empty($this->database) OR $this->dsn .= ';Database='.$this->database; + + // Some custom options + + if (isset($this->QuotedId)) + { + $this->dsn .= ';QuotedId='.$this->QuotedId; + $this->_quoted_identifier = (bool) $this->QuotedId; + } + + if (isset($this->ConnectionPooling)) + { + $this->dsn .= ';ConnectionPooling='.$this->ConnectionPooling; + } + + if ($this->encrypt === TRUE) + { + $this->dsn .= ';Encrypt=1'; + } + + if (isset($this->TraceOn)) + { + $this->dsn .= ';TraceOn='.$this->TraceOn; + } + + if (isset($this->TrustServerCertificate)) + { + $this->dsn .= ';TrustServerCertificate='.$this->TrustServerCertificate; + } + + empty($this->APP) OR $this->dsn .= ';APP='.$this->APP; + empty($this->Failover_Partner) OR $this->dsn .= ';Failover_Partner='.$this->Failover_Partner; + empty($this->LoginTimeout) OR $this->dsn .= ';LoginTimeout='.$this->LoginTimeout; + empty($this->MultipleActiveResultSets) OR $this->dsn .= ';MultipleActiveResultSets='.$this->MultipleActiveResultSets; + empty($this->TraceFile) OR $this->dsn .= ';TraceFile='.$this->TraceFile; + empty($this->WSID) OR $this->dsn .= ';WSID='.$this->WSID; + } + elseif (preg_match('/QuotedId=(0|1)/', $this->dsn, $match)) + { + $this->_quoted_identifier = (bool) $match[1]; + } + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return object + */ + public function db_connect($persistent = FALSE) + { + if ( ! empty($this->char_set) && preg_match('/utf[^8]*8/i', $this->char_set)) + { + $this->options[PDO::SQLSRV_ENCODING_UTF8] = 1; + } + + $this->conn_id = parent::db_connect($persistent); + + if ( ! is_object($this->conn_id) OR is_bool($this->_quoted_identifier)) + { + return $this->conn_id; + } + + // Determine how identifiers are escaped + $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi'); + $query = $query->row_array(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT '.$this->escape_identifiers('name') + .' FROM '.$this->escape_identifiers('sysobjects') + .' WHERE '.$this->escape_identifiers('type')." = 'U'"; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' AND '.$this->escape_identifiers('name')." LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql.' ORDER BY '.$this->escape_identifiers('name'); + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + return 'WITH ci_delete AS (SELECT TOP '.$this->qb_limit.' * FROM '.$table.$this->_compile_wh('qb_where').') DELETE FROM ci_delete'; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + // As of SQL Server 2012 (11.0.*) OFFSET is supported + if (version_compare($this->version(), '11', '>=')) + { + // SQL Server OFFSET-FETCH can be used only with the ORDER BY clause + empty($this->qb_orderby) && $sql .= ' ORDER BY 1'; + + return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY'; + } + + $limit = $this->qb_offset + $this->qb_limit; + + // An ORDER BY clause is required for ROW_NUMBER() to work + if ($this->qb_offset && ! empty($this->qb_orderby)) + { + $orderby = $this->_compile_order_by(); + + // We have to strip the ORDER BY clause + $sql = trim(substr($sql, 0, strrpos($sql, $orderby))); + + // Get the fields to select from our subquery, so that we can avoid CI_rownum appearing in the actual results + if (count($this->qb_select) === 0 OR strpos(implode(',', $this->qb_select), '*') !== FALSE) + { + $select = '*'; // Inevitable + } + else + { + // Use only field names and their aliases, everything else is out of our scope. + $select = array(); + $field_regexp = ($this->_quoted_identifier) + ? '("[^\"]+")' : '(\[[^\]]+\])'; + for ($i = 0, $c = count($this->qb_select); $i < $c; $i++) + { + $select[] = preg_match('/(?:\s|\.)'.$field_regexp.'$/i', $this->qb_select[$i], $m) + ? $m[1] : $this->qb_select[$i]; + } + $select = implode(', ', $select); + } + + return 'SELECT '.$select." FROM (\n\n" + .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql) + ."\n\n) ".$this->escape_identifiers('CI_subquery') + ."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit; + } + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$limit.' ', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + // Multiple-value inserts are only supported as of SQL Server 2008 + if (version_compare($this->version(), '10', '>=')) + { + return parent::_insert_batch($table, $keys, $values); + } + + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + +} diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php new file mode 100755 index 0000000..82a0d51 --- /dev/null +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php @@ -0,0 +1,149 @@ + 'SMALLINT', + 'SMALLINT' => 'INT', + 'INT' => 'BIGINT', + 'REAL' => 'FLOAT' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' ALTER COLUMN '; + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + $sqls[] = $sql.$this->_process_column($field[$i]); + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE) + { + unset($attributes['CONSTRAINT']); + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INTEGER': + $attributes['TYPE'] = 'INT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' IDENTITY(1,1)'; + } + } + +} diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/postgre/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php new file mode 100755 index 0000000..bcdfc06 --- /dev/null +++ b/system/database/drivers/postgre/postgre_driver.php @@ -0,0 +1,620 @@ +dsn)) + { + return; + } + + $this->dsn === '' OR $this->dsn = ''; + + if (strpos($this->hostname, '/') !== FALSE) + { + // If UNIX sockets are used, we shouldn't set a port + $this->port = ''; + } + + $this->hostname === '' OR $this->dsn = 'host='.$this->hostname.' '; + + if ( ! empty($this->port) && ctype_digit($this->port)) + { + $this->dsn .= 'port='.$this->port.' '; + } + + if ($this->username !== '') + { + $this->dsn .= 'user='.$this->username.' '; + + /* An empty password is valid! + * + * $db['password'] = NULL must be done in order to ignore it. + */ + $this->password === NULL OR $this->dsn .= "password='".$this->password."' "; + } + + $this->database === '' OR $this->dsn .= 'dbname='.$this->database.' '; + + /* We don't have these options as elements in our standard configuration + * array, but they might be set by parse_url() if the configuration was + * provided via string. Example: + * + * postgre://username:password@localhost:5432/database?connect_timeout=5&sslmode=1 + */ + foreach (array('connect_timeout', 'options', 'sslmode', 'service') as $key) + { + if (isset($this->$key) && is_string($this->$key) && $this->$key !== '') + { + $this->dsn .= $key."='".$this->$key."' "; + } + } + + $this->dsn = rtrim($this->dsn); + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $persistent + * @return resource + */ + public function db_connect($persistent = FALSE) + { + $this->conn_id = ($persistent === TRUE) + ? pg_pconnect($this->dsn) + : pg_connect($this->dsn); + + if ($this->conn_id !== FALSE) + { + if ($persistent === TRUE + && pg_connection_status($this->conn_id) === PGSQL_CONNECTION_BAD + && pg_ping($this->conn_id) === FALSE + ) + { + return FALSE; + } + + empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public'); + } + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @return void + */ + public function reconnect() + { + if (pg_ping($this->conn_id) === FALSE) + { + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @param string $charset + * @return bool + */ + protected function _db_set_charset($charset) + { + return (pg_set_client_encoding($this->conn_id, $charset) === 0); + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if ( ! $this->conn_id OR ($pg_version = pg_version($this->conn_id)) === FALSE) + { + return FALSE; + } + + /* If PHP was compiled with PostgreSQL lib versions earlier + * than 7.4, pg_version() won't return the server version + * and so we'll have to fall back to running a query in + * order to get it. + */ + return isset($pg_version['server']) + ? $this->data_cache['version'] = $pg_version['server'] + : parent::version(); + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return pg_query($this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return (bool) pg_query($this->conn_id, 'BEGIN'); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return (bool) pg_query($this->conn_id, 'COMMIT'); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return (bool) pg_query($this->conn_id, 'ROLLBACK'); + } + + // -------------------------------------------------------------------- + + /** + * Determines if a query is a "write" type. + * + * @param string An SQL query string + * @return bool + */ + public function is_write_type($sql) + { + if (preg_match('#^(INSERT|UPDATE).*RETURNING\s.+(\,\s?.+)*$#is', $sql)) + { + return FALSE; + } + + return parent::is_write_type($sql); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return pg_escape_string($this->conn_id, $str); + } + + // -------------------------------------------------------------------- + + /** + * "Smart" Escape String + * + * Escapes data based on type + * + * @param string $str + * @return mixed + */ + public function escape($str) + { + if (is_php('5.4.4') && (is_string($str) OR (is_object($str) && method_exists($str, '__toString')))) + { + return pg_escape_literal($this->conn_id, $str); + } + elseif (is_bool($str)) + { + return ($str) ? 'TRUE' : 'FALSE'; + } + + return parent::escape($str); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return pg_affected_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return string + */ + public function insert_id() + { + $v = pg_version($this->conn_id); + $v = isset($v['server']) ? $v['server'] : 0; // 'server' key is only available since PosgreSQL 7.4 + + $table = (func_num_args() > 0) ? func_get_arg(0) : NULL; + $column = (func_num_args() > 1) ? func_get_arg(1) : NULL; + + if ($table === NULL && $v >= '8.1') + { + $sql = 'SELECT LASTVAL() AS ins_id'; + } + elseif ($table !== NULL) + { + if ($column !== NULL && $v >= '8.0') + { + $sql = 'SELECT pg_get_serial_sequence(\''.$table."', '".$column."') AS seq"; + $query = $this->query($sql); + $query = $query->row(); + $seq = $query->seq; + } + else + { + // seq_name passed in table parameter + $seq = $table; + } + + $sql = 'SELECT CURRVAL(\''.$seq."') AS ins_id"; + } + else + { + return pg_last_oid($this->result_id); + } + + $query = $this->query($sql); + $query = $query->row(); + return (int) $query->ins_id; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT "table_name" FROM "information_schema"."tables" WHERE "table_schema" = \''.$this->schema."'"; + + if ($prefix_limit !== FALSE && $this->dbprefix !== '') + { + return $sql.' AND "table_name" LIKE \'' + .$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * List column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT "column_name" + FROM "information_schema"."columns" + WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default" + FROM "information_schema"."columns" + WHERE LOWER("table_name") = '.$this->escape(strtolower($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->column_name; + $retval[$i]->type = $query[$i]->data_type; + $retval[$i]->max_length = ($query[$i]->character_maximum_length > 0) ? $query[$i]->character_maximum_length : $query[$i]->numeric_precision; + $retval[$i]->default = $query[$i]->column_default; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => '', 'message' => pg_last_error($this->conn_id)); + } + + // -------------------------------------------------------------------- + + /** + * ORDER BY + * + * @param string $orderby + * @param string $direction ASC, DESC or RANDOM + * @param bool $escape + * @return object + */ + public function order_by($orderby, $direction = '', $escape = NULL) + { + $direction = strtoupper(trim($direction)); + if ($direction === 'RANDOM') + { + if ( ! is_float($orderby) && ctype_digit((string) $orderby)) + { + $orderby = ($orderby > 1) + ? (float) '0.'.$orderby + : (float) $orderby; + } + + if (is_float($orderby)) + { + $this->simple_query('SET SEED '.$orderby); + } + + $orderby = $this->_random_keyword[0]; + $direction = ''; + $escape = FALSE; + } + + return parent::order_by($orderby, $direction, $escape); + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Update_Batch statement + * + * Generates a platform-specific batch update string from the supplied data + * + * @param string $table Table name + * @param array $values Update data + * @param string $index WHERE key + * @return string + */ + protected function _update_batch($table, $values, $index) + { + $ids = array(); + foreach ($values as $key => $val) + { + $ids[] = $val[$index]['value']; + + foreach (array_keys($val) as $field) + { + if ($field !== $index) + { + $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['value'].' THEN '.$val[$field]['value']; + } + } + } + + $cases = ''; + foreach ($final as $k => $v) + { + $cases .= $k.' = (CASE '.$val[$index]['field']."\n" + .implode("\n", $v)."\n" + .'ELSE '.$k.' END), '; + } + + $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE); + + return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where'); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + $this->qb_limit = FALSE; + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + return $sql.' LIMIT '.$this->qb_limit.($this->qb_offset ? ' OFFSET '.$this->qb_offset : ''); + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + pg_close($this->conn_id); + } + +} diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php new file mode 100755 index 0000000..cdbff4c --- /dev/null +++ b/system/database/drivers/postgre/postgre_forge.php @@ -0,0 +1,205 @@ + 'INTEGER', + 'SMALLINT' => 'INTEGER', + 'INT' => 'BIGINT', + 'INT4' => 'BIGINT', + 'INTEGER' => 'BIGINT', + 'INT8' => 'NUMERIC', + 'BIGINT' => 'NUMERIC', + 'REAL' => 'DOUBLE PRECISION', + 'FLOAT' => 'DOUBLE PRECISION' + ); + + /** + * NULL value representation in CREATE/ALTER TABLE statements + * + * @var string + */ + protected $_null = 'NULL'; + + // -------------------------------------------------------------------- + + /** + * Class constructor + * + * @param object &$db Database object + * @return void + */ + public function __construct(&$db) + { + parent::__construct($db); + + if (version_compare($this->db->version(), '9.0', '>')) + { + $this->create_table_if = 'CREATE TABLE IF NOT EXISTS'; + } + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + if ($field[$i]['_literal'] !== FALSE) + { + return FALSE; + } + + if (version_compare($this->db->version(), '8', '>=') && isset($field[$i]['type'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TYPE '.$field[$i]['type'].$field[$i]['length']; + } + + if ( ! empty($field[$i]['default'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' SET DEFAULT '.$field[$i]['default']; + } + + if (isset($field[$i]['null'])) + { + $sqls[] = $sql.' ALTER COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL'); + } + + if ( ! empty($field[$i]['new_name'])) + { + $sqls[] = $sql.' RENAME COLUMN '.$this->db->escape_identifiers($field[$i]['name']) + .' TO '.$this->db->escape_identifiers($field[$i]['new_name']); + } + + if ( ! empty($field[$i]['comment'])) + { + $sqls[] = 'COMMENT ON COLUMN ' + .$this->db->escape_identifiers($table).'.'.$this->db->escape_identifiers($field[$i]['name']) + .' IS '.$field[$i]['comment']; + } + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + // Reset field lengths for data types that don't support it + if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== FALSE) + { + $attributes['CONSTRAINT'] = NULL; + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'TINYINT': + $attributes['TYPE'] = 'SMALLINT'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $field['type'] = ($field['type'] === 'NUMERIC') + ? 'BIGSERIAL' + : 'SERIAL'; + } + } + +} diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php new file mode 100755 index 0000000..57864a7 --- /dev/null +++ b/system/database/drivers/postgre/postgre_result.php @@ -0,0 +1,182 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = pg_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return pg_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field_names[] = pg_field_name($this->result_id, $i); + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = pg_field_name($this->result_id, $i); + $retval[$i]->type = pg_field_type($this->result_id, $i); + $retval[$i]->max_length = pg_field_size($this->result_id, $i); + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + pg_free_result($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return pg_result_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return pg_fetch_assoc($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return pg_fetch_object($this->result_id, NULL, $class_name); + } + +} diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php new file mode 100755 index 0000000..5ca358d --- /dev/null +++ b/system/database/drivers/postgre/postgre_utility.php @@ -0,0 +1,78 @@ +db->display_error('db_unsupported_feature'); + } +} diff --git a/system/database/drivers/sqlite/index.html b/system/database/drivers/sqlite/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/sqlite/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php new file mode 100755 index 0000000..03c96e4 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -0,0 +1,330 @@ +database, 0666, $error) + : sqlite_open($this->database, 0666, $error); + + isset($error) && log_message('error', $error); + + return $conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + return isset($this->data_cache['version']) + ? $this->data_cache['version'] + : $this->data_cache['version'] = sqlite_libversion(); + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return $this->is_write_type($sql) + ? sqlite_exec($this->conn_id, $sql) + : sqlite_query($this->conn_id, $sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return $this->simple_query('BEGIN TRANSACTION'); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return $this->simple_query('COMMIT'); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return $this->simple_query('ROLLBACK'); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependant string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return sqlite_escape_string($str); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return sqlite_changes($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return sqlite_last_insert_rowid($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = "SELECT name FROM sqlite_master WHERE type='table'"; + + if ($prefix_limit !== FALSE && $this->dbprefix != '') + { + return $sql." AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return bool + */ + protected function _list_columns($table = '') + { + // Not supported + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $query = $query->result_array(); + if (empty($query)) + { + return FALSE; + } + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]['name']; + $retval[$i]->type = $query[$i]['type']; + $retval[$i]->max_length = NULL; + $retval[$i]->default = $query[$i]['dflt_value']; + $retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occured. + * + * @return array + */ + public function error() + { + $error = array('code' => sqlite_last_error($this->conn_id)); + $error['message'] = sqlite_error_string($error['code']); + return $error; + } + + // -------------------------------------------------------------------- + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'INSERT OR '.parent::_replace($table, $keys, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this function maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + sqlite_close($this->conn_id); + } + +} diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php new file mode 100755 index 0000000..a0fc0cd --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -0,0 +1,205 @@ +db->database) OR ! @unlink($this->db->database)) + { + return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @todo implement drop_column(), modify_column() + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP' OR $alter_type === 'CHANGE') + { + // drop_column(): + // BEGIN TRANSACTION; + // CREATE TEMPORARY TABLE t1_backup(a,b); + // INSERT INTO t1_backup SELECT a,b FROM t1; + // DROP TABLE t1; + // CREATE TABLE t1(a,b); + // INSERT INTO t1 SELECT a,b FROM t1_backup; + // DROP TABLE t1_backup; + // COMMIT; + + return FALSE; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'] + .$field['auto_increment'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'ENUM': + case 'SET': + $attributes['TYPE'] = 'TEXT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['type'] = 'INTEGER PRIMARY KEY'; + $field['default'] = ''; + $field['null'] = ''; + $field['unique'] = ''; + $field['auto_increment'] = ' AUTOINCREMENT'; + + $this->primary_keys = array(); + } + } + +} diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php new file mode 100755 index 0000000..34d3ac3 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -0,0 +1,164 @@ +num_rows) + ? $this->num_rows + : $this->num_rows = @sqlite_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return @sqlite_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field_names[$i] = sqlite_field_name($this->result_id, $i); + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = sqlite_field_name($this->result_id, $i); + $retval[$i]->type = NULL; + $retval[$i]->max_length = NULL; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n + * @return bool + */ + public function data_seek($n = 0) + { + return sqlite_seek($this->result_id, $n); + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return sqlite_fetch_array($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return sqlite_fetch_object($this->result_id, $class_name); + } + +} diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php new file mode 100755 index 0000000..90ca4b1 --- /dev/null +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -0,0 +1,61 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/sqlite3/index.html b/system/database/drivers/sqlite3/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/sqlite3/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php new file mode 100755 index 0000000..d131baa --- /dev/null +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -0,0 +1,350 @@ +password) + ? new SQLite3($this->database) + : new SQLite3($this->database, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $this->password); + } + catch (Exception $e) + { + return FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + $version = SQLite3::version(); + return $this->data_cache['version'] = $version['versionString']; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @todo Implement use of SQLite3::querySingle(), if needed + * @param string $sql + * @return mixed SQLite3Result object or bool + */ + protected function _execute($sql) + { + return $this->is_write_type($sql) + ? $this->conn_id->exec($sql) + : $this->conn_id->query($sql); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return $this->conn_id->exec('BEGIN TRANSACTION'); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return $this->conn_id->exec('END TRANSACTION'); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return $this->conn_id->exec('ROLLBACK'); + } + + // -------------------------------------------------------------------- + + /** + * Platform-dependent string escape + * + * @param string + * @return string + */ + protected function _escape_str($str) + { + return $this->conn_id->escapeString($str); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return $this->conn_id->changes(); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @return int + */ + public function insert_id() + { + return $this->conn_id->lastInsertRowID(); + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool $prefix_limit + * @return string + */ + protected function _list_tables($prefix_limit = FALSE) + { + return 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\'' + .(($prefix_limit !== FALSE && $this->dbprefix != '') + ? ' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix).'%\' '.sprintf($this->_like_escape_str, $this->_like_escape_chr) + : ''); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * @param string $table Table name + * @return array + */ + public function list_fields($table) + { + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $this->data_cache['field_names'][$table] = array(); + foreach ($result->result_array() as $row) + { + $this->data_cache['field_names'][$table][] = $row['name']; + } + + return $this->data_cache['field_names'][$table]; + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $query = $query->result_array(); + if (empty($query)) + { + return FALSE; + } + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]['name']; + $retval[$i]->type = $query[$i]['type']; + $retval[$i]->max_length = NULL; + $retval[$i]->default = $query[$i]['dflt_value']; + $retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + return array('code' => $this->conn_id->lastErrorCode(), 'message' => $this->conn_id->lastErrorMsg()); + } + + // -------------------------------------------------------------------- + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string + */ + protected function _replace($table, $keys, $values) + { + return 'INSERT OR '.parent::_replace($table, $keys, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'DELETE FROM '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + $this->conn_id->close(); + } + +} diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php new file mode 100755 index 0000000..5ee6daa --- /dev/null +++ b/system/database/drivers/sqlite3/sqlite3_forge.php @@ -0,0 +1,225 @@ +db->version(), '3.3', '<')) + { + $this->_create_table_if = FALSE; + $this->_drop_table_if = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Create database + * + * @param string $db_name + * @return bool + */ + public function create_database($db_name) + { + // In SQLite, a database is created when you connect to the database. + // We'll return TRUE so that an error isn't generated + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @param string $db_name (ignored) + * @return bool + */ + public function drop_database($db_name) + { + // In SQLite, a database is dropped when we delete a file + if (file_exists($this->db->database)) + { + // We need to close the pseudo-connection first + $this->db->close(); + if ( ! @unlink($this->db->database)) + { + return $this->db->db_debug ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + elseif ( ! empty($this->db->data_cache['db_names'])) + { + $key = array_search(strtolower($this->db->database), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); + if ($key !== FALSE) + { + unset($this->db->data_cache['db_names'][$key]); + } + } + + return TRUE; + } + + return $this->db->db_debug ? $this->db->display_error('db_unable_to_drop') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @todo implement drop_column(), modify_column() + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if ($alter_type === 'DROP' OR $alter_type === 'CHANGE') + { + // drop_column(): + // BEGIN TRANSACTION; + // CREATE TEMPORARY TABLE t1_backup(a,b); + // INSERT INTO t1_backup SELECT a,b FROM t1; + // DROP TABLE t1; + // CREATE TABLE t1(a,b); + // INSERT INTO t1 SELECT a,b FROM t1_backup; + // DROP TABLE t1_backup; + // COMMIT; + + return FALSE; + } + + return parent::_alter_table($alter_type, $table, $field); + } + + // -------------------------------------------------------------------- + + /** + * Process column + * + * @param array $field + * @return string + */ + protected function _process_column($field) + { + return $this->db->escape_identifiers($field['name']) + .' '.$field['type'] + .$field['auto_increment'] + .$field['null'] + .$field['unique'] + .$field['default']; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + switch (strtoupper($attributes['TYPE'])) + { + case 'ENUM': + case 'SET': + $attributes['TYPE'] = 'TEXT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['type'] = 'INTEGER PRIMARY KEY'; + $field['default'] = ''; + $field['null'] = ''; + $field['unique'] = ''; + $field['auto_increment'] = ' AUTOINCREMENT'; + + $this->primary_keys = array(); + } + } + +} diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php new file mode 100755 index 0000000..03751f0 --- /dev/null +++ b/system/database/drivers/sqlite3/sqlite3_result.php @@ -0,0 +1,194 @@ +result_id->numColumns(); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $field_names[] = $this->result_id->columnName($i); + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + static $data_types = array( + SQLITE3_INTEGER => 'integer', + SQLITE3_FLOAT => 'float', + SQLITE3_TEXT => 'text', + SQLITE3_BLOB => 'blob', + SQLITE3_NULL => 'null' + ); + + $retval = array(); + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $this->result_id->columnName($i); + + $type = $this->result_id->columnType($i); + $retval[$i]->type = isset($data_types[$type]) ? $data_types[$type] : $type; + + $retval[$i]->max_length = NULL; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_object($this->result_id)) + { + $this->result_id->finalize(); + $this->result_id = NULL; + } + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return $this->result_id->fetchArray(SQLITE3_ASSOC); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + // No native support for fetching rows as objects + if (($row = $this->result_id->fetchArray(SQLITE3_ASSOC)) === FALSE) + { + return FALSE; + } + elseif ($class_name === 'stdClass') + { + return (object) $row; + } + + $class_name = new $class_name(); + foreach (array_keys($row) as $key) + { + $class_name->$key = $row[$key]; + } + + return $class_name; + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero. + * + * @param int $n (ignored) + * @return array + */ + public function data_seek($n = 0) + { + // Only resetting to the start of the result set is supported + return ($n > 0) ? FALSE : $this->result_id->reset(); + } + +} diff --git a/system/database/drivers/sqlite3/sqlite3_utility.php b/system/database/drivers/sqlite3/sqlite3_utility.php new file mode 100755 index 0000000..20d562f --- /dev/null +++ b/system/database/drivers/sqlite3/sqlite3_utility.php @@ -0,0 +1,61 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/drivers/sqlsrv/index.html b/system/database/drivers/sqlsrv/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/drivers/sqlsrv/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php new file mode 100755 index 0000000..4edcc7f --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -0,0 +1,543 @@ +scrollable === NULL) + { + $this->scrollable = defined('SQLSRV_CURSOR_CLIENT_BUFFERED') + ? SQLSRV_CURSOR_CLIENT_BUFFERED + : FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Database connection + * + * @param bool $pooling + * @return resource + */ + public function db_connect($pooling = FALSE) + { + $charset = in_array(strtolower($this->char_set), array('utf-8', 'utf8'), TRUE) + ? 'UTF-8' : SQLSRV_ENC_CHAR; + + $connection = array( + 'UID' => empty($this->username) ? '' : $this->username, + 'PWD' => empty($this->password) ? '' : $this->password, + 'Database' => $this->database, + 'ConnectionPooling' => ($pooling === TRUE) ? 1 : 0, + 'CharacterSet' => $charset, + 'Encrypt' => ($this->encrypt === TRUE) ? 1 : 0, + 'ReturnDatesAsStrings' => 1 + ); + + // If the username and password are both empty, assume this is a + // 'Windows Authentication Mode' connection. + if (empty($connection['UID']) && empty($connection['PWD'])) + { + unset($connection['UID'], $connection['PWD']); + } + + if (FALSE !== ($this->conn_id = sqlsrv_connect($this->hostname, $connection))) + { + // Determine how identifiers are escaped + $query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi'); + $query = $query->row_array(); + $this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi']; + $this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']'); + } + + return $this->conn_id; + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + if ($this->_execute('USE '.$this->escape_identifiers($database))) + { + $this->database = $database; + $this->data_cache = array(); + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @param string $sql an SQL query + * @return resource + */ + protected function _execute($sql) + { + return ($this->scrollable === FALSE OR $this->is_write_type($sql)) + ? sqlsrv_query($this->conn_id, $sql) + : sqlsrv_query($this->conn_id, $sql, NULL, array('Scrollable' => $this->scrollable)); + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @return bool + */ + protected function _trans_begin() + { + return sqlsrv_begin_transaction($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @return bool + */ + protected function _trans_commit() + { + return sqlsrv_commit($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @return bool + */ + protected function _trans_rollback() + { + return sqlsrv_rollback($this->conn_id); + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @return int + */ + public function affected_rows() + { + return sqlsrv_rows_affected($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * Returns the last id created in the Identity column. + * + * @return string + */ + public function insert_id() + { + return $this->query('SELECT SCOPE_IDENTITY() AS insert_id')->row()->insert_id; + } + + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + if ( ! $this->conn_id OR ($info = sqlsrv_server_info($this->conn_id)) === FALSE) + { + return FALSE; + } + + return $this->data_cache['version'] = $info['SQLServerVersion']; + } + + // -------------------------------------------------------------------- + + /** + * List table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @param bool + * @return string $prefix_limit + */ + protected function _list_tables($prefix_limit = FALSE) + { + $sql = 'SELECT '.$this->escape_identifiers('name') + .' FROM '.$this->escape_identifiers('sysobjects') + .' WHERE '.$this->escape_identifiers('type')." = 'U'"; + + if ($prefix_limit === TRUE && $this->dbprefix !== '') + { + $sql .= ' AND '.$this->escape_identifiers('name')." LIKE '".$this->escape_like_str($this->dbprefix)."%' " + .sprintf($this->_escape_like_str, $this->_escape_like_chr); + } + + return $sql.' ORDER BY '.$this->escape_identifiers('name'); + } + + // -------------------------------------------------------------------- + + /** + * List column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @param string $table + * @return string + */ + protected function _list_columns($table = '') + { + return 'SELECT COLUMN_NAME + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + } + + // -------------------------------------------------------------------- + + /** + * Returns an object with field data + * + * @param string $table + * @return array + */ + public function field_data($table) + { + $sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT + FROM INFORMATION_SCHEMA.Columns + WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table)); + + if (($query = $this->query($sql)) === FALSE) + { + return FALSE; + } + $query = $query->result_object(); + + $retval = array(); + for ($i = 0, $c = count($query); $i < $c; $i++) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $query[$i]->COLUMN_NAME; + $retval[$i]->type = $query[$i]->DATA_TYPE; + $retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION; + $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Error + * + * Returns an array containing code and message of the last + * database error that has occurred. + * + * @return array + */ + public function error() + { + $error = array('code' => '00000', 'message' => ''); + $sqlsrv_errors = sqlsrv_errors(SQLSRV_ERR_ERRORS); + + if ( ! is_array($sqlsrv_errors)) + { + return $error; + } + + $sqlsrv_error = array_shift($sqlsrv_errors); + if (isset($sqlsrv_error['SQLSTATE'])) + { + $error['code'] = isset($sqlsrv_error['code']) ? $sqlsrv_error['SQLSTATE'].'/'.$sqlsrv_error['code'] : $sqlsrv_error['SQLSTATE']; + } + elseif (isset($sqlsrv_error['code'])) + { + $error['code'] = $sqlsrv_error['code']; + } + + if (isset($sqlsrv_error['message'])) + { + $error['message'] = $sqlsrv_error['message']; + } + + return $error; + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @param string $table + * @param array $values + * @return string + */ + protected function _update($table, $values) + { + $this->qb_limit = FALSE; + $this->qb_orderby = array(); + return parent::_update($table, $values); + } + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * + * If the database does not support the TRUNCATE statement, + * then this method maps to 'DELETE FROM table' + * + * @param string $table + * @return string + */ + protected function _truncate($table) + { + return 'TRUNCATE TABLE '.$table; + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @param string $table + * @return string + */ + protected function _delete($table) + { + if ($this->qb_limit) + { + return 'WITH ci_delete AS (SELECT TOP '.$this->qb_limit.' * FROM '.$table.$this->_compile_wh('qb_where').') DELETE FROM ci_delete'; + } + + return parent::_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * LIMIT + * + * Generates a platform-specific LIMIT clause + * + * @param string $sql SQL Query + * @return string + */ + protected function _limit($sql) + { + // As of SQL Server 2012 (11.0.*) OFFSET is supported + if (version_compare($this->version(), '11', '>=')) + { + // SQL Server OFFSET-FETCH can be used only with the ORDER BY clause + empty($this->qb_orderby) && $sql .= ' ORDER BY 1'; + + return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY'; + } + + $limit = $this->qb_offset + $this->qb_limit; + + // An ORDER BY clause is required for ROW_NUMBER() to work + if ($this->qb_offset && ! empty($this->qb_orderby)) + { + $orderby = $this->_compile_order_by(); + + // We have to strip the ORDER BY clause + $sql = trim(substr($sql, 0, strrpos($sql, $orderby))); + + // Get the fields to select from our subquery, so that we can avoid CI_rownum appearing in the actual results + if (count($this->qb_select) === 0 OR strpos(implode(',', $this->qb_select), '*') !== FALSE) + { + $select = '*'; // Inevitable + } + else + { + // Use only field names and their aliases, everything else is out of our scope. + $select = array(); + $field_regexp = ($this->_quoted_identifier) + ? '("[^\"]+")' : '(\[[^\]]+\])'; + for ($i = 0, $c = count($this->qb_select); $i < $c; $i++) + { + $select[] = preg_match('/(?:\s|\.)'.$field_regexp.'$/i', $this->qb_select[$i], $m) + ? $m[1] : $this->qb_select[$i]; + } + $select = implode(', ', $select); + } + + return 'SELECT '.$select." FROM (\n\n" + .preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql) + ."\n\n) ".$this->escape_identifiers('CI_subquery') + ."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit; + } + + return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.$limit.' ', $sql); + } + + // -------------------------------------------------------------------- + + /** + * Insert batch statement + * + * Generates a platform-specific insert string from the supplied data. + * + * @param string $table Table name + * @param array $keys INSERT keys + * @param array $values INSERT values + * @return string|bool + */ + protected function _insert_batch($table, $keys, $values) + { + // Multiple-value inserts are only supported as of SQL Server 2008 + if (version_compare($this->version(), '10', '>=')) + { + return parent::_insert_batch($table, $keys, $values); + } + + return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @return void + */ + protected function _close() + { + sqlsrv_close($this->conn_id); + } + +} diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php new file mode 100755 index 0000000..aa8490e --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -0,0 +1,149 @@ + 'SMALLINT', + 'SMALLINT' => 'INT', + 'INT' => 'BIGINT', + 'REAL' => 'FLOAT' + ); + + // -------------------------------------------------------------------- + + /** + * ALTER TABLE + * + * @param string $alter_type ALTER type + * @param string $table Table name + * @param mixed $field Column definition + * @return string|string[] + */ + protected function _alter_table($alter_type, $table, $field) + { + if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) + { + return parent::_alter_table($alter_type, $table, $field); + } + + $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' ALTER COLUMN '; + $sqls = array(); + for ($i = 0, $c = count($field); $i < $c; $i++) + { + $sqls[] = $sql.$this->_process_column($field[$i]); + } + + return $sqls; + } + + // -------------------------------------------------------------------- + + /** + * Field attribute TYPE + * + * Performs a data type mapping between different databases. + * + * @param array &$attributes + * @return void + */ + protected function _attr_type(&$attributes) + { + if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE) + { + unset($attributes['CONSTRAINT']); + } + + switch (strtoupper($attributes['TYPE'])) + { + case 'MEDIUMINT': + $attributes['TYPE'] = 'INTEGER'; + $attributes['UNSIGNED'] = FALSE; + return; + case 'INTEGER': + $attributes['TYPE'] = 'INT'; + return; + default: return; + } + } + + // -------------------------------------------------------------------- + + /** + * Field attribute AUTO_INCREMENT + * + * @param array &$attributes + * @param array &$field + * @return void + */ + protected function _attr_auto_increment(&$attributes, &$field) + { + if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) + { + $field['auto_increment'] = ' IDENTITY(1,1)'; + } + } + +} diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php new file mode 100755 index 0000000..f784ebe --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -0,0 +1,193 @@ +scrollable = $driver_object->scrollable; + } + + // -------------------------------------------------------------------- + + /** + * Number of rows in the result set + * + * @return int + */ + public function num_rows() + { + // sqlsrv_num_rows() doesn't work with the FORWARD and DYNAMIC cursors (FALSE is the same as FORWARD) + if ( ! in_array($this->scrollable, array(FALSE, SQLSRV_CURSOR_FORWARD, SQLSRV_CURSOR_DYNAMIC), TRUE)) + { + return parent::num_rows(); + } + + return is_int($this->num_rows) + ? $this->num_rows + : $this->num_rows = sqlsrv_num_rows($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @return int + */ + public function num_fields() + { + return @sqlsrv_num_fields($this->result_id); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @return array + */ + public function list_fields() + { + $field_names = array(); + foreach (sqlsrv_field_metadata($this->result_id) as $offset => $field) + { + $field_names[] = $field['Name']; + } + + return $field_names; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @return array + */ + public function field_data() + { + $retval = array(); + foreach (sqlsrv_field_metadata($this->result_id) as $i => $field) + { + $retval[$i] = new stdClass(); + $retval[$i]->name = $field['Name']; + $retval[$i]->type = $field['Type']; + $retval[$i]->max_length = $field['Size']; + } + + return $retval; + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return void + */ + public function free_result() + { + if (is_resource($this->result_id)) + { + sqlsrv_free_stmt($this->result_id); + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @return array + */ + protected function _fetch_assoc() + { + return sqlsrv_fetch_array($this->result_id, SQLSRV_FETCH_ASSOC); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @param string $class_name + * @return object + */ + protected function _fetch_object($class_name = 'stdClass') + { + return sqlsrv_fetch_object($this->result_id, $class_name); + } + +} diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php new file mode 100755 index 0000000..19c93d0 --- /dev/null +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -0,0 +1,77 @@ +db->display_error('db_unsupported_feature'); + } + +} diff --git a/system/database/index.html b/system/database/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/database/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/fonts/index.html b/system/fonts/index.html new file mode 100755 index 0000000..b702fbc --- /dev/null +++ b/system/fonts/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf new file mode 100755 index 0000000000000000000000000000000000000000..383c88b86b7c17e2e284732af48b2bfc359647ae GIT binary patch literal 143830 zcmcG%34ml(c{W_il{&<709mpO2M~UwQR4 z@7=v(myaoCd_MIlA7KsVlRh5jzKO4)RfWbY`wrhFjOp_+jKK07&#-9ijjuk9OX5eO ze>NVvX3m%KWq!-?e=`3kq$b|LTsPq(3kwT$FMb#w?FXMPgnqy~62q^6U+>GM*XGB@ z3wGjGydX-lqH6v?P&Z5~WIN$VG!{=JQ|XMG&E*TlQn}LBUhU}Y>h9^S_4N-7t{55~ zSvfj3KCx+&v)TP zzQf17eYakA`7M{6zRl;m$>+P~6u!FR_|dsTH{;F4mwE@BxccO^*In=PUFm)D`EI}C z#v{$Q%U`Zq_JL#QNWR~9+9&ureW!en`QGJwFQns1-^YAU`#$aayze`{v%Y`!y-0e< zc9vx&*3TMjiS1=qu#d5yW}jid!VzvWw>1;WBr|TNH}h>*cP-a(BW}X&cOP{><$lKf zTlZU8UzW}CSt+Y#^{kbRWmDNgwmrKtJCU8r&SW=c4`vT#Z^_<~eRcM}?4#NDWS`A` zKKu7MHP@EU7Cv0~MB!6~&lUc<@Ppz-#VcQ2_$}v+Y^K@XKSO(;YPR>=UVHxw?cK)u zSe{jy?Hy$AXWxbPeg^H;(OxT)$Yg$}z4yDHbf0m*=CzkWdquCkW;UEnqP-=ry_3!M zUYxx#dwcdSwD*DRJH7UPCnx19=d}0v;=$sv7hn3V52EDiY)_xy#= z?|pvv^Z)q#`19iP{PXPd%-MyrKR)}~vzMK{^z7cVd(L+Id}lk(R?oJbEuJmV@jV;C zuW*(<%bX==esd;$CUNE~XTEgi3uiui=9x1eKl7$DkDj^v%$_r&-(UURr@s5-ci;cr z_kH)B-@Wg<`gcVM;|>eLmN4jRO7K;FT*{9qo6gOU07fg{&8OqZ66UtY++|{3y0|2nlm`?yIZMP%8HhEhV2~|b_RQw zABF>pBH1-uY7-feA*>*<{+M5I2rDa5O^@<~5H2XFNtI^>o+XSxhLhX2As;t6B3q`+p@$gn0+Kw)oFObhmkO%P8E!c= ze9g&W(Yl~AM8+$7BZ@mYy>RnZRSzyy2!Fy)J3>i}%`tzNm$3Ev zFAC@E9vEzVr2SdTjxcVmhCVL!(QeD-ypE&?c)P$!;@eVSwStCstmVsmtUJu2OlJ@OEM=Ov)&5V<)>W@cry!`ubyDD!j-ZlWy z)`VQIq)MVF5l9T~TmMd^GfwX-d-qjwUs;d@ClSi5mxPG?6NME zH@{)Fy}~dq!;%e;Y_FUWgUR4_kqK%U&O2c6ierNpvm%6(h=k$w@({GdD_#8PcdlEx zc=0Y)2^G!DACDDdPSjzT1RAmajpw(Y5(9DX@@i6G6IRTg-7|5Ko^f@0NbBlGR+o(I zrgG2>n1onp8F_`Ts5ZTQ;XW<`r|Q+dxB5PenPOvNEZ-Vxv*d&g$Zg4K2<@WSHV1PW6@~26CI$ z9V|pmea?<_3>MsM;toQp#i_~dm1Njb{lUcQ{^4vQ7B|x*Q5c`i*^FSWp1Lp=kHsaG zk$Gq|X3ifB#x`^hK-WvWBq@WZ6m>3OIBqqUx5I=P*TYscm9h-McPS@1ek&A>WYYO< zyEaT;vTi1lk1=GvPPok7m@BNBN>#=xZB(I)9LMqDT)Zup&1TLU8E_<)x%5&_v;!eK zcGKrB-?w>WBoz>OhI|o16-eh+sEVDd_2jBU*@37#w{9jW2|Tq0466%dk4S+W!!r(cA(ol_1b%O(z4+qd=n#yh2ajmfqV`!n{7WXt|16TL1-PBax(S-qT zXGjcD?M*lOb$=h-yn}ghuwk+rd+p`M%oDQ4C0n+Yw7W1X~$K=y@^;P95Mods=x~H()Ie!t{CIEBq4m# z$yIv$%LUyGs;O)jdpRL*TjA&V;jW&{N(m#XT}N+Z!xCpRwjBzE%qN1p%1NS{9vRyl zR0FE^d#=UTI4vxfUToc!H4mrzKBK<$CwsDhT=9 zvxihgkrhegMF#GTymNkbQ!1HEY^)7H5tG?Jc1h|Bvc3x!&I(WRPxyX76f)TK1Qw-^ zIx@ezEtA0BniDSKh~)>hcK7Ez3)~P#Pq>!3Rjq^YN?nHDTE8fkY^nn3rJBA(LtdMI zvpJ~OB^kv#C_l`DT4OHIw~cM-nAZ8rTNfV0zbT5!!XCZ z1`PJ03FH%sp|NT>YcNBv4ZyI&!DaUkt-J};m8}_oJdDAu+kzO9)?vTTAai) zao3L8(RGv091g0gBy-$cI?>VDvwv448jkQnL{@?_W15Ds?QY)4*b1St>sY1osA_I} z zLs40XPlPabygF1H-#)#%7=ui)iWC4wAQN2qW2`K3iYW0sVY{mnZmbw0gr3IvRnv(_ zQmP|!MDj~-5H(XSS30_4z!D@`k_p_HHN&f?WnnUxbj(1E#8lmIh{-cg^18~(Rw~GJ zUUSF_=_Y;*+cfo%sRs-+m1VSHMb|8-dH5oj^Z_wI0*D4AQQ!@RKdu{=Wjl`3Rmz7# zoLCFsTvl{=A_f%(swK4lvr?oh6(kk}ie=IIIgSzL&;tythbH-BAw_Z@+Y*gNybgoc zAqWvIV#*svW@m8auo~nMY*UFyp|{*}F%eBBB8lD_$F@hynyMMyz3XaYz0+O2ojuWT zG|UQNYVEF&XpCvTH=$3YAydoy{6v)zFczIds=PhogwQTGf-5|ax4tNksL+}gi+M&MkTAhRc z6TU5$O6RnI7Gxwp+Q2%3%m!7RCwfp1P7DoneM({zW-8s@H$Ju5&<#W8Vqt!Pk8_;h zMIyM`1?M06JiuTo_l9ST)l+$=`L^Q%Va-5Oobccf#i2B3b8J!oq3>Gs=)OZFll@Od=5e;e- z@(92~;n_cUk6PdVFZbYXQi?pMMe?R%NsPkjta)WADvJy+39M`yGAk+~{x#kU63>Wo zv~;D(>YTzzmSW~38pjuvK*EsnYtuo=>5GoDq!L{b6!gq_?UIoQ{NKL=)qS_u|4n!g zZ_>F%8UcMnv4tJL3Wg2emkwYHz+-l4|z%;hOo;UxkO_rgU ze#GpWW-Erdf$4-EHciJ024O0h&JCua*c#pMHx71>Qp6){ocVhq#uyZh(A+0Y&Dt)GCs9`^zBEHwS5W;>e?)sW+clv6x|;%`mt zjeL~x@9{Lc0*&4-OSx8 zDWuv?+;5r1R6dwG;7WquM>8q(evM8N1$LQgZOH-cGHc0xAQ}?cua!~^ z!>#HmZESM}jvX7&UCdO?k(E%$t+?>#J31m4JoUy+M%Gq273iFKzTgu#i=6t-6Z=1T zr2o$Pi}e@pEN$Lg(h|M#bSz4kT_Qht&IgCaRwVDi}Jx7~S0fsGDv<4QM-w&*;e^IkhEhjcZGw)Pf!faix?x5)p@#8={S$`taebY}@ zZfeh&#&FMjPju$Xalfj{ensX*o+wE*;McDv+|c%PDxKD~?_OKXGrG(9ecG1L6ZQSlVy`j#|8m(>$u_IOIq%*~c&| zMz3DK1AeprNB)#@d2gh%D$Ct*PCqG|Pqn@o9pKs!eYfk&sRUH8_3R_o>N%D7JKRn5@ zu}CapnU?WHkqRjznu(sFO>QQiycoW*Qpopo6iXrCJm}{=3qR&YFxDSx^mD5V8dkj3 zH9%0jexj&6wh?Bq1+sac?PZF#MB_`kHG))%Q8)a8h7aRi0MYJXp5AHMP!wM_RM@+G zu$nEQ)`^NjV=Cv!TEF49{6T-P)_qwI9DW)O4naKUw* zERY1+C-Q1pmX%mK=CbTX8&zAE6HY`=l2zr}#!fi3tX#@ZBH(NrTThsoRfM^;kK^~I zD)|m8glLID{0S$-A5itaN=HnSWfqZJS7mbNDJwMCJ~ina z6j>H|o(nSUM0!XwbMA?CDa+#ERl^b{06U9xxLComQq@^mw!@)FU+Rt(A{=Oq103S= znnL5lpi>^$)fOXU5C+?sT|HT`^`IK$STXsYZ3phTFcS-#k{}>*MaaiMQAqJ(r8^Rh z#vDrzP7U<9ZL}A7KA4_ZyPr(AS4pD0Zcjn=(qD{k0&{N{KjrK7jX(pqcFrz@!~MDb zT7Rx-{M(tLHzG>{(lj7+DiXsTXRN`&Rm_%uA|3O$Klj{ojG=^y6AJ`FL6%JBCQiS3 zePSS_xP*rbN0`HPE>!-LuT8mR?E7<60BESPb0Ap?D^#?aZOxyoi zGU~SN%m*0ph+FPoVTUYpIG2GoK-PeW0Tp<3B%LW9e$`)GbJCBD3vX74fvAa59&(&W zRNa{Q%4LUZRkz z1{^D7TqN?nx)HK5ZjA3BZ2Jo6pdG$@FpRlHgNs<4>Y1j7rk&bS84bBZ=!@^L^`g(4 zgSJe;(@|<}Fd&U18-GJ^uJ8-JwWzsTqYIxGW9(gw+=zz^N?O3V@Dm8L`7PC$ zHaGD{eHTF!h^)BS&jU4Tlp*S^wB}-8dm%()N_hTLYh=!Og*OKGflepd@%Z&7SAXuW z&2nH47G;ntzTzdb<7(7sd1y$bUOBFgR>R!Vs14w(51K?!KGn zw{IitaC}oa;yUfBJ>_1|{e!!@cW7cqPqjB1irS23YQaK~3P02*P6w#rx6n_lZ*JjV zxM9ff7Rd0k=s0`Hv1r5?O;Lpiw^U0*o#3zcO(Ujie7D$_Edh7J)_?~Pd-B`ZjkHMi zWk@c%lWxs?MI&fuduy#*d#|kzOZR9wyiKuhj*~c0BS#U_03HgoySZ?sWBoIlKc0@d z{k{KiVzpRLJ2G z%6?`ezQ?2uok+V^olnySehv*G0vtR>wh+UILa@+C#QZ&FxWRaE6b3^SEAZUM4ny1BJ09Vkd(%!;E?R~Y(n4s&n_vCnZZntY^2 z^HcV+Fl}l48j`dmVU00vj<{zL8~YH>E&5)|<)9@SaI%_misRXV#@Dv9m=|kW!V>1U z7bG=Brg?ETjYrll^alf!6NiMKWhR}tBL)2;2LK$2C>mbxqcJOD8Ff}!E}b6)EJ(VbJxxsIPXw3Tgh#hoN7bnlT#-qE-ZJpcg5vgw6ju5DnP*hetbp0 ztsxUnYSC=D(*SxI&;sfO7#K`c$qB{cZXk(#{PAQY9wqgEJ>W;D%QW9ZM-vzx3*ZLA zL?l%WrV5wDX*fbB7ZN+-H#yzGD__1rw52^E~f2wDym{9z!0z3&z1 zKg*GX`6vGv(m>_+J@u=|e|XQd>woY}R%j87pt4DY@8!=;pS=-&dV3p@{vUhPBQjCL zP6m;v#qc&^a;hu?;)eU9?^St&kn|R$gaVQj)S+{-om(U+gjC8O?Sq%@b=rjfS}y_v z!(uo~&+v>O(kq9W?oaW}ekOxx36}|V+U6VssU)ncyOK(uk_r#K%=YlhY_+BnAzTI}dGE5f&sH~&z%bxH`dN4rTf+LH@xez+J}{pRgk zw{F{-g}&9oezIW1OexYm<|YPuV(xH6nHeMh?sy!c- zNop{rj(qkQKbB%8hgWM^GvMe#agC|E>ni19si3DgP;tO3_TAz8zVJAk_a%J8@IE}G zZiIDRxO<-bi(<}ob4?;0g?xZudON*tYwi4aUq#XNnV+*6Bx%}BfG#~|ruwOup0CgE z2nA%)M@U(N`!n-zY>qJHc1vfvt#rpHU;4-TOFQg<%(`-aHNXIq+C8;^gRt-JvqjoSCZ#aDUVDn-DqslP`S(V!QMCg8y3g% z#L>Q~n``Hc<*mx^8_W8kAF8MR@K`dw|GQ(ku)zKu{}$gt-))|>F9Q&k!v~FCqu+QK z9;BMunC1ON-?#b+M^jh6;nd@A!)jsgAE#Cp_S_SVnfiF#57YoGEui;WGOAXRX#`n7 zW)wLlgwoL1yyg$3+RL?IVm8*ruvf0WNH=z^`N9>`ls+K=RW*=ZF6VO^NMpOc^GEoX z{s|iEt9d;ks&2ZFv2-(_r=r1u;n8u!8rsKcMZmYrfW!*^?noh*%k;FDbBa-Qhu7b+ zx*gmrg%K_qI{>>TcPGHf*V0yW=lOSW#-L{hI}+;Q_C)hpbZQ(+eTl+P?7^A+&UB&YWXWIrojMhG508f-GP14 zq#I5}-9*f4xBSEkl`A8kt3NR?INUeXw|abX#qNpGWEB1=pjpQZhZ7LD*tf`~*S~K6 z-o3j+VKWlcdH5M2S$Fc$pkk_g6d2#(D=xd@*xn<%2fBO8A3FR5x$V`ru3I%daHzKf zP7Fgd8|aJ}b&DY$4k@$?2ws998ObsUs7Q|q=)h1U9P3-TV*G+_yT)>{F!G5{UGc!q zjj>oXJk+6!^`FO*+gH&r61RsAf;JUIw^VL710iE&S0!Re1mwX&DCM@3NS<6Q8B!aN zRya1YKNilcz5?XH4HxX*wRzk4H$osGh+@D5Eo{}n{l_ji0215a%Kr9JITsCw?I#)A z@7O7@9b`0HRA}Hu4H_eJi~{G}wJe_30tF|NDSwE>zV27T%IP&tC?51SGn_XKM;6WHjs!TI0-){U7~lxh)otvQ!R`Geo=+wU99cQ5OEE zn7NAFr6sm~mJHT!yB{-xWdu&**+dryit>OC`YW%}p->g89IC+Ww#p@I)%sPNEXy)6 zpddQKMHNy!U)#xiNk!sXPp5;bgOrSH^7TshW&M^s*FfSS7my)N=7JHHO^tSjdB;yQ zj7(}tg?|t`Z^pPt{3)P~n|v3-(%UtJZ*K3o zi14C+gTXp?&tl~4xGu0q#5t{gM%U+D!*DYN+U3}&R>);@?&dRR*x-i~U%$SPa3jD( zLFR=JvQp~&4aZ8+XvmLL4Qd@G4Szs!nC+SNQukG#db0kp`6==Osj=KW{ncbl5eR#F z?c4eKJXuS2*Z*Z(*P2om-`zU%sLa(r&)+il+nG6bBIHDqkys*;Nx5l7PQ>OWhvN!J zmjZ^Ef!_lhv1jnQ-Pw55tRhsrgGrENq+01qrJvZ?K0n9oB*byoP3%T`5YCG1TUE;h+TAmF#lgc{eoFrGIdUu%DwQ6-_Of+b z<4E7Dl0obkU>E@2Mj=k&5Vq9-Dp7@vf}8KB&Vre*=pg?wyj+O1)WV0s0(s5 zssPZ2&I4en$VL#j7ytz)qVbvtQV!U$0)8AQ&%Ku$=1|xU@DD+~aI)3bG4)*i{q^sC z_G@vfyTqZsjXN*x%z|6U#xUaoGPs8l;Ih&FTKO2qSVr3Iy6IIm;nXWB~bW@HgcG)ztrCbi;%zW(H^M}??t{vMx zIn&u04MQtv_3y6TvE}^H{nyUVl3$%2>PT%ETQks|bDb!_L&6!a8JeBgn(7>Sz9Fh` zXhg$El}1)>+^~1&fs9LD_o4Q9R7TJL=11Jqpvu_ca<103a^~`ICArd&CwpEzT8-ME zQ_^`%=sf1X$e-}7TYRc>l5(`Y1G${xfx4co+1^ZFd=k2EX(yhvR$}Q?n zDt;}PYA<$fxbCtaJT*O{ovQHQ)$z7}54{rl{BIm&xnG3c5R^(62 z{dUV7S@(iJ^7Iy62LxlA8qEw%5`G<^0Ijf*WyaZ!1q8;*I_LpEBkuy+TA#eiDZPbk zUwpR1c($R|vo(^TOU=dXg4$X(F5Z*oT64;7KFfo|B^TCzGCCGGSrmDW6X)i@z~;r` z$-vm?6OV|WIZp$uRCH*|OO2LOvK><<{50h#Wmlt?Wt`<#XDNAT8m%n}`zX}1_I;$) z*4q|-EIi9U45q!W0NlGZqiKu?LI)_Ke8F}-_}dd9B+4_n z%=Z3XGeAg13+N$<38;;ECHy0Qi!a}jy#kMP9BR{YUP>Ob#v9TazVY5+%8-5%e(((Q z(3uC3P3}K)=E3?4^}jwde|h6gW4_Zw8?$cyW8M=YF;C@e{^yKA-*_@V4dc85_tnq6 zZ>^s%l%`*J0Tp!VH@xsd{WJ9+ykY5zxDYPvonHbbK7{kvLpj(UxoDYFPKBZ+C~&}_ z@){Th{eDqUmO_k0*%b?9AIT7Sjc`W=Nm6B1>zawB4N!YaaSi&wum>3_b3<2gRuZ~q z?oPR-sy{H${ro1sM6+Cv-}qAfQM7ly=ZtJ^Eg=L8QbY`#VKL5v(~1lGWpFVFZ+2{s zMvk&1(sl8={ta=k$e}c(!s}4ti)@V{{RJy7_7(ME{ua;r@VR|O?d9OWI7=U|r3#k6 zHW>}@QyMwems`?S4`EIX_BAfkm^}@uAEkR2T6AxO)OIKc>}hFxnLJP%CJDvETp*+g zhRW)$UyKc0*b_(~42DBOMbTseg>?)W`KJ@P?v$AbDyS2%iiVt9ebZ>D+-}2(SHL3{ z`1CCud#AH&ST^d{V`?FpkCiq&R{upZo`}l|pjBk8vpM|CzWzwf&K~T1x#*GVE>;eS zD9+35j5$zA4Mo!ou(0%PuNK8bTi1icuD`8*_Q9q-ee}^-Y;q-- z%5l>O>e~P@GR@gRXvL^>Den2+#ywG6;YF;77T}@2EHvpGWsGz3m(G$dr7+2I)VC=e z-gNTbQ(v0eDyk)1_`WZ5-j)eVlepoz9gA}3eZpxucN+>PrD)r9zMAO2;;TRDPgL{M zZBbfF!GO9e$%0Dj@hV$Sjz(fmj4)AGgk>ux;iiRZkyt-Qc4j84rx1V$sEguI8g=Gg zB9ro&Gxdk|F?>!BMUXB+fKuJLvmGKCfHww4k_3JP<}LjYh$jN=J9k!t;5spEB&6qf zW^er=boWd5|7e6^102%TG$8VZ9!?+S-*W+$89vKiAn6iogaYBhhV_L#AFco9_TJ%c z)FG~fCpp2fcE=S%BUhKr4UassAv-;l4I_%?BwhaPw0A9xo9rJE`RvSe_P}3#>Og92 zG$k9R%t}E3#$bzp14_R;@TtE#ke!~%^5TeJZu&&f-KTu7`hP#po)&DWLX2{=tdp8v z*k0!!tz@c6 zXiO%h`Z3I$9PXZ7Hu|&OVVSL-Uvh@8dCR6q&qPMj!N_I(vSK)w)Tv4ML!$z!_24(z zK1q{U#JuwOP4SaI{pyjz#*!T9wp1%sGWE|r{X~G%0>$#gr^)&8 z`1MCl?7n1jEQSCSnvrbB9XKW9))KjNY4erYN;RKLuOF!Y`dU5UM+p~=THwuyif-A_ z3;x2ihEB+Q0tHe%B_f~nYnoz#mqziGE%5&l_9CtsZE4b`r?RM`S`u04&C$4K5e23= z?y`=}ZE3kMBw!o$d-BOlcnY-Mh?^ZQ)ak+Fd4S32^*U8PcE5owvzctWy|NSySvqKP6o)unze+g4 zzY+PEH~T(K&iWHtS5vf5T&RV@sH z`=BL(Jz-)KK9=aWBay_X>t8&0@Rp+|wshySPMP7J_&Aw%oJ72{O-;puD?ty61(R;R z=;q&RLw2}79Rf~W@v*#jlVku@OHfMIEv zpCMN`;iCsG+3qIOv5#qNAk@ENcmJyKHK$)wfButy9mYN3e87z(56V{F$T$%N?)<%` zt?H|P5{Zpm$3|0jZf3=QUW=ey0pCds66R>OTIreDHF}8d>uvw5YbxCw-xGxWf%;>l zOBA^uZjcDU$>3qU82+Dxvyk=cDGJj-tQxXjTjEC2@mfB9^nF8=7885R#J*7t*S{R+ zf@GZwbl5em~LSW}h)K|f}7v}wEKGa)`bd<}9q>9+1hsM#C0}vAK z*>v{aRZ*RCS{%QTP$?Bbl>)Sm_$cb9QiYFDuTvHmZ%Y1VcFX!On*>;3l8JJ z24+`X{9t`SzF_`d@~azn4+qqnXEgX_Sh<1`s+!F*Yi`kkL%XhDHZg~w(;^@%b?1k5 z_kAlPK!rI?S7FbsnbiG_4S36f&>gDiV3!;huo(I^B(Q}Pn5 zJOr(0bqG2VAy|km#dC1uWMw5Yf0#kK6+Um9gc`iAy^%uJxuC}%AWR1g6|flM+rIEa z?k$+}KZJ!?^n6;gtMS?#!gEJ*i8;0u#AOW{599#sILOno%}a!#42nkS{e7dHXVN@X2eTl;5hRQ`fg?2MEv zI=DBSlp^GkU0E<1;8`;QFC`L;*v+Br5_NtIqlQ7QmE);II+;nht0#YT0=1TMh2<`` z!;#qL59++Ut|-RaBR$0md?;K4AQ>-?zA;-Qq&rK4_nF?V2;dRyV}#7uCSprSDS$s> z>Wq@(bVuP)b7`W8T;>%{y%QyjG~FJ_=kmE@d(ZEP*aqrMkXuWYz{Lq>@~VmeQTL-t zZ5PrnxSt?l-KK1-RvD~yfswpNLbQ$uf`D*}cqX8Mw+E88 z%!rRzxaFRU-g{FNLN`!A;1mSbC&@-O*BK5=5_TIP0I3(k5b?-Wh_X9AvQY;Dz$rn| zMvt+~(f=AC4s~n-^qGQo0P?sKaiq>);;TZd1exWYeGT!wO?3>S{6)Ko;jeWu?roZ_ z&Jn;9Ja3Oqy(->!RsA_~njHK{{kcm<5)Vw*EG$)l=xz>0HNSZ)f5{!cyum64#cJ}# zL6mv_cApntaqlM5>i)~q-D0q4-SEph8n~B-CEen~T2WNXEs8OfyCrdjKI{9#ZYh#- z4EUZe0{{@~2rUVx=|A|ge1ZC?J^6`|&HXD^jBQ!>s|Qft5?C9ckN0vHv>AYaGHqwI zKtPWqJLj(rwVk)U#R!3&-lPctLbKczl@ z|H99NPkXijeTL;&&{xZ*X=}%aZ-MYLQ4y%lYzzGW4EMND*74c{4&%JmH z6g;wTiUK#h+E*EP_Ki=!bH%FKj9G-Tjmbfn<#hr#{hH3mA#%?%>G6p)mViLE8*vs$ zub2j&e-FI_eE?wveOL?_QgwGm-}bI|ZHx8RVnW={2&&k&hp6PWw~RJ`CgST|_^G@F z{rx>pMqB;+3a?87yX@WaeakncVjHf2YDD z9sVGay)>3UW*Q+{NXf762=j6}$Vy09hl(d}YPX-Qf9V(3-jO2UsbP$Uxx@RBhQcRD&8L36EV>tFmi^$AcP&(a4eZQ5A+)Z>5or>T`I zQ=-}fmKG6}0hX<7%^BtGKfB(`90uD%nKiM%+NrfuwIh@6=fr@m64sVbq{oSqA~$wp zn>~Dz?D>Fod|I^wa6y7-4a^kh2^R?NRJibqJgOK7N|{x)*xrv_JEFxlmqjz9_gzf7 z$msC_Pa%R~ElWWgxQ1)6sv#kvgPQoDwC^u3AJC#}@}im2(<7OHU46~!;cKoQHr+jy zmQ1dO9{(U@^53XTjxYnw$?FN&xe^DR*qp$^(i^5($2q z2}dyD$sx+d@g9GW_2*@}+*QVCKW{_PF8NtSmo@NNW6@~Toqcp`Qxf51(RIh1_O#x2 z;>7_QT4Eg;sDe!a|idDs+{p=Dt{ zKG6+k%d=XAQu+RpuEqBgd0SW}XI@7v(*1o*RsuByrV}4bg_Nm@sR=Eb)v2#ZQ~~%z z&aEUn_I%)HZY&e8L`-<6lt>Xs*or$j=^ChmV+CCdue~OGYRtb3w#+E;8FA?e7eQ@mPY?AE)3V~jz*`@`XX!y z?gne%iVU_EfoUEDKz3=~4lHT}cws#>Ll30ylY%PEalBvA{00Im?Z6j9cRZvQZO}El zBcnIIeOqCDG5`^vPNSNSe}%nJwWK+o_hY#g9k{mt(jQ6pKB^-epeL+(?VqgSFRB6V z^p4NPzWCC|_*;(u^P{n3dnFwMa}MFe0f{90l3H%f>fG)R|McX*l@*6oElo0DUWg@I zx;$9pxulx_BJRIbOwlj^ zM+3zMuW9Sw{ayV7g6~D&O`?J&DT(jo{Litzm`LlH&s{UZ0?G&XtFffmk`iR8_FAOz zh##NQiD+SABeP;3_}l|)^Xn2-H`Nmfz;Iy+45y>ZS#i8KlAXL_C=*X71SZ}k_|!>; z3Aaa-P}{||pVr&!@BF~-56)b+d5ywbRs^-s+~Bd}D_%qN>xQ?!iv;f4IJsfkU?%~U zp}l=|A9+>dxte?z!|nUKzav}eW8L)PuWzE|H$E0OA7dZj@AGAlohahOAZvSC8rH!c zXT@=*zdy*1v#dBMii6CC(US*yGb1rM(oT|B{pJmO){Z%(Ywy3`(|2Ae@M#(f6aGFc zpA3Fg4y&w_Ar8r`Zi~LpQG%s61`@MvGgtT7^#wZTnmPSv=kF0Nu8Y1T?NMjkGirY;!&=hf?Uo!Mzb$WBdC5ZYdV_tN**DSb+UZEc}AI zo_)LTey?h_u?pRCh6cdQM$=xQ>C2)f5EYk`S4SA9p%4Hbw9tc=ydpNDp?~Wmg8Ic9 zG(8GRef4&eW+qASKAlURZA2R6kYXCraOU_5FyP^RLBEoL{=@sTvGay9kwj<+>~{_I zDJyr&%0TtToo*r-;t5q0aEP=>DDJk!YO8cwSp(~=s40%o{SiwRu_6G*m9dbOm3Mxv ze;i&h^yvORAZAr8fh31xWM!!&GF%`^ZXingJK9Twg)+y4q@ZTHW0JIHD@rQjX@gyZ zfCH@>#Ih;=XoeRG>q81FTB6{jOd}MY*gDpOG7_x_w@+sHc0C+Uip2Iy7D^7ekm1k( zj~ZJ>5M_bpE@CPI4ayC)6GMr>ycRp!16Dxb<|w$6EEg!ZubU`=Pl(8#?Wm3fgB7j* z$YX*!p1KtjHh-})z%Zq%W$8u+?6??MKR6BZlkv?i{3rJn$nOm0HKSU-<=}yCWgCrY z(%%?XC~3s)#nu7zwKd*!s61IVFs!*nGON?d3VL$17%6+W&L9PNUdD``ErkJ4@Rn>a zWQ`y7=?+PO1cN~WCd0^J1nN>OmC6*`iya~BpRPM};?zIvK#F@~$LI|=j560mV%r8n zK|kVviz)pjS7O-7l`Few4JT@=@XV|XKQ3J;l!Ivy=3qwY4;GZ`)A%zlmEg?)OwL&# z9wH&jh&q-x5JOmj7P)1Nh4aA8A9(uIy$Tl+wL4bMeZQyb()zUhgzAi`DYFQ6kWqwd5nf$N;JV#UdSteQ8@5HvQ|KjZ* zV91@)=)C?*V!$e;(fsL`8n-5xI zdsfLt*hzP6AX|d4!n-*>SY?Lc4&L@3e|_6YgJU^Gbt3szN3>8(X6n|jQFaODX9WpuPt)5^*>KbAhf=J>K=_Y1#pye#d z;$r{Ug$5^<9z?Z{Cy|X3FuF?661UpxJcw)KdbH#EnZ>Ix-_E;XfepzDN-}bVQnlQ{ zarK|wx(P^o0Ufq?cR1YJ+1+j=QSo=(GO?wCcsickJ8f|`6cgrbNH6ptwBV~b131ue zEYWreUEVmH3}qpKh!A8o%uAcnt8$!~8Pha!MM{a4$WXu$#j`jP)vhC*&0Ux73 zkk)<;i)8<}A%6aGle2=5EmD5)8{;ep#X(0eN8>2&6tTLyH2l$GAF9>Ztyr1@i>PoQ zwov{5@9eLk|JVC=L-ObXIjwTnR%du!j9E)NxRqjTbPo1p&rKgSq>!G`UvQhgAwAC~ zYsi*gt^mDXrL+}LhI$5eRcl@SZsyrjZy{v;4J5c~mFs3QE4yoHnV_VponI&#O^2d@4E zoG8Rms+}*_0&Ky~Ky!!!yguk}DH+A`tc1O3`gpoJRmog5c9>z-jGt`7Vms&v-}!J@ z?%*HA8ZAC6=TZ9x2Pshr>jpqNAWlo0S32yeHP6Szyj|+LMu#MspFi@*eTP2x>ks|g zizJ7&5fm9zJtqN%3ZPzH#=?B*+=!c;rq;)?;@OULtz7)!YKOgVZobd+>6tIj-7On; zkI>~Ep;-hJ2?A&eYA8I%a$%)FZf7nP31MXtx>AdfeOvEg?s1w2TvflAyNi9?_io>p zeZK-z9PM0gs2j7U^(@p>pS$I9jalIx(VAlPL-R1aco7o5p~chCFv1#iR*96% zhf{7UJJ9{`u4@7us;gB^z*@LLfh)(2pv16Fv|5X(tpBtV85u^ZPeXJL^u~`|1PG>1 zc;n{7=W*=D>K2AXDYu5k#|X->5(KD6K!H2eNGwm(Xl#EvM7TjX7D@z3zp%5rGXcRL zpsx6%Z?zGL=GXx&4>{F7C-W)&P+35kGZuGc2eOk^PS9T8;e8>z^a!}gV8Vhp zs3@7Xj#7V^Ed;!=L&7eOPU7IfFtQ4LrQDpT6`|BQQTt3$M*r%B4(KG6~KnJc_g^ zwe8Y`dIL)#UzCDRtl4B?oy!Z1kQF|DiJ>xoC42D`E9HXQp}JwQ3a%x4PbpMC)0nG=4Tl!0%^47rr|GeJglqG;YAF0+$!GOpZ?#6Om1Y z;xN|5(gUiC)mRBv!pbE9%p7CuXR-#n*AoEZn}xi881jz)o#OY%dy7nk#Vnxty#8C( zL7sv{pFy44gOCLzbfKMJrtzDav(?L<0`-Kd@eZkiCP6DqIUI``no6T5TC+>j=Aw`P z?R`)v!2rPTZWE*|qS$ccftgc4lGYm_kkL%WJoC0~A9*+(q6_K!O^z`O5}%$JNy?TD zWA2D%RTk~GcAFE^SZ~ObgJEE0aVPPSZ!4fxKve**2}iZsMHx+wRqWq8{XS8{8n_&4 zz6GhQVrg1N!;%Jx!4(O*I40J-qNy9=$t{w&Smu*;Iu)U`d2K-p$NUVFfrn?(W6dC4TSNdA&CmWhzaj zbLdmwx$pNr3g6MZ?mnMSyoG(2@2=K$J#*Na@J$uB%w1`T!?`-}j~>vn_eF2O@n=bF znj%2IqwApL_GOqH(%ndMlRv09f3HGqPxf`Jj7FY388VC@s;2>*i%RW2Rh!$sXUaBA zKZT#u-x}*=@1_bz4HN_@9Ql8!VgINK{y(zy&Y8|c1k#|+fd^zuh8jX;{eBzpSvWdw zfxRXg$`AbTpPM#_eG}!tHs<92s{fnayM%-^`*QF9urEpXiaTXFn{F>)L0%9<$|}i! zX|nr&)j?m7^!KgV3hjpshnh}x%2HQ>J}l!KUHA`fANv@%`;fZj>lRX>TCzYb-wQS< zJV19X=5v6doV!fXIob!l9X3zRFg;3JSf3f4sJ)eA?|t?6CZ`E=&jsz-Y;*<79vGe5 zb+qJ9*@|h~F^+R%0jyoN3hWOew8gvI`>jwCMDJ2s_Xjj!v!XiW_Laxjw^Qgqi^bbc z|L|{5-6*4;$y}8z6gv)|e*A__o$Zu;$jl-{KxQ#O*-@h(X7hzYo|hjTt3(~FkBYTn z@O7-@R#)8_6j|Y!HDx>4w9T{i6WmwXH~Usler8h==yQAKtL1DodtynaHoD52LEhZq zDUk+eHMZq0@KUEz_WZec2}KHKsp4QrQidJ#rky~tc0c}mt_>?!kMvdA6QhJ2y6wlC z*W01(eN?S5*C68(SU1#zq9_1OV(K9sd6dzS;VOb7B)J=fxJp7)(r&hZsJ@3v6aHtC znl66xrT=Qowo`mmOZc%IY|zLgE0x-@yFPfsn*_!}`D(`@S(=0`J}{X+=1nj0g52L!}4e2fAeq!i}`U@SdhX&oi0R7W7Cc3)30N0wfinW_0OWq zmJ4!Co7Gf3%_KMNH1vcQK6qb=LK15cE~9DW7UKfA2TSk>yT|LX(Wo4%#R}zWt<+xX z%x3@c$jxM3B44NuOb)G%M&EI?zOZ9<(glS85hkMfFt3z)`$yoNn6K$YlfAMXF>{9< zvEqm7S9m?deV+JJo3N};Aq3V9(i8DxcYN-F6Zj7*qG=<5FQg;P50tTios1Zi{Yk&D z|F!LOq4rQ((0Wr@5N?tm<^69ryz5YtT0|KK)%suc7ysx{G0u>B zf+|8^K_SDUEf%t5bLckmJ}nahe71jNA4^Ps#7=H_JeS*5#bO~U*q7nlcHK-wuUSip zfFNlhP(XMYc7h^eBsP}p#Nzb;6_LB=MEH1t;LP@*9&>JAf5~)tcwjs^wW}kj?LcfL zBLx`3|ASIY9PGCP$Q6TUrOS$d|CuJJN0`0et3MF zO)Z-^jL2F6fb5pGrcg!sCo8bV6}&lRTYg+ruOc6tBk-uGeFy&dGxkxshAVPgP|giw zMzx9;mZ0q|?qXBa@Ep{L)hPN1(eYFc{r`D9|88lj(lGTL<yofmzFI^pg_Ev&`bmgs2MpKh)bqBMd=XaGM=s#J+Sa=?%nKt z&HOvqp7{UJT9fYF*JTW{)&%v$!t2^b=t2A6LvOwK_y1wvqk`PEjS_MD?qXZI2fJe0>62<7xO&7TF-V*cZKeAzVn?gyx;pZWyE>z^knG4 z#gRi)$0CRUNd$sM(vqi!v?!|l8Cs8!=n0|ViT6|jy@S-Q*dI0NyYf5l+mARMbp+tM(Oz0XOiyg~Z?BJ! z0Wu`?Qyy_*dLnB0;@Yt*j$VOIND(_AB9(!epsoX$5U}4;Xd2Q<0#KK}kuyo3U0p85 z7HqBW$dNuhv_9EL!DBoJ&;Ofn4aW1cj!Zh^>43H{mM!*ZXMo#FYSpWjJ=V~!%{f?g zP;>kn&uzbtmI1H!`{+!#xCe}R0Az}|pw)R38p#W+nyPG#b!KRApP>P71yK>WKr%Hu zo01GeB)*VoXMBnVtOUq{RXeC?P&urO*ewSz<;F*8bw8U6f>Xjdv!!)0KywC z^mPMSi>c6MRIjQa8;yMUiBKRI&#S%u^=GS)fb{gS3)n*dKb zM>31!^J}zdMB^l%yyL@9ZEed>6>)?oAU}WHAwNwSXgxRGdw1HJrI_?D*P32)c-+k(*-847q9uU|(7I2cWba=0?u zJz-mh{R)T=V!^2~nfHJ%UX2)nmYGS=tGcQJWU@p?_l@}EWZVD(k^|feNHa{fsG~MB z?8z@Dke$H$h@(OhXgxDkLO_6tf*Me`*jUgbc*CG{MGjgHYi4C@Z&MmrRY9GiPcCj6 z2y2m|6$X$U;4BJ?4f<^>HVM7v51~Gxb!j*~2wS7A4d7RrkeyL^&GPu-KEYd9Dm4U$ z>FTW?cl7ulptl*_4V{HP0F~1cnx;Z&Z{Du>U~g;a5jy*b+I6a@mKd~N&|?8iMJ}op zZK87Z99pO7su6!MK$ZWY^saybX5#z#vhVb-AEAxP;Jl;K9L6L&I< zsbEK7*zG=ZR}#Vg!b3jq?#=55BL&723aian-c za3Rz+$_F4G*%1Mm=Cqy|ed5aRy?6iFw8EpNlkN#6_lP4T%1%h?-G^ z$0e`IXpw*-nUm4imQd~QF~ac!5de|bhZ3RijnIAEKy6cT7Z({Eh-`Z3!A<-FbDod~ z#GoK)0+7|&Ip{Z_I|pUY@@3QB_1EcfyE2!Vc@epm&f7C{0elBq(uRFw2tLC{u{%3-MtKQ0_UoZC?J$42g5!Zv0S z^ccx#4>C7K)fJYJd{|A&)H}Q@$Bcw3z9_wL<5VabOhjODs!8Mib8lwvIr8D1ww=o% zJ8Glj_f6YUxkNq_2AjO|8{d4c z&i)GC<2&(#S8ZXiAsx<_<}YZJpi+bxN`m28(9~G-0p$m1M#}<4z?6nf@u2%F&TNG= z5NPYPVd+AkMxuKYTHSnS_I4Bg_n+`U`+5{ zUv%9a(L~9zO|cyJ!>orT0ze>;E{ctcqZ`ZUW{5bP*9ca&a1hCW%ydyQABIWvhU3V6 zOuos>rED zgFmCY`mZwO`V+EQ4Hhz)$XpDn2!R&3D>N0#n=D)PB%#<$ld~RkB0w6MN_z!OI$+4Onj$1#O25Ohf;0Gf}1m8r;VxOEBx?pNB zzB!Jm|Lrq{f77C)(TIo2(&!C+0?ah0(!~?UATetF) zbdp`Ah6;&Q+ZtRMAEclubfb;zIwS#;kJH*fXo%+pvOxvMy(3kZtE8^wdo&fU9c2D& zwIGR!SD_@NB}jfjQ9#psNca3F#R#Er_@@hZ#?mDdRQ%oG{B4U7+GqN8?WSKVMpKqj z|Ar$*$BL94jEYgr0c(K;sVzk$^ukhfB^2)##Sb>YbULyS1K+~4rHD;CQdIx^v!#g6 z>F2rkvwwjaxisCuf^N3Dv0jIZt@Ym+_|K0JuWA^3p15xEqAMf%2nYyyTD-jOw!7A? zKW^*X56FO5)}-FC0?XYLGspmk`YSJ708gdYqg@x$p_9;CyM7V+ERn7hWo>Ipue)cq zqo!0us78RT_iS7-zG1_=bd&~F90dod?if`Wk?ecnESHQX+bpQ_frd5Vmt*G=8SPb|J5|Ei6*&_3G&`fR@n!P9JE z$X`HxYjh?_+j94=%W{&_n46Bp&F6p0znOm@`q+OFV?oiDEp)J>JVysvtc%t{bL6|V zdPcCeUwDHGC303Rst-nT%xyHyHi{?@M_ikHrz~ zASkj^dml>BuykbufV|9S*Ly&*Jx9ozNa98lstb%(R_g5chKIIKFXj;d0kCXH#AH`z zB}vm#f>e-|LbcM*{G14Kn&RkyI)OFIk@`)DTM=)xJUgDH92n5-36Oz$ppogvoFaHM zp@8auU~OO_hHx)f5rAkEgCh1Gj~esCkitS##}sbhdZ>Sxzrc6l8wn-sH=~?%`zS(T zY6U^%_u!Ipdi!$5V3q4Y+HVh3tHp;kRCA=Rd6;<^2@{UsY;r*Sd&c0ux>WSUAegeni8-{Xa0$qMDC zLP;$?0;=Myrm(`&z>eOUp=NZB^O@yZqPUpybHx6NZd59-zx)n~@oSbDP8RY-TuP3H z!oQ76-3h=92!(vw5s-}-;aJ{_Ru9kh9y z9_`58)k-;$F%T}m8hiG8j(pvF{+H|;_CDnDkYR5`qg!+5%x$~<0Or0u^X+M+uiC1m zEl*A`nevS~vWkD{i?)O~;zEyJeI@s=3$KSvlz~{X9+TqZJIfy1i@t=gX-LwS8HpCQ zfJHDKMQ0DRreY9Gk-%bYqe2)VCS+RxL-hz&A*R#%B7lF0rkUu|j)XSWcw}e@eF_Lt z-F^+^H7Tzzn>EF7$PfVn0zE3)r=aF83_=4~Rn#zpUxZ?Ge;-Ql!~ymmHh_S5M#-)_ zKByzg##_2(7XszEboGc|A$mcSz}~5aG{Kk4`iiyekYt#EJfosmml*{l3qAX0Q=)6Dwv2S0R}XrbK)D~y$?`#Y>I5$;UZ@lG4jGywYs(>%2s zXH_-LW@!19r1|Fl$GH;^=OV_qLImCLdqY{~_3RzYP4#d1(hHdxf$+YW3382~ErSvQ zdn+9*4P;KH2O()%r+@qT4+!t#|FY{Me3xhUElj&+9~Cf^%M3Popb>Wg|L5~}Fmz28 zx=lS#2gCY;bjkYOF%m|f;P0`Q{K6gst1dSgE{?MQQUB)i^fYX=F?5{Wc2C2{=^C0$ z`2f)(2~D4(-UqXKbnfepe|CHQYW^U9FW6Br53c#{$UXLG z-yq&_SA~l~r7jy-6tU2#GRD4}O;dZJ`B=4l>_O%{1i7kvvg|wYZ5Y2923{Mc&dGqS z<^2ANLEc?|dU-6jJijzO(o;)shPkf=%+OWe$Yh7p(IEN!xx;%{F{+gjjP!3rNpO`r z_sgfh=LrvnLq0>({R&w0$RKYM!Pgx@cO2}wmX%EuyZf%bYxkx^A`-oESVn7DnxA_Y zIYfTKycIUzvn;;OLU_8ue{By$<}K6~d!ZhP4qpx8NB08@_ZE6b$bn-ztsbMc$I=`_ zR}EpfT~#&1jNlc%R4dGe?+1+rddCa(RpaujE=ea3zA+Y7>)}i;jrX~_3`VO+ZqK8+ zC=yNRh@vMDphO~?Dks_w3{6v`RzgIam%+Zkc))bvXOQ04CU4BLDT8wq9lD@Mxk9es zFZS3ZXV;%GWb{12`78$(Qww%1)lE=Puu|xLl@6&&EJv#+J!pvy_GKYDH0)|RqA*ck zHe(velp)$d_8y@K*q5ntTD0KL%&$qvUZ^9O#o*B+0AVXb)75!z8bKk!kO86(vDhHJ zOAnQ~qMxJs4s0PxZ?&fys*Qk|wTHbJHj*Jzw1ARDNPhx}60o8}M}h4a{MZQpZXAkO zlhEfx;xx(Yld_BJTxBO~Y&KY}1_RyQ0XYdTnA$*h)Q_|O%kd@dd$we?MjhktN|w7= zoJG@!Lm(5?c1IiYu!bm8E7+KV#cZ!9((4}&$cAnX?e+Rb5gVxG&MZg# zA>W`R7ISMR@@e9gJRSp?Nr2jajoaT|s>%gZYBTC;3r(`bx^CNCFfjjfeA(`?C4(2z{?3v>wEYp{vsU-_0pfz%yma zTpgN&UIdFqlbv-n5AA^S8O@iq9}ayh?@Nz@wwoPfZho_9sa&u}DQ??Z(xN2`TRO5Q zs1Of{>2xXHd*~xS$%8%N_;w@;X{!t-w_ZizG6L9eW;_eTc#OLhq_!-d9fhr>p8TKW z_-p3&ksHg1zi{fxic0bOP@ ze_jDMt`Ysxb`%827X!q}&tpNVrJa;$c4rAM<$0c2g1e*mtf-F4u=S7fEXZb8&V8b9 zKZ#tEF+iV1`LoX7DLlsiqU*A*R|7fUv2;qoz2bfc z{&BlIh`bOm+91^sKpUm1`Fx>p@?`z9fA(z;YpSLh0WzvOWRmgud6Wc$JW8`f)3Xjc z#lZOZIC<+Ql0g6-kT*~>`RQ;pmY{VBf{0)<)&q|&4?zormR||hbU8XU7MpnSQx{|G zXs@E8#O%F=*tc8}MstCQO=vy`8wq?5`{``J>Iq+V^OZ*uu{9Nm2T|*UC?^2(z&l}c3e87}&lJS^ z_egYIKr3z8TH5t^{pT-dHDEkVYvt9wGaT7^&sWHR$ERB}N8VeT8mRPk=fZz~9R=A_ z&bhvV;z2Y8>^}_hoYLAr0wp&Ca368zTld^^&tE>o_$qe}*OH;IfjT$BoGuQCQZ%S|u<0U=Zt#B7G^eZOunlcO z&0yXL_6<&X1A>gSlnF*)RA!@(g4iqa*~M2(E~JyGD0)C@qahr!X67`Q7En74F3NDs zJ}xmTfV)7hnD*&6murG>cz&{HFrGt}1r;)ge~*y=e%kMu%pVdMLp7~vqED1P>LU{Y zY$-&PW2mmAC7#eCycizoUzj?k!1zGB0&!PqGFyNzgOI~iDFz+^go7c+I54wzsJKaB zOj*-SRB!5Qwr$vR`{`@eY7jHJ@S*kn`(K&{U$58j!$e$5_Y~f?;+g9B&D=+*9$7yB zFTyckCZFp1Gp9?5TVdOpO-vP12(6)Y2e>iQ_^drWh*Kf*RcL?I_|Vzto$zyWdfaE% zfE!LbWt-UFQ3%nT&j$3XF`G^}%Wi%~pF1z)%2vZKC7mT*j+C`&1?itnk)s#rykN(# zaO-uev2HN87zQ?cWeYdh{|7gE)GO8oeU=ttn5r*iN0v_c1AVNh0O;^hU|3-oO0fryJQRwdF0MY;C^!|q+?slk zRflJl<7I*`phI5NfA7u7(fWD(Ioau{Eau}X0)ISQ=ayeZ} z^mzSR?50bvoLNRquN4l*AQ99e0JEY<$xYCxMM14Fm}eAjW6S|kpgPkhr;@2uwUPS#%9xKW4E^RctbO z*b&~S7f?x@enYR5;KJ%aZUiBF6u|w-RS&%JT68|4=LtBC5rv*Jf))n2vi|8n>9+b; z9#p}hJh3-ek&I7nyM-e@5!LF$Q`h9zD)vXWUMI3ZfOzcUE6Cs_Gz8_=asgKurFp35 zFVs5u9EDge;P$!eth(NP{zpjmJP5lLh}!4y6KHn2`EZ&%w1o$x;55nD{*>h*bcUY&6v~@7VNl#Mufy;mrSoIwHCU@5p`zGgo zFRDU?qQN*>Spl&Ul$TI_k#Bx--;?)nAA)(WDtX6&IQPT@rxvOQu0)XNiw`YN&Gewl zlWsA>o2wJ!v#HYN z;_T#_>Toe<$sk5lMe9RW$PVXgsZlr;dgL?PydFb^eX&G@8CscHnlLP8#xf>KlvV(N zKgJYyp((Pt?op2V6bKM8l8S%z?cJke>qe&6%pSU={x2WHCX-kMogezf(DXRJk(x)I z>HLK5>lrRh)XxUGPYzas3)PezHoVxV047Q$Yop7H+j99_;pAb`{{UKlcueRVYGbTD z|F6Q2*|(w>)VsR=Xmy{AP7}gWA`vc4t-R63|%1jv@~jv#qmm-m~lp_AiOx_0WblgOj6E>!#-?YWaMGXTj8; z59wHz08I;0q+IIjt~{|Nk2;{gf3Xp9$bcC(xc~Sc&dg_1nS`OOPlHyQ@fe!-$~P%W zcj+g$UQU)W0|S$D%j-66Uf4LLt7U(EMbSlbeq=n6psm}n8~S$BZnxLh;Q;i36*{URTgEpR^ zGd0iB-nqpX_D;gwHG4E&LJMF;)T|=<8$GlG5OR;8sD>yOdjv$;A=c_f9LehU-~6%r z&Wx1H;W#>ov6fYoqMceH&OC@a#0qOxF`>%M!rUvl5u!*8y*hN$!AlDf~LXhR`zNzB}rf0Bp2ne)nn-C4Mfi_`+DCQ~y*|G^W zO}iQr4rwide zUjUGI?%`)nFnczl+{5`y9_aW?9{7(xb3bE9lKBkxa?}@&P?R<42r6KnF!De+bp)N7 zljx2+rox@Q^lx?=IZauMBGCe3wH6~G6w{48SLb_j`6&7&16jxhbu$ny*7o&A3417& zFK1=J!p8cWo#(I}O^%MD(L5M*c|-3;TWu~|D%U3FW)?%inSo?5;tdgIq1bn2MJFc5 z0WI9?`Olt$HNtc)GoNKYgt}#STrY$mLR?4M@tY14i>?NYu506_f3wrb(cf%*e$#Q~ z&i)32^c$Sw=$9vOu-B6^{cQb+a3EbUXGFsF;Q` zfvY*j2))Xx9Zei^IU$`j(Ma1jRS?YO0Qsk0^jepL$0kgu{sdXjjloBN5$B0d5Im?e zg*JuO0NCGYd5(q3kBVdAQsX^tfU4i?r+EFay` zm)5|aEA^`&^Wl=?M%*eL9*Fw{>8n6BIF$JhrkN5{}% z6*}d4XQ^dVH1!G;j&tzyOoF45oEdJd7)*k5GB|zcnfSA@)8H`t-?~Fs|u>;hGE&wUH}eS*(F#~h|n4@%f>0cQotb>F3at%jM=(2wuACKLP4^PLdLsb}-a z=n{!~Y3tMd5k*D3n*%74-T>7EtsC?itnMW^UWx1AS)L?NC9^=+}t(Phw)IU4wCXc8xLML%?axcx4#3_Y>=Iem6cYTN)8OPerc zkc3M&qckf0#0{B{twl45VqbN%clx?ZPA-BSlHoPo&aa(Z>R;108;=p?Vo5wY>f3$(NWA;+q#23z;7ynHll<$*gi*y}2gBJ(}XIQ$N=%ew} z_|t(%j|N@kOhLrTEj{ zQ@0(wf8x4{xa=!hoF^dvHTlP%3TTVI;4d$gNnR5}lS!D-;K)^l`vxxg;*r9HJyA5 zjR!sF6&>M6GkW(z7dYe3P8XpNz2iD~jSE|C3lioe{RXXX%)J;vB%UO5xl(2G!96S0 zQg3O?!a`pFjClYBK|YgSz_4k@gd1M>>33z4$rxi;n55t2q+3nomdHdAi1$4^FAw;G z*4sadyrY%$@&HpJ{e;3AWFBUhHhKNR)@LH&c)9N-uMtE~D5|?hs4^`J*}CiSrGz|j z!)c!Fr@T6-{l8V1por|TDnWA_@(yuYeXMm^THu5RfK8Qv;S|PIp&rNI&Sq5!~*5 zT#)ow(%U@5qXyumZmkV_tTV@7b9hq(9US6b&8_#iwZ5OvLZ_ZYjLES?-GYRUJ=A%( zHH*$#ZU5z>99`^rW4EP}xXRP(kV{9jis$`?sc&Rrg}Fj<7V%NS#4oeszR>ACyL$ow zf$NTDECqdV;KpJP%A1C{A^5hMH zsGc12Me@ws>tO-R-FB}N?L~B#*L?@c-UA@c1yE`tKfX<2rwH=-%9$?%3RJcSe?2@i#}fCL)C zlYLowDaT&^o}IOz*lbYcD$^_CxB znqPP4+Nt&98yL?F$Bp{gsq4mqFC}mIzH;llpjX0uBo5fIzV*REXx$rjZr{FRduE2h zKD5^jp#YuIBCq)t^SA$)b!m~kvEsYVWkHLqOU&Q-A|@ENr_-^K{z!TvB=W$XnwdeB zwGS=?&ebLNV_J z3>+Llzv85kvcX}_!+j1rDD6G{d5rgo)_7x3p8aUCLR_$VoN;spH0O?K0YlmhZnY-E zcIToaFZHbP<{xT}_qCS|&EGs|sQJFuc;Bi#-+0%LeP6w0p7)kR{m(bv&s_TJ2K)#A z2M3&e)__CCN!MD`4u2gOd@uktF$$wj17EkVw*~mA3u4Opc*L)qxL?zdhp*O{B09n_ zwjsBa^#H-cRhtS0v3`pZW`Y5WRJWiFhmSaa)L&cwW@ydhgF_)qjE~p(avb3^Mma4C z_i5tt`qMn;vy5&{`@k*zd1yRT$07LC!J$b6EzOEIpZlj3T2RZbRpdt*{z&f?LDa&c zMU;rTHKCv5LXm5M7YM$JWsj_zgO3dW!I&LOm5`kZS!F{4K!f_n?pQp6*wFq9N24_e z_+hmE8NbqfbpBGnUjy#O(h=T(a}sa{uAPZ%jl~nrC|Jo+#@2vi3^1XX#}i2fD(U3C z$A|NkfW_Pipdsf2cdUS7S5#auq`r=*eP5{7yqTbU`>zA$S?s$uSm$Y&icB{yW@q*ERUV zK`@~vyJNB)4}Fw4O3*cXL2~KrosI3R#t>(K9AXw6*fKaUa=1|AY6Oe5d08yjpmUKR zJ0&Ms=A!z)4*-@%6Z-+0>MjqNOqeJap&ze=^t^|=2p!*uHC%?$M!y4=vBvCB{ogNQ z*re>7Pe3U!4iY+$Az_m!4_kzOOi!=hxj%U~%@#3Dhz-=m8(myXip%TL`wYL!PB zaQ<51IWd;&+>ZE=-bZ-X96H62XarR z{RH9+f2{#%2l+BhH2~HlT8wfdDy-l?()VRK!tmD^2L0M#iU$#q>Ph8q0#PJd+yH7W zDf!xsahQjwg%efUq%WB}i@&kWK%L5Jw)ch<{j`f=?%8aIH-giLIt zKP?#Q?M00cHV*v7f#XjeRwRdXim84_a;cPHb3AEEhyM(%pvkGP$~N?zb-w=2d|%ikrj;n1?gC)Vufe%=op zo#y58?A`o$R~g?{6kDqa%FU6T=2v%~i$#O2v1Co$&<6xQGCUMf0+s?D%83STTNW7{ zjPSyMZp7#A7!HO8@0jDq#}i@_tTD9Q0Cfm50Mg(H7HFq%mP?9>@yKvMlC9wgZr^o# z*A-+f`vCawI{bH-OO%|97Q|4AhY8UrqoIH*w8~`aNR^5?;*&Lx&gwm**bj-vml{Bm z=|7<ZcxnUj3gLN(zk7nnkZu=Bm`2{FMT3}bUu|J z^n30Wl^qXoY%y0YSCV_tryxc};+jU9A%2Tjy>xTu(}>3>qxJ-ltGF6|t5rYAzT*7TT{Xlx z-Od-CKR25NMyEq|+X^*1oF(5%hu7wdU1q?-S04*4((ng|jEEq97hBuKPDP%wa1Sm-hQ%o^rF zcB~;|5bKtNBWK(>1R%}_)UT1InO2Q-e%k0ee7KM2uh&2o*X>QGy+bFC56Qv77&M_n zB@Qe&e&8B}NWGjE4r>59vxii4{p0j#4DAnTi*;&rvYN!}DIb-&k@`OVC(sv|hqla7 zyjA;wUB&&9tHa77|46!*VZuY>u`9pxw^s#vdIF*m1y75Adp_--%nX*V`tEnHG7EV> zZ_qMlZ3q9Tu$5!WyARbqQGcL*-zRfROF1>v9TbEuWHP%lwtMlDSh?n~V@p!NzNVXLQqgT#v2gChF$b?lm1rk9U zB{couyUClPknzJ?>NCRlto}MMeqfDau3g*L3%OHc~T{;5^7(L-^$;B?#!6av>1{%mi6>Q=UE>-qCY<==vwH!bJF6z{AhXSP^2`yTYNn5jT`c)74drwnqz{RloES3T~Q2&EiDm5 zi1Vg7pQbA|volpG_FePT8|z;ixO;2=XnxxiX8}?`O>+Z$OuWC=)OgHZt5}pZxl@6SCEfI77??Eugh2vypgr^#2MBL}(-e`nvMY zUETbAS^$w8A{9LUI$=yDfomskum7t4?FS0WyUH?Ja{xpLx)6{M6D?%$)q|S~A0wB4 z`BGnYeHIn(;Ll*{-(GWDy>Q=dBjOc;y}iK=_us!kx_;af1jh?wa*g@;GUfyG(wvXr zYRE9%t45p>!lnSPE-!>Mqd>a_{=`9pMSzAI^T+%J^I;%+89p^0*C7g1?=hnzjq~6^>5U>lFEqi zcc^2{HD!f%Z_oN@H7Z@jv@sIeokN47qr2Pq{5xcr1RwYg^IELrAQ{Gju0LJ>Z{In0 zd8>;#ln$n5h1qcK(z(`45E0`G?R${ut^bU=v=r5sxeFT_pUJhl@-LM`PagiM$pfy_HS4`wD-hC`|2P3 z!sA{+^LAG^e2MI;f9ksRv%tFoL5W4M5s5m%lgW-`d&;%>?bG`XY^{I&HUssqI{L~2 zLP($iOn=}k;g^q&^!?;)Et3Khv|JynzjWO?a>u%LR5veRuu*>71r|M57r66_Ze{u6 z!qZQa8IpYH>8H^!_q@&w~|AF&S<=lBbwQC#YD5H%XuQ?aabJIM9 zgOv|LpfVkbxT%nxXIy5;Em>)3Ux7YD)I_JZGYxk_4F#+wQK@5PixEk zN^B)GD57<|k&}hx@fc`E&{&Z2h!Wx~CZtkfIN*PzWC2}{$ER=FUGXJ$W|(^$YmCs| z6+#mB>Dd>sPMdoleO^70&OA2FRchC+nz!a=>NqfBd+{P5w)#Qs)l7EB?#F*zNafSD zh=m_T9eqv%>v?=~A}$#=`etfa7nnu?)MKDtsUFNqXzTlVGWl;exvksrL$S>paZ|1y zJXi&5MhLZjJOS`KA1FnE9S=vt!?vG`lqS>iR!Cu{Sj{n-&ca5P-)M_vfgdbLK$04C@C~J9PatyJccj zFfJFk3<&c0+9s1T{!oI=2W;2Q$-3}0wQ-voo1z%nG5Xc>(Eu7X=Wo?BPRpiud)w9-R49UC2qv5c?LAkBBTixsh9bj| z^u@)D7Y(~rL`s3=V#s%1h4g&sJKw3l_5j0Yy%yl{)N$z9y}N=Xsyh|yNIszO5fTos z5K#oZvU_)rkxYVbHDr0SJacjVwNOyMy6*>*D5BsLhgZa13NTec1gmg5%S?QiJuCq! z;6rpYziBzY|D*L^-aatVw}xTYz%E|Pv4P$z$0x5XnVVk!`c0XI`3!1`d?3h_pILC0 z6*Ql$O^SSGaUpZ))1Nw&n4UuYmnoyEw1odz*+ktk-aGWEPan!GEM|CdQUi&Zt0(^s zJ_k^a|JiwVCb(mk9WF_P^ucS2fFRw$S~{`OqKTrQopxxeX0N$EX=m-N&pU}|*Tkrx zCLO*kcwog+C-a+&vfhVgm_|+Kzs7v`kE(?A zz`3J*R;^h@%0lK4-YmWI+)MgS_C*%%`ozWYiRC;k9tR#3o;sFT7kmB&_#dC)k9YNU zO*ojSRsGAkJl4%1d^Omx7`7&z1_p4j1}@xH7D19p&oCWb%-vN={p~dEsnr}{nr^wB zQ}`8{F+<&~9<3iBUu4+16=r!P*WXP*agLy&LUC{`v%)LfFaPcfE6mqn1k_f3h(Gz! z#@TSdRYcMJUWAt`(sKW~x8A=v*_{Z3V;a|{=N{ks{bSK^A&n#kGN67Zs6o}fUz3D~QuWV0 z`5v9~=!MeS&yYRQ=!;LD*>`+yIs%uN8euze2Tn<)2V>b}aqCr??jBGXE|1jz<3*GM zB8V^=f)VI5sd)W?@ZtBF{_!(1AB)Fh{Y4^Q516*%N6C0wKb&!Tlsgvav+ZoYn1+i5 z5BWj^yMFf8`mObUyt#gh>mNHN+6P*WGFTD>Y&H&86c48#HuchKYmG)K++lCdVjk^< zosGE}%xF7%;4SDNAjxL8HNOzi1HSs*xp*o#PsmItohsZ@{|9B)z#ZHBCkp!)#f9!D z`S)K{V<)F|Ra2@MIj`#Xg{M!(YQJpTmMHPs8i+(v7oWLee>NVow-YzeFvlEZgaVRh z>iEMZNMzO&!{{SiKpGnV5#&s|gfxEJja^-o z@#ldP-m<616YUR@?y-|oqv;#w&SW_jZtpXH^VKoM0D&fh5SJEBdG~GGx5ETS6}>57 z05EV=K0T$3pE)y5KPHk5tF~Mi{Uw(syFMEYe`@=%jz|r;jUaVJBCGIsyMAc!KVGFnjsp8C=^>))@h=a1j`qf5JfR+@r9~4>XK5#lcu`>&X9k}xcLneGITmSK6WP!%A;MMV=p>I`LG}tfI!+BwPi@H+qp_Qh?iodjSp>-d(ERuxCC5X%j=UI7Qf|xC zbQlz`3}2y%7F+RPTZZ8)M{8Uu70gEad%Dv*ZL0WI9D9Y-J;CjzT=tJx*?56W6t|Ay@TWrNkEHE#K%TP zhK^3JgA*r7s_ysOr$3%Z2K&Prrf46TczgZF!Dw*A4%wknfn;SO6zjjt=JBUJf)7Zb z{&@Y1Z)Z}fu10*`m1-|Ciin&_#1rnnQqv=Nzy9wYU5kmrnQ{UP7H&+Y=ST|uc%k3E zg-w}PeZF9I`J$s7kKzwMxLa-8I#>p`08;GVawPk&;G!cmCMf!4-=ePDXAXe84yzv) z&0o<2ekC&3BPEJN!}!Qa#S=pp9*!N$E+nyFVIiM6cRwz`Fu6@*+jAwqeo_Ba3PfCv zj)cQ6d;oLvPgMI)G9#FQ)+BUJ3p8Cv^xCFU+Q=g(EXO4Cym zFhR{ZTJ`+wVg!0AI)82Z*75l}Sol|cH!5ST>38peFh;R>>|T^+zz@c#@@R_W^YtHD zmo>pMgcK9rMh6;bSjo)g&FIy03T#Kv4oJSFP_{$E>rQ=*7<21Tv%{eO4C-W+%2z{7|RR-E>!j0ipraHOiX4JQ?> z8gb9N5uP~<2?MVIj12*d&8VcGd)Xy@;kccmDRD~K0hw1sHPqJ^%00Nt6T!ZKBoNJ( zz^->x1%%nn10XX*`&E0wDPQHHO@%;FV-@s64tV%TI2=xIe0Y1q^99%io$Cd=lJpLp zeBdPD0o<+<=Py=6xpnJvz}0xe>~r1>RU4jA(34phkNMDt5LrR=H1nZ> zOVSv)Bre-|o8HXX4PpuOuT0dn}WL1B(7P%DT|5YrosXP}fHJ(Hm#Ck09VZ3+yPoozk>L}ArFhz_MtNw3ump1PisH#G zro7mf^O{#P?Pxe!>gn$FdZ*Wfp*d%A zN!b(g4}uuo;|Gm0n8xG~!)+p)t8ut~AP!X&Eyc%r=66?a{RV2p#Nd&=xAl$ok1cM8 zrpkWz4QpzHIUP;_*a0{#9v;o_xUKgaScROfxPyGRy--p z`04G(_stBBR{&Pi40JC;BoM-Y#=9PG&&Ju^XI^>m^~GYTI5V|&#`LL5SoM%|ZAJCx@i2eM?v4jb^-jr zUN44#QJbYPLpYjvG_B;(RjY?isn`i+0Eq3`2Y?R~(Ws6{^P3#{(0LUJy;uajb1nb} zGQ}7E{M^~qk!mqW$v{^V=c0#$S{k@BNqxQ-{#jR+hC4njF(nWIJ;f*II0TW+RTOw z4z&SY?l$K9>%xtwu54~)Z8@g;vh`?Q7wf#KF`fOhLshrSsyjX7#`UrTjnaoz?ibTj z(&2^l9_9pNSS`Jyn8*bX)b%1Fi?lbHo*!y+goNunC>nc>hm5M`#20Q7J)LV%!XAi)Rd zDHu&fld0^$*n5r!O`pf4E~o!K)1uhsU}$V?WVqa2$Y_8|){pPlG+R?}LEKA(ov6Ws znwkt^C-8VfgFfTvXpgBg+C)Eg|0AE?fAY&8_*c|!!{6e`FG8}OGX8x3fmV1coK%kj}*G_+;Y*3E(kt#(vP zRY5gDH)(L-qL-89mjm51N!dzyks4R}vz1iTLX{<}-kHp2N@I(vr?2{hQ(!Uzl_CZ~ zl0s-PlGhWqLVh9lSGM?cpFt2+KvkQlhdc~(tY$hPUPc-yEt1i(7tQrh?t0vl#*g-$ z|9kdJkl9+-Pa&~X9-0v44zXxB(`^B2yrTTJ%{N=BmfV^MSFox8?L!pZ& zq7~Em3>b@)D0Yh2zHBt)^+*7)LHs~L$0!y}v`L3J8B~G~i zb~xcwHl1dCDDD?!FE}DRNK1l^n$`y)COxKm<_l31eX{8kz*M{HHM)kl9Gwpc2*(#! zVm;LOFkl6MjvP&h>5*WtHKW0-qLm}LSUBOi!Cxu?fMqLG;nAvfR?%cT*qhFvt$KKV zX|nvteu#*Iay>(kWltDH(Cm36!U(<~{&RjTa&s9@u(d*us%(}xLyrWKv>8JpnMevo z%6IOEAU=^n59se7xO$VOdgOv1?X}p7Y!Y^M0(_QW^FmGs$?TYpum#La1@%f4Zja!W zhq_@zj9KY;9;FDtAgcT_Zq1a61C)D`GJ#GYw*;UPEr<~$P$f__DVm6zsc=k315bQe z#Ikud4j>LKPtui?#92i|!Q>20#zX#{XfLbI&=}&>!9oQE)V_So!^62?x?=Td=zA=^%$n6}{1S5!bQ5HSSZ?O?yV7B2j#DLr`Zj1`THc5vX)zDCZ2YTCvHVA8q; z3rO*RIn5Qzj*B~5x*3k5XXCpuM??Vcp`I9^z%k8X59$+bhS_4r59eYQtXSDk@qB2! z!HG=$&UiRNV@EU*386tA1xPD+fJPEoQ-N}$deKG|HNSM|#Vi`AGX3K$+cWJ8gDpZn zTc8zo&_r+n6;EQ&!+Lzt9hGGFpcRQ`cbwY0A(x7SpPNFCveVVcErXVZD1;Trn}Llo zqzm*Qm=185;;Tl~=wuoDz^0kq0DfvAe=N6TtBSQgi}sva{eN|jGIMaZ=CKKgj^9BiFmwdd{nNKE2CFEwZi)j zl^4R9!}Qaavj1{*C6kZN5YijWBubu;Df9Auy=gKWh)0rzR1(WYo`ihd0_^Wv2m5;y zEMP~Kv}NPD5cwh2ktKXj^MXjf4fLpV6VH@o&Om(*1%q$?)oOy=zn4k zem(Y@+E0#0gB__E&~9V1u_9JkLGFrm|Lu?hccpew#-z?8oN!uWZ8x_V`s|+BL6CA_&?x=(HEp86p9qhxd)^teM7fbs<-;#eEK ze6r=fGndn18NW%Zs0I^~vlQ8Bsy`6al7ZQdBHm^7;^#aYvz;t){0m{W1+>G4NbXV#7~^XLAe#PDlT@(WG`5Z9}l4sra{?BLwm>R90b_yxgVZlQigKl0V_Sg{Ze zDfX-LXy`yURvLq1T)Ulp6Yx%7LX@MSyQ#KzrRMk4FlSHv-kaWk_4{pG`|7jYByh{y zyS@fAmLpe9&C;PW8a4=h2UwhjPJw>uq}^@W#Et3!9E!}k>#TLy5Kh>v6^M5~fZf@u zDrw%l@l4ZOO{(9{oJ-@oIqGbP!ci{J%8k>%n4VO$dmo*hnH^hGzKUaan20j*Y}j{_ z=XaW+KxFBt6(HohuUbJ%F}kc(QB@6w3xv{3$4p*B!Vny*68Q5(@>DRq5(Vl*^9Dlb zcI#E~87nI2ucK77ttr?8EXcQL0+UZI`%8cZE3lC%8!Ncb;V&|;VYJXp(69 zj(mQ{ru8FH(*n(rU85Xga4gUgo|#O(`%z336=#?rfH>Q8ci zg#HBgU?+u$tbQ~l3u58eqHZxCjjcAtqFvcQk(@2d)saXyVnD5BDuPWhY@XS16&S_z zz8z9Y&u3mIB4t4xVO80F1!#E@aq=1K1}fmxg&KzWnnc$h5xhx2JED83Ai}3jq>-SU zt70!hW(=}oI&%p@VrT5|Rp7t}zp&FLfCdea@c~Hz%;e2`BGE+R1pI|HKnV6+G|+#; zK~3XP@(xyAhWx;rH5Ci>RuTWZE3W^*dZ$J<`)$9Ccq;(aoPf+JvLHO#b3-&`HDagt zoVA0JUuOJ4Gj#DGJK)Wvy_#}q3Jm%u<7>Rqoo7(92!3f!wcvG2jH&t1MfCNHmag*_ zM+(bT^wZ(PYd#u|EB>g)D1H_D&L!u6#{PnT8?vge$BeBe&ImZ|sj11~a^kf-;^wT< zvG24C$d^+M9#FM)6=>6oiClnC~5KZ+(a)I;}Pl<*dv0}Z3Bv?B7erX!uUJ@*4 zAbW}%*Kb-1*-I0C-&IjqK?oQd->Z~!x6L{}wIL(mkK1=zVbKCvm19Gsn;92^2Cm%I+WRe^4Z zMpMV`z3k{*33Sq|lDbqB$7cifhRMb8Vls_P8c#WYop=iSXxC?GK34d>j*fib_c+)= ze(-x9yEs(e#QutZ9NkOb1l`cE3g}90uUqhyP0in||=Sj2%c zlebJUE@9THi{Nm2H^+i%_g28QV8G+E4nw}Vuo1JO>(u#PPUwN&xcvxl57+?#eT5Xk zkJbb_S`|c5#DJz*wb!lObZVP{HjTOh(h71cKiD&t$R!E}NESp9CMzd~QHN5}Rl^7* zBz2_F?T;{-wGZk#7HPOY0&aY)qG+56fo>1032mD+-`XHe&k7)}&xJw!aagXh+O zUdAvjE70BZ>QjYuEUaq^II)~l7~C&v=5prZ*fkd!+H$upsjyZMO^L+%X6|DCMmBF4 zI*R5<*uahCR#`6hM`9wIM=_?Sq;i?iK*sMeIOCv=oTEpWxpgMh8-MfG%|P(s%A(d? zn0S!z!)tFRrKz6DnPtGn0(SwY6W^tHhSwRs1ILpnfQ6vAu|)O_PW|O?IXd{rZ!zNc z@NYMY$9Anb|M%P**e`ayzw3itXp%;-sWiQV=JIF?WD8u0V^;ebG*0JkUmaeGvz@_E zU9~+?3)gX9+>6p3i$0vyi2GqFI4kFQeAebSYCZRhqd{z7Kc`Y>%*>qHHipJ>K*b1P zMSy9EmS&=q1&cf+6j=%Zm?=QOd%-G9YeQvqdc2Nt&oIP5oHNQgvkbE3oMiU447!J z2_nO_v4Q)*Tp_^E2|pX#7|gXo@BL1N?w;9QX@zC(^?OW9)3e=G)z#q!l1C*|!$BAjIcT&A0 z!=!F|U3SJ7BKl=KvK)lvDk^PT;ko(Ea5jXH+7B)&Eu#x6q6+;@mf3j~CY@geaqJCm zVwpk#>@mn$XM(0>>Dh83BLm7x~(?vUmyRO_1}m(>XnjOLZ5Pi!NX47)g{f68E&?>Z~W`m6=3UHld zEV+N<-qpky;FQsyPGX(=TNktc#C!p}+vgFJ@)K3<067*@*9OvFvCa}hal%QpSMH?w z%aA;ic#&%*lC_LHi4&FbSDZh|Zqxx(GT!t$@3#Y0L_WIDbLEBXdj9$D^XO<{_y?4j zpdcSfxvi%C0X4ge0M^69>jq+LuVhR+@1*tg}O#@NIR&)ab`wQ&LVYBG`{!(e1} zzL3nP8!HvoydfRLDJTf282+y`u>o$JEdPh<|syt}jOMIhYc$ zT6DC4WN$#8P>r4OFq|d}02t9&xGz@+E^3CusQ~6kRDhxcxVF zn#<;%7*Ja;L~X(T{&J&OizHF(2wU--fHr;2YHl_#o&-|VuFQAz-sG+eBzOd~ej!fv@Hlu%}1Bu6Sf^_QVzaj$r`X5&UcZgM2q{ zaUenBC2f8ACeP%}_E6wp??DOU-^ix&#iKX>!HuuyXe*dV)$aJp<2O~a+3*m&4Arue z0v(H_D%Ua8WJnmx_r4D5iU}TY6_ds%zsNF! zK*4LlWV|;E{xzxGXdy>!G7*rj@@gi0z{XrGX@n_yVd~m+|J>Hb*z90xg-R3j7&FPF`ZAW;sI~s= zwha`0O{P+5Y<~xktF&ZoGHIf7N~qjm81pq9$eb8<6iipFXgpIJIB$9+%!9BAabiM) zgicEUI6%UX1CZuEd-09$xj6?YBjS|NJr|$&8T%~rnw}L0ZDcG`k~ zZlS^Y-xA-^&zQNA;RzG)%bmsL%NYVijwrR?UaMZ2Pjgbsq@EEFA&-sq15n?P6e=ib zR2XeQQ=k0X@u|}0#g#eGXT**jyXlAZ#?Zh&T{aI*2doI%XwEdV zW+a-t>G$4$)4d3=QEcSR=U@BU%k-e8q6G}hv51HX0Yz7|pnld>tv^d+D=eAuXlBD+ zq)+6&a5j@koQL&{t9$*K6DNMk{CAA+LF|8Rr_5P@-fmd%cQJqcxr2q~3y-I=;toIQ zUiZsaeG&5)Cdd=0?*Rq~@q(e}BMBTV^qEku0HEBitD;Utk%le2`zp)O*HI40 zD`#ICj7y^+r2%F+%sHeni5S8r*x}T)ywmAPZ!Z^LW;)OQw}Y;7$Lc>)Ve+M4QRT;{ zf7NvvtqoYeAL+TJ=TUU~6F61WCYXXSNu8G7ox^PVqyPK*K9aE&nXerFEW8bX+* zjweF)(qR()>qO*;3)=0S;1lSp(fX+(xg83|4;@JUXLDsGJ*}e%`HJOj47*$^k&qT? z+SEdJ?2138YRRa54O!%HSG3yLd7GM}NNwuLRI@f-E`XIPR3pa7?gi0UEupgioXoT( z6+t)4YXB<)mV8hP>mfTjym{lcQgvudmfyB-n;9^(1MJ?Z??eXAucoim_I@F8sZ z+^_6fsiHcE4*)qSbDU%Lv+RzG4qjn}6Iqt+s}?i4#4E}o!#p^3-E~uj6-wlyMFPYx1bh{n3vD1c#PF zJR1YPZ8Dz8Hz)R0iFZc^8hHj%2^$3WrW&#tMTvwGAOV^Mo<543AWa0)5yh1Z6)G#7 zS$}ZF$fJ5))?qh_f&9oSmyV)!k0Qv$Krl`qM}f*vq_JPB&t$Fo0~^omGq=e=iVQb` z!uY^QUnQ9jXLxZ+Ks{e#^1pyw1|; zNkd4?|LGO+VOyeuwhH5z#NKcQn*LziFCjfJ84INso_LOV8fEmXCCHQmuUKD`_G>6;<%2H;)x{D zQ{+XwMgGUbeZzOWoy)pg4SqvHJ3hIG^+8+CCp*~&T#P*23n3ryBVuA9ks!$EY9^zP zj@f8_Y+pjb1PW+lRs_O>iU06Rw)jvnnNO{Zk7qQ{RAP$ZIY)Dnr3;au&L-ZOiW)%~ z~^3QPpA;IMHZw3!sF6XiIFniXw2u z@XW|W^E*^b#)kf_ud1r7PN7_!_=f~1L|U3ZQr;T7FFv}MyZ^}7-d@@9ipkg@3Kpak zVm1{J*KAJDY5d#)J9*XdtBxz-n`X;ffl&isY6Mznd>Qm>0GoXYJ^Hm|e5?-WiV$+* ztZIg$?@(wUU8oVTGnFp9_y?~GTOlJCiJ)p7E16*l^et0~FwBl&wAv@C$t1a)6i*hD zqq;b<1(><`K?x+ueW13-j^y4z^&LE?SS;kJ*R<}5A+#(^3h+Ep(J1%VW6@i0IesA5 z8zlPk$`k+0eT;c`&zD{O=}QNBUavJFb8W-clN4`myXMys7vD_;kgcn?y0n*nRbkLO z6oS#&B0It|<_ZjHTI#;3O1VixwmfNaFM-p$4q@~gKX&8!Q9EQt3_~U&LqcF<^(~29 zvcPCItUp=gNKRLY!M{Yy0By>#P}oSDU<5{^7{UqxLRp;6M65(K5{d>DQW2z}QgfKNHKSL9vPm?LR~*d2v<7n)>aJpbmsbxyk4uuO{%Sm@_rsS%jC zNngZigoCjH5P{(N+y2KinWO-4Q6nM9ot?d&NGQ$&8S0#`u-|e^z z2uTAy3l-ETOWZLvh4<0Dibzp;V6IP7WTaF;?tbe_o1Q})#rH?ZeEz=Q=XRI{$=5K{}A%r*+PA<;J<`5M}Of(w$*O? zuWtRl=-%3A@B9CTy-4bvxUcd*hrPJa^AIH7u^0USx?exw_q)P$=(aD2E_21b>i`!= zWDVY*vrb+-bUj^(0t#bpPDMmJgz`}nCg8@60c^kMkOL1`#0)u>1M2>7L_-4kFSxou z$jo3_$j@H*)Kj3ztsFi>$ooGyunzM68G-*9L8@r(+TBE-Hn81@N!Wj2f4_+0P$%Al z?r;ei$wK|EEGa1>4SRj(?dg|z6r2-N-~orr;bg4*&8NZ2H`ik26McmI&#(DP{*U7; zp&bl<0k~Jw4&SJYPv4;@>6qHidLjz|sd>;djG?T+^S7~j2tfnj^ZYGieNkN@Pe6g6 zVyw6Hw(cpWGvPUEAl>Ypy!P#r8!jG9C*Yz+c9l8qBU@+SSbljgd{D7!vV^bU8HxI_ znXF1Bpr%^dk;Pgz4+r8BlR7JsOyw_p#U=Yj>Xq~qz}Fmq8&4|Q z#1Ti4&xXSjT)93%$Qz#iD|#0vI8`J+FWw&A?ufBp7u8O~u;&XlQz(LS8~^BZ3TH_IP?sP*yZmR>9)%Zp`V zd0`S3pM&LA;LUhrbs7$q(-N>ebD2AfKmr5){~GcY=#CRlx2_eYA*17DW}uh5TMXKA z*#L&AA7ljNvWK+{$s{xqInG$aw&Km#XpZ`w?^Eeeu{NJBl^QYvcOZpAXi+TOT(=Jk zDCXb#ka`vUvAgIu>^ub0!NYd_XHPx-N6hlGuLEf*L;C(Qsd%hEpAHp}9p>>hIR0P$ z+k@BLbH&KOKm*Yrgnv-v)%w7@r{ka4ILcA%#PUZH^Y5m1vwv{-@H0Emj>eL*y=s4B z;QV73UH!!OCnlXZuCt%vJ8$vF^rhH|FaiI;t;Abx|ADOlaYL*r`C;x>3gm2-%Zuj$ zr;?30!>mDwY|pQ=`64h)fa}2x;>D-ioo4>xbDrJHIDu$~I@%!Jl>;= zfC_;hRjE*jK#~j|B$eE$gCTi$C0D zLE!gAGgT-_m#HGZ@s+dTzOscoA{pj0W2$)QGoQJg7mJ$5(xMeb{c0dlvxwjU((s*%?grK7N&EIU%)hijo9*@5pu zSRB>M*wNkhocFzaj{AvSp9A7hC#f`4$d(Y~$7imK$*)+u_8OKNjuR1a$3t(;n0wIAc0(!q7 zBdSh-Y8gg0&G;o>R)Z|JZ?2Ti*aOtkfj{E;tHPFq25h#l^+JBvRB1TdSKQI;Y^%CSh?roWGvH*aN|<6D9{YBhB?n1q;ti>z@Rpq>CV2M^Oi0o@gDrM72;#ze2}Si6Y#d*>u6xtB3Hp zA{dWR0EGf@QOj>!-j9;Sh841q)l${Nj(RZX)Aibb4L)<4O(45q2*^93%Ea0&@Ju^L5xL%(lR^I-OvNCUhbi~+q^;{HaBFx@!|N|?#7V_<-w{Q=6HG!f z63ow<9Hn$JfQ_(PB<^sGz^DD`E?;yk0^Jio9 zQ}-H1+&1;^`EZkGG@RZ%|C)2@zb5C>%!$8q)+l^!VkP@qL#IfDBt$E2k&^4aba3$e z1>%QFh|ab~fVJPjQq56s{xSAsh70Ck)QUoL54r+abj+eoQVY+3?zGuA&T*E7RI#{$ zqXn%|pBWr^)mdW&zy~3FNkIPn#sBn&u+*=ajX$BZ-u@1jD!wwokNq{@(f?2Qj>ukA zT(cKByn#OMud@xE%p3S-U;I4Yz?ZEjP;+<#J$PQS-*oW?(!b`d`QN}>L*_Yp`gtaC zC6BVEJ-7c3&NF}8V?WicB497;qp-`pr#_O-xvO57}6Gb#AJ1&t@B;F_$hVTE%jvXu0^Ua$rl%+Dl z?8~V_KxyWCOP8FryBP%R5OxGaSEN`BsJkLT=Y{=>z6MD#1B@Jw1~{Plz;*_gA$~wm z5I^rq!z8Rtgmnp|VphFx>C3I(Z$0_MpP_P`riICo?fYKVpGWweiG!gUY`P%l6JxR2 z(c$VbmbQ#cu6fH(a^=lqAHDuNAftwrE=89YFHEM=X_g6r(p(o%287}X(e4HB-aH^h zqv!||Kqf9(VGwJ9KMZa%I_8KS-iw>VC9p>kej5Yw*9+-8bAFrWA-B0^BysQ3EHL532tokaSO}mwsDFBV-q0I`aL@{*YkixR`bH&b+C)KLtyv#D zYwOmTS6mvfhU(WDwfd-u+mnx-IrLbK`2_!U1+_1$>M@t4iaP0uTNgQi31qyah@acb}p z2!$Y02=cjYHEZU^8)x+FhO7diqCvPZdn@(s-}B=I4B;aZDww~ip0j(dCw5=X?pmVW z7>9@3v=r?iy<2BPR&1O9#*3+u*V>cj%rYi!4LeTPR5{aEprVb@N}C>!xR?mrp7A7EsPdZ-Tz?GA8Q{Xf|`r-mzrpstuQA zIKfGSoNPkxxEx^$fC4OkCNbq^IEXrXW(QIoBv|9D9Y2nQXOdTI$0o6Hc-fmSkJG)0 zHN3SQ)zeM^jEwq}%oH7JKCA|pcQ2n!z5n*~P)1m5??ZWW%Uf8m&?V!k#NyV4odw`T z=2Jb-Qcz-JYS6)RF$WuE(NcMz&|?Ug9ng~F!OS)!>?ODCYg zAK^7Pzp2^RC_Htc`;94LZ_4|jpY!dpKAG1XPv5|-?*x4TJUh1b2DDvRG<2O zs01)dW>J-+`njGutGS5iaJ%6IP%Tx+aFW;XSy#3UP z=OY81#PiFaJ-|%8P@37Zsha8Q$L0hIZp91aoDV;5mf6cQi*Ltx^uiZ8zdc`_Jo9PC z0P7;>L@RyLWzM0m^EYijqEB{zvR=+K|NhjgTR&}mo4fA&-+wI?p+>=({Pot4U;FIw z7aAF-I^_8i@Qz`FF(V4WWq5zy(dpDB^!99hkt6d0@&SkO1q%_}fp|$O56Cxu-meOK z;?5I4<_pOAe2w^YZ6lkQVeNgS%)sW?F?Vl}qK0h9sa5>%24a zW+aqi;0}_0Lf^sjC5K$K^B{Q~oZw&3zZw7E&b3^7zbjGXU6TDPN~ZNvZSK`S+`YZG z+9-`x8YVzik(~kVg&vH_#9sqr*#Rn7s`QWaj;B-9TR)x(+rc=+w0`R%dhX+P4 zyp+1~%MXR&yr2aGpunJR!P`jmAWwzll*C9uxNMXrnjF3K^Uc^fNMZ_UEb!=6LSuvd z`3n?AHFAZaxqaIYM*7j8DF7=J4HtL-b5`JUVKI+B4x)T1Drl&o0)Tx0Zh-8PBXub7=$G(mx!t)>#F9l~a zO=={ZSpKCBVigA4d2|LAf92g$2n1l9yf2}%^w)9cd7A06r*e59=KI%jp2@6{s1Y7W z3-bOFC(q;U#w%zFhEGpN)%fUvUTP@=8WhCkIi`0jzwP>;P)mv4T!02AEg*+M%b3-R zo3@rY87#s8`huJk?s$qCq^#FG_0)5R&TX`we6J`j7VV&cSdNqN<(m}RP=`S+K>fe> zUNjdqAJ`F;0@4u9rGguFyxK}G9C?7EAI)q^YU!CH!_I9%Ku%9?#P)a`eZL3Re!)28kD2$LXU z=bdTV)t@9K?uOTVtCqOnc&W=v@4{vFF5m!1V5TY*!h6n6@5~>v@$JtW^RPCkOHg(y zPGzs20Bw*ML=u>%#zv1G%*XdnW~0f_Bu(W5x^B*#BgtdEH}A_OQ)m@Kt0RUMB${ZX zuE&QL^Z+_%k%5<$G>eRM)RKg>le4ES9^B6R{%mv}WdwF3eQ*ScpkAmwDH5k;Q1s*cn0w&?y80iADAo3DZhZaYZ2-myzw{WHR_% zAb$BEjN0HUW56&$XJoapWkUr3SuEN{`+BD}trlqg<~w+0K7G3ZKCg0ZjHWBSz*#f0 zQHF_=razis!q7b%fah_Ld!*;$p0~j^akk#hfO}p{`&GBtq0kQ0y3rYb8IsZfY{+Cn zIZqVGrJQ*zV}-km)kXYh7hGb9LwQ@2Q67z#!z$FOP3A|y*wgJ)NAgr(o5B6x83v%_>UHE!Yy#I@q zt=N-5fVyTpz5)B;r4I-^p5lJp~8rnjONe98yp461_RUVhnZrjROF<$%++FH z0Hg>SL{W)Xa=i=pXizJk-Bh(Tms5Hb1Tb5fN02)_M(V~z^*Qb zIxtpQaXJ-Z4IY?quylBX4W*_H*QvEebpvj|`IRv&lc5hWc z;kL-AkJHTl*HhQDhFSyE4PZA?taM`nNNv^ff}+$n9QeN)#mIFM6U2g1hVKvto4F9e zZ79xS9$Cfw1M*B_ZfKo%i~)!rNzJbI1vK4K^`MzRNIV1#$}1K*&II@=c!#m{azm(~ zQQ`^e)-eDTweJ7!82DUK!a{cPT6KP|TEen~(X&Kx(Kij&4NX_)@D^4*Z?g0zitxWL z!!i04=40~<&Bge5#G#3Hf|f*AI&4-LW>U};@zAIv!yt!WKJ_>r{mRpo3DvR~U?k%% zfZ89FsZg$&wRa3`H#q7rg00W~&gq5%X8kHTOA?|Ya~1XO8yPWyz%co$Y@+whLhqgr zA0oO!YJG$=@qNyBdaJsm%USupD0l)eR`6QbX08S1SymPwccMS4d$PwOL@>pXgj8c89G@UX4!s*;Rs?t&y@%-#;yf%AHLOBee zT;0me-(}ROFJ;5WCSwq@0BT(iD~ZxTda{f*;x*#=?EZgba#G>*Srtq{Xp1Fp0*6qo z44SD->kIW1Alrx-pg>3vfGS~ZF?ny0Ss+RTf`Da+?5ihZKe$U2SEB$-YkmI}+3@NJ zMNOwCaf^I2jEL>fk`;LcRRG8kk^l*jxsiHjM@}!Wh;jj?VnXF_XubMAMotsTdz_5B zp;0Xf=4?^S7K-J^pW2S7grn05p5SBfHqRmUF~-q#WV#kOM$X^YyLGjrt@CaD?rLo3 zHyP{EQqHrZ$V}SQCTiEePEd4IArIrlu#n4Tvoiz3 z8Hutf8gx6(wGF_YYqCia!J%E55N}7pucTretTKD+Qn^(4+-D6^j^Uin(R^>P+uaEqn3Y zQJUT~f4n|`VZnMtLA-Dm^9VKOtj8{C^eh{shakkB{C2*(^TH4@P_ash6F~mQ;#~6( zkPnKKGj!O=F$s=aO3WBf+m1)bxscgma_-11;~F-dYq;mHzb9OP?6Jf;CKn(luXBQ( z7od_mSL*zQ{FIZP!WGs&NCK361FSYThlP75AC23l$w#bt;2>P*d_y0tWhW)xZj2_3 zd_+NEIjVJuBg-?9a2P;nW5WS0pz(1lT&DW>yyJ%kV*wx(e9oXCL6g6fTWm&nHLga% z6-Tq8QDM@m=#Xi%{(kV?Kfc6QaBzreV6;k>CZbAJj%rxUoD92NnBujbfFMPu&a$9@kIhfaPLjGwA%)ucRY%PNvjD)e;3@|+L22t~ zTnMJLBp|xEK#~fRT3kZ^Ubu6G=5zq$W1m8n$JxN}Z+hb`c~l8IaGPL$MEx>v$}}e@ zwNy}uk8Ul2uoC>~ssx*ZqntA-MNR=OO%G1aPRx^AVg(?!5@kfRl*J zxM4)csh+_TKV!bayuIfW_{W-sLd4S-ux_!egdIqW0#QC#hmI`?y0DHkcPIAUy@pte zxCF5{iH5^o;Ucz>%laSDc}C=r9Nx(RuV6Ip6A-m&=m}EXP1_>yZK=2|Mo=^c&myQ>8;(``igpG@ciyTbhi{8c zQ7Ic3e>8_^J2O;_$l}=pdnwB3do(u;+|{VSPnRqe8DRjt@Q9*>q9{@a#Y!kWa*i6D z*i;?aT$vqE0~Zc}5FNNF#OqWa^dk){W&&K)w)GKE-D6c_r-Cs%)hsOo(-Re#pqs%nC8kEN z>aAQ%v@t#g8D`*%h9Z0b{USh@N%PfWG2V-^chEp!#|koRc0>oFE+DL7J}b&i8yH%H zWlQ7(wh{Xs*b={eX0{P#n#|-p?aESHDu<wd0PC_VsL+CFNNb0u0q5SX7Q(feKbf z0^4F(SZ9ae=+hZopZk6#YZ?*{@>Y~s1Y${b`W1b^n+(#5PE0UPFgVA=J^H!t`znpR zj($YX_WjWxA3eiM;K=7U-JmF;iQ`70Z0&x>oNSjZCKw8|wp>jUYZo8tEnAquu<(vi z@4Nx9Ij$K@)Qh8O+ZTBIyng}eQErXE@U@jj*tn`9;>cX~%W*-V`dowhs5!(qRo~ znKUzMhGVJv!1iX5VlIxSSylrcj;#lS-#fLh*BfIPO-L81s>R$8BwRz6s{o=B!&b6M?q?lmeIzEzyOVg zyFj=xpHXaGw1F5(EE$s}mQ14@v9gGVgMhrSvQnU`5t@#O`ZPeTqWf!7uxicj<@vP+ z%oKjq>{!w_V4nQLOP)_@kUg9Q4s+wpHPn>BDiEnAOcQ{q@HC*0)Y#z0B4PQBni_Cm zI_89gvJ|5b4ODjQs8Ibe^a-GXzn5iXV=l?dX(dMtfNmqAR;$;fa4FnvL^#TX>M0`* zN%nyIp-DOl!G;mqRhtNJ57UXs@!S$ezjzK!N5jAZcG60CWpHeoCboj-GdjUU-wJ<$ z-62Pn>Cjl(W(_!nP}L!h5BEn)ike0wLe-F+08Y+MkxdR<76_Emh1AvpMH@(#qfv*b zc1{nNk;jVhAW*3gsd=Ft;MtwNvxw+yNj|SHG5WP5QEPh)%Qx3|9s%VBCi_Jr)kR(q zwAu|kzu`c#c+N~;E!@`^W|a&=($GGDNtT$8w(bXan@y-Ho=4leeh|Dw?!RH&pE%X} za)Ynf5}lB|=kbuW;lw3QURBqAxqYBhx%okcrF3KK(~;sD@q_{h;!xf zUfB*KNUI_p;BV1~Kl}~<;%oQr6FqYjodXUjaymg<$;{MkNk_a2XM@ZGtc*a3wCgii z+Cdmxx~b)8YO(dNYZm0Smou=J@jfMaz5%Q*QB^V$dpGqjT2hCr)v$A$zj0-x&je6g zN{KOG@r)$K%GP~*Z@f6t?2qtTJowxX9zlKwU0=joAetJ_C-3v3Tm)!Wwi#J^)xjoV z_u+$aWb=YN`MY`WRZEd(R%f`POhSoW_Sq{>B_m{UwLM#`DNhGu367%r19MK^Ct(`T zXMTQrtjqb#k@#ZAGd-o7UGj_#QS=KT5K5iOGH2x2$+53+uI5b=&@1WPIc z9p-v8&JsK0Ksh}q*CYDM?1tgrVws2TdvbA^q93@hkv1HzVUqnG2~>x$o#5@49J6e*?)y49+hVw(gR(8_z`6pdq{{N|$v% zj6jByw~x8Ue9O6$I%Ob*{lZHAnPY2KeOCm!d#xhs zdIO2N5?w_CdlH8|p!R6%wu@*X{K86|?pbYJ%YFmc{u4dN{ZVvKEu3A@U55q3gKF<6 zX;+OpqBsi0Ti}3&;Yb^Xkql%frt2Q*{zm+Yb(g8D^@)?d8l!7*no6O6lzId!@e!WN z+oMy{Guvi1PLI?Y$ytiJRlh8se5kt{NTV??{H(FT!}~q$7f&tn8b!e z1m7416mDCOy>eH~)MP}aFkFCG-5xLGikc-f@^U`PEav9M@)aZ_;ro}j43$U292=n7 zLwEl4>vtYEP<|mR;b^hkG;+Evi9lMlLzccsQ+wj2Y%Q6ORwDSxMBchF8bksb*LTKc z8oqlP_QSc5v~_j=NLfVOAWSFWtiL>{$E@gig(Epv6+>$B~!X6ir8CH$y?P zBh4L!ojemC9*XaH^wAyp<>frfEd@b2PP`DLWD)lYN|s6?vX*F`e|}R-_eE11(OMCD z-35BSV8Y3gV7)_=vm{>n%%Y9OA_~L?VtTf>uI2v%v5xIMw}Od}_$X~5g@_Rl41Xg0 z*PSUuk;*tRiVSD^{aN*u08TN8s%41Olk*UCXI+bF%)Oj{BzgAE&W-t>;6AU_%T5-p zt&^Qo=r>g&0Th;mB!ynMEMHLMzrW!ciu&x>;_SwJa`&_yHo}ju~nj8LJRtovc7Kn--SJl1K5@G5=I8URLcs5_wjl(OcFfb{Q4ih-*ZK0T%q<1J< zz}Pf4oRmpK600!zHr+6ck^a7XfI{G&ctfg~EERfD_Dhy2%DR*=CvI+iW`f`iQ1;!o ze)O3;ieXsh$S1)F)?2^nYWT}^MHQo%YS9iC?|9~;x87|-4Kd0DJtc|HeU)OD<)BQG zZKZpk-NuN95U?mUV}%Hw#!9MEsz;;I*v5sw-9*CPRi(pOBIke-15`cR8jZDLT(V?C8fc_v#X$sc)Q;XU!5 z8SKuhFAwc!qAuGHM^iX*fRiG``xX90Udc92-rjmuuxfJg%bh2~~^8egtSO9aeHn35p&zsteKT>Vuz> z#H58-Ffm%tHysena@pimTcYF`FemKsBxt@I4n>Jp2u=NW-+i|KISSgS;eaWr$;o8Q zh?oHMbv}n+_J@p+86U9&3|9-6XQDNHk|?A?&>(QScp)fp86#nHfe-=^w#o&Qbz2Ak zf=Gb+1`ZKo&iEiG7~+?Mb4fA`X|Q*&Ps^l%xsL4#Vo zm7EVjoSX-VUBn89k|;Z4xdDJ*cRmL7M~J$Jy3FN6=_m)ZmtZ8w18FNJXh<%gj|ZQE zMM1O^k;P>%2Y;_`<(;;^W5@#{BEm&V}apE&fR z=|U$yzScpezxVAUuUSq(zZ#&hI9+~yoyYe4=CyA|lL&U}yiNq0qG#iyG&8(4T0CtM zeT}KzI_FfTHg(q;Q`;G9FGq1V8SA!}3PZ$?a(j!^^cNRJ29kon1GSYtjtvsn~syPYvQ{|JnI`Dq;sniCH`K z>iffRVTs!tOx-`W04@~+;S@oanAT60;RJW*08bHQXgk5kgEc-d05wWVe0l5@DH5p) zS*b|IDqgs$JGtrlf5H;<>&ISDrn_?JUEW`3l)A*2?9g4|Cns3sRhM;F*qrj*u4*Zi zt+_#|(=US4Mk)9c-Ol5hDRJK53;`v5yg}*X`;N;tQV1fYdKRu9g2J?PUj$1;g=RJt zTRy&Te4P*KPvI%5olYGT^5#qAQCN0S>$XR0P<$l!M_dWdIHukWiau0Xs{i+vU zMUKYube3=%=J&HNIKOCIclW{R^74JP?`SV!LjqgKzck)F_FJQ z&t%s9V^J{YxizPsbsT#-)ySlVek--%1+*eI(=(g?UqXq}z~b!T#xVDLdtQ#&KLc;k zi`bkDVc_US1bqDxMC@3@<7lBmIL}>Sm%NkY7HluzZj)x4Sg5XYHNj4Yooh% zjE#}02JsvzA50Pd1G!fI5XNp3G9-_`;M!@kdi$G5_kfYj#I5$JRB}!RoJ1b5^>n%E z*uL7Ps+WB2)|9~c!-JTK&oktwiKEe{A7g(5BZ>|MRJtBOtkp9nbQX2onex#mo;>v% zPd;(0CjuOc4)4r~xkwr`Ep!t(`xp%+5y z4yTYZpYbBZ5=XcX-^mhqhY-izteqSpX$u=C#gARC5o}>tT;zAh)AFv<4%p$WPOTBv z4gCZy7PtTY_+T-ewuv!A!c3AG0!=1@C!}JS@E>Q!Mi#c5uj{C{u&-aDju(fUW9MAB zdkf&QZ3e|#oU9L1EU0K<5rdspvH_mQ8Yasa@mP9!+Z(p#L1Yeb!hae7ImAlMD&&p+ z!HH3WkE=nrJwOa3`Nw$gP-fS|C4>4xEqiq7)eL28(O3?}$_VT^Sqem1SP?xW;9XZI z>lGUq0Opsje(=+GRx>Fp%}^F9$IvH$co#3D_ZMv~JrV}@T%%Auf|4!6?9qoAw zX4g^J9sP50jHwMMBrG)7?BW3AZ@4BxI)j z?E~}r#_##cr)$4GsdU3PyuX#nZ>$avOqA;7db#wSyJre{Y$PAL;SWTqTyC}Q07zlL zBJum5lGKW67&`FtlpPS3>d3XoL)xi$I25vuYRqVEv^GzNyYx=?jKM@0fz$#Q z=2=pLb>;~_v~78TP=8LH=Q39k+Ee7uGI=Jo%XpBz3TYkcf7Evm#?fH`fD_cnA?VFO z(#unlvhSULo#lZO3;ag~$@`V#BhlEbKfMTabsN#0y}wo7pZ&ng7psHBBtSNY1LvQj zF2CXPM6Dm()Zc3^`|1rzs`Wn?(7y5l-V?=Eqvhr-%0q#&69{PdHJvOCOhLaeaw4~-P~_MG zV*Tg>LO_j2(K9vu512Oe@SxtCyUpPXcs1$cap%vcUG$46JEe_6t}7Ug9E6wF=sJM< z&#M}*Ma{6Wfm%e7iDui97|vHXS8{cI1q`Vo89m|OSMwb}XUWPv(Cvw35o!7-Wn`3y+_ z;P#!MY%m#TWnD2)N+^D(7i#?W+9r5Mg=Yr z0C23VYbqj;XfuSdmj&Jyq1px#I*_s8EJH9@uD)bLe_nIqU-?V8xAxphq1m9LKZ$bl zdQ!ur--nZL*Z~F z6|;@AINf1J(e+nmy$Vf z(b3BT!EiN%h&BB=C4vt!`pdaUI&20tbm5czl}kiQ$(fyb@S_SkBWwvLqnQ|`BKgY4 z;Y!-oZRZU1H-?(o!MQ7J6D+J~9iTyPXbz4SW`dzNZcipt$;{wJCGwkF%f(_21=fZt z!`{M1LEEod35fGH=`>_inzm9#QVM4xXH^3TEkoUiay+RE8pw!)(W$EnjWQcExwjx- z$B3F{-}(PE8{e3MO-7S?Z7G&US`3!mbUc+S4o!aQ;sAO8unkg7!mfsD7Zz5L>f=Iz za5Se#wo|PkBH00z#`6j)l(3OPA24wLl8Jb1Q*#h7UT6`ZsONr8JRIz@LCC$O8D<_QB~1%y7C0wEAv+0VRje#|?^2%U3Kh)?hFP{z;JLa6&I{7ys(@siL-iI) zZdobEWRi*S7?v#7EYUOciEo|w2j&R(7H}+n8om}pt@H2}lcy0oi92T%K-7J)Z9ik3 zu9I+xGu}m9maJfZ^^j-VSt#CTVad2TAWu_~1ISzBymL9g(2`0;Z)uR1obzy2_Z9K? zYk&rio^x3l*|cMyZZwC-Mh5#rS&kyvkGLfSz}$+&NpE#*iAdZ+r|MCVT~}U1_EDrpg4Zt5^b9Fa||Mc;4 zk)}T$!dd|@=jeM_?yWztLgnm^`CKNKVHp!W3`pwXAxoT*0spK7;D{K{1>(5tJRGDw zR_UYX@qx#7q)mYT$^lw97DqBl6XLln{;U4OF9eU!w z)$`MypF@jxG;~`mF!|&G1xY|_T)USS9DjtA7P~^=3l20l2}5}y%`Rzl4s(xntXpSe zz>!{e-MCW_K&&$N(_GPj<7&VW@E_!K_k%h&C!l7`xhJpHmzeChTXL8u&e)lVQXe0N zednA$>Ik&JH)t#hN*HIpNwzgC{-B`7b!ljLaD)|l!?0e1vSA%;z5gl7lFd*uOj(V? zi@gIZJGyw$SpQV5WD4j#fg}ZZ2Gprqp^~eDFgvDYGg_nY zX#?y`Rt<)D9z3sTnWDh}%LKJ(>zf%W4r|~dYV~p>tdMq=bgVMY{QU89Tz}>d@%d-* z3ifRwp~i-D#-XE!j!MC^t1Mqe0m8*)L3{&<>peO zudlhXI=m<_YT>Q2yl`(S*m@K75v27Xjp5Z--n@C1*qfG}+j#8Q=Coxw9XqT148Ww( z4y0$Akq`+1WD^r1DK-RDf8Ao9`vPAt0lWe|ql&1qOpPSc@%>tV-^O`poy+ZF-r4gf zJwE}fvD4p8G?y!QkRAw_BN|@cw=Y>;&yKKnmn?N84pvNC7CYC(waMj)Qgof~ZnI;( z(a`ZXJP|%w=aP##o;?hhuhJ zg@~hMT*fB3;rt`V#~SBPpM`uGt0>V}sZ>2@LJ|bF)y(bD6h77;G$?clMAPL|+)SgX zjHurC>HR3Y5$w5WY^B*$;Eafc(%dV4_ov6>Kq$aYABj{em{vM@$N7W# zvgueR1k_wmBoOf~-Vlx&#(@o50+bKQWDxwo5m^QAyu`$#vFO!1_NIaiU!Q(`Zkm;v zQEGp^kuQd9Mp%N;5I7XuiX^@bnyB7#Hl-W5Z@V;oFwtj(RdjCJs6?iF4xRX0{;k}* zs3q$5E{*KVg74xw66cCYTN`>iwOfkkR#^EO6H<&lxP7D}s64tK z{JU-2&E)$z>(@K|r0+w{C}3AwvrrxHppfhS`ktxd`y062kQ)FU?D`hYu+X2Ul7Klm z>w<^&!4;PcmJ+T*I|#keF*Q}1jpo3w4VwaDil`z@O*Qfy5{iLzu1{8i!9ykV>k{h$ z1rM4Xo>0*4T8AI1-xrI7v@G@yoEQNfazKqLkt)#>OWj2FMC!HWCWkfoQ>? z<1i~27EL*@PBcjqnP`oQqjUt8CKUuKfRsd&J^Vv=f$x2FF+ieD6k{=@!aIn%!Q|vj z244ePng;J86yMIVD^tIH6}XeZbq`zU!z-?i4CeY|V?G)u zwl{h^ftAakXi@GZSE0sa15{Qh5zeIHf(*+T=1N`-zKy3$EjE00g_Ju9uW4<~ zEj4VKy>ggkELh|e7s%y@(flb&8GI{Vm!qQLj5r#wZJF#)lBf`312JRALumA*VTq$L zAz6PTb$`uTzVAS<8kE)yF*htnvM)wJ21*29vHV!%$o$RLYDdAN>w$VtA zW@Avyky>0X6pQgf9Lv{Q&B<02yDe8oO&6*_b#V8PvMcmjD`>Xnv%!!a6%_cj#Hqv+ zUL%dsXmm->+iHF9-nx8jM2z*>DGP{lxFHS&=wX`^EwT=1C2^cmp+F=V*Q5X@5vbcK zhS`jUeK7zjq}e3LMGBI|1{49LL!6MHOM|&=A|2}kgA;0uSr(8^j2*GV+4;F_ zFj2FJ#PWe6%T}e}$aW)y?a`{GgNV4ng5}C7K#4Gra1Dww7}OF4yUx%D8i>yYNDz`{ z1aui8w_v2Fr_+K_4uwZeCBL#<5YMR#p?o-1Ej1L|mg5LN7bT-Kt=S^CTsh|m23C~- z^~dr-g@U&o+BCjp!`53BK551yz)}!H2r4`1Cls3v$U1EXov?ERZ@4X2p4jHx^gh8HayHYULT){$;b?*0MF0Q= z;PCWs-FgAbEcf*-GwcOhxAqf|T9Bzww;+EGyhJfpEcROn+j85eS(#ph%L%Za4NS20 z#M2+;rKZ(iEXGhWhz?Bd7UqN+ljuY|9zVQu=P*r|WJ)g4^zhD|hw)m1mSU=G3Z&fJ zUYeU54}&?DszH9SIf+7rm-@rwb8}007iNqpV=$hyne0G%WM+B;bV4KrXgM4o!+D{DJ9bSNL5&1A1@4hRNTQ>$ zNc7x|%XPq_IXF1C(0CT4XfEG~;;PTw@+H|GjD%GzQeBUPd&A1-*}HN1Xd|BkUjRAj z7KkXGMX55sa8@i9j|*Dd9iwh}aaC03>*lcS5H$v=bnLXD;aqou0`Ks4mv!Qfylj$q-;d0@mwL^yKq%Ti~01Z3HnYJHe0*W);h=KbWA_2BRYp0w4i_h9S zjuexOP#VIBFIKAdoMztZ%Nx&)Mq*J~3I)zUrr3MFyjG@cF{7rIhxUP+`7gYvgnn>Q=UV%#2(zHi$qZR5TQ_YF zRbpy>E~oV#IMDd+r@r;srL7xw(0UUg4YV_G9M>F=MTQ>S{C;ZZw=Zw(-`}fdhSRKm z7JMTWzOWET0__YKP%7C(Lx!#v;8ZG6hCr@B7hcmkB7OjKgPMQ%C%%<1+zE-1;Ugvr zp4)SU*>ESSNVVq!2efr3xeSsL{(Ea23+F{gaXORX&0d7$J)D{1-X-Y4uo(`Wd-$Rw z;4NaUQZhJv$)&@8d!pxut*7_z+`lV4kK1>Cxbj4@dEw2o@W6s^9C_JgBSvj03rma+ z1Y*bo$Vi|w;+B0}T1U(P_8jIqz?%UTK{B6*S zH172P2ZL!ZH={9%HxyRO#sZDA5A=TV$hhKqbEFT$PqG`dIU28>b@}M`sjuGE zcka3UT5ck%L`LFUS5_Bo{HQA8dvjaZmMR7qgb>1AMFh`FP4jZoHlJNpr6i$VOoB#3l6lV^dVfDu!&wjWcQxPdUQ|Syg zBm#$fbI?5>-n*D50y`J(a$SW-o=?P!`O;-C-@HOZ{Pe4A|LTidW!dQup7#WGFBaLw zN1R3W*JmQ%r(a;J^Dl0JO~i)ZyzBj~4|Ud;yLRqwrNmEhzteLEsYC9n8zcjX6uLi# z?Nvo)#(B}1DQBL@6yi}Kbu!L$mD`JjK$AE#NA-ArbSB8VHr3;QhCuCHFZQeZe<`u= zT7C8Nt-$7oCm*LaQkxzhKX%o4Y6gh{=pCrP>Rfo~zPXKH zB=qyEzl6|t)?I$LuFTyy_%PtkV-GhkxUd-+sFOes{%2AXq3PqBix0N`q4kdsl2xZ> zhEUoJopu-XIq^gAA5kCPsg}Sqs*?)Zcab9kQ`pcyhyc=|v!*^s(6ero>u9Z!bF*{;W zy3?%%JGhrBk_>Y^gs=pnU~+$Cbar|XzDXDeB8qeG@O?i-&yjn#;0Thqjr*S`Dfowj z)Y!ddbELnD$cUFg7IL|}p%EoXOVSx+yOt*>0E3y9Zy^o|ZczfdLVu_!^W4FIWJk-< zxQ=#P#+c2w9{TrB)3d$AY)5YmVl8O!jZJP^*%f3bizM=n!i3P`^z3M)pK#5g>LrA_ zby+NuVjS=@VBA0GjeF;I-M@0AN|Hz`Ng|RgVJ-*%oWzyg|2p3XzLw)Sp}Nq&&!-<> zd!N*C%)+U@AaeqDNryw>Q{UxjzL|6H821mlQkFJpt z_?+;{lVsskLiF#SZauVCh`58)6YJ&SOk{}E^51*ni{d}B)8N~BpW6rH3O7Mgb`*bM zs6ppY7qDiVaCAypC={G&Sz{%UX#!-pGjYz}RF z$TU5QEOuKPc3lum(yrV(_d>QPlKZ}wy{D2eYXgNrpgizcEixrdJ@d@}tpv}%KUAxQ z&bfHs(Qu=VlAU3MVWmnY96-Otm>mtpEEP-p3RYVQ%yhG+Rh9G;{}dA?H5)J8{} z!_J`;0(&x>P3N+fVVS)a!kyGDQf${KFj9+9A7P1?03J_rB@a?etjGdgD;%+lnH>5= zNb;Oz--7@O!=V-r`X`K_9O%liW)HWn=4QE9_q+-JaHo0gZ!%p7?b`lad*LNV+koxT z=z!`tljt0_79R~7%c-vgQ@v|Il8Ht^0_+a*R>X@eKn_+p;a&ie*cdWyh&*$>J>OaUcnSgcQ;%fm9%EfrOAk3CR)? zSO|m#mav;{YxMu!_hv>??7&AB_Vf7Zwfk;4=iGDeJ@*t2@kcn7NzK{pc4!&cwXmrG z+ytN5UJE~I)KeX5YD&#%0$d;<)k3eYC=d-U>z_9#7kz&W5f@%#V@4#8KMWo~-i+>+dm%@=fiNgl zcOpMf1Ya{SSzr+PTxXnPC9zmUY>3GEeA4uey*y|ss?~K7idvk=T+s1nGLl^Xmro6m z!u}-6YLNF3nz_hfF6)376Kox`Z8Ugd*Q&MQXgJz7x1}FD4~`xLz_f=enb~!fDAhPS zTRYk|4sP1$Y3Pgs(o)xQcnqyBYG~|i?h(|wdZ$?f)dmiFzm|r|x(cJoVB#c=_d5OQtYk)M; zxYTA;Grepbb_DA-c{cAF+^apUMx_lIK7OaA%x5q*4Io&h9UBh{QxnSg$k}e6-w)6J z5SHm=9TyD6EFgr%VUc%z;c0|zQ7lC48p@kgcBlaQ+-`>mC&g?NQPr{!5hSW&m9@3y z)e2kDsIal6)yHGSaaai$P-Rg4S?K+OmHDN|xXE_lux*uvgKfc4qSD*66|Q(t=VB%o z*zyN^Vmo#km0*u+H~FvB<`@Z0bCVnrEp{v4Y_{h=XSc#$Ol>F}7u) zchBhMJeI_6qr=jY$|O4*(^UrS#WHVgOyfR|kx+xZI|9ckm#aTTW zy%-h*I!&acq_U;Adl8noHs*Xy7to5(Z*VT^?rlLJiHHV?Fb>S-G5lMzcue+z$^HM| zc?@@uE}F$-j{Ddeh9iTMe-P(D&UQYz6O4gm`HNB3lYN#tJ+#WV1#;Ca?mi6NQw z=>levo#MCz-+da}kA*~_&EYT!v1$RsL_-72K)4q?DM83|cJ)_QR9BgyWe5XvU`LW% z3;fP)ZEf3}{sk@x`T=kdtVfV1OI3A6Wq(&^Mi5dSZsx~$XZ&j)Lx0gc>tn8}GY;(? zbG)-^<|RCZ_lRO&Yily-_SxZ00m`D-8j(0e*ia!Xb8YRh@!DFQJ_e?-nv-ly>jm3H zlHKPHCRBN&^H(zS{baY4`_eRLm%CprGAQRGwcNKfpEgk97a zV4x137u=IQ<8(iiH&_?ZX$4=<3!zV0HNW3hW>q6xu~Totudd*l7lPI%QY+Te6o#T75i_~%}B>D0FKkjxK3%)I#9Xs+V~scDiNO7#!2tJ% z5l_g=o|#KlBg`Zv2d1Wk>##So05^zOmfs_17+_kHcqFeUa_Es2Ddka8o-Qe?B{o4m zA(arAT(;HYFgOs%2L=mPoz1(QyJIr7-DB4?*%Plvj0uNtjN5WBU~*vU1hWcrz<lUZO=^cglL=mZ){6jtxgzdKwdWa7i_rOZBCmJzIG5?#ld`}y~G{+4_?)VV9t06 z6>H@s_z6$ePVE&KKiNa>BfmjAfpwW`Ks5Q^Otn2G`jCe?yq&QYNTnG}W=;`gt*Vo$ zIw1U(!eeIWJg`!y_wWEY>;xUR_b^ayKNy z{-AeGRl-}!G#k`fhsEg$vk@G_IL2FqIM4(mR#(8TfhGbc8My4Ith2zpTS2#vss4z8 z)`x6Xi^*bCLo1bO+`|R1)1?n}bcD2a79R?(N1sCkC@c^pbLX3IH?Ip@;k1aUA?ch> z9ZRT#5|W_8$j_#m7s6i+WYW-UG8)X0WJTk_@1*bN=sKU#s=a$t*tR_LyJlFn=`8{j4`9-ujv!bFOCN$REmMc$ z;ru`u|Hh_%Bc)*9)=XA1-srN+nskglQ1hGm_5pk&LlXSdoDA&&Q3ZDA|)%@HBJGg`XvPiK@agY^NT=t4eh z7v^POJbrohcdH$+=>3KO%`$7;BsCsvw?w0s5T_A~`?DXeuH>i0b45&35WS-8qV9XM z*S|6n>unHJ^?I0ms4_b0*xfw$2)*G4y;s7!pGj@Pgbf|`1C!6J3b%U=o8R2U6g?W? zl1=D3Kwr2Hp@u1WdTNolUbv5(j+;nsd9E;d39LuyYfAH>T^`A4-O7pwImI(*uzfI+>+| zld`X<&uhJ4$Icd`7Aj+E`V=O@BKVu#Y-TEWwx~Mf5Bl~kTN1$FB4C0HGi+4_N)cVx zT=!~#{WO10QnAws$6~HR<*Bo$)0aS&BDr%-ssFKBfIq+hRE4*?1 z)lb5XFP;s%>?@xQcC>63>^L~u{3pQ<#Hac-V*I+<8nzB@?jk3~e?~}J)zL!K=aE7r zYJ{R>!E#~Gj0n5Rg^Z79=##3=TpNK@Sef8Ts=N z8kECKmu2)TSd|rVnB^L zW`+vy(+d7alea=9V#0F6s^TVJUcgH(okK3bVAXjfei2u}d$zf z3I%B&ga}X_{i|iv)&E1v;5xO%@W$#cvT7lw(h6qYI$Gj^giu7VB3MOhpzsXUE=jq@ z$O_|fPsym2H)F(9!w9DchPq<0*66pWi{^$*YG=Ktji;raj7enUH^?erC@p=`A!wFB`BMjcOAoEGbUc&M7WA zwB%Hgb7{>MXQ(Vuh25zx{yCVI2~asMiB(o4SFU^E>`|D^X?=mpvtF1#x2m+fC{+|= z28QTRl&QAqHhDsUNb{VFRwUdG>_Tf6uDEJ`cNhZ4uoKGR&?T4q-84M@K4|=Xt^B)c zk9u+B5d3o7%s))dA-4igaxYbSmTYXy0M2~;q35$X!Yo`dxy=lOz!8xAA!b)ad8|n@ zzL+u1=W-=X_i5xa+gArtV2GSK^fGG)URezY;eaFH?_WQ-xy)V+CyiD$^T?#qTA|w= ziClRpB*``}CI!r;KX$ngJlbOGT(WAd9nwO{riVdccJe27ixtWR&;sYn!liY|#?|Y> zq16ivP$u`ducX||9=Fe%ZV!f z95mFO^Q-HayJ5C0SjTfkKe5{!4o+jziehWDA{KL(=%AbonV-dVA;*pka$Wza$+#j-S+1~1e1Q0=oD>~QM~+|#njNq$Tv zkYaeV%~2)BJ`Xo*{KFayy9LUYUvbV!#H>^b$5v7)%w3`zpkN_H;YiSCbKpuWLc5#} zFMSrz#VEE~tv2ifX(aX>6ElYgB1x=~ES&5H=sg}i+!#nMuF+j;782!&im^>Q zH%GeHR4y2@K<3pd2y;ZiUA-|m^0QY)5XL?sm`mLm>e2>O0{c4F*BdKcc6zFPL28A= z?eGX%i=w-GaOy3<^m`1ZkRN~YH~oOkmUDof!CcsrS+L5n0u1fB$=Jytj%U2(v%)mQ zQ5!s8&xUEpqGl>SGEC#PPr~$$zXnp8`Bad$3VeLty!dR8y0!isNPGKE22wUJ1)bg~ ze4lKPdt)>wzk@p?#4eEc;Ody`1%L`GFSda<4Z%Ewv8O$)N1mHX$w_A-gbA>?KO&T- zXwb(a)s@-jyJ4MC1+fG+9MtLxf%M9e_r9McC!Pk{Oe4b2i&yi*F zYTv0uF3vYQ2MFc^tRA9gg;_;0;((YijIeEpX?n_o0_J|x+R+a;36P%If~}ePS3kC7 ziO1=7mK4#dE;CokHXq?Nf~%eZmqg<9O>XDasSu`zyx_2Vgzss0Sfy<9^_@kjik?he zv=`c80y{I$E3#xW(7n z9Iye!s+_m?%^x~tb?-9Az-!kQ$26Khc46Dv#60I)osg(A-Ec?$!fow6O|7YoyE`f? zYin#;i=L0bSCYQsw3Rz39ZqZ1K}kY19cNX*xTSxQP6LAxOV6XQZG#FQEwNZAx3(Ig zZ6$SxY1wss!xgu(`W2+$yNtXf9u1Z(KjT7vG&UAX*UN`(v>-3ed zvx6Fu4>o#GRScn#CLQeApx3Eg@6kqVPN3b|A1o`Wbm^@|;SNjz;5}O-Syh78;IO&d z7Maa;>Dv0@g|}^pL`){H=bN2+HFWE+3nEzkkR8J1D(g^MsH{3YE?;F;D7f|hN?S*! zv$eAN(4vsThD9Xc!+~dfq`FnmVwOEVgF*^$nr>^}lJyhP+1!BlX;cEGLpFJ5LR~D4 zW&IRJSZvKJ%d_eG^RZxA)!O2QEfR#3G7)ib&7$(opSyDPhIyx%(*JY44gXg3b(hMH zP9VvIqdBV+#D);<>TrMGs@9&Sw)B>LT{RU+7{(j5*{2Z=IiYu{xSl`pG0G*%ZDy{< z7OH&w_^-3ampj041TEN0(SmvFs*B3P8VNprV8>-IE3yt`8Z?^XK)bf&F3g6k>GWbq z^Wi_D1mx&dNr>8IhwJXe^)(um-4YAUT^VsBG#8tq9p9yh3v3p59ip8w`s2uXQxB=` z6#5WD1-8bJGfod;LOeHUO~Y7OnJTcHrY$@L3{N_)&FsR3tl2~P>zP?V`WBTQZi0_J zt=GndqTwQ1Lz^6qtFAh7ffJJiM8r_5IH@UEW)v!_s%kFy{8g8YO>8+m5c0#HU%8Ka z9P(*(C=?Fv*s*1!AF&T$8_9yWr9u@t0XnUf|MIz`m+m=p`;I`+7toZ3YI&;Bc&s5; z&^s}D?%5`bJ?YZInOdi&89@Q-nN^*uN-J zWHTkp=h|FOSklFX$qGOewttehzNW_x)eeZA;f*k@SH*RFG#K_Sjuo2>$;y71_JF`1wn$K@^DG;1ShjJx96=u%W6u8bL zd0b<-odNHtWRV{!i9RJ`JpSAHs-~w$5`A}>o1W6z;Wr8BEWF0XIsp^Sz;sC6c8$%p za#QzKgO$dv!#MOi4N*#c-s}59_QA%|WMy3qY#7Z#Qm6Jcwk)eCOQ4GdSm)tQ z0Rvq38w^{(rqnT4qolowZCkkK&Og1#TZGL$FFb?IPNwN_H_!9IYa3%(ldpezo?Crj zd}qMAPswr~%QEg01$0~RSaZ;TiJIQ99_rtwM?*H3QI-SCetwuf%}1aKHSv=svWoRo zHXbzdIepQYEDMO8#m`u0EAX=!^2QUH-NW^zTC=(5&wL0hsltY#u*Mp$c>MUA*~#UY z1TkskY@UUY4hg<>{Fh1s`Zu|nsA;HxY1%Xg%4YIB$yKlLr0FLGF2&{vk4!C6ZH4@w zjRK$KOF7MoJa>}yivWaKKgOQm;8%WD3-~~gInC;3T(Lf-sH^6BON`m?@b~LoR&~f1 z^c~rcQXx!)teLj1w)^^9TtH&l{&<4XiLaj&4c#j<`ou=-dd2Q!G+1mV@ z@?xuxrah&NeD-Bp8+8cx>M(b&C~vLKG`5{}VfJ_5U!BQVR9Z{4)C}3Gt9<9KFO-&- zl|w5#S`sgcLXPXK4u_3;PH%}cvRM}Rz0Av>0W3Cym&=+1Y_E^G97WR^$CU@b0y#qs zK-St}iLe6V75L2H?lXr%wmDqR6-yu0)3C|wI-8Dj{F8m(z2JxjlXjae;4A9gaN4%| zfuZaJ`vP`-JuT9Ed9Lk`S+#jj^U%8W3!zWqj(EIgALSb}8y0UE9PYe8ugXrn+H29P zg?lxrm{mA7=HI4Bb6Hsj=5!~cNCro?J8!eVqgert({jG6mG$;NTGB@gdKvPpmPLupDaGQR zVS#DwvG5@ZM%Ww;bG6tEKMIhs{%^&FobO4lA_O5H{Jz0&hCNu$KgnjK7K_Vmv$Bcm z6MT8d?qUXB7PH45s^Hjr0V*sop803U8YkaD{!GHl%B1v3t+T>`OH9}-ZbyYv%Zf)$ zJvJ=FDScY&sB}O?$%$ROkbN&l|94ivzAQ0WhzQ}06YK4~=3u{=&R%=pyk9+eqQIoMj+$I_zLug^k_>W%9^FXFqqriZY zi>E#muN0n@eUmda8f96O??-a84#rW(-+Sqep-|lNtJ} zkj>jIq4=Yd3%?&Rxnci-ArBS}1{;$uweEJe`2Y{ifP>zt;*jogbDO2&xE0oRRK!8*-Rqv~_V?;|2P zko}YD7STp(5D{n{w0AE;W3X4xs-ygPRGmJ^I<*%XIH3QGTS z4oW^Qv0zLvGoMJLP-4DhoGlT4Tw^s!K~KOtKDcfEzp3D5sW!FXW!l%@KfG@9V))5} zL*k;6_C>o!4kLy}d85;5GEE+0t8)?a!t%AJ9f+5}>7O^IFjYiIS4|fz#HO zLu3vqEk`FKCwt1B$Gv&dT+S0M*yDhzth+8X@Z;>G`zA)#ZtQy+hB3x?$(*0iOBx$@ zZQj0oOLuz!u7sIs54Umhpw8ja#WA%!ym51_39hCfTc(o-x&0K;D z%Bwn?=FeR^HbHy7SyvQ=mtQ8GRY}%pQQbGQk4=m%ojbp&v#Q*|UWljt{Q#c~8GP;G z^-E4^%ajz`{hazo%?tXLgxh_FLH1%v--6~JsX4#BxFpkd%98c$#jL)tlAMM3%S^}Z z@9hf(gJN>{$GTdC};+FD%BTmNS^OA*aXM!qHynEpU^+ zr)W(Gtufi4chi$Ra!b5;S^turWDnHh5o^wjfNR-D=*t|PSNr9M9=&enbJ_=W8`hlM z_h`Xb-}86PG8I;WieHKip3|3b| z2g3hN3~ueM3WqFiUb<`H=+K$-`m=w&Go47d5}bH%*VoIYIeiK}Qz?XHZXRIB* zHQ*-^vt(vRbzJnrW*tUVw!DpkGJj(8Tg3oWUL+{f!n_uC2{RAP@`>|94ujo@J$g)l zjIPlBQ#fA*;ZO?KAxMPGBS{L!IhO@uAUa*hU2ds2*Eg2wtz6$ z4bIT{e1gHS*=B;& zR5izB2;h5zHPpf~0=y1SWl^t7S-s*Bd7Z;-92l%}0R)sK^Yk>D-RGv!{K{+(({pd4 z9&2&wulSA7bB9e*PR~926O_pIjj+~Y=wk}Dd`rj*q|<=GB&)IWZ{4Cn_2k_iP=c-0 zqQ3Pw7y?IpQ$G~;3rUi|Diqw8ZEdoxESEFH;}08nDMnKUu4~jl>p|b+V?Js|uGbbX>fY?tn^Js~{BfNR}OW&d9(g?jV`@%w-T5VgHeIeTQ zQonpjlR_1|PRlt25MNKu!BP%?H@O^w&Rh<7IQb*WvQVjP3u!XOvS63l7ZiG|o%(NK zSP;lPtQFH7M^dHhq5U;m_dX@1Agm}>*jN59c8rn^XPzU;=K`N%^dpOoW;%*g!Nvv2 zWP2cH9;JjNl0Ejz+gs2pLq%p;jk4Is!0BuciS$Nm!~j1IF*B6vs4B(WlGv z;Z@fPFV0Y%R^eo|X=1%$giV5IlzE&?p(7wxNSRx&(t3@)S|0++cSWcLu;sjJ9cNb~ zazkREEo5Rkds-H#9qJAS2t+l}sD?t7KtfD)@B^(uZ9$^8frJiG?ChLQ?S+6Di(QtV z4jI#{!+k-sJ<(ev8l3vH388l6I%zC6pW_;>!N+u>K&sHhghyit5HKG`*a~WkOG3PVeGRYb>=OB!_5E={ zirb*Qiq}XFOIRonF}((SuJJ)V1}6S2SC!eXW3<4L!6`HRMEn_RJH)SHvqxnrX$$^Lkc zog$@2>oADwmO!|Db>+yn9cMkw*^0deK@T0a7yps@N4r**FIu`_+3*^k^dBU41`q$Yqq?0lf)RNOdiE~O%|prBRinW6PQA2dG6zqMFIcV>}O4Y#aJHC zw`M+#j%e}YC(u#${n!3ZI{MrB53io4)05|a5<22Y9@}ez|13KC-{yQ$I-*m*n>^0H zui})sl57LVXd@;?!ttEYiHUd%HU!EnS)Q#}IEhBZ_NoBl+Nf-84cRYYvG!ggxFnmN za8YcLB0h?P&1c06@IYuY=%O5rF_QtkPp2Bm-hb>^_Igp@2UjSNuo;YQa}h*k{KXtX z*?>8c@Z^WwMW|a9Zs2=FmMhAE<>Z;0hs#?r$n{lpU6jcZbFD7u(-5|)i{#2s-r5|> zeyP6AhR9TN0#)rIs(!(w_4vdUlBvj&!k(L8ormxTgMx-G9#QGMhzG+g8@Q;>(547P z8LTD&D_)tueNv{#3@!4Oh7flb&Cpa*#Ug+eri<7V1yBS)0r0@6(U{e7E;`hpR4a&T zW#7!6#r=uD^3qhN5qZm(~H^b0j&E`GoM^DC{a$=Oo7!TU?s`0%FW@>$Kc+r zu<-#+Y7dvQ`-s)Dv7SxK;XOM0Ca@S(uvkxrLd`6eBCDb7BQMQ@d1TL;MqpG%pjW5b zK^FsB8$|6qm~c=jWdZiCI6g6HMSZ9+ImLTni?Rhb3O}03nr15Z7T8SkM4i3@tHK2a zx|u5S`LR+tWA?{AR}8JPqPYfNYHpFi&m>hQBcy;>5-N)jW-A#XaGUgLj=0 z?STI&UDRgs8w5vr(A2(vfBU*M>(}u7S^y6-25g1%La;@}tvq$*siUv8+2X}Egz~`T z7@>C{>Vy)M6vw}1U%O=)Gv$!r3?t}r3Nr2Qoy>BV0-x|7K1)k=7UN_VRRv~0`%3Pp zGb{=eFrCbCgYSip!*fGU&m$Xbr9?QQ z2qmJ_T@$s;0yYPq02*I9<+mp?SYsq=R7BSf$8VW{Av9-M+0t9~Hk7g>W_SD{$r{ z+e6zwm6dK5?<93(X`vSYUCK_qEOAJea`F<3)mQ%E52su<6ie_}X>+;cS=_AYevb47 zV>rrlj`DK*71>{&YA?wIq!O>ap_JD0ms9^L1WrxD2twmFh_QBV-qF`byoiv8sEe9M zXvy6To{#5g-6qlJ^ZHiLU$w}eM#Kw~6?%RKm3WKTEb@`A&dBex?H7jHR#j+QVm`E$ zH`MDi_NZM-Z5DRFMOWTay0pQo#$5lt>>Jr+_Akp4jv|M;thB7`lD!w6RSrkVdN-m& z2~H+Y;}8%2PGPmM0=n1TjH(&I&e%T$l9(;bCx3tj`=1lw0IgWtIpA;z1~ch1YzP*~ zxHGnAY))$EaF(|OSKW92DqpI>M}->9*>!&1U}b0anTO(Yeb|L6a`g^ehCm;oo7Pid zDX)h(M9D<+}p|QMHy;;h5i@(0ZSqevXl8e8s zYFYMYH2a5jY3{UplP=b_gV|H0dj$@-ZvSMDWnmg1x_3^u%%-%GtzBbM&T)kVhaY?l z2Xs`P?nFJ*a42C32hD3Aeq^m}UOZ6}3JbiWtkkjf*)J?`BvO99JZMc;XP-U(`RtqP zTqdom+S71%_O(aoBiYx0U-2PZ{$CVQhKhvcRrp+Ai=7Dk0L@5&1H0 z{nOrX`-(ELGY;VfJv*^1`xjvH4H~5{P}8zR4sUnJcxxhEGwB%kV<=?50uN{GN&YE~ zogrWW<|Io=32nfdU9dS~RN^1Ze-4U|tZT=`s;js6W!d}o8Js@B76idod!{boEf*4TL?wlEE7>r$~+BVo3Y!|z`1 z#|Kn;hF>Fp+wnWo>p(%&u`Vs+ZMFJ-@mAP1pUT>XI9$0VNeHi@EVOcXBfPnUi|4%1 zV3$p{YgSr|4H}C%4+}-wXtU-g+!)o8X<=0Fuw&KQRCmpxi%!q}1p{pC^H1FVVpUaN z-_ZmAI!Xt)$KTHOA)=f=T-IXtStYa6SYPJ#x)9pt(D!bsbY2Gi2QWQx1xte01lTKM;oS1%t<_tt=`p{_5plJiD>3t`Y_Y zb__potS*SbkfgD5b?vQv$LYee_uqN+#`DUc5XSMvK{lI0D$X9q-gkX{)4?xadyC1` z)Eua3b$->)2RTSKkPWFBpqpSVp_0ghub;o9b#xju=IQr9QJhR8myV^GVDB zkO0Yo)fj*p>Z^u2+uhg^lqF?oI@wE(tG~{Bp_QKFU^4m3G%w_~WR=d1W)`|fPQ0)1 zuzHy5-I<$#aP|sAV{g|&I3zyj%zcmF{=h}GiOMJF&<{W7&r>c*c4}I%44aaPVtSR(7JQBZWB|E&L^Bc zGnvyY5`od9!WY=zG=y9^a;R_M-q|8Ycte~;gUBPot-;~x6!k0e(4jPD;2UHxyr{&4B{1%Hj z`%^@G6d-bJye$~_1%(wutKbk^)$0fo5Wk0KUoX#CRqcVID>N^MzmuHWPH zYSW&O&*MZ4>S%eG=RA>UBG>}GP{dwZGiO0XEfe8$h^=L@!Rw~Uvi+-DPAiVa0&4i{ zP#e^O&1QG_ngYi5ipHvenih*zw0xyJ83^??w->`pEL>l~u*PJzFq`v;NhKJaj(`ac zSbG;7n%B*IdH6i#8-5{46&KeCzm2&9j)ju6ZU1YBca4uN-|B?MhPuoL<;i@eodz0>J(E$KV;)WJ1+eOVkxEw3)NTFj<3B3}lTE!59tJ@$wi9*yBQ-0rD# z>FP>qs|Mz;UE4J0l{%xKi^MWUGnNcShsLbcVfx(c(uVy$7u;&8!@RI)-hptmySJ_N z!uv#3bQgvehVOH;FR5-9ze!e*iy0R!Kv%gcAU=t+agd&0SHF8TA&7arP($;|W6clwLi4gqz z+Pyaa>fOT!La|7Zny(Rsa%yv0T+0_M?Copmgg0aprZdrmCeRj`zhuR!@g-54ExIIr z>WU@v@rcfRT+|)z?dfQbMI&KevS}SE@jkIi;)~+3qR*Xk)-J!_=cA>?ZXZt_)m-Blx7w^Xy z2rXN=n@R>cKe*oi>?r*S8q|gocVMxXq z&)oC%-RsN3$c2W$-7Tk>%Cv?p7i?SgIHU$*Ds$SB^%rb0XvZbQ8zCT3`cdIh*3p8`n^0sh&Uix z-F4u)uZ4r5033WnGt8)mvx5ebtAr@hJQrpQdv~o;_NFQ|1mt! zlgO?S;p2)uHHlmwd?)^ZJ*8*w5VY{2^2KcYya*&GY=q`So7Ps6bkd)n@QAhdP_~}8 zh|fc(?aSy%CN99CS$UuIE_;9jtxGC63l~?P>Kz)_DRdPl*1};a{8@`!=WW>j zv|t`#XJv!t# zI~V%(ljrhoZ)ozYZ0y`His6f6>he5716WD^|KB z!vr>@a`Ol*Y_T8v@ccN>57fg$S$D@)tJP}L@^(WBb(-S_$U^Nl7zFDP+EDaGLhYEI zLeC%#MSMQ4M<8E8goke$>F8Oub?HL5rUW&^?7kuh4JIa^L*LaJuo0*?rb9tb6o0S^}puAgmg{bM`l2T z%kliY0#(NFSg0iUu;RZ#fik4H7QBw#8Rts87L8tl{xKg#SaGj2+^|az_bpb)?Zc~6 zMR7!W)mzN=rX?CJ2D+6j>N1OF*&@)k^UiDIj|{>eluBo-HLG5n{DsXlG{Rq#V?VaS@7_T7k?=jVVvp5lSRR;M>1}EzQYSke3eBom7LbdgC%?Q1W;L8Z& zj8M(+t*VEf4k8Vg*o)@J!vUwm0DgpWRa#MvI04ufXC(-FjT$l5z&rJg{*sCmJgbPe z(7OalCq*iP9)x^@69WnT#4KHYo1j@3KgYv@aOLnMZ4j?T{H?n`6;DuENdcBj@|#DU zI1Nq(%221sb$p-=-F{jsUO=1tKK)m42eC46$NJ{Xy^LA7!%Re3X`$4aC}fzdUIf2U z7Am7Pdo=rF*PJ_RlU}FC@xvz#VlzC|s{Q_Yt93!lPQ`GrCfSzkYfHDLy&jJnQ54iJ zcr4)sTY!;3UAso(E3za4zN@y^7nM8g+^rlfwua3tMk_^_BaCa=9$WfmyVIky7(Ix# zg1~Dh#VUmml$Xw#{F97szFn)i4eGw-V@?*0O{FvRp}6$k*)7^zTe8mcP% zK`r7jNfO9Q19L36`voI1dDN(8ka?d0Iq`;+Hyp33Tr2W7)9WY#o~L3V7Pp&ig@DJ1 z<9G0?m5DKr>M#Y!F`6?8$SVZ%Y`Uaf-Q1+ml-I~v=Pe&7y@z}O7K z!nWNViB~9?y9?Y_idOm2NfDbF!3aOuN%ioWErnu1uSP;dWhAf^S=Be*D(bo;M?Bb0 zf#nCAUl4j8Jplb~_KzcG=y$Q}&G^ZJ5&3xq{^kyfah!v0ng~A-(gY#e3?YW!5MqQy zndy8&%=-wj{u1=@1R-|#6|&>r{x%^Fymvw3(pi*ouNrg1Lk&RueL?oRB4# z;dq#krTBg+u9qR*vN1xI7ZI|uhLBV4B4icHT#frR$ak$k$U4+-{Y!*wxQLKJoHyaT z={JN7Z6;*P03lmP2-)@oA;Yf|a{A4LjNtu_ZbEh*A!PJbLdMaK38dR=#(}!;d!CRp z+X*?_jst1VIZDWR$oF6kA&2!it|sJsJiFi=9DgL_b3Y;E!t)9FJnD1teS}nqU4 zD{mv@s_SsPOUM`BCgj>MAzykB2lDz7zWXxj@D;qj0cG8I7a=#}{+7!K!Dr-lJiBv@ zkh^|K$UVymxpxC0_l*#8|LcT2fa?d4$JYmNJc9#i9^8flZTSZB`6kMLs2;}?ggo3% z$RiavknYhU94P;>RfK%&2qE7I6Y>Pgd*V1DPvQD$Ga=6`z=5>i#W&v_A>{iBLY}>g zkRKc+Q2k zAFBv?tDcbG;r{KP5b}q$g#772Lf%1r{(}4eL4)6Whma3mBIF~q=wi{w1Nc*Abe;QGY&; z<4{l=!SMv4=>vo|w&OrP%}6^(AhhinLfi4IqXx$fgm$(N+O>etZsgswoY20937v=Q ze&oLp=@;SKfenN%LHeby61waiLQh#s=&9!rx~87c)2=3T{Q*KZApIskp_@_m&=Eqn zJWuGhFrmX4LQiiebOhHs6NHXENa#4OcO%Unlyk;rLigQ3=vg?QjXcj?Md*G#p$EQC z=pj5mj5Oz?exE}<{uR$J`X!;4-c0CGHKAW@A@u6GgkCd3=(YO@{nB-Wez~2{>yhq; z+X%f8-`(^ZLT^F7Uqd~<_Aa5f-bd(dNPh?3-?fd%*H-hp})ZS4IFQ_;P{Zx zUm}nHm>~4mj}!V^Jp0{Ug#Lal4%F*EQQtol;lR5;o=@n1q0Dz)CG>y7IPmP<1vuU& z^u2wAzW*?xAE2xc&mr_9eE0D-LXUM5dK_sd=MtJ7zD;Y^Pc&T^EE4TN~EUG&m}P3ui9?-6-|j^6tLhyIE4 z`_K74czN!#E$p`H++#8@Wr!&FD>U z;MkAnSK-+qJi8U&c-a}x&cU%3$GtcvaID7Bj$<6h1{^HEL3Xh8IBr26PvAI=;~8O< zd_JUlk1SVxo-9_~f^v;G>&Rm9IkH%4AqS;8vY0=YbPG?C5-Ek}M=$_9PL{Igs^62t zs(vzn^8wXw@y<_{skV?6k{$2fBMq9vB#Cn`j)ZtUt2^AST}$?$9`(YtRLkms>kEW4 zNjtvn7hGfk&I^PzY3E)dryy+y?$>aaqW&*UT_XIP^s{T}F0z(A$NM?*cRwc!`R7PK z|5Y*{u&R*X{hXxGo;rL}g`*OAqfGLZTphlQ>t`6;#a{u2E#yo1?ow5hoP|0aQtApg zA0-0}M(P!0Ii4SYuhD+wIUm;yu5GL?nltTGaLp}!q*FpY$aw_WP=N6LlaPDQ#aJHaLZGhcI z`TZ)gj-?Uj5R07d=cEPqt(ZcsM4Ama*5JF1I1d6(>yd6FXdr_$i^O$g5P1#ayb<^r zLHn*`&*k(uvuCV*`8G2;mfM}0`j|b}{+VnPub;YxwRgtRBDb5tfVG*O^KITr82mb< zJJ5dC=G=GMTgd=B)JC#GgGo@XzZ}%okO8FG$Y>b#Vn;v!0qI7aHH?k{{{-4pi+lDg ze-xwME7(2KGa6>kW%?IZlV-H7QYs+}aSr9bk&XaoIK%^_88~3ybtB(4^t*21by6bt zneUMvRtLP_#iyoztZtmT1GLQUH{g5_^vCG7<78(%+m$;G<9sN0uy5FL0lpu^`7k@n zhkxoA>UIG6twkHh(4MDpJe8xdXFwk^&%%3_<^ZER&}|vg9Lyd2aXt^v&j#%>e#iO+ zyJu&{pB}-%`bhr#ZCtZ_<#X;^c7HCeFJ=d>SvfO~4_-!H58z<=vpiY*eK=~-7P&ow zYwCA^V>o~2k7CMylPmW%=*YdfYZZ~mqq%FQgZ3oyf~pm=P86;wQPJP$ zo^wP^|D3z#iJN|qyA}ux8*|qpadM&DwTc+IhTOHBf7j^Fy+h*@Lz}}}#z%LAw~X$b z*c~3-67Cw^F}7!7Xgs`dbo0>o&hVDO9m6AMh7(<-;o8P@V`Xh)rXk!tx^r-3bGWA} zJb&k&iEZJ*otwj>6WfNycUOfM4owVBoH;fW-aWcy;*7!ZA^F>6O-*fh+0gjbq43JV z?R!Rsc5WXHx9lC<-o9ykbmy7-s>b)URxKY|)j2w{IiEul?(sj&o~=aQ!=pRHHC45_ zR8Song@A1@8G=i&3H;qm!cYz!$I~716?;2DcH?>!&%<*19WcAxBc~q6lZAM*S^j>f z{KX)?93~^=Oxz`qz7*$L(n!)cD&?yTX~45?x#U5lWM%e1MK(<4qcoQDHe3(ln!Op7 z?^*qJ%V`#(tO>lGKnY{G4&yni+XOZO2a$?B$(NfXHTc!y$uhZyTjjSak#0N68NuC7 zT#e#=3t+&Wwv$bA>vtmeeJF1n=~{7KjO6 z%%>LkX=o*F07?g%)CH9FAc}GyRzdTy4>+GJ03a4&muvv~M@s?X<=8`C34fuhptZG{ ztbsS-(_m4vo@@YUZz31Kdh~X3Gr5u+Ax|R~^Nr*(ayhw>+&~^CUnM_7M6~0C^bRLDBHeG<&ql*w;et<5aOX)JY zoUWiNDfW`+sdP16L)X&N=sLO{drpINBi%$d(;>QrZl&AkFg=}arz3O+-APC37?iul z>25kf_t3rc47!h=Nza01-Z}JK$Yu7^1N0z0L=V&R=>_y(=;!DWdLd#Nf1X}MFQ%8! zOX+3wa(V^5k{+d3(J#<1(yQq;^ji8Q$o0NVze2C4H_)%r8|h8-W_k<#8oia?MsLTK zA^I?Vgg#0iqmR>X(Qni5&?o4V^eOr@eTM!U z{Vx3;{XTt`K1Y8*pQk^BPU4GDWqXHpAo>3j5j`T_lrendZ} z$LMjfYUiGj5%rEeBNM}8BWG&1jt}k~+BCXjqh@ducr3e;_Us(4sjEq9CWc2g&wSF5 zdy~qY)46jdckalYJ9Fo*+__sh*VZcMWbV7Vq;g-Ezt32PM<)h14-btG?H=AeF}ibf zx7aZg!h!0DqdSJS4(eI9`D&RyQB8d=Pr17K+)MdJD}O9sY6iCq57*YzBmE96{P$hoeNb6uf+b%iqO z3T4z4%BU-pQCBFVu22SiaOc`vUnrx#P)2>BjQT?W(s9w3T0#p zWx$tt4nmni8JR*EnL-(vLK%&PG8zkIG#1KeER@k$D5J4ZMq{Cj#zGnCTGftW%mRm4 z4@uT^%M2!2TdNe4s!isKPSw^mBz0#Df#d9+7$4ldTfKD4_~7=5J>%$_Lu1=CgX80) zXN(MOnULhGJ!4w=JU+a2+l2CR^XM5nm8*@IZ7NrL#y0PiORjB{S!EKl)ZD$yDskVa z+;_?>GFjUxv&dv^SB>(#t5z=;w0YwQD_toSH+#km`R8&S3aMB%lux@GG-x#D(Ypsn zbVK{VM~8M!3=fW|hjxrjoVj~wLJgLW{=RcU8X6hefwOw|o=w{(z{unblC?D=1K#f3 zU7daqS&R?w-o9gSVq5N^(hRgiKQ=x(Hab3mdGO$f@-o?=9U0v^ylHR*Q*cf0a&%lj zyc5~%9@@mxim2k~PHFcrCh~*h%6Iij+mrS3u#ilmD{UIxxpjOGt181|vR;8wGA$1@ z$z)m{XmD1bm`r!e)j=tHHlm?MRyTIT{tQj%$A`9z4DHLk%ik#Pl>9S2%DGV8&L4r(9X@noAwkS z&{eN|-K9`XvOAYcw?Zv-HOhTmP5xeiLtRa$W^m`$5ulTi3cHetL(Z%|sTAGNsTAGN zseIg!Be{mII+fA_Ie9~mf`x`23?5^Ho0T4vN+}RYrINy?kv;MZA(=`k=t!j$u%%MH n`i '', + 'img_path' => '', + 'img_url' => '', + 'img_width' => '150', + 'img_height' => '30', + 'font_path' => '', + 'expiration' => 7200, + 'word_length' => 8, + 'font_size' => 16, + 'img_id' => '', + 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'colors' => array( + 'background' => array(255,255,255), + 'border' => array(153,102,102), + 'text' => array(204,153,153), + 'grid' => array(255,182,182) + ) + ); + + foreach ($defaults as $key => $val) + { + if ( ! is_array($data) && empty($$key)) + { + $$key = $val; + } + else + { + $$key = isset($data[$key]) ? $data[$key] : $val; + } + } + + if ($img_path === '' OR $img_url === '' + OR ! is_dir($img_path) OR ! is_really_writable($img_path) + OR ! extension_loaded('gd')) + { + return FALSE; + } + + // ----------------------------------- + // Remove old images + // ----------------------------------- + + $now = microtime(TRUE); + + $current_dir = @opendir($img_path); + while ($filename = @readdir($current_dir)) + { + if (in_array(substr($filename, -4), array('.jpg', '.png')) + && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) + { + @unlink($img_path.$filename); + } + } + + @closedir($current_dir); + + // ----------------------------------- + // Do we have a "word" yet? + // ----------------------------------- + + if (empty($word)) + { + $word = ''; + $pool_length = strlen($pool); + $rand_max = $pool_length - 1; + + // PHP7 or a suitable polyfill + if (function_exists('random_int')) + { + try + { + for ($i = 0; $i < $word_length; $i++) + { + $word .= $pool[random_int(0, $rand_max)]; + } + } + catch (Exception $e) + { + // This means fallback to the next possible + // alternative to random_int() + $word = ''; + } + } + } + + if (empty($word)) + { + // Nobody will have a larger character pool than + // 256 characters, but let's handle it just in case ... + // + // No, I do not care that the fallback to mt_rand() can + // handle it; if you trigger this, you're very obviously + // trying to break it. -- Narf + if ($pool_length > 256) + { + return FALSE; + } + + // We'll try using the operating system's PRNG first, + // which we can access through CI_Security::get_random_bytes() + $security = get_instance()->security; + + // To avoid numerous get_random_bytes() calls, we'll + // just try fetching as much bytes as we need at once. + if (($bytes = $security->get_random_bytes($pool_length)) !== FALSE) + { + $byte_index = $word_index = 0; + while ($word_index < $word_length) + { + // Do we have more random data to use? + // It could be exhausted by previous iterations + // ignoring bytes higher than $rand_max. + if ($byte_index === $pool_length) + { + // No failures should be possible if the + // first get_random_bytes() call didn't + // return FALSE, but still ... + for ($i = 0; $i < 5; $i++) + { + if (($bytes = $security->get_random_bytes($pool_length)) === FALSE) + { + continue; + } + + $byte_index = 0; + break; + } + + if ($bytes === FALSE) + { + // Sadly, this means fallback to mt_rand() + $word = ''; + break; + } + } + + list(, $rand_index) = unpack('C', $bytes[$byte_index++]); + if ($rand_index > $rand_max) + { + continue; + } + + $word .= $pool[$rand_index]; + $word_index++; + } + } + } + + if (empty($word)) + { + for ($i = 0; $i < $word_length; $i++) + { + $word .= $pool[mt_rand(0, $rand_max)]; + } + } + elseif ( ! is_string($word)) + { + $word = (string) $word; + } + + // ----------------------------------- + // Determine angle and position + // ----------------------------------- + $length = strlen($word); + $angle = ($length >= 6) ? mt_rand(-($length-6), ($length-6)) : 0; + $x_axis = mt_rand(6, (360/$length)-16); + $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height); + + // Create image + // PHP.net recommends imagecreatetruecolor(), but it isn't always available + $im = function_exists('imagecreatetruecolor') + ? imagecreatetruecolor($img_width, $img_height) + : imagecreate($img_width, $img_height); + + // ----------------------------------- + // Assign colors + // ---------------------------------- + + is_array($colors) OR $colors = $defaults['colors']; + + foreach (array_keys($defaults['colors']) as $key) + { + // Check for a possible missing value + is_array($colors[$key]) OR $colors[$key] = $defaults['colors'][$key]; + $colors[$key] = imagecolorallocate($im, $colors[$key][0], $colors[$key][1], $colors[$key][2]); + } + + // Create the rectangle + ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $colors['background']); + + // ----------------------------------- + // Create the spiral pattern + // ----------------------------------- + $theta = 1; + $thetac = 7; + $radius = 16; + $circles = 20; + $points = 32; + + for ($i = 0, $cp = ($circles * $points) - 1; $i < $cp; $i++) + { + $theta += $thetac; + $rad = $radius * ($i / $points); + $x = ($rad * cos($theta)) + $x_axis; + $y = ($rad * sin($theta)) + $y_axis; + $theta += $thetac; + $rad1 = $radius * (($i + 1) / $points); + $x1 = ($rad1 * cos($theta)) + $x_axis; + $y1 = ($rad1 * sin($theta)) + $y_axis; + imageline($im, $x, $y, $x1, $y1, $colors['grid']); + $theta -= $thetac; + } + + // ----------------------------------- + // Write the text + // ----------------------------------- + + $use_font = ($font_path !== '' && file_exists($font_path) && function_exists('imagettftext')); + if ($use_font === FALSE) + { + ($font_size > 5) && $font_size = 5; + $x = mt_rand(0, $img_width / ($length / 3)); + $y = 0; + } + else + { + ($font_size > 30) && $font_size = 30; + $x = mt_rand(0, $img_width / ($length / 1.5)); + $y = $font_size + 2; + } + + for ($i = 0; $i < $length; $i++) + { + if ($use_font === FALSE) + { + $y = mt_rand(0 , $img_height / 2); + imagestring($im, $font_size, $x, $y, $word[$i], $colors['text']); + $x += ($font_size * 2); + } + else + { + $y = mt_rand($img_height / 2, $img_height - 3); + imagettftext($im, $font_size, $angle, $x, $y, $colors['text'], $font_path, $word[$i]); + $x += $font_size; + } + } + + // Create the border + imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $colors['border']); + + // ----------------------------------- + // Generate the image + // ----------------------------------- + $img_url = rtrim($img_url, '/').'/'; + + if (function_exists('imagejpeg')) + { + $img_filename = $now.'.jpg'; + imagejpeg($im, $img_path.$img_filename); + } + elseif (function_exists('imagepng')) + { + $img_filename = $now.'.png'; + imagepng($im, $img_path.$img_filename); + } + else + { + return FALSE; + } + + $img = ' '; + ImageDestroy($im); + + return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); + } +} diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php new file mode 100755 index 0000000..b943edb --- /dev/null +++ b/system/helpers/cookie_helper.php @@ -0,0 +1,113 @@ +input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('get_cookie')) +{ + /** + * Fetch an item from the COOKIE array + * + * @param string + * @param bool + * @return mixed + */ + function get_cookie($index, $xss_clean = NULL) + { + is_bool($xss_clean) OR $xss_clean = (config_item('global_xss_filtering') === TRUE); + $prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix'); + return get_instance()->input->cookie($prefix.$index, $xss_clean); + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('delete_cookie')) +{ + /** + * Delete a COOKIE + * + * @param mixed + * @param string the cookie domain. Usually: .yourdomain.com + * @param string the cookie path + * @param string the cookie prefix + * @return void + */ + function delete_cookie($name, $domain = '', $path = '/', $prefix = '') + { + set_cookie($name, '', '', $domain, $path, $prefix); + } +} diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php new file mode 100755 index 0000000..bb15042 --- /dev/null +++ b/system/helpers/date_helper.php @@ -0,0 +1,742 @@ +format('j-n-Y G:i:s'), '%d-%d-%d %d:%d:%d', $day, $month, $year, $hour, $minute, $second); + + return mktime($hour, $minute, $second, $month, $day, $year); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('mdate')) +{ + /** + * Convert MySQL Style Datecodes + * + * This function is identical to PHPs date() function, + * except that it allows date codes to be formatted using + * the MySQL style, where each code letter is preceded + * with a percent sign: %Y %m %d etc... + * + * The benefit of doing dates this way is that you don't + * have to worry about escaping your text letters that + * match the date codes. + * + * @param string + * @param int + * @return int + */ + function mdate($datestr = '', $time = '') + { + if ($datestr === '') + { + return ''; + } + elseif (empty($time)) + { + $time = now(); + } + + $datestr = str_replace( + '%\\', + '', + preg_replace('/([a-z]+?){1}/i', '\\\\\\1', $datestr) + ); + + return date($datestr, $time); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('standard_date')) +{ + /** + * Standard Date + * + * Returns a date formatted according to the submitted standard. + * + * As of PHP 5.2, the DateTime extension provides constants that + * serve for the exact same purpose and are used with date(). + * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 Use PHP's native date() instead. + * @link http://www.php.net/manual/en/class.datetime.php#datetime.constants.types + * + * @example date(DATE_RFC822, now()); // default + * @example date(DATE_W3C, $time); // a different format and time + * + * @param string $fmt = 'DATE_RFC822' the chosen format + * @param int $time = NULL Unix timestamp + * @return string + */ + function standard_date($fmt = 'DATE_RFC822', $time = NULL) + { + if (empty($time)) + { + $time = now(); + } + + // Procedural style pre-defined constants from the DateTime extension + if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE) + { + return FALSE; + } + + return date(constant($fmt), $time); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('timespan')) +{ + /** + * Timespan + * + * Returns a span of seconds in this format: + * 10 days 14 hours 36 minutes 47 seconds + * + * @param int a number of seconds + * @param int Unix timestamp + * @param int a number of display units + * @return string + */ + function timespan($seconds = 1, $time = '', $units = 7) + { + $CI =& get_instance(); + $CI->lang->load('date'); + + is_numeric($seconds) OR $seconds = 1; + is_numeric($time) OR $time = time(); + is_numeric($units) OR $units = 7; + + $seconds = ($time <= $seconds) ? 1 : $time - $seconds; + + $str = array(); + $years = floor($seconds / 31557600); + + if ($years > 0) + { + $str[] = $years.' '.$CI->lang->line($years > 1 ? 'date_years' : 'date_year'); + } + + $seconds -= $years * 31557600; + $months = floor($seconds / 2629743); + + if (count($str) < $units && ($years > 0 OR $months > 0)) + { + if ($months > 0) + { + $str[] = $months.' '.$CI->lang->line($months > 1 ? 'date_months' : 'date_month'); + } + + $seconds -= $months * 2629743; + } + + $weeks = floor($seconds / 604800); + + if (count($str) < $units && ($years > 0 OR $months > 0 OR $weeks > 0)) + { + if ($weeks > 0) + { + $str[] = $weeks.' '.$CI->lang->line($weeks > 1 ? 'date_weeks' : 'date_week'); + } + + $seconds -= $weeks * 604800; + } + + $days = floor($seconds / 86400); + + if (count($str) < $units && ($months > 0 OR $weeks > 0 OR $days > 0)) + { + if ($days > 0) + { + $str[] = $days.' '.$CI->lang->line($days > 1 ? 'date_days' : 'date_day'); + } + + $seconds -= $days * 86400; + } + + $hours = floor($seconds / 3600); + + if (count($str) < $units && ($days > 0 OR $hours > 0)) + { + if ($hours > 0) + { + $str[] = $hours.' '.$CI->lang->line($hours > 1 ? 'date_hours' : 'date_hour'); + } + + $seconds -= $hours * 3600; + } + + $minutes = floor($seconds / 60); + + if (count($str) < $units && ($days > 0 OR $hours > 0 OR $minutes > 0)) + { + if ($minutes > 0) + { + $str[] = $minutes.' '.$CI->lang->line($minutes > 1 ? 'date_minutes' : 'date_minute'); + } + + $seconds -= $minutes * 60; + } + + if (count($str) === 0) + { + $str[] = $seconds.' '.$CI->lang->line($seconds > 1 ? 'date_seconds' : 'date_second'); + } + + return implode(', ', $str); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('days_in_month')) +{ + /** + * Number of days in a month + * + * Takes a month/year as input and returns the number of days + * for the given month/year. Takes leap years into consideration. + * + * @param int a numeric month + * @param int a numeric year + * @return int + */ + function days_in_month($month = 0, $year = '') + { + if ($month < 1 OR $month > 12) + { + return 0; + } + elseif ( ! is_numeric($year) OR strlen($year) !== 4) + { + $year = date('Y'); + } + + if (defined('CAL_GREGORIAN')) + { + return cal_days_in_month(CAL_GREGORIAN, $month, $year); + } + + if ($year >= 1970) + { + return (int) date('t', mktime(12, 0, 0, $month, 1, $year)); + } + + if ($month == 2) + { + if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) + { + return 29; + } + } + + $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); + return $days_in_month[$month - 1]; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('local_to_gmt')) +{ + /** + * Converts a local Unix timestamp to GMT + * + * @param int Unix timestamp + * @return int + */ + function local_to_gmt($time = '') + { + if ($time === '') + { + $time = time(); + } + + return mktime( + gmdate('G', $time), + gmdate('i', $time), + gmdate('s', $time), + gmdate('n', $time), + gmdate('j', $time), + gmdate('Y', $time) + ); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('gmt_to_local')) +{ + /** + * Converts GMT time to a localized value + * + * Takes a Unix timestamp (in GMT) as input, and returns + * at the local value based on the timezone and DST setting + * submitted + * + * @param int Unix timestamp + * @param string timezone + * @param bool whether DST is active + * @return int + */ + function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE) + { + if ($time === '') + { + return now(); + } + + $time += timezones($timezone) * 3600; + + return ($dst === TRUE) ? $time + 3600 : $time; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('mysql_to_unix')) +{ + /** + * Converts a MySQL Timestamp to Unix + * + * @param int MySQL timestamp YYYY-MM-DD HH:MM:SS + * @return int Unix timstamp + */ + function mysql_to_unix($time = '') + { + // We'll remove certain characters for backward compatibility + // since the formatting changed with MySQL 4.1 + // YYYY-MM-DD HH:MM:SS + + $time = str_replace(array('-', ':', ' '), '', $time); + + // YYYYMMDDHHMMSS + return mktime( + substr($time, 8, 2), + substr($time, 10, 2), + substr($time, 12, 2), + substr($time, 4, 2), + substr($time, 6, 2), + substr($time, 0, 4) + ); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('unix_to_human')) +{ + /** + * Unix to "Human" + * + * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM + * + * @param int Unix timestamp + * @param bool whether to show seconds + * @param string format: us or euro + * @return string + */ + function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us') + { + $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; + + if ($fmt === 'us') + { + $r .= date('h', $time).':'.date('i', $time); + } + else + { + $r .= date('H', $time).':'.date('i', $time); + } + + if ($seconds) + { + $r .= ':'.date('s', $time); + } + + if ($fmt === 'us') + { + return $r.' '.date('A', $time); + } + + return $r; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('human_to_unix')) +{ + /** + * Convert "human" date to GMT + * + * Reverses the above process + * + * @param string format: us or euro + * @return int + */ + function human_to_unix($datestr = '') + { + if ($datestr === '') + { + return FALSE; + } + + $datestr = preg_replace('/\040+/', ' ', trim($datestr)); + + if ( ! preg_match('/^(\d{2}|\d{4})\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr)) + { + return FALSE; + } + + sscanf($datestr, '%d-%d-%d %s %s', $year, $month, $day, $time, $ampm); + sscanf($time, '%d:%d:%d', $hour, $min, $sec); + isset($sec) OR $sec = 0; + + if (isset($ampm)) + { + $ampm = strtolower($ampm); + + if ($ampm[0] === 'p' && $hour < 12) + { + $hour += 12; + } + elseif ($ampm[0] === 'a' && $hour === 12) + { + $hour = 0; + } + } + + return mktime($hour, $min, $sec, $month, $day, $year); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('nice_date')) +{ + /** + * Turns many "reasonably-date-like" strings into something + * that is actually useful. This only works for dates after unix epoch. + * + * @deprecated 3.1.3 Use DateTime::createFromFormat($input_format, $input)->format($output_format); + * @param string The terribly formatted date-like string + * @param string Date format to return (same as php date function) + * @return string + */ + function nice_date($bad_date = '', $format = FALSE) + { + if (empty($bad_date)) + { + return 'Unknown'; + } + elseif (empty($format)) + { + $format = 'U'; + } + + // Date like: YYYYMM + if (preg_match('/^\d{6}$/i', $bad_date)) + { + if (in_array(substr($bad_date, 0, 2), array('19', '20'))) + { + $year = substr($bad_date, 0, 4); + $month = substr($bad_date, 4, 2); + } + else + { + $month = substr($bad_date, 0, 2); + $year = substr($bad_date, 2, 4); + } + + return date($format, strtotime($year.'-'.$month.'-01')); + } + + // Date Like: YYYYMMDD + if (preg_match('/^\d{8}$/i', $bad_date, $matches)) + { + return DateTime::createFromFormat('Ymd', $bad_date)->format($format); + } + + // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) + if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) + { + return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2])); + } + + // Any other kind of string, when converted into UNIX time, + // produces "0 seconds after epoc..." is probably bad... + // return "Invalid Date". + if (date('U', strtotime($bad_date)) === '0') + { + return 'Invalid Date'; + } + + // It's probably a valid-ish date format already + return date($format, strtotime($bad_date)); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('timezone_menu')) +{ + /** + * Timezone Menu + * + * Generates a drop-down menu of timezones. + * + * @param string timezone + * @param string classname + * @param string menu name + * @param mixed attributes + * @return string + */ + function timezone_menu($default = 'UTC', $class = '', $name = 'timezones', $attributes = '') + { + $CI =& get_instance(); + $CI->lang->load('date'); + + $default = ($default === 'GMT') ? 'UTC' : $default; + + $menu = ''; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('timezones')) +{ + /** + * Timezones + * + * Returns an array of timezones. This is a helper function + * for various other ones in this library + * + * @param string timezone + * @return string + */ + function timezones($tz = '') + { + // Note: Don't change the order of these even though + // some items appear to be in the wrong order + + $zones = array( + 'UM12' => -12, + 'UM11' => -11, + 'UM10' => -10, + 'UM95' => -9.5, + 'UM9' => -9, + 'UM8' => -8, + 'UM7' => -7, + 'UM6' => -6, + 'UM5' => -5, + 'UM45' => -4.5, + 'UM4' => -4, + 'UM35' => -3.5, + 'UM3' => -3, + 'UM2' => -2, + 'UM1' => -1, + 'UTC' => 0, + 'UP1' => +1, + 'UP2' => +2, + 'UP3' => +3, + 'UP35' => +3.5, + 'UP4' => +4, + 'UP45' => +4.5, + 'UP5' => +5, + 'UP55' => +5.5, + 'UP575' => +5.75, + 'UP6' => +6, + 'UP65' => +6.5, + 'UP7' => +7, + 'UP8' => +8, + 'UP875' => +8.75, + 'UP9' => +9, + 'UP95' => +9.5, + 'UP10' => +10, + 'UP105' => +10.5, + 'UP11' => +11, + 'UP115' => +11.5, + 'UP12' => +12, + 'UP1275' => +12.75, + 'UP13' => +13, + 'UP14' => +14 + ); + + if ($tz === '') + { + return $zones; + } + + return isset($zones[$tz]) ? $zones[$tz] : 0; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('date_range')) +{ + /** + * Date range + * + * Returns a list of dates within a specified period. + * + * @param int unix_start UNIX timestamp of period start date + * @param int unix_end|days UNIX timestamp of period end date + * or interval in days. + * @param mixed is_unix Specifies whether the second parameter + * is a UNIX timestamp or a day interval + * - TRUE or 'unix' for a timestamp + * - FALSE or 'days' for an interval + * @param string date_format Output date format, same as in date() + * @return array + */ + function date_range($unix_start = '', $mixed = '', $is_unix = TRUE, $format = 'Y-m-d') + { + if ($unix_start == '' OR $mixed == '' OR $format == '') + { + return FALSE; + } + + $is_unix = ! ( ! $is_unix OR $is_unix === 'days'); + + // Validate input and try strtotime() on invalid timestamps/intervals, just in case + if ( ( ! ctype_digit((string) $unix_start) && ($unix_start = @strtotime($unix_start)) === FALSE) + OR ( ! ctype_digit((string) $mixed) && ($is_unix === FALSE OR ($mixed = @strtotime($mixed)) === FALSE)) + OR ($is_unix === TRUE && $mixed < $unix_start)) + { + return FALSE; + } + + if ($is_unix && ($unix_start == $mixed OR date($format, $unix_start) === date($format, $mixed))) + { + return array(date($format, $unix_start)); + } + + $range = array(); + + $from = new DateTime(); + $from->setTimestamp($unix_start); + + if ($is_unix) + { + $arg = new DateTime(); + $arg->setTimestamp($mixed); + } + else + { + $arg = (int) $mixed; + } + + $period = new DatePeriod($from, new DateInterval('P1D'), $arg); + foreach ($period as $date) + { + $range[] = $date->format($format); + } + + /* If a period end date was passed to the DatePeriod constructor, it might not + * be in our results. Not sure if this is a bug or it's just possible because + * the end date might actually be less than 24 hours away from the previously + * generated DateTime object, but either way - we have to append it manually. + */ + if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) + { + $range[] = $arg->format($format); + } + + return $range; + } +} diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php new file mode 100755 index 0000000..2785241 --- /dev/null +++ b/system/helpers/directory_helper.php @@ -0,0 +1,101 @@ + 0) && is_dir($source_dir.$file)) + { + $filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden); + } + else + { + $filedata[] = $file; + } + } + + closedir($fp); + return $filedata; + } + + return FALSE; + } +} diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php new file mode 100755 index 0000000..b2a1458 --- /dev/null +++ b/system/helpers/download_helper.php @@ -0,0 +1,158 @@ + 0) + ? @rmdir($path) + : TRUE; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('get_filenames')) +{ + /** + * Get Filenames + * + * Reads the specified directory and builds an array containing the filenames. + * Any sub-folders contained within the specified path are read as well. + * + * @param string path to source + * @param bool whether to include the path as part of the filename + * @param bool internal variable to determine recursion status - do not use in calls + * @return array + */ + function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE) + { + static $_filedata = array(); + + if ($fp = @opendir($source_dir)) + { + // reset the array and make sure $source_dir has a trailing slash on the initial call + if ($_recursion === FALSE) + { + $_filedata = array(); + $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + } + + while (FALSE !== ($file = readdir($fp))) + { + if (is_dir($source_dir.$file) && $file[0] !== '.') + { + get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); + } + elseif ($file[0] !== '.') + { + $_filedata[] = ($include_path === TRUE) ? $source_dir.$file : $file; + } + } + + closedir($fp); + return $_filedata; + } + + return FALSE; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('get_dir_file_info')) +{ + /** + * Get Directory File Information + * + * Reads the specified directory and builds an array containing the filenames, + * filesize, dates, and permissions + * + * Any sub-folders contained within the specified path are read as well. + * + * @param string path to source + * @param bool Look only at the top level directory specified? + * @param bool internal variable to determine recursion status - do not use in calls + * @return array + */ + function get_dir_file_info($source_dir, $top_level_only = TRUE, $_recursion = FALSE) + { + static $_filedata = array(); + $relative_path = $source_dir; + + if ($fp = @opendir($source_dir)) + { + // reset the array and make sure $source_dir has a trailing slash on the initial call + if ($_recursion === FALSE) + { + $_filedata = array(); + $source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + } + + // Used to be foreach (scandir($source_dir, 1) as $file), but scandir() is simply not as fast + while (FALSE !== ($file = readdir($fp))) + { + if (is_dir($source_dir.$file) && $file[0] !== '.' && $top_level_only === FALSE) + { + get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, TRUE); + } + elseif ($file[0] !== '.') + { + $_filedata[$file] = get_file_info($source_dir.$file); + $_filedata[$file]['relative_path'] = $relative_path; + } + } + + closedir($fp); + return $_filedata; + } + + return FALSE; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('get_file_info')) +{ + /** + * Get File Info + * + * Given a file and path, returns the name, path, size, date modified + * Second parameter allows you to explicitly declare what information you want returned + * Options are: name, server_path, size, date, readable, writable, executable, fileperms + * Returns FALSE if the file cannot be found. + * + * @param string path to file + * @param mixed array or comma separated string of information returned + * @return array + */ + function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date')) + { + if ( ! file_exists($file)) + { + return FALSE; + } + + if (is_string($returned_values)) + { + $returned_values = explode(',', $returned_values); + } + + foreach ($returned_values as $key) + { + switch ($key) + { + case 'name': + $fileinfo['name'] = basename($file); + break; + case 'server_path': + $fileinfo['server_path'] = $file; + break; + case 'size': + $fileinfo['size'] = filesize($file); + break; + case 'date': + $fileinfo['date'] = filemtime($file); + break; + case 'readable': + $fileinfo['readable'] = is_readable($file); + break; + case 'writable': + $fileinfo['writable'] = is_really_writable($file); + break; + case 'executable': + $fileinfo['executable'] = is_executable($file); + break; + case 'fileperms': + $fileinfo['fileperms'] = fileperms($file); + break; + } + } + + return $fileinfo; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('get_mime_by_extension')) +{ + /** + * Get Mime by Extension + * + * Translates a file extension into a mime type based on config/mimes.php. + * Returns FALSE if it can't determine the type, or open the mime config file + * + * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience + * It should NOT be trusted, and should certainly NOT be used for security + * + * @param string $filename File name + * @return string + */ + function get_mime_by_extension($filename) + { + static $mimes; + + if ( ! is_array($mimes)) + { + $mimes = get_mimes(); + + if (empty($mimes)) + { + return FALSE; + } + } + + $extension = strtolower(substr(strrchr($filename, '.'), 1)); + + if (isset($mimes[$extension])) + { + return is_array($mimes[$extension]) + ? current($mimes[$extension]) // Multiple mime types, just give the first one + : $mimes[$extension]; + } + + return FALSE; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('symbolic_permissions')) +{ + /** + * Symbolic Permissions + * + * Takes a numeric value representing a file's permissions and returns + * standard symbolic notation representing that value + * + * @param int $perms Permissions + * @return string + */ + function symbolic_permissions($perms) + { + if (($perms & 0xC000) === 0xC000) + { + $symbolic = 's'; // Socket + } + elseif (($perms & 0xA000) === 0xA000) + { + $symbolic = 'l'; // Symbolic Link + } + elseif (($perms & 0x8000) === 0x8000) + { + $symbolic = '-'; // Regular + } + elseif (($perms & 0x6000) === 0x6000) + { + $symbolic = 'b'; // Block special + } + elseif (($perms & 0x4000) === 0x4000) + { + $symbolic = 'd'; // Directory + } + elseif (($perms & 0x2000) === 0x2000) + { + $symbolic = 'c'; // Character special + } + elseif (($perms & 0x1000) === 0x1000) + { + $symbolic = 'p'; // FIFO pipe + } + else + { + $symbolic = 'u'; // Unknown + } + + // Owner + $symbolic .= (($perms & 0x0100) ? 'r' : '-') + .(($perms & 0x0080) ? 'w' : '-') + .(($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); + + // Group + $symbolic .= (($perms & 0x0020) ? 'r' : '-') + .(($perms & 0x0010) ? 'w' : '-') + .(($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); + + // World + $symbolic .= (($perms & 0x0004) ? 'r' : '-') + .(($perms & 0x0002) ? 'w' : '-') + .(($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); + + return $symbolic; + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('octal_permissions')) +{ + /** + * Octal Permissions + * + * Takes a numeric value representing a file's permissions and returns + * a three character string representing the file's octal permissions + * + * @param int $perms Permissions + * @return string + */ + function octal_permissions($perms) + { + return substr(sprintf('%o', $perms), -3); + } +} diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php new file mode 100755 index 0000000..13f1963 --- /dev/null +++ b/system/helpers/form_helper.php @@ -0,0 +1,1055 @@ +config->site_url($CI->uri->uri_string()); + } + // If an action is not a full URL then turn it into one + elseif (strpos($action, '://') === FALSE) + { + $action = $CI->config->site_url($action); + } + + $attributes = _attributes_to_string($attributes); + + if (stripos($attributes, 'method=') === FALSE) + { + $attributes .= ' method="post"'; + } + + if (stripos($attributes, 'accept-charset=') === FALSE) + { + $attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"'; + } + + $form = '
\n"; + + if (is_array($hidden)) + { + foreach ($hidden as $name => $value) + { + $form .= ''."\n"; + } + } + + // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites + if ($CI->config->item('csrf_protection') === TRUE && strpos($action, $CI->config->base_url()) !== FALSE && ! stripos($form, 'method="get"')) + { + // Prepend/append random-length "white noise" around the CSRF + // token input, as a form of protection against BREACH attacks + if (FALSE !== ($noise = $CI->security->get_random_bytes(1))) + { + list(, $noise) = unpack('c', $noise); + } + else + { + $noise = mt_rand(-128, 127); + } + + // Prepend if $noise has a negative value, append if positive, do nothing for zero + $prepend = $append = ''; + if ($noise < 0) + { + $prepend = str_repeat(" ", abs($noise)); + } + elseif ($noise > 0) + { + $append = str_repeat(" ", $noise); + } + + $form .= sprintf( + '%s%s%s', + $prepend, + $CI->security->get_csrf_token_name(), + $CI->security->get_csrf_hash(), + $append, + "\n" + ); + } + + return $form; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_open_multipart')) +{ + /** + * Form Declaration - Multipart type + * + * Creates the opening portion of the form, but with "multipart/form-data". + * + * @param string the URI segments of the form destination + * @param array a key/value pair of attributes + * @param array a key/value pair hidden data + * @return string + */ + function form_open_multipart($action = '', $attributes = array(), $hidden = array()) + { + if (is_string($attributes)) + { + $attributes .= ' enctype="multipart/form-data"'; + } + else + { + $attributes['enctype'] = 'multipart/form-data'; + } + + return form_open($action, $attributes, $hidden); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_hidden')) +{ + /** + * Hidden Input Field + * + * Generates hidden fields. You can pass a simple key/value string or + * an associative array with multiple values. + * + * @param mixed $name Field name + * @param string $value Field value + * @param bool $recursing + * @return string + */ + function form_hidden($name, $value = '', $recursing = FALSE) + { + static $form; + + if ($recursing === FALSE) + { + $form = "\n"; + } + + if (is_array($name)) + { + foreach ($name as $key => $val) + { + form_hidden($key, $val, TRUE); + } + + return $form; + } + + if ( ! is_array($value)) + { + $form .= '\n"; + } + else + { + foreach ($value as $k => $v) + { + $k = is_int($k) ? '' : $k; + form_hidden($name.'['.$k.']', $v, TRUE); + } + } + + return $form; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_input')) +{ + /** + * Text Input Field + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_input($data = '', $value = '', $extra = '') + { + $defaults = array( + 'type' => 'text', + 'name' => is_array($data) ? '' : $data, + 'value' => $value + ); + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_password')) +{ + /** + * Password Field + * + * Identical to the input function but adds the "password" type + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_password($data = '', $value = '', $extra = '') + { + is_array($data) OR $data = array('name' => $data); + $data['type'] = 'password'; + return form_input($data, $value, $extra); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_upload')) +{ + /** + * Upload Field + * + * Identical to the input function but adds the "file" type + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_upload($data = '', $value = '', $extra = '') + { + $defaults = array('type' => 'file', 'name' => ''); + is_array($data) OR $data = array('name' => $data); + $data['type'] = 'file'; + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_textarea')) +{ + /** + * Textarea field + * + * @param mixed $data + * @param string $value + * @param mixed $extra + * @return string + */ + function form_textarea($data = '', $value = '', $extra = '') + { + $defaults = array( + 'name' => is_array($data) ? '' : $data, + 'cols' => '40', + 'rows' => '10' + ); + + if ( ! is_array($data) OR ! isset($data['value'])) + { + $val = $value; + } + else + { + $val = $data['value']; + unset($data['value']); // textareas don't use the value attribute + } + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_multiselect')) +{ + /** + * Multi-select menu + * + * @param string + * @param array + * @param mixed + * @param mixed + * @return string + */ + function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '') + { + $extra = _attributes_to_string($extra); + if (stripos($extra, 'multiple') === FALSE) + { + $extra .= ' multiple="multiple"'; + } + + return form_dropdown($name, $options, $selected, $extra); + } +} + +// -------------------------------------------------------------------- + +if ( ! function_exists('form_dropdown')) +{ + /** + * Drop-down Menu + * + * @param mixed $data + * @param mixed $options + * @param mixed $selected + * @param mixed $extra + * @return string + */ + function form_dropdown($data = '', $options = array(), $selected = array(), $extra = '') + { + $defaults = array(); + + if (is_array($data)) + { + if (isset($data['selected'])) + { + $selected = $data['selected']; + unset($data['selected']); // select tags don't have a selected attribute + } + + if (isset($data['options'])) + { + $options = $data['options']; + unset($data['options']); // select tags don't use an options attribute + } + } + else + { + $defaults = array('name' => $data); + } + + is_array($selected) OR $selected = array($selected); + is_array($options) OR $options = array($options); + + // If no selected state was submitted we will attempt to set it automatically + if (empty($selected)) + { + if (is_array($data)) + { + if (isset($data['name'], $_POST[$data['name']])) + { + $selected = array($_POST[$data['name']]); + } + } + elseif (isset($_POST[$data])) + { + $selected = array($_POST[$data]); + } + } + + $extra = _attributes_to_string($extra); + + $multiple = (count($selected) > 1 && stripos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; + + $form = '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_checkbox')) +{ + /** + * Checkbox Field + * + * @param mixed + * @param string + * @param bool + * @param mixed + * @return string + */ + function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '') + { + $defaults = array('type' => 'checkbox', 'name' => ( ! is_array($data) ? $data : ''), 'value' => $value); + + if (is_array($data) && array_key_exists('checked', $data)) + { + $checked = $data['checked']; + + if ($checked == FALSE) + { + unset($data['checked']); + } + else + { + $data['checked'] = 'checked'; + } + } + + if ($checked == TRUE) + { + $defaults['checked'] = 'checked'; + } + else + { + unset($defaults['checked']); + } + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_radio')) +{ + /** + * Radio Button + * + * @param mixed + * @param string + * @param bool + * @param mixed + * @return string + */ + function form_radio($data = '', $value = '', $checked = FALSE, $extra = '') + { + is_array($data) OR $data = array('name' => $data); + $data['type'] = 'radio'; + + return form_checkbox($data, $value, $checked, $extra); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_submit')) +{ + /** + * Submit Button + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_submit($data = '', $value = '', $extra = '') + { + $defaults = array( + 'type' => 'submit', + 'name' => is_array($data) ? '' : $data, + 'value' => $value + ); + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_reset')) +{ + /** + * Reset Button + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_reset($data = '', $value = '', $extra = '') + { + $defaults = array( + 'type' => 'reset', + 'name' => is_array($data) ? '' : $data, + 'value' => $value + ); + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_button')) +{ + /** + * Form Button + * + * @param mixed + * @param string + * @param mixed + * @return string + */ + function form_button($data = '', $content = '', $extra = '') + { + $defaults = array( + 'name' => is_array($data) ? '' : $data, + 'type' => 'button' + ); + + if (is_array($data) && isset($data['content'])) + { + $content = $data['content']; + unset($data['content']); // content is not an attribute + } + + return '\n"; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_label')) +{ + /** + * Form Label Tag + * + * @param string The text to appear onscreen + * @param string The id the label applies to + * @param mixed Additional attributes + * @return string + */ + function form_label($label_text = '', $id = '', $attributes = array()) + { + + $label = ''.$label_text.''; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_fieldset')) +{ + /** + * Fieldset Tag + * + * Used to produce
text. To close fieldset + * use form_fieldset_close() + * + * @param string The legend text + * @param array Additional attributes + * @return string + */ + function form_fieldset($legend_text = '', $attributes = array()) + { + $fieldset = '\n"; + if ($legend_text !== '') + { + return $fieldset.''.$legend_text."\n"; + } + + return $fieldset; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_fieldset_close')) +{ + /** + * Fieldset Close Tag + * + * @param string + * @return string + */ + function form_fieldset_close($extra = '') + { + return '
'.$extra; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_close')) +{ + /** + * Form Close Tag + * + * @param string + * @return string + */ + function form_close($extra = '') + { + return ''.$extra; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('form_prep')) +{ + /** + * Form Prep + * + * Formats text so that it can be safely placed in a form field in the event it has HTML tags. + * + * @deprecated 3.0.0 An alias for html_escape() + * @param string|string[] $str Value to escape + * @return string|string[] Escaped values + */ + function form_prep($str) + { + return html_escape($str, TRUE); + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('set_value')) +{ + /** + * Form Value + * + * Grabs a value from the POST array for the specified field so you can + * re-populate an input field or textarea. If Form Validation + * is active it retrieves the info from the validation class + * + * @param string $field Field name + * @param string $default Default value + * @param bool $html_escape Whether to escape HTML special characters or not + * @return string + */ + function set_value($field, $default = '', $html_escape = TRUE) + { + $CI =& get_instance(); + + $value = (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field)) + ? $CI->form_validation->set_value($field, $default) + : $CI->input->post($field, FALSE); + + isset($value) OR $value = $default; + return ($html_escape) ? html_escape($value) : $value; + } +} + +// ------------------------------------------------------------------------ + +if ( ! function_exists('set_select')) +{ + /** + * Set Select + * + * Let's you set the selected value of a + + + + + + +
+   + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

Developer’s Certificate of Origin 1.1

+

By making a contribution to this project, I certify that:

+
    +
  1. The contribution was created in whole or in part by me and I +have the right to submit it under the open source license +indicated in the file; or
  2. +
  3. The contribution is based upon previous work that, to the best +of my knowledge, is covered under an appropriate open source +license and I have the right under that license to submit that +work with modifications, whether created in whole or in part +by me, under the same open source license (unless I am +permitted to submit under a different license), as indicated +in the file; or
  4. +
  5. The contribution was provided directly to me by some other +person who certified (1), (2) or (3) and I have not modified +it.
  6. +
  7. I understand and agree that this project and the contribution +are public and that a record of the contribution (including all +personal information I submit with it, including my sign-off) is +maintained indefinitely and may be redistributed consistent with +this project or the open source license(s) involved.
  8. +
+
+ + +
+
+ + + + +
+ +
+

+ © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

+
+ + Built with Sphinx using a theme provided by Read the Docs. + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/_downloads/ELDocs.tmbundle.zip b/user_guide/_downloads/ELDocs.tmbundle.zip new file mode 100755 index 0000000000000000000000000000000000000000..f7a11b364ca918379b48ad525798148e7470b6b1 GIT binary patch literal 3932 zcmb7`c{tR28^(W(y$F$QNRlOMWbFGACbG?uwMEpJVPeK|NNH@@8T&}GO~=+EAxkG~ zg&A9@5Qm7SF$ZO$daivT)+8a?)$ms^L(H0Z36`{aR3`HW(!gMKOX-2 z;0E{s)8i&6540l2=WKxQIi#l&%z+&MS>(A`+vK}g!-AQBj|_Z(4PAnd{v)-MZ?(wk+lK#dtaigIRH=49r+X zgMrp0LnN{T_u}ptVU3oN3wathYr;#_#U*!U-H8eNU`I0^5ED3(JD^dP+)(44bY?+Cb-K?r za|&$)JM_ApCORK99FWeRldhtahjc2<`i!G)O|-}zf{jY@sg!fFmGaLXEha&Ic~lEz zn(Uf>Z(LL~<$GMQD9$9@3&{u{T`;jtijH;BiLhjWvqsCZww&DallHETVp6bDLeR9r z4G(v+yoW&^k2uoO(4!EG?ZTW*4MCt5ihnaq^;X79i)Wh~>&qKToX}mpd&)n}k-!M` zZlQ2;x<&HcY>h~8=D)Pi;v7JMtoSdt(%!x$tX@7)V(S$rA(`aI9XoYXW#%gS+%=pN z{LXdKvz1BBl}~%x--~YG-F`xZw!v%f3%_{L6NCPdQF+8R+@wMu6=wRVDDR}@bH*Fx zFOK%~z`#+y^lALdDuRWh~>sm9bx;a%#yYvwG#n3($<6VJ! zuu5v259+@juo#P89kZ&vDtM_e27USMYv}pU-tl^MDW3Kx?s+6DPpTmns}u>rX&r5? z_a7H#{nn}yW-0O97g}ml~};g~GjzdL+Z?BJI&2Quh=ptd&I z4T30pEpvd!sw+yXLM>r7Jg*!~#_wJ0(Q+n235;ayqb1|Vc;^LY+ga91i$fpEng?%z zhLB{U2pJS2CHR=2x@tqY$XBDKWFlFiWmwb`S%3*aPF zW1j|IdtND~Wv+lPiON;6f9v_hU+b!ur9+vgm%>g^&;e(Elt{B>s{wa(&y4I)dxS2M zkm~GhZU-4-;V=aeSeu~@PG|30wamBG{6d}Y*caD4_2tsKdMndFt1nb99pdR0^&B0O z{)^?%&rbXY+&tNHd*N@Gh9}{fO~vSbBs4V0}TQ&DR&XI#IQH4a&%7a2>_UgqPS{4{HiOZLLQWLWIVqqWK%kJtWB-uqXyh z1aY@_s5fS5ZiO%=c&HCz@!)kS>PhrPGS?$_&QWV!{SU1Sd=N2~i?{PiL|?1BBg0;q zhhEx$EWp4~PWu6`OXZ^Cth!&*GmI0T<@)`~J+(eLv?F@?326&?r$=+yAd`MAldL?d zBr5X>9M6fi_mk`sA07gi*M&9pw}LnWO%_z3Ls+2Kj;CV-#E-J@OlkIR*&5G!sjazTeLq>qS;_T~+ghLwiVe9Nkj>XLfa!&G;r`*hjobQr@{9yK@XUT$owkMvUg-of}+NT7%o1HPzX z;+E!iUf$@8_f;a=o`XLKwzLdojS;;=HhweW|;(_=o9X3FJ*`nHA zx7|b)!2ZEx4!CYDjc{y`cLyViu;%+pQi7cj*`=VLu=4+p`KxXHSmx2r%b8q#*Nr1nd-Og03Ep7kp5A z5zb2@UfM-7Uz6H+OIa*Gm~KSm0Wsi#0}=uznmzr)=LYqM<1c= z=`PR(=XAj*a;9$Tb42`pSwl$viso)SNad5}9mFNjRxZ6?D_oT5OjhUx`7tg(d|FZs zPed4SNA)bq4JF1b1IBwDBwg@E@cv?3-nr&B=q?e-8iPRA5wkTa>6O_*-(?jgYM83F zoK(zMW|KupIYDeGb;@6g+$dXC4_<;nYQyx{75p?quid|O^bDn@|7kz0+O;iV1Q@6p zvkZ5Fc+B}PWFI*TNYbt^2(&=}`tBmVs=MC!Qm81}L9Nmu*p;`N5N?0Exs(|D^*q=v z{_vCDdhR=mf-_c$Rb~tXajT+2+tzZL?ahY7Oier7AUW?#wRz-K)i1$A%Gn8wV!t0q zmuz4p-BW%3;_old(9&WK*tb@Et6MV#EC&`|* zez@!~Pi^z`(`uF_7yJE6Qs^)Z{K?ff))ql(!ty#Oo$78>))5VToZ*t!vCoV)PzFW; z(DsRq8{qsq-BS!V9=}ca%zq|)STI0O_8U_Fl?{8DS{6_PCjc!ern;Z4rN%J3b<_=a{^U`K35YrCrZ+~O&;IlOjZ1zcD{*KSK z>uv|DtvB6fD=_Q#t^Tds*8RQNt(xtJ-2ScM*2T2h@Hl-c|8d~HSyNm7L1vbX)5K1H NV?Y4VziZ>$e*jys2rd8s literal 0 HcmV?d00001 diff --git a/user_guide/_images/appflowchart.gif b/user_guide/_images/appflowchart.gif new file mode 100755 index 0000000000000000000000000000000000000000..422332c9e21ceb09a535d098407f52effc392baa GIT binary patch literal 25276 zcmV)2K+L~KNk%w1VYvd$0QUd@|Ns9kW}lEq1OER0kQf;K{r#7BIsgCwMTkWF{QUa* z`uF$u`}_Ow@bL8X^!fSu?d|Q^+1dE`_~_{9+}zyu_V(=T?BCzt_4W1h^Yi57GARL;Nalp<>l4Y)#vBu($doI?(XmJ@7mhh>gwv$)YOtq3eC;U=H}+x z+uPUI*VEI}k4OX7*4E?W<27rc;o;%Oqk-$|>vyPjkxUAOgM-M9j=Ig~TUc1Dj8WRh zu&$C^wY9XHFE2tuLh9Yns!mR~XlRV8=F!p7V~o~qliE2sIdPWU-rnATq2bTZ&yPm~ z@aWzjA0A*}V61jRkhqV~(9m_5-IlV?dY#|S&d&1a9e^mvgqN0vR1FDHjhF1cmyy&Kd zMj#&_2s)l(jJJ+U3XMktpP!$Yax9#joM>falT8brUn3wOAo%p}qQjxUz`)D9oR?D* z%h~6zudmJ8^mk1FT3A=rx}f;;^0R?bfPa6bYBHX-=NwF`mu(|Rd8@&gaw1Z$x{YG8 zm0Vnc%u!KMgec!eSM;YO0%GO{{H;W&CT@l^W@~?{{8&f*w}oY-%EGL=jP|<=jKd!$lKf6WMN>E zObV!`rpwC8A^8LV00000EC2ui0J#Fq000R8009UbNU)&6g9sBUT*$DY!-o(fN}Ncs zqQ#3CGiuz(v7^V2AVZ2ANwTELlPFWFT*GB3Xyc7I=BVS2JI08?i~a5Qz;Ypu*pX)uD&Sm;F24Ap zk5EP_<&;!bX=Rm80vV)&LvAM`d?$t}rd9Qcho62f%9ue08?^bsn+?P%=bUubY3H4I z<~iq^AGEo_nhwNR!2${@;N@c^YLudxN}~BB1~aa?rk|8nYU!nzW~ynXl4dZYpo4O0 zXpxB4HRh?PI+d1+5#x6-Kx>?RdWu1RLmK*} zsTq~IqLLD%>A<9X&PwaG*k-Hkw%m5>Ew{wJ`KPg=CR?O~sivzgQL7?%X0$M}*+8uj zSYU$*1j07(=Z}PTnZSF^t|}h1X|lP2thL%& zuLU57Eb_=Cmu&LMD4%?52@Uu8aJkA(jPANL*PN5Z?=Ar8#wOH@Z@(k35JCtV6m9g; zNGGlI(o8p<^w2Df&@T!$ENnubfkvz>q7}1>aRt+IY^%Nb?rZSbXs3-f!c;HZvZpYg z%dE|G*ZtA}UPrrg10`7hpl{G2$j|`|AQXPV;fN=$_~MK=?)c-07Y+gq9mo(u)E=N< zK?x3LEkVqWb-f~*d-v=&zd;Lqv<$4b?)vMn$1eNqw6lKn!d20CSq-+`|Y3xf-avCa zuqlsu6M&xds>cNv#6ScoNWlw6NWv1D@PsH#p$bhP2t&xpPI~f_pbVubN7+dcyfB6lIDz>t zK!XF`P>U5Pl+5N9##-7EA!BqE1~TvgNoJ530SKlrhe^z08uOUQOr|oINlaoOGK(L` zz_A_xJX(s;UB}yH5GN1|K6ulc&QO6k$4Sm|n)96KOs6{6c}{11)0?q)Wdo!Mzee8j zp7<2VBcql7JQG;J10m=DGY3l0f*LfLhxC92Ot1k5Fi>Vabk`4g=}!-^KmZucs75!+ z(T;lbqaY2bNI%K~g_sS8B@v)UN^=SRM*SAcG5No?70HQ3-Dg<+>vkg=<1T^3PFn3DUvNDqx z9H2o6Ou9(;sgxqCBBKSrN`t7{^{#mRs9M>&MWV`2tAM2&SCc16nqJ@p+c2wQ7fZ}- zoWQ3e$YMj?idBb50S^O7%S(A#f|=Gdub>TWR3VFk5=1kW%JO1hSF5glg6#tkKmiLn zzyU7*z=E;3RV*yHz=001AgCYc>s3SdkPAq`517>~1CqKtfYMg9(2ed#d%M=EQdYIB z&F+|78&e1X6a+1Z!EJL(UY)`s1}y+Vb?1rN$`<#ycyQ@*yXwygXaEEhkZx1^FoiyR zbP7|@FGeW<0u4-Hp>3sR0S$ zhZ09&4pB%kidC%Q6{k4G2k^ycT;+gX+Q6_UuyT%#_;xX7LI176$N*>WKN z0(KopkOlAsffQM!L%wrIk1XH_^!B$*uD}kT9OXh2=aF4)Gi_aP1TAy<(a4;^5nS-+ z(zdnC5J7Wtrz`=O!q%c;RevE7uI6(i z60zeN3<9*gr9nv{aM}?Q+R(_RPXX|wvtFVAtQ3er6&wxeY7cV;Rfquv)LPmP9LrG0 zUdUxL%W0T47uqfuH533ag+u^g-9;Y4yXE}{|I+&lf1q`phd}RNAGr|#_`?_E9pJpW zVB6~*DyEao@XX+CzBTr42*4`>Cs5nk)}DbAM3CO<2G_0Oeh7EZO#=#~JE{Wzp#%Wr z&1)hr0svpY=#WYAawz;d&oA$>0NfqqBM;dJjSxU1T#eU*?^USn4SBC0_EALscL@MthxWkY|ie0p@KNK%R$OkRl)X z?E^`~uMLjyuCv$JW@ftJyW;c(IH0*2IBW{2Zgq@fy~7vKfZx9!cH@-0y8tcwr~wRf zIultE03ZcMb3SvKe;xon05E|4%jZ7CI^U82tjKN4klHilzJCIA2yf~GbFNQhC50AL+82&*Sr zN(N0|=U#BtE-Eq_%CR0?*o9s=Dj_m4BZ7i5m`^l_fBFY}IY?eR7=QyvO~i!I1$RF0G-BJo^=5k1q09+jnX)c)L4zyc#YVYjoKKE z8AV#ArEsb^KND0x(lRY>!YAmMj_SCM?AVU(*d~AiF~1{*xu}cy#EZTNj2b44Z|DmL z@M0)tVlOt3CFWu!_HfELR}*$$)%XMs`H&D9krFwP6j_lLd65%YjRgi`4TV}@SC7Vl zH_L`GJ0mt8^D!xtk}7F3y3#U#vPD``O@hc1@>i2Ki5E2gd6PQ1lfjV^_*jYhSYG@{ zjMQX|o`{TU)@&8U0x|%RZt#>)8I@8wl~h@kR(X|JnU!t;kup$H3*~L~WQ9j%ACQzh zA7DE8Vm4~CmTc)SnL{-Ub5bxFKOh+x;9(hfnU{Kb7?9x-wXv6g8JLdImz}X}GyYkeQmfnVi{~p81)e8JeQWnN>MerR6X`;$$;v z5Mz{($+J8^^E^evIvr4(wt1VlnVY(~o4i?@t)l^#BQ%K%s)+;eyJ!oXm+E zd^t14lOmsy9IjEF)_I-Q2^-H@m#b))hKHEF2$YNeiCc|HfC3?h*ED0DR%5;t0-k^a zxe%Z6X$SOKpZ0m5_?e&jxu5*mpZO`D@reVT@JxZGAa8|?`($`t67$Fk!g(iBUC<-EBD2Ao7n&LR3TDXN1avd~U zqc(b@$wDNh;T|peAl|uqXsDRuxme{1hb~GGafK!|)-#?}Ni7foAM^rm6i0L91y*{c zSem6;x}{v&rCy4qbL2;W^a3vw0WH8vKNVD0<4^|rS7Ql^5w<+OkO_NGr*?X$c$%kr zx~F{Fr+fMeuiye5`jsF$OFJQ*_mLkI1-4eg)^!jjQXgY z+NlE)sf~CjMsg%S3ZD5mq`^phJUEO$D30VfE!z}0Aix1n>H;A20wiz*N8ki;lm))} ztH2tp!aA(PTCB$EM^2!tBp^s4-~wjK0U%&QSu{^kyl4mCue z?H8hU(JqPFDACd%k8&mK+OF>UuAqV-q1qtaxr*kBsY~J?>k28e*suQjuTY{T5z{5O zSg(;;sx=s%LW-(oRiqzjuUe=}G1WKDqXCsfJ(+Z?y1KC(+p!+|u^=0=A{(;I3PW5_ zKCCoV3dK3}L`~s{lnFp(5oQ8s!~;P8(EQukZpZ8^bXjbCSRkyuv%Yy>hz4A}-_-lfdJq5e0FkDxPagR&D#a z0x=lNC9!AeUH0XmOmImN-~zV)DgrDtzT{iJ2G(`NIksR|0FS$7 zF*RW_V6#6_x%3MH%%Hg>h;&2+v@#L8Bx#Ofb1NWoFZt5I4*b9n9KjMi!4w?93bQbA zDZ8{AlaFY&BA2_QVYTtHG4nDu_JS|^vM(yU!YtgvF8snU9K$V~FjeC=CZNI6q(d%y zyNZIgiK({HTTs(`5pb(BoHe%=JF8EMw$AA@WNh>cgbc8Z zG~0aK`V%zp3hE#bl2mB4Fk~u%&-q?{96L-xdm(=a2zjZi9e{LI<(oF;2h54JkGvpK*3qa zn?syjw7k@dOW0gNVbe3sGXc*NIQ-K;l9SK+ywCjH&;I<+{Mr9XD z=fesM#H`Fru6%{BIMTn<&B(3!L$8TH6EM`#b3_zCJxLVSVm;PmUDjrO)@V)EU(EpycF*8Sfmo{)7TstpVISJ=enp9R$9#UE8*O z+qj+Ey1m=AE!(N2N^IS}Z~c{7yftn+mJ-!z+9XL8``XoWw;rTPrZnBuUES7w-PoPo z+CAMdK*clv#J=u}MJ)Rx2CC4_!qBUH*9R5RFuPpqX=54mPT|B(^j+Wfec$HfPTwT1 zeWjWeF=ax?dosWQVa&|0;LHVa0nBiw0UTT&NijXGBH6U0eq)(w)V*uuK_P^zQQYAk z?!miB?BOU;cO(n8VyIhdgC~r<2t_MJl^9zj^luI z1k3tDGPJ(YT2j!|vi8Kt=ncK$#vag#dV-=X$>9eBS4N{^x)m=z{*|liiU6 zeB1~B3yPk$ln2o0j{fM79_f-k>6BjSmVW7!?v*E%Qep{LO}?;C-epnFs#EUiF{?{w z`APsn(%#J+clG_Jv=d#b5r#`l99f(v|stcwIG5>xXyqKtTii&=BOX z3iBWXUH5TD`uJ}Oaj1`niJ$z+FZ&Etg=asALCBsrCId`x0+)aN*na{{@KaR(==fm& zo#PJbpnptlTaYIPkm!G6F7{$E2Dyb*VNOK}Uoe3g)pl_QTK5lKQ^;iA4-fzZ4kTER zV1Wb*7C2~NVMGTChzw4oSkdA|i~vf#$_M}-ja4jcn8;8;f`SAE26SZEaR5RE4;FqX zfntOVCMOW=2?@DPFq2QCN1 zjwM^x>{+yF)vjfmmJ0_OAv{3%Q1WETl~gCbWFV6vgb5lhL`bn>MgYW#6)$Go*zse? zktHvlu_8r;3mPUsXz=s_gQU!PIGmsCe}Xgt@Tc!-&(hZzm{CNxK|57%>t*p8WanYh=v* zfMJ2uyxgZ-jhT8YYu8+i?&sg%f6=#?LxC;_po34of#}03gNC{Sp@kUQl5j!_D`YE% z7C?~8f(Gn55JA5DY5*|72s3Ol6jM}jMaL?;EVIozg9^0xIvTAs1+&`90~WsG0=e02 z!)>-HYM7!o07$9f3m+O0pvWm2sX@0yzW5@MMPh?eO5Kc%t&u9fphPxFti%$?*xsUn z1@=6YZo29iatNX{5VVse41i$fpH=$w^UprLKqnI!Cg9LB8tJnGBCk{31qn71Q9G$byZf=65)gk3blYF4DJd|z7VY=aj?P; zWARsDgH_B$%rxT+(OWx`0uO;09kDAKAVo7aA!`HRH`{I-0)RgTu?-4=iu~h?Z2>s) z+i-n*lG`u-xK;ok02rd(A%VO!Q_kE>wxu|)gGeGp1HRKA5JVygxK#rC$Uy?u9EC;I>Z z3IPOKWDo(eMDt#`^5yhRz51P#0v;5$Te|@W4uPo+Ose^AiWnA|R8vn#fnvlH7b*o< zWi>%&TWjPl*N{sfIX@Cs)_n7{NC*(-5@a4)a=bkjaaWyvR(*BKEGsrfWJzbqXlSLK zw%Q<_eiz9ao)(~yas}G@x2Aua2n1 zS>I1yzy&6B0A`Pa9|0?3z`&VqCN+6f4Dd&x(wG2zfmlQS#v%~0jAvy>h(Yt56Fa?Z zVh5WbNCHQ+z!N!8kimi=>_)d8M(wCaU{RWF#$_ekm=FMon1Un((g)uOgc4JTng@#~ z08-pWg_0l}6eKZ)MR03cYGM;zY8btQSZ8k3+hHvS(gqF`ia_t_9^k;Zm+Dl`CYbw= zKxhGqT?pif{h{Jc(pN>Fcy2jM*&Z*wND)2%^3fm(+>uuxR0TAu5f6;Og9!rRMzQQq zEO1m=6)=P^ryPXq2ehOz-1Gdu@ojk zT|k0j4&aHj0Du&YL4_p_V-`D!qB8-ZJ}L+#inAyx0;1RrZ-9adJTb;FKyeK!9Q8jW zaKUl_C_0W|gr4@?WV z8AyMo_GhjOngsv0D1_Y1pd>4t(v+qfv>ubEehQVIl@UxY5@0xgHngMdV|KU8f$sXpnDzw#C=hUiJ`)uH!$3fK@!QNo z10cQt80t0FA;qN9!Wd4)Z-4X)Qkjim2RpE_jd7gg9UG#@KMr!84eThis&zuOnD9U@ zpw~+Ppb%nVmK0)r0SniHe;o$EhXo=9U+9&c?5u@~V?FB$NtUuNhRPU>U=lSzQA4$GM-+Sh1b3Y09l6Jb6Nvn4TS&z zT$A16%6f(xMp#1Ao&I#FN8Rb7kOeBnAzRb(YTMoB_P3EGZgLkb${$%yty4uH%QF*CsM{XKp2+szhnHp=}j?Q0_(WD2)w!j)0_kL-HZt@AjyHj3h{1^rELaDoES%5Tu$yzOb-ZV%_sK$a;VKi$d(P zp>v>nc%4AseecEpqKpuSxI)Ty@h&B>^dux-`O9a1^OtWASu6wV+TI!0yRKwIeujTh z;QkzJD?2VCCUOx=rE zy3rdzs4G3vO1L}AGiLfO#~ZX+003T~f*atesk*Og0EA?kJPCY2%Ii1|90m-mH2%1> zufhN|0KG17J{43!=rcWTLbaD$D-+0u{UN$p^8*twfxnVDM(~4Q^Q#S0qe5T=5#u?Z z13H0NgG-2l10c8CqY&atI;cpL>98yc{i z4}uaObb|o@o6rE+fB`w2LprQOJG?_Y%tJlgLq42C+0cNc;EZ?+tK_P;p;o_xj##$ z`VztYkR~nSuM-ppTjWAqU)LxD=eqKPe;(2>{5IIHDv{ob;JAo|uIj0Lh*Z$z>vn8|VfEm<0;_k1NWeEs~i@K!$OwNt-N3 zYB)W=SdB6|BMMQ5{b@b207}3bi~X@iKVUsHQYV{pD+-|_I|?bNcmyLL1FO7BtjtQS zw90Z+g91Ru(;`E4^e1+#87G4+DT|4P5E(Zd0Z)hqxWoauoJ+c_OS`;Fyv$3z+)KX1 z0l16?PYA@v@eG2XL!gsy%2zXHGrZnR0s3`d+iz`-LQoG>3~I-m9$2wISo z_EC!Wc?4wGO4BsWu4K9SsUM{ANpyNm5i6_;@gGb9p!R@@b1(wk+)du>P2V&EODMH~{ilEBVEKscM z%DfO9hbf%H*-XXhhOE*m&}BUO&RbB;8`V0o%uxs0(aGV9k0~g0gH9gNfax^S>WqL0-~uI$0a=|@ zTCG)Ey;WSzRb8!B7vKU{jZZM80U6K$HnD&bXaM>%5C*uvHRaF5Y*PSzQ^&-JL#@^p zO;qfK&XbqSEjZ=jw*K@72)36UWL@53ER-P4# z0BH^aF%ZMFhO2A5&0XEyUEb|o-~CT#a61nHjR!ViF$$IcXK4*4SYh@BVHz6YuPos( znqM5HVb-x>vGbTxO^s8HPJ~@mAhym|jn!Q}WJFHnT%WEClzVODxW zOo)KqE7p!I)?$M4<5A(@Fn(O-h~zU((}3ZN^s^7k2@DW$W+vs*jt$l^Ez>iVfHbA!fw1CD z=8jIbB_DN8nh0AB80DVT3>&ad0kT}KRm+eW5ypjO&z)RBTxTkNM?1#a2C9QPKn#8s zmVYKBUIsU9P7nnVXH+Fy>P*t?+|KSqPl%3ai8fFF^<+=?girYt*7{W5{A|_;cG+&` zWNBqYnFZ(ATIKb7U7Ijxo)yew{aaf$VeFMhK$hpuE!HTmfbqQ(T-N8sa0Nmj1Yi*e z#2{)Fxq>T545J1XJ)WJD_6xSO2|k$Wsa652zG|$_YOUUCuI_5D{_3x$>Zx{V!i3>V zwl}&7X>T6sh-@yaI1TYpje`B+4!D5YJpovafn?rJ66kBc{%gPvY{4FE!Y*vU&QdPr zg7{>D3lQ0*Fj)t%=X*xWQblMR;1L=4-|FOoC3R@;lrYc^ZP6ZW(k^Y&K5fyif{NZ! z#ijtfl>s(MXXT9wv-XsHHr>V0gn?j%Uoqz4TDTH50L-C+wb*xCKxLAK6^MPl(DZ;e%A+?CJbePWYsV3m#OTmDLO z6IceZ91oyt?{3(K|>cqf>9Uz2M_=FD+>JHb006+tQK!@c_^S zTnK7chy=s{aY8@?#vtwrg6nr~OE_F^Bj++e91sz%+{rGpmOV4-7HKvkX~T8vw~h(< zCRo_5??5JIy9Qvi4RbLcb22Y;Ge2|xG#_)~y?`+7fMI0;1-Ah+Jy|qG3A~8#9)0Qs z@Z$!6PVQD!8d%t~wcWZcbVEOML{D@@Uvx%KblbgKkbPtpAX!OH*2*PeJlEGw#cjnH z1pr6|fpGBv5C}{l1Wo{eq$YJ!NA*z$fTDKw0PyruXLSG=g;f`7LLi7bFlt%%bWYH5 zgXrgB8E7V(4^<9krKN!*U-m4MziYPC@{OA(pYABn2+M&q=MM+b1-Ef?DmAltH~ z0fPqtgim;dUwDRZc!z&@h*x<3gBR0xANajp@Hx+b0?GF|R+OIRbi{}Rfrtc50019v zb$~ANChnGI?T& zWoeeNTjl3uT(o0$sYjExbB;2eH#m9n39fc)XKMik=eO2&3|K#cEddDFZWQo#u^oXC zkX^Tbd$^B#xu1KwuY0&>`@Nla6ew8;u=fw3KYXX{1h{jBVa{cJfOs6(K0o`*_I9=h z_koXm$)9}6uYAkDe9X6eIKTJ>w}8HH06JgZWhH!`21}pbaRA_iEAVum-+5PeeU>Nc zD=7NJaD`JJh*wu?SD$_V58rj69&y@73?QF~8^Hs)!`>n93Uxbj;+T5mcsEUXVXT+- zkA`xtuWqj|X|RXye)rn3&wvg1fCexDvp;(aumKy`d-Y#`_HTdpe}DLofA>d!3-J8D zHv!P!0F8GKYz7Dg3=$+LP+-6S016i}Z0PWzLWBkrFktZD!Ga1HGHm$Jz(ffM7A)AX zfdYkxlqy%UZ0YhP%$O}tmK+J8goy?pHe|q1VZp_U1rH{KXw>L{0u~oIXaHe?h6@o= zte6qtDppJmBLz@+H4*?$T>*RzJNBwqTmW2Q4S)u~j!$Rjo>j{>04un2uK>8xHo%M( zDI#3ZFabgX2S6GB96W0Df)qb^C}PC0!Gr~FMp#I^KtaLh+8s*_ zPEo-F2^lds;MmcliS!^#uy61FJ^c9c=hJ_$KIey>JRSI4AmM>P1R3PpcE5E;5d+|f zr%`$5eY9Rk5J)&7g%w(OA%+=hSYdnV>9kV@{QdNwKm!d}RDlj9wNz72MKx7be|@45 zR{>~+%UE^PF$w^w41(E;|Qpa0ljfD#O-bZR1tU>jYrS+w9!gCEw$BJdo8TZ z^4A|w019=Yq@1pZQHxMXMU_=;xdOl_SgqTxLYyc>h$dsnt7N@i&4tFj0N@gdR&eRN zu0nO_%kM&W>C2a2ZFNbQVTe7-Sh&nVCYf*#RN%mzD6r502N4)50H1yWDnKKNe1TeL zf(kJIMGaF(@`VqLbe8hUsl6O?BQ^9Pz|3DHvdGAuMZiG^ETGV+0~G)mX@QgycPRy# z5_>h)o>FI>s90}jtaslfE8YUDVsJLvX{)_9+iko3Hr!}e@Kf3U0XvX@L{*G6*aRVa z5!q&=-74XQ8-6(Ai7URi;%U!awtp9unD?-JD@CqT=E9inU!9``fF^aw^?B%{d)}6g zH3m?J>R3ghqvtx-dwS;&e<|@|jX8HQ9!Uu&K?NCn0D%WA(7*u~BeMoY4b4LV=oA3_ z@x>p2y385?UkoArAkj}>y=%)WG=&cU3_*RLMGL?M2Q;wY0R$gpP=N%Z?!BDUmL8Y? zoY(ztsx_#tlO6v#2W(+WRk8plfxtnofew6N10f;72~rS(7QEmC7ic%hDIi!w(Hj97 zVnDy8>LTG;AO=&Y!WFXcf*Leo2Zi#%%2|#@nR^ksXxBM?wS|W|{2>s7NITm_EKC%8 zjuh|^5lR6s15WWk2xve77bx!`uGyZ=`TzhZkj#1~`x7OwC;%;Tkxx^Y!XOl~h(QQ| zXzFtT1!xcg_%&dD^@G}W@>iVwSuKQqTn+%aHo!j`XoLho5CS`>$VD=;k&c9fFd`|* zNJ7Gqmb@e;ON6()>Fs{~Gu5dMSdm1Uu#~1eB`Q;?%2l$ml#3kYCJoX_|BZ|PI4(L@ zjD(1!&h1i&zWgN+i3p~N>F#Sx4Biu?IK?Us;fzz*o@*Y`#qga>P||c+Xa1xRD7dj` zaFin*?P$NK31@2i;{ilgu!82WUjdJv&{hTN$BYHVoYA%PsJSj?3 zdOBg^PE5trj_(xE#AHg5iiRp#HUU+=ML2T`)BLFb5&-~7?6jvq6-^?x_XqU};G1(q zj5zVA9X(PFoexoh5}Kn2CFsFxSe56e1UagE77&!7oG4n;npS!U)EsXAeQPDapw_w4 zHLYfaC|U1X*S+$!uYRTLT?tvsa^WzSDm^S>eaTWIzVtaUohk8@Y12aCQ~-Z+4Joq6 zQ%RK3i;0k#Li&)|FKo86gAxD~Br%0WNRO#b4JZA^na6VK4>`(tNIaRd)vjXgtC|XA zJ;zGc0^PN^#yzg71loh;GB>XDKrVEn8`9wtSGv}{E_SnPR_ZR%hPT{YV#6!ml?n!8 z!^|CCkMh{y4X=2|OWsYhXEN6eLZ}NdZ5OL2z0}l~A^7dg^Az%jZjOw7?t`EFVk^~2 z(RPoRf`}e?8{re=AQM1XNCxzfiFT}ks|xW)CNhzOcLpND3W;$4AR02^3iB4L6t?g} zR-6gmLIk)16fSpj>=1YyqY`iUF_0^93>_1>$VS%jU~h;^&W*Rp;aw~-(~A^JX^dkf z@EFKM#?;qzZwf!#Q)?Q5#?N&5%c>ExPq%!uq%F-+PLu6a8%(v^I>fhFy|WV534m89 zK?s=;f`>Dqgjeuc2;~8Eg!}A(hG6v)fA%n*v8v}rKbpo4v2oXqTx2--xEXKobTcXe z2ThZ@)TZ84lD}(GC$svnP)2Wxd?zP5*$GcuE*ds(y=6oxicyZ@O=Fuw)&0?#(OCrm zR^Qp-t_DI0m&gDBcH8VVC?p3;xbO<_tY?P!Hrtm#wi1;8?O|{$#M?%}v^`JlM>w#X z)6IA{yhYt^bAJ*W~8@Yd-t2z!LhBs_J z^YlN2I@Iz0y&_lB?%zKE24G$F-yfkKc%4ov001V`NF+2&9i##w>_C>R&K1-FE)YU0 z_!}W8$rTt$1%AR6aK!^g-~>{g)qMg462b&V9SF7#R@9y^9DtjgNtw8b4U$Qlkcm>r z)W%$f1wauE0G|+&9XR2}1~g6mP>hs4MDlh2T%CQ~u`M3T^_lby05eHBMBjkImV+r&f_bM(jn>plOTGHBkJ2<6inyvh}3Cp z)|E<3g$GGOfGui32V4LLoInJ)Kn#dL3cLUbJSc=lsDw@^g;uDAUTB5BKnjRJ47fl9 zoB#zdK?i8S`#^vR$j`;uk4`oOPZr&84W%1eV?Ifzsw@k6v`Vw&sE+O^k2cE(9Ks>= zsE`gRj}ngD)Qxv?<%%}{$5$!{*=WSs;3$z!DV0{KmGa7w`Ui=qCAhRDNg*BW93&=O zfh%Bw>m}e0;N?ZKCql9dD8e3^s;OYk>AED zM9PvbL~FWeiqNKvp2}^8$9PC7tmH=nHJXYoDSFqQRuLaV(sg|q1uWlNDm6CEfT5>&;ST5ETT5- z3FNKb?k(T;t>6AF;0CV7ekunr0msrn2aM|bpa5bx3aYB+sy z7A;7KL`j_ggiM64=#H-F(u56Iz)e(bPmIX6p2#O#F7O8L?y7|8qApIT-Rf#9)^=;GeXEik;J!ugFSTOiE(Ag#2!P5i!P47^?p{Wehew2j1)#(PjKB!601JeG1WzypSFi7%3(`c)Jn6NQ< zSH6w^r}Qqdo(h~t`lm?BRKjsY1JFrIj6e)0toV{|`F61ve=!(`u^5jr8H;iJ(g5O; z=m^yB{pRn*xs*Zp@8mim05iws4&t!{?AvZH3N&y8YXJD7G2MzUAs4bCA2K2*vLY{X zAq#Ti&MynBF$&m#i3;&gcnh}%Z5}U(3RiK#cJCht@*p!ZDVMS-Gcp=KatM&B2T(Hp z9w7;5a(FuLTPiUV-|`Ep?GyX2L0Cj(baDy&pdS+`8pm%LA2Tv1Gcp^l_@?p4ri7{T z#BL;^s+#N^yJj5&k^ooZaQ$n7V8q)7b00@=AR8(Zn6LY$vpTP{`xfruChjUv00=k# z3M{9li5T(M{3$pC^8z0%G1qPRCTa@|G(i`%K_4_iC$vH@G(uBA`Cb4Bq%o<^bN*g3 zi&mN z;Im_#Y&JK?9TV`M0#BfdGZxRSp*HNIHfjtkHB&dWQ$ICSN3~Q>byGKLr*k!jzcQ){@N48}5?WZDY;X<^isxeo?@|KqWEIGX$ zvGueaZ?n<$a=->EW}tuptTt=6wrjsOY{#~2&o*t>wrqp&iK3>r42b3Ipm+@R4-$ZI z4>xfaw{aggawoTPFE?{1xBWH>Y9=9X&oUB&sbF(7VMFoXXvFL;FiI!vQ4h4kVk~)= zw|QeMR$sP6mue-?Pihu%6J-F8 z3KOg?HaCMexPw19bDJh-LrQ@c&|h2kb>nh&`ze);brl=zVk_*Srgc&~DqNp9ipRBF zM?htB?1^&`b_kUJYK-TkhY?IFv`ZlqUg+B6i)kVVJ6J!r$s%eK55gWQg0gjkVknxYxtgcB zhH|KfoU{pN;Z+>xS}%7t$^moKrG8~8U*v4TG)AC!8jQzojXx~i`_tGBwVzdEeH zx~Z3XX)aA2rRY7=cx};fo?qIY<8gu@_y;Up6cM_yAG>VJ(FEKi5(-47Yc~%H51nX+ zq*uGOC%0`Nd4frIUoVG7ceLR)qjZM;O@ZzEWB9lJ*zdnWAM)P20ME>=ABr*Ue$Uglu_?jsV`eS-RpuXw@1OR~p2^K6kpa6ph3mi0nFhRqG z2q{*~2yhW&MvWUecJ%lWWJrxOR-}kAP~kz}nD^quF=7UGY}vDEn>nmNLWK+t9n;{zg+OrO!-*F+ejIsn z<;#(C;Xq^b$_y1Gs2-pzPAgr72_o#-@L|M>6-Aaee;$2Dk|t5A-1{;nU7I)s9{$eQ z#t0b~PE=L;1wa5L8N?`o{8P%n0~K8AgbQRC!G_XWddV-DxGU?dhSXxqE$%%05X6D( z!b`7~RFexDRnCCM!VquEZ8r#d`^~c&YusWB%y6`k|HsOlgAN7hs8h|1)`U0vDLu61gCV2!hKn#dLuJ8ba_u$m;xJ&9&Oxtj)WHz=KF4 ziY!VG&ph?aXuXqCT4_R;O+ibPn_F5yxm@-ByL1;lsF^>zv7F&oAE?pvY06+(G zum%Dz{gDMUKalp*3(XRB zEmBWC8fg*lQq@Gi;L1Z4Rd77Rl&Y=18tbdiz;z&SdBxI&9*YsEgj4r^FB5gK`!ByfWExI+q3LzBX2uWDN5&F$*LMdDeL{PcmOalN~2u?2mkPHI2 zYh5?&MY@VWfFS6AaX9oL5M4MN5nyfto1+fh?8Y}IIuV5lk&{E{G@d)94vPwF*q`1b zC>I3|epUio?GjM~CtA@iL8C;@;W5U2)gJRSi0AOIh%F^)d?SR?9qsp#d4dP2)k zTClf0LxQM#s{$WQ@_-}tJra^z{{Vygb`?Jg%+E$=06+o005_$3>4N;HUQku zAZc4xDo2?BEu3Njr|i)N?`j$7(*aG9ti>-qP$Ee4A2QxB;XZ%QLJ43da&e|4=o^L0d}T0o1Sp7P?SXt6mkWS+%MWCXvFSurQniNXFud z002bLYE+d%fm)X6MssSX_KWTM+# z2UeFyw4A7#CSe78AOXDL74LY-3tl5Uf|&2y%`w3m&a!Hu7u@ItTGh&p0nmdU^=X_s zdhsq87NHsgn4B{8|5{FINfis?(CUI0%vHdBr?3aRVqz%_lErp$wfY<`#Vm%g+CA?m z2|Ak(%(%ur2!s?R?(9JEn21G8;f|%<*>idZfuB({!*XfusCW=tAB)AK-vg;Z*0ByS znBxa;Q1X(Q++-&&c?-u_DREtDqaO$)gFooRQG;PX02rVcr_A{pu1QggAwRlXFJ~+&qg?hS67%!Wxlnp>gXW>(i$&C&||JdP;_wMss&pFK^?Xj zfDQACL?!a2yWcJErptR?!Wztq6&CeJF6=rB;Xw)-MvP(@ca?1Xl9r9g*6Ib z5oa78LRmbr|27W92M~Q!rZy!ZPgRt))^n}Ve%x%Okw}q4rpYmoEC*{}8{65|wzZ=? zWnNX;MnF}wAb`4srJiC7n*4J8)&Z*q3iZouK67>JH*N^P!+}k$B_Lz+2qaj+2xSoX zzzJS(gO`EN$PDXUWgyPyzcs29SAez!g(>CZq5i*TekUf_j z7t+~L4{~kALhT}0q;{ecB@l?XCv%470-zZ1rmmUe zU1kTW{{jN*c%^eagWBoE=N6VQ!Yw2=+_VtRa0@SMHXrW8Uf>r1+;I5f!9@9mUk)pp zORWObK@WdpA>aoWy}>^n&%>^Ka!x5*4@6S6r_@!lvX!n- zC@g{`+H0fk?5QtuEXQz%IkvzC=RY6%(U(3Oye+%2|Ee4~qA6vzuzj|5-))sqh5kB0 z$^|w{qE8JP9V|hI!iW9a&Nm_a3DYSf&ORVFM{eQ{sjzm@fD%O4&w5ql&ND z|Bg@E#9|%TAp5A#RAOgFxFGy;&~1c8Adu=;cqT|TFOUX+4%`oR4A1(qh5Qc3 zWP<&S&_hbkuqI3ZMNRb>fc0c<3SUpXT1`JLAOy#d457k7Mu1a*<||Gx*#?QnSg-|W zE86Db5X#{YPUSWdrPUrIGIY=ndE^H!NDx$kSwN%MIwdtKiVYtN32%@IA8}rQkl!q% z2ptPBPAlEP|14w? z>4FMVZWBkX6HhJGR80Xca07T_1T+8@({T(n01a271QT%?<3biGU_bj~ zB0nOc1&9$K1F{8B0z$STP@3-j#*rcLBMeVK8Xs~wkPbp5#3h2JRJKtQyRpK)@gjF| zA#~#dg2G~s0tQObBu^40Q&J^Yk|kTxC127ckD_O^;>MUR9%C^Dq0SyT3Lm3RAAN!p zC!kjXk|>2yqLRq>Y!Vh{jvP(E2EGa+qw+YA$Oe*98JAKUF%bYyPa_eFBfp3z6cPhs z1O-MQ7CZqh(NYC)fGyk7E#DF@<5Di?k}m5qE>$2c(J~g=FD&GY3PX#`@9(u~HjfuPIB>H>6TChvPZUWEFpJ4Jq>y|IhTSuq)^3 zDH$;ID=C-hm$yk^952s1Y*Di zBH#ol-~u{81ERwOeg*@e$~r`oCI+)Gc~TBPiUoBdA#h_X8=x`5&@s>RSI&?$`qC9+ z0z2aZJQad9$?`ESU^DOYIirI;8|yva0wV+PH0dcdUC$$PV?0YhC}5KYE`SLrfHot5 z3tZqfaZ>~;)Iu*5Lo-xEHD16Y@lY#EGe8q-K)Y}k z#d0@HKt_ZzHW!o$IG_bupf)2wOvjW=%hXKI6iw4qP0#cMzLWz>lm?(P1STLzOh7VI z12BbD9&>UQV^n(%v)RBCF&Ls8UsDEn6j3)r2K18^E3!gdbSwlFHwaZE9|K7>Q#3Tk zAQ#{oA(bZnlPjY%b*8in!}0=0kvwg{14aNgJAej2fC;+PLBI3_YSmV66<2drS9g_H zd$m@-)Ir~r2|yrDqjLm2AVL~|75y?aK?Fwq^iOA$>JZZ-|9v6@@IxpQRa-A(PL~uk z5fUt|G*uzuQl&B_k~IVT5?rV7Nvlv)1(X1}$kcSvR2M)ouC)ZRlvOoA240mxWz|6g zR$vE~U<=k@4;EnwR#-29SY^Oi=@bG=BLhyOBJ**Y5L%-Z+Pw2StMo<-wJf)l zWG90!S#d}#7HRY`WU;g?%QY(7(I8n=Wp$A>-Su6wh*UKUQEv2FUDg98fCWOJU;VX9 zIRI&sR%w@(X`9w*pB8GHwnT}Q24o-vSYQG?piY0L72z>31ruW*LIya1FgNy8+CWp1 zXz8XkP~C}0FYsqA00l~xWKn=7)3svV$x|cMZ6~!g{}I#!U=|`ZM`F98J->D?K-DyJ zR*T~Go*GLRd-h&k69s~HXp0sE7&K}(mvcLpbElRDs`hHLc55e=MO6cF4I^wPU~GHL zY>@_SWk4m?7Woj-vifDagf6Lw)6_F;oWVks6+*A+f>1p_!N zBFgr4L!=FuAaiW2I{RX8@$hy(augXuZiSX;|6TQ83pjyW*o6^zVdKERs9udefLX?*oco9iIZ4~mzar_m;#WNVT+Z9saIJc_%Cy~BkeaM z@pobLw=(M$1AJIj_tjNl6<}%ASJPOH*Em;!^@(GZSfP^z;8#VL6^He7g2i(K8l$B! zIDkGZ1_pra}`fTC8}nad(9C7_3|l{_IpZi99NSaoPa0H6a}pa+_u3)-L$ z8lelC1?G5^wblZFnQMjF6%zo9b@(t4!=4pmkxc+W8=0RM8lW{mq(_>hOWLGQ8l_WO zrA->37rLQQzy_%IlquFaDY{9GS&IQQnfJtt0fS{L;6M{p1A6yC$5(jK7papvebskF zq1QxFl#0`pW-B^zrO23ASDn|HF52Khln8R+u$9AdQh_=H7CD;p)dFmwkt^2&+S;w( z8m{A7uIHMr>sqc+0H$L)V(s(;|29CXhnbjf8ha7hR5N-k%aNn?S*`KfttY^-9~-hG zTe2scvMbxNA=|C-TCE?t1nktWF+ieIS+H$(inelbcRD?K8a`LEHC?tPz_^baF4~|VOYkpKcca?d zop>U??KO<0yQ~+Px~m(>lU&J{oXMNq$)EhmKcKJudSVegwEuF!+xw7wyh_JWzB8c6 zr5wt~oXpGI%&S|vV(LY>mpyUi8g ziv2>B8~nWy`O&@Ho+o|CKV8;moz`m|%tf8jg_%0H8>`Ee^8E((Q} z5d|pC5gqy5*&l@+|AX)yEpmThj}(=F2M{3*upte2APv$05fCBU!TsCGo!iNs2fW?e z%bncGUEHx@+`k>(zg^qcJ=?`y+_T-@wY}WOUEBG++lAmW1Kl3mo3Mf0)E_{5U)^3S zz~LVr;v-(-C!XRf-r_Ib;U#_772ebt;44tw;5o|Re_X5;UII>D<1t?4SDxirUgJ+5 zs@(kJQ(e^^ytJWI*z?5B1!6u7rE6?dqeapbpPlIaLltK>NcUD!?RgY~qAYnAd|CK~ zr=IEu7HNl7bf*{TcO1@RYvf7Z=)kc|M#Bn`+o29KJGof*BQL#Z62O*Hs^<(bts(C0ifsW!wX>q4ELkxD}O4~ zQ(~>R>yy2ngFcom7m{T_20DQBOW*WQAN5mT^;e(uS6}o)8Eb!e>+`hmRnzY28OXz4 z?BkyId*AneANYe`_=jKa!=9p1o#t!bFutDTbAR`VANr$T`k`O61u~3aLkSQ zXAyAF0ShRYXi-Kgiq~RmuPv}Z1u@F#K&hslifXE=uF7hwt|G}?1)yTo1MLZ+Q(mrassHAfZ5`R@BsuKus{O`TohUZ{{W0a zwg_aB`0zy{jR?TuAe2zTZin$UlE@bwQt}apebD=by@Ny=85bPTz=8)5e2~FK8c91{ zc}6k7x?z){}k&kLiN9c zWcCpyQ>+Uqq*GAM^<&}sux=xLsQnn*Zo{qc+;p$B(^Aeq?|f4|HBNo?)?bhPcrg2^ z?c^pX`zbnAcbk|=>dKEQ=kS_s6|kSfCi+*ECFz#{_#G;3#5_CMc2uOpj9S45boy z#uTaarCjZ*R}D%n_*`*8)ZE5RvAK;9ji^Kw$qPoMpixdW6=L!GQ#z}P*Stc;pDSG8 zX}0>+zzTM-&peP-qGKrvs^CE!ikWv3l*SRFCIPi!7;5 z4J52-Pm5ZY&9!J*K|wmT(b!LFgRge+D{26M%1T!2up4OY2sGf?;1W**BS3*&vYO1) zDtEce6&C!il9$yoD;5Xb>i=6g9EA>}{`m zVQLr*U`s(02mxcO>qTOOU;-sV*kqr>-JpckHHR@8ePh9g1Si-TDrm5S9}M9LOL)Q* zuCRqA>7oPQZm2q~HZdsDcx+u!0=x zc*i{Mv5$WYoxBid{F)LZ(pKm#;zF$GQ# z0WP>81|kqa3eJq?G^=^dY;Log-<;+$$G`<#h`t82(-Ry4nuulN*7U22WG>|s6 zRSjYQYx^XuX$^{N)PNFL00p$(vJ5&v19M+s;S6uM!ygXuh)aCp5eGrSqrK;8qrd_l zHj07V6-S3X~yz71MbNBiL9ukp>R7A>T2Q1wlCiFyOt2VcB zI|>Ny0ftC^@|3T<8%FZ&t!<2MgSSIo z^R%zM?Kj`~*hl0zeqN5OM!%8LFAwpbicyVb!}!}6eK^c-zVn@rn-cJzA|C%ewzIu& z)N6nH)$2FjtP-0V(WW-9FOK=okN)(lfBo!l|L2jD93vqKR2c!e@S(Jlmwcb~GZH_J z$ZrAxD1ZYc=*>TB;y*zH!7t$b&uTgFgs_Ja~f- z2rHs8cFsY1(2;!?$b?N8EX<>S5koPcA}Sq7DzActS*V4qVuePiB(!3GO1LZ5VK?A5 zF%}~#X=sIO$cAm`hHnUmaR`TL=!IV>GA-zWFX)7O$cHEcg;5wW6H_rCLx_cFh=fQn z7*T&97km_$E7oBY8kjc{BQc3+iI<3pnW%}I$cdeZiIljAc-V-J*oUQPioODgF(HF{ z1B$KaimwQZu_%kP*ouSWnRB+Hgi8oRkQj+~vx5vZzkr648 T6G@R3X^|I+kr`=$0RaFz4Q(3T literal 0 HcmV?d00001 diff --git a/user_guide/_images/smile.gif b/user_guide/_images/smile.gif new file mode 100755 index 0000000000000000000000000000000000000000..bf0922504edcbda115512c88240d215c18241f15 GIT binary patch literal 1156 zcmd6m{WIGK0LH)d(hIj2M{HToZP$o2Z%6CK8Rn&4+Gy7*uB(gF3N^3Sp_62*i6N`z zw9%>}#@O82&aGH?Go4E7ZS-WQqgp~}5b{m(%~$h%O)UP4JUG^gR9fPm7G?Q|O?#7#mB6k?`K+?a)% zvk*fTYPg7k*@z(mxKy2V?GMzBVd8ea*2e$B+L#L5l|5cmDu2~ zY;dW4M?#oIxLHJ)B?u_8S*{S!75h#(34e>3%Lup}ha8cjCPykTa}@#0P?OC5rk31M z;Fg=@PP5(GYSo>@HWJazL|mVQZJfdMNpExxCS&>(Y%2xXNVXZz5{7e#{w%hYif^Y` zRt4Dhc>)yLp*$SShjhi5u^iURtcDsJe2awZNy}~2c#GWm$+FdI)gHHM`RM8iRCfYh zJBesNLv^RtXOm5wqbq!5i4QK7 z8kZ}K%W}i(KI3E{{5*7NFxWT~2CBp0x#)$_0=?#*UUT2PH35zXZjT2VCxW2K5Y6bt zh2g@@mo4k_ExNxM>jSLqr#$@=?s6Xo90{1~bKj|;J zd>4BH)(3*8J3bt|{ZXTYIo$T~q>`rj^{`UR7-|e?6#F$vn2jQ4llV}h?Sd{zuJ4TgZ-+FGxkH=!lSaadr?aY*3+us z{!4y6=jp#^G6u4Fs$BoU9RHpS?gIfMmF<3|5>wU+_ z?DoB_0ski*#9a0Pz!bpSE4B9tfU*m;yZNwKijIT^s`i6_6dCk@{C@Iy$%wjL=Ip$r z?d|-&ffwHO@NUw^>6oaT%ZuF=L$cZfoOr3~g3L1}C^+k9dXRj-+}kgrB{YbuRwYEF zi#gdmfa4XI8zk5-on_>R)rPBeoTfmaH&i?&y|&N;bXwDTtNg~^I-_<97mR4Xt3Kzv zdVg!keR>~_omhXfIxoh>%{$!H0|30+PS>aPg+$Y1Wp3}b#hn6^=qkVsj=SD^ zwDLevo@-%}r|(d3O~ygE`W>IhuPsr4Jo?^Nt#YA^!Y_VEN%^g!%P=it zKB1Jzxm7PL&*(Poj0d-lCZzCG9?#_gk1jY}tEBxg!)M+&+)H6LNt2$H)83wS=RTOV Nxce^#Q9XdL{{R50L}~y4 literal 0 HcmV?d00001 diff --git a/user_guide/_static/ajax-loader.gif b/user_guide/_static/ajax-loader.gif new file mode 100755 index 0000000000000000000000000000000000000000..61faf8cab23993bd3e1560bff0668bd628642330 GIT binary patch literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nno%(3)e{?)x>&1u}A`t?OF7Z|1gRivOgXi&7IyQd1Pl zGfOfQ60;I3a`F>X^fL3(@);C=vM_KlFfb_o=k{|A33hf2a5d61U}gjg=>Rd%XaNQW zW@Cw{|b%Y*pl8F?4B9 zlo4Fz*0kZGJabY|>}Okf0}CCg{u4`zEPY^pV?j2@h+|igy0+Kz6p;@SpM4s6)XEMg z#3Y4GX>Hjlml5ftdH$4x0JGdn8~MX(U~_^d!Hi)=HU{V%g+mi8#UGbE-*ao8f#h+S z2a0-5+vc7MU$e-NhmBjLIC1v|)9+Im8x1yacJ7{^tLX(ZhYi^rpmXm0`@ku9b53aN zEXH@Y3JaztblgpxbJt{AtE1ad1Ca>{v$rwwvK(>{m~Gf_=-Ro7Fk{#;i~+{{>QtvI yb2P8Zac~?~=sRA>$6{!(^3;ZP0TPFR(G_-UDU(8Jl0?(IXu$~#4A!880|o%~Al1tN literal 0 HcmV?d00001 diff --git a/user_guide/_static/basic.css b/user_guide/_static/basic.css new file mode 100755 index 0000000..6df76b0 --- /dev/null +++ b/user_guide/_static/basic.css @@ -0,0 +1,639 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width: 170px; +} + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/user_guide/_static/ci-icon.ico b/user_guide/_static/ci-icon.ico new file mode 100755 index 0000000000000000000000000000000000000000..7ecfce214cbdbedc15d8348babeff5cd7e720488 GIT binary patch literal 5430 zcmeHL&npB`9Dn5Kuy>cuLGmAPauLohTgugsgTofC9NbV!aa0tgTofgxl%f=?Y?Sh& zWMxI9hibZ5LZ@~9&$;7J-7ai$2=7ByD3A3P1*hfQz|8$LL= zUz~w$;90HjJ=)Ss!V^NuI2Za%(z#lli~7u{+nbyOi;~<-#pGX{K<~tb_C6Lj^YSY9 zuHBEb(bRJ+>$(mjNuamQtlmY!MgdXJjDiJ*`fSvC!*oskp+}sjm(MWyz%r29BW!f*m(x|(w?cOiYFaD0y8pq z9eCfscMhGYa>i@!YdSYJ(-6XZ(W@wc#d9lm1l3S%FF!rC_waiB@V}AM)ez?!Gp$os wgQ-p&yk8A*^lZ5Jw#)Gj@LI_qy{H^P{^jt7C;ag)RHAYMwkN>;6;PJx7hHm1jsO4v literal 0 HcmV?d00001 diff --git a/user_guide/_static/comment-bright.png b/user_guide/_static/comment-bright.png new file mode 100755 index 0000000000000000000000000000000000000000..15e27edb12ac25701ac0ac21b97b52bb4e45415e GIT binary patch literal 756 zcmVgfIX78 z$8Pzv({A~p%??+>KickCb#0FM1rYN=mBmQ&Nwp<#JXUhU;{|)}%&s>suq6lXw*~s{ zvHx}3C%<;wE5CH!BR{p5@ml9ws}y)=QN-kL2?#`S5d*6j zk`h<}j1>tD$b?4D^N9w}-k)bxXxFg>+#kme^xx#qg6FI-%iv2U{0h(Y)cs%5a|m%Pn_K3X_bDJ>EH#(Fb73Z zfUt2Q3B>N+ot3qb*DqbTZpFIn4a!#_R-}{?-~Hs=xSS6p&$sZ-k1zDdtqU`Y@`#qL z&zv-~)Q#JCU(dI)Hf;$CEnK=6CK50}q7~wdbI->?E07bJ0R;!GSQTs5Am`#;*WHjvHRvY?&$Lm-vq1a_BzocI^ULXV!lbMd%|^B#fY;XX)n<&R^L z=84u1e_3ziq;Hz-*k5~zwY3*oDKt0;bM@M@@89;@m*4RFgvvM_4;5LB!@OB@^WbVT zjl{t;a8_>od-~P4 m{5|DvB&z#xT;*OnJqG}gk~_7HcNkCr0000W zanA~u9RIXo;n7c96&U)YLgs-FGlx~*_c{Jgvesu1E5(8YEf&5wF=YFPcRe@1=MJmi zag(L*xc2r0(slpcN!vC5CUju;vHJkHc*&70_n2OZsK%O~A=!+YIw z7zLLl7~Z+~RgWOQ=MI6$#0pvpu$Q43 zP@36QAmu6!_9NPM?o<1_!+stoVRRZbW9#SPe!n;#A_6m8f}|xN1;H{`0RoXQ2LM47 zt(g;iZ6|pCb@h2xk&(}S3=EVBUO0e90m2Lp5CB<(SPIaB;n4))3JB87Or#XPOPcum z?<^(g+m9}VNn4Y&B`g8h{t_$+RB1%HKRY6fjtd-<7&EsU;vs0GM(Lmbhi%Gwcfs0FTF}T zL{_M6Go&E0Eg8FuB*(Yn+Z*RVTBE@10eIOb3El^MhO`GabDll(V0&FlJi2k^;q8af zkENdk2}x2)_KVp`5OAwXZM;dG0?M-S)xE1IKDi6BY@5%Or?#aZ9$gcX)dPZ&wA1a< z$rFXHPn|TBf`e?>Are8sKtKrKcjF$i^lp!zkL?C|y^vlHr1HXeVJd;1I~g&Ob-q)& z(fn7s-KI}G{wnKzg_U5G(V%bX6uk zIa+<@>rdmZYd!9Y=C0cuchrbIjuRB_Wq{-RXlic?flu1*_ux}x%(HDH&nT`k^xCeC ziHi1!ChH*sQ6|UqJpTTzX$aw8e(UfcS^f;6yBWd+(1-70zU(rtxtqR%j z-lsH|CKQJXqD{+F7V0OTv8@{~(wp(`oIP^ZykMWgR>&|RsklFMCnOo&Bd{le} zV5F6424Qzl;o2G%oVvmHgRDP9!=rK8fy^!yV8y*4p=??uIRrrr0?>O!(z*g5AvL2!4z0{sq%vhG*Po}`a<6%kTK5TNhtC8}rXNu&h^QH4A&Sk~Autm*s~45(H7+0bi^MraaRVzr05hQ3iK?j` zR#U@^i0WhkIHTg29u~|ypU?sXCQEQgXfObPW;+0YAF;|5XyaMAEM0sQ@4-xCZe=0e z7r$ofiAxn@O5#RodD8rh5D@nKQ;?lcf@tg4o+Wp44aMl~c47azN_(im0N)7OqdPBC zGw;353_o$DqGRDhuhU$Eaj!@m000000NkvXXu0mjfjZ7Z_ literal 0 HcmV?d00001 diff --git a/user_guide/_static/css/badge_only.css b/user_guide/_static/css/badge_only.css new file mode 100755 index 0000000..7e17fb1 --- /dev/null +++ b/user_guide/_static/css/badge_only.css @@ -0,0 +1,2 @@ +.fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}} +/*# sourceMappingURL=badge_only.css.map */ diff --git a/user_guide/_static/css/citheme.css b/user_guide/_static/css/citheme.css new file mode 100755 index 0000000..a2a3b3e --- /dev/null +++ b/user_guide/_static/css/citheme.css @@ -0,0 +1,88 @@ +@import 'theme.css'; + +.highlighted { + padding: 0px !important; + font-weight: inherit !important; + background-color: #f1d40f !important; +} + +#nav { + background-color: #494949; + margin: 0; + padding: 0; + display: none; +} + +#nav2 { + background: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAMgAzAwERAAIRAQMRAf/EAFkAAQADAQAAAAAAAAAAAAAAAAABBQcIAQEAAAAAAAAAAAAAAAAAAAAAEAABAgYDAAAAAAAAAAAAAAAAAVERAtMEFJRVBxgRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AMRAAAAAAAA7a87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wN/wJGAYEjAMCRgGBIwDAkYBgSMAwJGAsoIwCCMAgjAIIwCCMAgjAIIwEgAAAAAAAAAAAAAAAAAAAAAAAH//2Q==) repeat-x scroll left top transparent; + margin: 0; + padding: 0 310px 0 0; + text-align: right; + display: none; +} + +#nav_inner { + background-color: transparent; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + font-size: 11px; + margin: 0; + padding: 8px 12px 0 20px; +} + +div#pulldown-menu { + -moz-column-count: 5; + -moz-column-gap: 20px; + -webkit-column-count: 5; + -webkit-column-gap: 20px; + column-count: 5; + column-gap: 20px; + -webkit-column-rule: 1px groove #b8b8b8; + -moz-column-rule: 1px groove #b8b8b8; + column-rule: 1px groove #b8b8b8; +} + +#pulldown-menu > ul { + padding-top: 10px; + padding-bottom: 10px; + -webkit-column-break-inside: avoid; /*Chrome, Safari*/ + display: table; /*Firefox*/ + break-inside: avoid; /*IE 10+ theoretically*/ +} + +#pulldown-menu ul li.toctree-l2 { + font-size: 0.82em; + margin-left: 20px; + list-style-image: url(data:image/gif;base64,R0lGODlhCwAJALMJAO7u7uTk5PLy8unp6fb29t7e3vj4+Li4uIWFheTk5AAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAALAAkAAAQoMJ1JqTQ4Z3SI98jHCWSJkByArCyiHkMsIzEX3DeCc0Xv+4hEa5iIAAA7); +} + +#pulldown-menu ul li.toctree-l1 a { + color: #ffffff; + text-decoration: none; + font-size: 12px; + font-family: "Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif; + font-weight: 700; +} + +#pulldown-menu ul li.toctree-l2 a { + text-decoration: none; + font-size: 11px; + line-height: 1.4em; + font-weight: 300; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + color: #aaaaaa; +} + +/*hide pulldown menu on mobile devices*/ +@media (max-width: 768px) { /*tablet size defined by theme*/ + #closeMe { + display: none; + } + + #pulldown { + display: none; + } + + #openToc { + display: none; + } +} \ No newline at end of file diff --git a/user_guide/_static/css/theme.css b/user_guide/_static/css/theme.css new file mode 100755 index 0000000..64d4114 --- /dev/null +++ b/user_guide/_static/css/theme.css @@ -0,0 +1,5 @@ +*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:hover,a:active{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:0}dfn{font-style:italic}ins{background:#ff9;color:#000;text-decoration:none}mark{background:#ff0;color:#000;font-style:italic;font-weight:bold}pre,code,.rst-content tt,kbd,samp{font-family:monospace,serif;_font-family:"courier new",monospace;font-size:1em}pre{white-space:pre}q{quotes:none}q:before,q:after{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}ul,ol,dl{margin:0;padding:0;list-style:none;list-style-image:none}li{list-style:none}dd{margin:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle;max-width:100%}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:0;margin:0;padding:0}label{cursor:pointer}legend{border:0;*margin-left:-7px;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*width:13px;*height:13px}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;resize:vertical}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.chromeframe{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr;*line-height:0}.ir br{display:none}.hidden{display:none !important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.relative{position:relative}big,small{font-size:100%}@media print{html,body,section{background:none !important}*{box-shadow:none !important;text-shadow:none !important;filter:none !important;-ms-filter:none !important}a,a:visited{text-decoration:underline}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:1.5cm 0.5cm 2.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.fa:before,.rst-content .admonition-title:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content dl dt .headerlink:before,.icon:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-alert,.rst-content .note,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .warning,.rst-content .seealso,.rst-content .admonition-todo,.btn,input[type="text"],input[type="password"],input[type="email"],input[type="url"],input[type="date"],input[type="month"],input[type="time"],input[type="datetime"],input[type="datetime-local"],input[type="week"],input[type="number"],input[type="search"],input[type="tel"],input[type="color"],select,textarea,.wy-menu-vertical li.on a,.wy-menu-vertical li.current>a,.wy-side-nav-search>a,.wy-side-nav-search .wy-dropdown>a,.wy-nav-top a{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}/*! + * Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url("../fonts/fontawesome-webfont.eot?v=4.1.0");src:url("../fonts/fontawesome-webfont.eot?#iefix&v=4.1.0") format("embedded-opentype"),url("../fonts/fontawesome-webfont.woff?v=4.1.0") format("woff"),url("../fonts/fontawesome-webfont.ttf?v=4.1.0") format("truetype"),url("../fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular") format("svg");font-weight:normal;font-style:normal}.fa,.rst-content .admonition-title,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink,.icon{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333em;line-height:0.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14286em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14286em;width:2.14286em;top:0.14286em;text-align:center}.fa-li.fa-lg{left:-1.85714em}.fa-border{padding:.2em .25em .15em;border:solid 0.08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left,.rst-content .pull-left.admonition-title,.rst-content h1 .pull-left.headerlink,.rst-content h2 .pull-left.headerlink,.rst-content h3 .pull-left.headerlink,.rst-content h4 .pull-left.headerlink,.rst-content h5 .pull-left.headerlink,.rst-content h6 .pull-left.headerlink,.rst-content dl dt .pull-left.headerlink,.pull-left.icon{margin-right:.3em}.fa.pull-right,.rst-content .pull-right.admonition-title,.rst-content h1 .pull-right.headerlink,.rst-content h2 .pull-right.headerlink,.rst-content h3 .pull-right.headerlink,.rst-content h4 .pull-right.headerlink,.rst-content h5 .pull-right.headerlink,.rst-content h6 .pull-right.headerlink,.rst-content dl dt .pull-right.headerlink,.pull-right.icon{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0);-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:""}.fa-music:before{content:""}.fa-search:before,.icon-search:before{content:""}.fa-envelope-o:before{content:""}.fa-heart:before{content:""}.fa-star:before{content:""}.fa-star-o:before{content:""}.fa-user:before{content:""}.fa-film:before{content:""}.fa-th-large:before{content:""}.fa-th:before{content:""}.fa-th-list:before{content:""}.fa-check:before{content:""}.fa-times:before{content:""}.fa-search-plus:before{content:""}.fa-search-minus:before{content:""}.fa-power-off:before{content:""}.fa-signal:before{content:""}.fa-gear:before,.fa-cog:before{content:""}.fa-trash-o:before{content:""}.fa-home:before,.icon-home:before{content:""}.fa-file-o:before{content:""}.fa-clock-o:before{content:""}.fa-road:before{content:""}.fa-download:before{content:""}.fa-arrow-circle-o-down:before{content:""}.fa-arrow-circle-o-up:before{content:""}.fa-inbox:before{content:""}.fa-play-circle-o:before{content:""}.fa-rotate-right:before,.fa-repeat:before{content:""}.fa-refresh:before{content:""}.fa-list-alt:before{content:""}.fa-lock:before{content:""}.fa-flag:before{content:""}.fa-headphones:before{content:""}.fa-volume-off:before{content:""}.fa-volume-down:before{content:""}.fa-volume-up:before{content:""}.fa-qrcode:before{content:""}.fa-barcode:before{content:""}.fa-tag:before{content:""}.fa-tags:before{content:""}.fa-book:before,.icon-book:before{content:""}.fa-bookmark:before{content:""}.fa-print:before{content:""}.fa-camera:before{content:""}.fa-font:before{content:""}.fa-bold:before{content:""}.fa-italic:before{content:""}.fa-text-height:before{content:""}.fa-text-width:before{content:""}.fa-align-left:before{content:""}.fa-align-center:before{content:""}.fa-align-right:before{content:""}.fa-align-justify:before{content:""}.fa-list:before{content:""}.fa-dedent:before,.fa-outdent:before{content:""}.fa-indent:before{content:""}.fa-video-camera:before{content:""}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:""}.fa-pencil:before{content:""}.fa-map-marker:before{content:""}.fa-adjust:before{content:""}.fa-tint:before{content:""}.fa-edit:before,.fa-pencil-square-o:before{content:""}.fa-share-square-o:before{content:""}.fa-check-square-o:before{content:""}.fa-arrows:before{content:""}.fa-step-backward:before{content:""}.fa-fast-backward:before{content:""}.fa-backward:before{content:""}.fa-play:before{content:""}.fa-pause:before{content:""}.fa-stop:before{content:""}.fa-forward:before{content:""}.fa-fast-forward:before{content:""}.fa-step-forward:before{content:""}.fa-eject:before{content:""}.fa-chevron-left:before{content:""}.fa-chevron-right:before{content:""}.fa-plus-circle:before{content:""}.fa-minus-circle:before{content:""}.fa-times-circle:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before{content:""}.fa-check-circle:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before{content:""}.fa-question-circle:before{content:""}.fa-info-circle:before{content:""}.fa-crosshairs:before{content:""}.fa-times-circle-o:before{content:""}.fa-check-circle-o:before{content:""}.fa-ban:before{content:""}.fa-arrow-left:before{content:""}.fa-arrow-right:before{content:""}.fa-arrow-up:before{content:""}.fa-arrow-down:before{content:""}.fa-mail-forward:before,.fa-share:before{content:""}.fa-expand:before{content:""}.fa-compress:before{content:""}.fa-plus:before{content:""}.fa-minus:before{content:""}.fa-asterisk:before{content:""}.fa-exclamation-circle:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.rst-content .admonition-title:before{content:""}.fa-gift:before{content:""}.fa-leaf:before{content:""}.fa-fire:before,.icon-fire:before{content:""}.fa-eye:before{content:""}.fa-eye-slash:before{content:""}.fa-warning:before,.fa-exclamation-triangle:before{content:""}.fa-plane:before{content:""}.fa-calendar:before{content:""}.fa-random:before{content:""}.fa-comment:before{content:""}.fa-magnet:before{content:""}.fa-chevron-up:before{content:""}.fa-chevron-down:before{content:""}.fa-retweet:before{content:""}.fa-shopping-cart:before{content:""}.fa-folder:before{content:""}.fa-folder-open:before{content:""}.fa-arrows-v:before{content:""}.fa-arrows-h:before{content:""}.fa-bar-chart-o:before{content:""}.fa-twitter-square:before{content:""}.fa-facebook-square:before{content:""}.fa-camera-retro:before{content:""}.fa-key:before{content:""}.fa-gears:before,.fa-cogs:before{content:""}.fa-comments:before{content:""}.fa-thumbs-o-up:before{content:""}.fa-thumbs-o-down:before{content:""}.fa-star-half:before{content:""}.fa-heart-o:before{content:""}.fa-sign-out:before{content:""}.fa-linkedin-square:before{content:""}.fa-thumb-tack:before{content:""}.fa-external-link:before{content:""}.fa-sign-in:before{content:""}.fa-trophy:before{content:""}.fa-github-square:before{content:""}.fa-upload:before{content:""}.fa-lemon-o:before{content:""}.fa-phone:before{content:""}.fa-square-o:before{content:""}.fa-bookmark-o:before{content:""}.fa-phone-square:before{content:""}.fa-twitter:before{content:""}.fa-facebook:before{content:""}.fa-github:before,.icon-github:before{content:""}.fa-unlock:before{content:""}.fa-credit-card:before{content:""}.fa-rss:before{content:""}.fa-hdd-o:before{content:""}.fa-bullhorn:before{content:""}.fa-bell:before{content:""}.fa-certificate:before{content:""}.fa-hand-o-right:before{content:""}.fa-hand-o-left:before{content:""}.fa-hand-o-up:before{content:""}.fa-hand-o-down:before{content:""}.fa-arrow-circle-left:before,.icon-circle-arrow-left:before{content:""}.fa-arrow-circle-right:before,.icon-circle-arrow-right:before{content:""}.fa-arrow-circle-up:before{content:""}.fa-arrow-circle-down:before{content:""}.fa-globe:before{content:""}.fa-wrench:before{content:""}.fa-tasks:before{content:""}.fa-filter:before{content:""}.fa-briefcase:before{content:""}.fa-arrows-alt:before{content:""}.fa-group:before,.fa-users:before{content:""}.fa-chain:before,.fa-link:before,.icon-link:before{content:""}.fa-cloud:before{content:""}.fa-flask:before{content:""}.fa-cut:before,.fa-scissors:before{content:""}.fa-copy:before,.fa-files-o:before{content:""}.fa-paperclip:before{content:""}.fa-save:before,.fa-floppy-o:before{content:""}.fa-square:before{content:""}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:""}.fa-list-ul:before{content:""}.fa-list-ol:before{content:""}.fa-strikethrough:before{content:""}.fa-underline:before{content:""}.fa-table:before{content:""}.fa-magic:before{content:""}.fa-truck:before{content:""}.fa-pinterest:before{content:""}.fa-pinterest-square:before{content:""}.fa-google-plus-square:before{content:""}.fa-google-plus:before{content:""}.fa-money:before{content:""}.fa-caret-down:before,.wy-dropdown .caret:before,.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.fa-caret-left:before{content:""}.fa-caret-right:before{content:""}.fa-columns:before{content:""}.fa-unsorted:before,.fa-sort:before{content:""}.fa-sort-down:before,.fa-sort-desc:before{content:""}.fa-sort-up:before,.fa-sort-asc:before{content:""}.fa-envelope:before{content:""}.fa-linkedin:before{content:""}.fa-rotate-left:before,.fa-undo:before{content:""}.fa-legal:before,.fa-gavel:before{content:""}.fa-dashboard:before,.fa-tachometer:before{content:""}.fa-comment-o:before{content:""}.fa-comments-o:before{content:""}.fa-flash:before,.fa-bolt:before{content:""}.fa-sitemap:before{content:""}.fa-umbrella:before{content:""}.fa-paste:before,.fa-clipboard:before{content:""}.fa-lightbulb-o:before{content:""}.fa-exchange:before{content:""}.fa-cloud-download:before{content:""}.fa-cloud-upload:before{content:""}.fa-user-md:before{content:""}.fa-stethoscope:before{content:""}.fa-suitcase:before{content:""}.fa-bell-o:before{content:""}.fa-coffee:before{content:""}.fa-cutlery:before{content:""}.fa-file-text-o:before{content:""}.fa-building-o:before{content:""}.fa-hospital-o:before{content:""}.fa-ambulance:before{content:""}.fa-medkit:before{content:""}.fa-fighter-jet:before{content:""}.fa-beer:before{content:""}.fa-h-square:before{content:""}.fa-plus-square:before{content:""}.fa-angle-double-left:before{content:""}.fa-angle-double-right:before{content:""}.fa-angle-double-up:before{content:""}.fa-angle-double-down:before{content:""}.fa-angle-left:before{content:""}.fa-angle-right:before{content:""}.fa-angle-up:before{content:""}.fa-angle-down:before{content:""}.fa-desktop:before{content:""}.fa-laptop:before{content:""}.fa-tablet:before{content:""}.fa-mobile-phone:before,.fa-mobile:before{content:""}.fa-circle-o:before{content:""}.fa-quote-left:before{content:""}.fa-quote-right:before{content:""}.fa-spinner:before{content:""}.fa-circle:before{content:""}.fa-mail-reply:before,.fa-reply:before{content:""}.fa-github-alt:before{content:""}.fa-folder-o:before{content:""}.fa-folder-open-o:before{content:""}.fa-smile-o:before{content:""}.fa-frown-o:before{content:""}.fa-meh-o:before{content:""}.fa-gamepad:before{content:""}.fa-keyboard-o:before{content:""}.fa-flag-o:before{content:""}.fa-flag-checkered:before{content:""}.fa-terminal:before{content:""}.fa-code:before{content:""}.fa-mail-reply-all:before,.fa-reply-all:before{content:""}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:""}.fa-location-arrow:before{content:""}.fa-crop:before{content:""}.fa-code-fork:before{content:""}.fa-unlink:before,.fa-chain-broken:before{content:""}.fa-question:before{content:""}.fa-info:before{content:""}.fa-exclamation:before{content:""}.fa-superscript:before{content:""}.fa-subscript:before{content:""}.fa-eraser:before{content:""}.fa-puzzle-piece:before{content:""}.fa-microphone:before{content:""}.fa-microphone-slash:before{content:""}.fa-shield:before{content:""}.fa-calendar-o:before{content:""}.fa-fire-extinguisher:before{content:""}.fa-rocket:before{content:""}.fa-maxcdn:before{content:""}.fa-chevron-circle-left:before{content:""}.fa-chevron-circle-right:before{content:""}.fa-chevron-circle-up:before{content:""}.fa-chevron-circle-down:before{content:""}.fa-html5:before{content:""}.fa-css3:before{content:""}.fa-anchor:before{content:""}.fa-unlock-alt:before{content:""}.fa-bullseye:before{content:""}.fa-ellipsis-h:before{content:""}.fa-ellipsis-v:before{content:""}.fa-rss-square:before{content:""}.fa-play-circle:before{content:""}.fa-ticket:before{content:""}.fa-minus-square:before{content:""}.fa-minus-square-o:before{content:""}.fa-level-up:before{content:""}.fa-level-down:before{content:""}.fa-check-square:before{content:""}.fa-pencil-square:before{content:""}.fa-external-link-square:before{content:""}.fa-share-square:before{content:""}.fa-compass:before{content:""}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:""}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:""}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:""}.fa-euro:before,.fa-eur:before{content:""}.fa-gbp:before{content:""}.fa-dollar:before,.fa-usd:before{content:""}.fa-rupee:before,.fa-inr:before{content:""}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:""}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:""}.fa-won:before,.fa-krw:before{content:""}.fa-bitcoin:before,.fa-btc:before{content:""}.fa-file:before{content:""}.fa-file-text:before{content:""}.fa-sort-alpha-asc:before{content:""}.fa-sort-alpha-desc:before{content:""}.fa-sort-amount-asc:before{content:""}.fa-sort-amount-desc:before{content:""}.fa-sort-numeric-asc:before{content:""}.fa-sort-numeric-desc:before{content:""}.fa-thumbs-up:before{content:""}.fa-thumbs-down:before{content:""}.fa-youtube-square:before{content:""}.fa-youtube:before{content:""}.fa-xing:before{content:""}.fa-xing-square:before{content:""}.fa-youtube-play:before{content:""}.fa-dropbox:before{content:""}.fa-stack-overflow:before{content:""}.fa-instagram:before{content:""}.fa-flickr:before{content:""}.fa-adn:before{content:""}.fa-bitbucket:before,.icon-bitbucket:before{content:""}.fa-bitbucket-square:before{content:""}.fa-tumblr:before{content:""}.fa-tumblr-square:before{content:""}.fa-long-arrow-down:before{content:""}.fa-long-arrow-up:before{content:""}.fa-long-arrow-left:before{content:""}.fa-long-arrow-right:before{content:""}.fa-apple:before{content:""}.fa-windows:before{content:""}.fa-android:before{content:""}.fa-linux:before{content:""}.fa-dribbble:before{content:""}.fa-skype:before{content:""}.fa-foursquare:before{content:""}.fa-trello:before{content:""}.fa-female:before{content:""}.fa-male:before{content:""}.fa-gittip:before{content:""}.fa-sun-o:before{content:""}.fa-moon-o:before{content:""}.fa-archive:before{content:""}.fa-bug:before{content:""}.fa-vk:before{content:""}.fa-weibo:before{content:""}.fa-renren:before{content:""}.fa-pagelines:before{content:""}.fa-stack-exchange:before{content:""}.fa-arrow-circle-o-right:before{content:""}.fa-arrow-circle-o-left:before{content:""}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:""}.fa-dot-circle-o:before{content:""}.fa-wheelchair:before{content:""}.fa-vimeo-square:before{content:""}.fa-turkish-lira:before,.fa-try:before{content:""}.fa-plus-square-o:before{content:""}.fa-space-shuttle:before{content:""}.fa-slack:before{content:""}.fa-envelope-square:before{content:""}.fa-wordpress:before{content:""}.fa-openid:before{content:""}.fa-institution:before,.fa-bank:before,.fa-university:before{content:""}.fa-mortar-board:before,.fa-graduation-cap:before{content:""}.fa-yahoo:before{content:""}.fa-google:before{content:""}.fa-reddit:before{content:""}.fa-reddit-square:before{content:""}.fa-stumbleupon-circle:before{content:""}.fa-stumbleupon:before{content:""}.fa-delicious:before{content:""}.fa-digg:before{content:""}.fa-pied-piper-square:before,.fa-pied-piper:before{content:""}.fa-pied-piper-alt:before{content:""}.fa-drupal:before{content:""}.fa-joomla:before{content:""}.fa-language:before{content:""}.fa-fax:before{content:""}.fa-building:before{content:""}.fa-child:before{content:""}.fa-paw:before{content:""}.fa-spoon:before{content:""}.fa-cube:before{content:""}.fa-cubes:before{content:""}.fa-behance:before{content:""}.fa-behance-square:before{content:""}.fa-steam:before{content:""}.fa-steam-square:before{content:""}.fa-recycle:before{content:""}.fa-automobile:before,.fa-car:before{content:""}.fa-cab:before,.fa-taxi:before{content:""}.fa-tree:before{content:""}.fa-spotify:before{content:""}.fa-deviantart:before{content:""}.fa-soundcloud:before{content:""}.fa-database:before{content:""}.fa-file-pdf-o:before{content:""}.fa-file-word-o:before{content:""}.fa-file-excel-o:before{content:""}.fa-file-powerpoint-o:before{content:""}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:""}.fa-file-zip-o:before,.fa-file-archive-o:before{content:""}.fa-file-sound-o:before,.fa-file-audio-o:before{content:""}.fa-file-movie-o:before,.fa-file-video-o:before{content:""}.fa-file-code-o:before{content:""}.fa-vine:before{content:""}.fa-codepen:before{content:""}.fa-jsfiddle:before{content:""}.fa-life-bouy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:""}.fa-circle-o-notch:before{content:""}.fa-ra:before,.fa-rebel:before{content:""}.fa-ge:before,.fa-empire:before{content:""}.fa-git-square:before{content:""}.fa-git:before{content:""}.fa-hacker-news:before{content:""}.fa-tencent-weibo:before{content:""}.fa-qq:before{content:""}.fa-wechat:before,.fa-weixin:before{content:""}.fa-send:before,.fa-paper-plane:before{content:""}.fa-send-o:before,.fa-paper-plane-o:before{content:""}.fa-history:before{content:""}.fa-circle-thin:before{content:""}.fa-header:before{content:""}.fa-paragraph:before{content:""}.fa-sliders:before{content:""}.fa-share-alt:before{content:""}.fa-share-alt-square:before{content:""}.fa-bomb:before{content:""}.fa,.rst-content .admonition-title,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink,.icon,.wy-dropdown .caret,.wy-inline-validate.wy-inline-validate-success .wy-input-context,.wy-inline-validate.wy-inline-validate-danger .wy-input-context,.wy-inline-validate.wy-inline-validate-warning .wy-input-context,.wy-inline-validate.wy-inline-validate-info .wy-input-context{font-family:inherit}.fa:before,.rst-content .admonition-title:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content dl dt .headerlink:before,.icon:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before{font-family:"FontAwesome";display:inline-block;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa,a .rst-content .admonition-title,.rst-content a .admonition-title,a .rst-content h1 .headerlink,.rst-content h1 a .headerlink,a .rst-content h2 .headerlink,.rst-content h2 a .headerlink,a .rst-content h3 .headerlink,.rst-content h3 a .headerlink,a .rst-content h4 .headerlink,.rst-content h4 a .headerlink,a .rst-content h5 .headerlink,.rst-content h5 a .headerlink,a .rst-content h6 .headerlink,.rst-content h6 a .headerlink,a .rst-content dl dt .headerlink,.rst-content dl dt a .headerlink,a .icon{display:inline-block;text-decoration:inherit}.btn .fa,.btn .rst-content .admonition-title,.rst-content .btn .admonition-title,.btn .rst-content h1 .headerlink,.rst-content h1 .btn .headerlink,.btn .rst-content h2 .headerlink,.rst-content h2 .btn .headerlink,.btn .rst-content h3 .headerlink,.rst-content h3 .btn .headerlink,.btn .rst-content h4 .headerlink,.rst-content h4 .btn .headerlink,.btn .rst-content h5 .headerlink,.rst-content h5 .btn .headerlink,.btn .rst-content h6 .headerlink,.rst-content h6 .btn .headerlink,.btn .rst-content dl dt .headerlink,.rst-content dl dt .btn .headerlink,.btn .icon,.nav .fa,.nav .rst-content .admonition-title,.rst-content .nav .admonition-title,.nav .rst-content h1 .headerlink,.rst-content h1 .nav .headerlink,.nav .rst-content h2 .headerlink,.rst-content h2 .nav .headerlink,.nav .rst-content h3 .headerlink,.rst-content h3 .nav .headerlink,.nav .rst-content h4 .headerlink,.rst-content h4 .nav .headerlink,.nav .rst-content h5 .headerlink,.rst-content h5 .nav .headerlink,.nav .rst-content h6 .headerlink,.rst-content h6 .nav .headerlink,.nav .rst-content dl dt .headerlink,.rst-content dl dt .nav .headerlink,.nav .icon{display:inline}.btn .fa.fa-large,.btn .rst-content .fa-large.admonition-title,.rst-content .btn .fa-large.admonition-title,.btn .rst-content h1 .fa-large.headerlink,.rst-content h1 .btn .fa-large.headerlink,.btn .rst-content h2 .fa-large.headerlink,.rst-content h2 .btn .fa-large.headerlink,.btn .rst-content h3 .fa-large.headerlink,.rst-content h3 .btn .fa-large.headerlink,.btn .rst-content h4 .fa-large.headerlink,.rst-content h4 .btn .fa-large.headerlink,.btn .rst-content h5 .fa-large.headerlink,.rst-content h5 .btn .fa-large.headerlink,.btn .rst-content h6 .fa-large.headerlink,.rst-content h6 .btn .fa-large.headerlink,.btn .rst-content dl dt .fa-large.headerlink,.rst-content dl dt .btn .fa-large.headerlink,.btn .fa-large.icon,.nav .fa.fa-large,.nav .rst-content .fa-large.admonition-title,.rst-content .nav .fa-large.admonition-title,.nav .rst-content h1 .fa-large.headerlink,.rst-content h1 .nav .fa-large.headerlink,.nav .rst-content h2 .fa-large.headerlink,.rst-content h2 .nav .fa-large.headerlink,.nav .rst-content h3 .fa-large.headerlink,.rst-content h3 .nav .fa-large.headerlink,.nav .rst-content h4 .fa-large.headerlink,.rst-content h4 .nav .fa-large.headerlink,.nav .rst-content h5 .fa-large.headerlink,.rst-content h5 .nav .fa-large.headerlink,.nav .rst-content h6 .fa-large.headerlink,.rst-content h6 .nav .fa-large.headerlink,.nav .rst-content dl dt .fa-large.headerlink,.rst-content dl dt .nav .fa-large.headerlink,.nav .fa-large.icon{line-height:0.9em}.btn .fa.fa-spin,.btn .rst-content .fa-spin.admonition-title,.rst-content .btn .fa-spin.admonition-title,.btn .rst-content h1 .fa-spin.headerlink,.rst-content h1 .btn .fa-spin.headerlink,.btn .rst-content h2 .fa-spin.headerlink,.rst-content h2 .btn .fa-spin.headerlink,.btn .rst-content h3 .fa-spin.headerlink,.rst-content h3 .btn .fa-spin.headerlink,.btn .rst-content h4 .fa-spin.headerlink,.rst-content h4 .btn .fa-spin.headerlink,.btn .rst-content h5 .fa-spin.headerlink,.rst-content h5 .btn .fa-spin.headerlink,.btn .rst-content h6 .fa-spin.headerlink,.rst-content h6 .btn .fa-spin.headerlink,.btn .rst-content dl dt .fa-spin.headerlink,.rst-content dl dt .btn .fa-spin.headerlink,.btn .fa-spin.icon,.nav .fa.fa-spin,.nav .rst-content .fa-spin.admonition-title,.rst-content .nav .fa-spin.admonition-title,.nav .rst-content h1 .fa-spin.headerlink,.rst-content h1 .nav .fa-spin.headerlink,.nav .rst-content h2 .fa-spin.headerlink,.rst-content h2 .nav .fa-spin.headerlink,.nav .rst-content h3 .fa-spin.headerlink,.rst-content h3 .nav .fa-spin.headerlink,.nav .rst-content h4 .fa-spin.headerlink,.rst-content h4 .nav .fa-spin.headerlink,.nav .rst-content h5 .fa-spin.headerlink,.rst-content h5 .nav .fa-spin.headerlink,.nav .rst-content h6 .fa-spin.headerlink,.rst-content h6 .nav .fa-spin.headerlink,.nav .rst-content dl dt .fa-spin.headerlink,.rst-content dl dt .nav .fa-spin.headerlink,.nav .fa-spin.icon{display:inline-block}.btn.fa:before,.rst-content .btn.admonition-title:before,.rst-content h1 .btn.headerlink:before,.rst-content h2 .btn.headerlink:before,.rst-content h3 .btn.headerlink:before,.rst-content h4 .btn.headerlink:before,.rst-content h5 .btn.headerlink:before,.rst-content h6 .btn.headerlink:before,.rst-content dl dt .btn.headerlink:before,.btn.icon:before{opacity:0.5;-webkit-transition:opacity 0.05s ease-in;-moz-transition:opacity 0.05s ease-in;transition:opacity 0.05s ease-in}.btn.fa:hover:before,.rst-content .btn.admonition-title:hover:before,.rst-content h1 .btn.headerlink:hover:before,.rst-content h2 .btn.headerlink:hover:before,.rst-content h3 .btn.headerlink:hover:before,.rst-content h4 .btn.headerlink:hover:before,.rst-content h5 .btn.headerlink:hover:before,.rst-content h6 .btn.headerlink:hover:before,.rst-content dl dt .btn.headerlink:hover:before,.btn.icon:hover:before{opacity:1}.btn-mini .fa:before,.btn-mini .rst-content .admonition-title:before,.rst-content .btn-mini .admonition-title:before,.btn-mini .rst-content h1 .headerlink:before,.rst-content h1 .btn-mini .headerlink:before,.btn-mini .rst-content h2 .headerlink:before,.rst-content h2 .btn-mini .headerlink:before,.btn-mini .rst-content h3 .headerlink:before,.rst-content h3 .btn-mini .headerlink:before,.btn-mini .rst-content h4 .headerlink:before,.rst-content h4 .btn-mini .headerlink:before,.btn-mini .rst-content h5 .headerlink:before,.rst-content h5 .btn-mini .headerlink:before,.btn-mini .rst-content h6 .headerlink:before,.rst-content h6 .btn-mini .headerlink:before,.btn-mini .rst-content dl dt .headerlink:before,.rst-content dl dt .btn-mini .headerlink:before,.btn-mini .icon:before{font-size:14px;vertical-align:-15%}.wy-alert,.rst-content .note,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .warning,.rst-content .seealso,.rst-content .admonition-todo{padding:12px;line-height:24px;margin-bottom:24px;background:#dedede}.wy-alert-title,.rst-content .admonition-title{color:#fff;font-weight:bold;display:block;color:#fff;background:#8ba8af;margin:-12px;padding:6px 12px;margin-bottom:12px}.wy-alert.wy-alert-danger,.rst-content .wy-alert-danger.note,.rst-content .wy-alert-danger.attention,.rst-content .wy-alert-danger.caution,.rst-content .danger,.rst-content .error,.rst-content .wy-alert-danger.hint,.rst-content .wy-alert-danger.important,.rst-content .wy-alert-danger.tip,.rst-content .wy-alert-danger.warning,.rst-content .wy-alert-danger.seealso,.rst-content .wy-alert-danger.admonition-todo{background:#fdf3f2}.wy-alert.wy-alert-danger .wy-alert-title,.rst-content .wy-alert-danger.note .wy-alert-title,.rst-content .wy-alert-danger.attention .wy-alert-title,.rst-content .wy-alert-danger.caution .wy-alert-title,.rst-content .danger .wy-alert-title,.rst-content .error .wy-alert-title,.rst-content .wy-alert-danger.hint .wy-alert-title,.rst-content .wy-alert-danger.important .wy-alert-title,.rst-content .wy-alert-danger.tip .wy-alert-title,.rst-content .wy-alert-danger.warning .wy-alert-title,.rst-content .wy-alert-danger.seealso .wy-alert-title,.rst-content .wy-alert-danger.admonition-todo .wy-alert-title,.wy-alert.wy-alert-danger .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-danger .admonition-title,.rst-content .wy-alert-danger.note .admonition-title,.rst-content .wy-alert-danger.attention .admonition-title,.rst-content .wy-alert-danger.caution .admonition-title,.rst-content .danger .admonition-title,.rst-content .error .admonition-title,.rst-content .wy-alert-danger.hint .admonition-title,.rst-content .wy-alert-danger.important .admonition-title,.rst-content .wy-alert-danger.tip .admonition-title,.rst-content .wy-alert-danger.warning .admonition-title,.rst-content .wy-alert-danger.seealso .admonition-title,.rst-content .wy-alert-danger.admonition-todo .admonition-title{background:#f29f97}.wy-alert.wy-alert-warning,.rst-content .wy-alert-warning.note,.rst-content .attention,.rst-content .caution,.rst-content .wy-alert-warning.danger,.rst-content .wy-alert-warning.error,.rst-content .wy-alert-warning.hint,.rst-content .wy-alert-warning.important,.rst-content .wy-alert-warning.tip,.rst-content .warning,.rst-content .wy-alert-warning.seealso,.rst-content .admonition-todo{background:#ffedcc}.wy-alert.wy-alert-warning .wy-alert-title,.rst-content .wy-alert-warning.note .wy-alert-title,.rst-content .attention .wy-alert-title,.rst-content .caution .wy-alert-title,.rst-content .wy-alert-warning.danger .wy-alert-title,.rst-content .wy-alert-warning.error .wy-alert-title,.rst-content .wy-alert-warning.hint .wy-alert-title,.rst-content .wy-alert-warning.important .wy-alert-title,.rst-content .wy-alert-warning.tip .wy-alert-title,.rst-content .warning .wy-alert-title,.rst-content .wy-alert-warning.seealso .wy-alert-title,.rst-content .admonition-todo .wy-alert-title,.wy-alert.wy-alert-warning .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-warning .admonition-title,.rst-content .wy-alert-warning.note .admonition-title,.rst-content .attention .admonition-title,.rst-content .caution .admonition-title,.rst-content .wy-alert-warning.danger .admonition-title,.rst-content .wy-alert-warning.error .admonition-title,.rst-content .wy-alert-warning.hint .admonition-title,.rst-content .wy-alert-warning.important .admonition-title,.rst-content .wy-alert-warning.tip .admonition-title,.rst-content .warning .admonition-title,.rst-content .wy-alert-warning.seealso .admonition-title,.rst-content .admonition-todo .admonition-title{background:#f0b37e}.wy-alert.wy-alert-info,.rst-content .note,.rst-content .wy-alert-info.attention,.rst-content .wy-alert-info.caution,.rst-content .wy-alert-info.danger,.rst-content .wy-alert-info.error,.rst-content .wy-alert-info.hint,.rst-content .wy-alert-info.important,.rst-content .wy-alert-info.tip,.rst-content .wy-alert-info.warning,.rst-content .seealso,.rst-content .wy-alert-info.admonition-todo{background:#dedede}.wy-alert.wy-alert-info .wy-alert-title,.rst-content .note .wy-alert-title,.rst-content .wy-alert-info.attention .wy-alert-title,.rst-content .wy-alert-info.caution .wy-alert-title,.rst-content .wy-alert-info.danger .wy-alert-title,.rst-content .wy-alert-info.error .wy-alert-title,.rst-content .wy-alert-info.hint .wy-alert-title,.rst-content .wy-alert-info.important .wy-alert-title,.rst-content .wy-alert-info.tip .wy-alert-title,.rst-content .wy-alert-info.warning .wy-alert-title,.rst-content .seealso .wy-alert-title,.rst-content .wy-alert-info.admonition-todo .wy-alert-title,.wy-alert.wy-alert-info .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-info .admonition-title,.rst-content .note .admonition-title,.rst-content .wy-alert-info.attention .admonition-title,.rst-content .wy-alert-info.caution .admonition-title,.rst-content .wy-alert-info.danger .admonition-title,.rst-content .wy-alert-info.error .admonition-title,.rst-content .wy-alert-info.hint .admonition-title,.rst-content .wy-alert-info.important .admonition-title,.rst-content .wy-alert-info.tip .admonition-title,.rst-content .wy-alert-info.warning .admonition-title,.rst-content .seealso .admonition-title,.rst-content .wy-alert-info.admonition-todo .admonition-title{background:#8ba8af}.wy-alert.wy-alert-success,.rst-content .wy-alert-success.note,.rst-content .wy-alert-success.attention,.rst-content .wy-alert-success.caution,.rst-content .wy-alert-success.danger,.rst-content .wy-alert-success.error,.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .wy-alert-success.warning,.rst-content .wy-alert-success.seealso,.rst-content .wy-alert-success.admonition-todo{background:#dedede}.wy-alert.wy-alert-success .wy-alert-title,.rst-content .wy-alert-success.note .wy-alert-title,.rst-content .wy-alert-success.attention .wy-alert-title,.rst-content .wy-alert-success.caution .wy-alert-title,.rst-content .wy-alert-success.danger .wy-alert-title,.rst-content .wy-alert-success.error .wy-alert-title,.rst-content .hint .wy-alert-title,.rst-content .important .wy-alert-title,.rst-content .tip .wy-alert-title,.rst-content .wy-alert-success.warning .wy-alert-title,.rst-content .wy-alert-success.seealso .wy-alert-title,.rst-content .wy-alert-success.admonition-todo .wy-alert-title,.wy-alert.wy-alert-success .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-success .admonition-title,.rst-content .wy-alert-success.note .admonition-title,.rst-content .wy-alert-success.attention .admonition-title,.rst-content .wy-alert-success.caution .admonition-title,.rst-content .wy-alert-success.danger .admonition-title,.rst-content .wy-alert-success.error .admonition-title,.rst-content .hint .admonition-title,.rst-content .important .admonition-title,.rst-content .tip .admonition-title,.rst-content .wy-alert-success.warning .admonition-title,.rst-content .wy-alert-success.seealso .admonition-title,.rst-content .wy-alert-success.admonition-todo .admonition-title{background:#dd4814}.wy-alert.wy-alert-neutral,.rst-content .wy-alert-neutral.note,.rst-content .wy-alert-neutral.attention,.rst-content .wy-alert-neutral.caution,.rst-content .wy-alert-neutral.danger,.rst-content .wy-alert-neutral.error,.rst-content .wy-alert-neutral.hint,.rst-content .wy-alert-neutral.important,.rst-content .wy-alert-neutral.tip,.rst-content .wy-alert-neutral.warning,.rst-content .wy-alert-neutral.seealso,.rst-content .wy-alert-neutral.admonition-todo{background:#f3f6f6}.wy-alert.wy-alert-neutral .wy-alert-title,.rst-content .wy-alert-neutral.note .wy-alert-title,.rst-content .wy-alert-neutral.attention .wy-alert-title,.rst-content .wy-alert-neutral.caution .wy-alert-title,.rst-content .wy-alert-neutral.danger .wy-alert-title,.rst-content .wy-alert-neutral.error .wy-alert-title,.rst-content .wy-alert-neutral.hint .wy-alert-title,.rst-content .wy-alert-neutral.important .wy-alert-title,.rst-content .wy-alert-neutral.tip .wy-alert-title,.rst-content .wy-alert-neutral.warning .wy-alert-title,.rst-content .wy-alert-neutral.seealso .wy-alert-title,.rst-content .wy-alert-neutral.admonition-todo .wy-alert-title,.wy-alert.wy-alert-neutral .rst-content .admonition-title,.rst-content .wy-alert.wy-alert-neutral .admonition-title,.rst-content .wy-alert-neutral.note .admonition-title,.rst-content .wy-alert-neutral.attention .admonition-title,.rst-content .wy-alert-neutral.caution .admonition-title,.rst-content .wy-alert-neutral.danger .admonition-title,.rst-content .wy-alert-neutral.error .admonition-title,.rst-content .wy-alert-neutral.hint .admonition-title,.rst-content .wy-alert-neutral.important .admonition-title,.rst-content .wy-alert-neutral.tip .admonition-title,.rst-content .wy-alert-neutral.warning .admonition-title,.rst-content .wy-alert-neutral.seealso .admonition-title,.rst-content .wy-alert-neutral.admonition-todo .admonition-title{color:#404040;background:#e1e4e5}.wy-alert.wy-alert-neutral a,.rst-content .wy-alert-neutral.note a,.rst-content .wy-alert-neutral.attention a,.rst-content .wy-alert-neutral.caution a,.rst-content .wy-alert-neutral.danger a,.rst-content .wy-alert-neutral.error a,.rst-content .wy-alert-neutral.hint a,.rst-content .wy-alert-neutral.important a,.rst-content .wy-alert-neutral.tip a,.rst-content .wy-alert-neutral.warning a,.rst-content .wy-alert-neutral.seealso a,.rst-content .wy-alert-neutral.admonition-todo a{color:#dd4814}.wy-alert p:last-child,.rst-content .note p:last-child,.rst-content .attention p:last-child,.rst-content .caution p:last-child,.rst-content .danger p:last-child,.rst-content .error p:last-child,.rst-content .hint p:last-child,.rst-content .important p:last-child,.rst-content .tip p:last-child,.rst-content .warning p:last-child,.rst-content .seealso p:last-child,.rst-content .admonition-todo p:last-child{margin-bottom:0}.wy-tray-container{position:fixed;bottom:0px;left:0;z-index:600}.wy-tray-container li{display:block;width:300px;background:transparent;color:#fff;text-align:center;box-shadow:0 5px 5px 0 rgba(0,0,0,0.1);padding:0 24px;min-width:20%;opacity:0;height:0;line-height:56px;overflow:hidden;-webkit-transition:all 0.3s ease-in;-moz-transition:all 0.3s ease-in;transition:all 0.3s ease-in}.wy-tray-container li.wy-tray-item-success{background:#27AE60}.wy-tray-container li.wy-tray-item-info{background:#dd4814}.wy-tray-container li.wy-tray-item-warning{background:#E67E22}.wy-tray-container li.wy-tray-item-danger{background:#E74C3C}.wy-tray-container li.on{opacity:1;height:56px}@media screen and (max-width: 768px){.wy-tray-container{bottom:auto;top:0;width:100%}.wy-tray-container li{width:100%}}button{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;cursor:pointer;line-height:normal;-webkit-appearance:button;*overflow:visible}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}button[disabled]{cursor:default}.btn{display:inline-block;border-radius:2px;line-height:normal;white-space:nowrap;text-align:center;cursor:pointer;font-size:100%;padding:6px 12px 8px 12px;color:#fff;border:1px solid rgba(0,0,0,0.1);background-color:#27AE60;text-decoration:none;font-weight:normal;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;box-shadow:0px 1px 2px -1px rgba(255,255,255,0.5) inset,0px -2px 0px 0px rgba(0,0,0,0.1) inset;outline-none:false;vertical-align:middle;*display:inline;zoom:1;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all 0.1s linear;-moz-transition:all 0.1s linear;transition:all 0.1s linear}.btn-hover{background:#2e8ece;color:#fff}.btn:hover{background:#2cc36b;color:#fff}.btn:focus{background:#2cc36b;outline:0}.btn:active{box-shadow:0px -1px 0px 0px rgba(0,0,0,0.05) inset,0px 2px 0px 0px rgba(0,0,0,0.1) inset;padding:8px 12px 6px 12px}.btn:visited{color:#fff}.btn:disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn-disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn-disabled:hover,.btn-disabled:focus,.btn-disabled:active{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:0.4;cursor:not-allowed;box-shadow:none}.btn::-moz-focus-inner{padding:0;border:0}.btn-small{font-size:80%}.btn-info{background-color:#dd4814 !important}.btn-info:hover{background-color:#2e8ece !important}.btn-neutral{background-color:#f3f6f6 !important;color:#404040 !important}.btn-neutral:hover{background-color:#e5ebeb !important;color:#404040}.btn-neutral:visited{color:#404040 !important}.btn-success{background-color:#27AE60 !important}.btn-success:hover{background-color:#295 !important}.btn-danger{background-color:#E74C3C !important}.btn-danger:hover{background-color:#ea6153 !important}.btn-warning{background-color:#E67E22 !important}.btn-warning:hover{background-color:#e98b39 !important}.btn-invert{background-color:#222}.btn-invert:hover{background-color:#2f2f2f !important}.btn-link{background-color:transparent !important;color:#dd4814;box-shadow:none;border-color:transparent !important}.btn-link:hover{background-color:transparent !important;color:#409ad5 !important;box-shadow:none}.btn-link:active{background-color:transparent !important;color:#409ad5 !important;box-shadow:none}.btn-link:visited{color:#97310e}.wy-btn-group .btn,.wy-control .btn{vertical-align:middle}.wy-btn-group{margin-bottom:24px;*zoom:1}.wy-btn-group:before,.wy-btn-group:after{display:table;content:""}.wy-btn-group:after{clear:both}.wy-dropdown{position:relative;display:inline-block}.wy-dropdown-active .wy-dropdown-menu{display:block}.wy-dropdown-menu{position:absolute;left:0;display:none;float:left;top:100%;min-width:100%;background:#fcfcfc;z-index:100;border:solid 1px #cfd7dd;box-shadow:0 2px 2px 0 rgba(0,0,0,0.1);padding:12px}.wy-dropdown-menu>dd>a{display:block;clear:both;color:#404040;white-space:nowrap;font-size:90%;padding:0 12px;cursor:pointer}.wy-dropdown-menu>dd>a:hover{background:#dd4814;color:#fff}.wy-dropdown-menu>dd.divider{border-top:solid 1px #cfd7dd;margin:6px 0}.wy-dropdown-menu>dd.search{padding-bottom:12px}.wy-dropdown-menu>dd.search input[type="search"]{width:100%}.wy-dropdown-menu>dd.call-to-action{background:#e3e3e3;text-transform:uppercase;font-weight:500;font-size:80%}.wy-dropdown-menu>dd.call-to-action:hover{background:#e3e3e3}.wy-dropdown-menu>dd.call-to-action .btn{color:#fff}.wy-dropdown.wy-dropdown-up .wy-dropdown-menu{bottom:100%;top:auto;left:auto;right:0}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu{background:#fcfcfc;margin-top:2px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a{padding:6px 12px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a:hover{background:#dd4814;color:#fff}.wy-dropdown.wy-dropdown-left .wy-dropdown-menu{right:0;text-align:right}.wy-dropdown-arrow:before{content:" ";border-bottom:5px solid #f5f5f5;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute;display:block;top:-4px;left:50%;margin-left:-3px}.wy-dropdown-arrow.wy-dropdown-arrow-left:before{left:11px}.wy-form-stacked select{display:block}.wy-form-aligned input,.wy-form-aligned textarea,.wy-form-aligned select,.wy-form-aligned .wy-help-inline,.wy-form-aligned label{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-form-aligned .wy-control-group>label{display:inline-block;vertical-align:middle;width:10em;margin:6px 12px 0 0;float:left}.wy-form-aligned .wy-control{float:left}.wy-form-aligned .wy-control label{display:block}.wy-form-aligned .wy-control select{margin-top:6px}fieldset{border:0;margin:0;padding:0}legend{display:block;width:100%;border:0;padding:0;white-space:normal;margin-bottom:24px;font-size:150%;*margin-left:-7px}label{display:block;margin:0 0 0.3125em 0;color:#333;font-size:90%}input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}.wy-control-group{margin-bottom:24px;*zoom:1;max-width:68em;margin-left:auto;margin-right:auto;*zoom:1}.wy-control-group:before,.wy-control-group:after{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group:before,.wy-control-group:after{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group.wy-control-group-required>label:after{content:" *";color:#E74C3C}.wy-control-group .wy-form-full,.wy-control-group .wy-form-halves,.wy-control-group .wy-form-thirds{padding-bottom:12px}.wy-control-group .wy-form-full select,.wy-control-group .wy-form-halves select,.wy-control-group .wy-form-thirds select{width:100%}.wy-control-group .wy-form-full input[type="text"],.wy-control-group .wy-form-full input[type="password"],.wy-control-group .wy-form-full input[type="email"],.wy-control-group .wy-form-full input[type="url"],.wy-control-group .wy-form-full input[type="date"],.wy-control-group .wy-form-full input[type="month"],.wy-control-group .wy-form-full input[type="time"],.wy-control-group .wy-form-full input[type="datetime"],.wy-control-group .wy-form-full input[type="datetime-local"],.wy-control-group .wy-form-full input[type="week"],.wy-control-group .wy-form-full input[type="number"],.wy-control-group .wy-form-full input[type="search"],.wy-control-group .wy-form-full input[type="tel"],.wy-control-group .wy-form-full input[type="color"],.wy-control-group .wy-form-halves input[type="text"],.wy-control-group .wy-form-halves input[type="password"],.wy-control-group .wy-form-halves input[type="email"],.wy-control-group .wy-form-halves input[type="url"],.wy-control-group .wy-form-halves input[type="date"],.wy-control-group .wy-form-halves input[type="month"],.wy-control-group .wy-form-halves input[type="time"],.wy-control-group .wy-form-halves input[type="datetime"],.wy-control-group .wy-form-halves input[type="datetime-local"],.wy-control-group .wy-form-halves input[type="week"],.wy-control-group .wy-form-halves input[type="number"],.wy-control-group .wy-form-halves input[type="search"],.wy-control-group .wy-form-halves input[type="tel"],.wy-control-group .wy-form-halves input[type="color"],.wy-control-group .wy-form-thirds input[type="text"],.wy-control-group .wy-form-thirds input[type="password"],.wy-control-group .wy-form-thirds input[type="email"],.wy-control-group .wy-form-thirds input[type="url"],.wy-control-group .wy-form-thirds input[type="date"],.wy-control-group .wy-form-thirds input[type="month"],.wy-control-group .wy-form-thirds input[type="time"],.wy-control-group .wy-form-thirds input[type="datetime"],.wy-control-group .wy-form-thirds input[type="datetime-local"],.wy-control-group .wy-form-thirds input[type="week"],.wy-control-group .wy-form-thirds input[type="number"],.wy-control-group .wy-form-thirds input[type="search"],.wy-control-group .wy-form-thirds input[type="tel"],.wy-control-group .wy-form-thirds input[type="color"]{width:100%}.wy-control-group .wy-form-full{float:left;display:block;margin-right:2.35765%;width:100%;margin-right:0}.wy-control-group .wy-form-full:last-child{margin-right:0}.wy-control-group .wy-form-halves{float:left;display:block;margin-right:2.35765%;width:48.82117%}.wy-control-group .wy-form-halves:last-child{margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(2n){margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(2n+1){clear:left}.wy-control-group .wy-form-thirds{float:left;display:block;margin-right:2.35765%;width:31.76157%}.wy-control-group .wy-form-thirds:last-child{margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n){margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n+1){clear:left}.wy-control-group.wy-control-group-no-input .wy-control{margin:6px 0 0 0;font-size:90%}.wy-control-no-input{display:inline-block;margin:6px 0 0 0;font-size:90%}.wy-control-group.fluid-input input[type="text"],.wy-control-group.fluid-input input[type="password"],.wy-control-group.fluid-input input[type="email"],.wy-control-group.fluid-input input[type="url"],.wy-control-group.fluid-input input[type="date"],.wy-control-group.fluid-input input[type="month"],.wy-control-group.fluid-input input[type="time"],.wy-control-group.fluid-input input[type="datetime"],.wy-control-group.fluid-input input[type="datetime-local"],.wy-control-group.fluid-input input[type="week"],.wy-control-group.fluid-input input[type="number"],.wy-control-group.fluid-input input[type="search"],.wy-control-group.fluid-input input[type="tel"],.wy-control-group.fluid-input input[type="color"]{width:100%}.wy-form-message-inline{display:inline-block;padding-left:0.3em;color:#666;vertical-align:middle;font-size:90%}.wy-form-message{display:block;color:#999;font-size:70%;margin-top:0.3125em;font-style:italic}input{line-height:normal}input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;*overflow:visible}input[type="text"],input[type="password"],input[type="email"],input[type="url"],input[type="date"],input[type="month"],input[type="time"],input[type="datetime"],input[type="datetime-local"],input[type="week"],input[type="number"],input[type="search"],input[type="tel"],input[type="color"]{-webkit-appearance:none;padding:6px;display:inline-block;border:1px solid #ccc;font-size:80%;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;box-shadow:inset 0 1px 3px #ddd;border-radius:0;-webkit-transition:border 0.3s linear;-moz-transition:border 0.3s linear;transition:border 0.3s linear}input[type="datetime-local"]{padding:0.34375em 0.625em}input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0;margin-right:0.3125em;*height:13px;*width:13px}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}input[type="text"]:focus,input[type="password"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus{outline:0;outline:thin dotted \9;border-color:#333}input.no-focus:focus{border-color:#ccc !important}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:1px auto #129FEA}input[type="text"][disabled],input[type="password"][disabled],input[type="email"][disabled],input[type="url"][disabled],input[type="date"][disabled],input[type="month"][disabled],input[type="time"][disabled],input[type="datetime"][disabled],input[type="datetime-local"][disabled],input[type="week"][disabled],input[type="number"][disabled],input[type="search"][disabled],input[type="tel"][disabled],input[type="color"][disabled]{cursor:not-allowed;background-color:#f3f6f6;color:#cad2d3}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#E74C3C;border:1px solid #E74C3C}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#E74C3C}input[type="file"]:focus:invalid:focus,input[type="radio"]:focus:invalid:focus,input[type="checkbox"]:focus:invalid:focus{outline-color:#E74C3C}input.wy-input-large{padding:12px;font-size:100%}textarea{overflow:auto;vertical-align:top;width:100%;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif}select,textarea{padding:0.5em 0.625em;display:inline-block;border:1px solid #ccc;font-size:80%;box-shadow:inset 0 1px 3px #ddd;-webkit-transition:border 0.3s linear;-moz-transition:border 0.3s linear;transition:border 0.3s linear}select{border:1px solid #ccc;background-color:#fff}select[multiple]{height:auto}select:focus,textarea:focus{outline:0}select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#fff;color:#cad2d3;border-color:transparent}.wy-checkbox,.wy-radio{margin:6px 0;color:#404040;display:block}.wy-checkbox input,.wy-radio input{vertical-align:baseline}.wy-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-input-prefix,.wy-input-suffix{white-space:nowrap;padding:6px}.wy-input-prefix .wy-input-context,.wy-input-suffix .wy-input-context{line-height:27px;padding:0 8px;display:inline-block;font-size:80%;background-color:#f3f6f6;border:solid 1px #ccc;color:#999}.wy-input-suffix .wy-input-context{border-left:0}.wy-input-prefix .wy-input-context{border-right:0}.wy-control-group.wy-control-group-error .wy-form-message,.wy-control-group.wy-control-group-error>label{color:#E74C3C}.wy-control-group.wy-control-group-error input[type="text"],.wy-control-group.wy-control-group-error input[type="password"],.wy-control-group.wy-control-group-error input[type="email"],.wy-control-group.wy-control-group-error input[type="url"],.wy-control-group.wy-control-group-error input[type="date"],.wy-control-group.wy-control-group-error input[type="month"],.wy-control-group.wy-control-group-error input[type="time"],.wy-control-group.wy-control-group-error input[type="datetime"],.wy-control-group.wy-control-group-error input[type="datetime-local"],.wy-control-group.wy-control-group-error input[type="week"],.wy-control-group.wy-control-group-error input[type="number"],.wy-control-group.wy-control-group-error input[type="search"],.wy-control-group.wy-control-group-error input[type="tel"],.wy-control-group.wy-control-group-error input[type="color"]{border:solid 1px #E74C3C}.wy-control-group.wy-control-group-error textarea{border:solid 1px #E74C3C}.wy-inline-validate{white-space:nowrap}.wy-inline-validate .wy-input-context{padding:0.5em 0.625em;display:inline-block;font-size:80%}.wy-inline-validate.wy-inline-validate-success .wy-input-context{color:#27AE60}.wy-inline-validate.wy-inline-validate-danger .wy-input-context{color:#E74C3C}.wy-inline-validate.wy-inline-validate-warning .wy-input-context{color:#E67E22}.wy-inline-validate.wy-inline-validate-info .wy-input-context{color:#dd4814}.rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.mirror{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1)}.mirror.rotate-90{-webkit-transform:scaleX(-1) rotate(90deg);-moz-transform:scaleX(-1) rotate(90deg);-ms-transform:scaleX(-1) rotate(90deg);-o-transform:scaleX(-1) rotate(90deg);transform:scaleX(-1) rotate(90deg)}.mirror.rotate-180{-webkit-transform:scaleX(-1) rotate(180deg);-moz-transform:scaleX(-1) rotate(180deg);-ms-transform:scaleX(-1) rotate(180deg);-o-transform:scaleX(-1) rotate(180deg);transform:scaleX(-1) rotate(180deg)}.mirror.rotate-270{-webkit-transform:scaleX(-1) rotate(270deg);-moz-transform:scaleX(-1) rotate(270deg);-ms-transform:scaleX(-1) rotate(270deg);-o-transform:scaleX(-1) rotate(270deg);transform:scaleX(-1) rotate(270deg)}@media only screen and (max-width: 480px){.wy-form button[type="submit"]{margin:0.7em 0 0}.wy-form input[type="text"],.wy-form input[type="password"],.wy-form input[type="email"],.wy-form input[type="url"],.wy-form input[type="date"],.wy-form input[type="month"],.wy-form input[type="time"],.wy-form input[type="datetime"],.wy-form input[type="datetime-local"],.wy-form input[type="week"],.wy-form input[type="number"],.wy-form input[type="search"],.wy-form input[type="tel"],.wy-form input[type="color"]{margin-bottom:0.3em;display:block}.wy-form label{margin-bottom:0.3em;display:block}.wy-form input[type="password"],.wy-form input[type="email"],.wy-form input[type="url"],.wy-form input[type="date"],.wy-form input[type="month"],.wy-form input[type="time"],.wy-form input[type="datetime"],.wy-form input[type="datetime-local"],.wy-form input[type="week"],.wy-form input[type="number"],.wy-form input[type="search"],.wy-form input[type="tel"],.wy-form input[type="color"]{margin-bottom:0}.wy-form-aligned .wy-control-group label{margin-bottom:0.3em;text-align:left;display:block;width:100%}.wy-form-aligned .wy-control{margin:1.5em 0 0 0}.wy-form .wy-help-inline,.wy-form-message-inline,.wy-form-message{display:block;font-size:80%;padding:6px 0}}@media screen and (max-width: 768px){.tablet-hide{display:none}.wy-table-responsive table td,.wy-table-responsive table th{white-space:nowrap}}@media screen and (max-width: 480px){.mobile-hide{display:none}}.float-left{float:left}.float-right{float:right}.full-width{width:100%}.wy-table,.rst-content table.docutils,.rst-content table.field-list{border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px}.wy-table caption,.rst-content table.docutils caption,.rst-content table.field-list caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.wy-table td,.rst-content table.docutils td,.rst-content table.field-list td,.wy-table th,.rst-content table.docutils th,.rst-content table.field-list th{font-size:90%;margin:0;overflow:visible;padding:8px 16px}.wy-table td:first-child,.rst-content table.docutils td:first-child,.rst-content table.field-list td:first-child,.wy-table th:first-child,.rst-content table.docutils th:first-child,.rst-content table.field-list th:first-child{border-left-width:0}.wy-table thead,.rst-content table.docutils thead,.rst-content table.field-list thead{color:#000;text-align:left;vertical-align:bottom;white-space:nowrap}.wy-table thead th,.rst-content table.docutils thead th,.rst-content table.field-list thead th{font-weight:bold;border-bottom:solid 2px #e1e4e5}.wy-table td,.rst-content table.docutils td,.rst-content table.field-list td{background-color:transparent;vertical-align:middle}.wy-table td p,.rst-content table.docutils td p,.rst-content table.field-list td p{line-height:18px}.wy-table td p:last-child,.rst-content table.docutils td p:last-child,.rst-content table.field-list td p:last-child{margin-bottom:0}.wy-table .wy-table-cell-min,.rst-content table.docutils .wy-table-cell-min,.rst-content table.field-list .wy-table-cell-min{width:1%;padding-right:0}.wy-table .wy-table-cell-min input[type=checkbox],.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox],.wy-table .wy-table-cell-min input[type=checkbox],.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox]{margin:0}.wy-table-secondary{color:gray;font-size:90%}.wy-table-tertiary{color:gray;font-size:80%}.wy-table-odd td,.wy-table-striped tr:nth-child(2n-1) td,.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td{background-color:#f3f6f6}.wy-table-backed{background-color:#f3f6f6}.wy-table-bordered-all,.rst-content table.docutils{border:1px solid #e1e4e5}.wy-table-bordered-all td,.rst-content table.docutils td{border-bottom:1px solid #e1e4e5;border-left:1px solid #e1e4e5}.wy-table-bordered-all tbody>tr:last-child td,.rst-content table.docutils tbody>tr:last-child td{border-bottom-width:0}.wy-table-bordered{border:1px solid #e1e4e5}.wy-table-bordered-rows td{border-bottom:1px solid #e1e4e5}.wy-table-bordered-rows tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal td,.wy-table-horizontal th{border-width:0 0 1px 0;border-bottom:1px solid #e1e4e5}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-responsive{margin-bottom:24px;max-width:100%;overflow:auto}.wy-table-responsive table{margin-bottom:0 !important}a{color:#dd4814;text-decoration:none;cursor:pointer}a:hover{color:#97310e}a:visited{color:#97310e}html{height:100%;overflow-x:hidden}body{font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;font-weight:normal;color:#404040;min-height:100%;overflow-x:hidden;background:#edf0f2}.wy-text-left{text-align:left}.wy-text-center{text-align:center}.wy-text-right{text-align:right}.wy-text-large{font-size:120%}.wy-text-normal{font-size:100%}.wy-text-small,small{font-size:80%}.wy-text-strike{text-decoration:line-through}.wy-text-warning{color:#E67E22 !important}a.wy-text-warning:hover{color:#eb9950 !important}.wy-text-info{color:#dd4814 !important}a.wy-text-info:hover{color:#409ad5 !important}.wy-text-success{color:#27AE60 !important}a.wy-text-success:hover{color:#36d278 !important}.wy-text-danger{color:#E74C3C !important}a.wy-text-danger:hover{color:#ed7669 !important}.wy-text-neutral{color:#404040 !important}a.wy-text-neutral:hover{color:#595959 !important}h1,h2,h3,h4,h5,h6,legend{margin-top:0;font-weight:700;font-family:"Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif}p{line-height:24px;margin:0;font-size:16px;margin-bottom:24px}h1{font-size:175%}h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}hr{display:block;height:1px;border:0;border-top:1px solid #e1e4e5;margin:24px 0;padding:0}code,.rst-content tt{white-space:nowrap;max-width:100%;background:#fff;border:solid 1px #e1e4e5;font-size:75%;padding:0 5px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;color:#E74C3C;overflow-x:auto}code.code-large,.rst-content tt.code-large{font-size:90%}.wy-plain-list-disc,.rst-content .section ul,.rst-content .toctree-wrapper ul,article ul{list-style:disc;line-height:24px;margin-bottom:24px}.wy-plain-list-disc li,.rst-content .section ul li,.rst-content .toctree-wrapper ul li,article ul li{list-style:disc;margin-left:24px}.wy-plain-list-disc li p:last-child,.rst-content .section ul li p:last-child,.rst-content .toctree-wrapper ul li p:last-child,article ul li p:last-child{margin-bottom:0}.wy-plain-list-disc li ul,.rst-content .section ul li ul,.rst-content .toctree-wrapper ul li ul,article ul li ul{margin-bottom:0}.wy-plain-list-disc li li,.rst-content .section ul li li,.rst-content .toctree-wrapper ul li li,article ul li li{list-style:circle}.wy-plain-list-disc li li li,.rst-content .section ul li li li,.rst-content .toctree-wrapper ul li li li,article ul li li li{list-style:square}.wy-plain-list-disc li ol li,.rst-content .section ul li ol li,.rst-content .toctree-wrapper ul li ol li,article ul li ol li{list-style:decimal}.wy-plain-list-decimal,.rst-content .section ol,.rst-content ol.arabic,article ol{list-style:decimal;line-height:24px;margin-bottom:24px}.wy-plain-list-decimal li,.rst-content .section ol li,.rst-content ol.arabic li,article ol li{list-style:decimal;margin-left:24px}.wy-plain-list-decimal li p:last-child,.rst-content .section ol li p:last-child,.rst-content ol.arabic li p:last-child,article ol li p:last-child{margin-bottom:0}.wy-plain-list-decimal li ul,.rst-content .section ol li ul,.rst-content ol.arabic li ul,article ol li ul{margin-bottom:0}.wy-plain-list-decimal li ul li,.rst-content .section ol li ul li,.rst-content ol.arabic li ul li,article ol li ul li{list-style:disc}.codeblock-example{border:1px solid #e1e4e5;border-bottom:none;padding:24px;padding-top:48px;font-weight:500;background:#fff;position:relative}.codeblock-example:after{content:"Example";position:absolute;top:0px;left:0px;background:#97310e;color:#fff;padding:6px 12px}.codeblock-example.prettyprint-example-only{border:1px solid #e1e4e5;margin-bottom:24px}.codeblock,pre.literal-block,.rst-content .literal-block,.rst-content pre.literal-block,div[class^='highlight']{border:1px solid #e1e4e5;padding:0px;overflow-x:auto;background:#fff;margin:1px 0 24px 0}.codeblock div[class^='highlight'],pre.literal-block div[class^='highlight'],.rst-content .literal-block div[class^='highlight'],div[class^='highlight'] div[class^='highlight']{border:none;background:none;margin:0}div[class^='highlight'] td.code{width:100%}.linenodiv pre{border-right:solid 1px #e6e9ea;margin:0;padding:12px 12px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:12px;line-height:1.5;color:#d9d9d9}div[class^='highlight'] pre{white-space:pre;margin:0;padding:12px 12px;font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;font-size:12px;line-height:1.5;display:block;overflow:auto;color:#404040}@media print{.codeblock,pre.literal-block,.rst-content .literal-block,.rst-content pre.literal-block,div[class^='highlight'],div[class^='highlight'] pre{white-space:pre-wrap}}.hll{background-color:#ffc;margin:0 -12px;padding:0 12px;display:block}.c{color:#998;font-style:italic}.err{color:#a61717;background-color:#e3d2d2}.k{font-weight:bold}.o{font-weight:bold}.cm{color:#998;font-style:italic}.cp{color:#999;font-weight:bold}.c1{color:#998;font-style:italic}.cs{color:#999;font-weight:bold;font-style:italic}.gd{color:#000;background-color:#fdd}.gd .x{color:#000;background-color:#faa}.ge{font-style:italic}.gr{color:#a00}.gh{color:#999}.gi{color:#000;background-color:#dfd}.gi .x{color:#000;background-color:#afa}.go{color:#888}.gp{color:#555}.gs{font-weight:bold}.gu{color:purple;font-weight:bold}.gt{color:#a00}.kc{font-weight:bold}.kd{font-weight:bold}.kn{font-weight:bold}.kp{font-weight:bold}.kr{font-weight:bold}.kt{color:#458;font-weight:bold}.m{color:#099}.s{color:#d14}.n{color:#333}.na{color:teal}.nb{color:#0086b3}.nc{color:#458;font-weight:bold}.no{color:teal}.ni{color:purple}.ne{color:#900;font-weight:bold}.nf{color:#900;font-weight:bold}.nn{color:#555}.nt{color:navy}.nv{color:teal}.ow{font-weight:bold}.w{color:#bbb}.mf{color:#099}.mh{color:#099}.mi{color:#099}.mo{color:#099}.sb{color:#d14}.sc{color:#d14}.sd{color:#d14}.s2{color:#d14}.se{color:#d14}.sh{color:#d14}.si{color:#d14}.sx{color:#d14}.sr{color:#009926}.s1{color:#d14}.ss{color:#990073}.bp{color:#999}.vc{color:teal}.vg{color:teal}.vi{color:teal}.il{color:#099}.gc{color:#999;background-color:#EAF2F5}.wy-breadcrumbs li{display:inline-block}.wy-breadcrumbs li.wy-breadcrumbs-aside{float:right}.wy-breadcrumbs li a{display:inline-block;padding:5px}.wy-breadcrumbs li a:first-child{padding-left:0}.wy-breadcrumbs-extra{margin-bottom:0;color:#b3b3b3;font-size:80%;display:inline-block}@media screen and (max-width: 480px){.wy-breadcrumbs-extra{display:none}.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}@media print{.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}.wy-affix{position:fixed;top:1.618em}.wy-menu a:hover{text-decoration:none}.wy-menu-horiz{*zoom:1}.wy-menu-horiz:before,.wy-menu-horiz:after{display:table;content:""}.wy-menu-horiz:after{clear:both}.wy-menu-horiz ul,.wy-menu-horiz li{display:inline-block}.wy-menu-horiz li:hover{background:rgba(255,255,255,0.1)}.wy-menu-horiz li.divide-left{border-left:solid 1px #404040}.wy-menu-horiz li.divide-right{border-right:solid 1px #404040}.wy-menu-horiz a{height:32px;display:inline-block;line-height:32px;padding:0 16px}.wy-menu-vertical header{height:32px;display:inline-block;line-height:32px;padding:0 1.618em;display:block;font-weight:bold;text-transform:uppercase;font-size:80%;color:#dd4814;white-space:nowrap}.wy-menu-vertical ul{margin-bottom:0}.wy-menu-vertical li.divide-top{border-top:solid 1px #404040}.wy-menu-vertical li.divide-bottom{border-bottom:solid 1px #404040}.wy-menu-vertical li.current{background:#e3e3e3}.wy-menu-vertical li.current a{color:gray;border-right:solid 1px #c9c9c9;padding:0.4045em 2.427em}.wy-menu-vertical li.current a:hover{background:#d6d6d6}.wy-menu-vertical li.on a,.wy-menu-vertical li.current>a{color:#404040;padding:0.4045em 1.618em;font-weight:bold;position:relative;background:#fcfcfc;border:none;border-bottom:solid 1px #c9c9c9;border-top:solid 1px #c9c9c9;padding-left:1.618em -4px}.wy-menu-vertical li.on a:hover,.wy-menu-vertical li.current>a:hover{background:#fcfcfc}.wy-menu-vertical li.toctree-l2.current>a{background:#c9c9c9;padding:0.4045em 2.427em}.wy-menu-vertical li.current ul{display:block}.wy-menu-vertical li ul{margin-bottom:0;display:none}.wy-menu-vertical .local-toc li ul{display:block}.wy-menu-vertical li ul li a{margin-bottom:0;color:#b3b3b3;font-weight:normal}.wy-menu-vertical a{display:inline-block;line-height:18px;padding:0.4045em 1.618em;display:block;position:relative;font-size:90%;color:#b3b3b3}.wy-menu-vertical a:hover{background-color:#4e4a4a;cursor:pointer}.wy-menu-vertical a:active{background-color:#dd4814;cursor:pointer;color:#fff}.wy-side-nav-search{z-index:200;background-color:#dd4814;text-align:center;padding:0.809em;display:block;color:#fcfcfc;margin-bottom:0.809em}.wy-side-nav-search input[type=text]{width:100%;border-radius:50px;padding:6px 12px;border-color:#97310e}.wy-side-nav-search img{display:block;margin:auto auto 0.809em auto;height:45px;width:45px;background-color:#dd4814;padding:5px;border-radius:100%}.wy-side-nav-search>a,.wy-side-nav-search .wy-dropdown>a{color:#fcfcfc;font-size:100%;font-weight:bold;display:inline-block;padding:4px 6px;margin-bottom:0.809em}.wy-side-nav-search>a:hover,.wy-side-nav-search .wy-dropdown>a:hover{background:rgba(255,255,255,0.1)}.wy-nav .wy-menu-vertical header{color:#dd4814}.wy-nav .wy-menu-vertical a{color:#b3b3b3}.wy-nav .wy-menu-vertical a:hover{background-color:#dd4814;color:#fff}[data-menu-wrap]{-webkit-transition:all 0.2s ease-in;-moz-transition:all 0.2s ease-in;transition:all 0.2s ease-in;position:absolute;opacity:1;width:100%;opacity:0}[data-menu-wrap].move-center{left:0;right:auto;opacity:1}[data-menu-wrap].move-left{right:auto;left:-100%;opacity:0}[data-menu-wrap].move-right{right:-100%;left:auto;opacity:0}.wy-body-for-nav{background:left repeat-y #fcfcfc;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxOERBMTRGRDBFMUUxMUUzODUwMkJCOThDMEVFNURFMCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxOERBMTRGRTBFMUUxMUUzODUwMkJCOThDMEVFNURFMCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE4REExNEZCMEUxRTExRTM4NTAyQkI5OEMwRUU1REUwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjE4REExNEZDMEUxRTExRTM4NTAyQkI5OEMwRUU1REUwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+EwrlwAAAAA5JREFUeNpiMDU0BAgwAAE2AJgB9BnaAAAAAElFTkSuQmCC);background-size:300px 1px}.wy-grid-for-nav{position:absolute;width:100%;height:100%}.wy-nav-side{position:absolute;top:0;left:0;width:300px;overflow:hidden;min-height:100%;background:#343131;z-index:200}.wy-nav-top{display:none;background:#dd4814;color:#fff;padding:0.4045em 0.809em;position:relative;line-height:50px;text-align:center;font-size:100%;*zoom:1}.wy-nav-top:before,.wy-nav-top:after{display:table;content:""}.wy-nav-top:after{clear:both}.wy-nav-top a{color:#fff;font-weight:bold}.wy-nav-top img{margin-right:12px;height:45px;width:45px;background-color:#dd4814;padding:5px;border-radius:100%}.wy-nav-top i{font-size:30px;float:left;cursor:pointer}.wy-nav-content-wrap{margin-left:300px;background:#fcfcfc;min-height:100%}.wy-nav-content{padding:1.618em 3.236em;height:100x;margin:auto}.wy-body-mask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.2);display:none;z-index:499}.wy-body-mask.on{display:block}footer{color:#999}footer p{margin-bottom:12px}.rst-footer-buttons{*zoom:1}.rst-footer-buttons:before,.rst-footer-buttons:after{display:table;content:""}.rst-footer-buttons:after{clear:both}#search-results .search li{margin-bottom:24px;border-bottom:solid 1px #e1e4e5;padding-bottom:24px}#search-results .search li:first-child{border-top:solid 1px #e1e4e5;padding-top:24px}#search-results .search li a{font-size:120%;margin-bottom:12px;display:inline-block}#search-results .context{color:gray;font-size:90%}@media screen and (max-width: 768px){.wy-body-for-nav{background:#fcfcfc}.wy-nav-top{display:block}.wy-nav-side{left:-300px}.wy-nav-side.shift{width:85%;left:0}.wy-nav-content-wrap{margin-left:0}.wy-nav-content-wrap .wy-nav-content{padding:1.618em}.wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}}@media screen and (min-width: 1400px){.wy-nav-content-wrap{background:rgba(0,0,0,0.05)}.wy-nav-content{margin:0;background:#fcfcfc}}@media print{.rst-versions,footer,.wy-nav-side{display:none}.wy-nav-content-wrap{margin-left:0}}nav.stickynav{position:fixed;top:0}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#dd4814;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa,.rst-versions .rst-current-version .rst-content .admonition-title,.rst-content .rst-versions .rst-current-version .admonition-title,.rst-versions .rst-current-version .rst-content h1 .headerlink,.rst-content h1 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h2 .headerlink,.rst-content h2 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h3 .headerlink,.rst-content h3 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h4 .headerlink,.rst-content h4 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h5 .headerlink,.rst-content h5 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content h6 .headerlink,.rst-content h6 .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .rst-content dl dt .headerlink,.rst-content dl dt .rst-versions .rst-current-version .headerlink,.rst-versions .rst-current-version .icon{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}}.rst-content img{max-width:100%;height:auto !important}.rst-content div.figure{margin-bottom:24px}.rst-content div.figure.align-center{text-align:center}.rst-content .section>img,.rst-content .section>a>img{margin-bottom:24px}.rst-content blockquote{margin-left:24px;line-height:24px;margin-bottom:24px}.rst-content .note .last,.rst-content .attention .last,.rst-content .caution .last,.rst-content .danger .last,.rst-content .error .last,.rst-content .hint .last,.rst-content .important .last,.rst-content .tip .last,.rst-content .warning .last,.rst-content .seealso .last,.rst-content .admonition-todo .last{margin-bottom:0}.rst-content .admonition-title:before{margin-right:4px}.rst-content .admonition table{border-color:rgba(0,0,0,0.1)}.rst-content .admonition table td,.rst-content .admonition table th{background:transparent !important;border-color:rgba(0,0,0,0.1) !important}.rst-content .section ol.loweralpha,.rst-content .section ol.loweralpha li{list-style:lower-alpha}.rst-content .section ol.upperalpha,.rst-content .section ol.upperalpha li{list-style:upper-alpha}.rst-content .section ol p,.rst-content .section ul p{margin-bottom:12px}.rst-content .line-block{margin-left:24px}.rst-content .topic-title{font-weight:bold;margin-bottom:12px}.rst-content .toc-backref{color:#404040}.rst-content .align-right{float:right;margin:0px 0px 24px 24px}.rst-content .align-left{float:left;margin:0px 24px 24px 0px}.rst-content .align-center{margin:auto;display:block}.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content dl dt .headerlink{display:none;visibility:hidden;font-size:14px}.rst-content h1 .headerlink:after,.rst-content h2 .headerlink:after,.rst-content h3 .headerlink:after,.rst-content h4 .headerlink:after,.rst-content h5 .headerlink:after,.rst-content h6 .headerlink:after,.rst-content dl dt .headerlink:after{visibility:visible;content:"";font-family:FontAwesome;display:inline-block}.rst-content h1:hover .headerlink,.rst-content h2:hover .headerlink,.rst-content h3:hover .headerlink,.rst-content h4:hover .headerlink,.rst-content h5:hover .headerlink,.rst-content h6:hover .headerlink,.rst-content dl dt:hover .headerlink{display:inline-block}.rst-content .sidebar{float:right;width:40%;display:block;margin:0 0 24px 24px;padding:24px;background:#f3f6f6;border:solid 1px #e1e4e5}.rst-content .sidebar p,.rst-content .sidebar ul,.rst-content .sidebar dl{font-size:90%}.rst-content .sidebar .last{margin-bottom:0}.rst-content .sidebar .sidebar-title{display:block;font-family:"Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif;font-weight:bold;background:#e1e4e5;padding:6px 12px;margin:-24px;margin-bottom:24px;font-size:100%}.rst-content .highlighted{background:#F1C40F;display:inline-block;font-weight:bold;padding:0 6px}.rst-content .footnote-reference,.rst-content .citation-reference{vertical-align:super;font-size:90%}.rst-content table.docutils.citation,.rst-content table.docutils.footnote{background:none;border:none;color:#999}.rst-content table.docutils.citation td,.rst-content table.docutils.citation tr,.rst-content table.docutils.footnote td,.rst-content table.docutils.footnote tr{border:none;background-color:transparent !important;white-space:normal}.rst-content table.docutils.citation td.label,.rst-content table.docutils.footnote td.label{padding-left:0;padding-right:0;vertical-align:top}.rst-content table.field-list{border:none}.rst-content table.field-list td{border:none;padding-top:5px}.rst-content table.field-list td>strong{display:inline-block;margin-top:3px}.rst-content table.field-list .field-name{padding-right:10px;text-align:left;white-space:nowrap}.rst-content table.field-list .field-body{text-align:left;padding-left:0}.rst-content tt{color:#000}.rst-content tt big,.rst-content tt em{font-size:100% !important;line-height:normal}.rst-content tt .xref,a .rst-content tt{font-weight:bold}.rst-content a tt{color:#dd4814}.rst-content dl{margin-bottom:24px}.rst-content dl dt{font-weight:bold}.rst-content dl p,.rst-content dl table,.rst-content dl ul,.rst-content dl ol{margin-bottom:12px !important}.rst-content dl dd{margin:0 0 12px 24px}.rst-content dl:not(.docutils){margin-bottom:24px}.rst-content dl:not(.docutils) dt{display:inline-block;margin:6px 0;font-size:90%;line-height:normal;background:#dedede;color:#dd4814;border-top:solid 3px #8ba8af;padding:6px;position:relative}.rst-content dl:not(.docutils) dt:before{color:#8ba8af}.rst-content dl:not(.docutils) dt .headerlink{color:#404040;font-size:100% !important}.rst-content dl:not(.docutils) dl dt{margin-bottom:6px;border:none;border-left:solid 3px #ccc;background:#f0f0f0;color:gray}.rst-content dl:not(.docutils) dl dt .headerlink{color:#404040;font-size:100% !important}.rst-content dl:not(.docutils) dt:first-child{margin-top:0}.rst-content dl:not(.docutils) tt{font-weight:bold}.rst-content dl:not(.docutils) tt.descname,.rst-content dl:not(.docutils) tt.descclassname{background-color:transparent;border:none;padding:0;font-size:100% !important}.rst-content dl:not(.docutils) tt.descname{font-weight:bold}.rst-content dl:not(.docutils) .optional{display:inline-block;padding:0 4px;color:#000;font-weight:bold}.rst-content dl:not(.docutils) .property{display:inline-block;padding-right:8px}.rst-content .viewcode-link,.rst-content .viewcode-back{display:inline-block;color:#27AE60;font-size:80%;padding-left:24px}.rst-content .viewcode-back{display:block;float:right}.rst-content p.rubric{margin-bottom:12px;font-weight:bold}@media screen and (max-width: 480px){.rst-content .sidebar{width:100%}}span[id*='MathJax-Span']{color:#404040}.math{text-align:center} +/*# sourceMappingURL=theme.css.map */ diff --git a/user_guide/_static/doctools.js b/user_guide/_static/doctools.js new file mode 100755 index 0000000..5654977 --- /dev/null +++ b/user_guide/_static/doctools.js @@ -0,0 +1,287 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); \ No newline at end of file diff --git a/user_guide/_static/down-pressed.png b/user_guide/_static/down-pressed.png new file mode 100755 index 0000000000000000000000000000000000000000..5756c8cad8854722893dc70b9eb4bb0400343a39 GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`OFdm2Ln;`PZ^+1>KjR?B@S0W7 z%OS_REiHONoJ6{+Ks@6k3590|7k9F+ddB6!zw3#&!aw#S`x}3V3&=A(a#84O-&F7T z^k3tZB;&iR9siw0|F|E|DAL<8r-F4!1H-;1{e*~yAKZN5f0|Ei6yUmR#Is)EM(Po_ zi`qJR6|P<~+)N+kSDgL7AjdIC_!O7Q?eGb+L+qOjm{~LLinM4NHn7U%HcK%uoMYO5 VJ~8zD2B3o(JYD@<);T3K0RV0%P>BEl literal 0 HcmV?d00001 diff --git a/user_guide/_static/down.png b/user_guide/_static/down.png new file mode 100755 index 0000000000000000000000000000000000000000..1b3bdad2ceffae91cee61b32f3295f9bbe646e48 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6CVIL!hEy=F?b*7pIY7kW{q%Rg zx!yQ<9v8bmJwa`TQk7YSw}WVQ()mRdQ;TC;* literal 0 HcmV?d00001 diff --git a/user_guide/_static/file.png b/user_guide/_static/file.png new file mode 100755 index 0000000000000000000000000000000000000000..a858a410e4faa62ce324d814e4b816fff83a6fb3 GIT binary patch literal 286 zcmV+(0pb3MP)s`hMrGg#P~ix$^RISR_I47Y|r1 z_CyJOe}D1){SET-^Amu_i71Lt6eYfZjRyw@I6OQAIXXHDfiX^GbOlHe=Ae4>0m)d(f|Me07*qoM6N<$f}vM^LjV8( literal 0 HcmV?d00001 diff --git a/user_guide/_static/fonts/FontAwesome.otf b/user_guide/_static/fonts/FontAwesome.otf new file mode 100755 index 0000000000000000000000000000000000000000..8b0f54e47e1d356dcf1496942a50e228e0f1ee14 GIT binary patch literal 62856 zcmcfp2Y3_5)&LBzEbU6(wGF`%u_do$I-wUs=poc3^xzP>t859|l91%ydy%{4ZewH9 zLNU#OK%5)jlp7M#adH#VlN(Y~MSVYG)7F`Dsts8mQIv>+ztD)dFw+9OVG%`1 zdML`ns?&x=Qnp|IfM+dm&(}ePcdqmf37+Ghm#p%f+FVKQ2*chjkzF#ZB~9w-bef!xGBr6D7h{6UGOP@t%*!8rhr zqTX&D_txFJckW8F88SgJDOYWQiq1}9HpST zU`<34PZ)C!_3}_&M2)6kC53tq%16Wv<;B!kk^fL$a$g&o8ZTNrRL|U3FQqy}Aw%^t z%FjbIl=r0M9>Z`rYKq77t>{++@-k0@oM~*1+}p2(7`Q4V*n=HYq=vsI?g5v}-nP z3|{}}ibb1(*R0;YdDD}@+q7nj-e?F6nlWp}oWMD=X3yOms||yGW^I(#9B4HL0`>*2 zG{Pq6qjlCmi#Eba+D94TAv}p9V_D5%k=nR0b4*~E)oRv<#|upiMk~z0GGmR=Yz-V5 ze^pq5HgIj2Au?HKwVD>qoJsnJx#u=RZ=|+Tk5lVmJ2z1#N=q3aw}vu8YK7c-N>4=y zwHEjdq-Iky;2wVdD3u7c7HAy@>636rQ}I+R6-Jq%%_eFi6$}s_rB+ajpcD*stEugP zo136*FtrWZo1wQ}7%h+r0@$R$MYWppE&yKBVk^ODoieQIXI-PMCWPv3^jr9p7*cDDu9q6%xx{?3;;b@n3omixrmwx*YNmZf9p3xm@i;8 zp?TpJjUB@J0D^@;Vq@WEgcj}}s2gf=U*-SLs=qz||El20$!O-RlsfnS_J9)6lK^rf z@F|+|fem;DctSVzuQ6lCs>g=*`}C{(m-TP#-`gM6ukSbXXY`l%AL#GuKiB_u|L6U` z^xwJVb4z_|(yht2X53nKYvZlGw+y#3Zk69U@CS95u-8E9*x%q${UiIw^e^w<+#lK> z-M_Ej)SuN~+27uOroXrU-Tp88`)^UVM&1epcn{s0b!+*p&9_2tnQmp>swD94ennAt zcir7`_tDR9d~W}I%Sf-0+(^%nvXRn}u#+RjBRxinMp7g0j<_@8_K4p{{5Im&i2f13 zj`+pr(-A+9_-Vw=5kHRjVZ`?%z8i6aJ1^|@`u}w?=l`!y{JYkcahKF7zYy(4XAHaLAh7>kswf;WDJ8 zodnW*&mk}LA4ATyzs;HS z&jMIk)X1SUY8WQ8mk8qz!5gX{ac?|#KNXah-`{R{t;jx;+arrw4mTM?C=b`)g9B|K zKbe$=Z!xqbc>xxr!#G3cIJ_43-sk>0XiMsaXE3e+56S@N-W&nebhy1GS=0t{!`!CB zeXl$`20SDCO)=z#yl@A)%foXM<_FJ&aY(!S?qN9ajLc&>wDpF%>BD`=97%ujZX|^{ zkUJb;(Bvllh3Ak$Tkm1o9O@S+z@h#=rtsbrEayd0}DguL&kx00m+ja=Bpt$)C)Jj(+GE#@N5{qN_YooPx`~Xe7HP3 z{%{$_+eqqQIN>I3Ngv^P)=&zdhx-v8M)G7X!|w&{r;s|*7v>g7Gy(!cXqP3lRov@8 zR1fWh=MwT9Zqok0{>Y@@?`{gwSN{7?L`gvE7m2*?lX6LUm1893w2Pdz9?n{^!(W2e zdWpaFl9b@u0BLprBcj#q)KgjW@7iqlGG5Yvz*k2E1b+8G7f(?i1&vA9XxDLyUk5nmBs6~80?xA;He-^DJ8RN^C1NybWMO6ExxOV&s>OP-SKlxQUu zNxCEtRJdwMgQQb(MDmQ}tmIiqujCEMHOY0!HkBMipnS7>{u``WKCv$?i#JtM9$^4u7g87d5nYqQ>kup*r>4Q>U zI$1hRI!8KRx>mYFs*@&5bEW0dI%&J~sPvTdy!1usRp|%PFQwl}f0q6xb;-PBD%k|t zY}tI-V%aj;YS{+aQ?dwIjLaxYk`>BoWsR~9*)iEk*+tn)va7OpWS_{smHjSrdP+V0 zJk_4#J?D9@_1xwe?HTK7@=Wl|@+|Uf_B`o%#`BWri=J_T=4`v|*&UBhl-L)Zv5p0%+J>@(~s_AL7X`wDx7eUJT&{SSMK z9pETV%t<)~r{X4Z^SBk<7A}m7;^H_fm&|2x`CJ88%QbUt++pq*cal5LUErSMUf^El zUgJLCKIVSme)FQdBwi!E`Us0Q z%p9T98WOazMw1pS4`!>y8fGSUh&Ik-O^&x{%~AT;IIAusHq0EYwdzPtZ?PI<%-T3( zf;Poyj0@2lgv1zcHAY2Q^wEZ}*a%}ZXpR=04ir-WpbZI&wOaLYTC*`MGSZl6h=r8Y z4d>%cq(*NDHzt{4!;(WH^yY|Ityyc*hFL*fHES(8GA!v5YmA7AiVce8e_;!6kC&7Z?Hyy8O0n%G}drq zY^2^A7ORi2YLl!XIxW$Sg>0fe(yD_8(T0#%Z4_w&Inczd&{N0@YP37MFWzF+MkX06M(8q>71~9GMQF*2ge2%AwMG*R7f)W-5CO{_W(pxQ1Gtd{5P-01VNw=dm{|+^ z6%j+0-eT37Lc+r$ViLp5kx^l=IKzeEl&qvF4E7NA%LH2ey@o@10m4vTyAQN~fSq7A zx?gWNFHF`H8*d3AI~%7r4CUPWFH{<1gk*m_30u(tfF`iWB#nqQTC}hv2E8F#m?SuDFTQn3UEkkc8@TWC!-F{GC^ww z>q*$~q;*EKK82V{VgW}(B4CfL)4q56 z4)D)xH0hF~^)O1fFcUYy3iJruY7hufKutIFVd8R^gr`Ecp*I_TDL24)U$r5ORbRg-pCjNXR?8@hRjlg!)^B z(D!dOu%iM74)q`)qGOHW+C($Zqs|&;iLn3^gGC89>$Oo4U_&EF=f-R>g=zQ41JxU% z^ai~(IaX`22o=$0BPn|0z*CK8 zK%DqkW2^;?Z85-a0Z6ni9$1JOKmq#-j|FR7G;j-Zd_)ZF6-)}K?p{V%Lg*B4TBUeba0p4h(`{lkhnUa;!S@mlEwb3uRAAna%X|R34lqnNUbFX_%$pF{0bXxjWdRmGt^CFZcG*MWq&*% zpD-JDPJjsSWiSA$4WFQ~!(L z(g@%$q;&`!M=`(;0H;FcJiPEeUTy)bGXu%#O;$^MxH}UvXTe-kd`b#g8@(3xP*30x znc%M+5eqCjy*4&-n6xnX2oC%!5s^Uj?t@SuO@S=#uW(bx z{WX6b2|^FDjXG;w?7RqzWiB8Wa4|QJBTGftngtFZz*C@qy(Q$Y1K?iO@DUL*ch+1% z9wK1j&>$1McLEb&Zk8+5#cF{jf&aTxfx3yPAYib-S%s<1oju2WfRYkWB~Tuak9)I+ z(-1(skh!xT*2bHo!{JN-dNJ<8yjM5m zG60rH7zk-~uZGNixK`kLe=CruA#>*j!96b-j;Z)?t?(j4`6Spia^GJE{4Ojx680Zt zNWe8%t069;H$XAk92OS^LR}2VREDV856=$Q!%mO|6<}C_6UCa{zd}W<5upDiblg`Y z4Cvl7f*bc0-6U;-JxByu&zNWdaxxqBk$}(fNs-__0UlzBNj3priZ@%}*dQl4?7A@u zxFO-}z(C>X2fTOs4u7+;J0*%HiJsMQxqoBiu59bC{I)* zIwpEv)GK;ZbY1kl=qJ%1q5%)ugY$R_l;6D`VIDej?~k_t(Uq#ab(*CcOB-jjSFxlRYtLG(g8nl{qO zbOHT5{ZCLqIVOM^&rD@zGV_^TOav3dn3%)Nr_5K(_smbsZ;XR+Nxh{3(y`L%(je&q z=^E)esaBdKO_%0LE2WLn1JX|EJJNqkKa+kfy&=6R{Z;m$EI>A1Hd!`RHd8iFwn+Af zOe@pN;$&u7o$Qe8lVqKiD_fkJ-=Jui1W386V`Pb1S)E zZZ{Xs={O@7&!utMTpf3Udy%`wead~q-Q@bYKfGjKDz6z{L0&7o9`}0EYlm03m(I)J zmEe`?mG4#O)#laVb=0fN>w?#dUN3vS=Jl4>2VS3feeLyw*Uw(Rc{#l9deh#V_egJz z_ayH*-iy4Kd2jIE?ESR2*4ylzxhxHlZ~0u+4bSNe2Avwqk&^$DHRv=KS#CD3;S~8SQm|;x zN%uXOg<%H!6sOWpT07MECb~&~iaal%Kr~kA@W=0ly z{t+$Uxdi~XHN7!e%}J9R(_7UXGlAu{@LgPTdU`T9mC4D=%h61g=2Yj|)i)V?b+ui? zE#uW(1@DS-MfI`{o?I@T&abi;)~M_?7x@=n*uipt?Z;r>c-GlBp66Pcnp(J_b~W~k zJU4;W8IE;z9Xr-_5FpZ3`8gH2s@$By{Co|!66RIRN3*C1^>ST?V>+@U!LTF2up`?- zL$|?lw4^nqr~{nKnUu7&6b%lRrZlCsr~{Z@h76@~^htykcl!R`V4$yrCB3Hbq$wn746_@NOa-3Klzp2l^gn2VQjbAuo0?#JQLL z$Mz}bSE*b<%<3&$R%={A(pBfD{9}jO88R43TRRf@j!umu(~;H5a&uR%M853YmDj$} zIQyjET)Xy-no~>!4446Ue9XYDW$(ym^9NXsBiI!j&bBmH*VjYd5uCtsQXS7>`8HO> zDbN}`0?ouLy46Rz8=vn%p8Uqm@ezB}D0m6pght^=)w6thX?kgz2G3qG5zoOZl-P#$ z;62Eu9_V9|U>i5{jy^LBsJUYYou6NrldH_F$f?R#6Z}L^@PMpQjwrgSs={8Q zoOChE&E(fDVqJZ+_^S(9K%?|z4Qv@&$Gd6owP0l%>_y%&IxVx)7#jOLcGPC4#d!g42=Yrv!#JYwQRKph}ax;`_tIz`20);H(1 zsJH++i<8d1wvyoE7px2R-tQK>V~5{WU|KHT4=~~?>;J-zTfD!37u?D8Q>s%Z8#$yy z%h5wD_x>xdywB+ughWP$WMyPzRwT*3=TpiXGn-0FZKbMbDvnhisqR1g!-dcPCCh&K zU-?&5z+T@$$>=nPF5$IkC4LdF#0#)`=@RwFOYj1u#w%4&w-#zI;XGu*dusADPKoOm z8YZ0Itm0}4+W;2`1!=edNfwuq23(9Y^AiBwidZ$*g5O$1LZ$6+E(!Uc|#A>nDKry|{>zcC#+K%kF13+aeB` z9VD9p6UpVd$^V7B9CH{zE9`mIIchS3J(9JvNG|5m;2dy7E#^4~49g)Y8pA2@Lg!dK zg2BOf!)Nnef3=~Zrna)izq+0-OJ%Z4GBT8|Rd_LG9C|4SxZ~=3jfW$p9$pYw$y_dg z$>JhlV>uJMiW^X%#R@E9a470Q>roqx9zaWQErSDbk~yp(uQ0DT&%cNvuP5iE^LQ+u z26PNWna=x2;dpDwYtF2PX<;eXb5R_ zZZpZ*jjdH0&h{xRQ82^3_v)+fai0dznTkb#fpNA>TZj!$wMBp(y(a5G+OcF=O-IX7 zI1yn7^P5|gEmh6+^=fi-zRxzcYPfTi=c-TFqDL>HS)ZW?kxW)_xu>W{<;ZnRKUuRK|0& z{yIfL1XJ`OLv>qeQ+d6Ac^h59pu}O!d{)1 zv*gVuu9H;FWrMuddxQ0v#UA3Pz#$I+SM%g3Mhc$GgAw6?7&+-zJQ9zbG>QEFIth(L zBY*uBja2)zlewX3ESktVZS|5(mkM&oHz$Xv$b>E&ZkH^c3ZkKeyP{@`J>81Zl|K725KKL~og7cTUw&+r2C zUk9>oB)d(Z#5JNP*mUmDq4TywX6_8%+DKj@yYsN}P;F;x zs~Sy06X}*#uDQ7i4t1y4@e^&gBNN(#@|4_eym;lN^{dj7Q_?EUGMmj-qU3N8NR(vr zL5@U0AW!DyaDfW~n7L>qoU7ycb%~=uC}_($bO;~RAg|+gl_}Tm%SPM9pFM`C+p(U`f$Ogj39`p#D49F9Oe2B)Y(1=eW zw)bneg>cL|gV(T-@p*5{tE=Jcu_#{Qxp*GXIvt3kkYHpQ3rMZzl>31_u>s6-4t1k$ z+%4rq9}T342VUdi$!t^dQ!_JRmu7%?geCz#$k7y78#|!3og3_v;<;Rny}YW5!%{qk zYr=}g#4>emYj$g9vy8LVs?h8`L_|TiBLNz~6T}mIn`7Q#x%%eXmYM^ywlbt>Y*KQW ztPgGNM5|#@Lho##(bo(L9oRr~qe#cANDc%f=kjIw`MHHTDlBJG(mA{ekB4g&=UR+@ z#y>k2b08anAWukZCeRZa(ch0ofCOX(Es0wN+K`%qt+#QuZ7_-y0m}#2?n`dsD*wD% zU9TxGD=jNm!ZzETgs?z(%&2dH6S29assTs?*$2o*DW}7G$(=zkCn=n0K=g91j%PTP zO^O&KdH%vD8V)3XPz7L>;2B8w07~qv;%G|;IoyGV`0yOvTG|Z!pBsQ#a448*<@V{7 zdf2gEhBIedl9SbV5}wF0Z(rH8R)gfF3J%|GPxzE<#INuQA;=Fuj>54gr^1)E;a_nA zo)4mW8(@oc8NVA2@UCNk;D%})%w{#z2H@ok=K_g?v+@cKVge`%egi3pAfR$7s)V8% zDeAC@I!=iS?|Kv_iSmi9WFEB;;){P5Rf%dKM4(>OC~6j+5}g+P=`qz~g~xw9Zi~l? z6U67mcO<+dT5?YEC%uhsrC(z|gAE zO*vJ0Soy8esY(oZgqQLER6n4etX{4*s1K;GsNYi~jhAMuW{;*_b1QI4;QGKH$2>CT zA7i<(=f?Sr+dQskyn1}e_?r{PPpF*GHsRt#zlr~zR50n=$@LGNnX+igA5%|F+cqs@ z+S}6~n7(}aZ!^p@%4hsObLz||W*(ijYF6oN$QX$5KDr7zAHmywn^DlpJ_O|_m=Lh-A{Et-MyoGSNERokiok) zBnhB3NFqWKByj{Ii5OXtL=iv-I)VcRzH|jku>?yL&Y*4VU{JsS#rOmaeBcup%p(vg z?BW3W4M&OsA3!q@+*i8Vuj{V(uR|WXD@)op>iqEmJe@|bq0uaUO$x21Z|quaWJ_xUXAmZ_~hhx4bGFsw0wse^@d)0B zL-DjAP%gua%Yc&7*ptG~HMb>n%yYV^Ir+quNu8Y~X zOsAO}fxX6IZ{=QTe4}1~-O+ORpvERWcIMrGol^hUixhq6Nu^Kwy$j!Uz@hXT4-9Ss z-^eat$rCh}7lHN*%g%HL&}$Su8|+c)fPpL~YD3OWLx-U)QRDO)^r8pth-2Z11unc6 zgng%-ae6tu=(e_wW5-~S1W_f(E39}MY+<0HH}t}`?3|LK9Q9xyw$l+A#;7pmon0@m z&K*)1ESq+ndV%!`g!5xSUcduLyEub)22bZfY4K@?Qx%R1r~Nu#$Db%*0|u7If<;f- zZs~|Wl!(S*4>TT2kOs?S>p%Q{+3%`Sh&B5C`;XrEP=ho`23o%ajYA%X+By!lcghCs z(t*>G`3tf5iS25v9E+7>u>TlY=(eddSF1{x5@z+(?=Ec9VE;d`68_zm&3^yMUl5~Q z0Git}{%n4T8P1e5L>?Gep2ptkLk#cJzMcm|(|{by6<_nIywA5V(E)G8Gcom+3bm`G z563%p(Fbx;4q8>~c*j#Xi_WWWENE06tM5GgA^R;KAldIYrnu%>=<-IpTt0YLpJO5Z z7ka_5=ykNkF$!&QjdCo4<9+{Y{}-4YM?Pfn-Sr?2iLE?(P=OM*pd0w2DX66fl@N?-1iD^%I(}!F>Y{#DE3uA#DGd2hEe5<#MzbG*8eJ9rAVS*a7>X z{S`8p!61R*K0CV=3?EN|rl+Y>-AblM$u#nWsCFL|0B zfQG|)pZ4~I6JVA_-Cz?4mQ3W`hJitlTLhF*gLObK6@qDS+lA0x(4E2J0agpr&cu^; zCO{MD_+OBcSu~yntMX9y*I=$xBgAa|S3PuJ@wbLP?TrDFLn7oI!1w?W6b|fFfXJWR zs>T5*;3zvdesBW5jGjNr;s6}*4v+5OI|y>`@(7+gbxs`u84}+uPY@vw00iu76xufo z;xcky3)%Z&;>+Yhm+!$8%J?!scS9CB;mhtZ2z){+m9XdqJo!a-xeFw$i9EJ~O~`HB z##U^V3ifpbIY!5;!OjkR*D9R>68VYgd@_*MUtkE$$-fkUxcc07c}E{~7;XvDpX)Cb|1|XFuvZq>JsB#)PveQe{;jxBiN^8{5K0jUrRqVzDg~18#Ciz@>FQUv zymy! z&*Od810Fl&u{>a&NYRqnoKmjF>yBohOh1`&!vECeGZ#-?l2ulhSKE~}#We+0>ac&U zetlbytST=DEOI$HMPT2?V*?FMarLpa{zkN(ZYfS}NLFDp%px@Hdbg?*+HWKXULd8 zkEK16c|6zUdZ=x9l%!V#N--vs)1Y?7`7@ zUn0ko6}wEv0^s#bf$8Y;nt{g#G6c;O9Rxkp~37xp$cQT7Cj!TNVhT`^& zI&4Hw_&KKS_Q{rzgsVT3nbUxjS!=s=ByFFeTQM)>Kqhz5aopk1G=ntHm(bZMG8dQ$BhNn1}_Fh1}7Nti)0c zsT@ogRyZ#PtP12$h;{@IwrJG15JZTZim@zu2-s#H3a(^DF9b*f!~-`SXB4TWX_;v% zT*RcM)i;-FDx{sz1Pp>3(E_#;_tAw?r_B|uIG=Ss?X=o8Z{QexDBE<7`o%{7?Ua9oUL)qyK{_Ai_VIOP#S7N&Z?ckpe>SiZNU9u zm_q=i4bJZ5(sVGj!PB!f7mo=XL{82L5inMgk&7V{T*SK~8Nwgw=%`(Z+g00lwVjUA zU=<3WUD{k?Dq6tekKu^y$hJ1`S7AGt=)v}92iHh2woB0rmiQX{&w_)RM|6e?WpRxG1qwgX1Z!msyPF7Ub7d7P6Vlc}3fyKQX z{8za}`FR?A4PT@4^9plwl!99goGkcu9*=ILU}-~rO?{;X|K@0ah;2_8fQ@>SAE*Hu zm0Ehb1*Q3A1^#G9oZ@s=Z~7@U&T;h6C(|Pi z>r_B2x`_Sz(lt28)kCN2v$jPmT?xPQJ9rqtDh3Y{nDII?+Y{^5u5Q$qRByH=X89*( zW+qsbz#re{>&mNY!JH4q<+i%|_71QcjvmY20Be`s_Y9ba=Ca)^9*q@#$RFGQTd(6C zD%WBR767mVjOD@V9ovsqp^2K>2HSzmI?N+AtVd2c@Vk*_I(IXT8ZbX?y>VB zUjx`hNA3vvLF4-_R%7+suyd>U8$5c5_dOFpf9J3&TGE@)C^juSC%r(E5|OF3M9T2A z8F=ALyha5M-v?g!X1a!$w-VTSu>AxDq`vRwfu|HHXh4~0-SQeQgF!}1ZYz~VPn9c zflBaRv=`n3Qn*Usc#Ek45eF0^LSR7lb6Mh?HnDpSg`cyk1F(JR%Ob?7Vgyf{qpy_(zgvuS>Vj=cLo{pa z>7>`QufDBBFQFGv3;F@B7jX-I>9Oo}NgLE_GwF{*7W7V4osfp`C!~n`D{ zw)N2Ge`)&ziIhHfGEX#uH_&MpKf(LB?vesIuAl_mzgzL^#-FF3QCH;Vl;)~*24l45 z5hQEJ5XpdL?T;vL1Qt`RP}9%>a6BA^|X!|NjdB_-jxI_CZ_l=Idxa zYiv&H$kZH3Ka|;-Ec<2Ut6=@}QDUDhSUP#7+LCO}G^NX|nW;%eh5%56KxP0ZU4iv*KA7w1xTwa7;q_g#*D8$PI$hF$~8E;@fbZi2er?M%mste&UVe zXw>l^U;pv=3AlcEd7Zho235`~JX|gRb zKMD8VG5SSkg(gI)?#yI@*VMn7sL4H8YOkr6)!UoP8&pmwgM1I4LNhLF(2)Uk4S`SY@Fxs`Oc(;0h69>rvKnWwBS-<;xgEr(x6DibxmxA2GpmIW%yoQloTB&TirQB-&)3iy;JKCM^{C2fZQ!-8vmGcos@_>` zs?06jUahZ9ZjxoybQv>rMOIl>wlW*yIdawc z1=gI%9Q>fsugF}o-=uuC4DGI?OOHNR`nu}nH;VJ$(-gdSwdhq6NdZ#d`u?6~~Z{9B`t z1-wD7iVv{1TrJ$)^S%f-D(W5jPFReasvb;xyJU+{ge@XLF!sW1Y>t#pxHf&n1 zT#>nH|1Pz8XL!_BlgzYrRr(xN=QBka^;w~<(os*A)DqVV3{f`x~wu*<2rlCTY(;`{I>jL zIg(cYQuReK+EM8DP0?Fb7i+$1ey6Rcv#0a&>5I>wJl%P&@mbk{muvs|59Qaf*EhbW z_U+#I{v1%Pj(mLjABWnTWxgjboH*Xqepc3gw(i1Z<%PWN^t0;pv+-Sq_cH?QCUG% zdPQ{U<|=F`!^+a9%Ut<>^NXIy4^bDT=A~pM$7FvlUt%w-s(;S!0?Is#=3GHno8CWo>lpI)FKe$jT79zST+OkX zwj*_?YR}i6x1XsyQCHPo(E_mQ%IeFS(o1y3!G*H?$*YP&RM{3=S)>NP*O)ZkUffX9 zT;l&u;qy61(`3n|nI*aE+#T^)mAc-5XO|S1md4@P{+a8x;&v0(YMUovWmkUrJ&Pu zXoQi+mlzyVO8Y8*2502splvA@57<9pE;b(RGHHC@z@yN7Q&))11UB+fcs{K&H5xCf zKDlFG%!H&Hbw@N1lr{f|?xO7oSi+$#0O~rDel$eo146*S?V*`hq6(0H%NP%`pACJIXr6*_&%wUIKAOx$>g;p&(WnhH6fYKMq71sza*elGHFyzT zNPIVF5n6Pb9n8$&3wSgMoXv3B$C6Mh1fewGk~#e>zp;A#;b65xG}uIkv|TbiuX_H{ zk&Epb2jy&{55H9X#uX)4CZOX@#Zq2#rw<$&plbvIOi;aXCP=0bJUn3c-RxUQ+%1X* z{>fL~SNpafs_Cq6Q#Z8rzSI7;tgaj)tW-6%1zF{q_Q!hHHYCdG6KgDHrSE2tnfv2@ z*#3!n`zLrG>Rg06WEV2S+hbHQ5ecCgnnkz+d`6wy7t4G@cPx&bJ`uY72A&*2kiR() z6bXoV6U+i~@qib)t=M{V>dOo`ML-S4(`fXOqhDdqDM`!8!N1|({Bm;AN^(==Jist4j@u&|VHkfH@Du$@Qy2AQ$ zyS=B!4Apu-Qm z??=AR!Q1>cw5nx=g{6hW@|2gSS+|amKUv#qsXH{+_oKfB=iXcIlJfGBa)=elxEVFOi~iUHd&I=pcASXucdT%& zI1%%L?ZgRx=S$9)Xz&P5Vg--jbHH8UD3D7bnD#I%oeT0z8Q3~q@{90U0|W>Iq7TOh z1NXBNgAP&M96-(t7<7ax5CV`lsF`;0Kr{)mF%V-31dg>2)dn!v5Y0Px-e3)^bLR_u zAk-tD0EPi=Wb4oq5)tMOdh~ZfmOf-|vv(;;YY^!I0+^8?SJRo`dC@ukP#kZu9gS@X z7R zCS-&8Ac`H_`5nyExf3wSe-KjId?+zTryShb!;;qltDAkOl@Z$Z084;cCoF^bIV@Ee zi3{;N-Umb2864mq;zq|m6=t(Nu}cM>#x8r?A+v@+MLw**Gn*WdKniw(tq8euTdsi8Zq0W~rrMOat z%m0Qa9T0xxB&|C-8&94BV}cy@fj6lSv`8TpH^P5~fbH1MJPwr1O5YI>fq5L>0N%zO zpw)L380LDgt&xsGhe10dgc}3xt5^u(a<_ofE8Q_ik&>4J5mvKj)0vr&g(IvQf*&EM z=Wz@dRD$rSN=YG=v%iJN&b$_g?5u8v$WA1*LC~f?kA!H=1=V$Z2@4m*i z!)jf11|vI|n8CTKI0gr=6lqxSh(fRxsD;zUZFwYAz1w8iX;p%+pFb`A>8H=%KcT*I z^vK~Cl@~X6uZ!LX%cM?9PfXsuNtT-rdYCFNudJd#gZ+NZs4Z-@H~OP-Um>6O(8DSS zoDRl3UI$DI2g5tT@K!iGt*{MN6a;gygZes?bp@Y!A_yRcap%RV1Aj6_&7Kx;2d?wJhEtaB~olpbt#z|334}xAjCm}zo^*y)xKLutVI8W?{JDyFB1Q@ zZ_8I|ht9Q2;aCbEKK)ESZ-CDnes(Q&ErZV-ejfVF;b+G(wNC)OE>Uz9__G-Nz3=RO zZ6z2L7<36;qB{jz2UcO}R4@MkgsPa&d5c9es2Nn#RuU84VO2XdgMo>XE1Z^x!2y&xJLkH-3zbN3m%kH8KljihAJNb-ug>0nsnuBd*6X?d6;)zd+r*T zW2CS(mmnq)+H`6@{E%?I6J&tp0rb`DATh%L%b^w|O)E&6u#ND-5T68qh?oB|I~X|p z2@cFJ@H7ifZHSfthPe--wSjaqP6Yd#K)hyrfmUFjYbnTCJU^_5+x3N53hR# z%hh$(x|pT}S$1`GUZbk5zWG3NVQWdVrl`BPyIbklk4}H?SP7qr0PoF%gUtaaGMsqM zLWgx1?>y+dy%z!%qyh8|Q3L#d1ncPA3r`1b?*eB7@SU5^Ai{UTK*kTiV-(5hX({SM zd~#Y-s|GzOZEb1-=Sncs(wLU4DMm9C=_P4d;9uOpB&F3gYEqmc8a&F?73#_=d%0bO zOpM)LR8XaQxY8$jL6_Ykc&_$lHY{ri9Qr?lgOz-=rM)PkfMXZbcU8L&C61U zPD*?Y2U(X+x>f4h?fglZc;v8 z4XQz@C<#qQf2!cj1MkmH#g|cl&Gf^j-P?oJ;GFSuJ$4<3t(D<3({U9}#P2J0<+>`p zx+3xLwwx_^=b~}Sgz9{Iih9qH1F>&>{Td2=L3RG-`qbw&u{VB6y{SUe(A4wqAe9D; z`f9Wr?Y)Yw${Ma#zj>8d_#v(fJp@s(pg{&fWG{s1xT8FPC^iG04cu0s8#oI-dO3!C z)ukmxrS$QQT{BkW8dtF1<*URuP!?W^j$vPQNohq19dkwZ{d=g!5q!$w3*la{n*$Ow zUgQWyI(rdKs&+03P}IdMxon^wJ+EegJG^7B0Xxyc%CLKZ^bQ;6Uhr6Dl5U z*PMIqT+i`;$Qlk-w;v`8L*z602~b(lJVNvDvqSXW2=x9Z55$h2lomT!MMg4@`|!bbNtJ)t8(lGj!JyO57)!Bt(Pt>F0vKDH>o6MXX+Gi=;uJYQV7SX zDF7jBiywIBDywp93TsRJOKtE~7}!oUH*Z3GK79S*zYT3e^>CeVRgw<&V*iqIh%Zr9 zSC>^(g0^$Bwx+V7sNNq3IoG3kXx`16S5eTqtNx(10=0Et1*sM6Fn;`rt0#cl1;ImD zSRpS5K1Zw^3dHeOM zu@muwpA$d5brnd044QhC_)A~aod2Qw`&c>N|F)9h5%!0F8W~ zOX7qE><;<;HLE}y1wH9Hs3Sy80@-H}q@3Y{UXUS<^Hw5*49O3md?gc|=`UFU{A{4D zfsjB9Qhx~vM5zLGEd^u)kVD*p1(97&Lo5)Q4r>Qeb258EQC(D1Sf$265MffCpAA7} zu0Bx7gPCP)Q$bU99Yk<~t)Ve9xh6@Kl$@ImT2Y@%PG@Hoq@^K<+=iYnHXFSjIS=0spgd563i}N>f zk6XpVsBFQsxjg;O?JtUpi3k7a-Q)VbjFxT zvu)6pLrfF{lxH+gg0LQH5P-V>h`o9|_GVmVuA$1Ut2S;}6C%w{$x2C4(R#2LTireA zGXTz?AH*3;N=>Ee2jA~L^BMn|dECX&Z;-VqG#0AMi!9bMen9!STMt!W*k*AJ@r}uQ zOwxJ#0$W;D`|_L0>bXB)X}$J3c{4?dR8nb)ib(I>Bhm|}!`AHMjyMjLHP^%~-Mo6` zw)brZ^7oZWu@o)zM-Yj0asEV>kgepk&VHgHWG&VNHI`!fX8XTrvGZR*G;ak; z_W2{SfrA;dl|CgNoxWurPdk&P60(Nu^~V4|r@17&e~&0W^3bDNU~(%E9)-op%uY-c z!!*o*9Hxl@^o{X&85^7#&^;#N47#r>34Hv6m?MO%%Dp&A&K~$gK==z0Z!KOreIzYJ zA#wr=C8jcPn25upDggj}Cvm6@vF=Xfc`&lY418P3?p#c^TJ*y6+{M}Iawy-Ig>1DK zY~u>H*|&zM-k0?pe*4j*+qWO>+>w@4$0gOJ?bxYe?;qVB-jj3QZPzMy(gsqpp^5YA zFX&!-O}Fjd=*mbQYb6XH(N}FJ(GedN384c>e;Q10bUcFbZU6}(KwzBws*Q6FYaiCZ zZ#>h|a>fHt=4mJiy?OObZ6j8`8bz?L28{2 zw?jE)-rUJk=AOM;r}^|8;JYqI*Z+LN$?fbzkl5X$ltsyf3BcYCtWMdHv^{aV?~eVu z_U_y-&9MQ@s@g$iq|>$<&YF(d2q6oj0kB)y(C~t={B60uI#4%?j0yP(YC21tkd&N| z!6z;?Xbnq3Q^JzN5~<{SpB&GQAwU;D7aGMQZ2-R`&61Xr&NZyxwPDBF#4vqW>NfgX zxDR65@rf!rQ<9LESY+hLz;MUbg3zK+-;i~|8$#AgK|X~5LkN-i*M)PyeIgfQ&ov|Y zKxE(5B-QHcQhlqzLP;5J54mbj=OuLx1%qt?^bw&`B{My_)@>-2gp*gR(Pz9{PZ%WcbGeJfMYUJa}R{xq( z!4Wm+0@+>hv3$}5nLGtwdB2d)!dJ|$Z2BieX4oF0#rORpS2BDwoUT1t*y&<5l|L z6PbO#Ve63PCayBPXnBxIzSa7(#u8(Wjs~D}bToL~v?1%ZN$GZW z!(kqL9+nsmT)E>$aPm%m1+I3V)#N2Ly7HrVueeoKd$91>F;#VDO?nmAaHRC?IaN1U zZ&vTC^W|P??H8 zt(!nK+>8$!$*cVzZrvGPA673t_b$aqj8zAT<+D#>a3p8$?kzvX?;}qU@g5?BC5kU9 zNte%;U|{64t-UaPaW-@T5p?cToA-<*J~B<&ohWw)w!cW5@;|KTS&P zdM@^C&=Jm7WvQuF;Sk3XkA)rN%thJ7MXHv_mUYKCt3-bAB$=I!*|QU!uBKhZbP#=E z{Sx{zpByqec&nOX;AWqEGK|~B`?q~EWY@agEBCD0xAy$>Ep+Iw{iNP-%OAfs{d|!=I z%ex;^FJ#^vx*H}$k2uZ0HJ)?}>4_CsabMZA&Jc#Ys@R)F(Rw9Lnly(JKiTo73>MNq zq;8P#^nSs+0)*yGh>sxm?VNs(q>+3~)5-AR<@jg7zvM1>+fC`5PU709ONw3o%D0y+ z7|mswByTJ^_0cCMPF%l!bkVeIUby+#Unxi=_cmXCea8A#Yhts;gSNn2s#9Pz3USvXoF>* z1qz5+X8?tr|2n`1gQ*WEI3#r%uqSZ+d-PuzdxCevO7{WvelUFa4`d{OX2>D4?1)DchD@fD zkx%dkAp|kmQ5vKI{Ml#3kIgO2u;~m?lEMpM-UP%pX}gRT#qSnQ+qz-D6$q_np!we% z#v?kG2bBWvH=AG#w*FfNQ__W`u+YjV21KEFU3k~oQ%RRJQ(xlui|RfS2y{pT?e^Yl zoa-{#q3lO}fkjxdhI{XB1CWzLfSViu(}yU&meJ<>;tZL)HC{G=GR2dFGCGgM(hcOp zc<#XBrr@#!>B(h9OJ=BM1i{H1Fk=7*NWK%0{1(am0WAXt1hurZ6dgNxgexm*+I8T# zlzdnWQp*O$sKYg~>3mgubySt5{$3Fhd@G5fmb|miIhNGRb505zc}JO(V|1k3puUlv zVK8KvQ|##wWHRMgrSb{-)fbf+_Ed`@!;qN;Vuv*?H#5f~&5~GivT_Y}>8uM%b55o; z-2&{m$(U)(uo!Ha)=Zn(Y?0OnDswC*yTN9#rXh)#k(r%lO}85C#+)1}!T?>BW?Q-) z$N&gO7?C!&r8$gJd2c<)gch?+dfA|~r&?1?TuPcDJ&%jV_J>m7EhjX#&CG}$0P zV@ffmr)Q^Sg970&18-w9*`%(;t~pG_3l3q!?yMtxnd!T?G&{m;R=oLg7VQ$ITGp7= z0HX<~kKqLViyF`ZX25vy#L&qLUWauretq((&qI0l`2SD>mMinB4LhRCn7V~eVN$Fu zP8}EPK`3b5+K*vxxV7R}@zhr)XmR%Is!M9}cy4h%WV1ykvRAQnh@pe{fv& z4*p=(dxuqWYvqlw>o-&+{ZrCN-X*Vc=MP?M_+-0u_wDcZ{HT^2{IRNumXT-n?|1B1 z=UB5$IlSCH!4a1o75#4VyDL-+@C;qngg&E|n?r_%!H$Fxa>!;Y#Q zJ9
    g6hQci^?554dATb{-)j(lvyL)qjwGIrcmNyA&2j9QlLX#>zGk0YGw8Y0t7} z+PSpKrBzXR^BU&X&u^5LYzx}8W!6yo_5yY2rrM%#o=*P_5TfpV$aHB!P1v68r^wsi zT~yTvH^kL(o6l@H7j!ncBI0PIU5a>aR+@U_l(_iK{L;vv`C;!$gXTofeoHlI-^ltA zT-B`Yb9QUn=r{!HR+Diroen%7dND$}<<__Be^h^bp}gTdf2j6ML*-FvabwA+ds(pZ zfy~tgkh^zYV6#uF7?F{H%UG1<8ZSdFz){i9u6Ud{1>I7Ua+C0nKW(N#L#O8VmTb*iYcu)G-VbL#WM zVB#}Tnp{>JQ?dU;^5Q{tb#;WkoZk^g`b@ONNX>?@cw$|lV z&JBAfW_sGk2aaE^xi)jdl+Z~D(#vy3?jNKE2l!>$n@$b0gjsPmDvM|;F6?1sv2^RQ zIPGi|?RvKFzvprb%}a_`)ksZQMw5yTAzf$>(l?k(3k}H#QAb9ZEm3?k?uKUuk(V;1 z0kjJRW^{l$G%VY)jeiZi*l`QV47KnB`AX0W7+4Y>~o`MOdo|%T7~g ztikuX2)V9J2nk6(w;zD`)Jvp^Mu}>^E~ZbSS; z*Zo|tkcpTS>s^~L9X82BTR}R4cv3St*PGj)R#a0_X1e$m*diS>$m?OMsKW65c8;8T z2qltca@XV1dl(1Eoof*~XJi8x{H;z{FSP9exv)nilVk%B2LX|SCB|DoZk;N_`j5Ha zfm4p+ZCKVh;WeoWp z!RedSOtNVSZX+jr6)3EAuWfXHB@Hz1 z*tT1Z%x77N9dMLF)@rHLlYr?8v#Bd{f!E2LX(Zsj_iYzfEdpHoG0XPApRP0j%oYmH zH372)r{QV58!G6OWQY(cDz%mumZ_c9;s(E!38L{r&g!da&(FCyXaHh zTSq6V+pEPB-a39%*a-$kimsk%@VZH>T5DAQEB)a1F&9uXUySp`T0k{@LV^lE`2 z)43IDw=N!0st66~CZ0kgZqupf=+wI-NWS?J>DKd`AvZoHk~h9?2HX3Y1LW5basVP9 zQ)yo**yCs^M#IQ5Nb|UVQ_>=`oZ5(p+IL7vwS?Gr5E~-s_*B}>pE|w<1xf*0YgcA) zb+^h|zWy3{CmmLekB({(b8c4RO;#JZO1@Pg9MStcc@vM`bLbNKZ5zFcKtUEbn>}!p zZGeE@CEuw?1bqojhSYJ^d`n@WYLZO8n}rw>Es0jd(eU;o`W^ijy-SPeHf|?YHBcUY z)exx$>suGuI|zWULPQ5 zbC$6U(!zYx@m+ZgR#f1G@P}<;3-h&yRYcXMlR3+L7SdU1o=tqqqPM5j+R3bwK1b*r zTUdEiU7Bxg`gVI+Ir1)?57IN7D50=CwOnnpXJ^~^T6;x>t@a3+<3naGME9|wFZ*d} zwF}8CA2R1it*xTMUh8Y~{4{B|)9fZ5g4hilQ#msrtNTrC5pzoQab;fOx*LftZPakKsXgDT($l>er~IP`$3R?+c;=JLVI z1J`U^Bi$S_ZTK?gH^FH_7yfoXFF)82agksD$D=KztGZQI*;IJI@}88uA%@nc6z-8f z&wl1HB8TrijVRaR_cE(h9`ZU)Kc*b{p2ZNI8;4W}8t*dcC_(EXhsv|dEoI#5YTenx zsv28OK_w^O`g&kP^nnjl4MiVR*0AxII_LbAPcB~g7-E`YdF1Pt2Yg5rs{7X(Zf!qC zMY;m6Kv$qEifCN8Z$7x-8rmP{Gw&kZa0ST8=C{0gFle| zICm8pPgQEhS_q(TthBExUc+O2aIMH-yl~)+Nh$kX_>Gp;g=;G}NYP;~* zEaC8zOa>91Zz8H*jAQmxTSL=B{HoWhEVq`3j^3St>Nh80zDn|K)IayU%^FdLA`hx?}fepwKVnEe6z~QsH)z!SEtlSJ~ z$L9`@rw}qxSe0ZZ?E;f?u94fn1iwd}5N|Rj@NzO|L*?4S)fSvu3Gv4ONTGAbVL)UE zVz_0J;x()6E7kOk0N60YsEUkV_2XRrgJ6v5MkzYe7;<~sG8Ju>u%5nx=sX((KqW6X zJ*c|K?fawt5$WoQPW;bH1;di#y$@)YrIV1;kJTEJ}_u) z^m6s)mBkg?JU@AF6T54s&A#|ChY@*a`T(j>4+y$;YdaAgt1jTH3#tpMicU7-E@_sw zwtRo}k*Yx=|D?&OK*%B|6xm<}E=lxPfoPLg3Koi|I5P6v=niqTW1OA}YTNLTi@3Pq z!DSVGiT8Rc*ojLFcL;vzvf1T9JAemRW@W%KrRN}jqujjEH*af_w`GD! zLeWhkmhC`eN@d85;c?QJO>>Spt9L=(xV;sbuabP_HIL-T` zC2wooCJCsBb3KFN>7F(FNn0GrJWYBNxzRy1Ao~`Vm6sMD#;yUR^Pr-vx<5;^t9Fw< zI15L}l*a2fQ>s4LQRg^Pk$WPtf=C_mo3HHFuhz)F#S_`?E>q^)kyOga&vaxYrby+# z;A4ov=A;=x&dA6}sf!Pci8V`eO=0obsuV*~R$5A`K0i7>Cp}STPfo~Biip)0Cudmo z$>}+e)=SGUXBQ+}Oj3g}Bg3G!Ch8MXQj=44shP%@*rc$AG--C$W>YqAPO@%_EKIhh z@5s#0EHGuI79_?S^YwPAr+a!^9Ng!4z21^pnvt5DWXd!o13qs{%-b3pZT6xJ;U2$c+|=1hQhFf@a#}&RNS@GeU3Vl8w=o zIr*lH%*;$6$AWqWc~JfQB5#5|kBoKt4C zLEIt9o(T-WI!k%AJ-0R^*MN2g9M|Wk7wF@Y?WV>QL!#7Xu{v_q4wE@D$50ejb1cUg zW8V#AlRYy(JdqtZV~;*RIXfZ>Qpa)SiShVk+HQSHat1K=2?^2Jv1Yp|LTAii+5*N@ zW3pLqNG`QHwxpRVEu~o%Y2Fr!43)Ura%|<9He*40cA`a}6JHosnrksvK?)Sxytqf7 zYELQ4&CAU%w^)myV;YoMs>&<0m_~T{??CX!>wb7{u-r6zd;(%Q zb;&X5_$@|Tjy)&G?l725`BgR(epg~ndQM7yW=@LK4so*Tbi1)U-xM#+$uV29RoMx) zxKcB;Aft_$TzX2pImM7^3Xim8CKg9##o}rMjWaDZBNaa{Gs6&LFy)!8`MIpaxQXe= z$DNfXt0^yAWhyDnHx=V%Vq~n+;(~(wf_zJLW|5&Lt2U!1JH6D51T;>z)sAG49XyXb zTV-`YLS9l>Vxc}KH=`gox1=mTs>D!gu%#F3Gjb~I=4@$sPOiQ%xhT0R%@~zuv}Hmi zJ|iCyu-E$2ZqukHoZ0wEe&V3cm44zt&~92LX`DX7>q`3KiI>_Ikr&(FXn(_pW$+&% zPp8p1$2rG|oZW2*U~mEk`G&}0v*+il3ep|PcCLBWz^X~= zbeR{?1gV0#WITwLQ!n%R4F%1OK-O4fojrUR7aT~IEJWV$u>)yb7AEy171>LcO(cr; zR%N)%>FC<=2O$xv&}nW!#3s(K>sKAJ8E{a=Oe!PUo$TX|m6S8NaajjR#~CXTl7-~I zr8AHgvNAm`rpg7Em>HJ}Kde{7a4Z1_cPiRJs1AU-Cp4{F8vxyH4{+Hu*oC<7W#?0xT2I0<9ZouT}fIhTo|C$-CFTB zU0irFpRBWPg-e02eSp})1OGvj+tbBr-x`k+NQeFdNE9_7QP{mC3Ol4p*_On!7xu*K ziyHE(jJ@z-&3L{+!%TgGMFyda%v3IM9OOSc^v;;7m92wuD|`>1YSFcj?|)ELnX4>S zT>Pq)sVk_u*R4o3m0M`-Xxio8vR`?k5`X;ly+eOkq^>jVFFaAw3Pcp0r_1qpp74QC z()zPM3GfJM1^mf$v>rq7y?r8L=59q0g4Z-cdBZ|#0iBENHG-VwcZcs z)1hR(d{QTQN+&;26TEgZUL%T)2}=o6gGo>ZtkxQ`mMOm0)~a?DR99ATn;UnmJFb31 zCV!#R@pU^kH*%E~)%iQ2Xqy~U#*=k)ov17(FMOM-eZF&nGB`;W8O1ej-nxIWnt82@ z_it_7%tuD)l0!P$$Fb=;vhKD9NzT6;Swq*dMxdJOlD98Vei`za_B6+~5}jHwao2eD z*oi^&wfwLNH=?g>*KQ_%`$LuPx>02)`435k8r&|i!pVE%qzRGfK4EGlRqgevv-)QHB|hY+pxxPGe?c%I{Mj z(5J3QPmSoe>s9rT@u7?6^Ya#kjJLnx=zXOx={!Zc;MRlSd+IaC^D7SWHdaw0ophVz zBTwx_yG=?-PfJTr@vT_7IDfwS)xNy3IsRFGx zr7EUS>PMG5`zXV=tw~y;me+KeHKk(zES`4yWc_a!&q!UM=*KW(r&8@5RxxPFhRTPz!2)P|SfE{$Sk_HUeR+pNao|~HMn`t&? z8!aihJ_w?Th=_3j;U3Ls*ST9oLYo`J$m`^5D-?k&Ilg2H;e=B6Kuk>3u?F)oPAi*| zVID(ErQ?m~wfsSopSUtn16rkc-I7?{I-cBsr#c7IZ-98=#4Q^(@a}TX#EKZz2_XS^t=*Mfh+Lt0|b$SfxsYJDFlGY6(B(i zPQ~LkCDS_qEKE)Yd%u#fHRyRFclCf&h=n}gIS0KqVHGPNa$NE8WPtL{hFkAk;*huf zN_1e|g6jEd`qc2@^eJt%_P{z`7~~!V8Y`5v)Rkw?R^mC`#=8dzgGBKq$(2>A{X2K; ztEx(gFG1+i{S_n>Y8Po$Bi?yu#Dayj`_^;qrOq%y?$5UhrJ|XaZmqwg2KDe6 zJO=YXLO{X>CqO`|kw5{0-Nfv{)E@*mw~#YIS{Z{hN!E^K&mBM&?0$D+yaf*+TvD+= zE}@7gyXkIGVPff;Xw_qd#O-h)a7wk_xGBPjPh*u0Qg+BhG?K;+nFvhnBE~_3{3hd= zx!U|SSq|Af$eSY`s#R*SSJ#d|z*#$FEl~~VFN-yIMFk=B254^bHbmEpWULknV70Ec zUH{7$PHosfw__I{>5OU7(eD?cc(9W=%JEk5pnJoka`Mb3K(L=C@|WA>)Ahm&Bb8TH zo_MQ-`-wbSIyvo0!(cGXmNmi}fym;e^y7@lMmX^%$HFRytD^W5I(XkHvnXWE#+fK)l}dg;M^M9u|=N`R9ecJtfHd z%CC+uFRduf$5fFd9&H*uTIDa6D<BsB~lLv|aP6mKD*Lng_kV z@{n}pp@_prRp+XX9@@|CKXkF;3-#AmgJ+%RcW>M?ZFip{qtCbL1s0K|#0>Do`-Y1t z*SWM4X$R8kCf3X;S(z&>n5ea{SJR2~#nmH*@{Fl69;N5<3YZ$7pc zo#amz9;-eE!QZ{xYpNR?t9KVSNq1Z+y!x4{(O3`UIWh;C6bxe5v3o;)9Db)eN*f$< zMv|_h{*;^L3y%1SdMa-kk0zApr1^2S$+WwQ-j=*<9h| z{ik^Hl=|me`BklaYt@BaN1Kl9+t*xouyj{ZbKY@09va91soatvbW1JEQkiOv6@{vD zTcN|jS*_cxAJ}(h??43)DLjZghst3r&8X#K%`m%~#4J-HZ^6B>pdhn2tIQs#UZW_8VjT<+r(+%4s}GyoysBgnvww{23nm_@wD$26ukXAae*n|i z?wYOi|C6!2{`41-K|P@3o>aimrDQ3BNO3ksw`BPyKbH&tBMg;}P!-bj1xXxPN|!Rr zKOIy`8*Fwz5$;zph?F*PE&W`F$-Lt-fbM;iv&rJwOo)~}U!aRGki}&21(7q%J>s~m zJ<>V!xQ7m`0X(hy_Z@SyoWQ!eF9Y(@q1+|Ou@ze^99cvbi7b|4TaKCx70Z7G3?1sS zj{BI*8IJfdD7_vg_r_&WVPOc)BH6!Gq}Aq)ovea(@x-t4j`1yGZ>~k*eLnV8^5-5j zL5p(;83RNq1O1p`FZLr=#9ZePYZqiMKS5-xn$*x|IOD184~x!8vx+Z$O9U?LXjUtr zJmQaT-TZX-!gr>;`;x9dH!AwV+h40mpI^vqvJHs?F{nywXaW+uljy>?Dwfx8;EQ6- z>4vC`gw(){L_-wFt9GgX!6m>=G0Y}7EX6`65YZOUK#+n?)3G#yX1)H#q2t@Qcj=Ur zz${hVoXvAWR!Ad1{Y?Lb+7sLR(%FxUB0V5!&=-$v>^;jvyJR^~;5KH6(@&@TS#_6n z{2S87g&)oO3?1+K;kP%gG%lJsb!9Kz0B$roeqBvo{ux02tz-;bk>?>z9Sgr|Jk`Ec zv0@iG9%oL2v8=)@7u%~X44i$K{Gr_Ze(D!^kV3b{%$a5Pj}W>TLSREi+|z+V9Zm`XGsJRsdT*M=Y9`QpK> zGvpy0%tpYX>9{W*C<9C$!EYJTYomDNxjK=7O=OH(cw0=>GoV^1E(|Wrsf?ChnbAl) z4+a-1JOaH|k`s$*qe`2&aNAOFFaeOEj=Mtj1rmFKATL9vT!#%fb36t-f-K!nW=@Bx zQv&>z6dH;^;I3tzR*ez9o%Z9k*h+ipG=bF}Rldk|7Nbh=fDuZhe0GM;K&{ z^yG2ahCW1BLCSD7Eg{eKy@c;8kmuO+mM}JcOz5qBRmaeR5iX}l?y=!TCcPi# zIi#V5W<0gYuAXIISed#89JTv+(`=N)g~jW`BgcL1gFa|PMC{fA+|E#52%k)c$U!2m zw+&D;x?U z3M~MeY_bNN{Z^s%E+8oLG)%j|!QNmFoh5tx7Yp2UZV>=zRJdB9M(NhNwU`mpFe4%u z!z4_Bg6r5U3!4e8uqh6(a!{}j!N>&035-k#uX*r&_~nSmyr2O}DWFG^#?|Ho?NSd{ z0-ERUHt3-%9=G9Vf>FT4$1#7yj_H`d+mkSlN8Lq>^Vl>$3rYhsSU=f&blUr+lXV(a zj!x5nU*`N+8N3-KSHoZ)i!iB(L0*(eXO8SOo_6-=pwrI1zPL1!rz6QTbSyIFqlsuk zZQ#z}Mrr#V1cqF#UGGf#EC9&%31a_+Bl`{hjf$==<52;w6B&YkkbacD`yqMiwHqEi z_8a7>yN5o+*Dx}N;C2~II!W(b{N^{7&~lC-g>(#gxqCVJ#`%EUl!uasu3k#|&Es(L zjkwZJ^ny~}^s{No=Tw9{dE&(W1Fw!pki?uNCX&y-_{qfkb+xnyE6G_%2)#suIe93Z z`bOVrt9W^n8R4dz;;fuO8IOB#S>&d0OtQ571FM0^$+x-cD{xy8WPm zRS&UL`4zC81!$v!96bh^{rO{oD(uMtSEIZLm_fKnAu;N|6|cbuV6n+Foe$s- z;41f_<_8AcUtkw89`yPxaiO6+yL-T%?2aNm)`CJ+p`jqf!3FQC+Im=BSDjZ@&hOoQ zWbY}JS6kdYP#B0f3@R6?7i?U%F_4dmPDW9r6+0q!1#^xRD7mN;lME>+J@^~_O_YL6 zN}?*!n&e2~b_GZ5SfSpggYX`|F>u+&1s&y&1m9u`p9CDp`meG)~ldk&6wMNxjX$$d;XJj0_!;fat`|IxL^gvNVqzJ zcBD+0;Eqs!`0nmek)uOdn{Y^;zv(cewU+ z`PJ?BeFBb&=)_-M0UWBIiqs=YlPCmm%nVWf%}nF6Bp!0we)=cKY5W~cgtaWL0(?%h zdKXh=V#^BbGub^%b6Ol5OF=2B^dJ<6bz?I9aM5C`V+p@7Z{?P#gvi9mB;P&X_CF({ ziq9uLB2THX4wM45@*!fsT>N#R|9R(SKe|=<1o1x`l_~zBj(jNlyX0M5Pea%q zSAi{2osnTOW$;e zA38W$(7_S<|3;UzA2mc4MpmWynygk+j=HQQuQ-<%n*6$^+lw*4y!Mmodsj~Z2%hU~7(MqZv0H7{yh2A3EY|j?h2UECq zK)~g+9M-#BGeI)8EKKc`%B4Nvu3^Z)~t&kkHb_ySnqx|fM@3xdHpDF=o83~iTjuUeH@myN#+!^;#!S^Fjl+(_1b6D(seRw5 zf4WH|vO;wcQORzc|4IGR4ZJN<7vk+ry#40X`UU6sbh{lix%n6KIbiTRv05rYxKMba4FSlTw?mw!(f}m(7FkOITv{(| zZ3g5(+5=!W9*Bq+ z04Z+6qX5@=?aRA|UK!8HU025c;GgR+4T+5j+N=t9=t^R_xY!h3xN380@QxTRHNg-Y zr;`6L{rHx1+}yfz>o2P>pWAn?jz4$2{zD{$Qj7QXh0NOs(lKyVf8K8_! zh=4S+w$AE+ z*!Xa;>f|WN;lWs7X4BY;R z)!Ub;Jw=|YtL*vZyt~g&GNF$|UtX0~t@a`Xm#q$67r~?XYyTEJEHKdNz_1?2GmfhJ^ib)KLJIiLyuCzkL( zNJ1tz%g!(R$I_4<46OoeLv98Vp<>1+C<7d33X+eB}u=hC$Vq&FDtl4!uQ5EAy})F6=!V^wt0GqI6g8gRupETL01|9su9kc>Vt>5EXVy`rPy zlCwhc#r6}eH&jf|89ZbMQX=52G-E#<7J;4Y672$jH&vWR-#sN2Tn++KO1pN2hA~ng z!2X)%?>CPX?q((GEuc^A($1B2wlHl)qWfF9-O=K$1n#XnJ;Pg6dIn>smvW3TkGmVY zwhqIj3lqXqdiwvm(f`lauV9u$W2kQR6=J%Hm?%2Iy8y_T(VLlj;e>k;1NVaU_Pp$S zhET$!PZU3Sfq!Jde|H=NY3bxaAlkP#f93HOf)IPwzAlrei5iH5xe0E@%JC5T?*qFC zuriYZ0ARO63Sa>IsRWr^2KV}DnLJ~P;Ap^rLvKJV53NV009CDMGom8!j5>LH1^_kO z5zicfD2!JXf-Oy$jO5NrL}Nz&9gWGh0o!V2(HI~3pC_$3`8l?1DH)2>$?PClWC~}1 zQT7ocuJE3kmDn2^X6$;RtstXsTIz|;{CUz7o(T(!TDnPv%VuZD9xM`K+7q-Q1pDz2 z+fbI>6R7dNCMYxjwF;-hyI^7j9q=4$Fg*m^XMM!nAmF(2KlLBU@UDuzf}yDExE=A) zV?~dk2bu;kMh=;9+}{7VB?H(k*(xDz?3N6|n+6YkJgWhdr6b7mKhZXHX9CXhM*IO- zGApZrHn(uJt%2%VL^B{tgjxOynWh;4(!F>_Pz$m)@*8+bwL~WxAPx$GJZ3`>QKU+! zHe7TNHgLEol`4XQs$>m8B6;I|F%G5^L2Wt!dt+V{-$!dxnFLdt2=8?*q^&^&p^2=9 zEDuN?7fp8!D=&bsi2}Z6{Kl+t>dDZXLO3Ic zDnxD_dul-hqm@l^s8~xjaruv+h7On|idw)tm2~rvD6~qbxwX0-*zj$cO96ZsZAEYr z?=3B-APkOqRl4mh}C`aJ4t|L63P4s+* zm2)^+>pEQ4?eSlpV+z-COqWiHy7yCL|2#;?28Gzb)BgXhAUW1_R-~Mj@=528E!n^X z`AC&;o%Ns%Jz#H7dEPpkad21%I!%XWs!b*|16I%I1v6ml{rAX@UvBS*x^CMLvgM968Z7RT?Z(? z)39>CJbpwLj@8206k{}9aN|$H&=Taf+R>0p3meqiIx2W0Afi>?dGoVjsQu%OFFRYy zG>?a5>+stE`N)wIf1@FWfstEn5Zk}Fx(6dp*0Yfsh|k- z*3LrWi_LEAn<7~td_Jc(5K4?ID`m^DY^UM2t3{ICi7`c&bhuvw0J@OJ3iw9(_4Jmp zV`j`4Gp1$6*PJ}_`iCuF^TK4R^?;@Sma~`)eUbP6ZiKhhzalmy6TB!HCQ^34Ra4XM{ht}1@Se6s2py`KSES^ zm&9_PItlXCdtY~NTVq_4xrR5zWyHj(q6^|GitP40J6Bu@`Rr;bqH&+1W`sZH8mjmS zc8(7ARd;}eP@o2**{b{!gWBUu$m92*=V{||n#s|zVhGeVegGQvt3M)8I`X5Iq?8Z& z)DtH%PpVIzu;iZL9UomT_z2(ph+rxz!RW|jCF!%4@B@g5D?8;ldscNV_FCX4939-} ztwHn|zH0EmyjRt|dg;Ua@b~DmeXh`<>cDBS6DFwUIp&sWxdF86T7a(msA!jb`poe@ z9D?;4L8&99YEnr4s)HJ^4}a`oK9NBf&r1}Bc?t6Zw-f3WV(wrj6|^Fu1%cbarTq%` z6za~cTFB%6!D6QU-*iPVzv3dqCB^31Ht*7D^bn682@jR=DTyh14pMM`iB<x=hnsaCE0*CbGEzC%fAM6_0vSa8o>|uwn#20$?zrMD|Mo80PKz^b0<1{ z39k<<-?UrbsNY+jzgzleu4u!Z3>9yOpzY`Jh_o|Evk*YESoYzOoy3BF$k~ccye6aCT8%s!73dX^rqou+ zbTauNqF9RG{60J^#ZnE1N(=AmAhP!}V4XNHamu4Tvdl3WPJZa>*?E(B7Ny3gf2%;_ z>!GOYtUh9s1 zC4bxi?2*vbtO;NiUz=G&b*QY3`F4PWA#30gqPRASY-63qmjN0q+5u*byl1CQ?QQ?H zp|j1qVSC4h-W?8Wcb27p`Zfe@iI|@v_zzf7yijdyni(L zBmt7pEkWGdxl1X3*IWLGlP4~(TeB~MRY3C86q0|#Y9Jkf`zMpX`?E~`O*HCbMX=gN z^2Cod1*}3A>5Sf7#8;L1MO8H{3gGGN3#SW(!9-z40t4OMi%Y3dNuN)qFR!4|1yV8- zg|E+&SB{cy`O+$xFrq7c-aubkL}jz2WUhofb&>QvPrBQr6!lD7-D{ux(!gL_ekf1o zND^}rt%)}2SqQN`e~J!BPX}X`gh|Y$CD|ovGT`2VxkSPjrWYCtGo*0miE0fQ_VEvg zr1Tw$Fuv>H#dO#>s@f+dizVr`b;j)&4S9DumyHK`>{)n1W&b@CY#`**kI3Z77>u7~ zPX?l6806F0K)iQR)-eoBo*FWc;_xm4g5;4JSBrbaRM}(rSuXIg6!$BV>>x9x;np_rZomuJ=XN^fV z#JZpMb3O7wEti;5!=+fC5<^*@wN!Z8PxOqBvv)fm=>cNE7GbN4pJ+N3G~keyD&0MW zp7m(Er|^>KiV3qq1AwM6WCJLcuW_I$LlmHu?kty*Vv~mCK+-jqaEosZ{Ec?qP2UQk zb*6YnLa{*#$?PnPx**?{Z{_WU$V8kc>r|-M>esbe_(HjKdBNKkfG@pD#?Gl1xfV$v z{e5lM?2nR(ut-D}6(|qBpYYyn2P(SycuKl%PlzpwQD;eFViH0Vc^ctf<~B{5oszKn z{Z+m~C;I1bccy4%TFJJ0b$(G!ZZR(`AbNq7e@!h0y+K`HQg<+oA1-8)zsR4We_(uL z{JPdC3u_I#qROR(o}7DfvJt2~cp>eIZHWoN_7L9?du`M%Cd<_-4z38>nZ~i`t5sc7 zRalkJI{{E)+Uc))%^%?urZ`x#cSY{Il6J)*&ufWrsyzTj7j@3NVvC}9;O1>!H*>P8=k4Jhd8DiBF3oG? z>Lfp(s3F6Sp;j+`^Vb&AF7@v3!P08yL<#{d0({`_uyDYlBj5e~P9CQhW{@(wjJ&bt zbIip;Glr&B45f{t1RyJ*10mPz{kr~!{(l+#*#h8Mza!tpmPQvw75K)0n7y6u=m5?F zfxB_zjO>kjeQ6y&PK_yuDvU0T^~Dj$zv-P0VCt8jJwc_OKDFz!FIDb#=O(56*-l9n ziRH1S^xx!;j~5C%?#(ASSnYz~H^-^Q?RxVRaIoLe?@D9K6DyKf%Vi{uZYSGsYijc9 z)O9r;EN>k?Ni7pOpBwo$)#iQ$JBB7NcRH3IJUllabj3ll>QA4#dbvbH`UY_ElfmF8I@XvbXNs#Oio% z+8VMco8Qsy5N*od6#{j0hj`DfoqO<+(;)(yXp9g{x^IM#%YAT!{6zC{*8wFVKP#^- z(#X%=0YK|ZWFR$?M49si=f9P-`xqK8E&_M`Rs~5@5#K(yXzvlTf;Qil?JnD=KKa3> zMZEkhc~cf`PT(w|A|YSg4RM|BShL3_mxhJCzLq)PQvMv&s z_Zi)V2r@$+iZyh)vTg3qRKiiYw*OT1rY%)9IzFU6{os45oB1~jZ*b;3`*}-_)GU!V zr6Z*)-bN+r$rE?n1l*Q%fh3BGbRK@bchCN)I)^rX)=pJzir5ma<3hHqOkb@YH7dVw zG@opq1C3s(JQSXli6ug~LStEGIsW-3-ngm1sebREZD&1SQ(aZR=Su(6M6M!|pU<`Z zetQn>%+YSNOAviZHR|)NSO55}!rZ)d2crH#O;e z{`T+8!DN*`tavCwk>+ki6mhLal8y?H9$8q}Y=|U6ujME_u}sn&#O32M1P%zv0}ud^ zO6}>%-s1%@|Hy^m8IQ>vW>i?ZKESH}%G!RN)ChN!DSOlR?S}-1r^)ffZ*G5^`|UT8 z>w)k9OWLTLJ`WL~8-)LTT4Xmz`8?DRJF)wGy6WqYTPf0f7La6JNtaEWQr<9&gECsu z?xwVT>c5YPkd*|Wmv)i+dE%oa-QK0L?)ot+_yjN)TOutht&S`mYFwIX~0 zERce}=s%Jh^UkQ{i$kTX9Jm(IQmDc?SiF!$UL6wmDB(6Ouhnx1ix?dMDCa)=a&5kF zo0JQq;Km?-gxIK$CwwUU!}{z3%!)$ka_BTTosZ$|!a|+_!?<}VAZ8lc417V4wNF0r z0LNA%hI$VT-S1AC?<1s!DPGTv`EK?@$)(#LQWa<;+ zRrIvjQDKELqu1{Z$_ptD>ho-q#+8EmaGXG7e5E7_#R zH6f-w*1n2MsF$j}*;|SM5h_3lp2GUxXBYPniZAi`iA9;fRtyk5(PD*Mjl3z>mgC4{ zj;RjJh|Uf815|P)U>O}t4;HLuWm#NN46@zx$51o1aP#KQd3*L`_rIcil1<4-&oHS0 zpR^=%T%NvVhL5-84(x?&3r}|5V&L8pbZ4gCl9Zd`ix3%dLXd&80n&{cGzy|~*lc;( zdA=3Gzph^R==`~}zL1AXxeLtKEf|?l8=gtNMzm1;HN8%*%WwIKKXv9PcMzWt;ydOS z=`UmHzs`Uf;s+5f@+$qBa2m2-%>KS1-n%O)vXn22v<9VaqEp*jeaOGXz$m=#%z@1S zc`78WEKug}Nr1c5xR(k`ed=Wbd-_)Mu(wZ(hF+i-d{8~|LW{;%s1ka5sH=bP=3MRB z4LbDoOa$(N55*rCS`Qz7i>;Tsm$IEYAHqKGXuSIXB4|b2L4OA`_1n-^_~3@d_1HCD z**-#CjDibJAMp}*Go^h+rVI&v{A&cM7m+u`h2WbnUPzXltRm4Ow;*0Fzn_-k4_WM z?RY);qK97_)hYQh#nJ9rh;=8t#BSfD52a>G@P{u&mZ0=b4U9Mdc@~Y9T3SD zJ?SgI=+a{81l6qdF|)VY#ED6%Ne14KWJz=+|N4s05J>7y97dOhN}XyrrUN{6542>Y z_=|%lZvF&1N|bEiiBVsyVka&*Y7N{80pk@DQ?xK1VL8$t3_-o&#BJ2>&Ah z`kss0TjWOmQ-L)XC=<-jm65pl|5>=!)r{m&yRJ!dLh~w84CA2Ghcc5rlj4)XmS82TfOjq4jZxk4LPgYsVjm*t^2Xd+3IPJ$FIO5AOaSuPU=s zGE&lszoxL%#K%LGXcQSmR~JiTvlEHG%;v~(n8@W=RN*z1(#ui-YI@m7-KJrOBDRAt z3}Wa%xQDSF60n2aZpkwVrLn>&_oz}gG)v!e&G(1$@M?6py+w)36$#{IeWo7V8;doW zk19yQ{OD9jstYPB3b=~=T2x#{LcZ0fLSF!Si7qKJO3y0Yuk;h=(f7!E-A}Puamh7f=X>x0-E*QbBg;7l=8i{cg* zbsds+tw`FzkVY6mp`3-62sbm`w^k4C?lQg~$q)%RTP!-;#bt4gQs!4>Y>z8PYC+)> zzH>=dcnE}O6+Us%nW1?R&~~UwsKqVQu7HsVhHV-W>j6}onrs4$$yaYJNGm|0@=#Lyn%RprcsWuT0BL zFrre|L3$9Cx{L{+@}?G<9S(Ak97Lrqb5W`tvX|{sm9!aoJ)v2^6Kcn`w0J(ad$+0S zQdZLjUsn06X+ze`4S0Eo9P-HP?s3I>Fy@|ToJ~L%w#Dgm;9#OI7Aq2GD}ePa6y~eFW21sytS`L845#YH6+aO=)N(P(OTc8Kk z=PYS_cwQV3WDuXGvwH?loyAWY6;1o^qUq*@)PzKX)Rbc(G2H+L;({!^HyqpS2~Q(v4)cM<^+X6w ztyLm-WK|;e=@8w){xni2SO=8nsg)_PX)V&MEkRHS20c_`fo_Jhp&y!+(n| z+GdW_`$p&!Bf?d%AHxeHs`Ol?zRp};gte*Fr?eoiyix@fa2<@m$Ee}s(k_+ZpXRZa zrR>mEcKb!c9H$n~2Sh%)E5FZ*F=@4mQ~& zCjCApJ%1o$uYMAntu8f`=H-;WPloxJb4`v6y8%)Gsb*<*#_+0MYOvQFbQWzK%J+jR zrFgLBW3h2l*81!q>DwUmP?5yL==n)ZKlm1??m6T`HF@^O2H@0+t&Wn65~*i)*-ST+ z5ENBdBq&K70!OHCIg~`o<6Tyv7nbJ{V);=ln{T^^O62j_?A$jp@?x2co+ClxhhKa` zM8DmhX3FMl1{7q>c4RXY*zZK{lUHaePs*2C(*g1ZzDZ5(C{HnpM)Nd$Ao-VuzBpL( zlUv@Ob+bQ2%;zAchS&)MPkch`56H4MV(a4C0Ps3Vr|WLecdl~urPH+A2ai-g+_?-~ zR)6xGKMtFlj=?kMW#`(gjvJ)U|LN;Hpqse1u4Qb^3>uphdx$MrBUB-BLeP!Oi$MD|wul29* zUjj>-raLot&OP^>v-kEaD#-!udsYF0^8M)MI*!aoQ&p&JNCNbC5leS&N4@@7`i7Dg z5bZ>=Xg+wP-Xe;PW0X`rc+DutK@1{FV~!}1M1t!vH#I9WeHb{OQd5lamXyK_OdbZ2 z?2KJo7b$pf4osB-R zx054D(-nV!IrJuOnb(s$L|z2((f2!jIy8=nGZZf(!}%&hokD28<#aw057I?)XP=f| ztw449NVC zmpBpSm5<5HyJVIVu(dj8`)>m)$|R`F*W~Eeia&9&j@~6lrz`$qD{%JZ-0d2(7#6E=vv?r zw7AM1eV_fLUz&;AFNhd`s4yq*#}I^IG2IQ>TVMJLOXPW&Ju5$~-nG}Hp+^8}GUS>-Q*OvqIfk<_*(pI= zREE49D$f&x=u)}+QnHab)Sla}qQ$Jc0Szc*a^LPW99Gc+`~togGsId-7JXDlvMR}% zm%gLJ+c@{P?{&TZMKbZ?=w8R$0$oKvuN^9q2kc+ubFiOk=G(&r;0_zAr-XK{oo}!jAQr;d4`CK>{uiu3 zKhi;-Iiu)toKQcm7^+5b+*gY3JK(yWrpQUvB<0BSSgZB6f+VtCiu*l}AE^Nb@wpA0 z8~vZ%agFz2Z!H$DOcG~P0f%rLD_)%EReH%(L?*bPgh`Y zyeS=^dx{+gc(S?l6m|RIaD7Ml@3)(M2Y1Gy2xdT1n*(F+D@f#B*ss1rq<*qR5!}7C z2&DyB+cN~4-G?*q&0R!w^nF|Gps7XbectlMEmC2Egg=ItghTlWyFx;D?+R^hZ)^LVy_WM|DeoA_LaHrMh+DR% z`0AFYtk5mnu_GubaLX?L%`3)GJ|LUhlN}nmN7*Z|yZ412%oW>mFGhbD#RVXxtJ+A0 zsw$YVV~t^@!n!4h+a;@8q21O0)LqTE&BhYtEgP zLQpgNYLB3717AXD4{1jGLwD_N4rxaNbC(I1LE5K(Ws6@O`G*OpU@8z&pNtRzF6>QyG5p+l)^V*r(D-iTTj zy*rl+%nc5O>ZZW%X$}RU=ArCIls~qj-T&a0{XvI!SeKQour4q0J-U^PgpI_tx${-< z`SABNx>~&@t(7DDn7_We_m@#~I{JKI2ZDyEIV6KF5$^2Wi>Iy;kB{vcKVeoMLZ*EB z{gq7*NLQ3Prh^nUKHr2sqTT`W`7%WzK zWt_3dSX!%etm*z#IH;?Pj?%{kqE>?qw8YoeSSt>S_I-{sNTq+eT!m}z42iVa&< zrgMoB9>ze`FyeSGqiW5{q76rr&vP-~7#`e(l;yX^2UTB-whJeYo;Pu2kcR_)M-4_v zyeATG&AE&dTS}L6Rj(K(OvTo{S=}0e`oBi}+4T0r_ad()9*;ksc%1u;IZfA`0#5W6 zLpC_vgdOR@K+HzOh9~0$!)*<5nxv}q76gO`vWJUWN^$O$jkbfT1C7ZMRhrV+q7a<> zKo(-3uEG&EI4mMDLKU58u1wctmE=@l;&S|B+Q7Q^<75ejH26_EBOF7Ot<+LerXlSg zI~dl!h@8Vj$PA3@s~2t&=GLu;hOszRbm8qzeGW!ZIYO1tX5 zL&ioMbjEBkDX$2V<;tqk=4y?7zCxgYT}13|)!v}WL&2I2le)*; zXWg06G8)Xbx9qPxplWM~4X|p8V)FL*E0O;u4=h56AtonP%!x^h(UVr$slDx*AHg{AthzA?nDvqnV+TsHnHI)(OovW3@KyJ4unx?Z;m#&DN#YIq;T*R0;^cu<<=rfI=2d$j-(TY21Tr?ihHvz#^ z0fPCap$2kscZx5culk&8ATCCbIkC#e@!l>DVIeJ_Ps-(knHt~PH)?%b$5$^fLr%2* zH&V|MH~UaIsiEHrr&ABd;v6G(SNN+o?T!zO(8NZh?pUpaGriipqbghsY-o$`QXOxr zIM|@6YA_$cmAOa07bZBKV?ttLlb|M-UR;_ZS%8unrQLagLu7a5M;0cE5$2kd7S(}+ z)o-_J{8)FntmXl7Tu7sMGm!YRKkV)n47o-?_d3Lyl(_m`Dw+n3luY=i>3U;QQ8K*g zR?l3J{^zQw$>EotY)m%kz4Rt4WF$!%(^i4`CtMf%QcHzF+5HY=ZY&wP!Xy>VV0I-& zX_GY$>*HbZ!3HIcKz`_T5~HnEk?qp1rPe}Ak;Y^(l&0J0eLMBcH5iR5dqdBRA{&-j zyij};hfxj@fyka)Boc9w?h?U}o=pAd4`O_3Qf!zcA*o9%EJj?WIM-sb;K}*b6Kyq! zh*Je+T5_$0m|zx~3rbYv4W_v?E&){?&(m;2F52p1&kzdJ4EjvHV_fepPqYt=yf#Oe zNsnb|UTK-BS#as!U_z3r%7J__fU&iRFR(p9J-60G9Oy^{SHrRl4a}rL&?0 z#cm!*h8oD&ARvsQewlq^oRw>!5j4s`flk)qJ%UDP#_8tFiyFo4r5Xb!Z9~E4jQ9Oi zBi4@kY~Dj17eOLO6zU>Wm^nll8c2lZq4l#HHNSAJM1y0Kp~y5yeL&%K*{XK75AVJv z&uxZG?z6Rjk$6o zYfqNcPj7j<+!q|uAs)~=dn!36x2Mu`0x)&w$s^ifPa-$uj-+mID@)(73TCOUubRP3 zc))(f;8wf!Od+mNSRyK+cTKLGj$ymk8091bH;cMD9zUL9e@xwawMGW_t4;KF3Bo6% zp-qVu-9i!_-Tl@Q8yPL{eb)Y*u!9coew8jg3_d4Eg}p_XLkHUbMICp@Ksn9pUI^{O zsrI3cFUhlaQz-ZoR%_RAXPZWC4K6i!kAz4>8DB(Xv+&`<{)0mf2W77a60K zq@NHN78WQzKEnitH67G+dy~Oz^0xF%o0Kr(d+2r`vMb0QvYnW_(z}v7F(o!Iz1}Q6 zWZx%X#xGJO0P=G{S*ipCe>%o1CCJlX1&OedP8UI^?htkc1??2+TxMs`{tgY9&UWnI z-+{qxE$hx>x&y0lfQRSl=#(13@MF#BoE0(O=O@ggt;je$4OCX-j zzi?!6&s#!aTk+w@{i{Eo);hb6hF+!##WXri?kTud?_5atUq?F$0L{+DDi z`jw6R_63>x1^J!WoV)LLj~9xU&E2?W|B8CU59gY=6D`+vtWKdRV@{bR28`?eO+4U_TyVVO23dsWXZ%S z_n*=WMIW1vb#ZU^CJWK?OUC+arNVqVF^vvs^s!B@-*!Fj6W#TcYlS7AB_774EhwFwb)au}T$ikzo_llP!W|Gk`>93ir=I_Vs|ykaIz~& zs5Aa7RqJQPEeT%}zBX|4mVhn0)`TvL;b<_K<7j6W6ungzAeII+?e5sqvG;iR8PM6B z`5^V0>Vxwp8`x+{F4SJx&yh@a?VLFgvsIgSSZV?_5oK}JsSTXIG3(rYrCkI=MutOX z_XJCo2LVcf_#q=oh`X>}yD5HqDwn!_OQyeS^~NIGcFlH>v4%8+*2gsInmAo^28Lbx zNKn8{W4p=@*R(brXl^`E)lq%e_HNMy4iCsNRPijPP4on_s9;M`tXLFlORUmy35_l3 z2UO?JR~mkvJEMD$;Em? zkWfI5S;{tyRGW(nOeT^1Y4<3$3g(W$*Gz%rjI!Fp{snYhTVA#wM z>7NddG<}Yg?MNxKrrR(s;D=D1CD{NiYqJ(3N`?x@5f~7_Vgzw%DGwuUqGfDpR$ZY8 z5O|J0)!{+^@szL(smdSKPtXi@5BjGi&6ZPA=v7i!WVI=AXqUT^@Ue6>?UpYx<{!D#D z>htTbQ~p#PIA*OotEoM6!g@s2c}gF3K@)xPxbC3p?za%__*QfNyCdH;e9k#sy#0)q? zQl9LdV{Z}+y>lFA*zP&wqKBo!Fz1 z_|dCU&nkUPm zHNB_l8^TI||5X~tTz2Jg|8wWMj-M0lbJ_R(kFOGYx?+XLqkG3QZ@#K;RoFi?ct6@;hcZh z%2ocGR*Fwr`J@2|ki5IO^PQTQN95ZI`^k@wRTH*4uR5tLecy?i#LDN3Pzwp{)v$*@ z-#4GwyWi3o*zwV~P468nZ#&;!3ky6gwTwJh<6gDogP*&{^mGe*^K!HnBWF#o%&XQI z*zb}AOM$*RBpJ*Bm4(JwOFl>ca=a=OgA6eYmvZg{WtU`Gs}lUuRs|dLYs~vO_kOZxW#%T^ z0b{FiUv_0$L3*JsH6c9E@3qL+(-x*KEeh<=*<#{zva>TwQ>`(ayKDj@D-SK(yfeo5 z`(D$Y56}en{@jpHE*F`v2DL;sQ1Or5N8&5B=G2;~6N#TRy$i25D=UucYe&?Ot5eI4 zS@-GBn2zC4K67Q3+nuIDYO*sx3!kERkdN8Y|iOGgDIyKm#(wE$+_e zOV^6ajrE0=_QoH!6X)%>w8x@aQY^>AE=(z1%2mExvMX#NSDtE-QkwPowLE{G`-`l)RXNjVEgAICsuTCc|yw z`pINaw~whxDc6@46~uD%brL9K>$CEdIb~_3$XVe~d08eKrm!_Bxslu%1c)+q+WgF% z*z}CJ)FORxnYqAiVd}oDBc>+nnU?aFwUv8JJ1=K*?#o?d zvfr|*e{U_U$*;YX@Jrm^zGV8WZ#Z|IOy;uq+O|vK-$i|za=qXa)4lcNnc3&px6i45 zJ(t@NkdYXwq1+n@6Z3}Ujmf9|tV5GGES#`q)ryrN)OqLVn6-N%vlr*a8aGswUVZN_ z^+bi%CY((Dj_*JuGd6l{`t?Jn`mKWyyC>o9Uhj~a51Y3^kQ`=1MWH{v@>O?7kA?aSv{(C2kBpPPrs z><{TPxBL7x7yG?G5)iDdBrXW-xp;#v!o~f|9&@{}XV%o%36iMAi|2l%jK%=TwoDO~ zqfK_`%^8$N5TC1lpy?fSqh$q0eeHhkKbC%LP9bje6~J9Laos-j zh7e4b4yBXmh>_`scayiKqMU5^0kU*OX%^ReygN?7?9HG789PMF?cdQCg`Dj1bO<%P zg#6hy5Oq$|+qjaG?-iX^xg#@2#`?YpfB}hg#0hCe8u>1b4&mI_W?HjKGObCiiLHtI zNy)$dCS&vRexNRA>Cim-5=UIpF#%Xg(tBo0nbJ`}G5e5@x;w~ws9$rj*n!$>AmXQ*yee|_igU@g<1~Lo%E^$uWcD&TS4sX&gN1v+U#|N|w45-VI;FIG zfqw0(!)xu@4E+Z2wvD2G@7Z@yxOBpr65BeIhsxTU8bwTO-Q4$tk zNwzh^qM-)+OLF4b#Uk|bP##vfFQFA&)s89MooA#eMPF+qia2fGKh)2fyKj;i3K6v$ zN5RuDh4odOK6>=DNdCV3co++OrG3X`#}4U3&#=p=g?qZ1c6R@L1|?eEr6gIPf7pY= z4(%oU?;m@8_x@K~j;`b4%A2CzQ@z(*TUo9-dh)BI->&*&(O$}j1#tF>i||a;0NT&| z8zGS!&y(06lGQ)BAM%!;Mm~mKhp@dBfAJ0l`|Ei9_gz{pk`}s8K)o0epL7v1dLj{P zG?|T-Y>QX61&sdrwCj;4xxiX7!SgRdf+0_zMZ3m%N*kw?hZ<56yyzloq+Jj71^S%S z46n2dbR8wVz|yWUQk7b^-YZ*ggn9###768!jTvdVx_rG?zP>o!oK3pMcw%E@T#GYA za|X(A3rN>PG=mx?rT0t=XqO9%K^lVJBVFSxS(ZGr$qVHM7K;+iB3+NBOktqLuS&~brtUyYxo%28vd(`5XI67K&m4fLT}bPf7?ZFy)e=a`g8 zKcn9}CMyZJ3{R0Jl!?}p=TI?+{^8db`a)rhBwGvy0!g-b403ZjQJ4r|1BheCqS|FN z_;E)nE_=&$sITq;AA=+sw;FT|01X#POn*|k^QKfq?1O2}7W+-08?@kFGyHZ1!E3yp zQFxI73M5Wn^X$FLP-)Qsg;zv`VS7Uak(MqtjG!Kv1O1JZ6GOSWNo|m)+C*ctVbHyZ z^wQbNGRstw%p2mYOF_|YAf6aQ7mLWDN%;9WpzL!sXuzns4ji0n{2utzcX}SV-t>?> zhq)M#kXlrZlLg@I8;U9pyyLY102_%zuQs~J(2`d4yf+(K=KhH{o77_z3`s|(0D;<> zBag~YNJYpqJ~b^$+(_M)4K+Z*hlZ?4i7w^V@3;K~hUML@_r}(VK}Fia8OCA8DY@&x ziW;%2ET<~_Xlh*$XK2_~Fj2J9ytP3F<&NluZ6nAw&amQ-O^Cjy)g)MP^tjUS0uelC zO*!(diLnMlVnXR24XBhP?$|=CCy_LXn933MV%avxD`8Q2W$pnnhm5~bXHZ_N{hq%1 zXfbEFx$dl0B<2D+Q5lyK7lSg>y!R7~Fhe;oszDC8CX%eiBc>n|-+7eS$qlHP`Uldz zC;{6JJsOFJ?lsav)X&=o{Y=(cKP4;e0YvdHBD#~i-P1^+5aRC}<6pC>Ch2rbSM#xp z)m^dg#FVWL_2(WEH$fk#O^YjvE6%L4R9Y%(iz_oK(@in@IF8I6BwQrQ*D$FW(Lo2d z)5!~b>9fAn{UYcphWf)tMBVQOGWXMq#2Z4fNS0U8HHh*qrYD0r_d*|fG6bg2^B8{feKug`Fv+3+na6?{F(v$XQ=^{I4Pat=IOpOv>>vj=VUVgcL zc08Krvo}2^sA#WgZ);2|1a8P(1KUyDnbI8898|nDWheYNeNe@o{rdg-0~MD24Yw1% zTlpbEXh0-GhUo?R+PidWAT|m}i`-QlP#kb5@=!5h>d7;^zZw6{OSRN}7j?#J-LC4L z?J4ak9n~f6+>h#$WI_;R`4nWJFWkQPYE;5p%sLqyABEwddY~=7?66J%}M`j&OOj zr7o!+!)Tv+0fv&kyhC!&Hu5E6J03m%Ci`%|9`w8*B)|SLu+|f4z@mvWro6Z;KE`k^W?%EV(n(oV`O$)#v(FOQzOxM{>fS9l&RK|TP1&flv#^A(+&EEu(fn;r z=bDxP|)vi%~c?1(jy`9cr@oihO(rpybjAhveZ+VeFm+#p!lWi6Ba<0{>fK$93>1hPBJ&ybFv|_7iAMo7Vu9gpxkCu;@zbaoKUm{;AUoYP*-!9)RkC7+Jb@HR~ z6Y}%&JMu^JKjoC^$1sd5^DHxlna0d!<}(|aEzC}44->+aGF41H)52V2t}r*5JIpW4 z-^{;RXSP2(fOThIVAbr4?09w#yM$fKZeq8wfov!n&1SMKY%6=3z0Tfe|6m_;E?j@k zjT^_!_1ppO2zQnHn!CsS*1v!MXZtJrPwxLl|K9$igk*OiZDg0B41%uR4M8eEsEoc z4;5c2epe91W4<5XpI7li_>uf%{uSPbU%{{D*YSaTI3L4j@g}~Uujlvi2l-C^1b>#l z#9!ra@}KkH@b~%Ok!56DJzR&nj&+^n`m*aB*VkSBT-Uj7a^3E_+cn%Z#x>DZ@0#gq za5cM@x;D8UaXsdG%JrP<2d-CKue;uH{m%7Q*MD3eyScdacN^g5?k2hobsOn6-fgCcW? z4*U|uFI`ly;}rZHg@%7gA@V@v@{`pX9?(?*KQo!1hlNjBh#=MuYs`aMt6Mh$)G)e{ z_!Zddc=3NFF?(6TV@4$MHemV55+M0O6NvCXND3Pi5{f@S!M}=@55|F>(ql;67$VQi z#!1Xl^UQb!Uzt>TU4d$2UKp##Dt&#%d<%t1>tQZx{BLkVj9+r!N$ftC#*&Md1z0@SVTqPo zBWx;O2v@`?`l#@DiAzW1rOU!IixfN(7wb;WR7=bS;QYnk>FSdw*Wr9$QuD%8HIGVg zzX@u7ySi1)6Z1AKl$w<4iKpeJb=x<6lFTWd3hn4 z>BzdySVtDCE?qEL-q(D+{Na}0!<*7uGWTVb=aktBD&bTWR3(?_Y&(u^J{;1(fQ=oL>;jKrJbIpPgPlAuom4vF+5@{#;d zz-#+g1NZ=j&>m2(4j{vjnvw85e2rlV(mqn}>Ot?4W>35j^f&|+t%-@*8A+PW@uAx` zf#jdCo0_*Bix)FW%d*Q<`&&wC>NIv=`z*V!W0pL+u0^+BRaTZ~D%BjTXzuJ%ddvH> zU7?+uD@0RLVt%4(04^K}+%L345^1Zcy+GQLi~sU8R6r80y~d(z_ECh^H~r)#NT-SeByTpYRC$hc-aOlNgM6$v_1C zMhpfMHh7+Yq70;+FVyU77W0^)vA!dyt12YiR1~ApL5DB3U%}-a`1MC6lh<(#wSQuWY2FSV7-l;U-+ucq*b%7`6Ib9V%j16n zY5$>qi$%+r6gAJzQ}gH4-80IiyI-#8o}pLp=M=p&%5f6q>fRZt3SQ#9;z3tGT1^M@ zE)x__?9h{m^%GmvCsD!UQhV@_geZa}1WyNp+E2ifH3j$2TQ1|*t7{ef1jS=NW}|xP z>wu>$hmnE89A70}BVXD8I__hjJ_cL3l>wJ{zNOq;ZYuH0FM?QL5tq;8rRS%c((AXP zbe$H;iIL&ADPV1%FkZnq;o1E3f(%ne_xj%To(&Pz<~AkIW*23dGEBYeyVrY0G{mH$ zKYg-}2xM#R?ugS*Ljf<2-n8R>liY z_&A=@abPFUlw?CpNiz2YqFG#=FLAvhASTCMEW;0&e@ByGk9Y_Tn9)BbsX+rmBw7aI z$&k)gv@DyvtK{Po(o<6SM73o1cyE`}*y;a$@e(WmXN+?8!qo~XD9N)hiSb3y`QQ;1 z7o{6%=AkgczpgM)KVDu}S9;(eu3ScjX5G4pI2$yLc;nZpStp&L6lg*01%LihKV>D4 zh|tGj;8<{e#Wg&Jn-zRSgW*U+1Mg%oDV%w5k{F0Tk1$TJxfM<%Q7HhS=X11Ku^CAb zi3{Tw$L-LCCnQC2sjM+vo?%Qi>O^auk*`+_cuMC>eP%qB`5~_<`0a{bK%Sth(hbCu z#Fxw;+tm*KIdIUm@9N{A6M5;;kp?k|W{Yo3sMA`+NK0sDTx{Q?qUHxrojMq&&hjM| zV_vbw1mQAOHmgg`%!H(DiWiUzjq-{1FIjYAQ1hS*z&k}Bme*--sI`%r*L>uXykxhA z@2G9;dymaO?^9D1S};U;^KbX8`sUQm9@$?LT%b1vU0qK#)oQpPu~1 z5|RI~k7R)Vk29nh(3~XK9zUIOL4~x(n6D0A)&LciUy#S~li2FGlJGF4gu$0CZBt2O zb)|Tp<%O{dJ{kSlmdqbaI-sq`Bc{RA)W>?v$HrxbTC`q~mb!#S6(6GB1M2{jQCzr4UfpzM)b|+6>&*Cd1m?Nq*mP8KhpWgynDUB>cpQJ1IYRZU^PR|GtCpH>Dv$ z%T7=LWV%r;aRl&Ar@fhh2n;Ueg}G>lN1>WG6%`blVN2i@*+8U|Y~zJhemj>7wHweybP}6B8X5@%KxfR$ED_&C1m@@Wa#tpo&|RQIu{=FH0?@8WQVC zTX=%e;B}(;gs9JwK`4%x+xMj6p5dl?@N8R*IU+*D!_s5MyqE_eGrk~6!?Wlp!@x5& zAFpBHOyvb>)LF3N{Iy2)weu?$i2VCl>wSsNR6!>rnm)I4sfMR)Zfv%E=N7|y)ol7) zeqI^|hcOZ*ecz83!uH+39kYQOD4G8+3EES}GhBSFlffum38#9=2qCl5XH$5xSkb~e zcTrY2r{En(-OxDNPGA0uzDQmkhYgn~c%ynid>SMYP|b2v0!n9O!}{Xcf%%0X_k;)h za-TDrl6Z5RHJ;NI6=(3iC)a%-B@Qq&RrGOX-(-2^frK3@0;=11^m`Z>X( zY&S$i@C`655t3m+StJj!Bv5Sgabg3;UJz9>u$}N#se$_QtTb>x;gy6moZ={ko&aAu z(1$8idxA~2aB0Zwd(DJR!(AvgS&KB*3Ug&i1$XNVFX0-x5o_inB%hC$cdB`b)}#>T zY#tySuseKd1;|HOiK^Qqn)n_dq0iDd}CdCJ>1^9%;wli9$KqfXst#{TC2RU9ge!hU{l5u$GDu^pCUj~|^P&2$(s({I(A>l|zdeA5g^DojrwX{*0oX5K$ oMn#JeYGU{pbzL1U=O}QIp<2eKYy*8l(j literal 0 HcmV?d00001 diff --git a/user_guide/_static/fonts/fontawesome-webfont.eot b/user_guide/_static/fonts/fontawesome-webfont.eot new file mode 100755 index 0000000000000000000000000000000000000000..7c79c6a6bc9a128a2a8eaffbe49a4338625fdbc2 GIT binary patch literal 38205 zcmZ^IWlSYp%;vqo1upLH?(XjH?(XhB4DRmk?(Q(SyX)W#I)m#B?7N%&@gNzPg3A9y|F{1i{C~vS%_!vmy8pvq0i*!V z04IP4KosB&umrgOcXRyD0su$=wg0R&z!TsAFa@~%hfn~t{zKgUi?RJbIV1oM026@a zKV<`u{HH7cRsj2daa8}Gnk4^EMF2odUHbodF(eRY6Og71NK*#{I$+FQ#4RkN>Xu5t zDV|CZ0erHH%7mJ7f9C(hMgfc`(&`gnuuiqhEZtN@Gm6qm9jtBTu`bUstuVt`VE1U^ zQeRP-GNx@G1O+8HnNjpn78T|1$sHu=pO{n+?Hbd%?rXh*b{x)ZZ9Ey*heliTM$ph9 zeSOvxJI7sn2z_VOStQwpj}H7Y+@M&VY|#ngtbu=`HY)^$pT2Bh?F%Qz)A!hd^bxco z(ph?3k$*g}cpvrc9fcXhjj;5WPot~Co6>e-hv7*v=?ht4ZzfafOKSl*nvanjGNp%5 zqVHEAb0A25 ztDEMbuMI$uR5*rQ;Ex2f;9~>x3rZo2m^kwR6UQRPZz@Czx8NQJM6qF(2xu!inpqCE zp&p-KF}@yM;D2@511uFKw|p7`rR5E%Q=P-zPeXA1Ktriy6is`S1oMudP6;lGGo*>+ z8#MeQ*S6fE;37Z&V&V2oyeT_l1gp@&a)ah*E|M@ELRv^E70jhArQEOCVR(XrnfK5q zp=6hd;d{^XAPeI<#-L-CBvNu5_(Jtd*&!2*tS%|-yzds5)A{0f(w};Y^KBe@AdynU zQL37Co!%Eq%0_)~bcR`#k94J}qgc4SSR@Ul!8_*tW{Z3Z>U6}ivNUHWn8P$)EbfkT z@k>R%?c7o_o;AP3>Pi=p)K`@mYLKBdm&H(%0ai{ls$|XAptE5F3tx6U{?(i@T>GA3 z^_!F+A*NF}bxUB`5ssZLyE(_w@^Dbsgs-6_CGq92Gx|oi!cA-HhDACy{4K)xs|&hF z>LTWj1(w}4LTGz@)0q87y$|wm>pEPvgpR{F10WY$v~2DYt@t>2Z4;zPN_He3aPb@z ziE0^tt>sf2&yu8qR?@PaDB@HEgBHaU>ZnpXEB^D(;d~K@`H3P(?)J@Vn z@CfT^4qS#V(v@+Tim_UUz_Xd-$p=1fq8#h)@{UE|bVYBR`b>ehNCJ;D5bU7L26}ay zF9bjM0OWm1Ao>6*BK&HtwoOBWueI2fo{G7Y(GD|!_MzfV9ur=<&-+oRNRfybM70FE ziI3L556BV<%TDstB!_UPon6HAw*b{&kueNsC+=#&J+)243^;t8PopRU4eb)@)UjTC z%|J@gDtLqz=z5jdArpDBF8$;L=m(uEBXxr?n&v3{9kTU@&#yiW%YPB)RIU}%aSn`6 z$@EM;F;6}0Oe=&L&gfL&?rfC)Kx@IRPdd3jy;|W(cPJI&mJ)b22%#Jh)6+MBXi}{R zv^IAae*Q9Ff|}Y>L3KPUWC=0h^@i;U8!M>_cS{w^1mL3n#)V zzLDJBVg}IArNIql9*}a_j5k%x5~ySF{kx7~rG&ilzkAtDE&P%=41?qbzUVW>mJ;wI zG5?8dPhnkm~3cU8v`qiyh&L1E1^VPh=!%X+Uo>1c96Q;$2#!T1Ajyyr?xG>dq*93%MpnA#<7B$B#7=HPXzf=n$eqoJt`+9|FBhvLb+Wa z4m8GHx>=pcMvH?ROyEX%6zNvTMAD1qZ;AsG_0HNgMRs*xMPr|7Ah1x>6n>WIU!Rbx zAYDQVirff^+o%FmVd0B_;=cS=Pb5fBM{XhmuA5{$CX^gd>K>tNd;Lue-*M39)i8u$ zvloM|Alu~~`DW*t3*x9MP(pP*a$yx_Za4IsuM$&kOP znIjBTyD&_q?33=(F8vwuz4}#@VC5b=BR^1qta#WB)w-2XWN|LD`9AlpS}&US6%rj_ zR)6|i3w@-sbdLY*wIZzMyd+h(eZ#``O&@Bi9YU38yi!ozx7p}(2j2!@LD^z z=Hq^=#||B`(#WvR3+)d*sr80BN|Ky6Jt`#Qjwg11 zG(HT7qi~b5*RMzyF*&HHxNqS2WkJBe>I_J0^)kQLmlNmelxf#>?%GJIl_lQcfQhMcCHR zpjs9>tRLYo;~E98pm1*t7SyL+0x}cVhI- z>CT#lG-N@6SO=jawi;8;(_?PT(9ie_1fvY;Jk2=I_w!E z!Y^R`3t#8*m?I|Ud>4es$FXWl2HUO$%~7*kxDsbkG4Q&Gd8^ez857WVF=K{GnKur# zV9TxY3P)fpjfiFra;dkVwPR>95jhb+kD|;*iA+l2Oqxik?B99KpfozgmzxwxSylWb zg)%DWt{5oQP7NgLljJDmH3}IPvoJ+PtxxycCnYT&69cDw>&}In&F09a^uTC0WeDa( zEL8Nxmcz5q4LfwxV%sU0hvQRh+z2C;vEp+E2B3SEF-f|#6-mSx*mK)c0$fDM7kPz8 z?`_-7=l0}C#Zht53SIt`Y4vfg!7WuL-bBA!&v`K(@{u2PXiuNAgvs0jjDCI?mYq<; z@mZQ{ZtFKytujvz#Oopf6!|7kA*r+I0ob}^W8~7^gRdfY+9S_F(zSHB!HwR(Y{(zI z-ibb7)VpopINsALOXkwt^<)cm?aV--LZ?;j*$ezC^n=3iBOB=!JGQ8>rYy~O6p6Wf zY~=*?XKaLp<&Qo6W*RX!e1xBb&9_ct3YV5z_iE#2JViml)_rvMZsp2wS_7iXxJvew%gf;mkQY%&1+`Gi*e*2*B>O@GO()_#LH6z(C{)jcjQ~2H z)FMk)q>Sp8;Wk^A>(}J1pqse|RN~jF+6{lt1bbson9)wiI+YmW7Np-sVNxH|T&AA! zBI7Xjs!)N);7)_r(h`BeuV_SgPbsHm*uRBUVktIpforWVBjVz-avd%1F&mvltBvF? zfNt|pMlEQ@*r7Zr@j1anSI{yWHPQ$!*)ikAEYb7Vw$0#qFN1VR2OI)KFA*m1z+qk`Qy*pW{`d{N@Nn-0){$edMYF#Lln)aUBU%x zpbeNn0tProp-?4C-fLh&EA7jUs3uXR>mE(WMi;sRvb?M`LI&#S!`abZ>*?LAUzBEv z;)Sf?7eJk&T&RX^Zw74e7XPe{@Ple&hu)^v@rLAWVA)heayJ-&0YhI9ste5a#M@pF z()}*Gekga)6xf{ah%_;p~T z+j{vjFu{}Ns1UWUeQeT)f!3d>d;a(X|5DX!wu&XZ9eRYc!uzZQ6r{8oI2ArhVA%G? zHyb=YT19dD63$YpPa%n8ND7_Z+Jr5NQ>dEfM3VIVW%dBxo*UEF9g+=Z` z3D|>we0$`qMMT%+#&?bKsMuGo8^3qSNM2?u$wL0_nc8UkL68&{gP*hNYcXSBRb%cB?pVTSk*kfIOciI=QQrZ1JZwiYyN9#?{qgO7Q!32 zgX+p(BAS0u%GTgED?@bG%^)gzHm;AuU5;tPf-`#gsCDOP-I(3&c+iFWwqT)~_?WRs z0IY9YJeXjU!Nm%OqKuR|k8Mk;_D%MBlM=Kp?lshdEZwvMKMFR{C5D4la_j_TyeaQ~ zdSvtTk@H$=sJHwFks8_|tO%{fojwPmtKj`Q1zQ>HauCfT53_ze)l zTG-M87<=xxy| zDdO)&IMC;(lZM18FVB?v=R|Rw@)!k9^%zF2N_oFCDrd~Y_ws}mz~dKX%-kV41cU}} zQ~qUWCv|=_P_%uplL?G&6J|d>Wk_c3gKFN@F)jA%#ii3cI4UcpfE7lu4V5L?>N`$! zk)h#WZ(15(Finwk1ceGKs3lJx3!EAjUatNdO{TJTR0f@n1S1an1=2=8TU1Ml9{F^EsNZr(g5=z%U97>sgM zril2uR`W@#-Wt5t4Bn5Yz{|T;kcFdy!DE^@u598ty3OaS54s~Hb)tkY7zz6}Z_G@k z&5BO9g?I?$$5+Ud9=`SC0y?M!A2=yUZ(a`GKLJ%Ec-W*#J(z zal~$;zmv0W6y8{yxu3p}rN~roYmS7RdYm}J=#D391J6{cb%T#4)$PQp>Q8-uV-c7&nmY~uoMX$~7PY5dy=uY?@pM1GFC@wI|v|Qrw-=$Sf4{wk5&4_=sF>gnp z*P({nvArrS(l#^E8wXB^60 zjj8eIprA~2PY#gR{Q)B%m?ITG#X@32;je#;)B6g}9@Lo{@=*J&tl^#@&d70hV zqvdqNZSrNvD`pj@qo;n?u+SB3dYiht9J6DcMtae}KQt|F%fb$wYUmT-k7u?}UG8yl z)Fn}2q?zp*uBGX@u7bNWI76Nt7RMm)!sbX2Hz;8bW%E3gv$UWV_F%`6i4Cp7qpcfJ zDggycgt){-@q3Xf(|fbVc=5I>92_~)!?urM`!cFbfKnO~Et7=kL&!+Ci3&hjX#21i zKFjJr(e$x^2(e2@eFplc?uR%6Bo=N#WU7i-P3r}$20vvC5=maef9!lE`8^MhF~c2C zpe=9m1d%QT;koR$`WI=uIaOv;*&wjp4F`WIs*eFc#p^<+tI9=knDS`Y5Hk`w5F|r_ z4?}k75;f>g@CXGS58Xp^u#Y!M9~*|c8HAWY>=({SS*)Ox9&@4z<~uD-@;AQcA~6`) znp0N7D_`!W=)@bxJMyWUz#U*pQ{cN0!i%$t+J2M;9RU6#E3;dfkcw9t9*NT*lcI1S zbVTz`ZG|Ev(sHZt5`F5KoNfAh|<`q^eO8loN$OjJIl2#PXtQA)~wGv&f^-Al_TjJ58Pa+M5kmz-NhD0 z>XD-aM~}AOprfr!hqfUw;f(eLw$1NUyo!L*Yc&h>8ZR3PcRsr zpYsNmhGRf-y508v%`$L8SaCUt#Le-|`Pk(FB`->6b$q*QiU>;5;ZO^-`(W`&3^SQ( zkqH=nN4>YBjf+!y{$c`$oM{CvIf05nmqxq36o*w@|2|2@sQgRAPEnrIYoiG6NcTuA zi20@ezU2fusTA{G1B8BuLkp+2=rSrPB@K@xP~VI_i<*3sk11&W&=Hk2t3r5-zDpV6 z#dQ?z6_e_cU_h5fCw*a;JR+eAljWPV_Vci#Oh=B8idNeaXLW~$1j{iF5rJu`*b1F% zh*c0OefvNb3TPm=QtqJnS&kg0IhUac=EH`4_JOdO2>dyQq`rdoW9z5}NrSU|aEVe@ z!0U9?EzH~X@v58!f-M3vXUndSwO;G6qI#e7_sY;FZ`~pD{4qHs6Dq@w0jvTvuB-~N z8+2+lf)Uo1oXzp{W-SR*n2#9tSW9am$`FVl_l@Qnkpcu$B>@qN%5&yQ1Sw+BnKemL zRfpwW%f=D?SAe7)%1{97X=s}IQA|YiL6S9K$N>{4hvtXo3ypJsGLwUJwmpXvvPb`i zPkFFE0I#G&1qC%RlILTgZcE(q9+YC<%6We|>5Vf%t>CBZCH(2j~p;r3-+a*1_ko zbDXT3(;;8uXXy6+1Dk)LQsHjW_wQy>RZ=1Ndb*^$3dPZD;?iXgYVT4mXTRmuV@H@d z+u^8>gmn-Ztx&?PG9OW)by86jFo4ZHASsxOGZ=Hk?0FLtV$3cds2baN$3E4A#Cl31p{Ux18pUuLY!{ z4`cJ3-aWj(HRT`W2eeMg9XCNOM0LZ3*_F@?(ptb*MXl6wMq(2O8`(E*p^_64!N@mh zN}T6Iy|eL?DEPiQ3hfe{h(y80^dA*EwBR9&WeP}~^-1)Q!~NsxR;~NduFokawu-+X zBk?;o@e$fU1Ti{AzikyOdXzd22eX9kBS`pQkdEjn{K^EqmgG`{$d@+XqZ9O6SY_gu zVF`tjkVmDrsCq}^dc~hYd`tGM!y0j&M8QMw%5XSu{5J^=s>#z|3VD@{Gx!}uptysk zT-+YXFP4p2TEnMWl(`?Zi-2;tKPjKmJ|@->q=`h8(^8lcI;rt9Vh4rL1X0bU&<>to zQ6;sD%}9Rgx_URn9|V~;>{Y$#W1I~`l^ZP`I}3}K2ERDD$UwHe2|PEk(Z?gSX5)<+ zdUVERMQ8fU8wU?*Omoc^6-f@ZzMlOCCI4JZ6pFU7w%(&U3w2ffD{wNRM)kBsFp1D~ z$hptcdV!tgO9it8id@_=mRh|S1`n@*{P87e8yPYawPY3Ej4zfgPmjpJt2xkQ)}yWE z8!BwmbeSH$?$nPCXocC}BuHU>8G_#JzpON-o8dHDrRT}GC=zG4n-7RYj5gxvKZ=Te zSOn$?;)Y`Oh+*oP4+?!cN|V?jhT*7k+1UwXf3vmw_`8RK38Xw0v`a;iv1{x~`@aLM%hM*qtStGVzXCYf`q* z_(Exk=MfFjEUpAv%V>G@&>gR|FJndsyiouJU(}m+h$7w~k3( zW%y9pi}!Z98ob(Mvpx~OfountwA-jxjjOYhbyE7{fri?p4n@6qdH^jr7&38fVczz`O5|rS zdy!`@=)KgM`o`*xTGX6Xu3ZvA3j2C&@tIF-vj3*NrQ~{bnX;X!<-Ae3z#`X$V(A?- zR>Eba34!GF`jUademjbn#TO6DETFmI1 zzS4Ag!l8Mt{T_^WuF)6(;xNHm4}e?OJGCJrNUFcL`Kh&jmc&pBdHbLT;X{(%Yck+$ z9rjdgp4HO5J=y1e6o0fXPkuh0x`e&vK^jbN zLp|T>34R?^3!C<1=U?}@-t=y2v*M`L27Wk8BFOxfx|1;Xni@||$FAh)b)?sBW> zzw>aD<;V80(-5HXqbXyvg-F(qA6|AbNFJ@SK>r2 z1KK76v~3*m5M?RO@~rZr4@<>T$Pxjuw=^e(_#E?V8&W8b5hz8G9Og?S%wxe24~VR& z0*ZpRTVmJdRbj=qb<5uLm(abvLXYTU9@-jw)?ms&mfc8AE!QY0D)J>g-lmy@O#5rY z6WLsH{weaGczE8jONV{}7m$23_L)sEBHTLA?Zbb6s1(3*q~4x|K72BGM_9-U=s9sU39y!~V5p@k##Z1v$ zRm8R`n7%GrkuQ9-DMesZFZqp1B@nB$^Rq%jm}XzRNYPx9EK!;LbE>VkX}0H7VYmtx zJjuxDl_{Gm<0co4N93{5g1C}PR|$ebo?XxyrGGPoPNS1T35K!QkOYXJjNv~{hQ<}) zj=PwUzrPmNOe$M3S>%bIQ{zQ?gB@@uBh3V44xG940Al0GE|aM6Jr(w5h1=03lZIFbBq;fVp3GD+(ARJ!+=|3t4d~)LXIZ2?0`BfXcHj8 zbFHKWn9noh6O;9%f2%6a{o=6@ySg)Fj7Dl80r{ry(Q=;~OrOv@ysCr@xCg4Q?h) z0>WslwOatjzulyT&7q=aiqW`VEU)869Tu$`L`7jXD3k3&LeBAPXqa?S`Pd|7 z2qFA79}#)cd|QZvZPO?h+Y&M#*`{8bO5oYngy#14(vLt|k0Chlj3L@1ZEP_ANPmHY|$QXQ!wD`4GueT7t zb9DaP`^6}`7+hfI+Lt3byh=*|2RmW|5RYL%|k;X#f~6nsc z*CEiAl#o!);6?bZ&&7Cuw=)?`YsI9rCORFy;ceZau=(}DK+fzi?8WFD6_MBMG$ml= zMsh-4ss&nJ$hgT~NSX41@Jwctel6t^3f!aS7D~w?`X92Uy{}4vADR1Y?ObuRR)4U} z2pv1}O4qjvl5YamQNHtoGN&HSZttO^zz9Oa6hS-=n2);DK{SzE6Q+vde1;^FCjSC9$*dy_*- zJ%hTbBmFU~CdErX%Nyeb$#OsI&ESCeA;@k@I4(q&7^1U1`s(G-VP}*LfJS{r7`{#t z3XBp#j3T)A zE{aoA15z}9lo-8(YRQ(SblP(l(>v_To=WdGwoOA(@uxpNPV2il0IpNJ2f3e-`Bpo!hL?RGM5E3eh8=8p>5^l_lXR9EPYY1}o z(k*0k1kU9Jyl--}Xw&XwA1P8^Q?cdv!cZY&l&Kq>B9GCGmdj4wHT^9dwMXYPap)$` zHcW`T%JL;fA%H>*c_mB?l#JLN?qHDW%PHjlUn{q>GpoUxp}-?hslNMUVKQVajYo`7 z>$&QaAbR9@gn)v*X_q1S^FTc3n^;^>(C45_gJ;x8ksNA!J8?Eww{X(y5t1#x)f`Qv z$afQ#`DUDiAP+HE#XzFQfSdoe-ssF`yXbms&A6+g4ZQu2BGnb5t5;(%?va?q$&kRJ6O8P9QtkTz$f0HLozGu3sL1T)XQ$jv*TKZZcy0*t| zK_TQs!%2>%4P>HGk!Wh`(xKdSBv*e;=wIYw7-Vd3f_575 z(1=MApsGiLJ4hjLR@)szko>7!=Mo)iqa96vMJ&dRf?a3#D;$evQ z{_YY+Q+@rn5PCc^9*jnFAMTfUSH-g22#!1STP2Pao1A(Ln%MXc8bY?jv~j`xipY2wT{IOb13X&AJk-5nTR+wl5td2i1=+j94+tN z#ltppQ4jMkmI!9MfaNY_6h(w`qsE!^;@090RmQ!EZH8N8Qs0vKiosb!dcr~y0z;3Y zc?m2$yi;?v#SgG}?w`?N$lDPxJUGnrqzyF6ECSA6iHE zMmXjfI#M|SwM2gyozz_z3C})%JT?s!dVF)l`84z(f|d!j{UQ}Ap@rBDEw3W{Itg{I zNJZsRdQPFi!zloCuI^&>(+Blj{~CtNs_W>xFkZX125*_wJ98t$i=ehjc`5@(yd(2u zT?>W>QqvI(U(%#Yz#1J9RBWcyAngI(;j%jXs@elcsgk zjas-ld1lL{O~fH~9q|_tC9}!DV`;gM=*! z8ip;mpc5sz9uI7RwZ8;>dJ+ele$aWeoXuWdAdG)CWRFuFEcP@LxmdwxSkc?z&}UJ_ z08WXvLj!wjn}~#TCX9NPIc`2z*W@bg%&xvOIewG`y0STb1mq~gp%uS^6(Q2#as80L z|18VSW315517}JcsqYkA`{6di;aW;2wkA=R*}KLiI|h=(ZGMB;EvE)S-hI2->&k0% z9XqG;&yK?V5qPfiI~0EURzMh8%w+%yGtpQbwTJUzWxcJ04&k#-5q-L>x4-B58gbL6 z2xm7dvGamFUVE4Zr@ae^f-=YsOjlm-GtAO}f{z+x7G{VW%aDvWBS9C{t6kOzj6H0^ z8YEmZmqmb$bHtEg+s8(GP#b=%AwIf3^lBpJg*Iv)ludv@gk@!u2{OHFA6|f=Fq7aj zD+OB~lm_FIcUcWY;}m@2*m(lKDEH|8!o1JKb|~q19`#wLQ_GD~ON#)q2!G}Hvt*)$ zd9t^xsn0=5lknsVSWEoU0229mEB7LcH>W7Vgsl%_@8?~uWwUD} z`XxhMRw~@(gYFi7+syt*GUAJxp0gKYG=_J&X?gwDFQyc*lF^iqR$g!<7wKhv-j6q& zzvr-n4l-w3hE0T=>}pxf__W3O`L&E&t$3^wrU9$^^ zTq~O8NYqYbldSWw*?>enK`TBbRn4&WcxtJ4QS?lHx}AtuYG_I?@`rj4X*rCV_~hukuD?XojV7i&{J2ZIr-*=BAMJ&k0JU9NIq# zkz0mMp78F9fe^?!Lg>!&0Zv9yf1mgsQlc6Q2-;;B1cw%=UqR+R=4DvR@&Cl2mBVKp z^$`k`%+4)*RPDpZ+$`m!LPH4&7pOZJ^plAKLhYLIT;iCK$q`45h2sKPP+o4cvJ{4+ zpZ%hK0QCWZEa(A+(-JPhPI>g+A@NBZ4C1@Z-ovz)*y?$kP0pSY@G|23zIIL@AFT2F zs-71oJ&Y}5MHOWGq@sArAoRIn$v&m}RBSsfUX8-fT)OITeMh~nx83g&vx-Oqcgs|* z0bOZp(4vsA!q{KcO(H5w3TQmzrO>)0VYDJ+$~Uf)iS6H$2*$^fsf}xz&Yd&Y5X0HZ zjHgQtaD};It7$bx3Z?b+Fq}>o!)(VO$Jw!?$W@^;heX|Rh=zOW3}!StFr>yb+lI=g zJcd3Yp$`6a*px@(a0;3x=(&u1`w?jX71o9Wt9FhHFEp(_D{=3x62uA}6M*ayf6r`9 z{auu7q^{SrEDhaj2Rnth^rvap#Bh}zQhGPu7Cg6vIMx20KW7#nSo9ih-fDL||8rD| z?F30se51-f=q|`|T*15_ITLh-woarjY*hr4YRGl)Q{BK8@AEZqf4Nti}!Cu+IxrT8t+nm2+GO*-^Y=+7-}W$WHpXp&=F_>|8~SXJ;k>(5GYwS}>~9;4YWl$R5|{36(|VO1 zwA-mm_p+urSKUi)o32KYVnVxTZ^R6m7W2CBzih2-%sCYD18CZgOx?(EU;#>TVzC z00(zo?At;%HQ60Bfd^w)H!PbA>p26=*O9x30bYiwULWM8Z1)w>k0~~hV*-x2hl`^5 zwvGQLmgWW69OCf}RVH|!GS^Kqj3uFc*8R z>e>_(uv`W0+l#JF-(pIhARC;Vf_Ng2GxaJ;u7u6$exj3mrNpQ&j8R5-_%w#@_dyFn zvfSFh;%61eB05sSi z`Yhwg!&_DQtF z@0MJfCj_nYMS;n0llhGVkt;VYD^)vdca2fi&Jxmb>Q(!TcrtN+d|{4d!pqNB58zvq zN6-gHE(cK#CVr}E+uMbADdD5Fx1CzLaF1G$h-i^8M~qM+U23HtrBU;fPGThCE3r#% zopji+n%!Bnw33WI6yuFBU6F8W<0iVBzZHiZWi_U8T>yt@>h4K-BC1D$QCEsYhW~%%K(pj127tbyQhk7Ay!gYzjdO6Jt%k64wTo!kNfR0(2(dmneO zNT(;B$nIq^p)NRYG&JB=)I$JLR%< zzmjY5$0?7q491IWEL@6lbW(tFH3cm-iZR96WL+7riuoI&%Wvc%f~Rk&UVc2OqyLh0 zt)zq%Ry*TI#p1L$g8ypa{k};(6X(P$bCI95$H>}a^Py)5qYzY!9`U4vuN1P2rcC?$ zlVNL5_VeCzjsC-y)gptp;v=bE95bAGZY=oqD|OdI`#wjEs&x1K_?Vh-aSb&0BW~pF zs_jI6Q42NGbW9u1-kcK!^Cb(GHYHzs2!5ZWm;*f(d>Rf96ldZ=5^gw|n50nHT?n#+ zm;B|@@%4;pV=36ej{7<&-t{k{6hYExI-_M{D1Igphg@gvS5->f7_GdMA|ZD`{{(7& znEZjFK$xuM77w{$+D~*8T*P3WT1s#b5Q4u3&1k}6%e}2$Kk#&_wV}x|e-b-#^-6Fz zYTo-I_g zT!2Be5zcJp=#oOI`tRcwDTDphmGbYOy+Sz4xg5n@({V^nWI{v3uHv~MNTwqAD3yoo zXuN)7AcX>t?kRET5$a=B0h5q9xBQG;s!LDHZ2bYy^Icm_ej+o+SP5`$Jv1f%z~3yf zP$(J&Gv_JQaf`vy|1lauI~cJY`u7{0h;ONdWBoh;0Zu|S9*(5HDdOq;z-DAQ83$ua z$3$3P{qZ%b;Tr8TR6eMpX;~)9WQyE7>E&uHhlxf)j?>=2#ILCvT8Y37Yr(th(MYRWZ!h1J(B(s@fbpan5 zN!;*SXL=%wfQf*u8edjrRe}VIxd)(`@`S8pv<^cB3GPr~O5j%vV+_XR*J?o$HB+kn z4Y9}N78Xe-Kgh_5F}hK3)kB?}_`hl5D_2M)#Dg!nVO|fcgZS;a%r)26Q2> z5s+VrrE-t79bfCeEzP8gG@&>rv>9OLf`*wCd+8eHPnwf^d1b6*BBP#@uy{NcJURbR zn?^PGElmeWUbqANIGDFOsRx{weXt5hSaGCZ5!UuYo_#03-SBZvVyOHi@C7fKc={u! zy4obhWSV$($=o?lSk|VBEosrdiomxzXx0$?t32;oPxD`smBja5{XM|GkytzG7HB+i zI+_xONpRW*Wd-t^I!(3t7vo7RQW9G!Ly6#|(XcAj8qJ;fwg=fURXgNm3T~Jf)b?{AxFghlwu)YxhxEJiZS)NI7FL&!Il2W z_|u~DS1!2t%?WR4WaN05$M-KE7P>R_b}bE5?Q~_J7SKG$*`2s}@rt`P6VF%tDnv(# zFb5Oy28(nbPf?AV@MPu!z;Cr6lx{K#EY5&jGQ`6&(#r#JWGyDOXM1CKL7XH!)0WSWHc&>o0D5 zS0bJEzjr@awn>pb_vpmH0}$;w3^y;zi#CF!#oTN1wYo5-P zBKPi8elw+db`nlW#MhUR`Gybz1|~kx)*uH6Wzad z+4w^?sTHI3FOWV(vrBcNKzGJ*RG`C3rwb)b3H zG2>8)%R{9^uPtgBJe49tAcmer5+`{{ckMtKLJJ}L`+>$>9w!FziW(a1tEOp!jk`8- ziUe|c5+g``wWAGqkR+FCJMleG!nIX)1Exf!WgJwMv=+^n(5_Xq)Sv@`bj(;%W)Gzc z@2ZB@YYM(l#Z<}C#p@me^!LN74(|KfT%uUcU|}+(B_v$!tp1Ij*ivQ!BtjAZ7^_ZW zOr<@(=633BJO%nWl+>z3PW^{!OSd>f(E@ozDI;uR>SxQS=K;IGAvIp9NAeyXR&TQA zszK87!&H|)M~H~41*VL%r0>+ZHg4H8u5s|WOK6Tf0x0}ee<|?ixzaq?qNg0;gBD_S zA(=kCH%5uabf_=}GKd!2$Hm|v=pM*BBGu$WN8UeUKFk(Gu)XRKFBbyA5bdb9su7m6 z&HoE9K+nHtmRW0-n>^F2HS2=1!7d-&=XPeK!D&joa2^FQ1^fOmsnrrI8pg#BK6(W`PW8j-?^%>Y%1# zJ?EQ-4xVGt)JO^*IJ8ZpC%76145J*l%rM_c)PW==CPc^UnFSlp1Zig~W&`_FpnF1Xi-ZmVYk(M)eBG z?*xE7f!3hW&5p7p?Q*68}WEeih55*V?c8|1V$59nxh+M6$Er*@mi zJXApP#GbfKPF`P$tQWePqVvkuTI#?in8t{3n!IC%v?}j4r2w!9kASC#R=ij+*9OHG z#-mmxq*0CxB=RJDD0w~`DJD0d)6Y1526{m8RLF~s$q&f?Eg3~%@3_}Mp{;>m*~d5x zoZNOGoqVK!^*FDEN9}TgK*FJ@=_DSdb4rO|99j7}i zg2nv#36Zvh+*I&0=IS9z8w?l?ItCn>+5A{|YTrTa@BDjBwGKeFmbB{yd@O+>t25QCl;N0D7+GD{+rcr@YAL>3O#8Ao8#IgKqSs++?_8G5&SD8{oeu=_d^ zPQH8nD;}21YI&})RXV>w;%I=wYD<|FyXHY^?LKFo-x=#7y?7wKIv3- z^qm1Qe@X)2nhgT%=@9hxADhYWm^{Tc@-FZ!qeoY1fk_A4>jqT()5WL8QpDkH*#t3V z^q6CIQ=9(-bT*R}(w0_YQ)=so&l84Kl+Z5n_IM4D?fNXDU3A8N-eIYMzQd4^ov#`b z=OMNrM+ovoct55A6Xn^vCn>bwjWsr@k4zjGJVJ*ReuHoK9v2Q2k`mb`A}H-Rl?HqUD-6VE}d{ zKiY)If#boCCP?xG(~-F)BEZ^#M6w8VRAdwTF}}APoU|_`X>tS2)FX#}h+&5MjMjD_ zNb#H_>vxTmnK@S6zz3gUX{Kpb!u(?ki2ZQLB(z3*C~FZY%k+?>R6`9}a17CzKq3IY z6og`t1{o-1@G2?dYR}K$O(bYXbAjQ}KI5~Pqd(1cX102Xv!a@YQ0^N~#8EJ8PR60Z&V|tu8sG~O zUg01sgSE;DQ>mer!Ua2@c@G^BO&6vD@JGmi z&U46(LZ0n^Cm*K{l&cM()za{B2i_ zza!H;u&@;2AN1^9oaU4d1gFo9wWGCeFu5eYJeffpbny^_WC#XJ0Az(?c(*5u!ww*2 z>4*TRoV`h4lCeIr_;@H>rQhFv7}IeGP#9+H$ufm90V#rx)8afQ7Sk}Jj=ZAuQdNny zrWg}qxG6*Hz%)puO@?vnTI;SMggHx7pQ*lXs2EJt0_EYo7q10Uj)2(Y7Mn$zM0 z2;K!2GTt_#I{tVG*R7UlY{@JXLCXhHjyR5jquHnq%~}aRseT#fK(n8n7gEsrC|t9Y zeQwgw{od@g)ecMG4f=c`u!$W98mz;RR17*_1`sMe6pt1vuof<`Rq6V{GN8pd>>HUc#MOtPD5%F% zRl!K!W7Fk2A||J}`DHS*>7KUI?Vov+c2P`yJ4_5MQ4$6eKwPqOdmn zV5adY8IlxSSb6$&EFypH8%8qJNf`X8ODmSwVUgNf07D@1u`==`G1{lR)nCn*?Uaze z8ERJpU?O{DDgeEP3u+nP(dnk&8#Nh(@(X06EOCgvgMvge;pb%p$82x+-$;n}lc5hp zpG$z+hc#3mp?-|6fOKsTDN`FHP^?NB*PUqO*%1{BycWECs%9*x09AB^as8SPBrK=W2-Zg zeLhUvw{SegHUv^P*pRj|RI9YJEHbq?Ik3&E3*mcMp;4|kJ_Bkh?XXo*kz9jEw%|O> zAdP*cBGgJ0uz2SQmQ0E}jenNSVxtW1dv@lN9q4kNGh`W~&}NT9s@F#3veFQcWS1y` zA_lDmAZ+3-4aow?Kq??1S3;p;E5vHNBm@9?+>D8%mIOHPL?$WL5dLlAqP=Q83Q;yu zS{b-J7yI6|9OiA4X@erlLErB|?E4i*3?#}l>`N$&p8gV=Pvqr?ED=fjrWz>1E z6FUJJmx8-a{V8)|W_~tK!M1E{FWA%5M5f8uw@Dd8EY07aYO(d)}rCQOWY65heABPXqQErYW-2fDnrkO ztE2rPTq!g!0x0Atth5e&kuT<(yv#_BF(!)`^SNmJ#{k`<*_prG*ZZNUVx-d-uMkDp zqEKQI!9SFjt0+Qtg)D(CiD&TKLOfrp4g}VXzzU~20OcdVBM3yKcE_5dW@g&?l+>7{ zIv^^qF0z7I(G0j-EA8yVXg&h}`xcAvUJz~!1AmeAS2x5(3a!zyC&<5RnWQK-hqOd_ zc&(bTi8g`G!B9S3vE>@j!HHKS)Cp5?@`OBIP{t;Eh`m;7d7&DDdR06-zI@Q&Zv-Q6 z{oV+P!PH+yFCt{2@6g%lc(b9)+5om{bif=Jxh)rOjZS!2`BEG>Gcw_ZNM5K%vaD(tF!1aj%Rtq_uY^j?pqW2L}L|!!!mNkhB4gzT$Kjv@yA= zJwzG=JTL{22aiBJS5s73{;d*vfJdsGM)K*(8akWp3Y}5?>v&b&zt{&0_g|ruU3^hPfd@fw*3_UfnMaL&{H+@!#6amQ70ET-< zu|Ypz1`Fs?6q8c@vmF*bieE)i2%3jEB6eIxnYLdXs1Ypzl<5;IWn&Y#J>jBb*0aw# zs58CR#-X+&j1K(EE-YHLf{8VZe`mqWH?1F!a9p_HrTLM<2Dz}*rq39~1`Q$QRL-C%0vP5VD zRJBqG!^prX8%vOQ8Rl>)Y*PKEMEU0X1_6a1L<0{AEQ-YAIDy89oQcuUb}=VR@rBu8 zxS^a4jNSU>db0Cx46A4zlb0|pv~5w4(c?Y5GGSaDXCX!{au9dzE*%e(k-{o;TUrAT z?EJxOx1|o@G_ipNNf%>syK^T4yFdxqVnuN^N4mazcURzTMGoA%!Qlgre8$qF+&32E zmkbg_VtL~+4@!v(%fsYHoQpl|MfFJc(u-m!lnD4mQvMeM{-EE5VUY#LUo|A1)_fqy z4e46XLQ%odYP%q#{E9P%MIfveEH?7bM{63%dxtUDP6Pti6c6&Ic?%n#Vdik-WhiVY zI1v_rMF!~t6aU1NDHo8)**-``MT3o*Cj=*f;-8UE;caqdzezL2pO{6hFHn3kOji;( z4EIkc;b@F){zhYjuyu&-O=+d7{`fV5Vs^gS}r zSlnz8Ufy^}Z1`vtnigWm!4?Xime#mJM~<5aKp>h-1zL~HA9X?et-KMkR!ZBBSEup} z<0}P0xUD5UK^yKajIh)6%pnU3$6^cnUjs^(WJkRmGGqQn|94Rz9JC3vPHbpaH}2+m z;UNGc>@|wGTc zn*CC)q?r!38f)2vsgP0}p({#+tte3(dAODUxSkY_Xp6WM(ycQlk>? zi90?Q2y`8f__Bj69I2m_C6sx+$`Ci73zahi4QQ#f7PvCCC--9`@nmIR8rm3^al&0+?ciPZVSfYtY_kBWwX) zp6!T*Elqhf2}~d$8UgO(P0b9H5-m$5i?4DAMEqWaKU51A8=pheK>-U2!brk25D-jZ zlt!DGCN4@pZHe4wRFY$vCjp@%m`2U*lR~5YgMq$kDT+Gx%+D)Pl*Kww`z8%2&`4$& z;gM`8E+{mJ79N7i?emDeL75VTddW}~l79wxVj=@)O1g*oiONH*B7l$$y;QYF{U(f> zbN(Gh22oA$&m}bHx+8Rjz-V4F>1U-sch#wX4$9!Kzf5y?qR6C`%nZ>}i}kNDb=8MW z&@a*la2TgL*_*dnu}`!`tjs3A4frq7=1b0>#>CJTQ;TuLj;|$=Zs#f^#Eso-jzS$n z_#5!N4U<;jYQLfw*}|AGJSzorKs?F-nS@Mo2Cgtjfd;|)WyyXl#t9AVro(Ji)cy#C zI*Tm3cyJh71DShm3fl-!FhCYgK3#Ij0GMny<3MrthIShbB%$A#=jA#HrY>sg)ScIG z>%2(!sh#7(gR&Kv>OZ1q8Sy~2k{-pOw?&-2w*&!cc>&HmLJI@LA&hvKQ3rw;t$`5v zDM*QOIQTChL~kTeu@e*oe=}fE4M$fJA?WR$j+b2PnAyXL(~Vfi`fRoplMeQJ8|Z48UpB~H_8y!d!9pe^6HHD1aUz1_pVYE?jJ+3wcV#7-iw5}o<8 z&AS4Hqy}IF1q{@n(RIvtR6r~&ga8N*@PIlq++i^l|0TDP=;Hq{UyzJ1OVA?6n0 z4QlwkniuXNq0ABZ=3(Ppe^{zWhR61~>Ga27j`Gh254B8-5?STtj!x0X&@q<+fDe)I zaFC3whx5$L`U8{1!ImV2V7Ukv0HLU&fWmrCtO=I2{4MEXZUW% z>9&DLp7LW-HLm7|q{-=nhk~AF6Uzu9Nc$}fQ7bZ)bmUmWU$Hcst&8(uYZeln08gBQ zNRYG0F+E}(L%f@lr$~e7laWe?ngZ6Ds&l|Oe4)ol>_v$V8oJi=6}sJ`EHD946S7pG zs{9ZZr*dt~6UahCj`Op3_JBwW-Q3Bx z|2mRHEuG2CBLVydoBRbJs&_OEv%Wc{5qVaKF18Lc)8n72VHMq4pd}P_Ao+qtQk-mH7em4XOK1+uveEcxLlJ9YyE+iI{!6(Zpc#W~ z%a(LBj{H92-)(`>k@G)^M(jDoLS`@#rbmtnbE)AMo)UTE9rs6T`Fo>R8Tt4bvx`{1(3U}|7q1)xk?AJ;`EsNSj zoot2O!X5_KVP^7>_5!!0H|+N7rH!CY!%5`+ELrOV^?*o~@zJcQuwG06Z&tI-HhTsc z{HWxvNl%VcCoL?if#}y70(3J$`vO8uHU5v75-j7>4w`m>&<7C{nO$X@v(ftV+O*RF)vL#5k^C_^Q%7jjvhR_`)>;Vm+FN|}p z)gymTb9zD5+%icdKC_YHs{l#h9$}Xif)Na9*4p^K@+qRX%9X%h#k+0}fpO6S!m_)2 zx#?$Kec=qO+g5YPdDNb+U4OQ6C0grZf2?JpM}Vk?5ugl9v4p9TqU(R zwehj_SZigl-5|e(BU4I7ot2wHR*M82NJvq#Hemw_Xa!TNSl3#@p-SQx!!Bh?;U2=7 z@7dSC57Ir9kjC3}RhAS{@d#5;1lAS-%N7?X#!ObJ0Q*{#tTKA}X@K(n=oZ40Z8w8j z-H`WFqR5_0%?P&?uV7fD7Ec!bHO2o|x_Vq&66q%du~yNeGg0!a>Cm6Um`808R+Vy0 zFcc69fue?5SA_LF0IxD)W+9-i;G^-Xx(;_@LU#@?kqaCzaFYoyp+cfr&4F^A(ku%? z6b?(lBjCjpw!f^kq;XMRRB{s&WiuQZ@C8d=aq;rB*j0$LOJL}5oV3T`iqZx-PFA*P zxGk`xy)Z(el4?S)0Ki~l*Ubb&k>#cW)6$Ia&5IF?khaEE(;Y?*!LU^}UtLKUw4t{* zc+q~-)bHIzLx@az>jYuL!j~kJaFKFvUR#Ptw#H8#MwEttL32Z4mJ-=K$}Y6L{*L7k zErl;};dP94!}>%8k|o{K%71cf!xyuL{1}bwW}&^qar3-BZKY%;;+f`ci;jQ$4CR^l z)Ya4}O@PFoWsHJW0C{#(t!RP_t`>p?-61{8QJO*~IGFe&CZ%I2zxRnz7+UWuaody- ze6`-on7{<}gW(jCawHQDlYK0-p<`#B58DL+Yl5)ZFcFHK=g5%Ihx58Q$b(o&9%6mCUc^N6v-aAsc ze7TH23DIau58oINcMYJz$zY9a#lDJxq(}hYYA@{%ZE*XTH3u+jmi# z*(?MSVWH2l(OGhB7(Znaj)rjuOi=dh)PIZ^c9TOu0Qv^LFaWl;!T@^PSg={7;ipP- zuK66IeGU`|=NLR{fJD)xb|)=a$8Q!APZ)r&Pl{eK&4c3FoiAJ}IC^goa(@a&XJ$y* zBU3yIMiVK^+^WzU*d{~CS!Q>^d|;i%U>&AFX#fjR(mdSox5_4DWD2m!X!?IkdWbo5U6=| zVPgD^i0w!^S(2L$NHLC>Y%%^q&e@Fk)Muh17!6Urj6@{4C=bT4U_BON11L58s4?PX zF>gdjJ+lvaLS<2FIbxZE+8HVvQCQu*xjBXz&tUJk*c!DIxB28dyFa)SVJTL3D*E5qWqDE7Z`i`Zd*P#PzBqVkyZ z5q%lpV%R|9YCX->J21*3l(8x(<>|n|+n(5AL8=bd1Ry}5wzdQOPW?S;wSfddz=AO+ z!7U^Bjn3$aR_-W+pLpTYsJ*&TzW2{|A>&*in$F9@WI@OArgp_)KHSg33^s( z5~`f2W7b3(+uN`9F+<@5e(Z;3i8qzYNWT|_tjG`ta71e>%F+7AVNV<6Y1}AA&v=Qvs%_gNXx=;*d6MyF0m?T?Un#o31OYwfPZID zZzNh_l4ob41SEtA6oCx7@U6ZIRZ^n0mlJ+8srg`Hxk>aaN5?3Sa|R2;Fj)4moM}UZ zEINtcya{S%&jwoJHO-jj#smn)wjD|WBYNOQlC58nohb2jW;kgbrh(W-)7%G?UyuRK zq#$@)8N|iVL4v!PW4=H@SyOn2@C5{mEGbK_y07%OMkOEMw_}S1z9K~+0eY|#i8L&r z`O$RIAgy_)#!?I{oEbyMwk#>y%Ly`D_c7-lEIxv6s@cGjum~#fakjfVOI#U6$FnS# z9LblHni{IC@p|&viO{*&-8yhv3?c^*I5y;d!(m?ftBs~fM6gn*^zmpW!m?BIcZ98y zTqmBGxINDRj1|tUYb{rhbEx^-$3jOeD1p&73z1b@8nXhKR@@6Nk?lHQ;uBp!ZM%lR zX)|>lLL}?SKA$WH=y@juIcC&!NIHkhOSXnQF*6fAANb7#OM0K-N#muPPZKP~#BHNVp!*5$Nou5LQxB$Zth)w9_gP8MVrYqkOc0 zkHJ$*X%k9xA2m3onQgoigKInz1YaP>Q0Z%VmU+=VfXd_X^0KA0ut4QcWJ^5hJ`6ua zuCpX!n_L+Hpv)nsrl<;kD+}s7la&>tnX#9|>Eg-?JD66St-s=I(J>+j%4L(%SpzF; zS>fk{L`;%*6VFrQ3Ob9LtAU*f7iP)Dxg*8$LpW0nngO&4DGN6Ga zz4D*cG5Y9&*aaW$)`_wl00W@7hzU=vjJ^jKrN|OdB_=|R$)IErcOzU3PXGzP91Hvi z1Hl^^bMsoP8b8*4*}h*`t?5K5o9(L2m_g(;hR6-;>4-nw1Y$essv5)r@mv=#!+mVN zy369O0e5E`5Do^y)Vq4weGDxy==KBE3$&*InScmzgD^d?bg~3>CN7J|hGT#TVq6_H>LXckc$bjRTuVCLUusB6cyzAmf)Ai!_ z#NL7-QejN*Es8S0`o8uSvn&U&yki0>-hGK8%rLOTKyd0wIP}F1=VeljySB4p zAC4tj&8X^{G3FU9TSGOf;e}0Tv1%pb3~bca5GaMH!j^hyKwv2Kkoa#D z;0KmE9^Cr~I>STVp^-DAxC0TX-;T}}5|Tj*&`S6NN=L#tauE?ESk}Y5B?#=6kBD_1 z?hI+lp^#}^Q@oV0SQ}71VqQ0ZWKiZx2cPjU$b?FL&64ep_D%dLZb(=#sQzpHc3_4q zOhFO*A~K*YaSpn7Q^k2$pduQ{R0s?AbcoR~WCYX27hsSq3kKuCmN9KIkwi;E^UrCo z6naP;$%&f&33H(+k6xX;W_o;%+j1sjpg`HqnUg@1&UA@RUDky%TBv-aSXR#SThC9Z zqE0FlL_fE&{ra&uWBs~jX6h&ozJOS-)u3kQ#;1c@bDs8CKdCQ!N)GOMNgPylAM5tB^Tg+x(7axuJy z94GC-zN&g^t1IzBVrkMB9GRjbPOmR0msE+i@AmGVDVox*h+UJysK8Q6=M6dl39=$S zs98&3*h(IP@Y3j|uAJ-d52&RW5E-^N#YWVn{i{27&cWY1_5isF1~i1p&!Ps62gUYd zyxX*Z73$wL|Fz8)_&gFPC#22_m*i9$rLK1YI6@mD*C{G-FlpZYw;i0twe}~AGSfQw z!C0U7L)gp|46XKQ2ep-=RAnwz&dX%Kk=HGRLSn&OW)TMJsy_rj{=1K*&{WXgo*Gc2 zn_nd;t5X*425l}ot30tixWqiA1b!O>c$yy8v)-dFG&L_|65kx4v;YrKVbDI5MHG^R z3el>MOrP7Pj_VrxAhHnyw9!6MCYp9Y1WKWQNh1Zq!Na3sjangyjt@GKro}*W!(I9< zGoj<@=PAKtkg`gB0Ul92Sa+2KJcXg)VL`sCP+QUac}1(GXjdOh0|Rh6EcQPvaEBBi z96an|jEZcYCz24@lz{N2E9Mw#5P;LjI&F=`q~&C7<<)zftjMP@-ieh?ELQcxyhY}# znQ;OSr;t7=q*m{7x~Y88brlsasSa|N%ZuqZnvZIfWvI|-gru{fY0`zn1&Uy9_%Flv zaahF3-!VeC_alhq|Hd7K$NqU#`$(ja5uK6goYrYc9T*cpY^LA_d#(g-s}_hO33!{W zu<;{BC^|VSP^6c|Mx%YvyHsRkzATp8cR(dvA_PUU;>Z~!pgDpzIf!)KvnNFQg2ht9 zM5x*Ffz4G3I?7qoSRr`TivVfRJHd zoJFkEZXfR_Xa$IP;eqzNtvG}ta$SJG&5q4E9gjFE`b*4zE`c%F9HiNZg=JB9(&1{0 zWyr5e$4?g5fi3p+E_BhcYfTh#xGL@-T5T6GH2&F@G&x9)s}12;tzbIaBnvJ$ICaP& ze^nu_1xDfs08>W02FLy635_!IVp;=mhx=QG(k_I zyz44f$^wBYtxB;?Q+L5tvdZh$lFC%@zB?seOIsPAd)7I%!%cw$0D5N!$csEp_%82T z7%1q7K9@w$*S3fTfD8*O_c9H!4uLR$?~8yH_N?EHi{OZ9Y6u7tNkB8xFye@Hy(f;E zy1z0c!an5ClOL9O*+xdH(g?FVCq4%2v4P>XWh({1DkWn~aTXvyP$$oZ`H1u^3@5_j z^`+Zb)|k^Jk!jyz6cunPNEhJ+e^=0dy~U?z$w;8q^|o69JE4ZgJ?kzX4v3@%!{UG6 zu8jx)Li+`<$4Jr70=lW!pVL;v42Vv@+hYx8p4PZTGK!^yK|7RV37)0~2@DJZdm(_Y zWJlV3VBKqk^aw#!Y6ZVl`Rw8zfFUKIMW*0MAmsXzCsH;$_L7IkIfemz5C8}r{r$5D zd{=>IW55BM`8323BGh@z_Wg;tF$51pm=?>I1e?->(hQ|5Q~@HSp6wiM@!z_77*y4n>&`>+j z06xsW@8mRfTozfzz zZ2VlioyxFOLUDBtNoW9stu=ZI4!wsq5=5lHqz<%jQa%WSQ`Dh2B7$2V*<%y{Bqxpr zSK58v zG`SZEQ=|FhA?yJWAsF#gP|xxo3%&nV;a#u9ktlmGOm__!Pz{@VFc|zlsp0ySPu9M? zeaA(C1_wjnsTOhtF-JbpXI+W;8kXGymUz#ppCbUharZ^hLiJ|XU6AwdX=E@`DCkYi z3=}IaC6LkaY~Mqf;N}WLQnyNY<~v!EXk*v|JTf7ph3gU?8Z$A`?Ib|sGDwT&^;jYf z@DX@RLt?)HeKs6-^j?MdWop25`Z*SF_ySTGf+sOT6k#+1Cdoz0C2SltLr1lF;7$^= z?_{OrkFfcWGFgmd(*g@hxl6Gk{Q-XpIj0_6N=__4;69cAsXC+(FRCEY!m+F99IQ-h z1HkwQFlgL2WujwMNFk-Q3r2G;=5^fQHnrRd1G`-$qwpTjGsy}kBbxZ1Dr*#^Ql3RQ ztw$2#r?j~|sOZDDgb;a??gQuu9g9|#=*5hMt?@;l<|9ZCj1 zEcQqS#+J4WAnm_GsU-apwifKKT0X_oO;%S{=_oixDKMnfR#Oy=sa^o1lAjj6pe#zD z(w>71(70IF1Ps95E?yfF;RSSxE~(cug}_ChZD73;>RsK;YhLDP99uish%65nL|wUk z?wifwh;p@{U>OP2NYG0V_h`krC&UzFK53YewW4tCLz~K}yAe7vj9t&o30)KecRGszp2)O(re$IL+ zTFc*{gB=R3l0c!5`xArP0!JG*7)Xp)xg(CFiId6ztZ9+lf*m;#X?Sd+9!5^XepPlm z*BBRwM;+;Lnu&1cW$STl2=-bVP+bvO?VH`;75SKt@9gK zP=cW+lc`mCkoPcV_vszRmD@ex;T!wypI}$sw zSGkxS?#QQ--pnkXWY5NRFV5JZXxqG^`-*(f^#8A^j*cg=Q%EwvQ`n(iguOCU;vEN- zU@zIu0Stu`e?$pkytDqWx9in z*8g$Cq2g$-73Ta+OPoY!HRt5%7`zn?w&ua|(q`eHe*@sk&k`J?f3S72vLk}OA5cI5 zg*}x#yD71X0Gc@0j*;{@`>Ay{JS;HKi`ejso$^(&<{_@iN#8Q2QNO{J1{d~yo_1Pt>@V3Of?LefzId^#%f zyI?dh=n-Xd$mZBb8^9jWI4Ic0Yprv6TnmL0!a^CP#1Dv;TJIV0?1yu8+3rAtP#o?tr>?)Kz|DPY8472R0<|)qKOh0N-uY? zS&<-XyFRE!FFIs42kXNOVLG+K5iKBhV;cT%dqH%71kDgp)& zsgH%$$>utLqrN0_%%VK`;T9?hB)#ddsz`*2dmc9sm|w;-jCV@k;dgQ5m`sG9am$^N zZD7LSP||v>+9wG9AU6Z}%(dV<5jE4cLHkZ%)wx3X&AUmByS}`;)eFW@-42@?xiAs$ zUD#%yNQ&~RHEfPg1B)$?mBQw74TAIh`(0_S0jCS01)VNl+_IwgHLH@%qQh~!1 z0m1J#M%#181prie;{Iw`tcURn`FnB)u=|+MfosUgz+FYVBR`nS(3$e`9#cn0$fCW-{J- zKV70+l`gtvv@?pyCR?*Lt6sBYMFG-59y7P=SB=e znfRUiJj{hf^3dX+Nh}7xaD@Sn6Ca&T(u;o*fYu$urJ>lL!}}XwE0sQaf0?B>Lyt2} zVy#S4W}<1IVC(V+brX(#pBBmxQVOkZ=N~UORTS^?L5OVy4q>5yH34u8o5L4QqBNrX z!^UL!N5JFLNH!*Ei|~J=ECL)M_I!Sm2%9@WW|fvo&?u1v;jBW>IiM{R?6#etr_OVI zIQU&g6E1zW?kwuekEum?T%FjO7V1Q*h_LxLugHDNzqf$Q$Ae5xLa)JzWGHe{CZCQR zy1M;5&tk?0$|yGqfA>VKQl`K!O_QSX`$k4-0vCsQb9_!QwD9RjUu6!ie^~`!zxDX+ zf`K`#*U1MwJ(tgaiC~Ts6ug;b&hl+0412lNDn~fqdp!GdQ=2xB48v0l#V=e z-Zzy}H!z6qYkF0QIkQl*QW0Hwl;>%)y%oUdn#@N04uw9;0I2{h>Kksto%Gz=xnhgB z(YeZSjkYBO3BdYSv<0h};;DWjja)bq&Nr`_1N|zs3hw- zBNC#^WvvX>*R>2&{Jngq>f=lOCRO2GkFp!K7B#3-DVb;Dqk;iwzE<{dn~!|EcjC445>}()P{b< zz^8$<1M&7iz-aM5WDn6INCyA~X0J`n1P*oSK4CzvaFP42tD@&CoV$h|wupoLVU1mn zM$rgRiW7j@v+q{ib}?Hy6%sR)N!DCD2d>M=Vw8qZwpj7u_l8XhK(`7YN%?hUOcx5z3~@%eZ%$4vBxE_@q%u#}-1&pb$uV$*w=4)7;V|ZE5$An? z{9I;)2{=%L3P7i6YKN9$XLEdik#MMHU1S`PDU>vzxV1ANl`#~+Z7z948>~;zO@QH~ zQz`Ok=3%}-%mDYofnd6^5xE}vgClw1%oVuSe(y4S6ro{UJSJtz&cq9*;l328SEN0J ziREB3u>~nC3&n$^XmHnHao*#Xk3C>C6drl7{t7X8TVMt$0>gh7W2y;UfzHci5^E{A zAjoDwhU<$3Nf$+sDx)#@<{^$4RrO=IWjOsz6tKiD`|7ptclbNuMTurBxGQk;8EI=7 zP{QGVgCKjDSi>VyS%65N60zB!ZF-~Khd}XW<;qT)1{FR!9p&*4P%4py_sRs4A)>S^ zE@m-VKUc z!OHht{0<^eb_VU1#JXr9c77(D7hEdo+{6e*O$7S@*M{{GUMNIvWD$AqQ z&=#rOB=m@f09RTZ$vHXq+2f3{Tg&lO6GQca64!0=Aw5UE$l1pJSEU4%g$TpG9kKHIqV!5 zgeI`@2h{R>Z3Njj-G~4Lv*!?(VmAOFbH2j73`2+{U>f<1lxjT|;a-gfDPi=*#Pf9ldF&jevss!IsT^wf9EB1|385PE*HNG`qdf@G z1_m(bjwjzQW&azHfE|co3j-|^%=7{`4EHyFl}=C>HYA&4^3g?+i*I=b%s}}^8mB;l zh_!__{Zdy3=!|9@UW4(FrDYKrMZC?tZl~{q+CodO8-*y(hRh4hOK$GguBQ!f+tM?Z z`M3v{_ok4+;-Zr=Dzi1bPOQ39yGDpO^@@jVf$N6EX1)nkqCTNH#!vSt^@eyqAre-M z#C&S)u>XXeEKi}tDL~`T#6OgH#$g>>YhBZsNLr<9Zb0yh+-2C&Ar_5e3SJ_h#+$_= zmV4BVq4~PWPuncYsg;H|!n}|+cpyoIM774v zO^--5^f&-+{-;gsBT{H`)h7P&H7s@2!yT4Rk%lk|bb(1`V2F2t#L9DrR)aF&m)D{6 z*h~Y;W8X>Q8#;~v^rqD_q#p-Jx8Jb1!bs+VfewgnX`Rp0clH>+LJJEFLX&Z(9s?%% zQRO$<@Xc-+H6Ui1JKUym+-IFW&|OG!B#+gRl#z+)cx(k3OdM@aCyS$}OF$98TO?6_ z#;Mk^JQGrumPEUJ6Voflg1Q%H&UF7YFA3A78q?qTf2xXD*gn#OI_j0tEiU?!{O$}O zWj`g-VXyO9eZ8}k^C`V$c2(JQ={2~wt0nNC44eFvtO}(PCTm!q6}7$mWRE} zw!{JyaK*sQQc$>zr+Mk(A*dC%a}1f|g@+12-H$_gG3_80Sk-6uWY=;5|z`tFl0=f;#mvlGQ?zli^lD$F? z4C6mPY;}ZO!ghjx((8e3Wq!ob4Yvh2R}FF`%K4=VT-FoBtPwG{hl2|uJp#RTG!5kW z+dn9haS~>!qX0{xE@(jLur?H9`H5?dL0zIZT95I@J1-Z}>(q$Z-$R zgTrU<6Z)YW0)Efkr~;NL?7bK7rD#f~3iaa2oGV2|W;?|ByTi?Q;H6Cd((zGs?*{Q$ zqusfyzr098LnDxsBq(-oE~!X4oI|J+S_lteX$SyxV)05`L(MJShk!f)Sei_c$fz4y z{0hOQ7YeMa{Jn~oa2_EA+plYBfq@8;)`abAB-7HW7eP?IAoLL(fuVIJCMeTG?!4r$ zget<&RS@b5FuU`@EB3j}r(n-kLq%22p>bUgVaz?qKk9fOVu{EP-u}7yzJftMZiGg= zPDo7C9UVkE+XcDe_-clr*6u6RVmP3E0t<~wRJf#q-DHzwFhIG)Wx8ni@k30GP*DM|iyK_C#|&%$4$fe|X^3MP=RDL7}@U9SPeHP^N^^sb+1 zp9V2PcFt(@!BR_4!3Eksgk+W$yxv`LRVFeUHfV$v|Gz$m8G+0Y;KMtL7$C8sD&6A^ z8tt3^oyl$j9a`u{^a%e3wlpLpx}o~xJo6k3IAsLJ;0rFHy+=p7$G=cTy<>2ZLJ%Vw zh&s^MSO%6!AovQlBxTyI1!)bagEXAh#COP3Ga5GgI0E|EQKd9qYk8pG@EJMB5F#Ii z(?Zz7?-n5H1*R4AMOltZkSDu<`T+(YBfTzV(scN>_RL@AQ2z|k%$yh<9O^O%+V8H$p^x5B!&fqwM6W5HnQtZ%KgZtYJ;%-J0K`*@RNKb6 za)5XeBeyWXQX7bMpeB$(j!NVcJUvC$v^lklNjy;sn*rn15LkysA=j$g(w$pEBSLVkBB%Y88T_Bl_`FrHJ77>&`7rX90BsbvmY4IU3Ik@&d# z%V0^5Ss$(ec@&20WsU~UsdY+9r8`n&L4}b7D_!|ZNIF?#uzG?vZ&9QH2taFUa;U!) zpOopLPK<+Q2gz_+$(3+r(Is<7@|e>CBxI;{!w8eo0cxTh{@wKG1UN$!2ns5)0UiL` zS^ZJ)5peyp?GBBBF*FkE7F|35xS~-n6BFO}dnnw4UWgx2sQ|l$#kyW0O)N#s;Uh*| zBq}TXPIUZqvNQ-;&gm}{CS;h{G9Rz~#K^@VmI~y?PW@S+Bsvi^Q1QsarV|4NkOenG z+EwQX+zdIWNy2FjLjxNE0_x~>##mpRZP38KfcC8+Dk+IlBLT!>3HlPDT^PRuv#vR5 z;W~d@MG}Ja(g*~_Y`}dqie{ADK#J>}C)kdxy%WoW_3lEWpJ9`UK1P&|j*Pj2GCp zWO8?>j97(h8LiI1Fdak=rg+nF*6O7Q*-Lrtn}jy=mm??!+jXvgS}lbgqg!qHo(L5q zGnw$|r3yz`YrF|Ad6pj8!nvd{nc@)iIy2xJ3fg)d z;X;~y_gH9gr0i!OO-bO5xJUadI~D@^(*)GM85dI6=x`j^3T)idi0ST+0ZHy8e!Uew zAAn&6zXu95(GS12jO_}Eh>tLc_}5U3-GD4k6Y``J#UQCk{HX;)60)9Z53kunrzrXk z#FWflWssd;p@KC%(t9ig7xte~4F-jBIEQ>Q%xYxLyW(aav*v!r)YQuY6DY8U#_N@j z!q^OtWE{nwF}tm>Bko_+iRyxQ#u>ftBx#bmPU@1G*XHG4((<1qwqs3)v|2=Z93W^B>lK@N%1DWH4 zh-s>K6QbdX`{5=`X|U0dH8iO2L!8lTwZ5@G8LRCq07R^VY0X_96LH$gDf*#fC7 z*>*NZ#d$6hNI@Vnr~2GoDt(H}Td9 z#W+(W!}0*A3t{vR__%C4|h><<(a9k0mV89;2~y0GLbaWqfqb&Wdz+2 z3KG|Q9N3(hLI)18PI36QP$0m+oB}7zoK=gipwZ35Mh;wUPl5W9?igb(VyT3ff#^g0x^$1zxXFf!HQkK zS{puhkV&Ig{Nc*%cR(7`rnp9-8`s!kd}3fgASbXLHq zzATe?n}agP1VU6Md0b$;cBXcE9cL zVR4aVL`QsTXbZup5SGk+Wr>#~gv45ic1M~gy+@flV56X0T5vuO>3d#i*x44r;fBGWnXCgZ3w))l+TvRFz}E-@;kRK zoigNz#0I2Hp_bTx1F_l5jZz64O~lS1P(WMWYSqKy^>86z9$jj&NP;0v^krWlV2lDa zP)$LNhM)yw-Z@FZ&jhPn_K}kk7NtaQTMLI*fkKFk*aH0la&yH3TI*q9T~3T_;;Z1Y z+t*=2kKrg5fZVHPu=(nkezaBSUU)z>3|Fc`_?=El@VefO=oo!#-O*%@N=lG=0J@+x zqR5msA@8Z}2t#rRsTFu+X>W@II`HJr3KsRvHSa8Cte4vW%zrVOWb$(gIya=L&F$o8 zC!W)pomoa``&sOPNNy)jWAuZ?Rn%oh!j=Lkb>4hg*+KkM6IiJPh%is>)uF2#S2@}I zC)f9Fwm<%b41e=g!jkwC>*Hj*LPdKyL|oQ*K~DOA6erODf?pG%!i`9Ev{G_4KG-z55hx3fZ+5}ux zFll&T+^*}r;D#@5E_TJGY{}FywEI5_<gk-VGiT)19+e5*NrCbeBIB}VH$^_t0a~>~ zjTLN?6QB}6UB2u@JG%2%H!9(dsA_mf^+gn0)Jdgh;*=@P?aGNXsLTneKH&8AIwx8} zPiEIK;(Xd9%UyTw%bNqwQp9dR@lAY=E=_w>b_JZYYy?BicG)gTXLb^MH(wyr(xVwiY5GrR^@E#4%k`@6b9;KCHZZ z%L?u_GUh+{HCeE#LOvoSNMb+~aAnpUfvf!mZfG}eWeau!ARQ1TjWEb8dkAp39Vj~U zv@iG5SJew&N^U1T(A+vFra=^5vu2PrEM!F6TUH}CoL6JJZcM2#mC?`?XOy`@g)wL5 zKteUGP|MIw*v4}(AQ()W033j#<$fR)qHJ+JC5vlZwg>X zD_$6PGfZir)_HHmiaBCg4}{=Z6jOaWzLqhEi4eguCgSCnrqG0wgwkGg8&Y13uzZDN z#*>x?-GL|;`zd%;0YvDoArwX`WKaa#Rx8dVrbIP~RV6UPt-Cnt>|lp53j8Tr@fshj z@l7;VkOrIjJ`Gw^xsa&sS_)x;0c)Qi5k%+ds3yD$Bf#3c>MM?6fiA+19}qV*hiFgG zt0D4Fz=E)~Kg6+=(-{WUX(TkALind7oaCB#Yea=&TcAKDj@j5}@WE42@&fFrUg&=Y zymO9hZh!_3`Jm&_bFz{+Ym%+~jJE}KoP&fWh9{OYUVA&h0L%n|X^!?3kRZeNcv|ZN z?lr6BvY@e{w^7Zst)uFD>Kop?J#{8%t0xUE8)5DgL{V`|a-epGv(n-Pq*F|(>>0NK z>f%sQQiXmM7F7W&B(Rd8P8lYmaS23{uO+NYkda|K6kBPt}dP~TV`5-bc z2sk3(hh$&~q!HdAbcAFdkXRhNJgjhlc~JNf)FY_IE*O|*V9OD?15Jj2400KoH0WjV zp9Z28gk1q~1j!ICB)~&(kO2Y$H3-uWTpXk`NMvC7Ln4MJ40Ippe!-$cfQ2v#LKDm= z&`_YDK@);zg4PDO3WOC1Ens|rssL&N><9P?;5C3LK(zsD0=@?T2pj$Xj{m!S>;D7& z|L{IieNpqEupdodiF~W@|1tRQ@muAWsJ?#vX!z*%yTG4P{5E=f;iJZ7(0Ajn@T#4z4zC7QD2%3Ff)Ocg-i0?QXz&0ASR~&F~(D z4+FO)zwl+Ru{)gF&e(R9ye*gahqMOOdS_{`p&TZbN3} zO4>MqZ5rdExMe&rj;N5jxiq|QdR&K4@n$r5YVhF7^ggha6Y%&gcSaJzeSVDx4g+gLDYO6l@O(c_MRFWi2fFL0*d2lr) z8n#&-XQxbsNQp1-1>ZE|25lV(ItxN336wT|AOUA~<$G#-Lm;EUflWQ2PaKt!V0)2@ zjJ^F|+4&{1156y1XVhq>2He_=DqEeIy1hpzgCD+R&0^9)0J$9*>C2In3%|&ElmRjaUw6#F0}I9dQeSkV z^RzLX`Af@FJ2@Woj(}VlLHkjbhA`x+CcA>^#@fP__w;dyboTg56DwFGCb^;j5X8cR zLI{`Gb#h_5wKMp3fnJO4ppzx@>y2a(Io#{*0K_;QW;p`_@ys!fAt{OENE;VuFUsbC z40h0pe4(G)dKLkoLJvYaa^3p$CM(sf4-6kw&$s8>k>#d3MdQwty-GY+EW*B82yv!H z8Fn=-o&)#nl90Ts0VOSU&X&>=kMHhvbI0fY{(po}wG&vZJ1Jm_MJ znZg=Dkqpd@MdosKGVTZb?tb%;6?47t(q~qaF@Efi<-zN6t1FL;l|p`+*eXW$PP8xU zwWe{O_Xtuc+^SR3q|qm4G$l~R@qD`i7bMI(4}Xz8p=K+^y_=BS%Lg9Q6@x9R42G{_ z3ujo$F#cfmIf!D-V!92kt)M)q0D%-tAve2&X~N~C(5xJOS!o9sX5A#7=E-d828}6u zEb|K&T5zgCoJb4p$9EH%f$C+G{LUH~tv){r`^C=p-iX<)ZyiuM4Ejlj;Qv_AJ(c<1^(u_O? z!9h&{iHbJXecG1W(?@=BXRrQfFq_r>Ns)O5dSc{+eKeE=LOWeoQOS>{1I3Ae^qV~& zMVyz(&kg>Lss1J>_F3JQ!_(JMF8oZMFC>f!8((o%fP?>WM~N{K#TOxx2Vhi)P6SnG z)VYfB8mattOu)u&z%DmUTfB(}1hry-W*%Yg>w+FF)KGK#rMv?{gx4!L8ZvRY&?8aA z;?n6XbgqHq_MOB=vo=uJ@dBJizk1;t-NhFZbHOU^dIl=QTGU~9L~Nxz!`v4c?YE}^ z4+HBd(|2gGF>P2X@V2WdAP`hl5OzNW-tpn--;vOvJ>heyF11A#Oo;gW?0Uow;-T@b z87P-Fkc% z~9spB&5E0V2-wEC_4B>(&?nod9X8@&nMmf`& zo$*$@gQu^K+>qXKi|&%C5CBQn7X`%)XlLO0#_N}~Ut#AR2aZTmd*lP))3~cX>ZY-5 z)zaJ>3=Mgmg{PR(r*IL{;-cKyzQcsI%^R(R*z=GO28L`>2+IhR4ekE+4 zM+Gjxzqe4kWU~R-5>VMZT-3ZM(po&(PI(v(&1dv(86XaN;BvHm}^fU38+P=hf%-Z4PrXG}u{ z^{g=)0^+lVS>{0*NjXNV8&_q+Y)FC5rw3J)qxWAWsHWI1Q7czoL5fLjuNaLok>pJ0 zQivnSZfgD;R3V$T#E<_`Og=^fL87?6@mL~$cPHC8+zk`RkkHzqC2ee!6OOT25}?Au z8lo5|NxX-eBv?+_Jl(h9D~;e6g@3JwzU4b}rUS0FtbaUHZZ$m{NtvL!ESZJHISL z#$q3276qW>>e0K9BC6Lm!PDcC*mJ>96;}jV-`)zxB`?jOs*Xw=t0)s{mG?QRw~8qt zfu=rKWTTDPq=!y;1b*tE3H@nBXu_aSH~}ouMp}xlRsiQy|?8 z+=eFuOFpAznJa$ z9HP}Oq&hZZjUr$CB~(eAM!iJ*;=b?Yrx6h>^|H)MP==A9VPv1#j0hS{CaVQ1a0U*_ zOPt|Q3|tBH4>cTq2$K@~xI!3~L_nbiL8%UpJy?`vZOB>f8|q^o(U}ch?lcb}gFn9* z1|~O!l8`0`5O(Y2Oh~*GnI51ZmY26LDazLJ5qc&Ez{Mb8VGH2izKeuw*Z=?k00000 E0QL`y%>V!Z literal 0 HcmV?d00001 diff --git a/user_guide/_static/fonts/fontawesome-webfont.svg b/user_guide/_static/fonts/fontawesome-webfont.svg new file mode 100755 index 0000000..45fdf33 --- /dev/null +++ b/user_guide/_static/fonts/fontawesome-webfont.svg @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/_static/fonts/fontawesome-webfont.ttf b/user_guide/_static/fonts/fontawesome-webfont.ttf new file mode 100755 index 0000000000000000000000000000000000000000..e89738de5eaf8fca33a2f2cdc5cb4929caa62b71 GIT binary patch literal 80652 zcmd4434B!5y$62Jx!dgfl1wJaOp=*N2qchXlCUL1*hxS(1pzUj2!bdoh~hR1qKGRh zwYF;1y3o}w_SLrdruJ!H7kRd|tG>S2R@?Wq7TP{rA#?eEf9K95lK|TG|33fEKg+%6 z+hTSaAdmL)uWh^R%I%Bq{=#vIHGE2vyyxxQ zu>PXwf4+35#HOMTl7@fkt@MNGkN*dqzrXxudarck;ms?=9TzfXbVcIGGxh+E^d!f> ztp1kWBdO@h9ZDcN>E)O$)*L%OUQ<(5(?2L3bseob+I4i% z(X~e}J$l2@yN*6`^z%o*bo9v4Umbn#sBz47tm;_Pv94o_j;%d*>9HG*-F57d|CLTs zlc>gL3N=cjYLt$8j>eB>jxIjhe{|c??9qFU4jg^^^s&K$J;*W3T~FTeWV|2+Pm&&ML33QxpS<_UX3 zo}ee-@q2t8ugBw&J>0`QlKZ6FaOd4a?i23g?ho95bN|)-zJuoA|NMsm7K+s}nqB%Y z{lQI|ivK_S=vvsKmRk#edAb%6i2hSQfN{*f8@=C#{(3MdvZPB=N8B5iy>ag#%Ndz% zd|;azJHAbmj*E8`hfQQA(J-EOQqrDKvr;880iAi{Eunx`8?Q;WwYSE-ESYZWVy*F( zDyBWrn7@r>BFSWAC`(6{$=}vkS07fh;rcptPAzWdrDR(Yf3n1{ZmbPgSS%G{s_+g8 z?`TBE8*uTOCf?S?TU)|jb#%6^y@R#4wuCfk)~1cCHg1}Q(}asx@ZVV6;lsib{$)h;3&X! zv#^nE>r1k8t{W+F*LfUs0DkxY35 zA&hmqcN%Y!F$Y>O5DtZ_l&QR>OYUgz=wcmSb8^yNnjQ>PHkL5{@qN#TZq2kl zV*Di$^E=g?)6Z1RVL6_0`tSSJtJ;*Bj-~)(fu@d{DcY;wYCkW#w&!@JXYJY^HP^E? zCQEfyNA@&MoHS`-XZ2cas^9s{_6MI-Cq)uIUm`L|ee%J^d;3q| zxwSnC)nU#t^(_m0Cn*@xCMAs)wp8(Omy8LeF_j-`^X2cc)%HzmHU_(Hx@>V>-Qvq` z>KZiO%HNyy@l}?(^Dn$><{N)&oS&(y%gk^5+Z+G+R{j~Y?$2TF2BjKgP>~{l@+5#xb#STNuZ8r?=WCN#*;G43z#WbeP}pXPs)z27Nc6N(s* z7!KVTtaQBluA?%jx!7OW`ifw}I-h-~p~09u-%4wQ;KqEnm7v$k5_U|!oKTDHICC?U z%UO%D>hNJ>6>FK#cCl;NcSO4y&fF{>U=3aD2IJ-~<7dX|?|etL6`R@eA+4k~0kR8WvKfSYMJobh>0d z!tvr{#Gs=xQsl%)QZ6lGj9fo`gtklOnC+PFB5q~+|H?r@3FXkQznBmY53W~ekX>W(B9tH3|SwvWJ~1XLheJ)N0I z(>o?V_Wu8Me(d|W)LC!j>N`8@S%!`yX`U_3UsHzz6Au-Z2`g~&4=#RcvTJE15t5HKCG3gq~ zrQNE0NeW>%!QQ27HO-7A+qxMxD=QAwOuIFjAAehPar8FhU^GezmgM(PUjEZ!aVvTo z+f4ar)c6Iz7iCcIr6=E0eaZm|+(=!(&9s`76^CY2-C-SFe<+|^nd%cY8^1JuY1YJ& zNEP13l7-rTiL2s0XS!=XLA99lj7d|~VsD&Yr5kF;8J`tNS3NtP z3km=mX{w2Vehi0vgtJWyPIUIJBgSuye>Z-6WY=Q{8ZWMnxyP;FvgG!|uO7aA$(Hrw z+_CD-;|@HQ&-QKV!ynInl1lD6!lIx2D(l%Ab2W~;IJV%Y*K9&@JhkbXpDu`9Jg(6d z+iJYP7vu#V=X4}m3WTqqe@p2FDIs8{2q`V01X>50LF_ODG-LDB`qKNS2O{^EnaD-4lj8PxQryhw9Ovnz(^f)Ef8uU z2*Uc*F(U!YNG;Z=rsJ1-f#sUgX(1$2M8Sf-$E7Al%LWLdqj6bc7WX_~h3j9O9*_O&uJZbsHf!YGkkdK3@Lg87({WRsC>(L4Fb~li4zjJka)fxa zJ<+n#5wRuivR)E)-_{cKI=|)#Zn4_0Xty~X_TcLBmPr*n=oDp}nkFxCIBd?kyKP%a z3)^)xWl9 z2=r7xK?qCFaWA6%eUW<(OS^n>tOSf)XGrI(tU^jX@g7V5_k36_LmfzD;9cZ2Bt60U(mW+|v56fMdYE1^I$# zYn;WCDXavVH)nd^#bB7oM%}kFw5ay^Kq2z{plQ z*kp&z*ff+Sx=PK|ch*OZe~qcIBxv>_<;k*S^aT##S!CCW3BP%kt1v!dz`J42aRDEB3Q^9 zD21}(34VTQ(IZF1Jhn)Zz6j{i3uu>ET5e**HtBLu3lZPM0<{ndq;MH6#$^pcf*PO; zMvz-W$VC(*%z=WTFr*hN%2>epb!UK;F`wfv4j+HNDW7rrSOAxeqqrVmK4(7D6k(59 z>H=&TuDEgKDHL&|2wN7Yv#`e^JgPA4Vt%KQQyd--xMIJPNp#^Pj`Q2Qlz>0#cjjo8 zb50~ryxS#YuAmFBly%H=0lx0*)XAQmQFc zVkB8gwmsEZe;gBw3IE}(Q$9K6HufsO;~U;;BjaoL8JTLYcN~)dnc$I_H0~)Ok20lF zEH*-E-`3fATPOE6R2mt-pXDkWQY&S}~TyokXyw@6buLX;*ub6eMzw9v-7(QKA+|L8-TdVjzepa!yjpUdH3-BzoS z^RN#-q^Xcm5ON2MJ89*!I0RmDT*l@V565YbFRc3xzln{*{*Zi$V6!2au+0Bx*H7*XCt+j>rd*JFSa16?@c(S!c!QKzj4ghXs#(BNfx8MKW zBJs8JwfVZoW#4CImaWG3K089H-N*b}ZU%&_l97od>r+*??<+P0u+n#%g zsAHWhdSusS8*aiP8m2FSuj{0_Xk|d>QoN=P1j~p30GtQ5SzQ}+72XTOe%Vit(OY{CQQmf*S4a-!rCL=&B z(CJbN?hlE3G6w2QX%r&SuPF&0CF^DV!xjJeG^zaQE{7S&Sbe7~`Fyx7${c(L58e zQHg&n=5!keg~5Y?YTC|+Ni!3LPbVIMqgMshgqEEacs{gm38lO<&kG^fB@*scroW@{W9O-ROG z?Ki$`92a<4V+*lVm4Oqq!r4Ns(=2x7h2|P0c!?=lQP+gi*9Iv8O(X`OOKxkDF*?Ne zobDYgd-fcgJCZD`sVSrXWW;TobD9?$z6W_|Am$cJq`G6!Mus~mfQn}2SD_BIBt{9=O676JNwgjI2{$qRA*qp zvSkYbovCER>AZt|+W4^(V4Bja^`^ROZ@>N8x+WyW%^&~$qtIa-G4fN@WF!@+bhkh8 zwI|x$m4OtXf9h9_Hsi+CxKkHaoJx6QHS@3*=2;ynM>brCBC90_4WiIPkRH+w+RqOe zN(FF1EwlrzVyy;i(|-KN@y|g0(=VMF60C3?yj!}~TkDMnThnx%epwbjau%!?u^sde zS&;zAY~an5J+Sao@ENtSReJH*(HOgzJIJ)h-SLtH00GoIooB1?3c{;3Nd zItcmYsr^Vn(q;B#D)b#vYpu7{|Nr8@8$Yqw+Un|u@z>RLLv?kx_zn@U-bhFpUq!UIUk>Ec_WYcV*tuLL-w-b>i$yiSh=vxZ!f`sbB z-=>;v02>IL2n8amC4Bu+tzcQvxVok)_R|ElFqg}#JPB|&a9k?c0rhlyvZITWpoS78Q5&7WEiJ5reQ7B^2Lk}GYoL%= zdn%+7>()ZDog}I(uyQ4NZDW1N_=Eq-8ABTu-W@FqX$*TJcLcTYc#EuZIVuOoDNI+C zI>q0tFbn6dkY@2Z{egH2Qe!9oV8P;$@m}5B^M*cAVYl1Lu9iPh*=}Lub)G!&2gTvy z{mybFh(vw>iA|?mQEDd78@ej9V#}hL)08Hcr9!g@Ds0IuNn5?eUZd4*tFbnz&RR9H zBWbC%S^^P^BN0!PhnOZ?w=EdDYUgaXr(#ZZM1DO~>#m~xQcw#9Q43}gLkhU~n2-ZN zSIk-+8nHbWxKEwL8t%nvp~o20mvgBjMit)x|{(&v217kK;Gm%Ge*DDkEd}3 zEcC!xm-842CmxLU*PoOw7i%S}X9dq3hdfu3$P5EU7$6d8bf|e|%Z9~Ok|{^`$n)Pj zbm+Z9@*t5+$Fp=CZ1rzQb1A*S-a;nkyjT2|&-h^`Q0)lX6-|y- zd2IoUi~3Kv3m6l4zz+$=258kmIHE^D78r%v8a=4{12SEsE6Br81A-H=yVLljW!mAz zZ!?>~I$A&okdQ`<6<~_!8j=WO#3+Sdi03dcjeVKjpH3tjrYu|h^nwZ|^TwVpeCh1v zpJ`hJI}?`wEuRox*yL5LTveEj*?p~5%N0oAuA89xRMrq!uySK#dh&$v<1*cm>%O>Z zO=Ym9XTkiNmu`P)`A_5S*wT4(F1w;K@(28nZKh;Nq5U>8jB7UBSrvR=yRd(vYP`*;+HPhnDTHj9A0I9 zUwx&cqSImVx$JtSCuC{Z7`6G?^i)mH{qZ@BE4tRvo=G?yR%Lu>da}{Mn7+e%c4ZViB0LPC|dWSDQ?y(zK%Ro0605Cgn)Hvx}3u07gM+AOX_w zkpve4C?F}UF31K#B34<&_qDw-vEY2y_hr!QjHD)jLV?bWz1 za6@1U{(bSqi%T==jTI_t<;-KTFcx_@ec_at-z_(uUAC~DyA{sWb*Tr9uNWV{uPIfo z+dPWJHbKSg*(@$4q(rQ7Ptp;r%^hQ(?YewTNKu(qVYg1aDDIC`cv-_aCwLp zzmL_AXI7`3hCXU58T#XYKJA3l> zv2a47oQfj}bB~LhhNHNbrF#mFIgz3RyXYg5{~xv6G>w$e7}0LgC>2Lx6(n*T$N%eg zkF|yPsQl>hE*4my+5|EWAjXcl7&dJ%nBi$iu?x{ z2ftGj%|0QHinvmm9w{RalF0@=9;Ji-BYRfTUkOT$Q~OxZF_@NeWa$HlDaDXu`|weD z)=wQ25=a-Cs2=)9yU343sRq+51u4TSMuiR~ojH9{&~~Dal923rLE_K^7Wz~a8B{Ww z&TvSVQjk&kjID=u<}*7F9oorrI}fq@d=(C7iiA<)ysDqw_f+xDp`A~%1AY}62U7+I zJ_z)c4!@QvsR`EvAJpCg_ASjYkl>ra5eYsTFHVL_xFce_d3M{twrvB-w&Pir8Q|b# zJ`f$%GU(}jrPh{;hYD`X!%RLWin5sBd4h^L6+99f}e!kWQ(MMn=A)U zAjLaUdayOf+CarI@Hn7s!Q!KRUdVeHI03TS2(c}z-&vjISA}eP{?|H=yh?9p14B8Z zUwtR>l+piGU3)tDP6DO2WaWVnm9mAX)c1`3p&T3FgXzRmY~aac@_!&z5qz1Tv31DS zMoCm$z(-h9LclJY#vtrq+_>M>s!2{I zYjl@PtYN67JwZBoGJlc58$jk$C5K^&5nz>}sIJr~dK83K0HP*H>|Qfg8m}$UE|H?nvgB=pa{W}siM-Fvh3iT%GguL@o^=lx>; z6V@Be^{V|1{nP+slcg?c9$ID2rj*27hB}ykG-wld0`d&8Fzg@i{<-` zL1oPvV{i>@@g9t_epJ)h&vV1|NQK~+4u zhQ-!IQ42X9(Y%r_0IOI3=q_E|S>6$+z zRy|qvcj=_bArOavE}&+MU6f8b{gH*8Hf>w6cfM%E;}8D9$coiJU>v@3=L9)yQ9L$V zX!5vPJy<(+(Pg(kw|M|4BjRUSKd&|N#eVvo6>6kLDfaTGew(w*W3jR~j4bfQxZLi2 z#5K?ckHqy#+;;WeUAdxtjswo~89U-m~%dGnMrGy#Pjk^B_V zmR$w8Wcg{@LX#uvigl>K^jWfHYOmA7YJe zI{s=n9uKP%!+c%7${C2Lxk$i?R2{*T*jEHkO?G!Cg*J>MOpPj0FU6f+*dItV&g76V z1b)pJ&Z!wP(E#rzjwNY&55X=l5!R#o)VENrBjrccGxDs4XEAo+;jV=ttEC~7{vmN(Hc`<9+{#fpHLj)Nd9eTcO~l4NgU1bOrQL!VpqQp zib+yUYF})TFh>{Clp6kaemgWrcOVVJ5D~Q z^rB8sKjecYq+-~LVDp})?U-e;_|57^a!dOlcUVjWQBca@2J(2{ZyU8X`l3 z!ZKqBCZ5TXguooG(a*5PF(lMTyU2d2(5_-@PHjVp@6l=BYJ$lrZz=76qtMm1H8T=; zL)Zn0K6KS|1i=Ogr#OaMVYNs06d3hV8d164|J-wa|0;h)gc6YoBu~A$=ZzS1s)}zl0NU8}YaCa@jC(V+kyrbM#+k?(iPn;jyOUHEk1n>nCMH%%UO0z z>j#QY`}pTq9$fm9GT()oV^&#NTRhnmitd5??kC*r}T6#G;# zT{4>ua-y&#TH0ZnA=XK;L!+!AC74DR4QTuOh2bC?SJFX#O5+DyJ}yy7B#fLm`Q*Eh zF_YgK+uo5i(hMI&X~g#gMiv-qQ}zODLySC{h&;4W71rlt+aHv#vZ#wET>Bzi;ca&u1rSmPQ3G&xc}HYiM#26F&DUrAx`u3aCK}v z5XBiDFVsi4Yh=C%cTL3z2uCAvAX#O!28fAe3N0efEC^aMGBB5Io|*; znm#!N-*Pp!BJbKaaM^bcoHJC;|9tC{V5ij>OsjqaADrKikrhxvC#!sg?|y7=-hJ+h z1KA#I_y(psW-K8JT^i~i=~ohErf-5MqY3uB9yQZHd2 zvjZa~Xp3ZD8@!%alE$wWbO-JULWg8MMCtqzV+|Kq%teyO5p!I#pgnWsn^55C(m=2- zc&&s31%G#_6ye;};fuGT2`1lW5MwsD{u3X+e0^7~s(RfXhwgC8H>Mxw-yH;Z#wB>& z`%#L>5l40V**gX{bj;Fft?q!=8o^Fk`P6szvipbKFk7%?rwBtNM2*2;N z&8GHYeSp@@0(J;^#d;j(7lv2JFaTl1RM?0Z{hjqWI5G4KuZ97UVXzgE$y@i7tD=12 zT^#R{O_6XaY>I zy0Q0#)#3Ig+TkVzzd}|0UQ?E8H^PXK&+) zOL6<-#w)_ZyY=IEnDis^28kc{4fX92q8$_?LW8qXYst__)tzbG_lR*${^0d6!=uONX5J;|nf-!1;nR z;Aa={tq#p%(H!~vY;JI`5@f>Qp(NlYC%k*B$?74I_QJLiviuMzi+0vZL^FH<;r2qr zb8Cy~r-q?6ndySL5uA8v{a|qk(va@Lkaobx)kSmBI-~R3H$)mSllep!x+h^|kYM?>=wK^lWze7D}H+0pF!brYsPI zmJ3$apq9uww+rYAb{>=fIg39EKmqTa$Y+f=ezOaUzARX=Hn5NBUybl&pvidW^`8#j zf4loY*wftDRarGI;N=!s?pn|l<<=D+dtqzGSHAqE2U50Fpe9w8>W+D2*iv0^=+?;y6u&ad)|$TZN008T^SNbfDq%}` z!`3x>whKNF>jv^OH>^@6@(ZNtFn2F#qXGiyrouwdsRDzCQ&kG-ltwgcC#6Ye_4l7O zX{N$f-LY>~hnee<&D?;{A<#kbFWPh7vU&4XxAtclYgoShrq8Y~URir{;R+2o=rOw`ynAzQsbu|GY)=^OFN;>mcZ!a(H*m zl+Fg^cfe||twYm&W80aacA6VEAOpqB7ROtJ7c0s7{osYbwWA#Qx&XvrY1RQkn>Q|6 zu^xSSn(rIw1-q49Y^>Ql$>wwH@{GUx*vdfQzRXUduRN7Uv*#g zJIv!<=W)Q7hue&a``>C|?@!n>rzW%HvoGxNz4y&8U%4&wC9oPacOKx=qXM4d1X0-a zKLRJoFe@FlDg}-OMVWU@qh6w3BEioP=-Z6|I)(Xwx=JWE z8X376kOPuHLlCBjbXbK#M(rP;>3eKI^=5U4BD*!?zm0rab@p3b+-*HPWarF=w8md# zvZ1(OFP3$A_{RtOa%z8DuJ5t@Jin`7W3rPC8Tl8zu6`@G4;|J$PRBYcOT#KDY=IYY z)~P-^(3c^pAjN6ISe|NoO%~*2b$ym}CFFl`({em9<_syfuqYSThlMu3e8!`ERRiZnEi zMP$Jc5#>1f%D2H?2YMl9o^VB!WU&lY2fq~-8LZDFXYwY7KrAnja($5jo!gQVAv zZSGvv*4NV0Hl<=}p$K_k7u^e~$VqA9qG{vGVoj9|GpDaO@9J4*9b+yQpHiyVJU5|Z zUPGl2lMK0_{?0-DonuVaUE!Lh>8bO+BJN{DguAA^vsj>NT6a^|)}B>YFFvO=E*>6r z#Vn3-!@43p4A3EwrXWbbnrJF;STdDPwkK&1R68gfLl?uQsp!&C3!KaK52%x zLXlNwgU_NqG1yR6Wqc3<> zX3R4ldkN$@#175VmNt!RS~{)S%u>K3auYXm6bxx3$8*{58ZSKe9P9b6C;_NVh7=`4 zj1ZpS7mXAxeT)VU;<$pz<`P{_!7K{Odzd(O@dmU)eAILyQ)mUZN;_K`=7elaJYN3f@5 z0o&xm4S7;s!3skuoXKlZSF7N+rh`~5z!4z5Lq^vHGgzgBaffH2xbNL8e_x!wA1goc zF4NUA`9XrCAt{m!CHNPAAb?8pl)LSU&Xg}kl4;>vBA)4$bB0uwkay{oWj4=5GN+HY zT4yP82a---bts`HX)S^l&tfe=*Dw~&q57mqd3)BJ$gJ73XAQ%V53JcE59CE&&e7Ev zOi7D#x&rn1rEw!o^AX@&xu@3x|%IUO3Bou zjYC7ZwMV8KUr<@$#WB2mUUjXpy>)J+s=Ailfis&jaQ-}FyQX-RlE#p1N8&l`h0w^s z3I;#~@E~+6q+!6!1ZE`S0hI9^1dUi~rRrPC7Sy%MFWV?!S&23m>sRP;@c@1>ek`L) za?X4gy@N11KzEb|8DMM59fZF4v=xqMgG*iy(!bC+ybB$I|0c~HOntCJ_XS1*?35_xct%NR#)2>jcL0W$O{82u=(lp6e? zog*^kiBbmb({!kWb>iqClK~k^rzE7yuv-UW0liA65afU0gi`Hefe?YFX3Q#|F?;%& z71yda{rarR)y?S(=U0ZDk>HkD+wYB(-T(P*|8~cQN#ME1!JIDRZfYw5gVIxFYBJ6sl}dnsEbubsQ|6Ni@jtP>a?dFs%p_WOl2qN7$|owN|! z*9Kd~SdZQT)Qa%S)t#4q;lVw-cQcLMU)m79`Sq=nQm@~0=kC|@xA1G(`=xKw#hgl* zQ;M5Zf%m1LH|Rnuh=VNQTG|Wv1D4Zq$&-v}o=}X^avb2Mmxclm0wsCC=jvJOi~2h2 zU4MeN@WI!H4pJ;rC0mG7IP@m@0cJI6=-)E=>$Gfd`nUw+AIL=0z5Gj2-`XCcGwM4n zB6Q8ri&H}FSVPY}CB5Ejv zaXMM@)1;GB5-8n=Z5~%(3RHAety1I+Ow9ZZ;}(;t8J*>CulHJ0HH~ur8_`AM>ZAE} z&mMl_l^0mcz!R_RW*79!O*OIgUZ+i4y!_nB^0P2eTRg78kB7zCki6?-HBIzz{kTO@ z{^;&ko)};)FTC=^;b)D9`{hOid-1NfX$zOG>Ou3xT61Hq9R(iuVqR{P4ofEr{i4`J zX8+JLki&&(BB>SFgMxPoupc%l5H({176Bmw+e1|JcZVy&$P|MW;T@=v#)?KR1tdf7 z5iyX!d4OI4)kqsC#jXs6fpg$82Xh>hhanckEC2k%a#lc*d=TNRu)UZ^BkQt$!XB*Y z)b;RAzuk6aqTcS%!(X@iSh%L)D&1+f-J{#OJYmO!HrH^`(A8A5rm?iB#X&_K)7)V@ zit_9O4qvOXi(C3!fk433XW_e)R-fa62b|tkMd|7++-Pmkl&h6iuk(R_w0t2X(@8Z|;YOPb5vwvXF_=jxVQDy%lwqR{wc8S~nQ zi`uOYOVw5SDxd3;rcp&beW8gpVeZWj-r;dqlwV%1$aB{QIS;O#D=WxWxIMU08KxWX zXFm_O<~Hy-bT3@#mXH23PZ9hI94u(;gpfyhC>TbHz>(l4i5RCOXd=-A#qPzz)IoMs zX#{D)i$kl8(Tc4DtYYm_xT9|x-}u*aR$cc{U5jk@b1(y3m0<``=cx?ZuDk1-Y&N@r z&F0hYy3Q7?^whyIg8VK~EZ}IVd+54V=NQMnJEiI|R=@rFz2Tb<%KMG~d3T>@WxW*~ zE$kUJMVGO8CWDFkvUxw+x&PgL`||s){^7i``b03PG2B!%O_yCBrd#V*diE%*majRw zcVX|`pAOUW*dBHGD{dW$nuAqZ8*c;hN!AW?SRe(^QxY?xUtO@Nq}xbzV2RK&p??j5 zg)vAYBtAJAfh_^uOD<@n426vX=&3g4sYNZuK!2t`QkG~4btuX5@pTO;#658)Dx1R- z)gSM^CZ|@_`qBY+tT8*ungo^m**ojb>;J~J+e5}6AzbFG+c0HPSvc94YF)l}&ctUo zJ@^z=o#ffpg;Tyib^Y4NRkt*TXQ?f*bZwn4pVf4?#mnbE9jWrnUl41VT|V8**3_N5 zAYQj{W-zp2;r_=aG}iZ~c{bf!w!1f7e$Ae7i5a)=IPZc70T)D{0=WTC>ySVp{=h!qkX`Q5q$w(Sf?HcBtUOu}ewqU-eDsuMH z`P^%9>smhRtE)}NTGUzL##^q6tX)6#`%@OSY<%#7^RAjTdqyI@e%U#}mW8|FM@ger zKYsip`_zRSLcy5}>*5QD#yj~rIinJv4{Ga_;K_1kY_Mc?@c2uo21hPkmlW@LGHOF` z2EqNqc^3&8lo8k~z@ng4Nsvk~SBM3zWgBPqui13h z!x;FPdMQJ^S_oq6k(tH>n->Zuuv2)IETkU9EDskmwQfAind(MFEHdGw=vaj;NmW=3 zD9EeX6nVg(A0(5?j9_hYq>796E3sh2X_~{s#+)*1d-4$Vz>U$)TVRehNQ$wT$zZb> z$oKqU!6sh7x(w$GARxE3WmM!9;#~glyWhRf z=4_uocQTtgkI(+IP>PqVuodSu6j zp8OqbPtsRA>0y3lDeXr%T2hFfx0Ag-^rJ*dz)XrFmqEaQC{I{~DVfF*aNsTQhr~2` zfq@1=-QkaeS2dQka<79`sC~vIk>tY{&|W6ON48z?Fdtx$yugekgQM|zFte2oZv}fR z8M*c)E}8Ku4e2FJHrhid6nHd6F&f4a;$;7UsUJ3WF4~t;IgmQ0+@VCLIbz++MFVKU zOv`OE7F-r{`)q!@soUgtJc}tLqe$LwLWm4XUKA`^F_X&0CoeTnMm#4}ob(*2I7Qnr z*AQ?@8FWLepi^MbI^3r=h?y|8?dSyX{5XV-2Wk_SLdxktkX?CbCpqH_m}R0TkQACQ zTe!CK5V3Hl14Y(K?i|CA%X22=T1>DOI5{hLa19!<`51X1SuCtXIv&umGX)X(9~(E> zMPN%7b~v;Ig>*`wWFX(Bg0PAJ1rRGZYxcbbC#A#6w@*q7?mV1bcIPXXk4q;jr_b!& z;d2dPN_OYwze-=J)5S%m6^SIL3``Mnud1utnK&A&DMAJ3+X7-q!c3xG7xi*aY4gZg|#;U zlD0d6KQu&xfPH)lCh# zMKzmM$Nw(Hja|bt4Ik<7PT?^HU+Q@I(9S`RH)Ly@yn5Y?hO-hAqMK96^IksBlfI&I zeB!Kz%(~T+>#f0wJu|}osewSyqd9av)M&FgyXMWLU>u>)ps-vA^81?AVYlEv?a;M| zsy9O`tgEuxpxf*a>e_cWG&uRH9+>CbxooqP$z1*-p$%>cdjGg?f>zdk*6y>fIeYcx z*7~xtNW>nSV7+`bF5JAhy-ceE)!Nt)t5;;J%cZKe&Tu%{?1X!A@@6>{mf=i+7J$hW zemQ`-92UIWT<^sggT?b`xj_}laN0Xajsq+(EC7vz`6yV%LtjaB3nSX4G}_>2f)`9@ z()0_0>@yt+tR8S^w1lvy;s{*t>p<*Z z!AhBB#e+b$MC%EavRM|72^a$ze51?muvu(2#p+)anD+arjT>in?wiqnTowzoCL#VuNe)gP2552f++V7_L`vOZA*tmjV1RfuM zdHnv0s_2ABcy%b@W7dh`vQYb^`TzaLo9YJ|!YjsChN|l({EP+mKWTj9M928b%FE`L ztqj*c)^OQRj(l~-)ai>R+BPf?uL|3|URy}3f0)Ju^h&{&0-9*xDD)l!VNz*Od!~r2 zAc7WKok`b`G?K;#ga)KBRru}%@sE_`lbE?Kb|$QR<5%9 z^w!Rn@)Z>>-B)W*#@uqHYx2y=Ha*Dt{%s$xaaCA-oh{P>uF7#r`Q$nNIhxGsD^`@Z zbhhd~dzD-}@hs-eE?jS2T%BpHShIFR&>nzSm4D9Ua%EhlD=@94(`T)4)$o1)*2jXn z4RyOJWp^xTuk}H0V&Z&ZGh*7_kKUV3ad1=mNBm6I{;KGCL)(lh755nOD;g+z9nnG| z_%dUzXhIeQQCmlt`9C!H3Pfb=>2uFzPdm;Sg+)4%WCzba+t{qG`tW!x0=@+RG)q;Tx{ps|lRu?R^fi>%c_!Z%1ou-)@~{~s`kaj@M*sd*~ zc|Pm=#7~VMebzYkW^Ln}&tCjgbv)WQZrgpc7WFI|e+^sxvgPpJJNmcwCoVou*|dJP zD|)k$fA3$m-mBcsuV1Iy!(ZH?B<1mUEnC_9z?W^wy1j=l3QoSV+h(qdpO0e5|xWW4_Sit>MUpNdrc-gvzbj`s-9o-i(3 zh-e@`{^xg{i)3G!x{%#_;)kXw5uql5p9H;=K*rqNX>$hkD*_yn^TY^`A^bA6Y!YTt zNr<3?1&;Yq0#LRh_Kut@`VCMFpIm2sN%X_#DKrn>31BM7&fU;zk(9L&?>4`XqHj#mxYMseX72QVfMY+CvMj4YY(63d$K}C6r~iZm zr{R7CjPhschv>WlUZ!s;A-eCdhc2igB2X}mSkFR=Hx+grh&itg-{Df-$UO(F4}8pY z*yY=}-&c8Sc^wZK-*~GWR#XvnfYn`o#jV`Q1HS0pkpy#m35K%Q|E#<=;ETwRPyg4~ zzwuM%5njB;OVL0uUj7!F9pZK6w^sVR&Regz+<4>hia?;Y{AX-8tNfCaCCcvxv*G;d zH@+-1e=*DZ{cgxJw56C<1GTW?}m&l3+@XpkAMc^tne=-T)-_ZhV9Pd^bBb)df zd&OYjRSl!{xwbx9WPNRqv0pIl$rl4YKM`tvU*N?jjpK&U@4~YYG?}4ZFL)WawS!ov zV>8iVphW0QVb$qK7WU?`1EOkT4#=3#JceO3Nz4L0jpx<=+pBDj`fsKk)s+ojpJ;1v z=+%K+Z;g&?uuc4WLuIui{mpuZt?KqMr5Y-4y|uDobQzu<^B51&WA=uT%Ev`VSKVN9 zRPWzkWw(tgBjzP5U`U62VbfUIqcH3v7Z&r^l%|31DwRDJG^e6Fgl>fE_-b#>Oyn_D$|ZY(zMg_o8bE=U|%FQD#Y7avmMLh5+S z;ZIF1h#X_KFf0mPWqd}hv%aReJ9+&RA$C=%;4v^cy{vKO^!?+5nI%igC+D-7OsT-J zFMaWYU6V~|%WGV}4&KXqkI1Ml7FeS%h$my{05mS+`>O%P+7^CfCxNHU_7D z>V+HcdX};2a$Grd@y8zA#I6cGaecD8xu)J(JA;?GDuQKU8;hlTvpieYGA=I58eftL zfx?a_!_#LrE=x}iEQCGouqd)DcJ|Ut#^h}%US_&?>g-S4q4r%A3Qq2N@ZyaRPMfuB zZ*8V)X|Q8~j6wAJtuTxz$ZCaLTfml590>}Y04bIZ=0?*A(Gs4;sEVNs{lz}7)I zUKmgCNKn-Y{fN*@f*3&#Fx4f~+S7`5KNv>hhBBGFn0Bjrx=C-EY>J<0&LQFw9C2Z; z+h@>Rw=cNn)-iJ}#LiP^^9&$yUIB0|${E16mgMKkI(fPn+WagNRIBt42h{>#W7x#L zXUb=)1rF(eH4fq_Bn~G()R$7UO+pjUDyUV_C}0S(R&R}qCWhdj z*iq{Fr>dfEvoVHE$dBJIG?i^$&75PKwgE-a`a)wOBMn7qV~nHR2p?8xR|=aI+9euB zgEj2kDn80Es$I&dJs*Amb+9Bwc25bkTT6!G6 zI{i~=sIyQluMMH@j&=yJLWm?QN@(Gv3(PW0)lik~NTC`Mc2MjgRUPKNFc{hpe2KMGTN4M0Mq{Zl7$q%OlR~e$WNHmHn(mOr zq`1mLAp1Z?gwU>zwq!@BL%bYVkJ{Mzrw-0@KS02|i9RWBIV8)@#wQkj^SZ#jQC0iX7Hsm&?_{R*=3X9F*Rozj&&d*i5&ee#Df(Wo$?NepMIka+wHwLXAQe{NflsU6% z+zxRIBNcg#jyPUWzB?3zI>jf3WSQxWnp;;nj0ekA89h^N+-}hkc@jTv9e!mluM)%; zbs2`+3Td=zg=AW-mUV>h3~{e4`e~y7{DULJWhZV z$Ix5LWYw+$yj2?_apDWI9Lg3Aky~NUU`60ftD;%`vgT5CuhW7!nL&*!G)8L3U9MWJ zPN!96_~?`tripbs6t`N2v9ytsgAXsTVuZqgyK?5XxR?W>H&xw=DACNOFwCnGP}Fk8 zDl>)a77Qqc+Z{m@tjwjW9;+g2nnROa7|F$VAi$DUmD3=fPeSJa>)<86A-6XIG$z-Fn_bf<X~j}>pSeswiai#x7;04^a=|o zHdzXu3~D!k_twGB!iup-<%>wx!n(HuDjeATlAIHvY9Un}`;FJJc|{`9 z-^eP`5K?4)M{evN9gQ)Ivh+8UDT=wU1GBf!lmQtmso=k_g?xr&l!&KZ3_Az9*8E0P zi+U}-`{WnV=3tR(`03+Msx(gd1-|R#&qqX{Imr*3ZT1Iz{{}+=eG!d^m^rdjB)d}@ zhv6|Gg(Yc-5b`RBcykb*k*rxTX9aa6^#76}DUg)W_p?cD%^=e2hYDQ!00MXh&pi5I z3G44!t4i6tWW-GI$p8@?0~mrqGDd}bo&*j9YpI__JtHg*t=Pz5=w`NuBnsrA174Bj zAoLZJYFr@J5w>!s6rAJ=Rv~d9ei09fyQ*wF%r3YGod%I3J`{A1@v!mmJv2b1fr9qw z9(DmP_#+NSJ-UFHS>9?~!b9Q7|;*yG03lx9S&g z2w#aT#@!2P_+)8@v`ku!t_wS^w1>1bU}!)Hfrk-&9rN|-g4Jm8E7m9lmnE|A5eBz- zmKRF!C6901yL8)iTJP0UXZEPd=+9l-dKT}!ZSUe9Tj6upLuQ;j`J93^sT|+7bnnK; zm#956r(WHwU1u5#azNpdMQq);#&Du?f8KS5Ph+bs!p797E_@+7|LCG6*Qz`AS0=)Z zCdBjmI$D>Co8tS9>Me{SF zN22wq%KM_xS1TIEmXdEg`@UsYU$gAUvXv{(*>&~uSC@~;;}eIdJtkK>BIWM-PTg-u z8g{M!Q4u*1<-bQFT5%wnLZOQ4(S`DF9$j`|+1dZG?CNXJS-BE5kIvG%z*@}$cU54F z1YAHpAOwLxqYCxS6bI_rHy=Hb1G>CxJ4eL7M;Mzrr+@RohMS&Y*+<`mW8IA#nxI7`cA~EsZ zB0@lmq&3oJ>1t`ObO&yc#1>XDDv%tR-ePrQje|G`4N4jDr3v(wtYAU4(j_8a+ex)6 zsBQWJXkpTUEL70BNfOp!r)h1GK}%E41v~=NWkfweB~&y1@Dzf0!i*WUAl*T4m7fy) zIJ<bgFWYnPZRf1A>+6^9Ik0S&)wyez(>iO}fjvvt>uN*e z+57I@vuwSNl9o&Pmt0jd^0O{|Znre2adYkAvU3nxxuN)Ov@(KDXfy1?z@_Owo|qeFgb>z;9S;=l){ z*y{q8=7{V8S;YQ3#xogX$>sePsI@&x#K>jXgSX4rG_VN)f6=~Cji?X_Sb^Y+5+p(& z**FA(#%DgDj~0lyy%jMx5F64@n+QR#*h_{pn!x|00m={3mmnB@3WB`;XHCl*KVgm7 zVsZR8HqFSA$3K_q<)52L1s6=$eikcya{>>e4&!U}KQVs7KV$sF_!PdKH$ZOQ_!5p( z-#_#>C2QsYZA?;5?oqE(uOod2c`X6lOu?h+tR(WL2##0X*y-ktwOq^2@i&K`mRHNMSxQTG)~ zS5D`%FZ|e!M=q2tSAO!*UtOMm+~)91xAF5A9^8C!-_T#XmuHrC^Vwy|%2C;m4gEiK{lgY8LcUti zW04jM6b(hIrcKn;^qA49KP*2w?p`q@oth;ycU&APof9cKu(wZ_q{VSE2U;^DnfkO8 z^gEzvik@S>!VV3&_^8$uHEv_CkBx|2&=Zm$#kK+UXsKrHxT!)MeX+E_t3pS}?h&W_ z01V*Fxs-o1_6i$`bd702pWL+W)xW~}Yns#ttbK`e9ngVTHA48BZqrkcKBOTT5g)LE zddeS+3!y6sBx`UNLVvzaYCzjYcn4rdyRuUK-&WPDEpeB(v#Dz{oYp|NY~{7mn{3C&AtI6|43)`Tu!rgp-*)z4*b^gHU3 zi?5yLs{l{=KY(m8KR9{7|DU06X@Cnq#sM0b@sRo831Zd6+f((G}2m25mpZIv36j}4j( z;C=Nq(4g@E8s1cNzlZRAGc8BzL@rXqqENp@K`qic>gu|&5uIobG}rDcTrg*AenUPJ zniI{)VZ~5_UGPkp^bfra@_w(r&L)I^kP0?6IokinDX1=M@ z)?IMu{%zZvTRb*fKcvzFhupsB+hh9Y2r0a}cxS?e<~qsHpj78{-N{vTg3y<&XhxL~NFa@zFmU3ak= z$8(BK?8)>E+}_FeMa6wK6k17W0?SmC_w#zy5m3%ib+?Z?AKfvaV(w zp81BXm$8}InMH{X2Tt9Q#)WV~9tcB^Q9}r~F;>KVq)G502hIW(@e-wgk>D(Q>Dw%_ z4rpg3juR(fH+a$EP-|#^;^pPb^Yih?c0T`nb2I+L->0vnzL`D{zssL}tB#(g=riiT;) zg!eRU!GI}(9~hZd_ybdHN?I);B)R*${0d8c)2#ooUah#pv*|jgC1i?;C2XscFoAw0Y5=wuX+8! zTOPc6UCUI9E`nIW)&)5$?9!`pCL8-~ZqW&zJE`zHv2j;_dU*3oyBm9UUD?t5&7di$ z9SgmF%Q?6F=H9&zeY~(Gylrtob^GS|Q>x_diR+fIoqyr}UfFd6V#W~PpQ)V#l_OV1 zrE+u?HiR#!92sSaF_i|0kxP}%_v*{sYnqS!dE%u{ukAgy>zvYAGt6$upw`%{e{uiK z_wQfZOqKJ*t6Jv!miz3_&|^F<0i56^iwYl$HL%zp=iRkq%DA3OuV`O&XHadhl-a$` z)w|VpmA%|qWY00^<==gH%j$=MQTN{#o>#LpG1j~K-1fDtLGcZQDU`*^I%af~ zRkV+F*a2@ zlYQqRbxTeMJGyd5?cCnp%ANyrc3+vF3T}UJ%DnbXQzle5cvfJL|~-hkLbp`M02S`iMdZr((3Y9evH-jHK2a+cexH1<$k@5Xs`leX+m zG_C8dzc|#guKnCq-m!_LHRmnd%Z}~eKWSz~dwWGFo=C()*WN1sSJRG5yPG4y{zv;s7K452_o-6#ymjR42ds~zQd zO>VwvMv0kpt|c>eAKpEqMA-=?YY(4H5>1klhd+e+88j^F*J8_(J*@xgu82z>c>mgi zJ7><^c~IHOCCE382V}k#6DO1O2<0{c@dE8)2}va;5xD{%KqYQX!La}`lbnF%ADgHj ziJioA_^}h-`?W;&__G)&BH_T{SuWh9Q5gs%We{KBH)F%N9|@h|b;`2|RZ>Vw{JSLg zku1(1266@hi||q9LsBC9Jv@Oj%8X|d%Ckd}LL8w%NboYlX#-DFI8UbVKzU54@E_;D zhhlYryANDzXem4qY@z)g-4lKA|3u1#3jm$a12@oYUO-Bo>;rm_)N?ZF90{R7ylX!& z%&A?V!5i7CkOoO49cm|D-r-`7YPR2IwZs|PkbeiC`^vs!*)O7YKpTqaJ6^`G=sWbg z(w>>Vf;Usag$L2NAdyk>e?;``4su8rH1jPEdaM?-ny33@rEVxLxrsu&Yhv|AHPg& z9DJYHG0|TY{nv_;%Brf$l1qOdV+&>-tdUP9w3T^94o6X5r8e=AujIzInZ4b-&mV`s z>v|kn!9StI2m_!bf}9+|C66>zplpx|-1d;e2Dce^nAQOgJ6C?1En}3b&Xm=6RnxwxbjUsJ z2bM)xiPIW1M52SAL6mWNSXXFpUn^o4xZVuCizi=&29j$k6^K|rDwVoTENq9-OW^`q`_Mk ziAUB05TC4ur3~M)z+{5=*$h#<+vw5jNd;MK##fC2d>^)0$t~bB_}1ySqEu(Nb@wS% zDe4j<4i|g{pBtnLqKvj=^?@^BhQZD3nX|3}JO*M!$rlD|Vl-nx&D@dk7GyR)24Ycr zt%HL7$#a|o1Tmws`}}-Opt?ePesj0Y)ph#;m#s`#&VNZM;6pz7adJ}>Vb zrg@rPa^0u$Q#7uLE}#KG7d*87!CQ#rbArv+Vr-M_UQ}m`5<)u04FQIM9T`wLpyHiR6ePH9uQ>%NH z%x+sB)#$GI8*}{aC&S=kZu=Rq#U5p`haXO_54;X8(6*J?wHT^HZIpW9OAr~@mt!%2 z?-v&%aq-5_CtLEI=&@j*C zEHGGlpLpeo53c^(SHL!${Nk$-8!o;0b@SXo)qOB5y&dB4_GD;iiR`>|T3&1A5NQAqrVQ@)sSb{in6v}%w; z7jq-#7E3Tdc9XZhb}Q_4Ggr>c1@9?d204?MTNm>RtwKC`&C^x{^@`qys=ymmJ?G-b`H=HsMU4Q76d3-LJjVW zIxTdX;t7_f^hki`aCW~UYB!&WDv{fN;CX;xo>YSL-vV^A7`~;j7@@Z_hA7}gqo3SX zS_{CKqI>#Skl#<6)CIVIehPgI*9FCdL1rhj73)C{h=jsd^1L-RAT2CK-*M#yaTOfm z7|o9*o#M+}+;Zuyf$tu9PhuGrhLKB1CBWmLsoP0v;(zeg!y$zlA)|AGA*CUhFc7?S4q%t`D!ldH>{nx)E|oN{wpg{!N(%T>{4F3-uSl$x8$S1-Qd zneRVy!(tJQ;51iM<88s|wUc+wDleb4bMpDKjAh2#Zn)t#>}H*R$EK?3TdH&GB7s1p zHqYy;s4lCmEvv5ZdGl)NT3v4Smg!ZS?pX2grt#x9JH+b;BuyGJuxc)&V^oP%f#DKti~TMtPKgC4pFD#B*e+D0d zmYLq<_W3<;*XNsIpMUfq?DNxG3&=h{s*GqlCCwrrZ-#u7A#G!PfiXN=8R;`8C;4U+A(-|$01{+vA5IHI1%=+ zN#k<%v5EU~)*cQb=qU)*9p6uAf}YQy>x3=CDEFsbTmS?JGPP^Rfde}_cOTxe#9G_= zvTJ1v@X5MbR=QqpE$HnnXiXemyEw0eW_d~8VnX2ZR{Y|=k^ z_gx^Wp)H8-Nv7KZy3Gv#29O=C-30*a7T9LF+N;{jO=9S|LL_qSR6kl;(qkM235Qb{pzL8ZmeAT*`^r`AXlt}529YAF z+Ld9%`5ev-@VGz>B;pL{SZRIgn4#VwAks^a!|@{42vGxvcA#B|L*5FHCR~1;J)KgV*D`=XsnQpsTdad4%C3J0>d`> z_^5LzOVcZRh_bly94Bdsmyao0#U;?(RDw(|86=v_@nBL?kAO70kMp8vgmqkN&rAl+W~;;gX%WkpM{t z6oxFz4Vtu(UovN&QTz^AeF@tnnmanF#=BSQkLTEFh-I|W)NgR;SNlpclrJ6YvX4#}ro z8JjEt>IgbYUf%ypWArOV)ZmR$GDsvicrwYymDsPikM;C$2D+cN{J4C0`Vig~sy0CD zPa=&Gq1c(5VYeEJOF$on$;VWiVb7er`_g@g-c%evnlMf>y$L3pFTDz{!M6&xhQ(H~ zL#LhW(pcZ}%dkURbU#MKj|wc+w6!mT`{wQf1GHWZ9U=nU-=DEfCy5OBoi92Q{yxPj z!ylbSCTT(YW0N6ulHJS5ogqcwV z&qu;1`#M$sT3jBNhR#q$*h`4}OLERe>Oa}vH_ZJ7agmWH#Tjbz@s~1%;Jz6CRNADJ zP4aed&_&*k}kB9L;+<$O24wD4k!dQ)04Ok9slF9GNeFF*k zcN3`jd-@WIzW$zIFxlUq3AZ)2nZP260oKFR2pdWS@jv7$i$2Ku27>)ToiFLr zVL!n7g18D^H`s_QCE(!_XQmYc+LH;6!ad}E?8W~W<%dZ;YgV}w z70pnQU>H}Te$!+Ug;OTh=yJ*ZO4;Ze_?A*Ce12rfgapc>lxp+?LgUDS3E-h;i2syo zfQ>(fBvefQAu}V-4X9_*nJx-j4Ap=&lq(Qh_XZBC4F-8TyP6$1VgutLrd|1(oA#XiXWc#waFCwugwTx5zJby1j0Wl}zOHNL>V#oj=<&U9Ir zp;UpYg2Gc)OR5OHfND1SGL>tF>KjsxGlizwGwt9yo45YUs5uCq*sF1eJyU4{vp=pSg<}f+wRamPUl?Nd;5Db!1!ygR>Qv+l)*1+a01Vzq) z4H7pY&LDTY$m|v~5gki&SF{`HD{w0+rGg%s>kBDg8leV&=0dE?2r4`R0t|wO%7%-) zti%HH!hso7SJ#3lyJ}b;eVV_u{bV0dMEU1W;`8dBJ_VAhPuys;^&!3%c5wj(QqXb5 zo?(Txb8v1C@i{$MrKng~W>CN+)&eaed0=?VSPyAcIK9<|i=B=sVc$lw6>0%9wFVp; zhOzZlajnsSq9Gon!iqm1;grbR1sH0i6Y(mZ_hZrx7FAIx zKogz))C7HOER;5|r;v@McKR|73-u}K?9=*taYis09OO4hv?aQgS$~Wuk4hD^Fk3zg zBKb8pHU^7;(+G>5c$55V%4^HB+n$!aSL(}3l>5EYz!30_^qNkwYgp5V*40*lgnaVh zrX`q`Iyxs+OnQMk^9`bEW0#!l+DImQEOLmbT6?&mc%W;e2<_1se-ILMd1IH*Po{pp zJRV*P=2yA>4A-g1r5tX5LKs@cw-ks!NlZQevtZ8iP0sd z2R3${aX4Vy1VyD7q%~LZ(o`cRv%iu`jAi$73#)5;ULc-c`F~UgBQ=6ckw*=&zvI{ z+UcS0)T{JRySSJhTHV9rDh5B`Str@$eDqR%Sk@TjKBAdX$^AUDhnuMQZDv6HUQIs> z9-imOWiAm0BT^ef=^7_DM8bGSLu6JRm^5pGaB){%CR&jb*Jib=)#29Vn{K;f`2aaq zsgTQEMagr8pWYK^eczVS11fQ40 zyr+3q1-(BgKde<143rp|{IZU{WcVUS5$vGq&lfQ#T16*}U9kOENMz39mMul^O=@w9 zXMnCUr)6GC4sC?nh7O-QaM76CCp|Lh*3yd(B$gk#a?S&Dt~|6nG0+m-f8!4iFP)jZ z|G-siL#NwdyluQbeTz}m;9;v_a zP4NleYHgHnj!%HLpFbPix3sUSB1rAZcvf<6z56qP^efdl)#xu zoB=3Q*(!vfMX==yp!7p&amjz=!pP6$pG9;&e@>+?Xa58Hb97^?eX@a1bpc{I{;_GR z9{xxk{OI9T*fZ&)huwU5K9H@_2e-@Q|G@?H=VC~Y`RvJIewpx>MGa&_v%)YQ)$aoOQ);M zK~)9)|FmvKcqxN=E%D$aIJ-PWt8Of3GHrQI8$_Zxuex*I}nb zQ_y<;H8dg_f2@oGsmP{+9WM-0Oz;+=YB2#th{KY!IH23eIusJ=A(!6CZ@$@o=|9SX3zi2DzN8bFE_?N%l>~g9b%+<~ce_6Q9z zLB2-vnp(|fiEUF3gm0X&0#{Rw6ctli@bZ+6Z}R!by{X$BH;XYP?Q0 z%9mVyV^igp&4zbTtS5!2uPW{QN^f3fAkdhHbUlQCoDaZ|L!At>0wBtv-kXyx<{ zDq#o_#J^JL6;tm>CGEv(gC~&c_k;}&ms(}E1sqnb^sSSsu%HfmghZgM7*1DOrv-{# z@Wqrn8+@?EO@np+h9kbjmR*lnZlV zx|o|fDkU=po58*jmI`t1zc5Pm`p*a8*QLU(zr|lq|L{Fx4;Jst>F0Vq?*7-{QJO4V ze&RlYd_JJ){$I}-8h`}XJ zz7?KTMAq6eVW4w=a&B2IB-z@s^sa7Y{rKr6F*`r?@u#F``ED}b_S7!Uk>9;6T3XyX z!Jo6ZmIQTN5^IN#Wvd@pV3CsMS?P-zc^y^&l?72DQQ#b%3xuC-;6#Wf(Ns|s$R3xM zgjKF@sP+JIdx&9FlVXxjwHP6XL6b<{`}LH31qfeJB}^1^PfKnh1m;461t{xTui$cU z`qgUENDh6JJ#$KBFq@3BR}DGf5Pm6IRO9z$saqyZq_v~ zb;~F6Cuy)C=D;=i@iZO~o9Py=%X&@fAIhuQEvHmQ-_Qq{{*;Q31q7O6NYrEnGY{}I zP<wD4m;$J15AMqV$M(8_|yWS+rb=ZI3fAtPu(cef{XYA@^{>8lr&PRtXJMQ z;$sR;=)pu8#Jsce*fc&jGLr%NIHG9et4B&KK1CpxkSGZuo@g5<-VS7I7KDBuI2s?{ zu;zl;q_WtUdYoC^duBFOpW8CNG(6etFq!W)t98)jb=|XP4)bLm@ClRax|^B<9`C#y zdqKomKKI6Ops}(fk(YChO}ERCZ)S$p-dj*$E^iAor}HVd7Wuf)NKqzlW*UQCC2a@X znX`VTi%@cMy)U$CT(?F^y>Wo6!>DWhT;{-r;W9r?^+%;u{UnLdhRU!Un|zdk^uMQh zGC2{uL1l`GQDs?GWxqZ@m&NF7F_z0BWQ~om-~hdwHj*Z#qGOS^oNB3nx4uqQNVp*p zcbL!%!UTx~kPN37j)yp)Lrq2u1*^(nB$b%4i0}UP{2)5HJ7Yhz~e| zdV}>2Sx&z2+||fGBe-!z)a6{u*sf<^5k5@GqEtKcoSC&vV`?fao;Ci++%*?oRW)tV z^m_4w`|lqt(VN^Z---KKnAsk9Pl^J2(^T@_1M+9`uZ8XQXy|TgENu>TDdSB|c?!insMEx+Qz!M=>m+{7I{hsrOXA2nb*;bfstGGrPL;l* zO22tEP|i-TQTv*X#?Ba32tYQFw=To{5ka|C5kfffkm`kx04$>*M;Lfwl63+3?s3g$ zR%6a!GTN9@McZsR7I7@%I7x6hQoL|l?x3n{Od<9X_OvdlPQA_j9eZ(t!OqdZ;ftVk z1HuX{K6%s*1&Z_ZgG!eh>l%1!R*qCLauNHpj)fdN*kd2|I)$%kYyX zxp>x?DdnA!3xmvKEWE6@qGeuqOnCk5c^BnJ@+%@;%MR-!dNYtRg@TB9cv)AZ0@p8^ z-?bih&1*?~P{{!P>I;{Zd&X6DmCjkho}NuV?Tpy86sa*x@#9eyQ3S4jR|V6@ zvYP~j)AFuBmainBzWc#9Gp@em%lhpKC@yX`HuXYZyzq=-##Ck z^iGl>)~i=^C{8Ux0@-M; zZ=3q8_;^aS;K98+=S=Zy0e9=4GH2)B2Nx)W5Z@ynNi~Fb5hi-*h4eFc<)tvcr|6r0Qou5{qQ8d=5+2 z@ywIl45h}lhm3YT$`&Rm&-_J zT2LYdxsv!JgqV4XqJmVRc!P`IHUZC8loLkFDbl*Mk>ieS^mNi8nPUTiaa?IyLe zVf>ng9GEC9tiobs{UU&jO=@L$_sIP=y_WR|4&y5C<68y?Xrzn5wGZZRsBD@V(uK9A zYM&uEZTtjBNg35GRA6)nJpc`+x)q%Ya(-J23;0mo0BHz48-Jm~#US556Kl@rwLM+TJD&p8uVu<`Us#N-ZWDf}z1l;&b%JCe5BQ zYaTHHwY@tcKTjZ!L){yshpc9JyyjL^_O`4)3xF6Rw~IxHvm&wV02;G=mt1L zA7q*z-ZM%=j4FdzepWH+~Hh68Nu+sCw^XA7qY^}srSEqJb|56j*sRE-RI73=B-s^mpI1f&srlt6cX;4&{f_^EL{KTQGabEI<2!#br0& z{{N{}bDL1%2W+yLx$vNa8Q;F$ zYce2TDR=_#yd$PR<2u#_Hl2-gp8jo_iajks@JL_83|Lpa$LS%-EQ zURM=apCoJ8))mjyGyAJ5PO;=Ddj=0xMWry(BbASBzHTV7M5k*MzQT8ll#-PA85(+U zKO>yBk{Bhxh6277kgFX-VN5+7Ha)NTh%z zJsvoJ(^Mut7~fFQXmf)1;`$n}3#3!8CvqI(ykcFDT)g^=ivn^#UJ6HJJ3a}Oma)&Q z2e6ydGI;mYpp5sjWI;3{B#r$R7nr@_ek1z>#~A#&dS8{69IH z<77A!S7pz%k8qE|is2sR=G&d(mD#gtnC@#p-Q9{O9P?_)@ti{<@b*L64dRl(5Q90% zmQzSyz;3#=wxNf;VX@2a*v%F@Fnr~cLQoz^4T#C5xw*IIcI7S=`mzhg9=Wx)r-A*4 znI5s2>5)`I2r|q~c|hn{iYIQ(&0X4)UDE7!${}B9ihD*^Yc)W>PIGP?pyPC!MIPgF zkb~r>K2#b)@EmjmOy=0AVc)|BfSo@k?;!5uEryNHUOp3{E;jFSTzNV1_Yn5p4& z0`ZS~7mi4)MZp>rSR<>%V3r%|3tGc9MB zRe2<3@d2ew8VnrgC`vK9m82aGuiWo!cgp=v!4q&yh_e+?~~wsDa#{`WsnE(@%)6X15aq-BXGG z1P{{#iUb?H75Qf1B@!F5K1DP6NSjz4ApJ?Zi+jjKs)oOumau=x7!uNWl|xcA=MyfJ z1k&vFh_8i3lTj_1oxT7%!1VyWmcOOn-<6DY9k zeyN(hY111-pE@A>knZJWD>wunbO7?Mu`gfdC@RQxBVCNyZ2I#Nlbh1cAe9pG=rHv= zPV*+SbKF>mWwXWc22*+Qee)4A$s)ZHGRY)20y$u_KhkM3SvMN3+pb2+7&Tsifmf5E=#u-pSB!S(VDbmw6V`^%i>y%xtG9{&90 zBNO!M+@kL3zj9dinw|0$$M7JE%2c($ws`|G({h}^)HcL&lIJ3N0GUe0QlD{*ctD#~ z=uo=)Azc&Df2jMY8t`@`_ea2@X~Z{va>QZTZ+5m{+SQq(wp&+gZC1UoX-_0F`_lYK zS8ZLad}d|)n2H?x^LIJT`z?-f>pGep8oOz>&T27>-ul*sCCe_hmqeyjRK^>6>L99Pm zDGZg^G!EAxEAm%~j&PoLL8reg76>B^thX}SI(|{Q&-S3tTG0l)0f08+p+pVfzGL8m zl@5exCSZHWvQ=~+X7XqWW$6M?)J#@ zsc+a_POCG_X7@)xfU?0B!rThb(&fxfw)9@>2#4twt1D*Q^c7t9g|KwME%>AAfDtlCg zO?6mSo1OC=mR_?{Xt&vH4tZg8p>L6$-Rrbj?5XcL&Ak@Ke5ZLeFgKnyJBgPeVG?x! z3=s}#iAJy#5C+1b;gSsv#vy7#ct+{z#2q{&=N?F=FlVq0sh8wO*uSZrWUbSDf5t35 zKvxD3P9JzlT>a8cIl=ChcmLN#qn+1q;bxS5o5ev21X3ZOY&sxZ+Tf9$r@9a$!x?tM zqzed3M6`u!Vqv-fpj+jFA|r}?#E4Dc0sQe>_iBAdeA;inen0j`yU_O<)%CH^ zb+o%+G4hbvuJ)_XVXM#6`gZ%Y%h?6zs{L2n3`hn+()V%^pE? zUJ9Z#vQnsFzhFm`$sk5)>Q@`SZj^ntux;|dxuB*W&Uj*c; z1jKy+hgP?0=mbjxPFgk6^^TjjZ8d9aW^TP~&h1?#w>u^~Un*#N^Y{a}QrL zY5l}Xk96uJ8wA3^Gd1iGV+Eb}GB)_R@Y$fYpy|BST}2H=IVO!DKgvY4$>xV6#}}cR zkQZ418PsSDDCpjT3WZPSW81F8L=LNDAZox&6$#nN)DQoS40uBjA)|S+IH#I5REw&? z0a7jyHUp&%NwSo+T7Ico;nnziNv5izdGnQ6=2_~X5#K&L%mh1gsropzq756u!FR9= z&r(#BwGg(AU6@J+$SUosIha2+kPG5rEfyK1N=y4caIr`+TySX#rqMV<#4)8>z+A#W z3Aq`V3OC&tN798jCZ4v2_RboobpLlIn9FN96S&_mhSV0$e}$O%*#+&$3O( z^@rqcCdUUC3-$8#8mrNwcYpDQJTR^DpOw?(cPGAo&-+sEZ!2w*ixrwq=4SwzpkY(@ z&_p@W=eXi8=LmL(9yrrZ!AqwXtkWGDMmso+J{Jbg+|^PrTVsF`kV;bD3E1L9PS6SK z=O?FB`~=&cGu3(+j6Ro8o8bz` z!85mp&^M~iBU)ovvl1Mt;N~+m1=~FI`&k=+k9qa0>ABuP-n|iW)_{5oT;titd<2d- zq12QRqv-h8?Aeum_jj@CK-m;Rw`?bOZF>lU1;&h@R^FPKwh z(`h$pCG)n0-rVcYUvubtLgnVo>~XD6Z8Mo2jSHSjZ62EMLv^p`p3TE`|8hDvs(Q{Z zYmTo`_t&!P_v0^V2q|6plMkJ#_JgCVsjfL=d(iq$a(e>nJLy+}1E}=6;)pRCT^hpx z=}3_8jB=i7w1ksPdCp*OK_^260(ihys6vn#keR(_b;AGGv7} zsMCQ|rV?|{+}uwu!8?V(P%s8AENCkWPH$;w85h|&VY*Nd@B>33;ukK@i3q~x#KMrH zIZ_fUYj!!^1=YpP`M&7%vOp<oB$@JDx<&+A))0Jz~>h*p{ zsI#iqms1q=hcBJ6@XmJo^r9;gjry3?Zm$rDVPj+*8g6=!5aBbr96hWnUc}0@ zU}UUB?v-m*-&8%J`VmG+8~|rpH)ec2z|;!e@Bu>(fp8o+Yw@&kt|qOPw__l1gB@-m zwve<3bVV`ZK@Q*!tpGGZP*`<+ZCx$pUZUWRYF10m%F$4eBZWe}1``Gl`DmPhZP&&q z!!_PjgTheU9=B&G3ONGN;IRo1tB_@kU(5*d83z#YmOMKQ19{K3x2Im{nu;_89kEDA zuW3iZ9G8c+X-#9op^lDV(HN8Vq#&9C@!CAMD{oc6eMO;9!{o~o3Bm0&w3l9m)Pf&f zRW{z>asdYXY9V?xAi!NI^EuOM;xlzYZP+-Kh1_{nH37FfP*auXKGxB}p`|-CM!cPU zo~{1-%U#uo_IS9krsji*@?v)X#NF}@#pSuSC@Ylz;S;O{%(vlCt-EAQ5&P)w;u81M z`aFxrQ5+34UEUOkMspjdkFW7FliMgZ+*wm|XKhOS&fKylwbiO_DqDE;@p+}qblhAz z4-t;VKmM_Isdsh#PcPonm=}%aHS%4cnQfN;TwoJ?4C!nm4mg_Wvb9Bgb^tHw&sZyl z$Hx+2*X&YVt-3??7?;1XCQwL-8q8m9b)<%{ZS6IoGjvO)^WqpCaT-r`k$9L77=)ys z*0Jb$3^xc^)jU(LRukky1ksr^DuR53uo@AaPI;1QoSCslj0#aDFM#t;AEDyQF|Wtt zjj=iBoHN+CPJU_4N)}waI3LN2*EgxZW9#6nJ!c8XTE&xrSVw0p zH!n6}G6WDI)wf`Q@C(0XQRA~I|FeyY&3+s=JtMr&j|cs$cC55iMsn9qVo&ErCUit| zbE6#-BDrkVl6ZB6S+|6VjzB&u`p*szEBAC(RCFHh?oR!LeJo#D;ueE!y}YB!7isB! zVT!+@?l-A5W9#b!bImn|q6rIE&x+L4L}neuE*=Qz#UH&fVZs{|Qwu-b+SH|SyER=+ z8$YIFt;?mwv1Eb4`|r#;^}ykVr-bJ2e(wx*gtKmvYJUy9Qw9K7Rwy-)z7lrwT&jZm<+%7|kvAf~R?ER$J zFaFGEOnu6_j0S_}lM-F&BfKE!BO@L2~kRm+3yHr?;CCn&h(cM6Rr`>&b&ZHvWR zB+fR4Q!zmfg&{bzx0&#twyQ=?7e!A3T?F|u!>XuKEC?C1CGsNCItkQqK9(ux1_fEB zM>C=eRQa;1pfD7&SrO_EMZ93O+SX3`{owB3Pg-ZQScUYtxF>zSWU8GdTncvfBk*qr>xZF1t-VNG9xeqd> z31h`^tC8gy?uao;78$YwNh#t~;}0%gNDLlvA}f4fszrQ?oxCZ`c8Gn0zlMb_)iy_X zIF_3KGvT}$sUz$dyKbkvNoe13^N#(uuv^%YR7V))8Au%#)-D=r@(a&FCd{mfiroyFVNeqCU>qrZxaLwe8j*-c2 zvKWvIYsh&NJw|=*kwufdU4*PdBuG5=+@aM56s@W zb+&ZT?5!6HSG9HSerqSQ_II|WF7}7R?8z@4d+dwHgd6Y69Wy5PK0Nf%@aUNR zBPar~gR&sOs~JlGRNP<&Drg>I4Z!qqf)guJgZm^$V{l}@TqfZ zI5q)N7(!7Fy*TBCs4qec5rDWWb=%^xyxeHfl==;p7niq96QvuMF1h4A*W|J)`5pPA z(u#y5e`$U5dvCYJmoCs*&1FRke(}QUib-=4uAHF8@du%Pz^$ z>vfe?T0@~fH>}s@nzSUUah%Bs_?rJ3=KW(eiaVpvfS$_>tQrI=Yr`FZ;kZ&H& z?nDcseFe&#SqDznS&N*-AXHX{8Tm)o@C-NUqOL1mKA4@P2u*^3Xf}z1KC*GFElOfs9NMI zn8O;~evR4%%~g)e>C?h+rPk)8L~SfbTDw+by1ij`pkjq{{955BaZi1yEnq6Ny2j>r zUi-5mb*-z=*yYMyVs=H{@K>uIo(1qqK*OnK!ta~bB+w~jw}tYXcuvlBy3>3vH4=Ey zI0h-RHYmWQ#`sqq!o)6)I{>& zvV#bodyRQ{Rbx9ZgVDLPrFCXU>p1pdc9ULqtifx~&0oP{$5{BBapOvgz2B18&nzt| zinv@Bv!p()O~g|PA%&ra=mS+c-@<5>neds-EZ<`=TMY7DW}V(OphTiUNV3UE#6~7< zPNy_L%A1oxyoG!-R614X(fEZd8m0(n%gaK$(28O?}+`?G7v zra%2o(xH*{X-GQ+-3a(4O+OW3RH=l$XbM0wW>*0Xgm?1(R&PRkMtQ_wdRURv6D|}H zLZNWC#6NQh3%^5#2a~Lf1R8cAkS>pUQ*7Sl$*Ls_#<$F#U32TrH*VVa$mBJ>h2_gv zP1@dFTRST}{($^$UVd9$U8F;tHuZ6aq=Ibxu3gUugP}s4sQ>Zap@aGPg@xmb5*;<& zn|8h^UD7gbT3emNsJVIlx-p^+ZrekC@t6}L)^sD*a#&I$a7m!(d1Ws=lv+T4n&jX% za*+}oscqeeX#78^3xs%T`{2jBgqy_+2j3U&Lj8$mVTP%9<84;>|I`EfZ3(VdlQ)*e zC8hUjWpz{7JcRCpQAKx>o)Y3ES}GbRBTn2-L5k$14rhS60`eIGb;BT~6 z(CZC)*zusp6Z8(AENO09(A+G|N|aA)UeJ7?xwNF2O|3`>kFHA&u1Kz*q&1nflb5}@ zY_isD(z3(!dvi%?vy|th_bC5<(Oe?WDQ#{pWsjCLJ5#GF5`UtzKPlTpg>XB&x&DQ1 z+g_;OYu0K^`$|gonKW8+>gLQ-rAbur|yq$=ZoR~y3#^aB=%C-|g?SZg@QjkuR%X<@ z9cDAL6y|s&$z_aLn>0F&Cnu6?Fgn0%*mFF#bq=N+v z8wwe`O_{;6z@G1O$AdM6db2|?!RwblTkl7!l>*!cL`qHz;|PgS_0ez6rSh|v%T)D=1c4!uS2L>)Gl)6j5EaZ}5b_*i2s z7z&9NX0iHh0qK0^WExb3Sw*8+BhO(vz+CAJ0<#&A!3*6j$hSLu)|`MX&rql>Rgb;U zzw=|k9&NfPDDn=>RKkY=Qt5#o>1o(yY-@Ow^c7n+Hp`{ zjVrL06$qkH&+?p}d{$Br71LGX4bUt@MTW&65WyYUx3QFGndTT|oXl<&h z@OA2JIzg@1*4nI-qdHARPKP&-IkyJgYZm(*k)Tm5vHJzMurRCZM>?dC77ef>3buNQ zIR=b&9X$JBuMUXnzX=+hU}a{rMl!3RY%qyTI`NVz$LsOHbJ!s{rv_|Vhd$4PVT?}7 z4dyV`Y{sxQ*^S3#%p-3qoN8jjnT=^3)N_ zy!wf|#!pg*s=_&_R*um)b&{!|CO=@rBA3B|OCqj32n|IAkV0BvQCJRnF)D`1a2|t} zON_>(5UtQ&B}FhO3CKiH9fhK}l|h|Rrv^!)6UiBk(Nmo60DB3(Id#ZLmVslFR3*y= z!B%(E?yJJqXFuH6;tt9`l@GH;UDY=pxHKA(9IG$hd7wYYD#W+n_{qXC8*Uo>I~H_d z)^lG>pS5?(gi9thTi+88F}ekhSkfwhUH8PiovV7G5{Q zcv!fxs`Xs0W#_w#7vIs{X)!bPFW5ig#LlYM~ue%Ondf@LQPFGVK5yDu$0Q2 zb7znQxJ7j64927rNwNc}vF(>s#NQ9nmR%<#>4e)$Ma%F_Q8X{-rJ?jv55WHd2r%5r z12-SHlLiy_Dj$+6Fo2wKcmi>grV=xaX3xaRkn=}P-k-`p*CR@(y`rz89kv+#=jDIO zt0`^(IO>$uEV+6LaGd0xz5lUy?|(3Of|RoP`{eVj4uD#JN~wVX`ssIA*&X}jhf5oZ z^L#A1Zk?R;i9PhdUZt#%EeDXvhP-OQp;FsG+jPb~%&us&O!*`gViywtd*pvO2IwY$ zEad@S8ZkkcNPwB&Gq{nLAy?!>u?K z0@x^zw^GjNJq3PnD88}C>V!dgSW-4>K^%3cxh?6zc8D>=+?lEi&gii zt#;EFUzlz9l~pUhnoP>C@~imOX8z&}6Yuk+`um7;aA1V0B1FrGlxaBCLsrTN&%nwv zuh$iE)|j9$$l(?zz{UBvuHk9ZjUS+v=-p0JI?9vEh#uUu_#g>~+ z9I9~?Sc);H6@9T{GcKjxfaf1qdWNb;YZ*q{kflTx>V&W=dj{i|6Dpd{8f=Ac^VmA3 z8cfh7Zsla(9)`ofOcqqZQ+=8q=mXl}o2J63FNMHMl#qr2kUKF=083Dr9;AS1f$I{% z{UM42@jEmeLKqZjFdYVYFzC_r0P&*ZH5i)f951R}iT34VlQrj0X|hQ;ul4_`q6(R&HjxqyI1yQva2L&u&tVUoq#0+?C@u`5(4><-(Yfw69 zM)MgY7ZOL19zyU&Ah&3Dd5`+W%rw~x>1rsWDOzjI#D7EHj)J{%2hL6 zQDg6v;&!vCP%n6#M!&#JYI{Mbv37CP*jiXwpcf>6>5|so9R@4RJNPH4t$K1FRh@cB z^SOE&^vy)|DiM*o23BxYWJnH%w1eu-W1?9RFJA=tjV2?)$l)YI92>=@ zI&extAX4bUF`K-3Efl>9FbVRiuWbGgJjqzpE~ph`F9q5A7h99z#=R<_23WXl>EN@ zUvKTXCix&+Jav4zq_J2vnrnVpQC=>nEe6xLrJY;nB_F(UYT^cq3By2WYH8bIwg6<#(YQuf)_rLM zzK$}q^_cN>-x#%dR!?e6!0)II%z3JFLfoM#XsFcq0bns~ci0TAh!Z}(DhlC`L2#$6 z^$75%B*aC?NDN|WN2H^4!NV^+|L}ny7lwZ<-;sLd7+k!i__0?~PqL!>3%k1)esS>N z7wQ%{Fesn5;#bV~T{hvDsS^2vU#(zA2HBtUe<@>%LT5<2s7s)KK_nith{U35R8WUt z^#wh)2v8^h0aozV(XpD2)lf3UE7XwoB@09wkf>IyK^B_I8ah;85?s{XyP|tmv(3Iq zKJuCqDOQfM(p5#1yB95AFgLXMrTv@Ra^iliXHw^~ISUfynu(V!U(iw$@~8ol5SY|Z zYl+rOxuCg7t#QGo3AxBpS+{7}<()#TW#;^O)0^yeZ?(oZt!w+%>)3a?wzdRCOMZ^Q z@Sgl{=8xvEw~kvJI&<07-E%8l;hEFR_VzJR5bb#lQ@2dawL8Z&wY61QZI?{ZxF$^9 zxak|6Ia9jMSu}TI9efFv__f})cw>R!oq5@umV5{1k9gx%T5nTDRH%a8%nkqHzryxO zUf3=ko5Z;+3Z#Qt4r(|%{YBs^rZ6wkU$@L2Cl97RnY~5&<;jxF-RMMf>bHYgs8rClzow^(gBx zJF|h|PmAb+)*4}pNHNOVC=;lXfmA;ArKJ^z>_wS4P_8E(F6L++el!mtsiJotLDZL&koA%;!_`kmrnBt0xYObF z6~0_^F8Fe{st#1Z%ULpTX^wiV13>-COsED**bl=NE-u?zfMH z#mLsxp;cFw=9ZOu^Ylg$+P=!bxQTW572BL9cSn`o2x?(3Dsq>!l+G*MyS?}7kybl# z@BGT~F40+1Kfg*_F}-%lOn0!tH+%eQ=;k8-x3a5&v!lA|bME`x_p!T4^PK=oNJ9uA zY<82)hZHtp2}wvoNMlGs!ppq(?t5?Y=FLpzW50l~4IiaIDMri>u|-5gtcW!#(we3b z5h)_piY?-=h_PaeNU^rH@{7U$xihob1*|{c?wxz?x#ymH?z!ilduQg(On(+DsR!m| zvI_(*9-cGxqLsy^pFPrBnNyfPeaj>F;3XXkPmkZ5#$7r1XxxMtOO0s*NK6yS@RUxS zuD~B)p|oNm9PZ*i2d4-8^hPE%JqD)q@h59>`+i1p?5k&vf9;X>sozedb8W?$-;d*| z?Lg8{$DEn?c1jo>r=-G)lV3Y?{Hxf%TvU>w@P&;TzoVqy6Tx>raPIfPeTpAie~;mO8eXHHKb*@F z(Eji_kp2JX6WSl5SDb#<6Wd`wVDH4?8{K-TQQ@m+ zLS?IRY3i}F;_uj2pl75 zClU7|W+4OzMtv1JxRn2tGcyuK8(vLzQ~JZVj6V8c>NRG_K`5?Sq3f>$4Yj_BPe;0 z7vV-#dm`G2`Dwg^E;**HKnOnArk|1SS9vH0UMo}`A@3sBqv{&dc`Lmiz_>;X>^O){3BW5ywLa2(5ma&wXHpGX($ zhi!m^7}NR@xDJ($@#B0z19%aqP&F}J*hn4L0^o=C*TC|3luLdKOu1YfiG}g5-{g6jv|=T$m@&o zs6WABB9D)PS28mWAbI81ze`xF2P@cxGT8if&BNPG@*h z0G`uH#9Rl{f5dMF_LKd8|IXF6X-BkIXdOB96!v9amROKDoZOInIr(1dvee_L)9D@Q z=Q6d->Fkc|k?b378`_>|JA=0s-k*Cdza;-qVW2Qvc(K@5+*^FCeW3k`ju{=BJ09=c z)p>X4sVR%6d~xc))Tci-JZ;sq2d2F{ebe;EW^A2ta%RuW+RS4!e==*qtZlO%oZUJ5 zzS%#WvwzP0bG|hf`u16c)=+=7{@ty;pq$a zUwH3@#}_SLba>I@i{8Fy{zbbkdUA1L@w&y2U);XLTJl}omYlY9&C(-F-@UZ|(z`Bw zvwNWX$z_L@o$4`r-sqj$yS?|N<#U!_zWn&|pR8E5;`4o4-_E`#SI%E~3|FDwSbg*A z7uU>KQ(p6>Pn@{C{c`j2qnE#N#r7*+?Kk@$>VIYJv30Z74X-xZv@ zZdd27y}O>+^`qVWyASMsVE2jL-`mr@=g^+xHzaT9yWz+U@9f>V*WdfhzP^3K`%dxS zjoWTKQJPmew15Bp*Y(5tv*pF*d&{p?u$ijzeD!Gc9oa3b^5t4ztyX)t-d{gff2*;z zaoi{vYm8CjE5_*qmmM$<9BCGs1I@>qZ<$NXhs~%;)OyWcVq5kz zj&L?RuN+)*@F_R#Hr%JZJ>Iu`;qUTa3AP3=4{jZNX=u~XH->kNR7dxYK012(rp-4U zx#{(r*W7H~{Kzc>x4eC5;i17pj~sgO(2s6C_twE%A0At9_=mS0xqaI0qqjeI$DBKE zyyM|Jr`=h-^NCMS{q(DMeetgEerEJDU%ESe_ujjoxckj}`tN!A-dXpKe)tcghwy(? z%*NR~|AfK-r}ZO*zoPaihB_s25e@f0dDt^d7-KyVEO38xLj)(Z`M5(G(%@848;;-< zo;rOvg3~DbYy@Y({nZH0YO`oGg4?udbR>fDjRtx=f?v?^{k91Hy4Fo^;=3ao@s`Uj z?OLoLC7uiK($;G>Vjs|ET;r=KtcPP4t|Kf(i1XLtYb8?iK;1&T9ifi5hMSs>uR*K_ zzpdI1a9E2g(rb{~0o+yi?$kEG+f^#8Wipqp5AfLut}f~@luTXt#?Vr&Tir?Sg8sT8 zP4E9A&o)RRAxkK^3%I6ub)jW8+Tv>sq`Pn~VWZ_EsKtQ%4b^TgQvnp$S_6$cp$w-( z4f(+9cpgYX2i)!^sC1NMyn#F2!2~WAN-yyeYRq|eslI3xVu+O@&LySvwp-*h^?!q6xN^co7xCY1NIQAkw zt5ddQ{N5kc_Jq*nBOOH=uh7?UeOS9syGOfQ`>e({SCV+pK8;;iS>B$5{h{yyfvuHNWp}Ba?Hoq$WJnEwJX+GXsy@0RL(uK5$E~3SB zG2VrD2`>F!O5NDm)r0ff<@^)_zDTi(R?`~1$n7%v1a87zLH)EAbI_GEKv&Uv>;cJLv$;R(WmGz-A1?59dsvs zn(iWeewOZ`d+D=uAAOGQr(eMH1HVWQ&@a(Z?7V-FewiMkU!l*_7wBR7ReFSejUJ_6 zr^o0w@RG>i#8-oUi@r#|O;6JA&{Oog^d7VIM`WN~heV^W9s0liEAPCumoz$YSp zOh2Ljq@U7%(R+mV4A6hm8G0Y{KXz*2T6R*TL|SA7UI!_1c(F-A6a}vMicaiznkqgf zritldhM1|%7qi4{F-Oc5^TauLrsF)(CC(S~#RX!4__$aoE)d1fAg&VY#nobi*eEuMYs6-; zMQjz<~XMc8cr8F0ote5jTjvVxPECl*E3ai?a4jQ4v)kMNQO2L*T7+ z*c@Prmav2^9C1*%!V|s-#Gn`w!(v2?ikrmE;udj8+$zSzr^I1#o48%vp*@fZETg-7 zZ8yg~-Q97#EK2u8ac>kakKz?k+!w_wqj*&mua4riVcfGmj8~}mD%6vzo4V(vT7hR& z(w@}aN+T<+L225KOf``9lb)};IX;wR%kf8&fhXN$%`jV8zfm%Ew=RX>$S`bpzOb8V zSGMdynHjb1R>`okDz*bZVb^MD&!}6vnW)(Hl<(?ZBiXQ9G7E09q?>-yH(E03+IqE6 zwTCPd0Hd>UA{{u4OBq(#9?mVuWpr0S@R1aSdo@5-F%pE znYrwJJPBcX0D|>C6-mX zX}!t}p<&1=tA?NQ8oDb}m4<|dxWkH`FP&0ZuQZ2rw_2>}P+^?P#z2ylo^o^;0Sv=- zGBw*}@`56d6N*!mNXY}T;ulcQplgRMFUASggf_Emu4Pyem=BFep)+<<#l?ex zgi64KiQ5dTW{1VRiYuk%HEh2a6$`DR4Fy9eSJtf<)LqveQku+%ppqgR!hw?u0c8)H_@==0C=!gU#l&)`}#wk&{VY|jC%vU$tVDY62?7}bjLxvB#3>D8t z#%8Zlh0x+lsNA&^O*xXpX!f#^$X?NJ1g)}H3LI8kN0ef5Io+llNkcbldF5R~pOWDY zg^MVfhSh{|hCQ5d0e3%3CeV>OivF|0HycN!!4x`7(Xp&f+YfvZWG@Ih8e zjrY7V@vx%yc<_eFoFY(#Gf{)Haa+?N=X3x!RB7g6Vi+{6;A+D4yhNi~&6Z&eP@a`6 zOVi9(SgkcE)|a^ky0H{mw*q;*XA~4TZ7ODkObLy%bk-uLPQoY#9g|RjGr176fe*LK zGCkyC%r{cL?lrwMJSue7R(1_ptLUE0vE_#2Bvp6qz=2z_nkg7$P)(Pm4iAy21U|ab z8Ob@iqwL3UlAb;&bKEsCdk zTe8|T{Ctf?LM;a*M3< zf~sIPgxRAi{!E&wO0S7&BW>yqN6JwALd!05yVPhbME0)iEq5@m{ZO=g2!{QP)>;-C z6Vj$I`#$>j8{~9O4m&(V0it)&fsUsZAStf}K~go$5LTik8<{$0 zcSo;g;pUWGWO*&Y#o861Tnp^FnuU%rd+8=dP*t`mfk0+&}oBi3yY$@+znO zEXWI;wAV1CS#6Ienoyc4JVlk@USUIl;WeO97tT)d#4}u}!a+r|w(gT%B;25!Xu3m*vR~n4vTPe4vz^Khl}8|= z)6mNpk)__A)l4}z6F?W*k<4x#5}-16yR1L8T@442@X)z@CNu^v#TACdA`t||;-DUMaCk_l9+ qx{Kk=rVu5YQ9XR<GPS>b$X_& zr@E%wRZdI{1Qg`ERKc?6xc~A0WB<2^i7Cl^2Z(%A-2Y_45ThzCA}aRH^uB$9 zZxMnHfc%hCWMKYgf4_bHZ|OyVd7v9w>)U;^-fxkDfPgv7S$2Y(>N|cju!HXysQ(p` zsg=9QH@g46Jsf$-2G#R*$WrR zL!siQ#}&N%w0_klvWRwyOkEG73-*c8@-muo+C7K=Bo3EnwJa2(a7H43$lf1EY>~q! z3mwbDz*EeaKAD%~!kO0Da<=BcLYl9Y|AkDJC@+d9(`X+~b8i5nitUFHth3Kob^|K4b^+um zCzkfUZBhJvn6ir5@{`bg_*ZV3kqLJlv+x=L&aJNfHpm5oTk-ekfPQ^}Ai4oNyP&<4 z4wo2xW*l46c-}VDn{&eVe+u%qqksC#~wFzVQ80u_cqNWek zbBc>7*?S&wJP1z?ZJE|9HFP$>!(E>9#}Ap1>aQYQ5{}2y3E|wz7&jtHxVVwn=%hQY z;qjf|^^)n)ldPiv0xXz?KE!&$l;lHOUw3+jrV$bPMc!^m7S$1Rb@bVn8fpmcJZb(dkg+ z@wt!x9qkVViWH;cz*ZTCEDchhtu|2t*sFa#t3yk{U5eg*0j@NXFmdy2gmq4a;U4d| zw+Ti^aFMFVRuw{sgP`21@$TBW+f}ke)6b9Z<4V}1tn9->HAsph=1duR5}waeP+aCN z1b`;+bQy!4; zWAS1tVL8em;&*91yvo~$NY~6YK5>+OOFn+brPzsWhB3F&7ys+#>6ZD2yZHTs%Ji0= zjCppcIO<-@cdXvbX^m{?~DK#d`OOh>+l3d&lcz&JI$C>^4TZZGWx^seZ;RM^z0S&l$GBd=)kwB*_S zSXrWfaCYlS=$YSNz+arKAJVqi*_9oqUFIN|rWr%9cE`qOEaNL{q%rE%+s zn2dxp#y2Aq;f!?q{U%gOA|zcRnZLcxrJ*5oaG}C#G4(h2+({}3sph5Z2uOp-=!o*B zvEA_9ALloGI)X^c)m(a2E5LtrP?2Evl#}0E5>wYM+8hc2bEEL!HNWYx0kza0h|D9(I|EO;H%cx zz&r5VY7r(XD=R9tV1|ifO!Y1NrEH(yW88w{M_K~^&I-Dz{p6S&w#WDnvMCUSFP)>nOjbYLi|+d@eZ-Z0-%(Fmv3*onRo_phiTs z*<<^mNoMQ!%PQ@?Uhq?_e$0(YE&Eh_s4zh9olq|UZWT^@hGr3?9#o~~Zhw0Bgzl_y z%H`~0d!wFfltQ z$ewvMz({&pSbm{NXgKFsWu{mPKwAiCyhT80(2RL^sx&hTQo!9G_w7YIwv87L z&EL*@oRfq;GY+a+UUK-Waj8`cl^LSY%|AanbldO`&1_#UL?&Gbxjnim(w8aUAjIVq zu|-rOsAxqMq2V8p-K$xe5QHuvgte({1?@P|@VYDdm^F`yM)nTT>aVON_|Km*Ei~*E zr@%m~S~`bi^{S;B==r(ZDUmxOG?I6IGIODeHC|I zJ&$?qS=jo=;M8<93Vp@EsFe-9Yj<>r(oDS@Oi%cI4b899W&FS2lSCq36kv`XNT#5( zpf0w(hgHuqXm0Enj+ok?MKGml&6~4ty}XBn1~e9Zt0uln;j9wIc@smE2+wNneD<2`b!F@FG2KIL~R0*pnjCX3Y1jQ$Li(HUa|jkS+am1C+1#x zVak2~*An~Ocr8A&@`1ozi)qJ~=ZadctMC>cv$s5bg<#t0V8Hnxwhu4orpP2nrw00Uc zlYMcu%$^icmD1$$?a0GpmcTTGc8mkzC2wJS)DQ{I^2LK?l9dLSJjWY_aZ77^Zz*tt zc4P(+XwBGLj^^Qs$q4Kwi9Fe1^twrXJU4_y z#19xYv^)I`6b6c2=B4QPH|!#FW)RF#+X?IEmFkxV6yY9Jo)t254Ib5j-xd|M@^K>p zxg_qYevP4}x&G$P+7BmmPUzK>x*Y8cT$IJ)0OZEv6lcKx7ITe;!eNi8Ee2>Mm(bCd zf|k4xm{7R)G^I9h_679;JFu?6N{Uh~ANmG@OJP+ELg9t+M@ZSF!DzJQ!Fex8d_Y&n z3ekTwY)0P~TY!#Z*Jkz}?@7n(D14NQZgbF`@P4|;rA5b5qL}R)XmJ=&7IoFWtBg!F zt}M*`RwZyV3Lp8!`&(U(8?F^E4?+HzS}?N<|JsUoIF|MKRHlKS@7%=gXW#x$@qlDU zlT3~3zFji_>C|5oU9G!)Dn87QfE}zYS4WCZWO2o=WJP7lMGmsu-jiZ2^vXp$`C#x? z>dW%K;p=gOm-#PUPkl-6N+NdDF?csf5y-%Tda7O1YRB@LcON{EcN#?Tz}) zWAI#6CM@^ZQ5t;+1YQz~&;iilU}`7hA%AE{pOIohR7Y{bqXdOjmRt>M&UWQ~Vcy(G z)t#ez39hKek_g*xGi{VwY|GE{^B@1Fxn7LNt+~0WHlZ+4a1()LoIberY?m~&=G4-B zcXnOET5IJVC(3i<*C3XWkJ}7sC|D>MR4Rd1{B+;i4%%ocroOwg=sGW%aBgmY92bTR23baR4$iRyZ*1Y=A z|M>#^7&ln6VZ&qe-zB~j*ToWEx&n1xhlkoFE;;nN9TwS11}8(aolu8i+A=6re%zE% z6ry<61v-u$o!cWT@3Y9;5NSdL!Uh$D)<#;-Nx1JYt;-9_j>GZ{wJY>Fw)c$%sjc5u zexe>U(gArOn|f?IbY$jE`;$uW)t(<3p1$1u%6|6EQlPZpgns>a6?`}J`lDx zZ~k4=6Cni(G}dT)Z9SChi0~HSpJ+M_6h%9BQP<30U^z^H^7Rr2`~=ilT4eg?>r457 zLZULx-&4J#p8j_|`%#_bfr2ST@uS!S3QJ&|mzRWv+|@AOa8j77Z{MwpQHkp6I-xb( z_v_|_bY`QVkzciuol;93a`vQ zs^MiHr->$DQ-p`P6~Q3&^mI)f-sHTTwV<$ofW6QE&t%rJs>fj2s)=g}mtnhsk-I*p zc~%VR)-`5C{`@usmN<*JbqT4Z!Vmu#eX$bGP=W;MLOHBA@t=0Jtvf;`-hddU4t}=k zSK%YgWd*P%yD|r}+iO>C0|=gN+t&UV^9u$*$X1`T@$b2dMTn*aVkCBEr=R{#J>v@E zbRlOsdb8t{)^VkO2TK8aqnVj?e``bll#StP?Job(v`beo8&wSH*ys%dKLUMqC}4PC zU%kpgcOkmYTg_iktGxflzP(=`NtiO7tF%TChCz^MW;~tW-8_>&E-`JYM8n;sXeX-? zVKk@vSKZ4V+pZn_$B;L>aUUtV<@A8(he74E_I0&&)`~{Nb$hDX$S=&N4%^*KI-^VV zN$WRG>wc0ZwDBwR*e#R6^+C?U8ziJGm-yTt?qoyaSIC*4ZR@m0?QZ!CO-6^~WYyCm z8>V#|fSd&%8$m{yQFsT-`*Ka2HfmtFEXK=S3_pzeC0P}xX5<@6wTI@>oGpKP-BJe% z)JH>4UQy%uvZ3@Mjas0_wnwcn&k<%9tcihE2Pp7k|Ne&!TjFH`M@mZsUn~&437G!W%z(AAI(q~1`EakbK07<{iGOlA)ML4}J-oG5fWt9w)YWD1x%#l@ z{Iwi29pO{FP0>B{c=Ae(FA7Z}1Y;2S{O=bi$H-?@{~^;PiK-l2|VRp-*vxy!A<(dM`QNPyViJ12&Wy%n%&V|>03~VFw9YCiaPALOch&Q z_Sf+HlkGG4DYzM>{*71uF7m2BFdpH}--V8$WO8LN+A}QFO48--nJf4Z?XsFaIqKv2 zV8e&LktQ{1Imj~E5$%6-cWnTvClrBbk^uoHQi(CLQ&Uo<+zn|B@~SmT6ZfQOznPqq zTS}9bnnHgsIb#8&k|#Xh_CT4?{H$Muv2j8RnX5Z2L?YsKoI5#eV_Q$2zC_We3g#X= zC|BHD-;*lnLrczI9~f4dLqYcL*b5Gw+xho%vhGj*GB}FuMz_)Zzs)=A$94#K{!eAO zL5$K|I*q)&#cM|aqU5Xaya5~#*VEqONEoj(J-_27yNne)DN-Q|Yfll)Qo6|IQ=b;q zNgTSYUBfRpR}DD9=gMYwk&k@jkKunh*(vv3qmit>m?Lbb8PNN0f#bQU&WUQv+`$-B z1T$o{h0h!X_aLr0^6&5q9T-G4sQKl_A|u*jv}e%^NHIhMQNo`CpTisGJbw#3Wli_( zx4we*8a7aDxTEM|-irl=W4U zo@ZTrZh6F`I~@ZF@+cSTc)g=Zm!{17i#RIA_FfF%jeJg^WTY?%fZXHrx6hsK!~H=l zHvHKk;kW}>wrSBhahlN$gCvqdYjH?p%vu5!{Z_w-r+BV<*2zfFQK8qNx_n1X6s$>u zQ6~zqxWRHMLdQ^EhK?}=c+IL1U5X-_Z1&QegVztgU>EO8WEirqWhd{+EYf)~a@=TeOSqCgDZeKe;1KeHv;S1$F3%t3$6ssViVjB>yc&f9=GcMRY z!>x#FTAOw}*Y0dGo1Cx0e*%I9n4oo&IBSXBA<9$=avYwP3#!EvBjM)A@7y0m7f3UNp(@Q9L-?jk@MC*ca za)TGEoDh_~W0540;KZk2>x9wZ3(T?WZ*6Lw=F8*8a4U{H1sPIFX336^8PJI#5P5;@E1hu7-Q@pkx!tLSdB2wSzf zyBFmixHW$o47%2X`R=H`T!$6RrYEZd(U;(m=BFpk;-E*~+A?FOJ24Vlm2->Ne>WUE zSK9l?a3p=Rf20haZOOpi%OhCL6rf~@bY-0{ zxcKfP9A-1jZo4ZF;@1!LaT5oohBZp*JEsxN$-o)o0?=5aJv7TqG3Bnupkka9El=*! za+>50^vO2!iG?T|x7?@V=vHy!123AsIi)3!7>nk0Y!lfCU*C+!0m$ui`VOmj%H~d`w$yZxFsI;3Z8v9|2&wx3J1jhEa$ts1jZdApJKqFL^;fH4 z*M%w)tma4khE+iV8R?njIXpXfo!Vg#M@yhEOdc=VU8ESwMI(e3v8}TFL?Eb&|m{K!{Ucg{@(mQf;V3>w2T4#* zAEt+k)eRJ}gfqF}n>*2x>ha&=r4h-=r%=Q%129#WsN~1uk4T2Ppmo(W@Y_Vk*iQ+^ z9f?)c1Q}3cXNmih-lp|p-CAPk5LTOE&2%s~43FZ}fV-Z>M*DIuwcD`MrbDh+5usH$ zr}rU^G|<}zg_VkseUd0|i}<{jP(xu~5bP4aIfH!RYt{1L&(&>;EW5K^r_U?SE$EJ+ zx9g3=39XGM&;+SCDHPU`G_;7()Yk81^HD;p0`70Bod!noMTae_%&!<=RfO2T7ln>A zIojV4Oaw0kW-a@MuOlrT9*q?vuiN;iUli8-O>c(HFT!sAsJ3NzB{y;a4gw6{@^0`F z4J;VGA>saK!$}h2c<;yzY7^=wi6YikE9T>qZ5mnq`Ps3CI-akDVWnf&g}1~+`b*d^ znbBNa#R_>GCTt?JMhzw84}w~JsY3+vn13 zj^9Tp7>-$r9Veq#1~yM|Bps6aPspt!>ZZ-4lq}_IMCEof`-iC{9RvXZP5g57Pm~U~Pt5$1zovU{%mi^zw!`_V;rZ~V3ioY? z7?+xP1upW+&=6%FNUY5oK?aOS@jP*Z2_iI}uMYh!A)95{Uh$NAI%8*xE#0GT48P0`L;pO2L*9U*c z*=IzuX@##EkH^~8Y3B;zD*6yh0~c`zNkfW`!-S${i2cM(S!+TDjs zIi|HnX6Bv3up*wc^6j^nlw#a-8)GqaSca$^#UWzJYJsTF%HkR^O?gE}rfxxUj@|P; z?0R`mn|CGZLgplF*`j`&9rQ^}a9x9+7LACEG<1c91CC%Rl+(u>^IQXJ8i_K>7)pAy zv{Ge>a_a3|EL*DTxPQllq`|3X`~$cUFUbL>0@v_L}9+ z^~Svk=y*7LSu1;imj@*3ztdAAunHDWT#g#OLuUvzQEI)GSmRhVihHUlGPe+zF=(|k;PwrEOd zBvUSPFVblcER<6&Y6=UMv>cejqse}Fu(;*6Cs>+hB<_>y7+O9_He~P=CaPJzA~VGV z$4HT*eb&No5^b}uk7%BU7P$I@PEn3$PX-TOY|WTn^BC5~R9=z}7M`NtqBSGgB(YCf zY=0Pem~>xvr_z2z_wdK0E9v0W>0}hv>BLU&O5&bEvw}e0Y6m=U( zdM^gqaBpy)UkOFrbR&_`y`hx_gQR7sdFa)UX$sPIc(#sC%w~yTvf!n${aMB7%=n7? zHgPt_*ki&$-CFv5Tq38-gCp=0E4hP>9VwzOBb@;QCsYS(NJD}siSnvn;q(Eq6WVsx z)t5I~e}4s}tLC7TU7qw{RylYhI<}f45su60Fs~6@F5G@z2mfZc zPpC~{a?CyV&}glU`lU#rW4wy14PLojJYiWQ-&>PBPMCIOq5sN4(fZfVEo-It5kO>( z-0cP+c5NZy;sk=hGun25?MzXw?2Nl7RTBt5yf?w6X(yOadjZaX;{9 z&eGWy=Dx4J5J{naM2Z=u+ZCTy&ik=?;4n39C#Y1&XrfTYliB&nzt5`j?2v2EUqi?4 zXW5A8Tkl*)@)mmw#GaOhN?fO-Z6VB1Me6m92vF z!H!j>Qb&j6K2qbyI7;y6T&?&-93O)4q?XwY(%nACKdVU3*6fp+*ZnD%JGN)aVkx~T zzYjA=%u@?RcO_F8`;m-TXF$(pDjSa0s9N{wMvXUunti~`5a=1=5N>GPo;@huZ7Blw-Kq0(b4S{JP+f3PgUE{qHl{~6mn+njuxTv9vj zrM}(Cn_6U}Y*#zKYEaaeV(zsk!L&ilA3I(GAe0@cA-Iipk`{NOtO+sT?is4X$I5j? zE;$*+x>C=*(aAq8eQ#DC6rNO`ceN#h_V;!Uj*n*EES8tDFj^?#Z!=Vs6G6jc?@(u7 ze?Fg&i6w|8Y!cQiVJ^AG-pb6P5RGI{88{h8sQh5OCGAV7|}0x%8|ZtpsoZ0Vr^u3RfP?`l_m(qr|C`chpN*<7A4R#7tAsY)7P ze(o8b(g^jk@{#LK8u^+7q^}KsD%{3T<{l1S?rjfE+&{`JMVA4m4lc;eN6{|H+az&> zuF@LU(BH80t5MZ8V$k)fDq~?lCXc8v09z02tRoo~76 z*!*;*C-|lZErNu~3hNchWdjtr!!6(;dV?W#4Wwse6P=XvPTc^Hduzw&G?!7vrH^T( z5qmKj=U!afFIB)dxcR0h%^7iDZ5qmx#e!dRn0^Z3^IIVtOwR_9pM{Uaikq@NC<6?` z&u`ZZBfsL!1A5fL%J>l}tC+JSqqrw{K1H&8b!5oQK=w+@@r8i*bRC_C2{qhw5D^nW zh!pnJ;SX#T`J7tIw(83E#P|;HH8UE@DTnG2zk}{ZMNP)^Vkd_@(K4#MMuINK?J=eU zlhBOH+>fVSq zO<(JrTlS@q^juk4-D=-yk?@AOC02tM87gk`I$m$Fv^XE%ZLXKXcAGor#SEF4h#&S!P5*RR`0exopuGp@Ue$7luUpBn5xa#G?)#Bl@1h7*%(#8 z`>}yaCVLD4wxk;R=Z;JXMMaghD8BB;ocenKfKo)np*y$hF@&$R(_+IJM;r3jXK>7* zb`?;w=F{O|OVbLn>#;dG`}J4DgdiO6c0=KaT%;xc?S<%Cjqhc}6Io&)O=hX&J>b%d z7hT|ZROSj>%aILdsiNht({eHLWm^Qj6>7=>zyV*kOD~Dm!HALNH~JCP*uAlUrPbYP_9W6wc%2qIF+rB7sE#5OZ%Z0|Rs22~}tK1kE1ui5v{9OA)(+fv0bZ)7tE$ z@uwq%n(Mlsv-;-B$a(i}cw=WS{if^DxM;*OMaVx8nF<%3uOOMj*eH%fA*t3Mc&>iq zjUlP}*=}I2-dPOvWB5N@*fF^WG9}?1oiO}yZQR%3y1NuUZ*Vr-b5);kLTm#&cF|iq zo)fp7r&ivhKKUxN--D{x8%1vU=zWeJ`<7wy!n1#NXCBM>Bw$JMJXR4F3Rbjb9!Cr?&_bN`Q^gC5O!ott+R%cPpCO zVs46N7O{2py?O%}>IZ2}+%r9m%EXl#V!A*j9z$VRHwE#ATM-Oo>-l=8De{X6)Pr6% zh8^(2N@_6gtl1dFemr>#EDWl3>d#7O&#YMNJv8NWxcHz>xs!0`$sHUN7ItYhD*L*2Pt zWDaQST>!q7(`_rr+42rMbLH55cUhy|%=fg^aNpLj|9MXzP=XXxx=Qs#iqGpHT8?&7 z6!OQ}G@>JZ=stZ+0hmO~iy6jc5)xy-yB4h$c#NwJ+m1gRCD}9&c@aR6VVoe@Y@t46 zu$#l1e0^Dk7;;|LYA4L9!JR;l#!%=H-0Hpli_WnNRZI`}1|!!3padFbEi5*>se_!- z$;nE`adT69GCE=6*CGl0nhQ6dV>W6;$+$f!4g2eF6UGbKNv`H@Fs^xdkT3uaVNa=y z<<{CN(S#t`tEs0%!+%_h@H5Q(zSOEEb%tFC+wBJX!bNe5n4gt5wt!*{`lEW!Xzjdy z@xgq<826Y?GJ1r(GY_b%zm@p7U+%O9ZC?kiK~3hspk&<9n-G%A4kjGC00X=c;rOY4 z#q0eK7k+LNc$0dDP+S%WPD96u0sZ2)$W+Xfv%Q*fz7F*YD}3(}z?Dpw60k#=j0o`& zl}8FCNN)T)3NO+pjx6sdjB;PVNSYrya*ptQy1s-jLgERQ*32H10+YH8GRaxf>;CS9;>dp6+duUCX~A^mJqr&MvJ39p$&%X_BjC zgVm1gi9G(*d17rKP+5dSL03~s4)W1vON_ACdjP`KEu!-vOZT!TyDGBYVjw;k%tlNm z?H8dtp{pThq&; zQKo;LPJ(;9^zV*G7TzU`xh`CoDoefMcRx{gcs!oR$6TbUKktA8K;p~YV`rJT=4$k+ zsVbUwpc4a|Tj6Q)w$yO!uvcO1SKi}=qMYD1qBDk}1>qI)4@9y+%ADuUy27QkaW4a# zltqU72AoTjDAUYeKxImvoFf`kXKrVhj%EdN`pB06y@+N@;5!{RzE)DBCouxJ*Q z1lz_Frhk_*Zi*!v&zZ7Iahel}8Pf%_N>|E#GG4-ej$AzK>s{Wq z2x3@14@^cA#%E|&chd@$?Gb)r zu!%HgjRkf868>Q`z%hx6tK3pwJ6?|6_x9JKUo>%4d3$0GEp$)B>$2|NZB1;_2Y+Q55ay(j^PTTI%pHkj? z=n<&$@z#9Z7<#~unCY_Kn(pvsd-5@Vd$L*Q1vkGsBIyuM+d$J@^$zr{U0&tHYPr{L zD%MGI&EA}IH|JQ4|I}6qnC$>tzQw`3`do}tmfd$EG;E8GwCovgMP7qicb<>5Ca|Yi z!;&*I%6bY4o{s48a@*eOBJAs0f+y0{?J^VFTk5dcezUk0b3pIZ)y~i|UJu!`R8p)? zI;WD4RbKp6Ogn`x6~gJsOS#4;cy=TVW#iC91+w`UcfM39bZ~9W%sXa`H3~n!SvtsT zOm_F=T&V%EgX^_R>(+v5JBNR`=-$kP2B8)m9eg5?)cv<2w%;@B-of` z(1h*SaZCdov3EU_Ch6wD$#xLg3pMvtWTfdhKEBi!^Wk3L1s&6olVndKi$=Xu8eK&Y z;0J$;w_68rvD3=)bjsH?VIUQ%i5S%UKayDHyqwf_w&gdMH6K3GX^gg zUIv=E-B5e?zwZN{8lIS@qkeY|c&>>&I%FKhPl%pJrLE-`=xqXndUGQjs!GO{P^pvh zk^q71UYX$Kf%=iMR%CPm17mq*YlbT>wQe1-=JDI@vB~3~XtyDNX1JZTe1WFUrDv)H zo(-yrt<7@DHriz~=83Hm8QGiQ4Ehv0@l+o5OhnjvSXNZ)(wTMMZIFlDQ)%| z=!E!pZxd66Rbe=Am6Qo%JjPf)p?UM}YyJolDk#3JqEMp*QY|7e_QQnmH@G!B!z}qa`UmNVmA?Z@k`~PA z@O~4A&a&r0Rr~QkNZw0*275Gdn}+o>3)e-M_x>mwp$#0&e_$TxRxXjHPxDYH@Y!MV zuo?$y1ZqyGA8Q16Rmc=YCr?JN=2smrxRD^Qjmi zXwdWMIHIM4O~0q`yfrS{xqmwu4{n=q4$&UA3xO z&oAYXNy}Zs#_}2RFGSEEp zE`VO_(PKBHgWnTM8=rLf2K5Umfp|(us$Qrf?)V9-+qM#GTN&5pEDD_vMqQRT$t#3M z0(S>~DBWvtRFUv@Hwxq6kHf!M7|3K-BGqJJSWB%22>!0@o?55>^tw)hU_!Dl)^67O z?Gwxtt#*ZJ6O+w#KdH>a2ZY)b==-_JYbh4Ru@x^-4eZJN7^4euUgsgr!OeWwU&~;B zrSGX5;*q<6DkhOPWnvg(4+x<3>Bp>P&_TIK)m^{*3qQw_9GD;AxS2f_(8AB#Ra7S+ z^Y8RCz3bx?Nb|%ta z9y79_M3F+Qe5f5QS)`z-pR@q!7ks5x-@%-pv}*wk)G{|ECA85<*nV@Y+gw*6X!sHE zD5B`3VXZalk#4}ok1L0Drj{A2SK5SRq^5&62d`*K`;ASdfR)bmwJ`>l{zETY_%RE%KV!$b;9cUhOO$ zUfZu!Z+r=-!wEiW<`q6laNnNpk?&mR3d%D3gq^6-*|3m9n11l&{cH=6^gQ3INb!A4 z+nXr7T+b;Q&d*9ni^EUwgWuzym#}Y3oiHR@atrQ2`_s>E8V91=7F0pHV7n=i{nxC) zOd2dvV}#nB>I!Nxzg1Y_hmRUv^dBN|69zn(dun=4(jS}r5%l-f8mXp+x^a6Y{#L|z zROt|?kiT89{X-cs#mCzx+xfsO}H^+UK`i=@#P!c|kTtFDOfRT2Uy{wvGV9PaN`{`EqZ~eI=^PA6nF7A|(5?HQ zkgnEOG+ThTz3I_N$Wh~^R)YN!mJSAT>Ka6D>Rr9oAJ!nYMMsk;yaoBplHy_fg(3yu zuDQsAS2r<)RpnLEC?P-320<@{bl?3PsgFn$k9mIu`-Md?u3G?8VpFR)c+PgBTCdBG zp-a|F7F&;LSaCPSQ4`h}t5>YiRB4cvXeDJ`QaH)4eyf3pw}o4=u-u9TY2?seE!Loo zS<98TW0C%xhcPD7O|GTgnTVA7M^oBMIx%8{Vb1R{#AQM;@q5<^28&hYH8GqdS#drv zG%y`nl=p!!hVds`G)lHVcHnYaf>}FJ_>cGGiQejWF}u9fWVsW%F}#3=gFg?o*VB)d zgU5oGq?Vr60xrCo>+JQO33I$5sMHinfoq90ar8qKk^9v?|^E-ahz(2~neOa1OT#p4KDp|p?ZTL$#XuHFw(=Bw6 ze94Q3l@ng|gxJD18tHFR@AQ1%;m#MXp-WSDUR=-q?Eb{H+3TFMA3Vbn5HO`=mmp=G zy;DlWPRYq4OUXJ|!pOPWW+rb+@za8qVMJ_D47R-d5G?6ViPx`|J%A@AyF|&ID~nnk zGnax5oie{7q&1BbN?Yi@K6P`PyMaC*hirbKKJt~VlHR(sWXK9`7zw_6+Jcz|Ac`D$ zrl7i#W7?7_&~n$CnRjlo=wZRjX1X%%<$a`htos$Q`LZr1;QSC{^4X0#fMNT%D292g z%Fy-I#;5I@UWCw^%pf01h!wUesgvqrsog8Ed8~aM#?`laRds7*Li;J;+tqE~I@V#L z(N#jk{h_+k{=jsZw!dcn@Q^}Vt$uFp)p{DQ+j$?w)zFdBOp~GNzT%D^B77?mg&3Jq zl*=73X#iH#@iTdNu1kpWr=~%(9dbwRh6FeNBJ>tWO~z}!tPmUDVCTfaR;RtNHuFmD zWUD!2&BsIIBNPE6*P)TA_+>hG#YJT5o*<5{Z5EenF>#0fjwhtVs)nhPi;GiR<-?TF z zk;~TA673(NkVaj(KBc!w@05^onf3r){p@)dSXW+z5Lp53b?WLjJ5O4}&eE6r=G3#l zy9na&jq-~fNu=eZP^F3@M#1VeV%Q;f01*?feWPUTUCiQz{OtlxQ)i&@(#7sf8_RFn z_zl(qN&8!`sG8}DRNz9@oyZ(9k0j>gd*tGkRe2Q9bZcMCsT=#ykBxk8cCY4Gdpwh0 zy*~CL>-Yx0fm$;?pN@TKAG7GRipAf5#Ct~Cv$1(>jow@A%?Hzd978^HCH=@W`nU%) z=`da;>@~y%Ys6noaF$BJ1F^cNy>H*x^%%cTvmR3HCGw~F(nf>cj$+TE&m+X8ZH>5w zj_*JJ5geh<&LG^&-3>MYy%*rG^(k7ws@ z*_b@N#vePW%*V5wbBnJ{$8pss)61p$TJkZ175bmw=WhhQp5(Ib+)Sf5pivxQ6zlO6_a z7r&o1Wltfm8fboXwM*@ zalz;j)vkuSndmtIF_CJE`<2E-gZiOYt@q>xMD!(Jvbu1Sx=WwA z+IJPe(23K1LI1ChdzPLb+7YUrTh|UD7TbSc@KLI|%C=5xH=IrpE}O*9w5la8YxEcv zeV4%MfIM-lweSDZN}B#iA|}#o+Oyfopn2|)Z#cSB_!yEau@Ar{XjGwJSbJMrd(RH* zAS%aCl37VG!#y5G2!6MZW&nf_F#W~qK{Oc_V4Mvrb7rR zaD`}!x$m4bqEVR%Kr?fL zq~QKRCFhO|PIXCZy;8|fbQPb;0^ECu@y=7uu3o+kH$<#({Lu|yC37Xi_2_&M#UP_vB*vzllRG-w1(FRoe6UqPn$t=7S42cMJGFvl+IRP=vyce0b_H5T?##eWt=$YhyyWe?nneKNYaUvqieyUY8aa+3$I)Ln>|D*~Jl z<4Ewq^?;t%9c#%ZRkJOfdR#GGrmDn)lZPgl@3BQD-x5QuuO@^qO-Ns^AG7mEQ3$gEkR)fL~Y3alDY;Pl&n}w-3HeGCb3d2QZUKx?qr>rf; z#Mg1qkMigkZBD4a+RR%=l<)8--dW2Ay=cvslI70vs?8_vtv%oGOZ za4iqRHSUYxDXJ{^+AIq+nny0%+*4Va-JLEbOgR(EEVz*Kn7CJIWsW$3PvO~GMqkz{ZqoU~wYPiMoO9t$Le-2q60_uwD`;<&V<9s)7P^2IFSOJ!r$Yj5Ci>kRS? zPk+I@I?EQ?J*F!&@WN_3l@|$AMNNKAHmq#klK$c#K#A762^-MdahNGs8T4H5k4hfJ zRWPh_TyaB(Dt@~o)m@mw-E$A4opDDRKp5)UbktNSHf;wal=;EX)RVithHKI5U~dv5 zEML6jw9DXf&g^HeIX?T}A-YbjHweU^tM5+J@7g2bmDlz3R~UO)12l!)NlQ-yRiGMp zl-KgM(YRCBbT&Tc8~|79hF07`a5K_oQXg^~Jc#OAq%MpdrgVS?BsR+;jG5TP5jf3Ffl+ zOXvV|59xBeeytPE*WLESN^7lfpZl;gQiB5O_KeD~>}Xn}3brqixTGo$F-0t~XP>gN zT4z2ra&~LS;HK_HtZg-6rY82HZlf}7Xl+%L`{MrxHbBY0^g>0um3@>UI$m$`q@GtQ z1M9?AoyS`1oT4wqQ?;v&4Oc}-Q&;G8d4V-+oJ|s{&pAoYoorN2Zr8bEvpfk5a3?-Y zAI${6CN&fE53C?}^pxyAdgGKG(F;;M;gVBvDN!bDDU};%#^hwAisVc@kz`Ra(m-wx zJt1h6gu9)UP&0G%Op)o2rtX0>y|#;ZnEX8+yPizK!%|4zxD{v(VOnH{7RazY4>epT zd1OjsQbH@v*pgIaMb-=PWg=C<7$xkuwZKq3!ZyaZ8cC_?Ak{6+n+1 zmLiOwlFjG_tUCf&5sQsb!!4BSLZ5VJqMxA3>T#5y^<*ZZxi;_VGUc$qbH}N*RA{lvE1e=RDr0^|+ z#V_zaUX*15k|^*dRgjHdNsQKpBuO^&gg1g&<|8)IA{Z4_wDLx?QRK}wg8~k_0gR%- z!21=oPOg(gFew&dm54>b8b#5-%Rxn`afpHdykO;9+a*b~ldwUwN-}mxCW6gsuuBKe zkVS#;icx|VmGBm@124I|FmJqhwX%+;tfp`IU;A?pxf<$~aij@!p=HeBri%52Z z(IbfxAr`ZX7wZg)*&*8ea#SUvNhYFC#Dp$`wZSR!ga}3=0U)mL5qS%a69J<{OlDOE zdPN?VEh@cyHw%O|9)}U+7Re@yM6BU!MIL)5D#T=v4M6|dWJLk1LvTy7065%6SrkR1 zS(d~GUM9TYAr78*S`<5PHu4T)^Ei&abT_Z^P6=eAohOQ5l4Lqn1l%^!Y&1zC!Nnx< zHltOr5S%-r5`mZ1IwIKZaFU{s_B=R1F@tQ7B!fykfMDSPy9Ggt;Lsauc+n&xc#Dcc z0B~Fhh>`$;T@s82A{qtBsPd9klpPj>T`;&MBG54sJ+@lWV6<3_B3Ny_{0WR%2+B>9cFnbADN)m$rx zZh^K{V75zTOrBBf^dB6bv=IksuT! z1R$;iU*co2wurxSoZ5~0cGcYX$_X)RjEu)*_yl>)+xFJ&x>C-p>!#W5+N<9Y z@4d=sbCm8C{)owA7cyDrBbz<}wg#xCq>Bz`7e*HohSN$zcUDmP=PuJN< zy@b*sDF06J4cCc&fupFumKV5D`cW=wLjNOKW@P61@ozL&W^++96mL%Dq4c+i^!HUF z$9R+;xng#XD*m!>M0JQ)IT|#TS(`h-shUbZ{v>kE!f%@DHMQtthUPfc2XDe(>YEZ{ zb}8A+Q8~pn_MMWdF$lTKHlQNz5c~eX#Op{xzZ}2`rEjXxYis&Z^q~`2_6OX?J{Zzj zb}-bpQRMPPP7CVnlVRGmVH^Ug0Fv+9s2c;{SZxz$A;%dBWfi!`z6fMwCs3Kul%dKw za{1#$x(zEE1|{_Ipcz@L$ZHS4Id@^F%O485OM5_j;4V5qrH=sJ1?OOZ>NA@g>3tMS z1Lt5S_64niFU~A-@qd^+Um!6d7d6O5bI}y6ZkB@9EvmX4BFF5TJGdF#Ol}Uhl3UNX z;*>zK>)eDaB0@0v*Q-n1xbj!5nF$9b-@^oMF)t~lAj=;)fB%Z@S4;g@%%0mP3gbU_ zt@JJ1fAjujeM;$b*Q2_fJbraanv@T1U$OuEN0y6yb7x=CFI}w*3lfCFN|;-$6h5Gdlcr2mJ|5RM#**QStS6R~}q>`hTvx z;;Pka*J8=zy(OEIl+Rqp?*9-jxU|j)Pylo zE%X=&K_cylINahtJLhjbp5HpZ6aJYio4Shoa@yP4yW|JjyRQ7&Gp@Vt489ibED3S# zn5V6TFE+&BPHjg_-*%uR%P4b8xeeS_?h0-{ciWh)e-Rjuk?nB|Ik%RUI>XtMOpuky zG=|x?W7yR$!?vkVZE4aegE6CH`|iGZ^*WQhX~n*SE9V(4d-hn2^Hv_*w_=kl zHnp67;O>1ZH_4dNa54F+)nT{f10wG~zM-{a`G#|sB=lG7@{ZQTl5;ocFR%`Utf%>S ztB82guZGA7?wG^WyuDTM@k9CIzrI3DL_Z{b+NG{&#GXTxZ*QLfGuj7lPp?|K>Z*Y| z(yJOQ#>I<`mWEa7I|gQ7m^f`!>W;zo86fn*UW1&oN20D=hWRfz3j1W@kAyWD@XDU?i4Dj{SYjDa{@DC8QM1+f1&+?d|vy7_8I7+x;*r26~HwPjs8o>>psTU7EbIF zuNJRnR+(L8ttj1sMoFN(q~!pmFC2{d-4oJ_S3kJxrgKOCx#P8m9=wd4sdU>dO7W4? z&f9u$fH(B6$gS!vKI045$7|t!rN?eowDWo|U9q;C%s=-NyB<83H(d7Vhkm!C_=sY* zcPr$q!9!aw7#RI$@2cF2UNXNXULUN}&cnDK1@7-&yW&zTY|}V-II1f>U;nlTlYwL3 zjTzIgcO=U!uZg;#;w0Z11^OW%j?d>^iuNa^-KO8b<#D)q9BwUNrJ;*q$Jp&0&xXIo z-^e~nl()`MpjL5}73`05y2S>VM+9 z)i-O$@{JBlctA1ya=wX+^l$o1MpKKUBluo87wkgSpY|?ScLAd6k za)Hk-`!)q@yFCn>yqR!;1RLeAP zZQZQd$(bt`cC2j8)^=&%(Z|f{RQb!#Ij8B7MzbR}aGiFcc1!npEP`a)^?eHEA> z5E#>yNiw>TR;s;W1FC$&4z|kW03WLQf(pZam;wmJo6}ic>c?BMxke?aB&IO@0h9cL z@A|#%`)>rHV^`lLipeUPS6MsKYxi6_Z*E`TFXnHV6?+>#B{zB7V~dt8UUt=`%Ws=$ zGf=wmJX^pfMy9v)%wC-9ADrH{JWTRq-`vYZrk}n3sr+@SIT~MfRhP34Y0CRL*Uz4{ zcJbV~J+4-N%?U1%zGQQDMx?df>Gn3-%?7LG!uCKsHjRXr#0@iJQMaeg*VR35)#Cap zzUVph)=7=G>4s@ppE|O#*DdJ-;&GS0#-sOE?{TX>WHvz1@_MpkpPQlSJ*sDHcLaLYENxz%vX zxmL33#epl3)}NkOEZKO2RdU;W@g@D+E;{(cuH9YT9=oGfTjOz^}1 zuzzBGC+j?x?dUNn;wty}7>%1c?xUxyc2jbf$sUMQw5(!V5bmfrwJ|4eoh(PQ3u7U^g09FvhQlnW z*h8Qj5hd-ZN)9s?#8Z7){Su<|^-CS4q~FdC00Yso9XCTU3-p0cu6Z;@m$XM zw81kMhQE@SdEnhcm;T_|Swq+CpS$J3pgAbFOI}y^x=;M(GkZVx&YJGXt}`0`Z*%Vf zA4hTbjql91>t*+v?xfT8Q$1Na-JQBl#g^qNcN-g7*v6I%xMPFcVH=E1GX{)lu^Bd2)ZIb^@v#%vMgOaynb(GPq9+38qe!&#@{i%qyEt z{B6RvCs*~K*l}L@^r>1iqhdK@&8zp_eBZuRO}KKFNOkiZ+Y+1cDSR2pOF)v~W%E6c z1nWTXzh>WgX?K0!wkz6~-{E3ax(cIJY?*)ft-CM3|C4!5p3U=$tJ~JknpiC@S$3N& zJyQ9(C03-@gsBx+w&5`@4NlduI+cLqiLV)zT$GIy>0BN;Qx{J%3}HgWvHQVr3`a&~ zjb((z(~X31_#>6Hck!(b+j$rF$6Q9P+E^+2j0GyC^rw$+S@EDNVE$y@1>r^Uan=>* zx36k((QiDkMXCr^bWH822(`C`BGsHhsb=@>lO`W{Ys%d_ap_M}IO&^8)Cb(_7gn}; zbdd3AJVsA}&m9Dl_-WwBm$1zR9pLz~OKWHK_gD2Dn7Q*xXUetZf$rJu>$}I-G&+6p z#tEAa-4NnbtWFi5x_IZq4{Yhf5kln789oYmz9^(B(Hy)M%@MUB1r|f_+r~uQEs(BF zhb-Wb<0$Rsy*Ry&9B1*2>n5#+=?&zV>~x5BEQ+K*+(Z%FMD!Y^s=(+ID~;8h(H-qy zH#^$3ac8`7b#H8|yLol{`OB^2;)}u;%-aJ_?AzBhE!5r~a!2Cvi2Ir&(tkHzx~;d# z?@HW#)08;FsbGoo=C^)&buY6f(@I_Dpxak~nn&Ydpw3s<+tj(b*;x?jrSELow{zx! zzN-HIS+$qK*6EdZ&!4n$LSw7XUK6Tm?pj(uaM>PH)%c4#nkU82ueQQj?Ha4Wp6&+oO_}@SR?FH~F>ZtgwO9qwk_nwFZ;j%lB_9%lJt2r%p$6$&MtO9@X+UOo?Woxf zbG#-t+%&aJi*2rDQ+FQTIkik)z_L|`PbKh}#3T-X9I$^&tT8+WJx=t20|x1Sls1!fLogOlF&Ije;uujhE)rrV`aH5O zf}~iR!6ip3HATneYi0g(Ihg>1qzn-pge1m6NCFZ^BFcgP^0jd)0WpS%Hp@1ghFic^ zkKBWpc>aCF499c=#+ke_%V39A0OO?0^0RO{Pp0sJ^mB*j>J(8_*iGU@{g@+jwA?WO z`%(#!y(pD{eKMVRRu*6qrv|j5i|IR+7y+SxW!EGl5Wb|V{y{LYzI;iybk!nNTX}QTibR)ab9tL;q4c1q z<>FaW*<{;dx?$)866tTR4*Y9rSygp)RoS*b2f^Iw2gA~-IA2xd69ivT6(9f9R(50S zwEkZ5&L2f%{Th--Se{1Qu*hM{IJS~_J4h@R#yb}bRlsfbl9WwwzVswm3|7pBGncLS z(K68TlWTj!Y7(o;w!0^QJ5*0rMb*lYClLvH#npr(7tlI}?tTrl)*>IEpQ+%i7w z45!`(*Ml#{jXUTXS6BSk;amWTm%Spr zf5$`8Z!hA3V!ujn;Je@4(*Nv%88Z$%+rQ+A3H$TB7Q0si@y0tq;VX2Z^n&#ME0^7{ zS5=@mpoFT${pj@9&{bXS2lBicmtVN{vR6s4{XUsMCQ(W1R|)jB)BtK$T+)-fDluzsBze*lSo0(6e;V z#G#W6ssOq`ZBZ(T6;X?BrFNj3D$vc%5IqJxYxJq8RAZdF^E6eC>Jp@~cp!3YHDAXT+0O7|gHi8*xS^S`Zj`*(YYKmBEw+AY%&wwY>QHLe5bW;xBCK zHJEyCJ76+Yz$N5JN(LW->GQ6>R`h;%rB}QbBW{5;V9FQQ0U2osrYWP3f}QqCox?8e zW~VkyJy6m!wP}M+KI28Q*esuylurG*sOVk5J&A8}-51gmnQ=kJ1+(D!k3vE$k_$0x zJ|C44^L&G|01eU)3I+&4%BgX1& zqkzP|0C#{7!5vKE>QDBsdvQ`t-@+NKYXY3&>Q8|1$**(ZVrJtQ*kTWZ;IU&l`wSWr z(b%>uzZTg#)CTZdI13^JI6D>t5{>Bv(ks%x?p)P(f!9-55t%mmR-n4`&eRVu2E)m7 zAT_WJ-wUDPIwsNo*z%c2>gr~j#A21M|FM@I`*8m!=YVZE_072v8@6qI9gPp*G(~Sm zW0+g^QOnMmn8?bGn{;9T8YO5y`sC@&f;#oSwun&~jm-1XDn=n_1@X8fcJ>&! zM!|^mZ%wvS+X^6CXrN0j1ZusFuGa|#MukeMUIO!ZO6Cl=6(fbvZ4Qqlj2?3zacX;q z6Md8;aWsu|$WwJCa_VBAL=kKCm|Ih7p}b8J983BjMi(rp%TIeuCNpP`u~j=InYkA4 zO-`vz*5zcAB+~S!Qw!2^Q6~H!qwpA`HL?X3tCU>EO@<@wz=%yUnaMZ@Q3}r**j)z9 z0S`}ZM<A*)YFa zqt=R`k~$6M{PY^29lX~KQdC(*84innE_Jg1$dP_5!qiNgRs%cL0j;PCg(fwre4Nq9 z`BY7l^4CKlm8fOmQ^0st&y9aQ0O1=;AY6ilQYPzjQcyM|LB)`6=9c|T?ooy$cQz-y zc{qU!@odmYvc*0LDS??JQ^e8>lc)|9D3{)XRL&7qSHhq*vmVa{3GC(o1HhHVvrS!u z&YzPa?|eXZVPLnDR*&X`zN}nHcxwz)3AKp$ZAqHC>{rFfm}pAJ`DG^JxwM9(#1;@U z;po3C&IZ<+Nun5ebD2LJYab!11B8R3U0hR(%T=><^1%4D`wr||JHAs@s!C|z*Cx=i zGqIwwv5BcFD5%u7hD<%ZJ*H5rwz8n0ifL-BT(RJWr+)g>4GU;ul@8UQySb*+PTW4d zvU2+Ni5E^+SEz5j;f7n$V)})*udkl6v8FKUcR2jDMOIs=rlPjCq9$as7S-Z?(ZZUI zQ>xeBzVz7owzl=h$oMbg{if`s|q06`+|laVe#AF2iVuR`ZxcE~tJu@s>@187Oi?pfH%3~nLeQHqdU zTv1q`(U3= z0DZ&ux?;oSAD@= zFkx@Os>80jo;uf*{wZWRz7YUMrReN$@T;X{I>hCV#J#`c(gO!B?c8~I<3fFH=ZmIg z%{}YZ^)xRtz1ULR-(TDkKfG!|Q5pWY%Ze6Y{EggJ=N6But+=*K)Gyq4cqje)bg)Y{ zhh1)qsX0k6hSVRUiE;TbsY;p-mAJ&n7lGcTD=OzH5PO;Y_HatFSw2D}iJELmM_0WJ zaedD_0XwHMHhFPMfV=o4P@F7w<8^P7QN`H<@7#lT)pw!Rq2+*#c*_#AwE5_J?;YK1 z`u#xy(c$zVDNc|sCYH@Z0^0C7A?7kW_c}IM~;r4Gd1p9>2R_<7*EUd9`bfc1%X@c=%|yHkKlvl66<>6@t$wL z;Hkr_PEo54^YQnN#`iA5sGHdEa+Dr7uue*(lIYQl67?e&ZX-B|*~4-e?Uhu!ECKM@ z3|qMyk#1s<@mq$kv)MDf`Mj`Q^@Nb1zAGQ10cZ74WIq}jPVU8_hio#HK%c_USGeQT zYV>hH8Md~M1SbxRT>qAEc|bH`)2_WI19FZoo8i(cp{ml@yu%#1k&%ww?9A@QEUrN? zMtlM$Qc4lOOa_T2vp$68Tr$7oh|H}jjr40x5uVjg$r;269HUTISOWU8uCOn&YpFvt zg{OHbQKSL&8kN*Pl*o%uc!5mpraa92(SEZ>sGm`PGtG)!IgD^Bw|+Wroj$|<)BhLGhiBM7 zyv!hRDuL@pfU~H4=J~;FP5(K%;(7a0{~TlIKmQM&DE;%SCHwA13`jaC3uJkr&)A}P zmT%@M>QB^H|M$O=|4A>+4pn*mwE$!|4!n`!kyXtgY#xoNA9iOolK&&U`}_93(^#`b zBb$sD3^IrE%9BXnFVi}+5KnYe z_Csf2 zV}<-LHLBEc84TPt>OOcChOj#)~X?ZxcahJn+Xc+XZU}Fz!PCkY1%zy1>AoE9p|$5;g@|4uS!f5^HvGSA&U0700
    V$fDV|Iw z-#ZH8@kAo&8X6qN(~8+vauls2VmxK&6M~O83OR_xEJ{?4GZ$vqTJvKqld>-g({5yZ zQg}d+aKr=sA0y&0N0jUP@W+l-E-5LOEh#@sE>(PF$z%fAxLms77r=&*IN+7kRQjJx z7)f!ZSVPr=oSQMt$IFbh6K+)1sO%~!q*8%5&`OO;C2axw!GSS%A17;M5BiZ$*&=OG zjlEmuazo|%&rG?fTpW)wL%EL1HO5Xj3qM@G?|$?Ia#QdID%V)M;Z(V-WNSazpDuAo zHTG^?uBp_uOqiK9ti6udyQbH z7slF&%5}!-jR)gpd5^eM8FuGfZ$cd@efF?^Lw`DUW0CO< z^$j>Hd(ZFP3C{Gk$vvk6Efc0^$@ly>ULd&WOz#BWvl88NW3HUvv+?Q5Gc;$~uPn=r zRWhFHXdVQUGplXawtz_97=lfQ!*~!=X3>XZ6lF>zFbX>YGXRsEBW)b6aADX4IvG0s5>sZmuo|SX_=VFgY zV_N(u-2z%#Zmb-B-g06b7?drNJw-C{joCo5W2p0LD$Jl_=S=P&;L@j0r`WK(^o0Q(Z3C5IKRtzxnfznlS04*>PKd z>}{z%K={em^tQxucw7^D?Ay>{)pXE~wjeP=5t?Q8z zJ?pT`p3G+PRfp?J27A`gi8CC4alCt74@_cLKbiUtuR_AFeEJyssWHo~gL!HWlJ&?u zollK)_7iAoRKeEufCMi084fVXRD5KK0V(kr_EUKnv`I=y8L5J-C%uhWn$t$pYh7_C+bU;?Rl}hhR*GXFEt3B#)5( zI<$56?5(qlZAhas}%!{evS#;{97qv0-Eui-TYy^&?TElbwldixSgj4M$h z))~UC;YHID_Z_%umAmCCM|jOW zt8cvfroAigSsiv<1^RntcXrMm{<-ADmk&V zWm(&{*FHTubN;5~(`S2KGp8-zG;hYh@bAcq-$Htv!(Yi+M_ZYJ38~(xc+P!{iD^fX zG7Um4Gl;XlK&=eOhgz6``+}(79T{0Lq^PnvHmCe@5s$ak z!hIDvl`L6km;NY3n0U#e0uT^RU5#y{G7cjyG@vRDvh^Y959NnCP9?MDMw(nQdY(lO z&-a!WOE=pL-il(d+VaFet}4esV`TgfTN;+Ydf_?YzD^QH9u}La9 z7DndQ0+W{?`&1hG^w@H=1k9($J{U>n{_>?a-E=9s0lH1k(xp9io1qH4nn%u+lJI5A zbGJdm^N8{8(0tBLH?11J8i!l&grw2-qYI=-Jp zgc%W^kp~N ziT?%F2@MCR93o!O(W+_qW?c5UGb{)RpTQsdsj(kgSKrtF9SVzwIBJVf# z#i(7<7#ryYkQeFy(f~QnfOBgx1=|pL5RHFj5jvi>%~_~2YA%+}GO<0pk>nZ>+ygMe z1(^2qWitP8peU0?#)y%y)l4=V8r%~P?4Q}X?Ec>4AAEH(cEQqEtgxbf>#2*pMZ^hK z-GKuht5K;_cj<$>2QZ-zBD#qr}X9&8x&Y(lUL_<7S3-_Dnvj0z-uy>HwRi` z;yMj$5KK6)DN}bA_24q9hMGWaz~3Rqo1-H6MeD%`8Y-2jIn1O|Rx_#>I*96Ow*3EU z7CL_7#g`v{=*_q3kN$qMNo4D^HDbtK;jOS(?c(wit3^{;_15DL?5}j+bn2o1QCmS< z(s1E3ec;jO6_-4_R;qh?Q{^D1qzgG4FLG*zq5s?vQF14Zkbice;<+;L+5fB|u`LP7 zCB$Cf!+Bw&>;)FnNEa;Z9?O8BVk!mQ5b=)Ec+@H#+iD_J=4BP)K3sYFMt&CaDS3W9 zl8pFK<}`~*iDq<6n1(?DF!c49#e^%zvaYG%c&Oq)?3(P@AR0f*a-ILVBjfJ9k> z&LfN4MWsP$qbPD(PkE$}Q zgaZjPAVo0&5|Y40)(M!q0g&!!cOGp7ElnEmm2~r5)?zhUrB z#C+q}A(=C#2oQspoH&&k=gfHQLt-%-N$&tIqNU3J;nT9pT3Z1JJNG4KRn#Jtw6-F> zh%Sq@O(_c+$)=55!aPkD6UlF1?Sca7ypWzI=0>EC_5EEdiwd)N@_EbMAC0LZECcbta4B*30Mi_35;wu$smZ4!_cUJqxWN& zdGJRPn1N=yj zna!UAqhqGy#==7BGr?;HJ+o7{d@g;S1`7fL+9y4l#sdP=%<#Ir+oZmfZw+oaO{s0! z2Lk13iu46Q7U8^P<3V!%z*Y}PcMt(q3aj>f*SQtx0QP*Y6Xq<9xbaF0ONY@-aQl8G8fq3#At70 zlfz=2U0^Ksi*yHgGSUuv9X@EGNz+Ik6W~OVE!q%TF@mAtEj7 z)ImCs&QZ_5y|WMm@n#Sd0zdY~`hjZ@AH+Wlmm(+91n>=yS`;g>t0@o04e^`37`?!Y zA(7mXut<9&ZUX2Kj?Q%hOy&&*WwslVYZH#pmw$8Arl4u1N`Jc~C7yp~ zKQLVl&1es;D7XfI9Z$amKTb(BQ#EZ#XL>iP(}eF+C-%&BqQ7UIK1oRoJ-kjmYc9TO{L*EUm~&L=53e{X!RQ*b zuk2{(4EB)v0Hkm2VrBe1%8%pDE!gxzdO(28UD!IB06i&6dX)Q0uPzu$1R7FQpw)oZ zX|ztGb%GnnL_CuVhp38D4_Y#4DcktoA>(JijQK^-z%f3q*~9CgjAot9r6%;_^4wVk zJV8&yh%rB~aElYNGYQy)G6@sNn6bqWV~5DZKu9TAFuk<9veSRD3s}^iUHzfv+1^s` zni;b%ar&Jhf6wB>O21MIAcVz!`taf&e+ccrWKPc-bk^+V_=i=1Wr59GQE92K?kS(S z5Ii{pAKD%~5@eC6p^DV|J1e_Or!QDIv%IIe-cniNwLu0#02pe-rRkE?N1P*`mX^hs z1mUv_lkbn>%~{fQ5;Pv5@YhJJ>y#_Kj%NWEnFU-HCL#Ud4+K^*ZDRn`AEZBElK}yZ zL@TGMlhQXQam*|oPrNHVW7{hSNA9(Ou6N}jLdK&cs6WdkYVXODdm;YC5wS>?*+^nk zJMe6dZkR2O63CJ7JZkj3LXN6Hkk7|(u$cTn26YGe3vpTnvr@X{s_m3i=t?`j z1zw^%;2K_%jcu0slRR=P1NtsSqe;gS(#tHiIun=TTYCSV>{z;g)6R%NQ>ZaSc5d3g zv_lSRfpM5Pb$#okr|Cyi)Z7R5Y@gX}=Q)nIchB6u=YhHMK$y!rPvc#9@px!;8{Pg9 z5e}obM`Zb=g}dw;YEd+qe1|^29Aphm<<>D_$9IHrG11$OS@h%u+JhvvBybT>5F*p% ztxr2e+)yme{vqsn^6wPVZZwf|2a&8dB^ML!Ps3FDLpVK2=Ag=yI~KvY_36(V=aOZE zn%(H2pTOThIU1b)kw&3mXeqANou<~_AWwEXmbx0(bv2t9V~Ig)HELL~u5D#qLGRvP z9SG^vAW1XmDpr2yeNxh(MkGS&MRpCBKNj_22h#u%PJ!)~$7XCW zL7kM~l^S(i%g&Mhm-GqE>6CG!W>94S+xmJ=g4ux8nHX701&ME^n;-A#lddqR1{o!O zX(muG2PosB2_$sTv|+|it`oETM6b&_2B6(yG>AG2TDs96?Iw8L-0Sy9k3FU>bksfY zlJwY1(tqLKTbZE?f85wq22Z6}I$q~;4|UPc;6Kncqr3ZO!((0WfJ6CX(ORTcWw7@- zl0lO1-l4BuE{f92AS{Z@u@=`Lir`mbExdAsCG%Q*6ok=vwIaTvK|UG2eMY=^`T6M4 z!8E|WRhb5}&woCA89h$E9l9+DOD~gx&=W>JAD0RjO)lok=sbMIxtO z8^lSzhmrKK80uLVV#h18;fP;!2Z5Vr{md%E&^1+XndSNCw2xT8Dh8~mNp06lb!;M$ z`f2JH^sz@$AHN@oTqAwF3@nAN6X31ymfU?e>A#xOaqhpfe$)QO>AJE37ndUhPM}`uYejXyYa5Oz${SuvvgY-c$tG_PTsdF zk3&^}L#-4Xg{$iX);v`?Pw6y=GoEZ?3y5XFcj=@&DlIoD7_I93Ez)|aR$9O1e5H<2 zn9zvXXHh8h%R0WgSr)DvCLDhA@Pr0=^PJOM{MPT1`EA=#0-)U;#aGJ|Lmk1&Qnl zI)e{3N<(DN6)&BrD69u#`x036I!_L$)Sx&&`cclp_k0K@YJmwI7l8Vm+q6cL z_BK%b(T|t2K&2vk`PZd;UeXFGCH?Zqn8=*p&M|_~gAC<_Y>4O*qgWpv!(mj#ZkNko zFzQD!0i%VyvxYFj>-k${Qy z%W5$pMWHG6ob()630I*38FQ(m4x@2nDj|CO!)o9AYrjc2^X2mkQ|JjLE+veX6!ZTa6wFkXmk?^G3vr0Uda-lLrS8X zN=dsBJyJ^Q)B{?jlBGo5&|Q;U61p!)6bJk;p-$>d;&55OmnRE=U``eo^%)+A%hR)a z<$tEd0W1?O&wq=b!sTgM0G%VBe49vLng2d><35K*c60ijT6r9JP9PCT`zdK7NRu<^ zN5{e4bfmVf54@o>O79xAIwSBJrBl!)4W|2DcI8s=+sP9bQeF2W4O~+R9Tycg0DF$Q%!kCfSE&_L-`dDrV zXgMf2G}_>ZZr=xx5)mvd!sn5eL+6RC5tikbBv%eU&Tm#`2Av|{(Xq0LA{GroOl~Z1 zjVurSDdzmM5D38z_8|e9G#Cwfk(gXTzmi`jB7f5VL}ltjBa+p^>4A>-dZ=Jlqz=Tgt5J%u zcq5^kxJX$H+#w6$sGyuxUd4uHf(ym8Vh1DrnwQq7Sw<_`9OwmzA4_+)F2)Vi4(SeD zs3jfXg2CmB)Jl#nr!88B(VGe!#k!p@)POe)N)>Hm9g>Zv!Haq%A=sdxmUfJLahKpL zE;Jh$R;$(g?Wo3#X=gZ=Wf=(AcSY@btyn)!&~4BOZve`Qp07QMU9x~?Xc{KgX*9YG zc7LZvqhF`iZ{ANc=t2Nlo=@xJ^bl%~)?DQ5a7(_7%z~YNI7JKdhmjB*cLp5Un6c#0 zL#W9+b%Ln9U@@-g;;(=9%weP=tWavTDz>bza!x;}Cdp#2f*%OFyU~lhUb+FFc^GxE zU7~i6PWa2QKkrZ!sCKCVRI-J>-YIVjx;9x-RPaQWMpt1;4NvU;~*8x z1_;Np0!$zyhlkx6Ezx4d-kIHk?tbf=58elSI+eowOM_B+1>*s z4Y+7D`TjntG9E+PVA*n=aPSG!W72H~LC}D;FDbRVwBp>Ef({*6FKVyA=c3i-Spoqf zM4|@aS*P6IG%-OMS|r=uWRar=BSs_jRV3?ZTn%TsnK{?tOdMSJ5b6{p4-vTJH`rMy^M_!_;fJuUGg;ty+==!xHY&RGTf;2BM z&o;!d`k?Lyr{h|ehz z_>>fs21z>wXtcc;^$gJ~T1?j3s2Fow-Ql1Y??6hByhGLzY0_h8FD)}+)7jGI#zQ*u zUfklarG=-n1_vJd=i!W_lK}vmywW=^aM#t|3E=3oyJw(1Yu(b@1dsf!dwAPX8~>x% z??X$q5e~eD>+^{FI=r}O0jp9O_S@O>z={ia+fEz51YC4JYu|5Bsn~^U@hLZW9!F!w z98iwbX9hEtJ(Nf!Qb?7S-a;E_*YQNcg?ee~h|LE3(XUPg`-!YATb99my;ftBj(~of z{HxLGrTfz-VEwl4G{t;~+A&N`Bsf79Oyr_tc(XU+37Wk|5BiK^ND4BB170HzO0?F* zB4KkhjDDOnT^nLN1UR&&g~J&>l-(vw6kjM_Tca>= zD(#fDZ^qrX%`CZX`epsiuRANcn&#I`S11|+oz-ojYNyy$;A^VsE^p)6Mo)W1W56fS zi6^HN9=^J3&4elobNUn*qE3US!r%}9#hv#6F!VM2YKSjxydZU_ug+JX;h^*|pjnN< z?g@c!++nv>#Q`9_jHU;L&RQJG^CKALoXBAr(r9w_yD?%D5;wEp4VdGjNTO%ffVvu* z8XC-CGhno)1W4&?q!(&rSuKk>QH{Twb7GmF>Dgz7nE+##Y9Om-0bOqO;xiN#mDO{a z;&yNtjonAJQ!`OJgfWGYmq(KfkTH=mYLPsd5N(OYgj~^9fTN@x`7mCJVUfA-#}hS}vX4o9p^|=%qaLIrwy-5hTnY|h=}bKh)@ziQ+)X2VxE02v z>p8tzr!;@_hBP?2>Yr7UrS~R$aQ6pH{~xOij0t!&r<@r;CWB~V`*2;q8xXGe=sai? zlu8=V8~?T-^_fCYLkPFfm#i7e|-~(vx$AJ`>H-&AV-&oty-B~js^@B51`ZIf7&*t$h zA)64?8~lOU7aE{>M#ZWt4_>tG9;Z}(AAr0RSd4?PR3Hf#Wo@;26>(FzT7pGj??M%6t=BAat{Kl?a0qI%-ln&W%a z{k8o1{qigg!K5pH>cO#UKQywMYZJ) z{myNza7}5hYp(aN8$SgWJM85E`0eoW0zZTs;`7`>lfNuj(PR?M#Wf{OPFr9~g@?15 zbQ`EFzk8hIi#gJmh}oAnQZx5k%tXtDRvg?ypoK9>F_h_+(@lcgqmjm3Z{&|Rov9&K z#=!b%(%%_{jur$HQ0m=P-66YZDpd1IrCo4$R`=Tqd;z<6+thh?v>T`Ru821%gLsJ`V zocWO;i2g-b^p|$dh0|tvBb$!>L8oA`5L*w-rVN`68W2f9YZ368P3Y{}Xf5Vm!U-2O zpq9|*xm^S)Gz~=QBK-`B?R?NnfGN#kOvp-Nu#m(g8{{yEhA~|ZZ@L_#40E>>84U(w z(bMhispoqpO#?sf2>RVht{niK$pTt=O{v%2(c$uyYWP!-);J=yMP^gca)mhWtE5k)Pp_(IQ<+Svw(|Wju)iFwr?lry4o9XbT)bC33AoKg)nSL(>V|1KZj| zwdS%?ANcgHk}~s?$|9XbC@s|Y=AakkpAQs9F;&Z z+%}884m4i=4ULz%{;`l+O6{QbQ@2x(5d9k?2BLS(BB7_Y#vjJmw#Kk~jMtKRc@fk* zBIM=yBVN*Bnn8Hfi;ZC>9uL~AAxynI=OSGM!*`=z;UYZ*glTkl3}hS@Gks6)XSnbA z$LOK-i$SZ!Vhw_s=bbmyuv&UyO<31zI~=Z+r@VK-P!s%P(D~tMV7F z>H<#|`p0(!3JU`rR}`@R@XFnVEKh zHPWTkHh**P^WFBk=pRxm$HiifS=zA5H-6rV>HcuoKm9mbL>vw!{fjrokAGuAYTn12 z8hbdind@m>_ZeR2O(q_#GdgL#^beq)bYR77>Dvj9%s^KMdLHS)H<>AEV=aDL7#xsp za6?Nu*dfP8Vt(I$Q6kRV2b`=K$HbaoMiIu=UUSCS0-^x#gmYA1I|84ZO{x?CcWKm0 z>*pnQ`nPIz>I=}LR;etXm)WG_0t5xYe^}@X1!+>qgE<7yE7a>N!7_t+=sb|R)nwFH z!i!z>b(J|j1Uxp0gtrbOj$%6w_6(S5&WfX}Vu0)c7C^S5L4d??>nNwnPIK|of`V7< zcuuKQ7@jE>=@@VPiBps=L~69j^|Zh%l+qBmRq>}`#%CJ5>rrcrzX#HfbULk%o}uxk zf>3gMk>U*A0q{Q!SB=J-p=6wKf)havcUuCVNhbM}`!eR-0J+|b!BL$ORqS!Q4SJIf zQqT$Ydc&%&KM(EvbJuEvP7l-D^zQWb!bwIDHwi)@l?Vt56^I{BuDQ3Zdzqr3K(Va5 z?cO!RHz^s1ic7Kwh~E>lEf=Ftn=u1(kdGjJ9{rD*l^Uc>e^8LdRP+ZX6aSwub@?We~t7f!u{@F(+3JMGn@22^Ly#9 z(rZ8`eJTAz`Z*|~cS=8(z69e49zDhGB=L0mY-zkWBA1N-BX4#GFL1k*Dc_R5SeqICYa3TuKiN{T?Q@sn(hBSTHr`xA20gsiWWoxNf_&9=2b4^QHT4 z0k?pKsSYnH&tU2>Ts6P#a2t5zsY6eJ&!r=~K|gpo_0$|V@uO6i9X^xiV=<>O;wUtd z;Gk7Z7mmgsZ(1&(vXWyiJyVYPi;a|~X6`d3-r4=U^r7imubrtZ@Ja8VNbEXsVpjsZ zUQ+aMQ3?5Zc+-qi2WD*AG=sTh#-@wmRjr*n-`WoJ$<E!4^`mQNHl>%(kp}T@zm4-P(4-- zZx4Gp`$HtB;|#4h_`zR1> z1xSo=0#4)zHh~}QX7CZr3la0NI97tLQf!U{iwXn2?$}!0ua>k0Rm5@=#oGE{Zk1|4wUU(OiXITj87g>hmi?T{GjR0v9Lz1;z%=oZ*Ch4qH*~9+GbR z=8)d3WqGLdn(a!u$W!NY?l=jyfzsQX3;^ESI>lw2InyX;8jY(rR1{u1eqlnPI07$o zc$JE(YF_2B7kZU^QK3TN9TMypc66J@RnbO;$rJJRJ!eqfbQ9;Pqo2M{vN>xDjXML5 zb(*45N3F8vg>4T_v{yQvdUZ(f&kId4wGjSK`CTcFgqI zA1u{kp&m)PVr?`KL<5x`5Dr7!uu;qzz;e9Y)=nDjXRr<+j1stdX8OuOd2se5#r(ai zXc()UaQ%~}j$p;@4^#v?%-WF0`KveFzM48UtG`R?zgxrF^;LI%`?$xc-={Q|ulv39 zkG;Kt@-U;Y_&A{81ntVl0e!+&T+ECECBwX5x0Q!1rj>#<+T4DzW>H7=d{gmE&|tQ6 ztjWaj1t!tPBY~ae3sN*6EMQix;xxC_&2WU4ifyaluOpV2yVarb=uP9Co!9)<$JUxW z>K;?!Laixa25L|nj^7FsDlJo*;?X>ewb2_PoMYh1KcVUTCY?4|)3JHu z@+njMR?e8#)L^zexG)|M2HAwP{U6dLSNZ(b;wfK_Gm4Ians79_8an>qjK-!;8w114 zA4xwYLRhN2GGC-QY&7MlHAndpm(HIX_7|ztK#)GWM_p7@J+5uP-aH{!m&ot-Q?VH<@%=h8@)=^yxTEp{|AzZY*P~(C{mR zR=QiI)v2UAwF;#vjje~2B!iStsX)RYiVU&+pUT8$P%yMo-yJN~GNO2j1VS@|0RuocmlB3FuM?noicXPxW)R>r`0rL3c!H;J2}TqO4i10D z5*?{QnrDjUlIeTO{@vlo@t9F2iHk6zRB#V!iXZ3{`Bgv-l#Od&kJ>XpG6vJ#3Jb?x z4-F$}=@!3dqG8G0p&-M#Dih#YO%`^2aQ5Yi>VE5;j(tAbD)@anKF>GXKoeDRKO@A~b( zVlHc*Jh?S0sJWZhtS+SuG^5GqW24cWu9n%7{YJuMlwQIIQ*-ejml)cNL!_XP+T05( z;r~iq1S6>}L!a${H`5mneE{zyypjZ?mEB2V77LN&Hx=m|6jc)?^A?j{vhwUEcXAo_ zkt8EFWA&0K^FiWk!%2!bN*zap7UOULoMg?DFC_he)L6i~F00jL0ViD+i_1E6s;sGT zZc`I8JzhDvX>QYjrt-2TFewy=53f!PElsTH;x$@+;^H?KPvo^49vsHUo65?Ym?A5_ zkNp4DrZQ<}c~et4c(|-dOf3(^|BAQ%D*whq@HTLB?D@@`pO5X)@|`8nwl@gl|Gmc>oVgzz3>97x5A!kUEZbb5@f#gt{>%tmiQQ4<5yMl1OB& zv2Y~ulT5udo)c(1RREda1I-=*d8Re zka~h1X~8$Bi2^6Yg#iTAgeI^*yp9ga4T0~En}7)75mG>OHz&=T@I7$>v6YM1z5@6l zv3j9e$K+WvOkiO6^tl%N5SrW;wGeL9^o`T)>}26BY9+&p>>@_5vMFfkc7|bTn&&yj z$N&fdr02vKB;F!1R|!;;yf*hdw>ns?2Wq8R&}xCsQ($2jlRBtx)8$^!yC(Q&3Bg-mO5ExXn0>5r3 z-6q)d1r9@z%EOnl<1RLtTJPRe0-4IoLcykDK?7Q5I(-&%n@2%A0jQ}3bbEoQ=b1R` zEHNu-#ZJAFX88Jc0P2hN6~&NND?yQHae^`*qt|JyKxbzaR=pZPBhV;~N*#wvLUYB8 z$RMedVf0o2GzL+xWR#F)8IIP{i^XWt3XC|(Vc-R2 zkp*>Q^pXl)1pqW@QMc9@)z*1x!#KZBsbN%t$J6aLv9wlS#@RF$wZ2nlRB{Ch&ZVQd zirTiI@u#(uJW89vQiK`4mq$BI*VnH5)p^^>&7jCpcC>Txmh~$eUz=CmRRW>Mj~ZPe zYKmCDZgyo@bFO<&+TY~5d%Sd6&XufK#h~JMu$b=mo0(N z5WQ*VRbKtmAMb58yQJSphr#@wni~&n3-}pf#n$Zyk}eRU-+ANL^Ges=H1rQNp~LCV zd^2VGo{i%#>uS=!PagtGQ^({T;|oNnqcq-nzH#%UeEgD*pU~$$z6S0^o*w#0THBkB>H)CC`VC0Zl=? zzPm6|##vGKqLIeH!WYKEEljsx3)PEtk`P@5Fmr9VhLE}DJ=$sZ=R6dW_%Vc zP$ry0e?Cmm7L(2Q7`2VD2pF@CxjEP{e`eoHg*O^$`5tuZ$ z>Ckx=S5I4bMs-7}h=u*z3Ee z_V1QAq*Hh!+Xf7g?VDtblng?NRf(sv477ly7=%e6tO?D##7$L=m4GxxNije_?2D-r zwYNl4Cn6CzIdV7xl+uQiW%Z4vTg%G8VW*!fYzo5FFtU5APL~Q8O$-z?(n_7~Qf-B9 z2)5|UAeFrq{Y0d%rS&JvN-r&GY$(HwhfFD4O-ByH=B@fNeJY>_Py>$W%XC}y`XSh= zA7+0b@y7m95sv4;|HOV@A|r#rv_~|%H4w0WM_e8(`b{##pE^Vlf^tYarNm!K>vAUr zvb=vR#SRjLM%l{~q`hX*LgIghk&@KL#E6$pGn0{=Y1HhQTp1kv5ia^`<=4u9J=q=_ z2(>5e0p-_~e=Q1^)ENNPy#gdwbOXvD_3inOJ$wEG43^ZDgE@Pp3-y9MAbo+Ufq@}l z7xduvz0$Grx{@LrNUUBhC2VvbzF?1BRtA^VPa;^;!malVOS#RmSY}jRPhGryQ9JoV z>+5=8qGz2nNJ>M;C7BbhZ)hDU$!pR$yrd6G1P>1k^sHM4Ue1*xWB+pFxb+rnBFHef zK_o_5tiF6h4-0w?#-gf{xy?3TQ=`w;JhwDdWHd1IM+_<-gFjd%^%dKZgi=yc=mGZP zzDbtr#uyhWkUsGydm8nlZfrv(;077MG2^fQhq#^;h~I!GLf~ScJP>ZJFbeLu3lDvF()I- zf_LFMJ;3#`NvfTiNHW;Uk;02dLfj2>40cI+La-`BGuR5!gb0nm7{uR4F+tNwgXsV_ zPQd5-0`|d<*F;f>3cq4a@%AO-65$KG8+H1pOocX4q>aCAkYO>7i-B74I6dXKSQ`+J z589;(sl-o!>L>8L+Q6|buZy*!C_c{`N?mpgq~-_)wYpc$1|eel>xKbbv4DJ`d>iSH zkhC+V8cQ9Sll_b`VlXW+1xELY{03zj%)TuH4%acFNf!fR9Eet_jASxE_D@czq5#$tXtpnJuhjbAngFvev=`H*Y>v3D@G>x&? z7{_wLwKYf)QIrKvQ?|Its0Td52;Pldhu5EPD^PjY^k3V=(Tu(f2pS8^ z8Wg5ly`d;tUQ(!qoS;;(P{(rxOAnO4~YYHdV=W z1Ax2MU|~5C$(RhSHrK2!ENYrxUC083uc5!Yq+P4=D4|7E+ab`f#$tCv?Sg>1#Zy(R zgp9p>VN3s|Dm_gD^dGW%rOb`{Aon#pnNpEauZo&Ot)zCLFEXnKV;)?xij+=k1|JhO zt3L#MNPoj0V=U_PBV8Abj5seS3<6Qlt)qe!Qe6-htYM|K6V zLMyA~@Q2vFI?ZemI%jNBD7CsG-ssdhPgMTb+SN0vs$O5Ub}`Zn2c*-7{v!QJryKy_ z&|iQb1STE)xs;MVkpBCv-B%|b01GCyRWh7T&v94(E>u|wS)EE#zo>K5>;h3yZbbz% z&2P1pF|6Iz1m?^O2bDEZyQ0w7((=%}!f~47!fjs;c_!#}cDHA|%W=Eb!Ln*?v5r;u zF7NYso>_eUB1h4QroNjd=&YX}k{8!?UcaZmrDMxeYc>KV@xYan;y36ts2jk>=GKi` zof`G1hLvz}@3uPhbX11cJ}r8>t(4VH?@MiT*o7L$%qKd>M+C08u8Oly&i4mypp=w| z`OyiVE7GqqYrP5bn1t8|3_KbvjTS~=E;{!7bH@(+(&PQ5bbIQh6ZZih6FKox>T%$^ z&(qsG@0)`MzhRpt$B=Zv(zk)_Ct&>VQf1PIZ!ZN$hrr*QzmtBF#zv;t%Q%W!jqNQo z7Ew8hCkPp6Jk~+%N&x8disE$^ud~G<8VRvT+h=r0wLwD^wuk8Or_AA1_A=M}-u|V% z)0+&&_0rMTM7v!)4$7DNCic!>GIy4H!wdU1v=&6{yrrvi@yxmLN^ZigC3Bm@ZVSt3 z6ppUCT3sOAeNmH-wT81z?%A^GI`HG3P0cP^ z=PXdE-j}`w_CNu6>!eOlXe%b|oKk&{Z=6vt4W&Mxv61=Rsj|%9#u@aq85@D4ea;r? zpFq21PCJ-znmP?8qMvIzI%aR#k|%2xAZe*Oom(>|ZKvf7iBU`{?21(OO_hu$4-}ZIQwWm`KWNlvSN--T)-UlC}!>)IBQ`C(?tZWmW%rI&hs8UO&zEcs`QL%~TX;Q4*01OJp%Co?WRh7EG;VG@@nDtr#KG z#NGwbZFb{KDUm+Cyg_>HCwE9+-~Rf8#>)-?{+XR`ZHA79)0EawV*FexvH9sfsL;)g zw)ggT`oVqDN(1;j z+C$-`c8%FQb>M0c27zH7D3Ilw=)@WxWMq{t8w}J6BKhl?R460@6(JdtHD^|gQ7V0q zNjxi^{Mmp`c$?-_O0D&y%u>*yonVXJZk4vA7bgKj_QK@Pq?6AII=HkQa4JK>s^~gD zyY?N{P)}@PO?d0l^D`?_ffks4ilcIK`Pbew>a#hW>LXVsJE&znYTq*_8;=@sOq@#; z={`9Rr0<*=+M~`VcRE|fHue7jDoYD$004N}V_;-pU|?ZjXo@RJkLS1f%D~Oe00QUc zW`)D(|Ns9pus5)QxEu^jAPN9Cg$rB&004N}V_;-pU}N}qmw|!3;Xe?tH!uK2kO5;K z0I6LEeE@jcg;cRl12GKsT`m_1IMIcLE)`;6XcwS}@qPfdj!1|PKuCyzP7zn5ugFYzITwTLGqsUul~03g?(GI z$Nvn^x|r_)-_XCSO{+dM*h6>eWewk3wb=*uYlgFXwsW!`?@s5i?!;@H#-=g%hhvaf z8cNdU8*<&++t|&1TT_KNm%!Jd-1eZCbC!&d^qr3*cWcXy&v~Etq88bC(d033+1s4k zf(LUyxoCJuH5v1^Qe*XLf9@+Jl5a~kl_C@U{B0r(8#HJ~G2{_N;1iZoDGhkn}5)14*olpEb$m@Oe z7GBPD_ElHqefpq!-0K*}=F8OX-u*y2YP`-7(W58n*+^Fm=(lJU<~;+Z+=HgCdLMW5 zkb9ry4R#FSQ|DRjPTOLhym^OUKNrb$n1#66*f$ln7kg%9oK@|$^7{vZ16004N} zV_;wqBLm7Y1TaiuxWeefSircBiGj(6S%tZY#e?M>%P&?N)@7`J*h1Kju&1&A;RxZF z#PNXBgL4JvKdvCI30$|hb+~8oxbRf)oZ>a(jp1Fw=fbywUyR>}f0;mpK$pNHK`p^m zLM}qvgeycWM5c&*5cLvWBIYM{K-@??O?;F1HwhJq0Eror0+M}_Kco_*CP-bAW|LNu z4wEjCULyTUMoPv@_Xd}DVQnbDXdUeY%)rH9jbWYPBcmLn2gX9iLB?lHq)hBg_LzJ# zwJ@Dy#$Xm^w#Hn^e3M0h#RJP4%TrcjR!LSHZ1>sm+2z6FPkDM8tU7XjsM7g|ko#s~LcE#PreUpcr$2w0p&qbaGJnwn_@sjfL@oMmz=e5UM z#5=}&osXB#312PWeZD{ZGW_27yZN68kO;^M*ca#$xGC^mkWo-p(1~E9kTYQ%VUxms zh5Lk8gdd3zh=_?;5%DF`Au=m+O60!C7f}XLby0hwS)$FNCq=)D35zL-*%50NTM_#R z1mgnY_QlJ@*Ciw*+)HdqJd~uB)RS~8nI$tRB z7FGSJ_Nks!eXqum8x&?Ko>b}&=)tA-JYfx$W)I6z0q@}9mNUKz9 zTshx$_qHC1o+?ZT0KC^I-vD^pV_;-p zV4TJz$soc20!%>62!sp_4q!e502Y`53;=lAb&$_a!axwlzZLvLjGhef*cju%1Gd!@ zH$+hr1cC&;7NpWBf6`VIAHxUm;K2v+q&JT~fzRRB=~lpKHoNnincZ(@2fzxRk%CHR z0NC6yD`e@#Jcm^rYffPUP0eX+;a>ARHu0o+fp1?mFH-$e^Agt8gXRp@)T8EQY^xW| zZ^)_-&F?VP7tU~kG7MBPL57)Yn*%w!k}1*~V$6)kx?TBq^rlTps=BoP)EoC_LLuW0E*b4fzt@a8jE17u;y)%T zecDh@G~gdfq8h2pc78yGk<>XN^{GCVzC!ky#|~Fg-MaGnVFenLC;7x zl3FKNGE=}D$8ngMnVFd!W@d1h6Q{bRS$N65-R`PVLv{79U%e$N>7U1!OIMZt&kr6^ zO^HfnQ0e~CJ*B%#_mv(*85LAfLmdq?(Lx&?bTNX_(!HgJN)KQRa)K7RTXuoPZOt1t;NToPtwv8cxRDFxN~h83bOxPCXVKYo4xLNq(fM=%T}T(v z#dHZ>N|({)bOl{WSJBmU4P8sukwMp!Nml7mvdJMqJ?fK79&M!o`4mt{k|NqhF(s5z zM)R~li?l?`bOYT;H_^>>3*Ab$(d~2x-AQ+q9pDX&!MZYEQCr``!Y2Ba7`&9eBnIzR9OFX-l2s5_bh6v|{FC$TPSx+lT zYQ`IwO9mlUeuSR3=A)9=w4=NS@wFh z#OsHqU$$kxn#N}0R$Li~2CpUz(@!g@7l=wMO{e3?h0td~nHxi;mPM+odZ8s3+mUZB z8MYVOzTiD0VW#z1^kR{?4dsen(3ke0((}!Jix1;Ot_(%enwNeS2!s7;7oysrS;$#b z+ZNl>5p~PdeK|Gz75+;qmXw2rY63GJRHN7n)0%AtA~q{M8K(T*cWPd0`kviR#bRo> z!t1+fOUnzMle#Vb)(;I|^wLf)+9FIv+|HF)4e#di)+|ZA-cm)KrR{|dkIUy3vK~9q zGi{-wX3TqzkoCy3(<~OXNQAcMw*oUVl&>PLnT}eJBg}pZ$4je;YsR8#yMiO6F07lR zA~Gz~9xRx#)9slY!lBj}3KbRfYGg797#K3D_hhW>9X))g=#>hkDz*wc?eISHvCL22 z9V+?=&B)IZLjj`|cwr&7a}a5{E(f~rZp#FRgy$)(>4iO+PfP4rh%j+w+AXH#sA%%U zTxwZnI26q|mJ8aCb}ni!8o8WB#dnPe9U_Gzb|>+ch0)7=zf;IbVEX=;ShRgJFjw5F z^t~R#PMAH;kytdu5(ABIqp1Yjmx<_bR6;N8>)}<7XDAxB>5I@Y<63NnjtuIy34FexmyaGrYDt?Dw$o!2ia6h_T`0yuq8tvOEw=70%|QQMjCRQ#T8&gnd8A`jYfvao2xB7Am6MwaASDZTE22E3l)d78Dg9? zD!@)TPLi_ga8fWDICx>j629NIRako**i^J!zQzLGT2yGOYblFziwekij!0t_ksH=o z^a7*nOj)#kl3Ip2Tw0>G5OdDE)znM|NsSqm57V?_PxNdv5iNz>JWs0qSY}a0#j?s6 z$())cOlF9(ouz!05l6+0G=99Ol9=_`BR2jUU%`~6cgC<`i`@`uwvLflQkM*VO^J!K%puNUW?E=nf zWM>F%T~V0hQ^sp5m|Gi+?U?W0WJYApYx&9vgJEGcm>2k-`(i|g*ceu@POj!it*cUM z1Wudhrmjpl_@a?yUaD@ap+Kc}tl3rWx?= zW@w9AAe@1hwtLDY-es#`*9F%BH>auIL{E%6GP4wvLKSh1zjc-zf9p()zjeAgS8H{C zd(Fhga7Jr&Xx$OXfXhbBHzU<)proBZTIyUn8#@KQHQrj=GMN@j=VE@(eA+PN!{lSD zT>br}RzU?En6b4KsA*^o4Jy4Q79*8~`R(!rM)|mE60jrH9;a4V4uo6pGuK6?(_os@ zxM--igc>=b1x+oCW~ae1=IUko74>3hYKM53Kf1zq1pzUchg>qS_?GN6UtFmV%(xniN5;)ipu6Y2Z&+ z>?E10F*cbpTRE#1AZBLb>bM=_-HQ@0SyPb4S8T(gRWYU}rkeWcr`E5rk^LQ6eL3iI zom0LxHhjTJuV9!98nO9z{fyAGu2aI8+Bn(DOTMlMoc5g7sNeCrOATOR%VMk2k6DSp;b z^femVu{jH?ac_H*BU(-O<{9 literal 0 HcmV?d00001 diff --git a/user_guide/_static/jquery-3.1.0.js b/user_guide/_static/jquery-3.1.0.js new file mode 100755 index 0000000..f2fc274 --- /dev/null +++ b/user_guide/_static/jquery-3.1.0.js @@ -0,0 +1,10074 @@ +/*eslint-disable no-unused-vars*/ +/*! + * jQuery JavaScript Library v3.1.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2016-07-07T21:44Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.1.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.0 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-01-04 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + // Known :disabled false positives: + // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) + // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Check form elements and option elements for explicit disabling + return "label" in elem && elem.disabled === disabled || + "form" in elem && elem.disabled === disabled || + + // Check non-disabled form elements for fieldset[disabled] ancestors + "form" in elem && elem.disabled === false && ( + // Support: IE6-11+ + // Ancestry is covered for us + elem.isDisabled === disabled || + + // Otherwise, assume any non-
    " + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll("[msallowcapture^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push("~="); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push(".#.+[+~]"); + } + }); + + assert(function( el ) { + el.innerHTML = "" + + ""; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement("input"); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll(":enabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll(":disabled").length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( el ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === document ? -1 : + b === document ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + !compilerCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch (e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return (sel + "").replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + // Use previously-cached element index if available + if ( useCache ) { + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || (node[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + (outerCache[ node.uniqueID ] = {}); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + // Don't keep the element (issue #299) + input[0] = null; + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( (oldCache = uniqueCache[ key ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context === document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + if ( !context && elem.ownerDocument !== document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context || document, xml) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( el ) { + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( el ) { + el.innerHTML = ""; + return el.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( el ) { + el.innerHTML = ""; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( el ) { + return el.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; + } ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnotwhite = ( /\S+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( jQuery.isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + resolve.call( undefined, value ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.call( undefined, value ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( jQuery.isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + jQuery.isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the master Deferred + master = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + master.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( master.state() === "pending" || + jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return master.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + } + + return master.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + len ? fn( elems[ 0 ], key ) : emptyGet; +}; +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ jQuery.camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( jQuery.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); + } else { + key = jQuery.camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnotwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? JSON.parse( data ) : + data; + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + jQuery.contains( elem.ownerDocument, elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + +var swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, + scale = 1, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + do { + + // If previous iteration zeroed out, double until we get *something*. + // Use string for doubling so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + initialInUnit = initialInUnit / scale; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // Break the loop if scale is unchanged or perfect, or if we've just had enough. + } while ( + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations + ); + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ), + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); + +var rscriptType = ( /^$|\/(?:java|ecma)script/i ); + + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // Support: IE <=9 only + option: [ 1, "" ], + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
    " ], + col: [ 2, "", "
    " ], + tr: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + + _default: [ 0, "", "" ] +}; + +// Support: IE <=9 only +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? + context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +} )(); +var documentElement = document.documentElement; + + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 only +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + // Make a writable jQuery.Event from the native event object + var event = jQuery.event.fix( nativeEvent ); + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Support: IE <=9 + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // + // Support: Firefox <=42 + // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) + if ( delegateCount && cur.nodeType && + ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push( { elem: cur, handlers: matches } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + return ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event.which; + } +}, jQuery.event.addProp ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +function manipulationTarget( elem, content ) { + if ( jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.access( src ); + pdataCur = dataPriv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rmargin = ( /^margin/ ); + +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + style = elem.style; + + computed = computed || getStyles( elem ); + + // Support: IE <=9 only + // getPropertyValue is only needed for .css('filter') (#12537) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }, + + cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style; + +// Return a css property mapped to a potentially vendor prefixed property +function vendorPropName( name ) { + + // Shortcut for names that are not vendor prefixed + if ( name in emptyStyle ) { + return name; + } + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +function setPositiveNumber( elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + + // If we already have the right measurement, avoid augmentation + 4 : + + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // At this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + + // At this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // At this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var val, + valueIsBorderBox = true, + styles = getStyles( elem ), + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + if ( elem.getClientRects().length ) { + val = elem.getBoundingClientRect()[ name ]; + } + + // Some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test( val ) ) { + return val; + } + + // Check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && + ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // Use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + "float": "cssFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || + ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + if ( type === "number" ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + style[ name ] = value; + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || + ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + } ) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = extra && getStyles( elem ), + subtract = extra && augmentWidthOrHeight( + elem, + name, + extra, + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ); + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ name ] = value; + value = jQuery.css( elem, name ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && + ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || + jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function raf() { + if ( timerId ) { + window.requestAnimationFrame( raf ); + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = jQuery.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 13 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( jQuery.isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + jQuery.proxy( result.stop, result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnotwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + // Go to the end state if fx are off or if document is hidden + if ( jQuery.fx.off || document.hidden ) { + opt.duration = 0; + + } else { + opt.duration = typeof opt.duration === "number" ? + opt.duration : opt.duration in jQuery.fx.speeds ? + jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + if ( timer() ) { + jQuery.fx.start(); + } else { + jQuery.timers.pop(); + } +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( !timerId ) { + timerId = window.requestAnimationFrame ? + window.requestAnimationFrame( raf ) : + window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.stop = function() { + if ( window.cancelAnimationFrame ) { + window.cancelAnimationFrame( timerId ); + } else { + window.clearInterval( timerId ); + } + + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + jQuery.nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + attrNames = value && value.match( rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + return tabindex ? + parseInt( tabindex, 10 ) : + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && elem.href ? + 0 : + -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + +var rclass = /[\t\r\n\f]/g; + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnotwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && + ( " " + curValue + " " ).replace( rclass, " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = jQuery.trim( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnotwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && + ( " " + curValue + " " ).replace( rclass, " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = jQuery.trim( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( type === "string" ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = value.match( rnotwhite ) || []; + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + getClass( elem ) + " " ).replace( rclass, " " ) + .indexOf( className ) > -1 + ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g, + rspaces = /[\x20\t\r\n\f]+/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, isFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + + // Handle most common string cases + ret.replace( rreturn, "" ) : + + // Handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + +jQuery.fn.extend( { + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + + + + +support.focusin = "onfocusin" in window; + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = jQuery.now(); + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = jQuery.isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ) + .filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ) + .map( function( i, elem ) { + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rts = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 13 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available, append data to url + if ( s.data ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add anti-cache in uncached url if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rts, "" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + + +jQuery._evalUrl = function( url ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + "throws": true + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( jQuery.isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Change Log
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Change Log

    +
    +

    Version 3.1.6

    +

    Release Date: Sep 25, 2017

    +
      +
    • Security
        +
      • Fixed a potential object injection in Cache Library ‘apc’ driver when save() is used with $raw = TRUE (thanks to Tomas Bortoli).
      • +
      +
    • +
    • General Changes +
    • +
    +
    +

    Bug fixes for 3.1.6

    +
      +
    • Fixed a bug (#5164) - Loader Library method library() ignored requests to load libraries previously assigned to super-object properties named differently than the library name.
    • +
    • Fixed a bug (#5168) - Query Builder method count_all_results() produced erroneous queries on Microsoft SQL Server when ORDER BY clauses are cached.
    • +
    • Fixed a bug (#5128) - Profiler didn’t wrap $_SESSION and configuration arrays in <pre> tags.
    • +
    • Fixed a bug (#5183) - Database Library method is_write_type() didn’t return TRUE for MERGE statements.
    • +
    • Fixed a bug where Image Manipulation Library didn’t escape image source paths passed to NetPBM as shell arguments.
    • +
    • Fixed a bug (#5236) - Query Builder methods limit(), offset() break SQL Server 2005, 2008 queries with "<tablename>".* in the SELECT clause.
    • +
    • Fixed a bug (#5243) - Database Library method version() didn’t work with the ‘pdo/dblib’ driver.
    • +
    • Fixed a bug (#5246) - Database transactions status wasn’t reset unless trans_complete() was called.
    • +
    • Fixed a bug (#5260) - Database Utilities method backup() generated incorrect INSERT statements with the ‘mysqli’ driver.
    • +
    • Fixed a bug where Database Results method field_data() didn’t parse field types with the ‘mysqli’ driver.
    • +
    +
    +
    +
    +

    Version 3.1.5

    +

    Release Date: Jun 19, 2017

    + +
    +

    Bug fixes for 3.1.5

    +
      +
    • Fixed a bug (#5070) - Email Library didn’t properly detect 7-bit encoding.
    • +
    • Fixed a bug (#5084) - XML-RPC Library errored because of a variable name typo.
    • +
    • Fixed a bug (#5108) - Inflector Helper function singular() didn’t properly handle ‘quizzes’.
    • +
    • Fixed a regression (#5131) - private controller methods triggered PHP errors instead of a 404 response.
    • +
    • Fixed a bug (#5150) - Database Forge method modify_column() triggered an error while renaming columns with the ‘oci8’, ‘pdo/oci’ drivers.
    • +
    • Fixed a bug (#5155) - Query Builder method count_all_results() returned incorrect result for queries using LIMIT, OFFSET.
    • +
    +
    +
    +
    +

    Version 3.1.4

    +

    Release Date: Mar 20, 2017

    + +
    +

    Bug fixes for 3.1.4

    +
      +
    • Fixed a regression (#4975) - Loader Library couldn’t handle objects passed as view variables.
    • +
    • Fixed a bug (#4977) - Loader Library method helper() could accept any character as a filename extension separator.
    • +
    • Fixed a regression where the Session Library would fail on a session_regenerate_id(TRUE) call with the ‘database’ driver.
    • +
    • Fixed a bug (#4987) - Query Builder caching didn’t keep track of table aliases.
    • +
    • Fixed a bug where Text Helper function ascii_to_entities() wasn’t byte-safe when mbstring.func_overload is enabled.
    • +
    • Fixed a bug where CI_Log, CI_Output, CI_Email and CI_Zip didn’t handle strings in a byte-safe manner when mbstring.func_overload is enabled.
    • +
    • Fixed a bug where Session Library didn’t read session data in a byte-safe manner when mbstring.func_overload is enabled.
    • +
    • Fixed a bug (#4990) - Profiler didn’t close <pre> tags it generated.
    • +
    • Fixed a bug (#4990) - Profiler didn’t HTML-escape quotes for $_SESSION variables.
    • +
    • Fixed a bug where Input Library method set_cookie() didn’t allow its httponly and secure parameters to be overriden to FALSE.
    • +
    • Fixed a bug (#5006) - common function get_mimes() didn’t load application/config/mimes.php if an environment specific config exists.
    • +
    • Fixed a bug (#5006) - common function remove_invisible_characters() didn’t remove URL-encoded 0x7F.
    • +
    • Fixed a bug (#4815) - Database Library stripped URL-encoded sequences while escaping strings with the ‘mssql’ driver.
    • +
    • Fixed a bug (#5044) - HTML Helper function img() didn’t accept data: URI schemes for the image source.
    • +
    • Fixed a bug (#5050) - Database Library tried to access an undefined property in a number of error handling cases.
    • +
    • Fixed a bug (#5057) - Database driver ‘postgre’ didn’t actually apply extra options (such as ‘connect_timeout’) to its DSN.
    • +
    +
    +
    +
    +

    Version 3.1.3

    +

    Release Date: Jan 09, 2017

    +
      +
    • Security
        +
      • Fixed an XSS vulnerability in Security Library method xss_clean().
      • +
      • Fixed a possible file inclusion vulnerability in Loader Library method vars().
      • +
      • Fixed a possible remote code execution vulnerability in the Email Library when ‘mail’ or ‘sendmail’ are used (thanks to Paul Buonopane from NamePros).
      • +
      • Added protection against timing side-channel attacks in Security Library method csrf_verify().
      • +
      • Added protection against BREACH attacks targeting the CSRF token field generated by Form Helper function form_open().
      • +
      +
    • +
    • General Changes
        +
      • Deprecated $config['allow_get_array'].
      • +
      • Deprecated $config['standardize_newlines'].
      • +
      • Deprecated Date Helper function nice_date().
      • +
      +
    • +
    +
    +

    Bug fixes for 3.1.3

    +
      +
    • Fixed a bug (#4886) - Database Library didn’t differentiate bind markers inside double-quoted strings in queries.
    • +
    • Fixed a bug (#4890) - XML-RPC Library didn’t work on PHP 7.
    • +
    • Fixed a regression (#4887) - File Uploading Library triggered fatal errors due to numerous PHP distribution channels (XAMPP and cPanel confirmed) explicitly disabling ext/fileinfo by default.
    • +
    • Fixed a bug (#4679) - Input Library method ip_address() didn’t properly resolve $config['proxy_ips'] IPv6 addresses.
    • +
    • Fixed a bug (#4902) - Image Manipulation Library processing via ImageMagick didn’t work.
    • +
    • Fixed a bug (#4905) - Loader Library didn’t take into account possible user-provided directory paths when loading helpers.
    • +
    • Fixed a bug (#4916) - Session Library with sess_match_ip enabled was unusable for IPv6 clients when using the ‘database’ driver on MySQL 5.7.5+.
    • +
    • Fixed a bug (#4917) - Date Helper function nice_date() didn’t handle YYYYMMDD inputs properly.
    • +
    • Fixed a bug (#4923) - Session Library could execute an erroneous SQL query with the ‘database’ driver, if the lock attempt times out.
    • +
    • Fixed a bug (#4927) - Output Library method get_header() returned the first matching header, regardless of whether it would be replaced by a second set_header() call.
    • +
    • Fixed a bug (#4844) - Email Library didn’t apply escapeshellarg() to the while passing the Sendmail -f parameter through popen().
    • +
    • Fixed a bug (#4928) - the bootstrap file didn’t check if config/constants.php exists before trying to load it.
    • +
    • Fixed a bug (#4937) - Image Manipulation Library method initialize() didn’t translate new_image inputs to absolute paths.
    • +
    • Fixed a bug (#4941) - Query Builder method order_by() didn’t work with ‘RANDOM’ under the ‘pdo/sqlite’ driver.
    • +
    • Fixed a regression (#4892) - Query Builder method update_batch() didn’t properly handle identifier escaping.
    • +
    • Fixed a bug (#4953) - Database Forge method create_table() didn’t update an internal tables list cache if it exists but is empty.
    • +
    • Fixed a bug (#4958) - Query Builder method count_all_results() didn’t take into account cached ORDER BY clauses.
    • +
    • Fixed a bug (#4804) - Query Builder method insert_batch() could fail if the input array pointer was modified.
    • +
    • Fixed a bug (#4962) - Database Force method alter_table() would fail with the ‘oci8’ driver.
    • +
    • Fixed a bug (#4457) - Image Manipulation Library method get_image_properties() didn’t detect invalid images.
    • +
    • Fixed a bug (#4765) - Email Library didn’t send the User-Agent header without a prior call to clear().
    • +
    +
    +
    +
    +

    Version 3.1.2

    +

    Release Date: Oct 28, 2016

    +
      +
    • Security
        +
      • Fixed a number of new vulnerabilities in Security Library method xss_clean().
      • +
      +
    • +
    • General Changes
        +
      • Allowed PHP 4-style constructors (Matching_name::Matching_name() methods) to be used as routes, if there’s a __construct() to override them.
      • +
      +
    • +
    +
    +

    Bug fixes for 3.1.2

    +
      +
    • Fixed a regression (#4874) - Session Library didn’t take into account session.hash_bits_per_character when validating session IDs.
    • +
    • Fixed a bug (#4871) - Query Builder method update_batch() didn’t properly handle identifier escaping.
    • +
    • Fixed a bug (#4884) - Query Builder didn’t properly parse field names ending in ‘is’ when used inside WHERE and HAVING statements.
    • +
    • Fixed a bug where CI_Log, CI_Output, CI_Email and CI_Zip didn’t handle strings in a byte-safe manner when mbstring.func_overload is enabled.
    • +
    +
    +
    +
    +

    Version 3.1.1

    +

    Release Date: Oct 22, 2016

    + +
    +

    Bug fixes for 3.1.1

    +
      +
    • Fixed a bug (#4732) - Session Library triggered errors while writing data for a newly-created sessions with the ‘memcached’ driver.
    • +
    • Fixed a regression (#4736) - Image Manipulation Library processing via ImageMagick didn’t work.
    • +
    • Fixed a bug (#4737) - Query Builder didn’t add an OFFSET when LIMIT is zero or unused.
    • +
    • Fixed a regression (#4739) - Email Library doesn’t properly separate attachment bodies from headers.
    • +
    • Fixed a bug (#4754) - Unit Testing Library method result() didn’t translate res_datatype.
    • +
    • Fixed a bug (#4759) - Form Validation, Trackback and XML-RPC libraries treated URI schemes in a case-sensitive manner.
    • +
    • Fixed a bug (#4762) - Cache Library ‘file’ driver method get_metadata() checked TTL time against mtime instead of the cache item’s creation time.
    • +
    • Fixed a bug where File Uploading Library generated error messages on PHP 7.1.
    • +
    • Fixed a bug (#4780) - compatibility function hex2bin() didn’t reject inputs of type “resource”.
    • +
    • Fixed a bug (#4787) - Form Validation Library method valid_email() triggered E_WARNING when input emails have empty domain names.
    • +
    • Fixed a bug (#4805) - Database driver ‘mysqli’ didn’t use the MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT flag properly.
    • +
    • Fixed a bug (#4808) - Database method is_write_type() only looked at the first line of a queries using RETURNING with the ‘postgre’, ‘pdo/pgsql’, ‘odbc’ and ‘pdo/odbc’ drivers.
    • +
    • Fixed a bug where Query Builder method insert_batch() tried to execute an unsupported SQL query with the ‘ibase’ and ‘pdo/firebird’ drivers.
    • +
    • Fixed a bug (#4809) - Database driver ‘pdo/mysql’ didn’t turn off AUTOCOMMIT when starting a transaction.
    • +
    • Fixed a bug (#4822) - CAPTCHA Helper didn’t clear expired PNG images.
    • +
    • Fixed a bug (#4823) - Session Library ‘files’ driver could enter an infinite loop if mbstring.func_overload is enabled.
    • +
    • Fixed a bug (#4851) - Database Forge didn’t quote schema names passed to its create_database() method.
    • +
    • Fixed a bug (#4863) - HTML Table Library method set_caption() was missing method chaining support.
    • +
    • Fixed a bug (#4843) - XML-RPC Library client class didn’t set a read/write socket timeout.
    • +
    • Fixed a bug (#4865) - uncaught exceptions didn’t set the HTTP Response status code to 500 unless display_errors was turned On.
    • +
    • Fixed a bug (#4830) - Session Library didn’t take into account the new session INI settings in PHP 7.1.
    • +
    +
    +
    +
    +

    Version 3.1.0

    +

    Release Date: July 26, 2016

    +
      +
    • Security
        +
      • Fixed an SQL injection in the ‘odbc’ database driver.
      • +
      • Updated set_realpath() Path Helper function to filter-out php:// wrapper inputs.
      • +
      • Officially dropped any kind of support for PHP 5.2.x and anything under 5.3.7.
      • +
      +
    • +
    • General Changes
        +
      • Updated Image Manipulation Library to validate width and height configuration values.
      • +
      • Updated Encryption Library to always prefer random_bytes() when it is available.
      • +
      • Updated Session Library to log ‘debug’ messages when using fallbacks to session.save_path (php.ini) or ‘sess_use_database’, ‘sess_table_name’ settings.
      • +
      • Added a ‘LONGTEXT’ to ‘STRING’ alias to Database Forge for the ‘cubrid’, ‘pdo/cubrid’ drivers.
      • +
      • Added ‘TINYINT’, ‘MEDIUMINT’, ‘INT’ and ‘BIGINT’ aliases to ‘NUMBER’ to Database Forge for the ‘oci8’, ‘pdo/oci’ drivers.
      • +
      • password_hash() compatibility function changes:
          +
        • Changed salt-generation logic to prefer random_bytes() when it is available.
        • +
        • Changed salt-generation logic to prefer direct access to /dev/urandom over openssl_random_pseudo_bytes().
        • +
        • Changed salt-generation logic to error if openssl_random_pseudo_bytes() sets its $crypto_strong flag to FALSE.
        • +
        +
      • +
      +
    • +
    +
    +

    Bug fixes for 3.1.0

    +
      +
    • Fixed a bug where Image Manipulation Library didn’t escape image source paths passed to ImageMagick as shell arguments.
    • +
    • Fixed a bug (#861) - Database Forge method create_table() incorrectly accepts field width constraints for MSSQL/SQLSRV integer-type columns.
    • +
    • Fixed a bug (#4562) - Cache Library didn’t check if Memcached::quit() is available before calling it.
    • +
    • Fixed a bug (#4563) - Input Library method request_headers() ignores $xss_clean parameter value after first call.
    • +
    • Fixed a bug (#4605) - Config Library method site_url() stripped trailing slashes from relative URIs passed to it.
    • +
    • Fixed a bug (#4613) - Email Library failed to send multiple emails via SMTP due to “already authenticated” errors when keep-alive is enabled.
    • +
    • Fixed a bug (#4633) - Form Validation Library ignored multiple “callback” rules for empty, non-required fields.
    • +
    • Fixed a bug (#4637) - Database method error() returned FALSE with the ‘oci8’ driver if there was no error.
    • +
    • Fixed a bug (#4647) - Query Builder method count_all_results() doesn’t take into account GROUP BY clauses while deciding whether to do a subquery or not.
    • +
    • Fixed a bug where Session Library ‘redis’ driver didn’t properly detect if a connection is properly closed on PHP 5.x.
    • +
    • Fixed a bug (#4583) - Email Library didn’t properly handle inline attachments in HTML emails.
    • +
    • Fixed a bug where Database method db_select() didn’t clear metadata cached for the previously used database.
    • +
    • Fixed a bug (#4675) - File Helper function delete_files() treated symbolic links as regular directories.
    • +
    • Fixed a bug (#4674) - Database driver ‘dblib’ triggered E_WARNING messages while connecting.
    • +
    • Fixed a bug (#4678) - Database Forge tried to use unsupported IF NOT EXISTS clause when creating tables on Oracle.
    • +
    • Fixed a bug (#4691) - File Uploading Library method data() returns wrong ‘raw_name’ when the filename extension is also contained in the raw filename.
    • +
    • Fixed a bug (#4679) - Input Library method ip_address() errors with a matching $config['proxy_ips'] IPv6 address.
    • +
    • Fixed a bug (#4695) - User Agent Library didn’t load the config/user_agents.php file when there’s no User-Agent HTTP request header.
    • +
    • Fixed a bug (#4713) - Query Builder methods insert_batch(), update_batch() could return wrong affected rows count.
    • +
    • Fixed a bug (#4712) - Email Library doesn’t sent RSET to SMTP servers after a failure and while using keep-alive.
    • +
    • Fixed a bug (#4724) - Common function is_https() compared the X-Forwarded-Proto HTTP header case-sensitively.
    • +
    • Fixed a bug (#4725) - Common function remove_invisible_characters() searched case-sensitively for URL-encoded characters.
    • +
    +
    +
    +
    +

    Version 3.0.6

    +

    Release Date: March 21, 2016

    +
      +
    • General Changes
        +
      • Added a destructor to Cache Library ‘memcached’ driver to ensure that Memcache(d) connections are properly closed.
      • +
      • Deprecated Form Validation Library method prep_for_form().
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0.6

    +
      +
    • Fixed a bug (#4516) - Form Validation Library always accepted empty array inputs.
    • +
    • Fixed a bug where Session Library allowed accessing $_SESSION values as class properties but isset() didn’t work on them.
    • +
    • Fixed a bug where Form Validation Library modified the $_POST array when the data being validated was actually provided via set_data().
    • +
    • Fixed a bug (#4539) - Migration Library applied migrations before validating that all migrations within the requested version range are valid.
    • +
    • Fixed a bug (#4539) - Migration Library triggered failures for migrations that are out of the requested version range.
    • +
    +
    +
    +
    +

    Version 3.0.5

    +

    Release Date: March 11, 2016

    +
      +
    • Core
        +
      • Changed Loader Library to allow $autoload['drivers'] assigning with custom property names.
      • +
      • Changed Loader Library to ignore variables prefixed with ‘_ci_’ when loading views.
      • +
      +
    • +
    • General Changes
        +
      • Updated the Session Library to produce friendlier error messages on failures with drivers other than ‘files’.
      • +
      +
    • +
    • Query Builder
        +
      • Added a $batch_size parameter to the insert_batch() method (defaults to 100).
      • +
      • Added a $batch_size parameter to the update_batch() method (defaults to 100).
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0.5

    +
      +
    • Fixed a bug (#4391) - Email Library method reply_to() didn’t apply Q-encoding.
    • +
    • Fixed a bug (#4384) - Pagination Library ignored (possible) cur_page configuration value.
    • +
    • Fixed a bug (#4395) - Query Builder method count_all_results() still fails if an ORDER BY condition is used.
    • +
    • Fixed a bug (#4399) - Query Builder methods insert_batch(), update_batch() produced confusing error messages when called with no data and db_debug is enabled.
    • +
    • Fixed a bug (#4401) - Query Builder breaks WHERE and HAVING conditions that use IN() with strings containing a closing parenthesis.
    • +
    • Fixed a regression in Form Helper functions set_checkbox(), set_radio() where “checked” inputs aren’t recognized after a form submit.
    • +
    • Fixed a bug (#4407) - Text Helper function word_censor() doesn’t work under PHP 7 if there’s no custom replacement provided.
    • +
    • Fixed a bug (#4415) - Form Validation Library rule valid_url didn’t accept URLs with IPv6 addresses enclosed in square brackets under PHP 5 (upstream bug).
    • +
    • Fixed a bug (#4427) - CAPTCHA Helper triggers an error if the provided character pool is too small.
    • +
    • Fixed a bug (#4430) - File Uploading Library option file_ext_tolower didn’t work.
    • +
    • Fixed a bug (#4431) - Query Builder method join() discarded opening parentheses.
    • +
    • Fixed a bug (#4424) - Session Library triggered a PHP warning when writing a newly created session with the ‘redis’ driver.
    • +
    • Fixed a bug (#4437) - Inflector Helper function humanize() didn’t escape its $separator parameter while using it in a regular expression.
    • +
    • Fixed a bug where Session Library didn’t properly handle its locks’ statuses with the ‘memcached’ driver.
    • +
    • Fixed a bug where Session Library triggered a PHP warning when writing a newly created session with the ‘memcached’ driver.
    • +
    • Fixed a bug (#4449) - Query Builder method join() breaks conditions containing IS NULL, IS NOT NULL.
    • +
    • Fixed a bug (#4491) - Session Library didn’t clean-up internal variables for emulated locks with the ‘redis’ driver.
    • +
    • Fixed a bug where Session Library didn’t clean-up internal variables for emulated locks with the ‘memcached’ driver.
    • +
    • Fixed a bug where Database transactions didn’t work with the ‘ibase’ driver.
    • +
    • Fixed a bug (#4475) - Security Library method strip_image_tags() preserves only the first URL character from non-quoted src attributes.
    • +
    • Fixed a bug where Profiler Library didn’t apply htmlspecialchars() to all displayed inputs.
    • +
    • Fixed a bug (#4277) - Cache Library triggered fatal errors if accessing the Memcache(d) and/or Redis driver and they are not available on the system.
    • +
    • Fixed a bug where Cache Library method is_supported() logged an error message when it returns FALSE for the APC and Wincache drivers.
    • +
    +
    +
    +
    +

    Version 3.0.4

    +

    Release Date: January 13, 2016

    +
      +
    • General Changes
        +
      • Updated Security Library method get_random_bytes() to use PHP 7’s random_bytes() function when possible.
      • +
      • Updated Encryption Library method create_key() to use PHP 7’s random_bytes() function when possible.
      • +
      +
    • +
    • Database
        +
      • Added support for OFFSET-FETCH with Oracle 12c for the ‘oci8’ and ‘pdo/oci’ drivers.
      • +
      • Added support for the new MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT constant from PHP 5.6.16 for the ‘mysqli’ driver.
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0.4

    +
      +
    • Fixed a bug (#4212) - Query Builder method count_all_results() could fail if an ORDER BY condition is used.
    • +
    • Fixed a bug where Form Helper functions set_checkbox(), set_radio() didn’t “uncheck” inputs on a submitted form if the default state is “checked”.
    • +
    • Fixed a bug (#4217) - Config Library method base_url() didn’t use proper formatting for IPv6 when it falls back to $_SERVER['SERVER_ADDR'].
    • +
    • Fixed a bug where CAPTCHA Helper entered an infinite loop while generating a random string.
    • +
    • Fixed a bug (#4223) - Database method simple_query() blindly executes queries without checking if the connection was initialized properly.
    • +
    • Fixed a bug (#4244) - Email Library could improperly use “unsafe” US-ASCII characters during Quoted-printable encoding.
    • +
    • Fixed a bug (#4245) - Database Forge couldn’t properly handle SET and ENUM type fields with string values.
    • +
    • Fixed a bug (#4283) - String Helper function alternator() couldn’t be called without arguments.
    • +
    • Fixed a bug (#4306) - Database method version() didn’t work properly with the ‘mssql’ driver.
    • +
    • Fixed a bug (#4039) - Session Library could generate multiple (redundant) warnings in case of a read failure with the ‘files’ driver, due to a bug in PHP.
    • +
    • Fixed a bug where Session Library didn’t have proper error handling on PHP 5 (due to a PHP bug).
    • +
    • Fixed a bug (#4312) - Form Validation Library didn’t provide error feedback for failed validation on empty requests.
    • +
    • Fixed a bug where Database method version() returned banner text instead of only the version number with the ‘oci8’ and ‘pdo/oci’ drivers.
    • +
    • Fixed a bug (#4331) - Database method error() didn’t really work for connection errors with the ‘mysqli’ driver.
    • +
    • Fixed a bug (#4343) - Email Library failing with a “More than one ‘from’ person” message when using sendmail.
    • +
    • Fixed a bug (#4350) - Loader Library method model() logic directly instantiated the CI_Model or MY_Model classes.
    • +
    • Fixed a bug (#4337) - Database method query() didn’t return a result set for queries with the RETURNING statement on PostgreSQL.
    • +
    • Fixed a bug (#4362) - Session Library doesn’t properly maintain its state after ID regeneration with the ‘redis’ and ‘memcached’ drivers on PHP 7.
    • +
    • Fixed a bug (#4349) - Database drivers ‘mysql’, ‘mysqli’, ‘pdo/mysql’ discard other sql_mode flags when “stricton” is enabled.
    • +
    • Fixed a bug (#4349) - Database drivers ‘mysql’, ‘mysqli’, ‘pdo/mysql’ don’t turn off STRICT_TRANS_TABLES on MySQL 5.7+ when “stricton” is disabled.
    • +
    • Fixed a bug (#4374) - Session Library with the ‘database’ driver could be affected by userspace Query Builder conditions.
    • +
    +
    +
    +
    +

    Version 3.0.3

    +

    Release Date: October 31, 2015

    +
      +
    • Security
        +
      • Fixed an XSS attack vector in Security Library method xss_clean().
      • +
      • Changed Config Library method base_url() to fallback to $_SERVER['SERVER_ADDR'] when $config['base_url'] is empty in order to avoid Host header injections.
      • +
      • Changed CAPTCHA Helper to use the operating system’s PRNG when possible.
      • +
      +
    • +
    • Database +
    • +
    +
    +

    Bug fixes for 3.0.3

    +
      +
    • Fixed a bug (#4170) - Database method insert_id() could return an identity from the wrong scope with the ‘sqlsrv’ driver.
    • +
    • Fixed a bug (#4179) - Session Library doesn’t properly maintain its state after ID regeneration with the ‘database’ driver on PHP 7.
    • +
    • Fixed a bug (#4173) - Database Forge method add_key() didn’t allow creation of non-PRIMARY composite keys after the “bugfix” for #3968.
    • +
    • Fixed a bug (#4171) - Database Transactions didn’t work with nesting in methods trans_begin(), trans_commit(), trans_rollback().
    • +
    • Fixed a bug where Database Transaction methods trans_begin(), trans_commit(), trans_rollback() ignored failures.
    • +
    • Fixed a bug where all Database Transaction methods returned TRUE while transactions are actually disabled.
    • +
    • Fixed a bug where common function html_escape() modified keys of its array inputs.
    • +
    • Fixed a bug (#4192) - Email Library wouldn’t always have proper Quoted-printable encoding due to a bug in PHP’s own mb_mime_encodeheader() function.
    • +
    +
    +
    +
    +

    Version 3.0.2

    +

    Release Date: October 8, 2015

    +
      +
    • Security +
    • +
    • General Changes
        +
      • Updated the application/config/constants.php file to check if constants aren’t already defined before doing that.
      • +
      • Changed Loader Library method model() to only apply ucfirst() and not strtolower() to the requested class name.
      • +
      • Changed Config Library methods base_url(), site_url() to allow protocol-relative URLs by passing an empty string as the protocol.
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0.2

    +
      +
    • Fixed a bug (#2284) - Database method protect_identifiers() breaks when Query Builder isn’t enabled.
    • +
    • Fixed a bug (#4052) - Routing with anonymous functions didn’t work for routes that don’t use regular expressions.
    • +
    • Fixed a bug (#4056) - Input Library method get_request_header() could not return a value unless request_headers() was called beforehand.
    • +
    • Fixed a bug where the Database Class entered an endless loop if it fails to connect with the ‘sqlsrv’ driver.
    • +
    • Fixed a bug (#4065) - Database method protect_identifiers() treats a traling space as an alias separator if the input doesn’t contain ‘ AS ‘.
    • +
    • Fixed a bug (#4066) - Cache Library couldn’t fallback to a backup driver if the primary one is Memcache(d) or Redis.
    • +
    • Fixed a bug (#4073) - Email Library method send() could return TRUE in case of an actual failure when an SMTP command fails.
    • +
    • Fixed a bug (#4086) - Query Builder didn’t apply dbprefix to LIKE conditions if the pattern included spaces.
    • +
    • Fixed a bug (#4091) - Cache Library ‘file’ driver could be tricked into accepting empty cache item IDs.
    • +
    • Fixed a bug (#4093) - Query Builder modified string values containing ‘AND’, ‘OR’ while compiling WHERE conditions.
    • +
    • Fixed a bug (#4096) - Query Builder didn’t apply dbprefix when compiling BETWEEN conditions.
    • +
    • Fixed a bug (#4105) - Form Validation Library didn’t allow pipe characters inside “bracket parameters” when using a string ruleset.
    • +
    • Fixed a bug (#4109) - Routing to default_controller didn’t work when enable_query_strings is set to TRUE.
    • +
    • Fixed a bug (#4044) - Cache Library ‘redis’ driver didn’t catch RedisException that could be thrown during authentication.
    • +
    • Fixed a bug (#4120) - Database method error() didn’t return error info when called after query() with the ‘mssql’ driver.
    • +
    • Fixed a bug (#4116) - Pagination Library set the wrong page number on the “data-ci-pagination-page” attribute in generated links.
    • +
    • Fixed a bug where Pagination Library added the ‘rel=”start”’ attribute to the first displayed link even if it’s not actually linking the first page.
    • +
    • Fixed a bug (#4137) - Error Handling breaks for the new Error exceptions under PHP 7.
    • +
    • Fixed a bug (#4126) - Form Validation Library method reset_validation() discarded validation rules from config files.
    • +
    +
    +
    +
    +

    Version 3.0.1

    +

    Release Date: August 7, 2015

    +
      +
    • Core +
    • +
    • Database
        +
      • Added list_fields() support for SQLite (‘sqlite3’ and ‘pdo_sqlite’ drivers).
      • +
      • Added SSL connection support for the ‘mysqli’ and ‘pdo_mysql’ drivers.
      • +
      +
    • +
    • Libraries
        +
      • File Uploading Library changes:
          +
        • Changed method set_error() to accept a custom log level (defaults to ‘error’).
        • +
        • Errors “no_file_selected”, “file_partial”, “stopped_by_extension”, “no_file_types”, “invalid_filetype”, “bad_filename” are now logged at the ‘debug’ level.
        • +
        • Errors “file_exceeds_limit”, “file_exceeds_form_limit”, “invalid_filesize”, “invalid_dimensions” are now logged at the ‘info’ level.
        • +
        +
      • +
      • Added ‘is_resource’ to the available expectations in Unit Testing Library.
      • +
      +
    • +
    • Helpers
        +
      • Added Unicode support to URL Helper function url_title().
      • +
      • Added support for passing the “extra” parameter as an array to all Form Helper functions that use it.
      • +
      +
    • +
    • Core
        +
      • Added support for defining a list of specific query parameters in $config['cache_query_string'] for the Output Library.
      • +
      • Added class existence and inheritance checks to CI_Loader::model() in order to ease debugging in case of name collisions.
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0.1

    +
      +
    • Fixed a bug (#3733) - Autoloading of libraries with aliases didn’t work, although it was advertised to.
    • +
    • Fixed a bug (#3744) - Redis Caching driver didn’t handle authentication failures properly.
    • +
    • Fixed a bug (#3761) - URL Helper function anchor() didn’t work with array inputs.
    • +
    • Fixed a bug (#3773) - db_select() didn’t work for MySQL with the PDO Database driver.
    • +
    • Fixed a bug (#3771) - Form Validation Library was looking for a ‘form_validation_’ prefix when trying to translate field name labels.
    • +
    • Fixed a bug (#3787) - FTP Library method delete_dir() failed when the target has subdirectories.
    • +
    • Fixed a bug (#3801) - Output Library method _display_cache() incorrectly looked for the last modified time of a directory instead of the cache file.
    • +
    • Fixed a bug (#3816) - Form Validation Library treated empty string values as non-existing ones.
    • +
    • Fixed a bug (#3823) - Session Library drivers Redis and Memcached didn’t properly handle locks that are blocking the request for more than 30 seconds.
    • +
    • Fixed a bug (#3846) - Image Manipulation Library method image_mirror_gd() didn’t properly initialize its variables.
    • +
    • Fixed a bug (#3854) - field_data() didn’t work properly with the Oracle (OCI8) database driver.
    • +
    • Fixed a bug in the Database Utility Class method csv_from_result() didn’t work with a whitespace CSV delimiter.
    • +
    • Fixed a bug (#3890) - Input Library method get_request_header() treated header names as case-sensitive.
    • +
    • Fixed a bug (#3903) - Form Validation Library ignored “unnamed” closure validation rules.
    • +
    • Fixed a bug (#3904) - Form Validation Library ignored “named” callback rules when the field is empty and there’s no ‘required’ rule.
    • +
    • Fixed a bug (#3922) - Email and XML-RPC libraries could enter an infinite loop due to PHP bug #39598.
    • +
    • Fixed a bug (#3913) - Cache Library didn’t work with the direct $this->cache->$driver_name->method() syntax with Redis and Memcache(d).
    • +
    • Fixed a bug (#3932) - Query Builder didn’t properly compile WHERE and HAVING conditions for field names that end with “and”, “or”.
    • +
    • Fixed a bug in Query Builder where delete() didn’t properly work on multiple tables with a WHERE condition previously set via where().
    • +
    • Fixed a bug (#3952) - Database method list_fields() didn’t work with SQLite3.
    • +
    • Fixed a bug (#3955) - Cache Library methods increment() and decrement() ignored the ‘key_prefix’ setting.
    • +
    • Fixed a bug (#3963) - Unit Testing Library wrongly tried to translate filenames, line numbers and notes values in test results.
    • +
    • Fixed a bug (#3965) - File Uploading Library ignored the “encrypt_name” setting when “overwrite” is enabled.
    • +
    • Fixed a bug (#3968) - Database Forge method add_key() didn’t treat array inputs as composite keys unless it’s a PRIMARY KEY.
    • +
    • Fixed a bug (#3715) - Pagination Library could generate broken link when a protocol-relative base URL is used.
    • +
    • Fixed a bug (#3828) - Output Library method delete_cache() couldn’t delete index page caches.
    • +
    • Fixed a bug (#3704) - Database method stored_procedure() in the ‘oci8’ driver didn’t properly bind parameters.
    • +
    • Fixed a bug (#3778) - Download Helper function force_download() incorrectly sent a Pragma response header.
    • +
    • Fixed a bug (#3752) - $routing['directory'] overrides were not properly handled and always resulted in a 404 “Not Found” error.
    • +
    • Fixed a bug (#3279) - Query Builder methods update() and get_compiled_update() did double escaping on the table name if it was provided via from().
    • +
    • Fixed a bug (#3991) - $config['rewrite_short_tags'] never worked due to function_exists('eval') always returning FALSE.
    • +
    • Fixed a bug where the File Uploading Library library will not properly configure its maximum file size unless the input value is of type integer.
    • +
    • Fixed a bug (#4000) - Pagination Library didn’t enable “rel” attributes by default if no attributes-related config options were used.
    • +
    • Fixed a bug (#4004) - URI Class didn’t properly parse the request URI if it contains a colon followed by a digit.
    • +
    • Fixed a bug in Query Builder where the $escape parameter for some methods only affected field names.
    • +
    • Fixed a bug (#4012) - Query Builder methods where_in(), or_where_in(), where_not_in(), or_where_not_in() didn’t take into account previously cached WHERE conditions when query cache is in use.
    • +
    • Fixed a bug (#4015) - Email Library method set_header() didn’t support method chaining, although it was advertised.
    • +
    • Fixed a bug (#4027) - Routing with HTTP verbs only worked if the route request method was declared in all-lowercase letters.
    • +
    • Fixed a bug (#4026) - Database Transactions always rollback if any previous query() call fails.
    • +
    • Fixed a bug (#4023) - String Helper function increment_string() didn’t escape its $separator parameter.
    • +
    +
    +
    +
    +

    Version 3.0.0

    +

    Release Date: March 30, 2015

    +
      +
    • License
        +
      • CodeIgniter has been relicensed with the MIT License, eliminating its old proprietary licensing.
      • +
      +
    • +
    • General Changes
        +
      • PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4 and recommends PHP 5.4+ or newer to be used.
      • +
      • Changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase).
      • +
      • Changed the default database driver to ‘mysqli’ (the old ‘mysql’ driver is DEPRECATED).
      • +
      • $_SERVER['CI_ENV'] can now be set to control the ENVIRONMENT constant.
      • +
      • Added an optional backtrace to php-error template.
      • +
      • Added Android to the list of user agents.
      • +
      • Added Windows 7, Windows 8, Windows 8.1, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms.
      • +
      • Added Fennec (Firefox for mobile) to the list of mobile user agents.
      • +
      • Ability to log certain error types, not all under a threshold.
      • +
      • Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
      • +
      • Added support for pgp, gpg, zsh and cdr files to mimes.php.
      • +
      • Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
      • +
      • Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg, wma Audio files to mimes.php.
      • +
      • Added support for kmz and kml (Google Earth) files to mimes.php.
      • +
      • Added support for ics Calendar files to mimes.php.
      • +
      • Added support for rar, jar and 7zip archives to mimes.php.
      • +
      • Updated support for xml (‘application/xml’) and xsl (‘application/xml’, ‘text/xsl’) files in mimes.php.
      • +
      • Updated support for doc files in mimes.php.
      • +
      • Updated support for docx files in mimes.php.
      • +
      • Updated support for php files in mimes.php.
      • +
      • Updated support for zip files in mimes.php.
      • +
      • Updated support for csv files in mimes.php.
      • +
      • Added Romanian, Greek, Vietnamese and Cyrilic characters in application/config/foreign_characters.php.
      • +
      • Changed logger to only chmod when file is first created.
      • +
      • Removed previously deprecated SHA1 Library.
      • +
      • Removed previously deprecated use of $autoload['core'] in application/config/autoload.php. +Only entries in $autoload['libraries'] are auto-loaded now.
      • +
      • Removed previously deprecated EXT constant.
      • +
      • Updated all classes to be written in PHP 5 style, with visibility declarations and no var usage for properties.
      • +
      • Added an Exception handler.
      • +
      • Moved error templates to application/views/errors/ and made the path configurable via $config['error_views_path'].
      • +
      • Added support non-HTML error templates for CLI applications.
      • +
      • Moved the Log class to application/core/
      • +
      • Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment.
      • +
      • Changed detection of $view_folder so that if it’s not found in the current path, it will now also be searched for under the application folder.
      • +
      • Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths.
      • +
      • Updated email validation methods to use filter_var() instead of PCRE.
      • +
      • Changed environment defaults to report all errors in development and only fatal ones in testing, production but only display them in development.
      • +
      • Updated ip_address database field lengths from 16 to 45 for supporting IPv6 address on Trackback Library and Captcha Helper.
      • +
      • Removed cheatsheets and quick_reference PDFs from the documentation.
      • +
      • Added availability checks where usage of dangerous functions like eval() and exec() is required.
      • +
      • Added support for changing the file extension of log files using $config['log_file_extension'].
      • +
      • Added support for turning newline standardization on/off via $config['standardize_newlines'] and set it to FALSE by default.
      • +
      • Added configuration setting $config['composer_autoload'] to enable loading of a Composer auto-loader.
      • +
      • Removed the automatic conversion of ‘programmatic characters’ to HTML entities from the URI Library.
      • +
      • Changed log messages that say a class or file was loaded to “info” level instead of “debug”, so that they don’t pollute log files when $config['log_threshold'] is set to 2 (debug).
      • +
      +
    • +
    • Helpers
        +
      • Date Helper changes include:
          +
        • Added an optional third parameter to timespan() that constrains the number of time units displayed.
        • +
        • Added an optional parameter to timezone_menu() that allows more attributes to be added to the generated select tag.
        • +
        • Added function date_range() that generates a list of dates between a specified period.
        • +
        • Deprecated standard_date(), which now just uses the native date() with DateTime constants.
        • +
        • Changed now() to work with all timezone strings supported by PHP.
        • +
        • Changed days_in_month() to use the native cal_days_in_month() PHP function, if available.
        • +
        +
      • +
      • URL Helper changes include:
          +
        • Deprecated separator options dash and underscore for function url_title() (they are only aliases for ‘-‘ and ‘_’ respectively).
        • +
        • url_title() will now trim extra dashes from beginning and end.
        • +
        • anchor_popup() will now fill the href attribute with the URL and its JS code will return FALSE instead.
        • +
        • Added JS window name support to the anchor_popup() function.
        • +
        • Added support for menubar attribute to the anchor_popup().
        • +
        • Added support (auto-detection) for HTTP/1.1 response codes 303, 307 in redirect().
        • +
        • Changed redirect() to choose the refresh method only on IIS servers, instead of all servers on Windows (when auto is used).
        • +
        • Changed anchor(), anchor_popup(), and redirect() to support protocol-relative URLs (e.g. //ellislab.com/codeigniter).
        • +
        +
      • +
      • HTML Helper changes include:
          +
        • Added more doctypes.
        • +
        • Changed application and environment config files to be loaded in a cascade-like manner.
        • +
        • Changed doctype() to cache and only load once the doctypes array.
        • +
        • Deprecated functions nbs() and br(), which are just aliases for the native str_repeat() with &nbsp; and <br /> respectively.
        • +
        +
      • +
      • Inflector Helper changes include: +
      • +
      • Download Helper changes include:
          +
        • Added an optional third parameter to force_download() that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
        • +
        • Added a work-around in force_download() for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
        • +
        • Added support for reading from an existing file path by passing NULL as the second parameter to force_download() (useful for large files and/or safely transmitting binary data).
        • +
        +
      • +
      • Form Helper changes include: +
      • +
      • Security Helper changes include: +
      • +
      • Smiley Helper changes include:
          +
        • Deprecated the whole helper as too specific for CodeIgniter.
        • +
        • Removed previously deprecated function js_insert_smiley().
        • +
        • Changed application and environment config files to be loaded in a cascade-like manner.
        • +
        • The smileys array is now cached and loaded only once.
        • +
        +
      • +
      • File Helper changes include:
          +
        • set_realpath() can now also handle file paths as opposed to just directories.
        • +
        • Added an optional paramater to delete_files() to enable it to skip deleting files such as .htaccess and index.html.
        • +
        • Deprecated function read_file() - it’s just an alias for PHP’s native file_get_contents().
        • +
        +
      • +
      • String Helper changes include:
          +
        • Deprecated function repeater() - it’s just an alias for PHP’s native str_repeat().
        • +
        • Deprecated function trim_slashes() - it’s just an alias for PHP’s native trim() (with a slash as its second argument).
        • +
        • Deprecated randomization type options unique and encrypt for funcion random_string() (they are only aliases for md5 and sha1 respectively).
        • +
        +
      • +
      • CAPTCHA Helper changes include:
          +
        • Added word_length and pool options to allow customization of the generated word.
        • +
        • Added colors configuration to allow customization for the background, border, text and grid colors.
        • +
        • Added filename to the returned array elements.
        • +
        • Updated to use imagepng() in case that imagejpeg() isn’t available.
        • +
        • Added font_size option to allow customization of font size.
        • +
        • Added img_id option to set id attribute of captcha image.
        • +
        +
      • +
      • Text Helper changes include: +
      • +
      • Directory Helper directory_map() will now append DIRECTORY_SEPARATOR to directory names in the returned array.
      • +
      • Array Helper element() and elements() now return NULL instead of FALSE when the required elements don’t exist.
      • +
      • Language Helper lang() now accepts an optional list of additional HTML attributes.
      • +
      • Deprecated the Email Helper as its valid_email(), send_email() functions are now only aliases for PHP native functions filter_var() and mail() respectively.
      • +
      +
    • +
    • Database
        +
      • DEPRECATED the ‘mysql’, ‘sqlite’, ‘mssql’ and ‘pdo/dblib’ (also known as ‘pdo/mssql’ or ‘pdo/sybase’) drivers.
      • +
      • Added dsn configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID).
      • +
      • Added schema configuration setting (defaults to public) for drivers that might need it (currently used by PostgreSQL and ODBC).
      • +
      • Added save_queries configuration setting to application/config/database.php (defaults to TRUE).
      • +
      • Removed autoinit configuration setting as it doesn’t make sense to instantiate the database class but not connect to the database.
      • +
      • Added subdrivers support (currently only used by PDO).
      • +
      • Added an optional database name parameter to db_select().
      • +
      • Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
      • +
      • Renamed internal method _escape_identifiers() to escape_identifiers().
      • +
      • Updated escape_identifiers() to accept an array of fields as well as strings.
      • +
      • MySQL and MySQLi drivers now require at least MySQL version 5.1.
      • +
      • Added a $persistent parameter to db_connect() and changed db_pconnect() to be an alias for db_connect(TRUE).
      • +
      • db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1).
      • +
      • db_select() will now always (if required by the driver) be called by db_connect() instead of only when initializing.
      • +
      • Replaced the _error_message() and _error_number() methods with error(), which returns an array containing the last database error code and message.
      • +
      • Improved version() implementation so that drivers that have a native function to get the version number don’t have to be defined in the core DB_driver class.
      • +
      • Added capability for packages to hold config/database.php config files.
      • +
      • Added MySQL client compression support.
      • +
      • Added encrypted connections support (for mysql, sqlsrv and PDO with sqlsrv).
      • +
      • Removed Loader Class from Database error tracing to better find the likely culprit.
      • +
      • Added support for SQLite3 database driver.
      • +
      • Added Interbase/Firebird database support via the ibase driver.
      • +
      • Added ODBC support for create_database(), drop_database() and drop_table() in Database Forge.
      • +
      • Added support to binding arrays as IN() sets in query().
      • +
      • Query Builder changes include:
          +
        • Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern.
        • +
        • Added the ability to insert objects with insert_batch().
        • +
        • Added new methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete().
        • +
        • Added an optional parameter that allows to disable escaping (useful for custom fields) for methods join(), order_by(), where_in(), or_where_in(), where_not_in(), or_where_not_in(), insert(), insert_batch().
        • +
        • Added support for join() with multiple conditions.
        • +
        • Added support for USING in join().
        • +
        • Added support for EXISTS in where().
        • +
        • Added seed values support for random ordering with order_by(seed, 'RANDOM').
        • +
        • Changed limit() to ignore NULL values instead of always casting to integer.
        • +
        • Changed offset() to ignore empty values instead of always casting to integer.
        • +
        • Methods insert_batch() and update_batch() now return an integer representing the number of rows affected by them.
        • +
        • Methods where(), or_where(), having() and or_having() now convert trailing = and <>, != SQL operators to IS NULL and IS NOT NULL respectively when the supplied comparison value is NULL.
        • +
        • Added method chaining support to reset_query(), start_cache(), stop_cache() and flush_cache().
        • +
        • Added an optional second parameter to count_all_results() to disable resetting of QB values.
        • +
        +
      • +
      • Database Results changes include:
          +
        • Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
        • +
        • Added method unbuffered_row() for fetching a row without prefetching the whole result (consume less memory).
        • +
        • Renamed former method _data_seek() to data_seek() and made it public.
        • +
        +
      • +
      • Improved support for the MySQLi driver, including:
          +
        • OOP style usage of the PHP extension is now used, instead of the procedural aliases.
        • +
        • Server version checking is now done via mysqli::$server_info instead of running an SQL query.
        • +
        • Added persistent connections support for PHP >= 5.3.
        • +
        • Added support for configuring socket pipe connections.
        • +
        • Added support for backup() in Database Utilities.
        • +
        • Changed methods trans_begin(), trans_commit() and trans_rollback() to use the PHP API instead of sending queries.
        • +
        +
      • +
      • Improved support of the PDO driver, including:
          +
        • Added support for create_database(), drop_database() and drop_table() in Database Forge.
        • +
        • Added support for list_fields() in Database Results.
        • +
        • Subdrivers are now isolated from each other instead of being in one large class.
        • +
        +
      • +
      • Improved support of the PostgreSQL driver, including:
          +
        • pg_version() is now used to get the database version number, when possible.
        • +
        • Added db_set_charset() support.
        • +
        • Added support for optimize_table() in Database Utilities (rebuilds table indexes).
        • +
        • Added boolean data type support in escape().
        • +
        • Added update_batch() support.
        • +
        • Removed limit() and order_by() support for UPDATE and DELETE queries as PostgreSQL does not support those features.
        • +
        • Added a work-around for dead persistent connections to be re-created after a database restart.
        • +
        • Changed db_connect() to include the (new) schema value into Postgre’s search_path session variable.
        • +
        • pg_escape_literal() is now used for escaping strings, if available.
        • +
        +
      • +
      • Improved support of the CUBRID driver, including:
          +
        • Added DSN string support.
        • +
        • Added persistent connections support.
        • +
        • Improved list_databases() in Database Utility (until now only the currently used database was returned).
        • +
        +
      • +
      • Improved support of the MSSQL and SQLSRV drivers, including:
          +
        • Added random ordering support.
        • +
        • Added support for optimize_table() in Database Utility.
        • +
        • Added escaping with QUOTE_IDENTIFIER setting detection.
        • +
        • Added port handling support for UNIX-based systems (MSSQL driver).
        • +
        • Added OFFSET support for SQL Server 2005 and above.
        • +
        • Added db_set_charset() support (MSSQL driver).
        • +
        • Added a scrollable property to enable configuration of the cursor to use (SQLSRV driver).
        • +
        • Added support and auto-detection for the SQLSRV_CURSOR_CLIENT_BUFFERED scrollable cursor flag (SQLSRV driver).
        • +
        • Changed default behavior to not use SQLSRV_CURSOR_STATIC due to performance issues (SQLSRV driver).
        • +
        +
      • +
      • Improved support of the Oracle (OCI8) driver, including:
          +
        • Added DSN string support (Easy Connect and TNS).
        • +
        • Added support for drop_table() in Database Forge.
        • +
        • Added support for list_databases() in Database Utilities.
        • +
        • Generally improved for speed and cleaned up all of its components.
        • +
        • num_rows() is now only called explicitly by the developer and no longer re-executes statements.
        • +
        +
      • +
      • Improved support of the SQLite driver, including: +
      • +
      • Database Forge changes include:
          +
        • Added an optional second parameter to drop_table() that allows adding the IF EXISTS condition, which is no longer the default.
        • +
        • Added support for passing a custom database object to the loader.
        • +
        • Added support for passing custom table attributes (such as ENGINE for MySQL) to create_table().
        • +
        • Added support for usage of the FIRST clause in add_column() for MySQL and CUBRID.
        • +
        • Added partial support for field comments (MySQL, PostgreSQL, Oracle).
        • +
        • Deprecated add_column()’s third method. AFTER clause should now be added to the field definition array instead.
        • +
        • Overall improved support for all of the drivers.
        • +
        +
      • +
      • Database Utility changes include:
          +
        • Added support for passing a custom database object to the loader.
        • +
        • Modified the class to no longer extend Database Forge, which has been a deprecated behavior for awhile.
        • +
        • Overall improved support for all of the drivers.
        • +
        • Added foreign_key_checks option to MySQL/MySQLi backup, allowing statement to disable/re-enable foreign key checks to be inserted into the backup output.
        • +
        +
      • +
      +
    • +
    • Libraries
        +
      • Added a new Encryption Library to replace the old, largely insecure Encrypt Library.
      • +
      • Encrypt Library changes include:
          +
        • Deprecated the library in favor of the new Encryption Library.
        • +
        • Added support for hashing algorithms other than SHA1 and MD5.
        • +
        • Removed previously deprecated sha1() method.
        • +
        +
      • +
      • Session Library changes include:
          +
        • Completely re-written the library to use self-contained drivers via $config['sess_driver'].
        • +
        • Added ‘files’, ‘database’, ‘redis’ and ‘memcached’ drivers (using ‘files’ by default).
        • +
        • Added $config['sess_save_path'] setting to specify where the session data is stored, depending on the driver.
        • +
        • Dropped support for storing session data in cookies (which renders $config['sess_encrypt_cookie'] useless and is therefore also removed).
        • +
        • Dropped official support for storing session data in databases other than MySQL and PostgreSQL.
        • +
        • Changed table structure for the ‘database’ driver.
        • +
        • Added a new tempdata feature that allows setting userdata items with expiration time (mark_as_temp(), tempdata(), set_tempdata(), unset_tempdata()).
        • +
        • Changed method keep_flashdata() to also accept an array of keys.
        • +
        • Changed methods userdata(), flashdata() to return an array of all userdata/flashdata when no parameter is passed.
        • +
        • Deprecated method all_userdata() - it is now just an alias for userdata() with no parameters.
        • +
        • Added method has_userdata() that verifies the existence of a userdata item.
        • +
        • Added debug level log messages for key events in the session validation process.
        • +
        • Dropped support for the sess_match_useragent option.
        • +
        +
      • +
      • File Uploading Library changes include:
          +
        • Added method chaining support.
        • +
        • Added support for using array notation in file field names.
        • +
        • Added max_filename_increment and file_ext_tolower configuration settings.
        • +
        • Added min_width and min_height configuration settings for images.
        • +
        • Added mod_mime_fix configuration setting to disable suffixing multiple file extensions with an underscore.
        • +
        • Added the possibility pass allowed_types as an array.
        • +
        • Added an $index parameter to the method data().
        • +
        • Added a $reset parameter to method initialize().
        • +
        • Removed method clean_file_name() and its usage in favor of Security Library’s sanitize_filename().
        • +
        • Removed method mimes_types().
        • +
        • Changed CI_Upload::_prep_filename() to simply replace all (but the last) dots in the filename with underscores, instead of suffixing them.
        • +
        +
      • +
      • Calendar Library changes include:
          +
        • Added method chaining support.
        • +
        • Added configuration to generate days of other months instead of blank cells.
        • +
        • Added auto-configuration for next_prev_url if it is empty and show_prev_next is set to TRUE.
        • +
        • Added support for templating via an array in addition to the encoded string.
        • +
        • Changed method get_total_days() to be an alias for Date Helper days_in_month().
        • +
        +
      • +
      • Cart Library changes include:
          +
        • Deprecated the library as too specific for CodeIgniter.
        • +
        • Added method remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility.
        • +
        • Added method get_item() to enable retrieving data for a single cart item.
        • +
        • Added unicode support for product names.
        • +
        • Added support for disabling product name strictness via the $product_name_safe property.
        • +
        • Changed insert() method to auto-increment quantity for an item when inserted twice instead of resetting it.
        • +
        • Changed update() method to support updating all properties attached to an item and not to require ‘qty’.
        • +
        +
      • +
      • Image Manipulation Library changes include:
          +
        • The initialize() method now only sets existing class properties.
        • +
        • Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
        • +
        • Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method if they are set manually after initialization.
        • +
        • If property maintain_ratio is set to TRUE, image_reproportion() now doesn’t need both width and height to be specified.
        • +
        • Property maintain_ratio is now taken into account when resizing images using ImageMagick library.
        • +
        • Added support for maintaining transparency for PNG images when watermarking.
        • +
        • Added a file_permissions setting.
        • +
        +
      • +
      • Form Validation Library changes include:
          +
        • Added method error_array() to return all error messages as an array.
        • +
        • Added method set_data() to set an alternative data array to be validated instead of the default $_POST.
        • +
        • Added method reset_validation() which resets internal validation variables in case of multiple validation routines.
        • +
        • Added support for setting error delimiters in the config file via $config['error_prefix'] and $config['error_suffix'].
        • +
        • Internal method _execute() now considers input data to be invalid if a specified rule is not found.
        • +
        • Removed method is_numeric() as it exists as a native PHP function and _execute() will find and use that (the is_numeric rule itself is deprecated since 1.6.1).
        • +
        • Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
        • +
        • Updated method set_rules() to accept an array of rules as well as a string.
        • +
        • Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous).
        • +
        • Added rule differs to check if the value of a field differs from the value of another field.
        • +
        • Added rule valid_url.
        • +
        • Added rule in_list to check if the value of a field is within a given list.
        • +
        • Added support for named parameters in error messages.
        • +
        • Language line keys must now be prefixed with form_validation_.
        • +
        • Added rule alpha_numeric_spaces.
        • +
        • Added support for custom error messages per field rule.
        • +
        • Added support for callable rules when they are passed as an array.
        • +
        • Added support for non-ASCII domains in valid_email rule, depending on the Intl extension.
        • +
        • Changed the debug message about an error message not being set to include the rule name it is about.
        • +
        +
      • +
      • Caching Library changes include:
          +
        • Added Wincache driver.
        • +
        • Added Redis driver.
        • +
        • Added a key_prefix option for cache IDs.
        • +
        • Updated driver is_supported() methods to log at the “debug” level.
        • +
        • Added option to store raw values instead of CI-formatted ones (APC, Memcache).
        • +
        • Added atomic increment/decrement feature via increment(), decrement().
        • +
        +
      • +
      • E-mail Library changes include:
          +
        • Added a custom filename parameter to attach() as $this->email->attach($filename, $disposition, $newname).
        • +
        • Added possibility to send attachment as buffer string in attach() as $this->email->attach($buffer, $disposition, $newname, $mime).
        • +
        • Added possibility to attach remote files by passing a URL.
        • +
        • Added method attachment_cid() to enable embedding inline attachments into HTML.
        • +
        • Added dsn (delivery status notification) option.
        • +
        • Renamed method _set_header() to set_header() and made it public to enable adding custom headers.
        • +
        • Successfully sent emails will automatically clear the parameters.
        • +
        • Added a return_path parameter to the from() method.
        • +
        • Removed the second parameter (character limit) from internal method _prep_quoted_printable() as it is never used.
        • +
        • Internal method _prep_quoted_printable() will now utilize the native quoted_printable_encode(), imap_8bit() functions (if available) when CRLF is set to “rn”.
        • +
        • Default charset now relies on the global $config['charset'] setting.
        • +
        • Removed unused protected method _get_ip() (Input Library’s ip_address() should be used anyway).
        • +
        • Internal method _prep_q_encoding() now utilizes PHP’s mbstring and iconv extensions (when available) and no longer has a second ($from) argument.
        • +
        • Added an optional parameter to print_debugger() to allow specifying which parts of the message should be printed (‘headers’, ‘subject’, ‘body’).
        • +
        • Added SMTP keepalive option to avoid opening the connection for each send() call. Accessible as $smtp_keepalive.
        • +
        • Public method set_header() now filters the input by removing all “\r” and “\n” characters.
        • +
        • Added support for non-ASCII domains in valid_email(), depending on the Intl extension.
        • +
        +
      • +
      • Pagination Library changes include:
          +
        • Deprecated usage of the “anchor_class” setting (use the new “attributes” setting instead).
        • +
        • Added method chaining support to initialize() method.
        • +
        • Added support for the anchor “rel” attribute.
        • +
        • Added support for setting custom attributes.
        • +
        • Added support for language translations of the first_link, next_link, prev_link and last_link values.
        • +
        • Added support for $config['num_links'] = 0 configuration.
        • +
        • Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
        • +
        • Added $config['use_global_url_suffix'] to allow overriding the library ‘suffix’ value with that of the global $config['url_suffix'] setting.
        • +
        • Removed the default &nbsp; from a number of the configuration variables.
        • +
        +
      • +
      • Profiler Library changes include:
          +
        • Database object names are now being displayed.
        • +
        • The sum of all queries running times in seconds is now being displayed.
        • +
        • Added support for displaying the HTTP DNT (“Do Not Track”) header.
        • +
        • Added support for displaying $_FILES.
        • +
        +
      • +
      • Migration Library changes include:
          +
        • Added support for timestamp-based migrations (enabled by default).
        • +
        • Added $config['migration_type'] to allow switching between sequential and timestamp migrations.
        • +
        +
      • +
      • XML-RPC Library changes include:
          +
        • Added the ability to use a proxy.
        • +
        • Added Basic HTTP authentication support.
        • +
        +
      • +
      • User Agent Library changes include:
          +
        • Added check to detect if robots are pretending to be mobile clients (helps with e.g. Google indexing mobile website versions).
        • +
        • Added method parse() to allow parsing a custom user-agent string, different from the current visitor’s.
        • +
        +
      • +
      • HTML Table Library changes include:
          +
        • Added method chaining support.
        • +
        • Added support for setting table class defaults in a config file.
        • +
        +
      • +
      • Zip Library changes include:
          +
        • Method read_file() can now also alter the original file path/name while adding files to an archive.
        • +
        • Added support for changing the compression level.
        • +
        +
      • +
      • Trackback Library method receive() will now utilize iconv() if it is available but mb_convert_encoding() is not.
      • +
      +
    • +
    • Core
        +
      • Routing changes include:
          +
        • Added support for multiple levels of controller directories.
        • +
        • Added support for per-directory default_controller and 404_override classes.
        • +
        • Added possibility to route requests using HTTP verbs.
        • +
        • Added possibility to route requests using callbacks.
        • +
        • Added a new reserved route (translate_uri_dashes) to allow usage of dashes in the controller and method URI segments.
        • +
        • Deprecated methods fetch_directory(), fetch_class() and fetch_method() in favor of their respective public properties.
        • +
        • Removed method _set_overrides() and moved its logic to the class constructor.
        • +
        +
      • +
      • URI Library changes include:
          +
        • Added conditional PCRE UTF-8 support to the “invalid URI characters” check and removed the preg_quote() call from it to allow more flexibility.
        • +
        • Renamed method _filter_uri() to filter_uri().
        • +
        • Changed method filter_uri() to accept by reference and removed its return value.
        • +
        • Changed private methods to protected so that MY_URI can override them.
        • +
        • Renamed internal method _parse_cli_args() to _parse_argv().
        • +
        • Renamed internal method _detect_uri() to _parse_request_uri().
        • +
        • Changed _parse_request_uri() to accept absolute URIs for compatibility with HTTP/1.1 as per RFC2616 <http://www.ietf.org/rfc/rfc2616.txt>.
        • +
        • Added protected method _parse_query_string() to URI paths in the the QUERY_STRING value, like _parse_request_uri() does.
        • +
        • Changed URI string detection logic to always default to REQUEST_URI unless configured otherwise or under CLI.
        • +
        • Removed methods _remove_url_suffix(), _explode_segments() and moved their logic into _set_uri_string().
        • +
        • Removed method _fetch_uri_string() and moved its logic into the class constructor.
        • +
        • Removed method _reindex_segments().
        • +
        +
      • +
      • Loader Library changes include:
          +
        • Added method chaining support.
        • +
        • Added method get_vars() to the Loader to retrieve all variables loaded with $this->load->vars().
        • +
        • _ci_autoloader() is now a protected method.
        • +
        • Added autoloading of drivers with $autoload['drivers'].
        • +
        • $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as <?= will always be available.
        • +
        • Changed method config() to return whatever CI_Config::load() returns instead of always being void.
        • +
        • Added support for library and model aliasing on autoload.
        • +
        • Changed method is_loaded() to ask for the (case sensitive) library name instead of its instance name.
        • +
        • Removed $_base_classes property and unified all class data in $_ci_classes instead.
        • +
        • Added method clear_vars() to allow clearing the cached variables for views.
        • +
        +
      • +
      • Input Library changes include:
          +
        • Deprecated the $config['global_xss_filtering'] setting.
        • +
        • Added method() to retrieve $_SERVER['REQUEST_METHOD'].
        • +
        • Added support for arrays and network addresses (e.g. 192.168.1.1/24) for use with the proxy_ips setting.
        • +
        • Added method input_stream() to aid in using php://input stream data such as one passed via PUT, DELETE and PATCH requests.
        • +
        • Changed method valid_ip() to use PHP’s native filter_var() function.
        • +
        • Changed internal method _sanitize_globals() to skip enforcing reversal of register_globals in PHP 5.4+, where this functionality no longer exists.
        • +
        • Changed methods get(), post(), get_post(), cookie(), server(), user_agent() to return NULL instead of FALSE when no value is found.
        • +
        • Changed default value of the $xss_clean parameter to NULL for all methods that utilize it, the default value is now determined by the $config['global_xss_filtering'] setting.
        • +
        • Added method post_get() and changed get_post() to search in GET data first. Both methods’ names now properly match their GET/POST data search priorities.
        • +
        • Changed method _fetch_from_array() to parse array notation in field name.
        • +
        • Changed method _fetch_from_array() to allow retrieving multiple fields at once.
        • +
        • Added an option for _clean_input_keys() to return FALSE instead of terminating the whole script.
        • +
        • Deprecated the is_cli_request() method, it is now an alias for the new is_cli() common function.
        • +
        • Added an $xss_clean parameter to method user_agent() and removed the $user_agent property.
        • +
        • Added property $raw_input_stream to access php://input data.
        • +
        +
      • +
      • Common functions changes include:
          +
        • Added function get_mimes() to return the application/config/mimes.php array.
        • +
        • Added support for HTTP code 303 (“See Other”) in set_status_header().
        • +
        • Removed redundant conditional to determine HTTP server protocol in set_status_header().
        • +
        • Renamed _exception_handler() to _error_handler() and replaced it with a real exception handler.
        • +
        • Changed _error_handler() to respect php.ini display_errors setting.
        • +
        • Added function is_https() to check if a secure connection is used.
        • +
        • Added function is_cli() to replace the CI_Input::is_cli_request() method.
        • +
        • Added function function_usable() to work around a bug in Suhosin <http://www.hardened-php.net/suhosin/>.
        • +
        • Removed the third ($php_error) argument from function log_message().
        • +
        • Changed internal function load_class() to accept a constructor parameter instead of (previously unused) class name prefix.
        • +
        • Removed default parameter value of is_php().
        • +
        • Added a second argument $double_encode to html_escape().
        • +
        • Changed function config_item() to return NULL instead of FALSE when no value is found.
        • +
        • Changed function set_status_header() to return immediately when run under CLI.
        • +
        +
      • +
      • Output Library changes include:
          +
        • Added a second argument to method set_content_type() that allows setting the document charset as well.
        • +
        • Added methods get_content_type() and get_header().
        • +
        • Added method delete_cache().
        • +
        • Added configuration option $config['cache_query_string'] to enable taking the query string into account when caching.
        • +
        • Changed caching behavior to compress the output before storing it, if $config['compress_output'] is enabled.
        • +
        +
      • +
      • Config Library changes include:
          +
        • Changed site_url() method to accept an array as well.
        • +
        • Removed internal method _assign_to_config() and moved its implementation to CodeIgniter.php instead.
        • +
        • item() now returns NULL instead of FALSE when the required config item doesn’t exist.
        • +
        • Added an optional second parameter to both base_url() and site_url() that allows enforcing of a protocol different than the one in the base_url configuration setting.
        • +
        • Added HTTP “Host” header character validation to prevent cache poisoning attacks when base_url auto-detection is used.
        • +
        +
      • +
      • Security Library changes include:
          +
        • Added $config['csrf_regeneration'], which makes CSRF token regeneration optional.
        • +
        • Added $config['csrf_exclude_uris'], allowing for exclusion of URIs from the CSRF protection (regular expressions are supported).
        • +
        • Added method strip_image_tags().
        • +
        • Added method get_random_bytes() and switched CSRF & XSS token generation to use it.
        • +
        • Modified method sanitize_filename() to read a public $filename_bad_chars property for getting the invalid characters list.
        • +
        • Return status code of 403 instead of a 500 if CSRF protection is enabled but a token is missing from a request.
        • +
        +
      • +
      • Language Library changes include:
          +
        • Changed method load() to filter the language name with ctype_alpha().
        • +
        • Changed method load() to also accept an array of language files.
        • +
        • Added an optional second parameter to method line() to disable error logging for line keys that were not found.
        • +
        • Language files are now loaded in a cascading style with the one in system/ always loaded and overridden afterwards, if another one is found.
        • +
        +
      • +
      • Hooks Library changes include:
          +
        • Added support for closure hooks (or anything that is_callable() returns TRUE for).
        • +
        • Renamed method _call_hook() to call_hook().
        • +
        • Class instances are now stored in order to maintain their state.
        • +
        +
      • +
      • UTF-8 Library changes include:
          +
        • UTF8_ENABLED now requires only one of Multibyte String or iconv to be available instead of both.
        • +
        • Changed method clean_string() to utilize mb_convert_encoding() if it is available.
        • +
        • Renamed method _is_ascii() to is_ascii() and made it public.
        • +
        +
      • +
      • Log Library changes include:
          +
        • Added a $config['log_file_permissions'] setting.
        • +
        • Changed the library constructor to try to create the log_path directory if it doesn’t exist.
        • +
        • Added support for microseconds (“u” date format character) in $config['log_date_format'].
        • +
        +
      • +
      • Added compatibility layers for:
          +
        • Multibyte String (limited support).
        • +
        • Hash (hash_equals(), hash_pbkdf2()).
        • +
        • Password Hashing.
        • +
        • Standard Functions ``array_column()`, array_replace(), array_replace_recursive(), hex2bin(), quoted_printable_encode().
        • +
        +
      • +
      • Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
      • +
      • Added support for HTTP-Only cookies with new config option cookie_httponly (default FALSE).
      • +
      • $config['time_reference'] now supports all timezone strings supported by PHP.
      • +
      • Fatal PHP errors are now also passed to _error_handler(), so they can be logged.
      • +
      +
    • +
    +
    +

    Bug fixes for 3.0

    +
      +
    • Fixed a bug where unlink() raised an error if cache file did not exist when you try to delete it.
    • +
    • Fixed a bug (#181) - a typo in the form validation language file.
    • +
    • Fixed a bug (#159, #163) - Query Builder nested transactions didn’t work properly due to $_trans_depth not being incremented.
    • +
    • Fixed a bug (#737, #75) - Pagination anchor class was not set properly when using initialize method.
    • +
    • Fixed a bug (#419) - URL Helper auto_link() didn’t recognize URLs that come after a word boundary.
    • +
    • Fixed a bug (#724) - Form Validation Library rule is_unique didn’t check if a database connection exists.
    • +
    • Fixed a bug (#647) - Zip Library internal method _get_mod_time() didn’t suppress possible “stat failed” errors generated by filemtime().
    • +
    • Fixed a bug (#157, #174) - Image Manipulation Library method clear() didn’t completely clear properties.
    • +
    • Fixed a bug where Database Forge method create_table() with PostgreSQL database could lead to fetching the whole table.
    • +
    • Fixed a bug (#795) - Form Helper form_open() didn’t add the default form method and accept-charset when an empty array is passed to it.
    • +
    • Fixed a bug (#797) - Date Helper timespan() was using incorrect seconds for year and month.
    • +
    • Fixed a bug in Cart Library method contents() where if called without a TRUE (or equal) parameter, it would fail due to a typo.
    • +
    • Fixed a bug (#406) - SQLSRV DB driver not returning resource on db_pconnect().
    • +
    • Fixed a bug in Image Manipulation Library method gd_loaded() where it was possible for the script execution to end or a PHP E_WARNING message to be emitted.
    • +
    • Fixed a bug in the Pagination library where when use_page_numbers=TRUE previous link and page 1 link did not have the same url.
    • +
    • Fixed a bug (#561) - errors in XML-RPC Library were not properly escaped.
    • +
    • Fixed a bug (#904) - Loader Library method initialize() caused a PHP Fatal error to be triggered if error level E_STRICT is used.
    • +
    • Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to ‘on’.
    • +
    • Fixed a bug (#154) - Session Library method sess_update() caused the session to be destroyed on pages where multiple AJAX requests were executed at once.
    • +
    • Fixed a possible bug in Input Libary method is_ajax_request() where some clients might not send the X-Requested-With HTTP header value exactly as ‘XmlHttpRequest’.
    • +
    • Fixed a bug (#1039) - Database Utilities internal method _backup() method failed for the ‘mysql’ driver due to a table name not being escaped.
    • +
    • Fixed a bug (#1070) - CI_DB_driver::initialize() didn’t set a character set if a database is not selected.
    • +
    • Fixed a bug (#177) - Form Validation Library method set_value() didn’t set the default value if POST data is NULL.
    • +
    • Fixed a bug (#68, #414) - :Oracle’s escape_str() didn’t properly escape LIKE wild characters.
    • +
    • Fixed a bug (#81) - ODBC’s list_fields() and field_data() methods skipped the first column due to odbc_field_*() functions’ index starting at 1 instead of 0.
    • +
    • Fixed a bug (#129) - ODBC’s num_rows() method returned -1 in some cases, due to not all subdrivers supporting the odbc_num_rows() function.
    • +
    • Fixed a bug (#153) - E_NOTICE being generated by getimagesize() in the File Uploading Library.
    • +
    • Fixed a bug (#611) - SQLSRV’s error handling methods used to issue warnings when there’s no actual error.
    • +
    • Fixed a bug (#1036) - is_write_type() method in the Database Library didn’t return TRUE for RENAME queries.
    • +
    • Fixed a bug in PDO’s _version() method where it used to return the client version as opposed to the server one.
    • +
    • Fixed a bug in PDO’s insert_id() method where it could’ve failed if it’s used with Postgre versions prior to 8.1.
    • +
    • Fixed a bug in CUBRID’s affected_rows() method where a connection resource was passed to cubrid_affected_rows() instead of a result.
    • +
    • Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset instead.
    • +
    • Fixed a bug (#413) - Oracle’s error handling methods used to only return connection-related errors.
    • +
    • Fixed a bug (#1101) - Database Result method field_data() for ‘mysql’, ‘mysqli’ drivers was implemented as if it was handling a DESCRIBE result instead of the actual result set.
    • +
    • Fixed a bug in Oracle’s Database Forge method _create_table() where it failed with AUTO_INCREMENT as it’s not supported.
    • +
    • Fixed a bug (#1080) - when using the SMTP protocol, Email Library method send() was returning TRUE even if the connection/authentication against the server failed.
    • +
    • Fixed a bug (#306) - ODBC’s insert_id() method was calling non-existent function odbc_insert_id(), which resulted in a fatal error.
    • +
    • Fixed a bug in Oracle’s Database Result implementation where the cursor ID passed to it was always NULL.
    • +
    • Fixed a bug (#64) - Regular expression in DB_query_builder.php failed to handle queries containing SQL bracket delimiters in the JOIN condition.
    • +
    • Fixed a bug in the Session Library where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right.
    • +
    • Fixed a bug (#501) - Form Validation Library method set_rules() depended on count($_POST) instead of actually checking if the request method ‘POST’ before aborting.
    • +
    • Fixed a bug (#136) - PostgreSQL and MySQL’s escape_str() method didn’t properly escape LIKE wild characters.
    • +
    • Fixed a bug in Loader Library method library() where some PHP versions wouldn’t execute the class constructor.
    • +
    • Fixed a bug (#88) - An unexisting property was used for configuration of the Memcache cache driver.
    • +
    • Fixed a bug (#14) - Database Forge method create_database() didn’t utilize the configured database character set.
    • +
    • Fixed a bug (#23, #1238) - Database Caching method delete_all() used to delete .htaccess and index.html files, which is a potential security risk.
    • +
    • Fixed a bug in Trackback Library method validate_url() where it didn’t actually do anything, due to input not being passed by reference.
    • +
    • Fixed a bug (#11, #183, #863) - Form Validation Library method _execute() silently continued to the next rule, if a rule method/function is not found.
    • +
    • Fixed a bug (#122) - routed URI string was being reported incorrectly in sub-directories.
    • +
    • Fixed a bug (#1241) - Zip Library method read_dir() wasn’t compatible with Windows.
    • +
    • Fixed a bug (#306) - ODBC driver didn’t have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
    • +
    • Fixed a bug in MSSQL and SQLSrv’s _truncate() where the TABLE keyword was missing.
    • +
    • Fixed a bug in PDO’s trans_commit() method where it failed due to an erroneous property name.
    • +
    • Fixed a bug (#798) - Query Builder method update() used to ignore LIKE conditions that were set with like().
    • +
    • Fixed a bug in Oracle’s and MSSQL’s delete() methods where an erroneous SQL statement was generated when used with limit().
    • +
    • Fixed a bug in SQLSRV’s delete() method where like() and limit() conditions were ignored.
    • +
    • Fixed a bug (#1265) - Database connections were always closed, regardless of the ‘pconnect’ option value.
    • +
    • Fixed a bug (#128) - Language Library did not correctly keep track of loaded language files.
    • +
    • Fixed a bug (#1349) - File Uploading Library method get_extension() returned the original filename when it didn’t have an actual extension.
    • +
    • Fixed a bug (#1273) - Query Builder method set_update_batch() generated an E_NOTICE message.
    • +
    • Fixed a bug (#44, #110) - File Uploading Library method clean_file_name() didn’t clear ‘!’ and ‘#’ characters.
    • +
    • Fixed a bug (#121) - Database Results method row() returned an array when there’s no actual result to be returned.
    • +
    • Fixed a bug (#319) - SQLSRV’s affected_rows() method failed due to a scrollable cursor being created for write-type queries.
    • +
    • Fixed a bug (#356) - Database driver ‘postgre’ didn’t have an _update_batch() method, which resulted in fatal error being triggered when update_batch() is used with it.
    • +
    • Fixed a bug (#784, #862) - Database Forge method create_table() failed on SQLSRV/MSSQL when used with ‘IF NOT EXISTS’.
    • +
    • Fixed a bug (#1419) - Driver Library had a static variable that was causing an error.
    • +
    • Fixed a bug (#1411) - the Email Library used its own short list of MIMEs instead the one from config/mimes.php.
    • +
    • Fixed a bug where php.ini setting magic_quotes_runtime wasn’t turned off for PHP 5.3 (where it is indeed deprecated, but not non-existent).
    • +
    • Fixed a bug (#666) - Output Library method set_content_type() didn’t set the document charset.
    • +
    • Fixed a bug (#784, #861) - Database Forge method create_table() used to accept constraints for MSSQL/SQLSRV integer-type columns.
    • +
    • Fixed a bug (#706) - SQLSRV/MSSSQL Database drivers didn’t escape field names.
    • +
    • Fixed a bug (#1452) - Query Builder method protect_identifiers() didn’t properly detect identifiers with spaces in their names.
    • +
    • Fixed a bug where Query Builder method protect_identifiers() ignored its extra arguments when the value passed to it is an array.
    • +
    • Fixed a bug where Query Builder internal method _has_operator() didn’t detect BETWEEN.
    • +
    • Fixed a bug where Query Builder method join() failed with identifiers containing dashes.
    • +
    • Fixed a bug (#1264) - Database Forge and Database Utilities didn’t update/reset the databases and tables list cache when a table or a database is created, dropped or renamed.
    • +
    • Fixed a bug (#7) - Query Builder method join() only escaped one set of conditions.
    • +
    • Fixed a bug (#1321) - CI_Exceptions couldn’t find the errors/ directory in some cases.
    • +
    • Fixed a bug (#1202) - Encrypt Library encode_from_legacy() didn’t set back the encrypt mode on failure.
    • +
    • Fixed a bug (#145) - Database Class method compile_binds() failed when the bind marker was present in a literal string within the query.
    • +
    • Fixed a bug in Query Builder method protect_identifiers() where if passed along with the field names, operators got escaped as well.
    • +
    • Fixed a bug (#10) - URI Library internal method _detect_uri() failed with paths containing a colon.
    • +
    • Fixed a bug (#1387) - Query Builder method from() didn’t escape table aliases.
    • +
    • Fixed a bug (#520) - Date Helper function :php:func:nice_date() failed when the optional second parameter is not passed.
    • +
    • Fixed a bug (#318) - Profiling Library setting query_toggle_count was not settable as described in the manual.
    • +
    • Fixed a bug (#938) - Config Library method site_url() added a question mark to the URL string when query strings are enabled even if it already existed.
    • +
    • Fixed a bug (#999) - Config Library method site_url() always appended $config['url_suffix'] to the end of the URL string, regardless of whether a query string exists in it.
    • +
    • Fixed a bug where URL Helper function anchor_popup() ignored the attributes argument if it is not an array.
    • +
    • Fixed a bug (#1328) - Form Validation Library didn’t properly check the type of the form fields before processing them.
    • +
    • Fixed a bug (#79) - Form Validation Library didn’t properly validate array fields that use associative keys or have custom indexes.
    • +
    • Fixed a bug (#427) - Form Validation Library method strip_image_tags() was an alias to a non-existent method.
    • +
    • Fixed a bug (#1545) - Query Builder method limit() wasn’t executed properly under Oracle.
    • +
    • Fixed a bug (#1551) - Date Helper function standard_date() didn’t properly format W3C and ATOM standard dates.
    • +
    • Fixed a bug where Query Builder method join() escaped literal values as if they were fields.
    • +
    • Fixed a bug (#135) - PHP Error logging was impossible without the errors being displayed.
    • +
    • Fixed a bug (#1613) - Form Helper functions form_multiselect(), form_dropdown() didn’t properly handle empty array option groups.
    • +
    • Fixed a bug (#1605) - Pagination Library produced incorrect previous and next link values.
    • +
    • Fixed a bug in SQLSRV’s affected_rows() method where an erroneous function name was used.
    • +
    • Fixed a bug (#1000) - Change syntax of $view_file to $_ci_view_file to prevent being overwritten by application.
    • +
    • Fixed a bug (#1757) - Directory Helper function directory_map() was skipping files and directories named ‘0’.
    • +
    • Fixed a bug (#1789) - Database Library method escape_str() escaped quote characters in LIKE conditions twice under MySQL.
    • +
    • Fixed a bug (#395) - Unit Testing Library method result() didn’t properly check array result columns when called from report().
    • +
    • Fixed a bug (#1692) - Database Class method display_error() didn’t properly trace the possible error source on Windows systems.
    • +
    • Fixed a bug (#1745) - Database Class method is_write_type() didn’t return TRUE for LOAD queries.
    • +
    • Fixed a bug (#1765) - Database Class didn’t properly detect connection errors for the ‘mysqli’ driver.
    • +
    • Fixed a bug (#1257) - Query Builder used to (unnecessarily) group FROM clause contents, which breaks certain queries and is invalid for some databases.
    • +
    • Fixed a bug (#1709) - Email headers were broken when using long email subjects and rn as CRLF.
    • +
    • Fixed a bug where MB_ENABLED constant was only declared if UTF8_ENABLED was set to TRUE.
    • +
    • Fixed a bug where the Session Library accepted cookies with last_activity values being in the future.
    • +
    • Fixed a bug (#1897) - Email Library triggered PHP E_WARNING errors when mail protocol used and to() is never called.
    • +
    • Fixed a bug (#1409) - Email Library didn’t properly handle multibyte characters when applying Q-encoding to headers.
    • +
    • Fixed a bug where Email Library ignored its wordwrap setting while handling alternative messages.
    • +
    • Fixed a bug (#1476, #1909) - Pagination Library didn’t take into account actual routing when determining the current page.
    • +
    • Fixed a bug (#1766) - Query Builder didn’t always take into account the dbprefix setting.
    • +
    • Fixed a bug (#779) - URI Class didn’t always trim slashes from the uri_string as shown in the documentation.
    • +
    • Fixed a bug (#134) - Database Caching method delete_cache() didn’t work in some cases due to cachedir not being initialized properly.
    • +
    • Fixed a bug (#191) - Loader Library ignored attempts for (re)loading databases to get_instance()->db even when the old database connection is dead.
    • +
    • Fixed a bug (#1255) - User Agent Library method is_referral() only checked if $_SERVER['HTTP_REFERER'] exists.
    • +
    • Fixed a bug (#1146) - Download Helper function force_download() incorrectly sent Cache-Control directives pre-check and post-check to Internet Explorer.
    • +
    • Fixed a bug (#1811) - URI Library didn’t properly cache segments for uri_to_assoc() and ruri_to_assoc().
    • +
    • Fixed a bug (#1506) - Form Helpers set empty name attributes.
    • +
    • Fixed a bug (#59) - Query Builder method count_all_results() ignored the DISTINCT clause.
    • +
    • Fixed a bug (#1624) - Form Validation Library rule matches didn’t property handle array field names.
    • +
    • Fixed a bug (#1630) - Form Helper function set_value() didn’t escape HTML entities.
    • +
    • Fixed a bug (#142) - Form Helper function form_dropdown() didn’t escape HTML entities in option values.
    • +
    • Fixed a bug (#50) - Session Library unnecessarily stripped slashed from serialized data, making it impossible to read objects in a namespace.
    • +
    • Fixed a bug (#658) - Routing wildcard :any didn’t work as advertised and matched multiple URI segments instead of all characters within a single segment.
    • +
    • Fixed a bug (#1938) - Email Library removed multiple spaces inside a pre-formatted plain text message.
    • +
    • Fixed a bug (#122) - URI Library method ruri_string() didn’t include a directory if one is used.
    • +
    • Fixed a bug - Routing Library didn’t properly handle default_controller in a subdirectory when a method is also specified.
    • +
    • Fixed a bug (#953) - post_controller_constructor hook wasn’t called with a 404_override.
    • +
    • Fixed a bug (#1220) - Profiler Library didn’t display information for database objects that are instantiated inside models.
    • +
    • Fixed a bug (#1978) - Directory Helper function directory_map()’s return array didn’t make a distinction between directories and file indexes when a directory with a numeric name is present.
    • +
    • Fixed a bug (#777) - Loader Library didn’t look for helper extensions in added package paths.
    • +
    • Fixed a bug (#18) - APC Cache driver didn’t (un)serialize data, resulting in failure to store objects.
    • +
    • Fixed a bug (#188) - Unit Testing Library filled up logs with error messages for non-existing language keys.
    • +
    • Fixed a bug (#113) - Form Validation Library didn’t properly handle empty fields that were specified as an array.
    • +
    • Fixed a bug (#2061) - Routing Class didn’t properly sanitize directory, controller and function triggers with enable_query_strings set to TRUE.
    • +
    • Fixed a bug - SQLSRV didn’t support escape_like_str() or escaping an array of values.
    • +
    • Fixed a bug - Database Results method list_fields() didn’t reset its field pointer for the ‘mysql’, ‘mysqli’ and ‘mssql’ drivers.
    • +
    • Fixed a bug (#2211) - Migration Library extensions couldn’t execute CI_Migration::__construct().
    • +
    • Fixed a bug (#2255) - Email Library didn’t apply smtp_timeout to socket reads and writes.
    • +
    • Fixed a bug (#2239) - Email Library improperly handled the Subject when used with bcc_batch_mode resulting in E_WARNING messages and an empty Subject.
    • +
    • Fixed a bug (#2234) - Query Builder didn’t reset JOIN cache for write-type queries.
    • +
    • Fixed a bug (#2298) - Database Results method next_row() kept returning the last row, allowing for infinite loops.
    • +
    • Fixed a bug (#2236, #2639) - Form Helper functions set_value(), set_select(), set_radio(), set_checkbox() didn’t parse array notation for keys if the rule was not present in the Form Validation Library.
    • +
    • Fixed a bug (#2353) - Query Builder erroneously prefixed literal strings with dbprefix.
    • +
    • Fixed a bug (#78) - Cart Library didn’t allow non-English letters in product names.
    • +
    • Fixed a bug (#77) - Database Class didn’t properly handle the transaction “test mode” flag.
    • +
    • Fixed a bug (#2380) - URI Routing method fetch_method() returned ‘index’ if the requested method name matches its controller name.
    • +
    • Fixed a bug (#2388) - Email Library used to ignore attachment errors, resulting in broken emails being sent.
    • +
    • Fixed a bug (#2498) - Form Validation Library rule valid_base64 only checked characters instead of actual validity.
    • +
    • Fixed a bug (#2425) - OCI8 database driver method stored_procedure() didn’t log an error unless db_debug was set to TRUE.
    • +
    • Fixed a bug (#2490) - Database Class method query() returning boolean instead of a result object for PostgreSQL-specific INSERT INTO … RETURNING statements.
    • +
    • Fixed a bug (#249) - Cache Library didn’t properly handle Memcache(d) configurations with missing options.
    • +
    • Fixed a bug (#180) - config_item() didn’t take into account run-time configuration changes.
    • +
    • Fixed a bug (#2551) - Loader Library method library() didn’t properly check if a class that is being loaded already exists.
    • +
    • Fixed a bug (#2560) - Form Helper function form_open() set the ‘method=”post”’ attribute only if the passed attributes equaled an empty string.
    • +
    • Fixed a bug (#2585) - Query Builder methods min(), max(), avg(), sum() didn’t escape field names.
    • +
    • Fixed a bug (#2590) - Common function log_message() didn’t actually cache the CI_Log class instance.
    • +
    • Fixed a bug (#2609) - Common function get_config() optional argument was only effective on first function call. Also, it can now add items, in addition to updating existing items.
    • +
    • Fixed a bug in the ‘postgre’ database driver where the connection ID wasn’t passed to pg_escape_string().
    • +
    • Fixed a bug (#33) - Script execution was terminated when an invalid cookie key was encountered.
    • +
    • Fixed a bug (#2691) - nested database transactions could end in a deadlock when an error is encountered with db_debug set to TRUE.
    • +
    • Fixed a bug (#2515) - _exception_handler() used to send the 200 “OK” HTTP status code and didn’t stop script exection even on fatal errors.
    • +
    • Fixed a bug - Redis Caching driver didn’t handle connection failures properly.
    • +
    • Fixed a bug (#2756) - Database Class executed the MySQL-specific SET SESSION sql_mode query for all drivers when the ‘stricton’ option is set.
    • +
    • Fixed a bug (#2579) - Query Builder “no escape” functionality didn’t work properly with query cache.
    • +
    • Fixed a bug (#2237) - Parser Library failed if the same tag pair is used more than once within a template.
    • +
    • Fixed a bug (#2143) - Form Validation Library didn’t check for rule groups named in a controller/method manner when trying to load from a config file.
    • +
    • Fixed a bug (#2762) - Hooks Class didn’t properly check if the called class/function exists.
    • +
    • Fixed a bug (#148) - Input Library internal method _clean_input_data() assumed that it data is URL-encoded, stripping certain character sequences from it.
    • +
    • Fixed a bug (#346) - with $config['global_xss_filtering'] turned on, the $_GET, $_POST, $_COOKIE and $_SERVER superglobals were overwritten during initialization time, resulting in XSS filtering being either performed twice or there was no possible way to get the original data, even though options for this do exist.
    • +
    • Fixed an edge case (#555) - User Agent Library reported an incorrect version Opera 10+ due to a non-standard user-agent string.
    • +
    • Fixed a bug (#133) - Text Helper ascii_to_entities() stripped the last character if it happens to be in the extended ASCII group.
    • +
    • Fixed a bug (#2822) - fwrite() was used incorrectly throughout the whole framework, allowing incomplete writes when writing to a network stream and possibly a few other edge cases.
    • +
    • Fixed a bug where User Agent Library methods accept_charset() and accept_lang() didn’t properly parse HTTP headers that contain spaces.
    • +
    • Fixed a bug where default_controller was called instad of triggering a 404 error if the current route is in a controller directory.
    • +
    • Fixed a bug (#2737) - XML-RPC Library used objects as array keys, which triggered E_NOTICE messages.
    • +
    • Fixed a bug (#2771) - Security Library method xss_clean() didn’t take into account HTML5 entities.
    • +
    • Fixed a bug (#2856) - ODBC method affected_rows() passed an incorrect value to odbc_num_rows().
    • +
    • Fixed a bug (#43) Image Manipulation Library method text_watermark() didn’t properly determine watermark placement.
    • +
    • Fixed a bug where HTML Table Library ignored its auto_heading setting if headings were not already set.
    • +
    • Fixed a bug (#2364) - Pagination Library appended the query string (if used) multiple times when there are successive calls to create_links() with no initialize() in between them.
    • +
    • Partially fixed a bug (#261) - UTF-8 class method clean_string() generating log messages and/or not producing the desired result due to an upstream bug in iconv.
    • +
    • Fixed a bug where CI_Xmlrpcs::parseRequest() could fail if $HTTP_RAW_POST_DATA is not populated.
    • +
    • Fixed a bug in Zip Library internal method _get_mod_time() where it was not parsing result returned by filemtime().
    • +
    • Fixed a bug (#3161) - Cache Library methods increment(), decrement() didn’t auto-create non-existent items when using redis and/or file storage.
    • +
    • Fixed a bug (#3189) - Parser Library used double replacement on key->value pairs, exposing a potential template injection vulnerability.
    • +
    • Fixed a bug (#3573) - Email Library violated RFC5321 by sending ‘localhost.localdomain’ as a hostname.
    • +
    • Fixed a bug (#3572) - CI_Security::_remove_evil_attributes() failed for large-sized inputs due to pcre.backtrack_limit and didn’t properly match HTML tags.
    • +
    +
    +
    +
    +

    Version 2.2.3

    +

    Release Date: July 14, 2015

    +
      +
    • Security
        +
      • Removed a fallback to mysql_escape_string() in the ‘mysql’ database driver (escape_str() method) when there’s no active database connection.
      • +
      +
    • +
    +
    +
    +

    Version 2.2.2

    +

    Release Date: April 15, 2015

    +
      +
    • General Changes
        +
      • Added HTTP “Host” header character validation to prevent cache poisoning attacks when base_url auto-detection is used.
      • +
      • Added FSCommand and seekSegmentTime to the “evil attributes” list in CI_Security::xss_clean().
      • +
      +
    • +
    +
    +

    Bug fixes for 2.2.2

    +
      +
    • Fixed a bug (#3665) - CI_Security::entity_decode() triggered warnings under some circumstances.
    • +
    +
    +
    +
    +

    Version 2.2.1

    +

    Release Date: January 22, 2015

    +
      +
    • General Changes
        +
      • Improved security in xss_clean().
      • +
      • Updated timezones in Date Helper.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.2.1

    +
      +
    • Fixed a bug (#3094) - Internal method CI_Input::_clean_input_data() breaks encrypted session cookies.
    • +
    • Fixed a bug (#2268) - Security Library method xss_clean() didn’t properly match JavaScript events.
    • +
    • Fixed a bug (#3309) - Security Library method xss_clean() used an overly-invasive pattern to strip JS event handlers.
    • +
    • Fixed a bug (#2771) - Security Library method xss_clean() didn’t take into account HTML5 entities.
    • +
    • Fixed a bug (#73) - Security Library method sanitize_filename() could be tricked by an XSS attack.
    • +
    • Fixed a bug (#2681) - Security Library method entity_decode() used the PREG_REPLACE_EVAL flag, which is deprecated since PHP 5.5.
    • +
    • Fixed a bug (#3302) - Internal function get_config() triggered an E_NOTICE message on PHP 5.6.
    • +
    • Fixed a bug (#2508) - Config Library didn’t properly detect if the current request is via HTTPS.
    • +
    • Fixed a bug (#3314) - SQLSRV Database driver’s method count_all() didn’t escape the supplied table name.
    • +
    • Fixed a bug (#3404) - MySQLi Database driver’s method escape_str() had a wrong fallback to mysql_escape_string() when there was no active connection.
    • +
    • Fixed a bug in the Session Library where session ID regeneration occurred during AJAX requests.
    • +
    +
    +
    +
    +

    Version 2.2.0

    +

    Release Date: June 2, 2014

    +
      +
    • General Changes
        +
      • Security: Encrypt Library method xor_encode() has been removed. The Encrypt Class now requires the Mcrypt extension to be installed.
      • +
      • Security: The Session Library now uses HMAC authentication instead of a simple MD5 checksum.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.2.0

    +
      +
    • Fixed an edge case (#2583) in the Email Library where Suhosin <http://www.hardened-php.net/suhosin/> blocked messages sent via mail() due to trailing newspaces in headers.
    • +
    • Fixed a bug (#696) - make oci_execute() calls inside num_rows() non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don’t need to be committed.
    • +
    • Fixed a bug (#2689) - Database Force methods create_table(), drop_table() and rename_table() produced broken SQL for tge ‘sqlsrv’ driver.
    • +
    • Fixed a bug (#2427) - PDO Database driver didn’t properly check for query failures.
    • +
    • Fixed a bug in the Session Library where authentication was not performed for encrypted cookies.
    • +
    +
    +
    +
    +

    Version 2.1.4

    +

    Release Date: July 8, 2013

    +
      +
    • General Changes
        +
      • Improved security in xss_clean().
      • +
      +
    • +
    +
    +

    Bug fixes for 2.1.4

    +
      +
    • Fixed a bug (#1936) - Migration Library method latest() had a typo when retrieving language values.
    • +
    • Fixed a bug (#2021) - Migration Library configuration file was mistakenly using Windows style line feeds.
    • +
    • Fixed a bug (#1273) - E_NOTICE being generated by Query Builder’s set_update_batch() method.
    • +
    • Fixed a bug (#2337) - Email Library method print_debugger() didn’t apply htmlspecialchars() to headers.
    • +
    +
    +
    +
    +

    Version 2.1.3

    +

    Release Date: October 8, 2012

    + +
    +

    Bug fixes for 2.1.3

    +
      +
    • Fixed a bug (#1543) - File-based Caching method get_metadata() used a non-existent array key to look for the TTL value.
    • +
    • Fixed a bug (#1314) - Session Library method sess_destroy() didn’t destroy the userdata array.
    • +
    • Fixed a bug (#804) - Profiler library was trying to handle objects as strings in some cases, resulting in E_WARNING messages being issued by htmlspecialchars().
    • +
    • Fixed a bug (#1699) - Migration Library ignored the $config['migration_path'] setting.
    • +
    • Fixed a bug (#227) - Input Library allowed unconditional spoofing of HTTP clients’ IP addresses through the HTTP_CLIENT_IP header.
    • +
    • Fixed a bug (#907) - Input Library ignored HTTP_X_CLUSTER_CLIENT_IP and HTTP_X_CLIENT_IP headers when checking for proxies.
    • +
    • Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid.
    • +
    • Fixed a bug (#499) - Security Library where a CSRF cookie was created even if $config['csrf_protection'] is set to FALSE.
    • +
    • Fixed a bug (#1715) - Input Library triggered csrf_verify() on CLI requests.
    • +
    • Fixed a bug (#751) - Query Builder didn’t properly handle cached field escaping overrides.
    • +
    • Fixed a bug (#2004) - Query Builder didn’t properly merge cached calls with non-cache ones.
    • +
    +
    +
    +
    +

    Version 2.1.2

    +

    Release Date: June 29, 2012

    +
      +
    • General Changes
        +
      • Improved security in xss_clean().
      • +
      +
    • +
    +
    +
    +

    Version 2.1.1

    +

    Release Date: June 12, 2012

    +
      +
    • General Changes
        +
      • Fixed support for docx, xlsx files in mimes.php.
      • +
      +
    • +
    • Libraries +
    • +
    • Helpers
        +
      • url_title() performance and output improved. You can now use any string as the word delimiter, but ‘dash’ and ‘underscore’ are still supported.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.1.1

    +
      +
    • Fixed a bug (#697) - A wrong array key was used in the File Uploading Library to check for mime-types.
    • +
    • Fixed a bug - form_open() compared $action against site_url() instead of base_url().
    • +
    • Fixed a bug - CI_Upload::_file_mime_type() could’ve failed if mime_content_type() is used for the detection and returns FALSE.
    • +
    • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Library to create a new file.
    • +
    • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
    • +
    • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
    • +
    • Fixed a bug (#726) - PDO put a ‘dbname’ argument in its connection string regardless of the database platform in use, which made it impossible to use SQLite.
    • +
    • Fixed a bug - CI_DB_pdo_driver::num_rows() was not returning properly value with SELECT queries, cause it was relying on PDOStatement::rowCount().
    • +
    • Fixed a bug (#1059) - CI_Image_lib::clear() was not correctly clearing all necessary object properties, namely width and height.
    • +
    +
    +
    +
    +

    Version 2.1.0

    +

    Release Date: November 14, 2011

    +
      +
    • General Changes
        +
      • Callback validation rules can now accept parameters like any other +validation rule.
      • +
      • Added html_escape() to Common +functions to escape HTML output +for preventing XSS.
      • +
      +
    • +
    • Helpers
        +
      • Added increment_string() to String +Helper to turn “foo” into “foo-1” +or “foo-1” into “foo-2”.
      • +
      • Altered form helper - made action on form_open_multipart helper +function call optional. Fixes (#65)
      • +
      • url_title() will now trim extra dashes from beginning and end.
      • +
      • Improved speed of String Helper’s random_string() method
      • +
      +
    • +
    • Database
        +
      • Added a CUBRID driver to the Database +Driver. Thanks to the CUBRID team for +supplying this patch.
      • +
      • Added a PDO driver to the Database Driver.
      • +
      • Typecast limit and offset in the Database +Driver to integers to avoid possible +injection.
      • +
      • Added additional option ‘none’ for the optional third argument for +$this->db->like() in the Database +Driver.
      • +
      • Added $this->db->insert_batch() support to the OCI8 (Oracle) driver.
      • +
      • Added failover if the main connections in the config should fail
      • +
      +
    • +
    • Libraries
        +
      • Changed $this->cart->insert() in the Cart +Library to return the Row ID if a single +item was inserted successfully.
      • +
      • Added support to set an optional parameter in your callback rules +of validation using the Form Validation +Library.
      • +
      • Added a Migration library to assist with applying +incremental updates to your database schema.
      • +
      • Driver children can be located in any package path.
      • +
      • Added max_filename_increment config setting for Upload library.
      • +
      • Added is_unique to the Form Validation library.
      • +
      • Added $config[‘use_page_numbers’] to the Pagination library, which enables real page numbers in the URI.
      • +
      • Added TLS and SSL Encryption for SMTP.
      • +
      +
    • +
    • Core
        +
      • Changed private functions in CI_URI to protected so MY_URI can +override them.
      • +
      • Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
      • +
      +
    • +
    +
    +

    Bug fixes for 2.1.0

    +
      +
    • Fixed #378 Robots identified as regular browsers by the User Agent +class.
    • +
    • If a config class was loaded first then a library with the same name +is loaded, the config would be ignored.
    • +
    • Fixed a bug (Reactor #19) where 1) the 404_override route was being +ignored in some cases, and 2) auto-loaded libraries were not +available to the 404_override controller when a controller existed +but the requested method did not.
    • +
    • Fixed a bug (Reactor #89) where MySQL export would fail if the table +had hyphens or other non alphanumeric/underscore characters.
    • +
    • Fixed a bug (#105) that stopped query errors from being logged unless database debugging was enabled
    • +
    • Fixed a bug (#160) - Removed unneeded array copy in the file cache +driver.
    • +
    • Fixed a bug (#150) - field_data() now correctly returns column +length.
    • +
    • Fixed a bug (#8) - load_class() now looks for core classes in +APPPATH first, allowing them to be replaced.
    • +
    • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
    • +
    • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
    • +
    • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error “user_data does not have a default value” when deleting then creating a session.
    • +
    • Fixed a bug (#112) - OCI8 (Oracle) driver didn’t pass the configured database character set when connecting.
    • +
    • Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.
    • +
    • Fixed a bug (#82) - WHERE clause field names in the DB update_string() method were not escaped, resulting in failed queries in some cases.
    • +
    • Fixed a bug (#89) - Fix a variable type mismatch in DB display_error() where an array is expected, but a string could be set instead.
    • +
    • Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)
    • +
    • Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).
    • +
    • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection.
    • +
    • Fixed a bug (#537) - Support for all wav type in browser.
    • +
    • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
    • +
    • Fixed invalid date time format in Date helper and XMLRPC library.
    • +
    • Fixed a bug (#200) - MySQL queries would be malformed after calling db->count_all() then db->get().
    • +
    +
    +
    +
    +

    Version 2.0.3

    +

    Release Date: August 20, 2011

    +
      +
    • Security

      +
        +
      • An improvement was made to the MySQL and MySQLi drivers to prevent +exposing a potential vector for SQL injection on sites using +multi-byte character sets in the database client connection. +An incompatibility in PHP versions < 5.2.3 and MySQL < 5.0.7 with +mysql_set_charset() creates a situation where using multi-byte +character sets on these environments may potentially expose a SQL +injection attack vector. Latin-1, UTF-8, and other “low ASCII” +character sets are unaffected on all environments.

        +

        If you are running or considering running a multi-byte character +set for your database connection, please pay close attention to +the server environment you are deploying on to ensure you are not +vulnerable.

        +
      • +
      +
    • +
    • General Changes

      +
        +
      • Fixed a bug where there was a misspelling within a code comment in +the index.php file.
      • +
      • Added Session Class userdata to the output profiler. Additionally, +added a show/hide toggle on HTTP Headers, Session Data and Config +Variables.
      • +
      • Removed internal usage of the EXT constant.
      • +
      • Visual updates to the welcome_message view file and default error +templates. Thanks to danijelb +for the pull request.
      • +
      • Added insert_batch() function to the PostgreSQL database driver. +Thanks to epallerols for the patch.
      • +
      • Added “application/x-csv” to mimes.php.
      • +
      • Fixed a bug where Email library +attachments with a “.” in the name would using invalid MIME-types.
      • +
      +
    • +
    • Helpers

      +
        +
      • Added an optional third parameter to heading() which allows adding +html attributes to the rendered heading tag.
      • +
      • form_open() now only adds a hidden (Cross-site Reference Forgery) +protection field when the form’s action is internal and is set to +the post method. (Reactor #165)
      • +
      • Re-worked plural() and singular() functions in the Inflector +helper to support considerably +more words.
      • +
      +
    • +
    • Libraries

      +
        +
      • Altered Session to use a longer match against the user_agent +string. See upgrade notes if using database sessions.
      • +
      • Added $this->db->set_dbprefix() to the Database +Driver.
      • +
      • Changed $this->cart->insert() in the Cart +Library to return the Row ID if a single +item was inserted successfully.
      • +
      • Added $this->load->get_var() to the Loader +library to retrieve global vars set with +$this->load->view() and $this->load->vars().
      • +
      • Changed $this->db->having() to insert quotes using escape() rather +than escape_str().
      • +
      +
    • +
    +
    +

    Bug fixes for 2.0.3

    +
      +
    • Added ENVIRONMENT to reserved constants. (Reactor #196)
    • +
    • Changed server check to ensure SCRIPT_NAME is defined. (Reactor #57)
    • +
    • Removed APPPATH.’third_party’ from the packages autoloader to negate +needless file stats if no packages exist or if the developer does not +load any other packages by default.
    • +
    • Fixed a bug (Reactor #231) where Sessions Library database table +example SQL did not contain an index on last_activity. See Upgrade +Notes.
    • +
    • Fixed a bug (Reactor #229) where the Sessions Library example SQL in +the documentation contained incorrect SQL.
    • +
    • Fixed a bug (Core #340) where when passing in the second parameter to +$this->db->select(), column names in subsequent queries would not be +properly escaped.
    • +
    • Fixed issue #199 - Attributes passed as string does not include a +space between it and the opening tag.
    • +
    • Fixed a bug where the method $this->cart->total_items() from Cart +Library now returns the sum of the quantity +of all items in the cart instead of your total count.
    • +
    • Fixed a bug where not setting ‘null’ when adding fields in db_forge +for mysql and mysqli drivers would default to NULL instead of NOT +NULL as the docs suggest.
    • +
    • Fixed a bug where using $this->db->select_max(), +$this->db->select_min(), etc could throw notices. Thanks to w43l for +the patch.
    • +
    • Replace checks for STDIN with php_sapi_name() == ‘cli’ which on the +whole is more reliable. This should get parameters in crontab +working.
    • +
    +
    +
    +
    +

    Version 2.0.2

    +

    Release Date: April 7, 2011 +Hg Tag: v2.0.2

    +
      +
    • General changes
        +
      • The Security library was moved to +the core and is now loaded automatically. Please remove your +loading calls.
      • +
      • The CI_SHA class is now deprecated. All supported versions of PHP +provide a sha1() function.
      • +
      • constants.php will now be loaded from the environment folder if +available.
      • +
      • Added language key error logging
      • +
      • Made Environment Support optional. Comment out or delete the +constant to stop environment checks.
      • +
      • Added Environment Support for Hooks.
      • +
      • Added CI_ Prefix to the Cache driver.
      • +
      • Added CLI usage documentation.
      • +
      +
    • +
    • Helpers
        +
      • Removed the previously deprecated dohash() from the Security +helper; use do_hash() instead.
      • +
      • Changed the ‘plural’ function so that it doesn’t ruin the +captalization of your string. It also take into consideration +acronyms which are all caps.
      • +
      +
    • +
    • Database
        +
      • $this->db->count_all_results() will now return an integer +instead of a string.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.0.2

    +
      +
    • Fixed a bug (Reactor #145) where the Output Library had +parse_exec_vars set to protected.
    • +
    • Fixed a bug (Reactor #80) where is_really_writable would create an +empty file when on Windows or with safe_mode enabled.
    • +
    • Fixed various bugs with User Guide.
    • +
    • Added is_cli_request() method to documentation for Input +class.
    • +
    • Added form_validation_lang entries for decimal, less_than and +greater_than.
    • +
    • Fixed issue #153 Escape Str Bug in MSSQL driver.
    • +
    • Fixed issue #172 Google Chrome 11 posts incorrectly when action is empty.
    • +
    +
    +
    +
    +

    Version 2.0.1

    +

    Release Date: March 15, 2011 +Hg Tag: v2.0.1

    +
      +
    • General changes
        +
      • Added $config[‘cookie_secure’] to the config file to allow +requiring a secure (HTTPS) in order to set cookies.
      • +
      • Added the constant CI_CORE to help differentiate between Core: +TRUE and Reactor: FALSE.
      • +
      • Added an ENVIRONMENT constant in index.php, which affects PHP +error reporting settings, and optionally, which configuration +files are loaded (see below). Read more on the Handling +Environments page.
      • +
      • Added support for +environment-specific +configuration files.
      • +
      +
    • +
    • Libraries
        +
      • Added decimal, less_than and greater_than rules to the Form +validation Class.
      • +
      • Input Class methods post() and get() +will now return a full array if the first argument is not +provided.
      • +
      • Secure cookies can now be made with the set_cookie() helper and +Input Class method.
      • +
      • Added set_content_type() to Output +Class to set the output Content-Type +HTTP header based on a MIME Type or a config/mimes.php array key.
      • +
      • Output Class will now support method +chaining.
      • +
      +
    • +
    • Helpers
        +
      • Changed the logic for form_open() in Form +helper. If no value is passed it will +submit to the current URL.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.0.1

    +
      +
    • CLI requests can now be run from any folder, not just when CD’ed next +to index.php.
    • +
    • Fixed issue #41: Added audio/mp3 mime type to mp3.
    • +
    • Fixed a bug (Core #329) where the file caching driver referenced the +incorrect cache directory.
    • +
    • Fixed a bug (Reactor #69) where the SHA1 library was named +incorrectly.
    • +
    +
    +
    +
    +

    Version 2.0.0

    +

    Release Date: January 28, 2011 +Hg Tag: v2.0.0

    +
      +
    • General changes
        +
      • PHP 4 support is removed. CodeIgniter now requires PHP 5.1.6.
      • +
      • Scaffolding, having been deprecated for a number of versions, has +been removed.
      • +
      • Plugins have been removed, in favor of Helpers. The CAPTCHA plugin +has been converted to a Helper and +documented. The JavaScript +calendar plugin was removed due to the ready availability of great +JavaScript calendars, particularly with jQuery.
      • +
      • Added new special Library type: +Drivers.
      • +
      • Added full query-string support. See the config file for details.
      • +
      • Moved the application folder outside of the system folder.
      • +
      • Moved system/cache and system/logs directories to the application +directory.
      • +
      • Added routing overrides to the main index.php file, enabling the +normal routing to be overridden on a per “index” file basis.
      • +
      • Added the ability to set config values (or override config values) +directly from data set in the main index.php file. This allows a +single application to be used with multiple front controllers, +each having its own config values.
      • +
      • Added $config[‘directory_trigger’] to the config file so that a +controller sub-directory can be specified when running _GET +strings instead of URI segments.
      • +
      • Added ability to set “Package” paths - specific paths where the +Loader and Config classes should try to look first for a requested +file. This allows distribution of sub-applications with their own +libraries, models, config files, etc. in a single “package” +directory. See the Loader class +documentation for more details.
      • +
      • In-development code is now hosted at BitBucket .
      • +
      • Removed the deprecated Validation Class.
      • +
      • Added CI_ Prefix to all core classes.
      • +
      • Package paths can now be set in application/config/autoload.php.
      • +
      • Upload library file_name can +now be set without an extension, the extension will be taken from +the uploaded file instead of the given name.
      • +
      • In Database Forge the name can be omitted +from $this->dbforge->modify_column()’s 2nd param if you aren’t +changing the name.
      • +
      • $config[‘base_url’] is now empty by default and will guess what +it should be.
      • +
      • Enabled full Command Line Interface compatibility with +config[‘uri_protocol’] = ‘CLI’;.
      • +
      +
    • +
    • Libraries
        +
      • Added a Cache driver with APC, +memcached, and file-based support.
      • +
      • Added $prefix, $suffix and $first_url properties to Pagination +library.
      • +
      • Added the ability to suppress first, previous, next, last, and +page links by setting their values to FALSE in the Pagination +library.
      • +
      • Added Security library, which now +contains the xss_clean function, filename_security function and +other security related functions.
      • +
      • Added CSRF (Cross-site Reference Forgery) protection to the +Security library.
      • +
      • Added $parse_exec_vars property to Output library.
      • +
      • Added ability to enable / disable individual sections of the +Profiler
      • +
      • Added a wildcard option $config[‘allowed_types’] = ‘*’ to the +File Uploading Class.
      • +
      • Added an ‘object’ config variable to the XML-RPC Server library so +that one can specify the object to look for requested methods, +instead of assuming it is in the $CI superobject.
      • +
      • Added “is_object” into the list of unit tests capable of being +run.
      • +
      • Table library will generate an empty cell with a blank string, or +NULL value.
      • +
      • Added ability to set tag attributes for individual cells in the +Table library
      • +
      • Added a parse_string() method to the Parser +Class.
      • +
      • Added HTTP headers and Config information to the +Profiler output.
      • +
      • Added Chrome and Flock to the list of detectable browsers by +browser() in the User Agent Class.
      • +
      • The Unit Test Class now has an +optional “notes” field available to it, and allows for discrete +display of test result items using +$this->unit->set_test_items().
      • +
      • Added a $xss_clean class variable to the XMLRPC library, enabling +control over the use of the Security library’s xss_clean() +method.
      • +
      • Added a download() method to the FTP +library
      • +
      • Changed do_xss_clean() to return FALSE if the uploaded file +fails XSS checks.
      • +
      • Added stripslashes() and trim()ing of double quotes from $_FILES +type value to standardize input in Upload library.
      • +
      • Added a second parameter (boolean) to +$this->zip->read_dir(‘/path/to/directory’, FALSE) to remove the +preceding trail of empty folders when creating a Zip archive. This +example would contain a zip with “directory” and all of its +contents.
      • +
      • Added ability in the Image Library to handle PNG transparency for +resize operations when using the GD lib.
      • +
      • Modified the Session class to prevent use if no encryption key is +set in the config file.
      • +
      • Added a new config item to the Session class +sess_expire_on_close to allow sessions to auto-expire when the +browser window is closed.
      • +
      • Improved performance of the Encryption library on servers where +Mcrypt is available.
      • +
      • Changed the default encryption mode in the Encryption library to +CBC.
      • +
      • Added an encode_from_legacy() method to provide a way to +transition encrypted data from CodeIgniter 1.x to CodeIgniter 2.x. +Please see the upgrade +instructions for details.
      • +
      • Altered Form_Validation library to allow for method chaining on +set_rules(), set_message() and set_error_delimiters() +functions.
      • +
      • Altered Email Library to allow for method chaining.
      • +
      • Added request_headers(), get_request_header() and +is_ajax_request() to the input class.
      • +
      • Altered User agent library so that +is_browser(), is_mobile() and is_robot() can optionally check +for a specific browser or mobile device.
      • +
      • Altered Input library so that post() and +get() will return all POST and GET items (respectively) if there +are no parameters passed in.
      • +
      +
    • +
    • Database
        +
      • database configuration.
      • +
      • Added autoinit value to database +configuration.
      • +
      • Added stricton value to database +configuration.
      • +
      • Added database_exists() to the Database Utilities +Class.
      • +
      • Semantic change to db->version() function to allow a list of +exceptions for databases with functions to return version string +instead of specially formed SQL queries. Currently this list only +includes Oracle and SQLite.
      • +
      • Fixed a bug where driver specific table identifier protection +could lead to malformed queries in the field_data() functions.
      • +
      • Fixed a bug where an undefined class variable was referenced in +database drivers.
      • +
      • Modified the database errors to show the filename and line number +of the problematic query.
      • +
      • Removed the following deprecated functions: orwhere, orlike, +groupby, orhaving, orderby, getwhere.
      • +
      • Removed deprecated _drop_database() and _create_database() +functions from the db utility drivers.
      • +
      • Improved dbforge create_table() function for the Postgres driver.
      • +
      +
    • +
    • Helpers
        +
      • Added convert_accented_characters() function to text +helper.
      • +
      • Added accept-charset to the list of inserted attributes of +form_open() in the Form Helper.
      • +
      • Deprecated the dohash() function in favour of do_hash() for +naming consistency.
      • +
      • Non-backwards compatible change made to get_dir_file_info() in +the File Helper. No longer recurses +by default so as to encourage responsible use (this function can +cause server performance issues when used without caution).
      • +
      • Modified the second parameter of directory_map() in the +Directory Helper to accept an +integer to specify recursion depth.
      • +
      • Modified delete_files() in the File +Helper to return FALSE on failure.
      • +
      • Added an optional second parameter to byte_format() in the +Number Helper to allow for decimal +precision.
      • +
      • Added alpha, and sha1 string types to random_string() in the +String Helper.
      • +
      • Modified prep_url() so as to not prepend http&#58;// if the supplied +string already has a scheme.
      • +
      • Modified get_file_info in the file helper, changing filectime() +to filemtime() for dates.
      • +
      • Modified smiley_js() to add optional third parameter to return +only the javascript with no script tags.
      • +
      • The img() function of the HTML +helper will now generate an empty +string as an alt attribute if one is not provided.
      • +
      • If CSRF is enabled in the application config file, form_open() +will automatically insert it as a hidden field.
      • +
      • Added sanitize_filename() into the Security +helper.
      • +
      • Added ellipsize() to the Text +Helper
      • +
      • Added elements() to the Array +Helper
      • +
      +
    • +
    • Other Changes
        +
      • Added an optional second parameter to show_404() to disable +logging.
      • +
      • Updated loader to automatically apply the sub-class prefix as an +option when loading classes. Class names can be prefixed with the +standard “CI_” or the same prefix as the subclass prefix, or no +prefix at all.
      • +
      • Increased randomness with is_really_writable() to avoid file +collisions when hundreds or thousands of requests occur at once.
      • +
      • Switched some DIR_WRITE_MODE constant uses to FILE_WRITE_MODE +where files and not directories are being operated on.
      • +
      • get_mime_by_extension() is now case insensitive.
      • +
      • Added “default” to the list Reserved +Names.
      • +
      • Added ‘application/x-msdownload’ for .exe files and +‘application/x-gzip-compressed’ for .tgz files to +config/mimes.php.
      • +
      • Updated the output library to no longer compress output or send +content-length headers if the server runs with +zlib.output_compression enabled.
      • +
      • Eliminated a call to is_really_writable() on each request unless +it is really needed (Output caching)
      • +
      • Documented append_output() in the Output +Class.
      • +
      • Documented a second argument in the decode() function for the +Encrypt Class.
      • +
      • Documented db->close().
      • +
      • Updated the router to support a default route with any number of +segments.
      • +
      • Moved _remove_invisible_characters() function from the +Security Library to common +functions.
      • +
      • Added audio/mpeg3 as a valid mime type for MP3.
      • +
      +
    • +
    +
    +

    Bug fixes for 2.0.0

    +
      +
    • Fixed a bug where you could not change the User-Agent when sending +email.
    • +
    • Fixed a bug where the Output class would send incorrect cached output +for controllers implementing their own _output() method.
    • +
    • Fixed a bug where a failed query would not have a saved query +execution time causing errors in the Profiler
    • +
    • Fixed a bug that was writing log entries when multiple identical +helpers and plugins were loaded.
    • +
    • Fixed assorted user guide typos or examples (#10693, #8951, #7825, +#8660, #7883, #6771, #10656).
    • +
    • Fixed a language key in the profiler: “profiler_no_memory_usage” +to “profiler_no_memory”.
    • +
    • Fixed an error in the Zip library that didn’t allow downloading on +PHP 4 servers.
    • +
    • Fixed a bug in the Form Validation library where fields passed as +rule parameters were not being translated (#9132)
    • +
    • Modified inflector helper to properly pluralize words that end in +‘ch’ or ‘sh’
    • +
    • Fixed a bug in xss_clean() that was not allowing hyphens in query +strings of submitted URLs.
    • +
    • Fixed bugs in get_dir_file_info() and get_file_info() in the +File Helper with recursion, and file paths on Windows.
    • +
    • Fixed a bug where Active Record override parameter would not let you +disable Active Record if it was enabled in your database config file.
    • +
    • Fixed a bug in reduce_double_slashes() in the String Helper to +properly remove duplicate leading slashes (#7585)
    • +
    • Fixed a bug in values_parsing() of the XML-RPC library which +prevented NULL variables typed as ‘string’ from being handled +properly.
    • +
    • Fixed a bug were form_open_multipart() didn’t accept string +attribute arguments (#10930).
    • +
    • Fixed a bug (#10470) where get_mime_by_extension() was case +sensitive.
    • +
    • Fixed a bug where some error messages for the SQLite and Oracle +drivers would not display.
    • +
    • Fixed a bug where files created with the Zip Library would result in +file creation dates of 1980.
    • +
    • Fixed a bug in the Session library that would result in PHP error +when attempting to store values with objects.
    • +
    • Fixed a bug where extending the Controller class would result in a +fatal PHP error.
    • +
    • Fixed a PHP Strict Standards Error in the index.php file.
    • +
    • Fixed a bug where getimagesize() was being needlessly checked on +non-image files in is_allowed_type().
    • +
    • Fixed a bug in the Encryption library where an empty key was not +triggering an error.
    • +
    • Fixed a bug in the Email library where CC and BCC recipients were not +reset when using the clear() method (#109).
    • +
    • Fixed a bug in the URL Helper where prep_url() could cause a PHP +error on PHP versions < 5.1.2.
    • +
    • Added a log message in core/output if the cache directory config +value was not found.
    • +
    • Fixed a bug where multiple libraries could not be loaded by passing +an array to load->library()
    • +
    • Fixed a bug in the html helper where too much white space was +rendered between the src and alt tags in the img() function.
    • +
    • Fixed a bug in the profilers _compile_queries() function.
    • +
    • Fixed a bug in the date helper where the DATE_ISO8601 variable was +returning an incorrectly formatted date string.
    • +
    +
    +
    +
    +

    Version 1.7.2

    +

    Release Date: September 11, 2009 +Hg Tag: v1.7.2

    +
      +
    • Libraries
        +
      • Added a new Cart Class.
      • +
      • Added the ability to pass $config[‘file_name’] for the File +Uploading Class and rename the +uploaded file.
      • +
      • Changed order of listed user-agents so Safari would more +accurately report itself. (#6844)
      • +
      +
    • +
    • Database
        +
      • Switched from using gettype() in escape() to is_* methods, since +future PHP versions might change its output.
      • +
      • Updated all database drivers to handle arrays in escape_str()
      • +
      • Added escape_like_str() method for escaping strings to be used +in LIKE conditions
      • +
      • Updated Active Record to utilize the new LIKE escaping mechanism.
      • +
      • Added reconnect() method to DB drivers to try to keep alive / +reestablish a connection after a long idle.
      • +
      • Modified MSSQL driver to use mssql_get_last_message() for error +messages.
      • +
      +
    • +
    • Helpers
        +
      • Added form_multiselect() to the Form +helper.
      • +
      • Modified form_hidden() in the Form +helper to accept multi-dimensional +arrays.
      • +
      • Modified form_prep() in the Form +helper to keep track of prepped +fields to avoid multiple prep/mutation from subsequent calls which +can occur when using Form Validation and form helper functions to +output form fields.
      • +
      • Modified directory_map() in the Directory +helper to allow the inclusion of +hidden files, and to return FALSE on failure to read directory.
      • +
      • Modified the Smiley helper to work +with multiple fields and insert the smiley at the last known +cursor position.
      • +
      +
    • +
    • General
        +
      • Compatible with PHP 5.3.0.
      • +
      • Modified show_error() to allow sending +of HTTP server response codes.
      • +
      • Modified show_404() to send 404 status +code, removing non-CGI compatible header() statement from +error_404.php template.
      • +
      • Added set_status_header() to the Common +functions to allow use when the +Output class is unavailable.
      • +
      • Added is_php() to Common +functions to facilitate PHP +version comparisons.
      • +
      • Added 2 CodeIgniter “cheatsheets” (thanks to DesignFellow.com for +this contribution).
      • +
      +
    • +
    +
    +

    Bug fixes for 1.7.2

    +
      +
    • Fixed assorted user guide typos or examples (#6743, #7214, #7516, +#7287, #7852, #8224, #8324, #8349).
    • +
    • Fixed a bug in the Form Validation library where multiple callbacks +weren’t working (#6110)
    • +
    • doctype helper default value was missing a “1”.
    • +
    • Fixed a bug in the language class when outputting an error for an +unfound file.
    • +
    • Fixed a bug in the Calendar library where the shortname was output +for “May”.
    • +
    • Fixed a bug with ORIG_PATH_INFO that was allowing URIs of just a +slash through.
    • +
    • Fixed a fatal error in the Oracle and ODBC drivers (#6752)
    • +
    • Fixed a bug where xml_from_result() was checking for a nonexistent +method.
    • +
    • Fixed a bug where Database Forge’s add_column and modify_column +were not looping through when sent multiple fields.
    • +
    • Fixed a bug where the File Helper was using ‘/’ instead of the +DIRECTORY_SEPARATOR constant.
    • +
    • Fixed a bug to prevent PHP errors when attempting to use sendmail on +servers that have manually disabled the PHP popen() function.
    • +
    • Fixed a bug that would cause PHP errors in XML-RPC data if the PHP +data type did not match the specified XML-RPC type.
    • +
    • Fixed a bug in the XML-RPC class with parsing dateTime.iso8601 data +types.
    • +
    • Fixed a case sensitive string replacement in xss_clean()
    • +
    • Fixed a bug in form_textarea() where form data was not prepped +correctly.
    • +
    • Fixed a bug in form_prep() causing it to not preserve entities in +the user’s original input when called back into a form element
    • +
    • Fixed a bug in _protect_identifiers() where the swap prefix +($swap_pre) was not being observed.
    • +
    • Fixed a bug where the 400 status header sent with the ‘disallowed URI +characters’ was not compatible with CGI environments.
    • +
    • Fixed a bug in the typography class where heading tags could have +paragraph tags inserted when using auto_typography().
    • +
    +
    +
    +
    +

    Version 1.7.1

    +

    Release Date: February 10, 2009 +Hg Tag: 1.7.1

    +
      +
    • Libraries
        +
      • Fixed an arbitrary script execution security flaw (#6068) in the +Form Validation library (thanks to hkk)
      • +
      • Changed default current page indicator in the Pagination library +to use <strong> instead of <b>
      • +
      • A “HTTP/1.1 400 Bad Request” header is now sent when disallowed +characters are encountered.
      • +
      • Added <big>, <small>, <q>, and <tt> to the Typography parser’s +inline elements.
      • +
      • Added more accurate error reporting for the Email library when +using sendmail.
      • +
      • Removed a strict type check from the rotate() function of the +Image Manipulation Class.
      • +
      • Added enhanced error checking in file saving in the Image library +when using the GD lib.
      • +
      • Added an additional newline between multipart email headers and +the MIME message text for better compatibility with a variety of +MUAs.
      • +
      • Made modest improvements to efficiency and accuracy of +explode_name() in the Image lib.
      • +
      +
    • +
    • Database
        +
      • Added where_in to the list of expected arguments received by +delete().
      • +
      +
    • +
    • Helpers
        +
      • Added the ability to have optgroups in form_dropdown() within the +form helper.
      • +
      • Added a doctype() function to the HTML +helper.
      • +
      • Added ability to force lowercase for url_title() in the URL +helper.
      • +
      • Changed the default “type” of form_button() to “button” from +“submit” in the form helper.
      • +
      • Changed redirect() in the URL helper to allow redirections to URLs +outside of the CI site.
      • +
      • Updated get_cookie() to try to fetch the cookie using the global +cookie prefix if the requested cookie name doesn’t exist.
      • +
      +
    • +
    • Other Changes
        +
      • Improved security in xss_clean() to help prevent attacks +targeting Internet Explorer.
      • +
      • Added ‘application/msexcel’ to config/mimes.php for .xls files.
      • +
      • Added ‘proxy_ips’ config item to whitelist reverse proxy servers +from which to trust the HTTP_X_FORWARDED_FOR header to to +determine the visitor’s IP address.
      • +
      • Improved accuracy of Upload::is_allowed_filetype() for images +(#6715)
      • +
      +
    • +
    +
    +

    Bug fixes for 1.7.1

    +
      +
    • Database
        +
      • Fixed a bug when doing ‘random’ on order_by() (#5706).
      • +
      • Fixed a bug where adding a primary key through Forge could fail +(#5731).
      • +
      • Fixed a bug when using DB cache on multiple databases (#5737).
      • +
      • Fixed a bug where TRUNCATE was not considered a “write” query +(#6619).
      • +
      • Fixed a bug where csv_from_result() was checking for a +nonexistent method.
      • +
      • Fixed a bug _protect_identifiers() where it was improperly +removing all pipe symbols from items
      • +
      +
    • +
    • Fixed assorted user guide typos or examples (#5998, #6093, #6259, +#6339, #6432, #6521).
    • +
    • Fixed a bug in the MySQLi driver when no port is specified
    • +
    • Fixed a bug (#5702), in which the field label was not being fetched +properly, when “matching” one field to another.
    • +
    • Fixed a bug in which identifers were not being escaped properly when +reserved characters were used.
    • +
    • Fixed a bug with the regular expression used to protect submitted +paragraph tags in auto typography.
    • +
    • Fixed a bug where double dashes within tag attributes were being +converted to em dash entities.
    • +
    • Fixed a bug where double spaces within tag attributes were being +converted to non-breaking space entities.
    • +
    • Fixed some accuracy issues with curly quotes in +Typography::format_characters()
    • +
    • Changed a few docblock comments to reflect actual return values.
    • +
    • Fixed a bug with high ascii characters in subject and from email +headers.
    • +
    • Fixed a bug in xss_clean() where whitespace following a validated +character entity would not be preserved.
    • +
    • Fixed a bug where HTML comments and <pre> tags were being parsed in +Typography::auto_typography().
    • +
    • Fixed a bug with non-breaking space cleanup in +Typography::auto_typography().
    • +
    • Fixed a bug in database escaping where a compound statement (ie: +SUM()) wasn’t handled correctly with database prefixes.
    • +
    • Fixed a bug when an opening quote is preceded by a paragraph tag and +immediately followed by another tag.
    • +
    • Fixed a bug in the Text Helper affecting some locales where +word_censor() would not work on words beginning or ending with an +accented character.
    • +
    • Fixed a bug in the Text Helper character limiter where the provided +limit intersects the last word of the string.
    • +
    • Fixed a bug (#6342) with plural() in the Inflection helper with words +ending in “y”.
    • +
    • Fixed bug (#6517) where Routed URI segments returned by +URI::rsegment() method were incorrect for the default controller.
    • +
    • Fixed a bug (#6706) in the Security Helper where xss_clean() was +using a deprecated second argument.
    • +
    • Fixed a bug in the URL helper url_title() function where trailing +periods were allowed at the end of a URL.
    • +
    • Fixed a bug (#6669) in the Email class when CRLF’s are used for the +newline character with headers when used with the “mail” protocol.
    • +
    • Fixed a bug (#6500) where URI::A_filter_uri() was exit()ing an +error instead of using show_error().
    • +
    • Fixed a bug (#6592) in the File Helper where get_dir_file_info() +where recursion was not occurring properly.
    • +
    • Tweaked Typography::auto_typography() for some edge-cases.
    • +
    +
    +
    +
    +

    Version 1.7

    +

    Release Date: October 23, 2008 +Hg Tag: 1.7.0

    +
      +
    • Libraries
        +
      • Added a new Form Validation +Class. It simplifies setting +rules and field names, supports arrays as field names, allows +groups of validation rules to be saved in a config file, and adds +some helper functions for use in view files. Please note that +the old Validation class is now deprecated. We will leave it in +the library folder for some time so that existing applications +that use it will not break, but you are encouraged to migrate to +the new version.
      • +
      • Updated the Sessions class so that +any custom data being saved gets stored to a database rather than +the session cookie (assuming you are using a database to store +session data), permitting much more data to be saved.
      • +
      • Added the ability to store libraries in subdirectories within +either the main “libraries” or the local application “libraries” +folder. Please see the Loader class for +more info.
      • +
      • Added the ability to assign library objects to your own variable +names when you use $this->load->library(). Please see the Loader +class for more info.
      • +
      • Added controller class/method info to Profiler +class and support for multiple database +connections.
      • +
      • Improved the “auto typography” feature and moved it out of the +helper into its own Typography +Class.
      • +
      • Improved performance and accuracy of xss_clean(), including +reduction of false positives on image/file tests.
      • +
      • Improved Parser class to allow +multiple calls to the parse() function. The output of each is +appended in the output.
      • +
      • Added max_filename option to set a file name length limit in the +File Upload Class.
      • +
      • Added set_status_header() function to Output +class.
      • +
      • Modified Pagination class to only +output the “First” link when the link for page one would not be +shown.
      • +
      • Added support for mb_strlen in the Form +Validation class so that +multi-byte languages will calculate string lengths properly.
      • +
      +
    • +
    • Database
        +
      • Improved Active Record class to allow full path column and table +names: hostname.database.table.column. Also improved the alias +handling.
      • +
      • Improved how table and column names are escaped and prefixed. It +now honors full path names when adding prefixes and escaping.
      • +
      • Added Active Record caching feature to “update” and “delete” +functions.
      • +
      • Added removal of non-printing control characters in escape_str() +of DB drivers that do not have native PHP escaping mechanisms +(mssql, oci8, odbc), to avoid potential SQL errors, and possible +sources of SQL injection.
      • +
      • Added port support to MySQL, MySQLi, and MS SQL database drivers.
      • +
      • Added driver name variable in each DB driver, based on bug report +#4436.
      • +
      +
    • +
    • Helpers
        +
      • Added several new “setting” functions to the Form +helper that allow POST data to be +retrieved and set into forms. These are intended to be used on +their own, or with the new Form Validation +Class.
      • +
      • Added current_url() and uri_segments() to URL +helper.
      • +
      • Altered auto_link() in the URL +helper so that email addresses with +“+” included will be linked.
      • +
      • Added meta() function to HTML +helper.
      • +
      • Improved accuracy of calculations in Number +helper.
      • +
      • Removed added newlines (“\n”) from most form and html helper +functions.
      • +
      • Tightened up validation in the Date +helper function human_to_unix(), +and eliminated the POSIX regex.
      • +
      • Updated Date helper to match the +world’s current time zones and offsets.
      • +
      • Modified url_title() in the URL +helper to remove characters and digits +that are part of character entities, to allow dashes, underscores, +and periods regardless of the $separator, and to allow uppercase +characters.
      • +
      • Added support for arbitrary attributes in anchor_popup() of the +URL helper.
      • +
      +
    • +
    • Other Changes
        +
      • Added PHP Style Guide to docs.
      • +
      • Added sanitization in xss_clean() for a deprecated HTML tag that +could be abused in user input in Internet Explorer.
      • +
      • Added a few openxml document mime types, and an additional mobile +agent to mimes.php and user_agents.php respectively.
      • +
      • Added a file lock check during caching, before trying to write to +the file.
      • +
      • Modified Cookie key cleaning to unset a few troublesome key names +that can be present in certain environments, preventing CI from +halting execution.
      • +
      • Changed the output of the profiler to use style attribute rather +than clear, and added the id “codeigniter_profiler” to the +container div.
      • +
      +
    • +
    +
    +

    Bug fixes for 1.7.0

    +
      +
    • Fixed bug in xss_clean() that could remove some desirable tag +attributes.
    • +
    • Fixed assorted user guide typos or examples (#4807, #4812, #4840, +#4862, #4864, #4899, #4930, #5006, #5071, #5158, #5229, #5254, +#5351).
    • +
    • Fixed an edit from 1.6.3 that made the $robots array in +user_agents.php go poof.
    • +
    • Fixed a bug in the Email library with +quoted-printable encoding improperly encoding space and tab +characters.
    • +
    • Modified XSS sanitization to no longer add semicolons after &[single +letter], such as in M&M’s, B&B, etc.
    • +
    • Modified XSS sanitization to no longer strip XHTML image tags of +closing slashes.
    • +
    • Fixed a bug in the Session class when database sessions are used +where upon session update all userdata would be errantly written to +the session cookie.
    • +
    • Fixed a bug (#4536) in backups with the MySQL driver where some +legacy code was causing certain characters to be double escaped.
    • +
    • Fixed a routing bug (#4661) that occurred when the default route +pointed to a subfolder.
    • +
    • Fixed the spelling of “Dhaka” in the timezone_menu() function of the +Date helper.
    • +
    • Fixed the spelling of “raspberry” in config/smileys.php.
    • +
    • Fixed incorrect parenthesis in form_open() function (#5135).
    • +
    • Fixed a bug that was ignoring case when comparing controller methods +(#4560).
    • +
    • Fixed a bug (#4615) that was not setting SMTP authorization settings +when using the initialize function.
    • +
    • Fixed a bug in highlight_code() in the Text +helper that would leave a stray </span> +in certain cases.
    • +
    • Fixed Oracle bug (#3306) that was preventing multiple queries in one +action.
    • +
    • Fixed ODBC bug that was ignoring connection params due to its use of +a constructor.
    • +
    • Fixed a DB driver bug with num_rows() that would cause an error with +the Oracle driver.
    • +
    • Fixed MS SQL bug (#4915). Added brackets around database name in MS +SQL driver when selecting the database, in the event that reserved +characters are used in the name.
    • +
    • Fixed a DB caching bug (4718) in which the path was incorrect when no +URI segments were present.
    • +
    • Fixed Image_lib class bug #4562. A path was not defined for NetPBM.
    • +
    • Fixed Image_lib class bug #4532. When cropping an image with +identical height/width settings on output, a copy is made.
    • +
    • Fixed DB_driver bug (4900), in which a database error was not being +logged correctly.
    • +
    • Fixed DB backup bug in which field names were not being escaped.
    • +
    • Fixed a DB Active Record caching bug in which multiple calls to +cached data were not being honored.
    • +
    • Fixed a bug in the Session class that was disallowing slashes in the +serialized array.
    • +
    • Fixed a Form Validation bug in which the “isset” error message was +being trigged by the “required” rule.
    • +
    • Fixed a spelling error in a Loader error message.
    • +
    • Fixed a bug (5050) with IP validation with empty segments.
    • +
    • Fixed a bug in which the parser was being greedy if multiple +identical sets of tags were encountered.
    • +
    +
    +
    +
    +

    Version 1.6.3

    +

    Release Date: June 26, 2008 +Hg Tag: v1.6.3

    +

    Version 1.6.3 is a security and maintenance release and is recommended +for all users.

    +
      +
    • Database
        +
      • Modified MySQL/MySQLi Forge class to give explicit names to keys
      • +
      • Added ability to set multiple column non-primary keys to the +Forge class
      • +
      • Added ability to set additional database config values in DSN +connections via the query string.
      • +
      +
    • +
    • Libraries
        +
      • Set the mime type check in the Upload +class to reference the global +mimes variable.
      • +
      • Added support for query strings to the Pagination +class, automatically detected or +explicitly declared.
      • +
      • Added get_post() to the Input class.
      • +
      • Documented get() in the Input class.
      • +
      • Added the ability to automatically output language items as form +labels in the Language class.
      • +
      +
    • +
    • Helpers +
    • +
    • Other changes
        +
      • Improved security in xss_clean().
      • +
      • Removed an unused Router reference in _display_cache().
      • +
      • Added ability to use xss_clean() to test +images for XSS, useful for upload +security.
      • +
      • Considerably expanded list of mobile user-agents in +config/user_agents.php.
      • +
      • Charset information in the userguide has been moved above title +for internationalization purposes (#4614).
      • +
      • Added “Using Associative Arrays In a Request Parameter” example to +the XMLRPC userguide page.
      • +
      • Removed maxlength and size as automatically added attributes of +form_input() in the form helper.
      • +
      • Documented the language file use of byte_format() in the number +helper.
      • +
      +
    • +
    +
    +

    Bug fixes for 1.6.3

    +
      +
    • Added a language key for valid_emails in validation_lang.php.
    • +
    • Amended fixes for bug (#3419) with parsing DSN database connections.
    • +
    • Moved the _has_operator() function (#4535) into DB_driver from +DB_active_rec.
    • +
    • Fixed a syntax error in upload_lang.php.
    • +
    • Fixed a bug (#4542) with a regular expression in the Image library.
    • +
    • Fixed a bug (#4561) where orhaving() wasn’t properly passing values.
    • +
    • Removed some unused variables from the code (#4563).
    • +
    • Fixed a bug where having() was not adding an = into the statement +(#4568).
    • +
    • Fixed assorted user guide typos or examples (#4574, #4706).
    • +
    • Added quoted-printable headers to Email class when the multi-part +override is used.
    • +
    • Fixed a double opening <p> tag in the index pages of each system +directory.
    • +
    +
    +
    +
    +

    Version 1.6.2

    +

    Release Date: May 13, 2008 +Hg Tag: 1.6.2

    +
      +
    • Active Record
        +
      • Added the ability to prevent escaping in having() clauses.
      • +
      • Added rename_table() into DBForge.
      • +
      • Fixed a bug that wasn’t allowing escaping to be turned off if the +value of a query was NULL.
      • +
      • DB Forge is now assigned to any models that exist after loading +(#3457).
      • +
      +
    • +
    • Database
        +
      • Added Strict Mode to database +transactions.
      • +
      • Escape behaviour in where() clauses has changed; values in those +with the “FALSE” argument are no longer escaped (ie: quoted).
      • +
      +
    • +
    • Config
        +
      • Added ‘application/vnd.ms-powerpoint’ to list of mime types.
      • +
      • Added ‘audio/mpg’ to list of mime types.
      • +
      • Added new user-modifiable file constants.php containing file mode +and fopen constants.
      • +
      • Added the ability to set CRLF settings via config in the +Email class.
      • +
      +
    • +
    • Libraries
        +
      • Added increased security for filename handling in the Upload +library.
      • +
      • Added increased security for sessions for client-side data +tampering.
      • +
      • The MySQLi forge class is now in sync with MySQL forge.
      • +
      • Added the ability to set CRLF settings via config in the +Email class.
      • +
      • Unit Testing results are now +colour coded, and a change was made to the default template of +results.
      • +
      • Added a valid_emails rule to the Validation class.
      • +
      • The Zip class now exits within download().
      • +
      • The Zip class has undergone a substantial +re-write for speed and clarity (thanks stanleyxu for the hard work +and code contribution in bug report #3425!)
      • +
      +
    • +
    • Helpers
        +
      • Added a Compatibility +Helper for using some common +PHP 5 functions safely in applications that might run on PHP 4 +servers (thanks Seppo for the hard work and code contribution!)
      • +
      • Added form_button() in the Form +helper.
      • +
      • Changed the radio() and checkbox() functions to default to not +checked by default.
      • +
      • Added the ability to include an optional HTTP Response Code in the +redirect() function of the URL +Helper.
      • +
      • Modified img() in the HTML Helper to +remove an unneeded space (#4208).
      • +
      • Modified anchor() in the URL helper +to no longer add a default title= attribute (#4209).
      • +
      • The Download helper now exits +within force_download().
      • +
      • Added get_dir_file_info(), get_file_info(), and +get_mime_by_extension() to the File +Helper.
      • +
      • Added symbolic_permissions() and octal_permissions() to the +File helper.
      • +
      +
    • +
    • Plugins
        +
      • Modified captcha generation to first look for the function +imagecreatetruecolor, and fallback to imagecreate if it isn’t +available (#4226).
      • +
      +
    • +
    • Other Changes
        +
      • Added ability for xss_clean() to accept +arrays.
      • +
      • Removed closing PHP tags from all PHP files to avoid accidental +output and potential ‘cannot modify headers’ errors.
      • +
      • Removed “scripts” from the auto-load search path. Scripts were +deprecated in Version 1.4.1 (September 21, 2006). If you still +need to use them for legacy reasons, they must now be manually +loaded in each Controller.
      • +
      • Added a Reserved Names page to +the userguide, and migrated reserved controller names into it.
      • +
      • Added a Common Functions page +to the userguide for globally available functions.
      • +
      • Improved security and performance of xss_clean().
      • +
      +
    • +
    +
    +

    Bugfixes for 1.6.2

    +
      +
    • Fixed a bug where SET queries were not being handled as “write” +queries.
    • +
    • Fixed a bug (#3191) with ORIG_PATH_INFO URI parsing.
    • +
    • Fixed a bug in DB Forge, when inserting an id field (#3456).
    • +
    • Fixed a bug in the table library that could cause identically +constructed rows to be dropped (#3459).
    • +
    • Fixed DB Driver and MySQLi result driver checking for resources +instead of objects (#3461).
    • +
    • Fixed an AR_caching error where it wasn’t tracking table aliases +(#3463).
    • +
    • Fixed a bug in AR compiling, where select statements with arguments +got incorrectly escaped (#3478).
    • +
    • Fixed an incorrect documentation of $this->load->language (#3520).
    • +
    • Fixed bugs (#3523, #4350) in get_filenames() with recursion and +problems with Windows when $include_path is used.
    • +
    • Fixed a bug (#4153) in the XML-RPC class preventing dateTime.iso8601 +from being used.
    • +
    • Fixed an AR bug with or_where_not_in() (#4171).
    • +
    • Fixed a bug with xss_clean() that would +add semicolons to GET URI variable strings.
    • +
    • Fixed a bug (#4206) in the Directory Helper where the directory +resource was not being closed, and minor improvements.
    • +
    • Fixed a bug in the FTP library where delete_dir() was not working +recursively (#4215).
    • +
    • Fixed a Validation bug when set_rules() is used with a non-array +field name and rule (#4220).
    • +
    • Fixed a bug (#4223) where DB caching would not work for returned DB +objects or multiple DB connections.
    • +
    • Fixed a bug in the Upload library that might output the same error +twice (#4390).
    • +
    • Fixed an AR bug when joining with a table alias and table prefix +(#4400).
    • +
    • Fixed a bug in the DB class testing the $params argument.
    • +
    • Fixed a bug in the Table library where the integer 0 in cell data +would be displayed as a blank cell.
    • +
    • Fixed a bug in link_tag() of the URL +helper where a key was passed instead of +a value.
    • +
    • Fixed a bug in DB_result::row() that prevented it from returning +individual fields with MySQL NULL values.
    • +
    • Fixed a bug where SMTP emails were not having dot transformation +performed on lines that begin with a dot.
    • +
    • Fixed a bug in display_error() in the DB driver that was +instantiating new Language and Exception objects, and not using the +error heading.
    • +
    • Fixed a bug (#4413) where a URI containing slashes only e.g. +‘http&#58;//example.com/index.php?//’ would result in PHP errors
    • +
    • Fixed an array to string conversion error in the Validation library +(#4425)
    • +
    • Fixed bug (#4451, #4299, #4339) where failed transactions will not +rollback when debug mode is enabled.
    • +
    • Fixed a bug (#4506) with overlay_watermark() in the Image library +preventing support for PNG-24s with alpha transparency
    • +
    • Fixed assorted user guide typos (#3453, #4364, #4379, #4399, #4408, +#4412, #4448, #4488).
    • +
    +
    +
    +
    +

    Version 1.6.1

    +

    Release Date: February 12, 2008 +Hg Tag: 1.6.1

    +
      +
    • Active Record +
    • +
    • Database drivers
        +
      • Added support for setting client character set and collation for +MySQLi.
      • +
      +
    • +
    • Core Changes
        +
      • Modified xss_clean() to be more intelligent with its handling of +URL encoded strings.
      • +
      • Added $_SERVER, $_FILES, $_ENV, and $_SESSION to sanitization +of globals.
      • +
      • Added a Path Helper.
      • +
      • Simplified _reindex_segments() in the URI class.
      • +
      • Escaped the ‘-‘ in the default ‘permitted_uri_chars’ config +item, to prevent errors if developers just try to add additional +characters to the end of the default expression.
      • +
      • Modified method calling to controllers to show a 404 when a +private or protected method is accessed via a URL.
      • +
      • Modified framework initiated 404s to log the controller and method +for invalid requests.
      • +
      +
    • +
    • Helpers
        +
      • Modified get_filenames() in the File Helper to return FALSE if +the $source_dir is not readable.
      • +
      +
    • +
    +
    +

    Bugfixes for 1.6.1

    +
      +
    • Deprecated is_numeric as a validation rule. Use of numeric and +integer are preferred.
    • +
    • Fixed bug (#3379) in DBForge with SQLite for table creation.
    • +
    • Made Active Record fully database prefix aware (#3384).
    • +
    • Fixed a bug where DBForge was outputting invalid SQL in Postgres by +adding brackets around the tables in FROM.
    • +
    • Changed the behaviour of Active Record’s update() to make the WHERE +clause optional (#3395).
    • +
    • Fixed a bug (#3396) where certain POST variables would cause a PHP +warning.
    • +
    • Fixed a bug in query binding (#3402).
    • +
    • Changed order of SQL keywords in the Profiler $highlight array so OR +would not be highlighted before ORDER BY.
    • +
    • Fixed a bug (#3404) where the MySQLi driver was testing if +$this->conn_id was a resource instead of an object.
    • +
    • Fixed a bug (#3419) connecting to a database via a DSN string.
    • +
    • Fixed a bug (#3445) where the routed segment array was not re-indexed +to begin with 1 when the default controller is used.
    • +
    • Fixed assorted user guide typos.
    • +
    +
    +
    +
    +

    Version 1.6.0

    +

    Release Date: January 30, 2008

    +
      +
    • DBForge
        +
      • Added DBForge to the database tools.
      • +
      • Moved create_database() and drop_database() into +DBForge.
      • +
      • Added add_field(), add_key(), create_table(), drop_table(), +add_column(), drop_column(), modify_column() into +DBForge.
      • +
      +
    • +
    • Active Record
        +
      • Added protect_identifiers() in Active +Record.
      • +
      • All AR queries are backticked if appropriate to the database.
      • +
      • Added where_in(), or_where_in(), where_not_in(), +or_where_not_in(), not_like() and or_not_like() to Active +Record.
      • +
      • Added support for limit() into update() and delete() statements in +Active Record.
      • +
      • Added empty_table() and truncate_table() to Active +Record.
      • +
      • Added the ability to pass an array of tables to the delete() +statement in Active Record.
      • +
      • Added count_all_results() function to Active +Record.
      • +
      • Added select_max(), select_min(), select_avg() and +select_sum() to Active Record.
      • +
      • Added the ability to use aliases with joins in Active +Record.
      • +
      • Added a third parameter to Active Record’s like() clause to +control where the wildcard goes.
      • +
      • Added a third parameter to set() in Active +Record that withholds escaping +data.
      • +
      • Changed the behaviour of variables submitted to the where() clause +with no values to auto set “IS NULL”
      • +
      +
    • +
    • Other Database Related
        +
      • MySQL driver now requires MySQL 4.1+
      • +
      • Added $this->DB->save_queries variable to DB driver, enabling +queries to get saved or not. Previously they were always saved.
      • +
      • Added $this->db->dbprefix() to manually add database prefixes.
      • +
      • Added ‘random’ as an order_by() option , and removed “rand()” as +a listed option as it was MySQL only.
      • +
      • Added a check for NULL fields in the MySQL database backup +utility.
      • +
      • Added “constrain_by_prefix” parameter to db->list_table() +function. If set to TRUE it will limit the result to only table +names with the current prefix.
      • +
      • Deprecated from Active Record; getwhere() for get_where(); +groupby() for group_by(); havingor() for having_or(); orderby() +for order_by; orwhere() for or_where(); and orlike() for +or_like().
      • +
      • Modified csv_from_result() to output CSV data more in the spirit +of basic rules of RFC 4180.
      • +
      • Added ‘char_set’ and ‘dbcollat’ database configuration settings, +to explicitly set the client communication properly.
      • +
      • Removed ‘active_r’ configuration setting and replaced with a +global $active_record setting, which is more in harmony with the +global nature of the behavior (#1834).
      • +
      +
    • +
    • Core changes
        +
      • Added ability to load multiple views, whose content will be +appended to the output in the order loaded.
      • +
      • Added the ability to auto-load +Models.
      • +
      • Reorganized the URI and Routes classes for better clarity.
      • +
      • Added Compat.php to allow function overrides for older versions of +PHP or PHP environments missing certain extensions / libraries
      • +
      • Added memory usage, GET, URI string data, and individual query +execution time to Profiler output.
      • +
      • Deprecated Scaffolding.
      • +
      • Added is_really_writable() to Common.php to provide a +cross-platform reliable method of testing file/folder writability.
      • +
      +
    • +
    • Libraries
        +
      • Changed the load protocol of Models to allow for extension.
      • +
      • Strengthened the Encryption library to help protect against man in +the middle attacks when MCRYPT_MODE_CBC mode is used.
      • +
      • Added Flashdata variables, session_id regeneration and +configurable session update times to the Session +class.
      • +
      • Removed ‘last_visit’ from the Session class.
      • +
      • Added a language entry for valid_ip validation error.
      • +
      • Modified prep_for_form() in the Validation class to accept +arrays, adding support for POST array validation (via callbacks +only)
      • +
      • Added an “integer” rule into the Validation library.
      • +
      • Added valid_base64() to the Validation library.
      • +
      • Documented clear() in the Image +Processing library.
      • +
      • Changed the behaviour of custom callbacks so that they no longer +trigger the “required” rule.
      • +
      • Modified Upload class $_FILES error messages to be more precise.
      • +
      • Moved the safe mode and auth checks for the Email library into the +constructor.
      • +
      • Modified variable names in _ci_load() method of Loader class to +avoid conflicts with view variables.
      • +
      • Added a few additional mime type variations for CSV.
      • +
      • Enabled the ‘system’ methods for the XML-RPC Server library, +except for ‘system.multicall’ which is still disabled.
      • +
      +
    • +
    • Helpers & Plugins
        +
      • Added link_tag() to the HTML +helper.
      • +
      • Added img() to the HTML helper.
      • +
      • Added ability to “extend” Helpers.
      • +
      • Added an email helper into core +helpers.
      • +
      • Added strip_quotes() function to string +helper.
      • +
      • Added reduce_multiples() function to string +helper.
      • +
      • Added quotes_to_entities() function to string +helper.
      • +
      • Added form_fieldset(), form_fieldset_close(), form_label(), +and form_reset() function to form +helper.
      • +
      • Added support for external urls in form_open().
      • +
      • Removed support for db_backup in MySQLi due to incompatible +functions.
      • +
      • Javascript Calendar plugin now uses the months and days from the +calendar language file, instead of hard-coded values, +internationalizing it.
      • +
      +
    • +
    • Documentation Changes
        +
      • Added Writing Documentation section +for the community to use in writing their own documentation.
      • +
      • Added titles to all user manual pages.
      • +
      • Added attributes into <html> of userguide for valid html.
      • +
      • Added Zip Encoding Class +to the table of contents of the userguide.
      • +
      • Moved part of the userguide menu javascript to an external file.
      • +
      • Documented distinct() in Active +Record.
      • +
      • Documented the timezones() function in the Date +Helper.
      • +
      • Documented unset_userdata in the Session +class.
      • +
      • Documented 2 config options to the Database +configuration page.
      • +
      +
    • +
    +
    +

    Bug fixes for Version 1.6.0

    +
      +
    • Fixed a bug (#1813) preventing using $CI->db in the same application +with returned database objects.
    • +
    • Fixed a bug (#1842) where the $this->uri->rsegments array would not +include the ‘index’ method if routed to the controller without an +implicit method.
    • +
    • Fixed a bug (#1872) where word_limiter() was not retaining +whitespace.
    • +
    • Fixed a bug (#1890) in csv_from_result() where content that +included the delimiter would break the file.
    • +
    • Fixed a bug (#2542)in the clean_email() method of the Email class to +allow for non-numeric / non-sequential array keys.
    • +
    • Fixed a bug (#2545) in _html_entity_decode_callback() when +‘global_xss_filtering’ is enabled.
    • +
    • Fixed a bug (#2668) in the parser class +where numeric data was ignored.
    • +
    • Fixed a bug (#2679) where the “previous” pagination link would get +drawn on the first page.
    • +
    • Fixed a bug (#2702) in _object_to_array that broke some types of +inserts and updates.
    • +
    • Fixed a bug (#2732) in the SQLite driver for PHP 4.
    • +
    • Fixed a bug (#2754) in Pagination to scan for non-positive +num_links.
    • +
    • Fixed a bug (#2762) in the Session +library where user agent matching would +fail on user agents ending with a space.
    • +
    • Fixed a bug (#2784) $field_names[] vs $Ffield_names[] in postgres +and sqlite drivers.
    • +
    • Fixed a bug (#2810) in the typography helper causing extraneous +paragraph tags when string contains tags.
    • +
    • Fixed a bug (#2849) where arguments passed to a subfolder controller +method would be incorrectly shifted, dropping the 3rd segment value.
    • +
    • Fixed a bug (#2858) which referenced a wrong variable in the Image +class.
    • +
    • Fixed a bug (#2875)when loading plugin files as _plugin. and not +_pi.
    • +
    • Fixed a bug (#2912) in get_filenames() in the File +Helper where the array wasn’t cleared +after each call.
    • +
    • Fixed a bug (#2974) in highlight_phrase() that caused an error with +slashes.
    • +
    • Fixed a bug (#3003) in the Encryption Library to support modes other +than MCRYPT_MODE_ECB
    • +
    • Fixed a bug (#3015) in the User Agent +library where more than 2 languages +where not reported with languages().
    • +
    • Fixed a bug (#3017) in the Email library +where some timezones were calculated incorrectly.
    • +
    • Fixed a bug (#3024) in which master_dim wasn’t getting reset by +clear() in the Image library.
    • +
    • Fixed a bug (#3156) in Text Helper highlight_code() causing PHP tags +to be handled incorrectly.
    • +
    • Fixed a bug (#3166) that prevented num_rows from working in Oracle.
    • +
    • Fixed a bug (#3175) preventing certain libraries from working +properly when autoloaded in PHP 4.
    • +
    • Fixed a bug (#3267) in the Typography Helper where unordered list was +listed “un.
    • +
    • Fixed a bug (#3268) where the Router could leave ‘/’ as the path.
    • +
    • Fixed a bug (#3279) where the Email class was sending the wrong +Content-Transfer-Encoding for some character sets.
    • +
    • Fixed a bug (#3284) where the rsegment array would not be set +properly if the requested URI contained more segments than the routed +URI.
    • +
    • Removed extraneous load of $CFG in _display_cache() of the Output +class (#3285).
    • +
    • Removed an extraneous call to loading models (#3286).
    • +
    • Fixed a bug (#3310) with sanitization of globals in the Input class +that could unset CI’s global variables.
    • +
    • Fixed a bug (#3314) which would cause the top level path to be +deleted in delete_files() of the File helper.
    • +
    • Fixed a bug (#3328) where the smiley helper might return an undefined +variable.
    • +
    • Fixed a bug (#3330) in the FTP class where a comparison wasn’t +getting made.
    • +
    • Removed an unused parameter from Profiler (#3332).
    • +
    • Fixed a bug in database driver where num_rows property wasn’t +getting updated.
    • +
    • Fixed a bug in the upload +library when allowed_files +wasn’t defined.
    • +
    • Fixed a bug in word_wrap() of the Text Helper that incorrectly +referenced an object.
    • +
    • Fixed a bug in Validation where valid_ip() wasn’t called properly.
    • +
    • Fixed a bug in Validation where individual error messages for +checkboxes wasn’t supported.
    • +
    • Fixed a bug in captcha calling an invalid PHP function.
    • +
    • Fixed a bug in the cookie helper “set_cookie” function. It was not +honoring the config settings.
    • +
    • Fixed a bug that was making validation callbacks required even when +not set as such.
    • +
    • Fixed a bug in the XML-RPC library so if a type is specified, a more +intelligent decision is made as to the default type.
    • +
    • Fixed an example of comma-separated emails in the email library +documentation.
    • +
    • Fixed an example in the Calendar library for Showing Next/Previous +Month Links.
    • +
    • Fixed a typo in the database language file.
    • +
    • Fixed a typo in the image language file “suppor” to “support”.
    • +
    • Fixed an example for XML RPC.
    • +
    • Fixed an example of accept_charset() in the User Agent +Library.
    • +
    • Fixed a typo in the docblock comments that had CodeIgniter spelled +CodeIgnitor.
    • +
    • Fixed a typo in the String Helper +(uniquid changed to uniqid).
    • +
    • Fixed typos in the email Language class +(email_attachment_unredable, email_filed_smtp_login), and FTP +Class (ftp_unable_to_remame).
    • +
    • Added a stripslashes() into the Upload Library.
    • +
    • Fixed a series of grammatical and spelling errors in the language +files.
    • +
    • Fixed assorted user guide typos.
    • +
    +
    +
    +
    +

    Version 1.5.4

    +

    Release Date: July 12, 2007

    +
      +
    • Added custom Language files to the +autoload options.
    • +
    • Added stripslashes() to the _clean_input_data() function in the +Input class when magic quotes is on so +that data will always be un-slashed within the framework.
    • +
    • Added array to string into the profiler.
    • +
    • Added some additional mime types in application/config/mimes.php.
    • +
    • Added filename_security() method to Input +library.
    • +
    • Added some additional arguments to the Inflection +helper singular() to compensate +for words ending in “s”. Also added a force parameter to pluralize().
    • +
    • Added $config[‘charset’] to the config file. Default value is +‘UTF-8’, used in some string handling functions.
    • +
    • Fixed MSSQL insert_id().
    • +
    • Fixed a logic error in the DB trans_status() function. It was +incorrectly returning TRUE on failure and FALSE on success.
    • +
    • Fixed a bug that was allowing multiple load attempts on extended +classes.
    • +
    • Fixed a bug in the bootstrap file that was incorrectly attempting to +discern the full server path even when it was explicity set by the +user.
    • +
    • Fixed a bug in the escape_str() function in the MySQL driver.
    • +
    • Fixed a typo in the Calendar library
    • +
    • Fixed a typo in rpcs.php library
    • +
    • Fixed a bug in the Zip library, providing +PC Zip file compatibility with Mac OS X
    • +
    • Fixed a bug in router that was ignoring the scaffolding route for +optimization
    • +
    • Fixed an IP validation bug.
    • +
    • Fixed a bug in display of POST keys in the +Profiler output
    • +
    • Fixed a bug in display of queries with characters that would be +interpreted as HTML in the Profiler +output
    • +
    • Fixed a bug in display of Email class print debugger with characters +that would be interpreted as HTML in the debugging output
    • +
    • Fixed a bug in the Content-Transfer-Encoding of HTML emails with the +quoted-printable MIME type
    • +
    • Fixed a bug where one could unset certain PHP superglobals by setting +them via GET or POST data
    • +
    • Fixed an undefined function error in the insert_id() function of the +PostgreSQL driver
    • +
    • Fixed various doc typos.
    • +
    • Documented two functions from the String +helper that were missing from the +user guide: trim_slashes() and reduce_double_slashes().
    • +
    • Docs now validate to XHTML 1 transitional
    • +
    • Updated the XSS Filtering to take into account the IE expression() +ability and improved certain deletions to prevent possible exploits
    • +
    • Modified the Router so that when Query Strings are Enabled, the +controller trigger and function trigger values are sanitized for +filename include security.
    • +
    • Modified the is_image() method in the Upload library to take into +account Windows IE 6/7 eccentricities when dealing with MIMEs
    • +
    • Modified XSS Cleaning routine to be more performance friendly and +compatible with PHP 5.2’s new PCRE backtrack and recursion limits.
    • +
    • Modified the URL Helper to type cast +the $title as a string in case a numeric value is supplied
    • +
    • Modified Form Helper form_dropdown() to type cast the keys and +values of the options array as strings, allowing numeric values to be +properly set as ‘selected’
    • +
    • Deprecated the use if is_numeric() in various places since it allows +periods. Due to compatibility problems with ctype_digit(), making it +unreliable in some installations, the following regular expression +was used instead: preg_match(“/[^0-9]/”, $n)
    • +
    • Deprecated: APPVER has been deprecated and replaced with CI_VERSION +for clarity.
    • +
    +
    +
    +

    Version 1.5.3

    +

    Release Date: April 15, 2007

    +
      +
    • Added array to string into the profiler
    • +
    • Code Igniter references updated to CodeIgniter
    • +
    • pMachine references updated to EllisLab
    • +
    • Fixed a bug in the repeater function of string +helper.
    • +
    • Fixed a bug in ODBC driver
    • +
    • Fixed a bug in result_array() that was returning an empty array when +no result is produced.
    • +
    • Fixed a bug in the redirect function of the url +helper.
    • +
    • Fixed an undefined variable in Loader
    • +
    • Fixed a version bug in the Postgres driver
    • +
    • Fixed a bug in the textarea function of the form helper for use with +strings
    • +
    • Fixed doc typos.
    • +
    +
    +
    +

    Version 1.5.2

    +

    Release Date: February 13, 2007

    +
      +
    • Added subversion information +to the downloads page.
    • +
    • Added support for captions in the Table +Library
    • +
    • Fixed a bug in the +download_helper that was causing +Internet Explorer to load rather than download
    • +
    • Fixed a bug in the Active Record Join function that was not taking +table prefixes into consideration.
    • +
    • Removed unescaped variables in error messages of Input and Router +classes
    • +
    • Fixed a bug in the Loader that was causing errors on Libraries loaded +twice. A debug message is now silently made in the log.
    • +
    • Fixed a bug in the form helper that +gave textarea a value attribute
    • +
    • Fixed a bug in the Image Library that +was ignoring resizing the same size image
    • +
    • Fixed some doc typos.
    • +
    +
    +
    +

    Version 1.5.1

    +

    Release Date: November 23, 2006

    +
      +
    • Added support for submitting arrays of libraries in the +$this->load->library function.
    • +
    • Added support for naming custom library files in lower or uppercase.
    • +
    • Fixed a bug related to output buffering.
    • +
    • Fixed a bug in the active record class that was not resetting query +data after a completed query.
    • +
    • Fixed a bug that was suppressing errors in controllers.
    • +
    • Fixed a problem that can cause a loop to occur when the config file +is missing.
    • +
    • Fixed a bug that occurred when multiple models were loaded with the +third parameter set to TRUE.
    • +
    • Fixed an oversight that was not unsetting globals properly in the +input sanitize function.
    • +
    • Fixed some bugs in the Oracle DB driver.
    • +
    • Fixed an incorrectly named variable in the MySQLi result driver.
    • +
    • Fixed some doc typos.
    • +
    +
    +
    +

    Version 1.5.0.1

    +

    Release Date: October 31, 2006

    +
      +
    • Fixed a problem in which duplicate attempts to load helpers and +classes were not being stopped.
    • +
    • Fixed a bug in the word_wrap() helper function.
    • +
    • Fixed an invalid color Hex number in the Profiler class.
    • +
    • Fixed a corrupted image in the user guide.
    • +
    +
    +
    +

    Version 1.5.0

    +

    Release Date: October 30, 2006

    +
      +
    • Added DB utility class, permitting DB +backups, CVS or XML files from DB results, and various other +functions.
    • +
    • Added Database Caching Class.
    • +
    • Added transaction support to the +database classes.
    • +
    • Added Profiler Class which generates a +report of Benchmark execution times, queries, and POST data at the +bottom of your pages.
    • +
    • Added User Agent Library which +allows browsers, robots, and mobile devises to be identified.
    • +
    • Added HTML Table Class , enabling tables +to be generated from arrays or database results.
    • +
    • Added Zip Encoding Library.
    • +
    • Added FTP Library.
    • +
    • Added the ability to extend +libraries and extend core +classes, in addition to being able to +replace them.
    • +
    • Added support for storing models within +sub-folders.
    • +
    • Added Download Helper.
    • +
    • Added simple_query() function to the +database classes
    • +
    • Added standard_date() function to +the Date Helper.
    • +
    • Added $query->free_result() to database +class.
    • +
    • Added $query->list_fields() function to +database class
    • +
    • Added $this->db->platform() function
    • +
    • Added new File Helper: +get_filenames()
    • +
    • Added new helper: Smiley Helper
    • +
    • Added support for <ul> and <ol> lists in the HTML +Helper
    • +
    • Added the ability to rewrite short +tags on-the-fly, converting them +to standard PHP statements, for those servers that do not support +short tags. This allows the cleaner syntax to be used regardless of +whether it’s supported by the server.
    • +
    • Added the ability to rename or relocate the “application” +folder.
    • +
    • Added more thorough initialization in the upload class so that all +class variables are reset.
    • +
    • Added “is_numeric” to validation, which uses the native PHP +is_numeric function.
    • +
    • Improved the URI handler to make it more reliable when the +$config[‘uri_protocol’] item is set to AUTO.
    • +
    • Moved most of the functions in the Controller class into the Loader +class, allowing fewer reserved function names for controllers when +running under PHP 5.
    • +
    • Updated the DB Result class to return an empty array when +$query->result() doesn’t produce a result.
    • +
    • Updated the input->cookie() and input->post() functions in Input +Class to permit arrays contained cookies +that are arrays to be run through the XSS filter.
    • +
    • Documented three functions from the Validation +class that were missing from the user +guide: set_select(), set_radio(), and set_checkbox().
    • +
    • Fixed a bug in the Email class related to SMTP Helo data.
    • +
    • Fixed a bug in the word wrapping helper and function in the email +class.
    • +
    • Fixed a bug in the validation class.
    • +
    • Fixed a bug in the typography helper that was incorrectly wrapping +block level elements in paragraph tags.
    • +
    • Fixed a problem in the form_prep() function that was double encoding +entities.
    • +
    • Fixed a bug that affects some versions of PHP when output buffering +is nested.
    • +
    • Fixed a bug that caused CI to stop working when the PHP magic +__get() or __set() functions were used within models or +controllers.
    • +
    • Fixed a pagination bug that was permitting negative values in the +URL.
    • +
    • Fixed an oversight in which the Loader class was not allowed to be +extended.
    • +
    • Changed _get_config() to get_config() since the function is not a +private one.
    • +
    • Deprecated “init” folder. Initialization happens automatically +now. Please see documentation.
    • +
    • Deprecated $this->db->field_names() USE +$this->db->list_fields()
    • +
    • Deprecated the $config[‘log_errors’] item from the config.php +file. Instead, $config[‘log_threshold’] can be set to “0” to turn it +off.
    • +
    +
    +
    +

    Version 1.4.1

    +

    Release Date: September 21, 2006

    +
      +
    • Added a new feature that passes URI segments directly to your +function calls as parameters. See the +Controllers page for more info.
    • +
    • Added support for a function named _output(), which when used in +your controllers will received the final rendered output from the +output class. More info in the Controllers +page.
    • +
    • Added several new functions in the URI +Class to let you retrieve and manipulate URI +segments that have been re-routed using the URI +Routing feature. Previously, the URI class did not +permit you to access any re-routed URI segments, but now it does.
    • +
    • Added $this->output->set_header() +function, which allows you to set server headers.
    • +
    • Updated plugins, helpers, and language classes to allow your +application folder to contain its own plugins, helpers, and language +folders. Previously they were always treated as global for your +entire installation. If your application folder contains any of these +resources they will be used instead the global ones.
    • +
    • Added Inflector helper.
    • +
    • Added element() function in the array +helper.
    • +
    • Added RAND() to active record orderby() function.
    • +
    • Added delete_cookie() and get_cookie() to Cookie +helper, even though the input class +has a cookie fetching function.
    • +
    • Added Oracle database driver (still undergoing testing so it might +have some bugs).
    • +
    • Added the ability to combine pseudo-variables and php variables in +the template parser class.
    • +
    • Added output compression option to the config file.
    • +
    • Removed the is_numeric test from the db->escape() function.
    • +
    • Fixed a MySQLi bug that was causing error messages not to contain +proper error data.
    • +
    • Fixed a bug in the email class which was causing it to ignore +explicitly set alternative headers.
    • +
    • Fixed a bug that was causing a PHP error when the Exceptions class +was called within the get_config() function since it was causing +problems.
    • +
    • Fixed an oversight in the cookie helper in which the config file +cookie settings were not being honored.
    • +
    • Fixed an oversight in the upload class. An item mentioned in the 1.4 +changelog was missing.
    • +
    • Added some code to allow email attachments to be reset when sending +batches of email.
    • +
    • Deprecated the application/scripts folder. It will continue to work +for legacy users, but it is recommended that you create your own +libraries or +models instead. It was originally added +before CI had user libraries or models, but it’s not needed anymore.
    • +
    • Deprecated the $autoload[‘core’] item from the autoload.php file. +Instead, please now use: $autoload[‘libraries’]
    • +
    • Deprecated the following database functions: +$this->db->smart_escape_str() and $this->db->fields().
    • +
    +
    +
    +

    Version 1.4.0

    +

    Release Date: September 17, 2006

    +
      +
    • Added Hooks feature, enabling you to tap +into and modify the inner workings of the framework without hacking +the core files.
    • +
    • Added the ability to organize controller files into +sub-folders. Kudos to Marco for +suggesting this (and the next two) feature.
    • +
    • Added regular expressions support for routing +rules.
    • +
    • Added the ability to remap function +calls within your controllers.
    • +
    • Added the ability to replace core system +classes with your own classes.
    • +
    • Added support for % character in URL.
    • +
    • Added the ability to supply full URLs using the +anchor() helper function.
    • +
    • Added mode parameter to file_write() +helper.
    • +
    • Added support for changing the port number in the Postgres +driver.
    • +
    • Moved the list of “allowed URI characters” out of the Router class +and into the config file.
    • +
    • Moved the MIME type array out of the Upload class and into its own +file in the application/config/ folder.
    • +
    • Updated the Upload class to allow the upload field name to be set +when calling do_upload().
    • +
    • Updated the Config Library to be able to +load config files silently, and to be able to assign config files to +their own index (to avoid collisions if you use multiple config +files).
    • +
    • Updated the URI Protocol code to allow more options so that URLs will +work more reliably in different environments.
    • +
    • Updated the form_open() helper to allow the GET method to be used.
    • +
    • Updated the MySQLi execute() function with some code to help prevent +lost connection errors.
    • +
    • Updated the SQLite Driver to check for object support before +attempting to return results as objects. If unsupported it returns an +array.
    • +
    • Updated the Models loader function to allow multiple loads of the +same model.
    • +
    • Updated the MS SQL driver so that single quotes are escaped.
    • +
    • Updated the Postgres and ODBC drivers for better compatibility.
    • +
    • Removed a strtolower() call that was changing URL segments to lower +case.
    • +
    • Removed some references that were interfering with PHP 4.4.1 +compatibility.
    • +
    • Removed backticks from Postgres class since these are not needed.
    • +
    • Renamed display() to _display() in the Output class to make it clear +that it’s a private function.
    • +
    • Deprecated the hash() function due to a naming conflict with a native +PHP function with the same name. Please use dohash() instead.
    • +
    • Fixed an bug that was preventing the input class from unsetting GET +variables.
    • +
    • Fixed a router bug that was making it too greedy when matching end +segments.
    • +
    • Fixed a bug that was preventing multiple discrete database calls.
    • +
    • Fixed a bug in which loading a language file was producing a “file +contains no data” message.
    • +
    • Fixed a session bug caused by the XSS Filtering feature inadvertently +changing the case of certain words.
    • +
    • Fixed some missing prefixes when using the database prefix feature.
    • +
    • Fixed a typo in the Calendar class (cal_november).
    • +
    • Fixed a bug in the form_checkbox() helper.
    • +
    • Fixed a bug that was allowing the second segment of the URI to be +identical to the class name.
    • +
    • Fixed an evaluation bug in the database initialization function.
    • +
    • Fixed a minor bug in one of the error messages in the language class.
    • +
    • Fixed a bug in the date helper timespan function.
    • +
    • Fixed an undefined variable in the DB Driver class.
    • +
    • Fixed a bug in which dollar signs used as binding replacement values +in the DB class would be treated as RegEx back-references.
    • +
    • Fixed a bug in the set_hash() function which was preventing MD5 from +being used.
    • +
    • Fixed a couple bugs in the Unit Testing class.
    • +
    • Fixed an incorrectly named variable in the Validation class.
    • +
    • Fixed an incorrectly named variable in the URI class.
    • +
    • Fixed a bug in the config class that was preventing the base URL from +being called properly.
    • +
    • Fixed a bug in the validation class that was not permitting callbacks +if the form field was empty.
    • +
    • Fixed a problem that was preventing scaffolding from working properly +with MySQLi.
    • +
    • Fixed some MS SQL bugs.
    • +
    • Fixed some doc typos.
    • +
    +
    +
    +

    Version 1.3.3

    +

    Release Date: June 1, 2006

    +
      +
    • Models do not connect automatically to the database as of this +version. More info here.
    • +
    • Updated the Sessions class to utilize the active record class when +running session related queries. Previously the queries assumed MySQL +syntax.
    • +
    • Updated alternator() function to re-initialize when called with no +arguments, allowing multiple calls.
    • +
    • Fixed a bug in the active record “having” function.
    • +
    • Fixed a problem in the validation class which was making checkboxes +be ignored when required.
    • +
    • Fixed a bug in the word_limiter() helper function. It was cutting +off the fist word.
    • +
    • Fixed a bug in the xss_clean function due to a PHP bug that affects +some versions of html_entity_decode.
    • +
    • Fixed a validation bug that was preventing rules from being set twice +in one controller.
    • +
    • Fixed a calendar bug that was not letting it use dynamically loaded +languages.
    • +
    • Fixed a bug in the active record class when using WHERE clauses with +LIKE
    • +
    • Fixed a bug in the hash() security helper.
    • +
    • Fixed some typos.
    • +
    +
    +
    +

    Version 1.3.2

    +

    Release Date: April 17, 2006

    +
      +
    • Changed the behavior of the validation class such that if a +“required” rule is NOT explicitly stated for a field then all other +tests get ignored.
    • +
    • Fixed a bug in the Controller class that was causing it to look in +the local “init” folder instead of the main system one.
    • +
    • Fixed a bug in the init_pagination file. The $config item was not +being set correctly.
    • +
    • Fixed a bug in the auto typography helper that was causing +inconsistent behavior.
    • +
    • Fixed a couple bugs in the Model class.
    • +
    • Fixed some documentation typos and errata.
    • +
    +
    +
    +

    Version 1.3.1

    +

    Release Date: April 11, 2006

    +
      +
    • Added a Unit Testing Library.
    • +
    • Added the ability to pass objects to the insert() and +update() database functions. This feature enables you to (among +other things) use your Model class +variables to run queries with. See the Models page for details.
    • +
    • Added the ability to pass objects to the view loading +function: $this->load->view(‘my_view’, +$object);
    • +
    • Added getwhere function to Active Record +class.
    • +
    • Added count_all function to Active Record +class.
    • +
    • Added language file for scaffolding and fixed a scaffolding bug that +occurs when there are no rows in the specified table.
    • +
    • Added $this->db->last_query(), which +allows you to view your last query that was run.
    • +
    • Added a new mime type to the upload class for better compatibility.
    • +
    • Changed how cache files are read to prevent PHP errors if the cache +file contains an XML tag, which PHP wants to interpret as a short +tag.
    • +
    • Fixed a bug in a couple of the active record functions (where and +orderby).
    • +
    • Fixed a bug in the image library when realpath() returns false.
    • +
    • Fixed a bug in the Models that was preventing libraries from being +used within them.
    • +
    • Fixed a bug in the “exact_length” function of the validation class.
    • +
    • Fixed some typos in the user guide
    • +
    +
    +
    +

    Version 1.3

    +

    Release Date: April 3, 2006

    +
      +
    • Added support for Models.
    • +
    • Redesigned the database libraries to support additional RDBMs +(Postgres, MySQLi, etc.).
    • +
    • Redesigned the Active Record class +to enable more varied types of queries with simpler syntax, and +advanced features like JOINs.
    • +
    • Added a feature to the database class that lets you run custom +function calls.
    • +
    • Added support for private functions in your +controllers. Any controller function name that starts with an +underscore will not be served by a URI request.
    • +
    • Added the ability to pass your own initialization parameters to your +custom core libraries when using +$this->load->library()
    • +
    • Added support for running standard query string URLs. +These can be optionally enabled in your config file.
    • +
    • Added the ability to specify a “suffix”, which will be +appended to your URLs. For example, you could add .html to your URLs, +making them appear static. This feature is enabled in your config +file.
    • +
    • Added a new error template for use with native PHP errors.
    • +
    • Added “alternator” function in the string +helpers.
    • +
    • Removed slashing from the input class. After much debate we decided +to kill this feature.
    • +
    • Change the commenting style in the scripts to the PEAR standard so +that IDEs and tools like phpDocumenter can harvest the comments.
    • +
    • Added better class and function name-spacing to avoid collisions with +user developed classes. All CodeIgniter classes are now prefixed with +CI_ and all controller methods are prefixed with _ci to avoid +controller collisions. A list of reserved function names can be +found here.
    • +
    • Redesigned how the “CI” super object is referenced, depending on +whether PHP 4 or 5 is being run, since PHP 5 allows a more graceful +way to manage objects that utilizes a bit less resources.
    • +
    • Deprecated: $this->db->use_table() has been deprecated. Please read +the Active Record page for +information.
    • +
    • Deprecated: $this->db->smart_escape_str() has been deprecated. +Please use this instead: $this->db->escape()
    • +
    • Fixed a bug in the exception handler which was preventing some PHP +errors from showing up.
    • +
    • Fixed a typo in the URI class. $this->total_segment() should be +plural: $this->total_segments()
    • +
    • Fixed some typos in the default calendar template
    • +
    • Fixed some typos in the user guide
    • +
    +
    +
    +

    Version 1.2

    +

    Release Date: March 21, 2006

    +
      +
    • Redesigned some internal aspects of the framework to resolve scoping +problems that surfaced during the beta tests. The problem was most +notable when instantiating classes in your constructors, particularly +if those classes in turn did work in their constructors.
    • +
    • Added a global function named +get_instance() allowing the main +CodeIgniter object to be accessible throughout your own classes.
    • +
    • Added new File Helper: +delete_files()
    • +
    • Added new URL Helpers: base_url(), +index_page()
    • +
    • Added the ability to create your own core +libraries and store them in your local +application directory.
    • +
    • Added an overwrite option to the Upload +class, enabling files to be +overwritten rather than having the file name appended.
    • +
    • Added Javascript Calendar plugin.
    • +
    • Added search feature to user guide. Note: This is done using Google, +which at the time of this writing has not crawled all the pages of +the docs.
    • +
    • Updated the parser class so that it allows tag pars within other tag +pairs.
    • +
    • Fixed a bug in the DB “where” function.
    • +
    • Fixed a bug that was preventing custom config files to be +auto-loaded.
    • +
    • Fixed a bug in the mysql class bind feature that prevented question +marks in the replacement data.
    • +
    • Fixed some bugs in the xss_clean function
    • +
    +
    +
    +

    Version Beta 1.1

    +

    Release Date: March 10, 2006

    +
      +
    • Added a Calendaring class.
    • +
    • Added support for running multiple +applications that share a common CodeIgniter +backend.
    • +
    • Moved the “uri protocol” variable from the index.php file into the +config.php file
    • +
    • Fixed a problem that was preventing certain function calls from +working within constructors.
    • +
    • Fixed a problem that was preventing the $this->load->library function +from working in constructors.
    • +
    • Fixed a bug that occurred when the session class was loaded using the +auto-load routine.
    • +
    • Fixed a bug that can happen with PHP versions that do not support the +E_STRICT constant
    • +
    • Fixed a data type error in the form_radio function (form helper)
    • +
    • Fixed a bug that was preventing the xss_clean function from being +called from the validation class.
    • +
    • Fixed the cookie related config names, which were incorrectly +specified as $conf rather than $config
    • +
    • Fixed a pagination problem in the scaffolding.
    • +
    • Fixed a bug in the mysql class “where” function.
    • +
    • Fixed a regex problem in some code that trimmed duplicate slashes.
    • +
    • Fixed a bug in the br() function in the HTML helper
    • +
    • Fixed a syntax mistake in the form_dropdown function in the Form +Helper.
    • +
    • Removed the “style” attributes form the form helpers.
    • +
    • Updated the documentation. Added “next/previous” links to each page +and fixed various typos.
    • +
    +
    +
    +

    Version Beta 1.0

    +

    Release Date: February 28, 2006

    +

    First publicly released version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/contributing/index.html b/user_guide/contributing/index.html new file mode 100755 index 0000000..fcbea54 --- /dev/null +++ b/user_guide/contributing/index.html @@ -0,0 +1,615 @@ + + + + + + + + + + Contributing to CodeIgniter — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Contributing to CodeIgniter
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Contributing to CodeIgniter

    + +

    CodeIgniter is a community driven project and accepts contributions of code +and documentation from the community. These contributions are made in the form +of Issues or Pull Requests +on the CodeIgniter repository on GitHub.

    +

    Issues are a quick way to point out a bug. If you find a bug or documentation +error in CodeIgniter then please check a few things first:

    +
      +
    • There is not already an open Issue
    • +
    • The issue has already been fixed (check the develop branch, or look for +closed Issues)
    • +
    • Is it something really obvious that you fix it yourself?
    • +
    +

    Reporting issues is helpful but an even better approach is to send a Pull +Request, which is done by “Forking” the main repository and committing to your +own copy. This will require you to use the version control system called Git.

    +
    +

    Support

    +

    Please note that GitHub is not for general support questions! If you are +having trouble using a feature of CodeIgniter, ask for help on our +forums instead.

    +

    If you are not sure whether you are using something correctly or if you +have found a bug, again - please ask on the forums first.

    +
    +
    +

    Security

    +

    Did you find a security issue in CodeIgniter?

    +

    Please don’t disclose it publicly, but e-mail us at security@codeigniter.com, +or report it via our page on HackerOne.

    +

    If you’ve found a critical vulnerability, we’d be happy to credit you in our +ChangeLog <../changelog>.

    +
    +
    +

    Tips for a Good Issue Report

    +

    Use a descriptive subject line (eg parser library chokes on commas) rather than a vague one (eg. your code broke).

    +

    Address a single issue in a report.

    +

    Identify the CodeIgniter version (eg 3.0-develop) and the component if you know it (eg. parser library)

    +

    Explain what you expected to happen, and what did happen. +Include error messages and stacktrace, if any.

    +

    Include short code segments if they help to explain. +Use a pastebin or dropbox facility to include longer segments of code or screenshots - do not include them in the issue report itself. +This means setting a reasonable expiry for those, until the issue is resolved or closed.

    +

    If you know how to fix the issue, you can do so in your own fork & branch, and submit a pull request. +The issue report information above should be part of that.

    +

    If your issue report can describe the steps to reproduce the problem, that is great. +If you can include a unit test that reproduces the problem, that is even better, as it gives whoever is fixing +it a clearer target!

    +
    +
    +

    Guidelines

    +

    Before we look into how, here are the guidelines. If your Pull Requests fail +to pass these guidelines it will be declined and you will need to re-submit +when you’ve made the changes. This might sound a bit tough, but it is required +for us to maintain quality of the code-base.

    +
    +

    PHP Style

    +

    All code must meet the Style Guide, which is +essentially the Allman indent style, underscores and +readable operators. This makes certain that all code is the same format as the +existing code and means it will be as readable as possible.

    +
    +
    +

    Documentation

    +

    If you change anything that requires a change to documentation then you will +need to add it. New classes, methods, parameters, changing default values, etc +are all things that will require a change to documentation. The change-log +must also be updated for every change. Also PHPDoc blocks must be maintained.

    +
    +
    +

    Compatibility

    +

    CodeIgniter recommends PHP 5.6 or newer to be used, but it should be +compatible with PHP 5.3.7 so all code supplied must stick to this +requirement. If PHP 5.4 (and above) functions or features are used then +there must be a fallback for PHP 5.3.7.

    +
    +
    +

    Branching

    +

    CodeIgniter uses the Git-Flow branching model +which requires all pull requests to be sent to the “develop” branch. This is +where the next planned version will be developed. The “master” branch will +always contain the latest stable version and is kept clean so a “hotfix” (e.g: +an emergency security patch) can be applied to master to create a new version, +without worrying about other features holding it up. For this reason all +commits need to be made to “develop” and any sent to “master” will be closed +automatically. If you have multiple changes to submit, please place all +changes into their own branch on your fork.

    +

    One thing at a time: A pull request should only contain one change. That does +not mean only one commit, but one change - however many commits it took. The +reason for this is that if you change X and Y but send a pull request for both +at the same time, we might really want X but disagree with Y, meaning we +cannot merge the request. Using the Git-Flow branching model you can create +new branches for both of these features and send two requests.

    +
    +
    +

    Signing

    +

    You must sign your work, certifying that you either wrote the work or +otherwise have the right to pass it on to an open source project. git makes +this trivial as you merely have to use –signoff on your commits to your +CodeIgniter fork.

    +
    git commit --signoff
    +
    +
    +

    or simply

    +
    git commit -s
    +
    +
    +

    This will sign your commits with the information setup in your git config, e.g.

    +
    +
    Signed-off-by: John Q Public <john.public@example.com>
    +

    If you are using Tower there is a “Sign-Off” checkbox in the commit window. You +could even alias git commit to use the -s flag so you don’t have to think about +it.

    +

    By signing your work in this manner, you certify to a “Developer’s Certificate +of Origin”. The current version of this certificate is in the Developer’s Certificate of Origin 1.1 file +in the root of this documentation.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html new file mode 100755 index 0000000..089c8a5 --- /dev/null +++ b/user_guide/database/caching.html @@ -0,0 +1,642 @@ + + + + + + + + + + Database Caching Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Caching Class

    +

    The Database Caching Class permits you to cache your queries as text +files for reduced database load.

    +
    +

    Important

    +

    This class is initialized automatically by the database +driver when caching is enabled. Do NOT load this class manually.

    +
    +
    +

    Important

    +

    Not all query result functions are available when you +use caching. Please read this page carefully.

    +
    +
    +

    Enabling Caching

    +

    Caching is enabled in three steps:

    +
      +
    • Create a writable directory on your server where the cache files can +be stored.
    • +
    • Set the path to your cache folder in your +application/config/database.php file.
    • +
    • Enable the caching feature, either globally by setting the preference +in your application/config/database.php file, or manually as +described below.
    • +
    +

    Once enabled, caching will happen automatically whenever a page is +loaded that contains database queries.

    +
    +
    +

    How Does Caching Work?

    +

    CodeIgniter’s query caching system happens dynamically when your pages +are viewed. When caching is enabled, the first time a web page is +loaded, the query result object will be serialized and stored in a text +file on your server. The next time the page is loaded the cache file +will be used instead of accessing your database. Your database usage can +effectively be reduced to zero for any pages that have been cached.

    +

    Only read-type (SELECT) queries can be cached, since these are the only +type of queries that produce a result. Write-type (INSERT, UPDATE, etc.) +queries, since they don’t generate a result, will not be cached by the +system.

    +

    Cache files DO NOT expire. Any queries that have been cached will remain +cached until you delete them. The caching system permits you clear +caches associated with individual pages, or you can delete the entire +collection of cache files. Typically you’ll want to use the housekeeping +functions described below to delete cache files after certain events +take place, like when you’ve added new information to your database.

    +
    +
    +

    Will Caching Improve Your Site’s Performance?

    +

    Getting a performance gain as a result of caching depends on many +factors. If you have a highly optimized database under very little load, +you probably won’t see a performance boost. If your database is under +heavy use you probably will see an improved response, assuming your +file-system is not overly taxed. Remember that caching simply changes +how your information is retrieved, shifting it from being a database +operation to a file-system one.

    +

    In some clustered server environments, for example, caching may be +detrimental since file-system operations are so intense. On single +servers in shared environments, caching will probably be beneficial. +Unfortunately there is no single answer to the question of whether you +should cache your database. It really depends on your situation.

    +
    +
    +

    How are Cache Files Stored?

    +

    CodeIgniter places the result of EACH query into its own cache file. +Sets of cache files are further organized into sub-folders corresponding +to your controller functions. To be precise, the sub-folders are named +identically to the first two segments of your URI (the controller class +name and function name).

    +

    For example, let’s say you have a controller called blog with a function +called comments that contains three queries. The caching system will +create a cache folder called blog+comments, into which it will write +three cache files.

    +

    If you use dynamic queries that change based on information in your URI +(when using pagination, for example), each instance of the query will +produce its own cache file. It’s possible, therefore, to end up with +many times more cache files than you have queries.

    +
    +
    +

    Managing your Cache Files

    +

    Since cache files do not expire, you’ll need to build deletion routines +into your application. For example, let’s say you have a blog that +allows user commenting. Whenever a new comment is submitted you’ll want +to delete the cache files associated with the controller function that +serves up your comments. You’ll find two delete functions described +below that help you clear data.

    +
    +
    +

    Not All Database Functions Work with Caching

    +

    Lastly, we need to point out that the result object that is cached is a +simplified version of the full result object. For that reason, some of +the query result functions are not available for use.

    +

    The following functions ARE NOT available when using a cached result +object:

    +
      +
    • num_fields()
    • +
    • field_names()
    • +
    • field_data()
    • +
    • free_result()
    • +
    +

    Also, the two database resources (result_id and conn_id) are not +available when caching, since result resources only pertain to run-time +operations.

    +
    +

    Function Reference

    +
    +
    +
    +

    $this->db->cache_on() / $this->db->cache_off()

    +

    Manually enables/disables caching. This can be useful if you want to +keep certain queries from being cached. Example:

    +
    // Turn caching on
    +$this->db->cache_on();
    +$query = $this->db->query("SELECT * FROM mytable");
    +
    +// Turn caching off for this one query
    +$this->db->cache_off();
    +$query = $this->db->query("SELECT * FROM members WHERE member_id = '$current_user'");
    +
    +// Turn caching back on
    +$this->db->cache_on();
    +$query = $this->db->query("SELECT * FROM another_table");
    +
    +
    +
    +
    +

    $this->db->cache_delete()

    +

    Deletes the cache files associated with a particular page. This is +useful if you need to clear caching after you update your database.

    +

    The caching system saves your cache files to folders that correspond to +the URI of the page you are viewing. For example, if you are viewing a +page at example.com/index.php/blog/comments, the caching system will put +all cache files associated with it in a folder called blog+comments. To +delete those particular cache files you will use:

    +
    $this->db->cache_delete('blog', 'comments');
    +
    +
    +

    If you do not use any parameters the current URI will be used when +determining what should be cleared.

    +
    +
    +

    $this->db->cache_delete_all()

    +

    Clears all existing cache files. Example:

    +
    $this->db->cache_delete_all();
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html new file mode 100755 index 0000000..6cf0c07 --- /dev/null +++ b/user_guide/database/call_function.html @@ -0,0 +1,529 @@ + + + + + + + + + + Custom Function Calls — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Custom Function Calls

    +
    +

    $this->db->call_function();

    +

    This function enables you to call PHP database functions that are not +natively included in CodeIgniter, in a platform independent manner. For +example, let’s say you want to call the mysql_get_client_info() +function, which is not natively supported by CodeIgniter. You could +do so like this:

    +
    $this->db->call_function('get_client_info');
    +
    +
    +

    You must supply the name of the function, without the mysql_ +prefix, in the first parameter. The prefix is added automatically based +on which database driver is currently being used. This permits you to +run the same function on different database platforms. Obviously not all +function calls are identical between platforms, so there are limits to +how useful this function can be in terms of portability.

    +

    Any parameters needed by the function you are calling will be added to +the second parameter.

    +
    $this->db->call_function('some_function', $param1, $param2, etc..);
    +
    +
    +

    Often, you will either need to supply a database connection ID or a +database result ID. The connection ID can be accessed using:

    +
    $this->db->conn_id;
    +
    +
    +

    The result ID can be accessed from within your result object, like this:

    +
    $query = $this->db->query("SOME QUERY");
    +
    +$query->result_id;
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html new file mode 100755 index 0000000..ba8acf4 --- /dev/null +++ b/user_guide/database/configuration.html @@ -0,0 +1,758 @@ + + + + + + + + + + Database Configuration — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Configuration

    +

    CodeIgniter has a config file that lets you store your database +connection values (username, password, database name, etc.). The config +file is located at application/config/database.php. You can also set +database connection values for specific +environments by placing database.php +in the respective environment config folder.

    +

    The config settings are stored in a multi-dimensional array with this +prototype:

    +
    $db['default'] = array(
    +        'dsn'   => '',
    +        'hostname' => 'localhost',
    +        'username' => 'root',
    +        'password' => '',
    +        'database' => 'database_name',
    +        'dbdriver' => 'mysqli',
    +        'dbprefix' => '',
    +        'pconnect' => TRUE,
    +        'db_debug' => TRUE,
    +        'cache_on' => FALSE,
    +        'cachedir' => '',
    +        'char_set' => 'utf8',
    +        'dbcollat' => 'utf8_general_ci',
    +        'swap_pre' => '',
    +        'encrypt' => FALSE,
    +        'compress' => FALSE,
    +        'stricton' => FALSE,
    +        'failover' => array()
    +);
    +
    +
    +

    Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might +require a full DSN string to be provided. If that is the case, you +should use the ‘dsn’ configuration setting, as if you’re using the +driver’s underlying native PHP extension, like this:

    +
    // PDO
    +$db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';
    +
    +// Oracle
    +$db['default']['dsn'] = '//localhost/XE';
    +
    +
    +
    +

    Note

    +

    If you do not specify a DSN string for a driver that requires it, CodeIgniter +will try to build it with the rest of the provided settings.

    +
    +
    +

    Note

    +

    If you provide a DSN string and it is missing some valid settings (e.g. the +database character set), which are present in the rest of the configuration +fields, CodeIgniter will append them.

    +
    +

    You can also specify failovers for the situation when the main connection cannot connect for some reason. +These failovers can be specified by setting the failover for a connection like this:

    +
    $db['default']['failover'] = array(
    +                array(
    +                        'hostname' => 'localhost1',
    +                        'username' => '',
    +                        'password' => '',
    +                        'database' => '',
    +                        'dbdriver' => 'mysqli',
    +                        'dbprefix' => '',
    +                        'pconnect' => TRUE,
    +                        'db_debug' => TRUE,
    +                        'cache_on' => FALSE,
    +                        'cachedir' => '',
    +                        'char_set' => 'utf8',
    +                        'dbcollat' => 'utf8_general_ci',
    +                        'swap_pre' => '',
    +                        'encrypt' => FALSE,
    +                        'compress' => FALSE,
    +                        'stricton' => FALSE
    +                ),
    +                array(
    +                        'hostname' => 'localhost2',
    +                        'username' => '',
    +                        'password' => '',
    +                        'database' => '',
    +                        'dbdriver' => 'mysqli',
    +                        'dbprefix' => '',
    +                        'pconnect' => TRUE,
    +                        'db_debug' => TRUE,
    +                        'cache_on' => FALSE,
    +                        'cachedir' => '',
    +                        'char_set' => 'utf8',
    +                        'dbcollat' => 'utf8_general_ci',
    +                        'swap_pre' => '',
    +                        'encrypt' => FALSE,
    +                        'compress' => FALSE,
    +                        'stricton' => FALSE
    +                )
    +        );
    +
    +
    +

    You can specify as many failovers as you like.

    +

    The reason we use a multi-dimensional array rather than a more simple +one is to permit you to optionally store multiple sets of connection +values. If, for example, you run multiple environments (development, +production, test, etc.) under a single installation, you can set up a +connection group for each, then switch between groups as needed. For +example, to set up a “test” environment you would do this:

    +
    $db['test'] = array(
    +        'dsn'   => '',
    +        'hostname' => 'localhost',
    +        'username' => 'root',
    +        'password' => '',
    +        'database' => 'database_name',
    +        'dbdriver' => 'mysqli',
    +        'dbprefix' => '',
    +        'pconnect' => TRUE,
    +        'db_debug' => TRUE,
    +        'cache_on' => FALSE,
    +        'cachedir' => '',
    +        'char_set' => 'utf8',
    +        'dbcollat' => 'utf8_general_ci',
    +        'swap_pre' => '',
    +        'compress' => FALSE,
    +        'encrypt' => FALSE,
    +        'stricton' => FALSE,
    +        'failover' => array()
    +);
    +
    +
    +

    Then, to globally tell the system to use that group you would set this +variable located in the config file:

    +
    $active_group = 'test';
    +
    +
    +
    +

    Note

    +

    The name ‘test’ is arbitrary. It can be anything you want. By +default we’ve used the word “default” for the primary connection, +but it too can be renamed to something more relevant to your project.

    +
    +
    +

    Query Builder

    +

    The Query Builder Class is globally enabled or +disabled by setting the $query_builder variable in the database +configuration file to TRUE/FALSE (boolean). The default setting is TRUE. +If you are not using the +query builder class, setting it to FALSE will utilize fewer resources +when the database classes are initialized.

    +
    $query_builder = TRUE;
    +
    +
    +
    +

    Note

    +

    that some CodeIgniter classes such as Sessions require Query +Builder to be enabled to access certain functionality.

    +
    +
    +
    +

    Explanation of Values:

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name ConfigDescription
    dsnThe DSN connect string (an all-in-one configuration sequence).
    hostnameThe hostname of your database server. Often this is ‘localhost’.
    usernameThe username used to connect to the database.
    passwordThe password used to connect to the database.
    databaseThe name of the database you want to connect to.
    dbdriverThe database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case.
    dbprefixAn optional table prefix which will added to the table name when running +Query Builder queries. This permits multiple CodeIgniter +installations to share one database.
    pconnectTRUE/FALSE (boolean) - Whether to use a persistent connection.
    db_debugTRUE/FALSE (boolean) - Whether database errors should be displayed.
    cache_onTRUE/FALSE (boolean) - Whether database query caching is enabled, +see also Database Caching Class.
    cachedirThe absolute server path to your database query cache directory.
    char_setThe character set used in communicating with the database.
    dbcollat

    The character collation used in communicating with the database

    +
    +

    Note

    +

    Only used in the ‘mysql’ and ‘mysqli’ drivers.

    +
    +
    swap_preA default table prefix that should be swapped with dbprefix. This is useful for distributed +applications where you might run manually written queries, and need the prefix to still be +customizable by the end user.
    schemaThe database schema, defaults to ‘public’. Used by PostgreSQL and ODBC drivers.
    encrypt

    Whether or not to use an encrypted connection.

    +
    +
      +
    • ‘mysql’ (deprecated), ‘sqlsrv’ and ‘pdo/sqlsrv’ drivers accept TRUE/FALSE
    • +
    • ‘mysqli’ and ‘pdo/mysql’ drivers accept an array with the following options:
        +
      • ‘ssl_key’ - Path to the private key file
      • +
      • ‘ssl_cert’ - Path to the public key certificate file
      • +
      • ‘ssl_ca’ - Path to the certificate authority file
      • +
      • ‘ssl_capath’ - Path to a directory containing trusted CA certificats in PEM format
      • +
      • ‘ssl_cipher’ - List of allowed ciphers to be used for the encryption, separated by colons (‘:’)
      • +
      • ‘ssl_verify’ - TRUE/FALSE; Whether to verify the server certificate or not (‘mysqli’ only)
      • +
      +
    • +
    +
    +
    compressWhether or not to use client compression (MySQL only).
    strictonTRUE/FALSE (boolean) - Whether to force “Strict Mode” connections, good for ensuring strict SQL +while developing an application.
    port

    The database port number. To use this value you have to add a line to the database config array.

    +
    $db['default']['port'] = 5432;
    +
    +
    +
    +
    +

    Note

    +

    Depending on what database platform you are using (MySQL, PostgreSQL, +etc.) not all values will be needed. For example, when using SQLite you +will not need to supply a username or password, and the database name +will be the path to your database file. The information above assumes +you are using MySQL.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html new file mode 100755 index 0000000..dcc94a2 --- /dev/null +++ b/user_guide/database/connecting.html @@ -0,0 +1,641 @@ + + + + + + + + + + Connecting to your Database — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Connecting to your Database

    +

    There are two ways to connect to a database:

    +
    +

    Automatically Connecting

    +

    The “auto connect” feature will load and instantiate the database class +with every page load. To enable “auto connecting”, add the word database +to the library array, as indicated in the following file:

    +

    application/config/autoload.php

    +
    +
    +

    Manually Connecting

    +

    If only some of your pages require database connectivity you can +manually connect to your database by adding this line of code in any +function where it is needed, or in your class constructor to make the +database available globally in that class.

    +
    $this->load->database();
    +
    +
    +

    If the above function does not contain any information in the first +parameter it will connect to the group specified in your database config +file. For most people, this is the preferred method of use.

    +
    +

    Available Parameters

    +
      +
    1. The database connection values, passed either as an array or a DSN +string.
    2. +
    3. TRUE/FALSE (boolean). Whether to return the connection ID (see +Connecting to Multiple Databases below).
    4. +
    5. TRUE/FALSE (boolean). Whether to enable the Query Builder class. Set +to TRUE by default.
    6. +
    +
    +
    +

    Manually Connecting to a Database

    +

    The first parameter of this function can optionally be used to +specify a particular database group from your config file, or you can +even submit connection values for a database that is not specified in +your config file. Examples:

    +

    To choose a specific group from your config file you can do this:

    +
    $this->load->database('group_name');
    +
    +
    +

    Where group_name is the name of the connection group from your config +file.

    +

    To connect manually to a desired database you can pass an array of +values:

    +
    $config['hostname'] = 'localhost';
    +$config['username'] = 'myusername';
    +$config['password'] = 'mypassword';
    +$config['database'] = 'mydatabase';
    +$config['dbdriver'] = 'mysqli';
    +$config['dbprefix'] = '';
    +$config['pconnect'] = FALSE;
    +$config['db_debug'] = TRUE;
    +$config['cache_on'] = FALSE;
    +$config['cachedir'] = '';
    +$config['char_set'] = 'utf8';
    +$config['dbcollat'] = 'utf8_general_ci';
    +$this->load->database($config);
    +
    +
    +

    For information on each of these values please see the configuration +page.

    +
    +

    Note

    +

    For the PDO driver, you should use the $config[‘dsn’] setting +instead of ‘hostname’ and ‘database’:

    +
    +

    +
    $config[‘dsn’] = ‘mysql:host=localhost;dbname=mydatabase’;
    +
    +
    +

    Or you can submit your database values as a Data Source Name. DSNs must +have this prototype:

    +
    $dsn = 'dbdriver://username:password@hostname/database';
    +$this->load->database($dsn);
    +
    +
    +

    To override default config values when connecting with a DSN string, add +the config variables as a query string.

    +
    $dsn = 'dbdriver://username:password@hostname/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=/path/to/cache';
    +$this->load->database($dsn);
    +
    +
    +
    +
    +
    +

    Connecting to Multiple Databases

    +

    If you need to connect to more than one database simultaneously you can +do so as follows:

    +
    $DB1 = $this->load->database('group_one', TRUE);
    +$DB2 = $this->load->database('group_two', TRUE);
    +
    +
    +

    Note: Change the words “group_one” and “group_two” to the specific +group names you are connecting to (or you can pass the connection values +as indicated above).

    +

    By setting the second parameter to TRUE (boolean) the function will +return the database object.

    +
    +

    Note

    +

    When you connect this way, you will use your object name to issue +commands rather than the syntax used throughout this guide. In other +words, rather than issuing commands with:

    +
    +

    +
    $this->db->query();
    +
    $this->db->result();
    +
    etc…
    +

    +
    You will instead use:
    +

    +
    $DB1->query();
    +
    $DB1->result();
    +
    etc…
    +
    +
    +
    +

    Note

    +

    You don’t need to create separate database configurations if you +only need to use a different database on the same connection. You +can switch to a different database when you need to, like this:

    +
    +
    $this->db->db_select($database2_name);
    +
    +
    +
    +
    +

    Reconnecting / Keeping the Connection Alive

    +

    If the database server’s idle timeout is exceeded while you’re doing +some heavy PHP lifting (processing an image, for instance), you should +consider pinging the server by using the reconnect() method before +sending further queries, which can gracefully keep the connection alive +or re-establish it.

    +
    $this->db->reconnect();
    +
    +
    +
    +
    +

    Manually closing the Connection

    +

    While CodeIgniter intelligently takes care of closing your database +connections, you can explicitly close the connection.

    +
    $this->db->close();
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/db_driver_reference.html b/user_guide/database/db_driver_reference.html new file mode 100755 index 0000000..efe6566 --- /dev/null +++ b/user_guide/database/db_driver_reference.html @@ -0,0 +1,1483 @@ + + + + + + + + + + DB Driver Reference — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    DB Driver Reference

    +

    This is the platform-independent base DB implementation class. +This class will not be called directly. Rather, the adapter +class for the specific database will extend and instantiate it.

    +

    The how-to material for this has been split over several articles. +This article is intended to be a reference for them.

    +
    +

    Important

    +

    Not all methods are supported by all database drivers, +some of them may fail (and return FALSE) if the underlying +driver does not support them.

    +
    +
    +
    +class CI_DB_driver
    +
    +
    +initialize()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Initialize database settings, establish a connection to +the database.

    +
    + +
    +
    +db_connect($persistent = TRUE)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $persistent (bool) – Whether to establish a persistent connection or a regular one
    • +
    +
    Returns:

    Database connection resource/object or FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Establish a connection with the database.

    +
    +

    Note

    +

    The returned value depends on the underlying +driver in use. For example, a mysqli instance +will be returned with the ‘mysqli’ driver.

    +
    +
    + +
    +
    +db_pconnect()
    +
    +++ + + + + + +
    Returns:Database connection resource/object or FALSE on failure
    Return type:mixed
    +

    Establish a persistent connection with the database.

    +
    +

    Note

    +

    This method is just an alias for db_connect(TRUE).

    +
    +
    + +
    +
    +reconnect()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Keep / reestablish the database connection if no queries +have been sent for a length of time exceeding the +server’s idle timeout.

    +
    + +
    +
    +db_select([$database = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $database (string) – Database name
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Select / switch the current database.

    +
    + +
    +
    +db_set_charset($charset)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $charset (string) – Character set name
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Set client character set.

    +
    + +
    +
    +platform()
    +
    +++ + + + + + +
    Returns:Platform name
    Return type:string
    +

    The name of the platform in use (mysql, mssql, etc…).

    +
    + +
    +
    +version()
    +
    +++ + + + + + +
    Returns:The version of the database being used
    Return type:string
    +

    Database version number.

    +
    + +
    +
    +query($sql[, $binds = FALSE[, $return_object = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $sql (string) – The SQL statement to execute
    • +
    • $binds (array) – An array of binding data
    • +
    • $return_object (bool) – Whether to return a result object or not
    • +
    +
    Returns:

    TRUE for successful “write-type” queries, CI_DB_result instance (method chaining) on “query” success, FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Execute an SQL query.

    +

    Accepts an SQL string as input and returns a result object +upon successful execution of a “read” type query.

    +

    Returns:

    +
    +
      +
    • Boolean TRUE upon successful execution of a “write type” queries
    • +
    • Boolean FALSE upon failure
    • +
    • CI_DB_result object for “read type” queries
    • +
    +
    +
    + +
    +
    +simple_query($sql)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $sql (string) – The SQL statement to execute
    • +
    +
    Returns:

    Whatever the underlying driver’s “query” function returns

    +
    Return type:

    mixed

    +
    +

    A simplified version of the query() method, appropriate +for use when you don’t need to get a result object or to +just send a query to the database and not care for the result.

    +
    + +
    +
    +affected_rows()
    +
    +++ + + + + + +
    Returns:Number of rows affected
    Return type:int
    +

    Returns the number of rows changed by the last executed query.

    +

    Useful for checking how much rows were created, updated or deleted +during the last executed query.

    +
    + +
    +
    +trans_strict([$mode = TRUE])
    +
    +++ + + + + + +
    Parameters:
      +
    • $mode (bool) – Strict mode flag
    • +
    +
    Return type:

    void

    +
    +

    Enable/disable transaction “strict” mode.

    +

    When strict mode is enabled, if you are running multiple +groups of transactions and one group fails, all subsequent +groups will be rolled back.

    +

    If strict mode is disabled, each group is treated +autonomously, meaning a failure of one group will not +affect any others.

    +
    + +
    +
    +trans_off()
    +
    +++ + + + +
    Return type:void
    +

    Disables transactions at run-time.

    +
    + +
    +
    +trans_start([$test_mode = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $test_mode (bool) – Test mode flag
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Start a transaction.

    +
    + +
    +
    +trans_complete()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Complete Transaction.

    +
    + +
    +
    +trans_status()
    +
    +++ + + + + + +
    Returns:TRUE if the transaction succeeded, FALSE if it failed
    Return type:bool
    +

    Lets you retrieve the transaction status flag to +determine if it has failed.

    +
    + +
    +
    +compile_binds($sql, $binds)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $sql (string) – The SQL statement
    • +
    • $binds (array) – An array of binding data
    • +
    +
    Returns:

    The updated SQL statement

    +
    Return type:

    string

    +
    +

    Compiles an SQL query with the bind values passed for it.

    +
    + +
    +
    +is_write_type($sql)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $sql (string) – The SQL statement
    • +
    +
    Returns:

    TRUE if the SQL statement is of “write type”, FALSE if not

    +
    Return type:

    bool

    +
    +

    Determines if a query is of a “write” type (such as +INSERT, UPDATE, DELETE) or “read” type (i.e. SELECT).

    +
    + +
    +
    +elapsed_time([$decimals = 6])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $decimals (int) – The number of decimal places
    • +
    +
    Returns:

    The aggregate query elapsed time, in microseconds

    +
    Return type:

    string

    +
    +

    Calculate the aggregate query elapsed time.

    +
    + +
    +
    +total_queries()
    +
    +++ + + + + + +
    Returns:The total number of queries executed
    Return type:int
    +

    Returns the total number of queries that have been +executed so far.

    +
    + +
    +
    +last_query()
    +
    +++ + + + + + +
    Returns:The last query executed
    Return type:string
    +

    Returns the last query that was executed.

    +
    + +
    +
    +escape($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (mixed) – The value to escape, or an array of multiple ones
    • +
    +
    Returns:

    The escaped value(s)

    +
    Return type:

    mixed

    +
    +

    Escapes input data based on type, including boolean and +NULLs.

    +
    + +
    +
    +escape_str($str[, $like = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (mixed) – A string value or array of multiple ones
    • +
    • $like (bool) – Whether or not the string will be used in a LIKE condition
    • +
    +
    Returns:

    The escaped string(s)

    +
    Return type:

    mixed

    +
    +

    Escapes string values.

    +
    +

    Warning

    +

    The returned strings do NOT include quotes +around them.

    +
    +
    + +
    +
    +escape_like_str($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (mixed) – A string value or array of multiple ones
    • +
    +
    Returns:

    The escaped string(s)

    +
    Return type:

    mixed

    +
    +

    Escape LIKE strings.

    +

    Similar to escape_str(), but will also escape the % +and _ wildcard characters, so that they don’t cause +false-positives in LIKE conditions.

    +
    +

    Important

    +

    The escape_like_str() method uses ‘!’ (exclamation mark) +to escape special characters for LIKE conditions. Because this +method escapes partial strings that you would wrap in quotes +yourself, it cannot automatically add the ESCAPE '!' +condition for you, and so you’ll have to manually do that.

    +
    +
    + +
    +
    +primary($table)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    +
    Returns:

    The primary key name, FALSE if none

    +
    Return type:

    string

    +
    +

    Retrieves the primary key of a table.

    +
    +

    Note

    +

    If the database platform does not support primary +key detection, the first column name may be assumed +as the primary key.

    +
    +
    + +
    +
    +count_all([$table = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    +
    Returns:

    Row count for the specified table

    +
    Return type:

    int

    +
    +

    Returns the total number of rows in a table, or 0 if no +table was provided.

    +
    + +
    +
    +list_tables([$constrain_by_prefix = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $constrain_by_prefix (bool) – TRUE to match table names by the configured dbprefix
    • +
    +
    Returns:

    Array of table names or FALSE on failure

    +
    Return type:

    array

    +
    +

    Gets a list of the tables in the current database.

    +
    + +
    +
    +table_exists($table_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table_name (string) – The table name
    • +
    +
    Returns:

    TRUE if that table exists, FALSE if not

    +
    Return type:

    bool

    +
    +

    Determine if a particular table exists.

    +
    + +
    +
    +list_fields($table)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The table name
    • +
    +
    Returns:

    Array of field names or FALSE on failure

    +
    Return type:

    array

    +
    +

    Gets a list of the field names in a table.

    +
    + +
    +
    +field_exists($field_name, $table_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table_name (string) – The table name
    • +
    • $field_name (string) – The field name
    • +
    +
    Returns:

    TRUE if that field exists in that table, FALSE if not

    +
    Return type:

    bool

    +
    +

    Determine if a particular field exists.

    +
    + +
    +
    +field_data($table)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The table name
    • +
    +
    Returns:

    Array of field data items or FALSE on failure

    +
    Return type:

    array

    +
    +

    Gets a list containing field data about a table.

    +
    + +
    +
    +escape_identifiers($item)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (mixed) – The item or array of items to escape
    • +
    +
    Returns:

    The input item(s), escaped

    +
    Return type:

    mixed

    +
    +

    Escape SQL identifiers, such as column, table and names.

    +
    + +
    +
    +insert_string($table, $data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The target table
    • +
    • $data (array) – An associative array of key/value pairs
    • +
    +
    Returns:

    The SQL INSERT statement, as a string

    +
    Return type:

    string

    +
    +

    Generate an INSERT statement string.

    +
    + +
    +
    +update_string($table, $data, $where)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The target table
    • +
    • $data (array) – An associative array of key/value pairs
    • +
    • $where (mixed) – The WHERE statement conditions
    • +
    +
    Returns:

    The SQL UPDATE statement, as a string

    +
    Return type:

    string

    +
    +

    Generate an UPDATE statement string.

    +
    + +
    +
    +call_function($function)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $function (string) – Function name
    • +
    +
    Returns:

    The function result

    +
    Return type:

    string

    +
    +

    Runs a native PHP function , using a platform agnostic +wrapper.

    +
    + +
    +
    +cache_set_path([$path = ''])
    +
    +++ + + + + + +
    Parameters:
      +
    • $path (string) – Path to the cache directory
    • +
    +
    Return type:

    void

    +
    +

    Sets the directory path to use for caching storage.

    +
    + +
    +
    +cache_on()
    +
    +++ + + + + + +
    Returns:TRUE if caching is on, FALSE if not
    Return type:bool
    +

    Enable database results caching.

    +
    + +
    +
    +cache_off()
    +
    +++ + + + + + +
    Returns:TRUE if caching is on, FALSE if not
    Return type:bool
    +

    Disable database results caching.

    +
    + +
    +
    +cache_delete([$segment_one = ''[, $segment_two = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $segment_one (string) – First URI segment
    • +
    • $segment_two (string) – Second URI segment
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Delete the cache files associated with a particular URI.

    +
    + +
    +
    +cache_delete_all()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Delete all cache files.

    +
    + +
    +
    +close()
    +
    +++ + + + +
    Return type:void
    +

    Close the DB Connection.

    +
    + +
    +
    +display_error([$error = ''[, $swap = ''[, $native = FALSE]]])
    +
    +++ + + + + + + + + + +
    Parameters:
      +
    • $error (string) – The error message
    • +
    • $swap (string) – Any “swap” values
    • +
    • $native (bool) – Whether to localize the message
    • +
    +
    Return type:

    void

    +
    Returns:

    Displays the DB error screensends the application/views/errors/error_db.php template

    +
    Return type:

    string

    +
    +

    Display an error message and stop script execution.

    +

    The message is displayed using the +application/views/errors/error_db.php template.

    +
    + +
    +
    +protect_identifiers($item[, $prefix_single = FALSE[, $protect_identifiers = NULL[, $field_exists = TRUE]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – The item to work with
    • +
    • $prefix_single (bool) – Whether to apply the dbprefix even if the input item is a single identifier
    • +
    • $protect_identifiers (bool) – Whether to quote identifiers
    • +
    • $field_exists (bool) – Whether the supplied item contains a field name or not
    • +
    +
    Returns:

    The modified item

    +
    Return type:

    string

    +
    +

    Takes a column or table name (optionally with an alias) +and applies the configured dbprefix to it.

    +

    Some logic is necessary in order to deal with +column names that include the path.

    +

    Consider a query like this:

    +
    SELECT * FROM hostname.database.table.column AS c FROM hostname.database.table
    +
    +
    +

    Or a query with aliasing:

    +
    SELECT m.member_id, m.member_name FROM members AS m
    +
    +
    +

    Since the column name can include up to four segments +(host, DB, table, column) or also have an alias prefix, +we need to do a bit of work to figure this out and +insert the table prefix (if it exists) in the proper +position, and escape only the correct identifiers.

    +

    This method is used extensively by the Query Builder class.

    +
    + +
    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/examples.html b/user_guide/database/examples.html new file mode 100755 index 0000000..943df22 --- /dev/null +++ b/user_guide/database/examples.html @@ -0,0 +1,597 @@ + + + + + + + + + + Database Quick Start: Example Code — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Quick Start: Example Code

    +

    The following page contains example code showing how the database class +is used. For complete details please read the individual pages +describing each function.

    +
    +

    Initializing the Database Class

    +

    The following code loads and initializes the database class based on +your configuration settings:

    +
    $this->load->database();
    +
    +
    +

    Once loaded the class is ready to be used as described below.

    +

    Note: If all your pages require database access you can connect +automatically. See the connecting page for details.

    +
    +
    +

    Standard Query With Multiple Results (Object Version)

    +
    $query = $this->db->query('SELECT name, title, email FROM my_table');
    +
    +foreach ($query->result() as $row)
    +{
    +        echo $row->title;
    +        echo $row->name;
    +        echo $row->email;
    +}
    +
    +echo 'Total Results: ' . $query->num_rows();
    +
    +
    +

    The above result() function returns an array of objects. Example: +$row->title

    +
    +
    +

    Standard Query With Multiple Results (Array Version)

    +
    $query = $this->db->query('SELECT name, title, email FROM my_table');
    +
    +foreach ($query->result_array() as $row)
    +{
    +        echo $row['title'];
    +        echo $row['name'];
    +        echo $row['email'];
    +}
    +
    +
    +

    The above result_array() function returns an array of standard array +indexes. Example: $row[‘title’]

    +
    +
    +

    Standard Query With Single Result

    +
    $query = $this->db->query('SELECT name FROM my_table LIMIT 1');
    +$row = $query->row();
    +echo $row->name;
    +
    +
    +

    The above row() function returns an object. Example: $row->name

    +
    +
    +

    Standard Query With Single Result (Array version)

    +
    $query = $this->db->query('SELECT name FROM my_table LIMIT 1');
    +$row = $query->row_array();
    +echo $row['name'];
    +
    +
    +

    The above row_array() function returns an array. Example: +$row[‘name’]

    +
    +
    +

    Standard Insert

    +
    $sql = "INSERT INTO mytable (title, name) VALUES (".$this->db->escape($title).", ".$this->db->escape($name).")";
    +$this->db->query($sql);
    +echo $this->db->affected_rows();
    +
    +
    +
    +
    +

    Query Builder Query

    +

    The Query Builder Pattern gives you a simplified +means of retrieving data:

    +
    $query = $this->db->get('table_name');
    +
    +foreach ($query->result() as $row)
    +{
    +        echo $row->title;
    +}
    +
    +
    +

    The above get() function retrieves all the results from the supplied +table. The Query Builder class contains a full +compliment of functions for working with data.

    +
    +
    +

    Query Builder Insert

    +
    $data = array(
    +        'title' => $title,
    +        'name' => $name,
    +        'date' => $date
    +);
    +
    +$this->db->insert('mytable', $data);  // Produces: INSERT INTO mytable (title, name, date) VALUES ('{$title}', '{$name}', '{$date}')
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html new file mode 100755 index 0000000..0983507 --- /dev/null +++ b/user_guide/database/forge.html @@ -0,0 +1,1034 @@ + + + + + + + + + + Database Forge Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Forge Class

    +

    The Database Forge Class contains methods that help you manage your +database.

    + +
    +

    Initializing the Forge Class

    +
    +

    Important

    +

    In order to initialize the Forge class, your database +driver must already be running, since the forge class relies on it.

    +
    +

    Load the Forge Class as follows:

    +
    $this->load->dbforge()
    +
    +
    +

    You can also pass another database object to the DB Forge loader, in case +the database you want to manage isn’t the default one:

    +
    $this->myforge = $this->load->dbforge($this->other_db, TRUE);
    +
    +
    +

    In the above example, we’re passing a custom database object as the first +parameter and then tell it to return the dbforge object, instead of +assigning it directly to $this->dbforge.

    +
    +

    Note

    +

    Both of the parameters can be used individually, just pass an empty +value as the first one if you wish to skip it.

    +
    +

    Once initialized you will access the methods using the $this->dbforge +object:

    +
    $this->dbforge->some_method();
    +
    +
    +
    +
    +

    Creating and Dropping Databases

    +

    $this->dbforge->create_database(‘db_name’)

    +

    Permits you to create the database specified in the first parameter. +Returns TRUE/FALSE based on success or failure:

    +
    if ($this->dbforge->create_database('my_db'))
    +{
    +        echo 'Database created!';
    +}
    +
    +
    +

    $this->dbforge->drop_database(‘db_name’)

    +

    Permits you to drop the database specified in the first parameter. +Returns TRUE/FALSE based on success or failure:

    +
    if ($this->dbforge->drop_database('my_db'))
    +{
    +        echo 'Database deleted!';
    +}
    +
    +
    +
    +
    +

    Creating and Dropping Tables

    +

    There are several things you may wish to do when creating tables. Add +fields, add keys to the table, alter columns. CodeIgniter provides a +mechanism for this.

    +
    +

    Adding fields

    +

    Fields are created via an associative array. Within the array you must +include a ‘type’ key that relates to the datatype of the field. For +example, INT, VARCHAR, TEXT, etc. Many datatypes (for example VARCHAR) +also require a ‘constraint’ key.

    +
    $fields = array(
    +        'users' => array(
    +                'type' => 'VARCHAR',
    +                'constraint' => '100',
    +        ),
    +);
    +// will translate to "users VARCHAR(100)" when the field is added.
    +
    +
    +

    Additionally, the following key/values can be used:

    +
      +
    • unsigned/true : to generate “UNSIGNED” in the field definition.
    • +
    • default/value : to generate a default value in the field definition.
    • +
    • null/true : to generate “NULL” in the field definition. Without this, +the field will default to “NOT NULL”.
    • +
    • auto_increment/true : generates an auto_increment flag on the +field. Note that the field type must be a type that supports this, +such as integer.
    • +
    • unique/true : to generate a unique key for the field definition.
    • +
    +
    $fields = array(
    +        'blog_id' => array(
    +                'type' => 'INT',
    +                'constraint' => 5,
    +                'unsigned' => TRUE,
    +                'auto_increment' => TRUE
    +        ),
    +        'blog_title' => array(
    +                'type' => 'VARCHAR',
    +                'constraint' => '100',
    +                'unique' => TRUE,
    +        ),
    +        'blog_author' => array(
    +                'type' =>'VARCHAR',
    +                'constraint' => '100',
    +                'default' => 'King of Town',
    +        ),
    +        'blog_description' => array(
    +                'type' => 'TEXT',
    +                'null' => TRUE,
    +        ),
    +);
    +
    +
    +

    After the fields have been defined, they can be added using +$this->dbforge->add_field($fields); followed by a call to the +create_table() method.

    +

    $this->dbforge->add_field()

    +

    The add fields method will accept the above array.

    +
    +

    Passing strings as fields

    +

    If you know exactly how you want a field to be created, you can pass the +string into the field definitions with add_field()

    +
    $this->dbforge->add_field("label varchar(100) NOT NULL DEFAULT 'default label'");
    +
    +
    +
    +

    Note

    +

    Passing raw strings as fields cannot be followed by add_key() calls on those fields.

    +
    +
    +

    Note

    +

    Multiple calls to add_field() are cumulative.

    +
    +
    +
    +

    Creating an id field

    +

    There is a special exception for creating id fields. A field with type +id will automatically be assigned as an INT(9) auto_incrementing +Primary Key.

    +
    $this->dbforge->add_field('id');
    +// gives id INT(9) NOT NULL AUTO_INCREMENT
    +
    +
    +
    +
    +
    +

    Adding Keys

    +

    Generally speaking, you’ll want your table to have Keys. This is +accomplished with $this->dbforge->add_key(‘field’). An optional second +parameter set to TRUE will make it a primary key. Note that add_key() +must be followed by a call to create_table().

    +

    Multiple column non-primary keys must be sent as an array. Sample output +below is for MySQL.

    +
    $this->dbforge->add_key('blog_id', TRUE);
    +// gives PRIMARY KEY `blog_id` (`blog_id`)
    +
    +$this->dbforge->add_key('blog_id', TRUE);
    +$this->dbforge->add_key('site_id', TRUE);
    +// gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)
    +
    +$this->dbforge->add_key('blog_name');
    +// gives KEY `blog_name` (`blog_name`)
    +
    +$this->dbforge->add_key(array('blog_name', 'blog_label'));
    +// gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)
    +
    +
    +
    +
    +

    Creating a table

    +

    After fields and keys have been declared, you can create a new table +with

    +
    $this->dbforge->create_table('table_name');
    +// gives CREATE TABLE table_name
    +
    +
    +

    An optional second parameter set to TRUE adds an “IF NOT EXISTS” clause +into the definition

    +
    $this->dbforge->create_table('table_name', TRUE);
    +// gives CREATE TABLE IF NOT EXISTS table_name
    +
    +
    +

    You could also pass optional table attributes, such as MySQL’s ENGINE:

    +
    $attributes = array('ENGINE' => 'InnoDB');
    +$this->dbforge->create_table('table_name', FALSE, $attributes);
    +// produces: CREATE TABLE `table_name` (...) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
    +
    +
    +
    +

    Note

    +

    Unless you specify the CHARACTER SET and/or COLLATE attributes, +create_table() will always add them with your configured char_set +and dbcollat values, as long as they are not empty (MySQL only).

    +
    +
    +
    +

    Dropping a table

    +

    Execute a DROP TABLE statement and optionally add an IF EXISTS clause.

    +
    // Produces: DROP TABLE table_name
    +$this->dbforge->drop_table('table_name');
    +
    +// Produces: DROP TABLE IF EXISTS table_name
    +$this->dbforge->drop_table('table_name',TRUE);
    +
    +
    +
    +
    +

    Renaming a table

    +

    Executes a TABLE rename

    +
    $this->dbforge->rename_table('old_table_name', 'new_table_name');
    +// gives ALTER TABLE old_table_name RENAME TO new_table_name
    +
    +
    +
    +
    +
    +

    Modifying Tables

    +
    +

    Adding a Column to a Table

    +

    $this->dbforge->add_column()

    +

    The add_column() method is used to modify an existing table. It +accepts the same field array as above, and can be used for an unlimited +number of additional fields.

    +
    $fields = array(
    +        'preferences' => array('type' => 'TEXT')
    +);
    +$this->dbforge->add_column('table_name', $fields);
    +// Executes: ALTER TABLE table_name ADD preferences TEXT
    +
    +
    +

    If you are using MySQL or CUBIRD, then you can take advantage of their +AFTER and FIRST clauses to position the new column.

    +

    Examples:

    +
    // Will place the new column after the `another_field` column:
    +$fields = array(
    +        'preferences' => array('type' => 'TEXT', 'after' => 'another_field')
    +);
    +
    +// Will place the new column at the start of the table definition:
    +$fields = array(
    +        'preferences' => array('type' => 'TEXT', 'first' => TRUE)
    +);
    +
    +
    +
    +
    +

    Dropping a Column From a Table

    +

    $this->dbforge->drop_column()

    +

    Used to remove a column from a table.

    +
    $this->dbforge->drop_column('table_name', 'column_to_drop');
    +
    +
    +
    +
    +

    Modifying a Column in a Table

    +

    $this->dbforge->modify_column()

    +

    The usage of this method is identical to add_column(), except it +alters an existing column rather than adding a new one. In order to +change the name you can add a “name” key into the field defining array.

    +
    $fields = array(
    +        'old_name' => array(
    +                'name' => 'new_name',
    +                'type' => 'TEXT',
    +        ),
    +);
    +$this->dbforge->modify_column('table_name', $fields);
    +// gives ALTER TABLE table_name CHANGE old_name new_name TEXT
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_DB_forge
    +
    +
    +add_column($table[, $field = array()[, $_after = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name to add the column to
    • +
    • $field (array) – Column definition(s)
    • +
    • $_after (string) – Column for AFTER clause (deprecated)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Adds a column to a table. Usage: See Adding a Column to a Table.

    +
    + +
    +
    +add_field($field)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (array) – Field definition to add
    • +
    +
    Returns:

    CI_DB_forge instance (method chaining)

    +
    Return type:

    CI_DB_forge

    +
    +

    Adds a field to the set that will be used to create a table. Usage: See Adding fields.

    +
    + +
    +
    +add_key($key[, $primary = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (array) – Name of a key field
    • +
    • $primary (bool) – Set to TRUE if it should be a primary key or a regular one
    • +
    +
    Returns:

    CI_DB_forge instance (method chaining)

    +
    Return type:

    CI_DB_forge

    +
    +

    Adds a key to the set that will be used to create a table. Usage: See Adding Keys.

    +
    + +
    +
    +create_database($db_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $db_name (string) – Name of the database to create
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Creates a new database. Usage: See Creating and Dropping Databases.

    +
    + +
    +
    +create_table($table[, $if_not_exists = FALSE[, array $attributes = array()]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Name of the table to create
    • +
    • $if_not_exists (string) – Set to TRUE to add an ‘IF NOT EXISTS’ clause
    • +
    • $attributes (string) – An associative array of table attributes
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Creates a new table. Usage: See Creating a table.

    +
    + +
    +
    +drop_column($table, $column_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $column_name (array) – The column name to drop
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Drops a column from a table. Usage: See Dropping a Column From a Table.

    +
    + +
    +
    +drop_database($db_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $db_name (string) – Name of the database to drop
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Drops a database. Usage: See Creating and Dropping Databases.

    +
    + +
    +
    +drop_table($table_name[, $if_exists = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Name of the table to drop
    • +
    • $if_exists (string) – Set to TRUE to add an ‘IF EXISTS’ clause
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Drops a table. Usage: See Dropping a table.

    +
    + +
    +
    +modify_column($table, $field)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $field (array) – Column definition(s)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Modifies a table column. Usage: See Modifying a Column in a Table.

    +
    + +
    +
    +rename_table($table_name, $new_table_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Current of the table
    • +
    • $new_table_name (string) – New name of the table
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Renames a table. Usage: See Renaming a table.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html new file mode 100755 index 0000000..e602533 --- /dev/null +++ b/user_guide/database/helpers.html @@ -0,0 +1,592 @@ + + + + + + + + + + Query Helper Methods — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Query Helper Methods

    +
    +

    Information From Executing a Query

    +

    $this->db->insert_id()

    +

    The insert ID number when performing database inserts.

    +
    +

    Note

    +

    If using the PDO driver with PostgreSQL, or using the Interbase +driver, this function requires a $name parameter, which specifies the +appropriate sequence to check for the insert id.

    +
    +

    $this->db->affected_rows()

    +

    Displays the number of affected rows, when doing “write” type queries +(insert, update, etc.).

    +
    +

    Note

    +

    In MySQL “DELETE FROM TABLE” returns 0 affected rows. The database +class has a small hack that allows it to return the correct number of +affected rows. By default this hack is enabled but it can be turned off +in the database driver file.

    +
    +

    $this->db->last_query()

    +

    Returns the last query that was run (the query string, not the result). +Example:

    +
    $str = $this->db->last_query();
    +
    +// Produces:  SELECT * FROM sometable....
    +
    +
    +
    +

    Note

    +

    Disabling the save_queries setting in your database +configuration will render this function useless.

    +
    +
    +
    +

    Information About Your Database

    +

    $this->db->count_all()

    +

    Permits you to determine the number of rows in a particular table. +Submit the table name in the first parameter. Example:

    +
    echo $this->db->count_all('my_table');
    +
    +// Produces an integer, like 25
    +
    +
    +

    $this->db->platform()

    +

    Outputs the database platform you are running (MySQL, MS SQL, Postgres, +etc…):

    +
    echo $this->db->platform();
    +
    +
    +

    $this->db->version()

    +

    Outputs the database version you are running:

    +
    echo $this->db->version();
    +
    +
    +
    +
    +

    Making Your Queries Easier

    +

    $this->db->insert_string()

    +

    This function simplifies the process of writing database inserts. It +returns a correctly formatted SQL insert string. Example:

    +
    $data = array('name' => $name, 'email' => $email, 'url' => $url);
    +
    +$str = $this->db->insert_string('table_name', $data);
    +
    +
    +

    The first parameter is the table name, the second is an associative +array with the data to be inserted. The above example produces:

    +
    INSERT INTO table_name (name, email, url) VALUES ('Rick', 'rick@example.com', 'example.com')
    +
    +
    +
    +

    Note

    +

    Values are automatically escaped, producing safer queries.

    +
    +

    $this->db->update_string()

    +

    This function simplifies the process of writing database updates. It +returns a correctly formatted SQL update string. Example:

    +
    $data = array('name' => $name, 'email' => $email, 'url' => $url);
    +
    +$where = "author_id = 1 AND status = 'active'";
    +
    +$str = $this->db->update_string('table_name', $data, $where);
    +
    +
    +

    The first parameter is the table name, the second is an associative +array with the data to be updated, and the third parameter is the +“where” clause. The above example produces:

    +
    UPDATE table_name SET name = 'Rick', email = 'rick@example.com', url = 'example.com' WHERE author_id = 1 AND status = 'active'
    +
    +
    +
    +

    Note

    +

    Values are automatically escaped, producing safer queries.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/index.html b/user_guide/database/index.html new file mode 100755 index 0000000..9cae6d6 --- /dev/null +++ b/user_guide/database/index.html @@ -0,0 +1,514 @@ + + + + + + + + + + Database Reference — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Database Reference
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Database Reference

    +

    CodeIgniter comes with a full-featured and very fast abstracted database +class that supports both traditional structures and Query Builder +patterns. The database functions offer clear, simple syntax.

    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/metadata.html b/user_guide/database/metadata.html new file mode 100755 index 0000000..feb2248 --- /dev/null +++ b/user_guide/database/metadata.html @@ -0,0 +1,614 @@ + + + + + + + + + + Database Metadata — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Metadata

    +
    +

    Table MetaData

    +

    These functions let you fetch table information.

    +
    +

    List the Tables in Your Database

    +

    $this->db->list_tables();

    +

    Returns an array containing the names of all the tables in the database +you are currently connected to. Example:

    +
    $tables = $this->db->list_tables();
    +
    +foreach ($tables as $table)
    +{
    +        echo $table;
    +}
    +
    +
    +
    +
    +

    Determine If a Table Exists

    +

    $this->db->table_exists();

    +

    Sometimes it’s helpful to know whether a particular table exists before +running an operation on it. Returns a boolean TRUE/FALSE. Usage example:

    +
    if ($this->db->table_exists('table_name'))
    +{
    +        // some code...
    +}
    +
    +
    +
    +

    Note

    +

    Replace table_name with the name of the table you are looking for.

    +
    +
    +
    +
    +

    Field MetaData

    +
    +

    List the Fields in a Table

    +

    $this->db->list_fields()

    +

    Returns an array containing the field names. This query can be called +two ways:

    +

    1. You can supply the table name and call it from the $this->db-> +object:

    +
    $fields = $this->db->list_fields('table_name');
    +
    +foreach ($fields as $field)
    +{
    +        echo $field;
    +}
    +
    +
    +

    2. You can gather the field names associated with any query you run by +calling the function from your query result object:

    +
    $query = $this->db->query('SELECT * FROM some_table');
    +
    +foreach ($query->list_fields() as $field)
    +{
    +        echo $field;
    +}
    +
    +
    +
    +
    +

    Determine If a Field is Present in a Table

    +

    $this->db->field_exists()

    +

    Sometimes it’s helpful to know whether a particular field exists before +performing an action. Returns a boolean TRUE/FALSE. Usage example:

    +
    if ($this->db->field_exists('field_name', 'table_name'))
    +{
    +        // some code...
    +}
    +
    +
    +
    +

    Note

    +

    Replace field_name with the name of the column you are looking +for, and replace table_name with the name of the table you are +looking for.

    +
    +
    +
    +

    Retrieve Field Metadata

    +

    $this->db->field_data()

    +

    Returns an array of objects containing field information.

    +

    Sometimes it’s helpful to gather the field names or other metadata, like +the column type, max length, etc.

    +
    +

    Note

    +

    Not all databases provide meta-data.

    +
    +

    Usage example:

    +
    $fields = $this->db->field_data('table_name');
    +
    +foreach ($fields as $field)
    +{
    +        echo $field->name;
    +        echo $field->type;
    +        echo $field->max_length;
    +        echo $field->primary_key;
    +}
    +
    +
    +

    If you have run a query already you can use the result object instead of +supplying the table name:

    +
    $query = $this->db->query("YOUR QUERY");
    +$fields = $query->field_data();
    +
    +
    +

    The following data is available from this function if supported by your +database:

    +
      +
    • name - column name
    • +
    • max_length - maximum length of the column
    • +
    • primary_key - 1 if the column is a primary key
    • +
    • type - the type of the column
    • +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html new file mode 100755 index 0000000..dd66453 --- /dev/null +++ b/user_guide/database/queries.html @@ -0,0 +1,658 @@ + + + + + + + + + + Queries — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Queries

    +
    +

    Query Basics

    +
    +

    Regular Queries

    +

    To submit a query, use the query function:

    +
    $this->db->query('YOUR QUERY HERE');
    +
    +
    +

    The query() function returns a database result object when “read” +type queries are run, which you can use to show your +results. When “write” type queries are run it simply +returns TRUE or FALSE depending on success or failure. When retrieving +data you will typically assign the query to your own variable, like +this:

    +
    $query = $this->db->query('YOUR QUERY HERE');
    +
    +
    +
    +
    +

    Simplified Queries

    +

    The simple_query method is a simplified version of the +$this->db->query() method. It DOES +NOT return a database result set, nor does it set the query timer, or +compile bind data, or store your query for debugging. It simply lets you +submit a query. Most users will rarely use this function.

    +

    It returns whatever the database drivers’ “execute” function returns. +That typically is TRUE/FALSE on success or failure for write type queries +such as INSERT, DELETE or UPDATE statements (which is what it really +should be used for) and a resource/object on success for queries with +fetchable results.

    +
    if ($this->db->simple_query('YOUR QUERY'))
    +{
    +        echo "Success!";
    +}
    +else
    +{
    +        echo "Query failed!";
    +}
    +
    +
    +
    +

    Note

    +

    PostgreSQL’s pg_exec() function (for example) always +returns a resource on success, even for write type queries. +So take that in mind if you’re looking for a boolean value.

    +
    +
    +
    +
    +

    Working with Database prefixes manually

    +

    If you have configured a database prefix and would like to prepend it to +a table name for use in a native SQL query for example, then you can use +the following:

    +
    $this->db->dbprefix('tablename'); // outputs prefix_tablename
    +
    +
    +

    If for any reason you would like to change the prefix programatically +without needing to create a new connection, you can use this method:

    +
    $this->db->set_dbprefix('newprefix_');
    +$this->db->dbprefix('tablename'); // outputs newprefix_tablename
    +
    +
    +
    +
    +

    Protecting identifiers

    +

    In many databases it is advisable to protect table and field names - for +example with backticks in MySQL. Query Builder queries are +automatically protected, however if you need to manually protect an +identifier you can use:

    +
    $this->db->protect_identifiers('table_name');
    +
    +
    +
    +

    Important

    +

    Although the Query Builder will try its best to properly +quote any field and table names that you feed it, note that it +is NOT designed to work with arbitrary user input. DO NOT feed it +with unsanitized user data.

    +
    +

    This function will also add a table prefix to your table, assuming you +have a prefix specified in your database config file. To enable the +prefixing set TRUE (boolean) via the second parameter:

    +
    $this->db->protect_identifiers('table_name', TRUE);
    +
    +
    +
    +
    +

    Escaping Queries

    +

    It’s a very good security practice to escape your data before submitting +it into your database. CodeIgniter has three methods that help you do +this:

    +
      +
    1. $this->db->escape() This function determines the data type so +that it can escape only string data. It also automatically adds +single quotes around the data so you don’t have to:

      +
      $sql = "INSERT INTO table (title) VALUES(".$this->db->escape($title).")";
      +
      +
      +
    2. +
    3. $this->db->escape_str() This function escapes the data passed to +it, regardless of type. Most of the time you’ll use the above +function rather than this one. Use the function like this:

      +
      $sql = "INSERT INTO table (title) VALUES('".$this->db->escape_str($title)."')";
      +
      +
      +
    4. +
    5. $this->db->escape_like_str() This method should be used when +strings are to be used in LIKE conditions so that LIKE wildcards +(‘%’, ‘_’) in the string are also properly escaped.

      +
    6. +
    +
    $search = '20% raise';
    +$sql = "SELECT id FROM table WHERE column LIKE '%" .
    +    $this->db->escape_like_str($search)."%' ESCAPE '!'";
    +
    +
    +
    +

    Important

    +

    The escape_like_str() method uses ‘!’ (exclamation mark) +to escape special characters for LIKE conditions. Because this +method escapes partial strings that you would wrap in quotes +yourself, it cannot automatically add the ESCAPE '!' +condition for you, and so you’ll have to manually do that.

    +
    +
    +
    +

    Query Bindings

    +

    Bindings enable you to simplify your query syntax by letting the system +put the queries together for you. Consider the following example:

    +
    $sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
    +$this->db->query($sql, array(3, 'live', 'Rick'));
    +
    +
    +

    The question marks in the query are automatically replaced with the +values in the array in the second parameter of the query function.

    +

    Binding also work with arrays, which will be transformed to IN sets:

    +
    $sql = "SELECT * FROM some_table WHERE id IN ? AND status = ? AND author = ?";
    +$this->db->query($sql, array(array(3, 6), 'live', 'Rick'));
    +
    +
    +

    The resulting query will be:

    +
    SELECT * FROM some_table WHERE id IN (3,6) AND status = 'live' AND author = 'Rick'
    +
    +
    +

    The secondary benefit of using binds is that the values are +automatically escaped, producing safer queries. You don’t have to +remember to manually escape data; the engine does it automatically for +you.

    +
    +
    +

    Handling Errors

    +

    $this->db->error();

    +

    If you need to get the last error that has occurred, the error() method +will return an array containing its code and message. Here’s a quick +example:

    +
    if ( ! $this->db->simple_query('SELECT `example_field` FROM `example_table`'))
    +{
    +        $error = $this->db->error(); // Has keys 'code' and 'message'
    +}
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/query_builder.html b/user_guide/database/query_builder.html new file mode 100755 index 0000000..3db72f9 --- /dev/null +++ b/user_guide/database/query_builder.html @@ -0,0 +1,2714 @@ + + + + + + + + + + Query Builder Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Query Builder Class

    +

    CodeIgniter gives you access to a Query Builder class. This pattern +allows information to be retrieved, inserted, and updated in your +database with minimal scripting. In some cases only one or two lines +of code are necessary to perform a database action. +CodeIgniter does not require that each database table be its own class +file. It instead provides a more simplified interface.

    +

    Beyond simplicity, a major benefit to using the Query Builder features +is that it allows you to create database independent applications, since +the query syntax is generated by each database adapter. It also allows +for safer queries, since the values are escaped automatically by the +system.

    +
    +

    Note

    +

    If you intend to write your own queries you can disable this +class in your database config file, allowing the core database library +and adapter to utilize fewer resources.

    +
    + +
    +

    Selecting Data

    +

    The following functions allow you to build SQL SELECT statements.

    +

    $this->db->get()

    +

    Runs the selection query and returns the result. Can be used by itself +to retrieve all records from a table:

    +
    $query = $this->db->get('mytable');  // Produces: SELECT * FROM mytable
    +
    +
    +

    The second and third parameters enable you to set a limit and offset +clause:

    +
    $query = $this->db->get('mytable', 10, 20);
    +
    +// Executes: SELECT * FROM mytable LIMIT 20, 10
    +// (in MySQL. Other databases have slightly different syntax)
    +
    +
    +

    You’ll notice that the above function is assigned to a variable named +$query, which can be used to show the results:

    +
    $query = $this->db->get('mytable');
    +
    +foreach ($query->result() as $row)
    +{
    +        echo $row->title;
    +}
    +
    +
    +

    Please visit the result functions page for a full +discussion regarding result generation.

    +

    $this->db->get_compiled_select()

    +

    Compiles the selection query just like $this->db->get() but does not run +the query. This method simply returns the SQL query as a string.

    +

    Example:

    +
    $sql = $this->db->get_compiled_select('mytable');
    +echo $sql;
    +
    +// Prints string: SELECT * FROM mytable
    +
    +
    +

    The second parameter enables you to set whether or not the query builder query +will be reset (by default it will be reset, just like when using $this->db->get()):

    +
    echo $this->db->limit(10,20)->get_compiled_select('mytable', FALSE);
    +
    +// Prints string: SELECT * FROM mytable LIMIT 20, 10
    +// (in MySQL. Other databases have slightly different syntax)
    +
    +echo $this->db->select('title, content, date')->get_compiled_select();
    +
    +// Prints string: SELECT title, content, date FROM mytable LIMIT 20, 10
    +
    +
    +

    The key thing to notice in the above example is that the second query did not +utilize $this->db->from() and did not pass a table name into the first +parameter. The reason for this outcome is because the query has not been +executed using $this->db->get() which resets values or reset directly +using $this->db->reset_query().

    +

    $this->db->get_where()

    +

    Identical to the above function except that it permits you to add a +“where” clause in the second parameter, instead of using the db->where() +function:

    +
    $query = $this->db->get_where('mytable', array('id' => $id), $limit, $offset);
    +
    +
    +

    Please read the about the where function below for more information.

    +
    +

    Note

    +

    get_where() was formerly known as getwhere(), which has been removed

    +
    +

    $this->db->select()

    +

    Permits you to write the SELECT portion of your query:

    +
    $this->db->select('title, content, date');
    +$query = $this->db->get('mytable');
    +
    +// Executes: SELECT title, content, date FROM mytable
    +
    +
    +
    +

    Note

    +

    If you are selecting all (*) from a table you do not need to +use this function. When omitted, CodeIgniter assumes that you wish +to select all fields and automatically adds ‘SELECT *’.

    +
    +

    $this->db->select() accepts an optional second parameter. If you set it +to FALSE, CodeIgniter will not try to protect your field or table names. +This is useful if you need a compound select statement where automatic +escaping of fields may break them.

    +
    $this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4) AS amount_paid', FALSE);
    +$query = $this->db->get('mytable');
    +
    +
    +

    $this->db->select_max()

    +

    Writes a SELECT MAX(field) portion for your query. You can optionally +include a second parameter to rename the resulting field.

    +
    $this->db->select_max('age');
    +$query = $this->db->get('members');  // Produces: SELECT MAX(age) as age FROM members
    +
    +$this->db->select_max('age', 'member_age');
    +$query = $this->db->get('members'); // Produces: SELECT MAX(age) as member_age FROM members
    +
    +
    +

    $this->db->select_min()

    +

    Writes a “SELECT MIN(field)” portion for your query. As with +select_max(), You can optionally include a second parameter to rename +the resulting field.

    +
    $this->db->select_min('age');
    +$query = $this->db->get('members'); // Produces: SELECT MIN(age) as age FROM members
    +
    +
    +

    $this->db->select_avg()

    +

    Writes a “SELECT AVG(field)” portion for your query. As with +select_max(), You can optionally include a second parameter to rename +the resulting field.

    +
    $this->db->select_avg('age');
    +$query = $this->db->get('members'); // Produces: SELECT AVG(age) as age FROM members
    +
    +
    +

    $this->db->select_sum()

    +

    Writes a “SELECT SUM(field)” portion for your query. As with +select_max(), You can optionally include a second parameter to rename +the resulting field.

    +
    $this->db->select_sum('age');
    +$query = $this->db->get('members'); // Produces: SELECT SUM(age) as age FROM members
    +
    +
    +

    $this->db->from()

    +

    Permits you to write the FROM portion of your query:

    +
    $this->db->select('title, content, date');
    +$this->db->from('mytable');
    +$query = $this->db->get();  // Produces: SELECT title, content, date FROM mytable
    +
    +
    +
    +

    Note

    +

    As shown earlier, the FROM portion of your query can be specified +in the $this->db->get() function, so use whichever method you prefer.

    +
    +

    $this->db->join()

    +

    Permits you to write the JOIN portion of your query:

    +
    $this->db->select('*');
    +$this->db->from('blogs');
    +$this->db->join('comments', 'comments.id = blogs.id');
    +$query = $this->db->get();
    +
    +// Produces:
    +// SELECT * FROM blogs JOIN comments ON comments.id = blogs.id
    +
    +
    +

    Multiple function calls can be made if you need several joins in one +query.

    +

    If you need a specific type of JOIN you can specify it via the third +parameter of the function. Options are: left, right, outer, inner, left +outer, and right outer.

    +
    $this->db->join('comments', 'comments.id = blogs.id', 'left');
    +// Produces: LEFT JOIN comments ON comments.id = blogs.id
    +
    +
    +
    +
    +

    Looking for Specific Data

    +

    $this->db->where()

    +

    This function enables you to set WHERE clauses using one of four +methods:

    +
    +

    Note

    +

    All values passed to this function are escaped automatically, +producing safer queries.

    +
    +
      +
    1. Simple key/value method:

      +
      +
      $this->db->where('name', $name); // Produces: WHERE name = 'Joe'
      +
      +
      +

      Notice that the equal sign is added for you.

      +

      If you use multiple function calls they will be chained together with +AND between them:

      +
      $this->db->where('name', $name);
      +$this->db->where('title', $title);
      +$this->db->where('status', $status);
      +// WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
      +
      +
      +
      +
    2. +
    3. Custom key/value method:

      +
      +

      You can include an operator in the first parameter in order to +control the comparison:

      +
      $this->db->where('name !=', $name);
      +$this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45
      +
      +
      +
      +
    4. +
    5. Associative array method:

      +
      +
      $array = array('name' => $name, 'title' => $title, 'status' => $status);
      +$this->db->where($array);
      +// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
      +
      +
      +

      You can include your own operators using this method as well:

      +
      $array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);
      +$this->db->where($array);
      +
      +
      +
      +
    6. +
    7. +
      Custom string:
      +

      You can write your own clauses manually:

      +
      $where = "name='Joe' AND status='boss' OR status='active'";
      +$this->db->where($where);
      +
      +
      +
      +
      +
    8. +
    +

    $this->db->where() accepts an optional third parameter. If you set it to +FALSE, CodeIgniter will not try to protect your field or table names.

    +
    $this->db->where('MATCH (field) AGAINST ("value")', NULL, FALSE);
    +
    +
    +

    $this->db->or_where()

    +

    This function is identical to the one above, except that multiple +instances are joined by OR:

    +
    $this->db->where('name !=', $name);
    +$this->db->or_where('id >', $id);  // Produces: WHERE name != 'Joe' OR id > 50
    +
    +
    +
    +

    Note

    +

    or_where() was formerly known as orwhere(), which has been +removed.

    +
    +

    $this->db->where_in()

    +

    Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with AND if +appropriate

    +
    $names = array('Frank', 'Todd', 'James');
    +$this->db->where_in('username', $names);
    +// Produces: WHERE username IN ('Frank', 'Todd', 'James')
    +
    +
    +

    $this->db->or_where_in()

    +

    Generates a WHERE field IN (‘item’, ‘item’) SQL query joined with OR if +appropriate

    +
    $names = array('Frank', 'Todd', 'James');
    +$this->db->or_where_in('username', $names);
    +// Produces: OR username IN ('Frank', 'Todd', 'James')
    +
    +
    +

    $this->db->where_not_in()

    +

    Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with +AND if appropriate

    +
    $names = array('Frank', 'Todd', 'James');
    +$this->db->where_not_in('username', $names);
    +// Produces: WHERE username NOT IN ('Frank', 'Todd', 'James')
    +
    +
    +

    $this->db->or_where_not_in()

    +

    Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with OR +if appropriate

    +
    $names = array('Frank', 'Todd', 'James');
    +$this->db->or_where_not_in('username', $names);
    +// Produces: OR username NOT IN ('Frank', 'Todd', 'James')
    +
    +
    +
    +
    +

    Looking for Similar Data

    +

    $this->db->like()

    +

    This method enables you to generate LIKE clauses, useful for doing +searches.

    +
    +

    Note

    +

    All values passed to this method are escaped automatically.

    +
    +
      +
    1. Simple key/value method:

      +
      +
      $this->db->like('title', 'match');
      +// Produces: WHERE `title` LIKE '%match%' ESCAPE '!'
      +
      +
      +

      If you use multiple method calls they will be chained together with +AND between them:

      +
      $this->db->like('title', 'match');
      +$this->db->like('body', 'match');
      +// WHERE `title` LIKE '%match%' ESCAPE '!' AND  `body` LIKE '%match% ESCAPE '!'
      +
      +
      +

      If you want to control where the wildcard (%) is placed, you can use +an optional third argument. Your options are ‘before’, ‘after’ and +‘both’ (which is the default).

      +
      $this->db->like('title', 'match', 'before');    // Produces: WHERE `title` LIKE '%match' ESCAPE '!'
      +$this->db->like('title', 'match', 'after');     // Produces: WHERE `title` LIKE 'match%' ESCAPE '!'
      +$this->db->like('title', 'match', 'both');      // Produces: WHERE `title` LIKE '%match%' ESCAPE '!'
      +
      +
      +
      +
    2. +
    3. Associative array method:

      +
      +
      $array = array('title' => $match, 'page1' => $match, 'page2' => $match);
      +$this->db->like($array);
      +// WHERE `title` LIKE '%match%' ESCAPE '!' AND  `page1` LIKE '%match%' ESCAPE '!' AND  `page2` LIKE '%match%' ESCAPE '!'
      +
      +
      +
      +
    4. +
    +

    $this->db->or_like()

    +

    This method is identical to the one above, except that multiple +instances are joined by OR:

    +
    $this->db->like('title', 'match'); $this->db->or_like('body', $match);
    +// WHERE `title` LIKE '%match%' ESCAPE '!' OR  `body` LIKE '%match%' ESCAPE '!'
    +
    +
    +
    +

    Note

    +

    or_like() was formerly known as orlike(), which has been removed.

    +
    +

    $this->db->not_like()

    +

    This method is identical to like(), except that it generates +NOT LIKE statements:

    +
    $this->db->not_like('title', 'match');  // WHERE `title` NOT LIKE '%match% ESCAPE '!'
    +
    +
    +

    $this->db->or_not_like()

    +

    This method is identical to not_like(), except that multiple +instances are joined by OR:

    +
    $this->db->like('title', 'match');
    +$this->db->or_not_like('body', 'match');
    +// WHERE `title` LIKE '%match% OR  `body` NOT LIKE '%match%' ESCAPE '!'
    +
    +
    +

    $this->db->group_by()

    +

    Permits you to write the GROUP BY portion of your query:

    +
    $this->db->group_by("title"); // Produces: GROUP BY title
    +
    +
    +

    You can also pass an array of multiple values as well:

    +
    $this->db->group_by(array("title", "date"));  // Produces: GROUP BY title, date
    +
    +
    +
    +

    Note

    +

    group_by() was formerly known as groupby(), which has been +removed.

    +
    +

    $this->db->distinct()

    +

    Adds the “DISTINCT” keyword to a query

    +
    $this->db->distinct();
    +$this->db->get('table'); // Produces: SELECT DISTINCT * FROM table
    +
    +
    +

    $this->db->having()

    +

    Permits you to write the HAVING portion of your query. There are 2 +possible syntaxes, 1 argument or 2:

    +
    $this->db->having('user_id = 45');  // Produces: HAVING user_id = 45
    +$this->db->having('user_id',  45);  // Produces: HAVING user_id = 45
    +
    +
    +

    You can also pass an array of multiple values as well:

    +
    $this->db->having(array('title =' => 'My Title', 'id <' => $id));
    +// Produces: HAVING title = 'My Title', id < 45
    +
    +
    +

    If you are using a database that CodeIgniter escapes queries for, you +can prevent escaping content by passing an optional third argument, and +setting it to FALSE.

    +
    $this->db->having('user_id',  45);  // Produces: HAVING `user_id` = 45 in some databases such as MySQL
    +$this->db->having('user_id',  45, FALSE);  // Produces: HAVING user_id = 45
    +
    +
    +

    $this->db->or_having()

    +

    Identical to having(), only separates multiple clauses with “OR”.

    +
    +
    +

    Ordering results

    +

    $this->db->order_by()

    +

    Lets you set an ORDER BY clause.

    +

    The first parameter contains the name of the column you would like to order by.

    +

    The second parameter lets you set the direction of the result. +Options are ASC, DESC AND RANDOM.

    +
    $this->db->order_by('title', 'DESC');
    +// Produces: ORDER BY `title` DESC
    +
    +
    +

    You can also pass your own string in the first parameter:

    +
    $this->db->order_by('title DESC, name ASC');
    +// Produces: ORDER BY `title` DESC, `name` ASC
    +
    +
    +

    Or multiple function calls can be made if you need multiple fields.

    +
    $this->db->order_by('title', 'DESC');
    +$this->db->order_by('name', 'ASC');
    +// Produces: ORDER BY `title` DESC, `name` ASC
    +
    +
    +

    If you choose the RANDOM direction option, then the first parameters will +be ignored, unless you specify a numeric seed value.

    +
    $this->db->order_by('title', 'RANDOM');
    +// Produces: ORDER BY RAND()
    +
    +$this->db->order_by(42, 'RANDOM');
    +// Produces: ORDER BY RAND(42)
    +
    +
    +
    +

    Note

    +

    order_by() was formerly known as orderby(), which has been +removed.

    +
    +
    +

    Note

    +

    Random ordering is not currently supported in Oracle and +will default to ASC instead.

    +
    +
    +
    +

    Limiting or Counting Results

    +

    $this->db->limit()

    +

    Lets you limit the number of rows you would like returned by the query:

    +
    $this->db->limit(10);  // Produces: LIMIT 10
    +
    +
    +

    The second parameter lets you set a result offset.

    +
    $this->db->limit(10, 20);  // Produces: LIMIT 20, 10 (in MySQL.  Other databases have slightly different syntax)
    +
    +
    +

    $this->db->count_all_results()

    +

    Permits you to determine the number of rows in a particular Active +Record query. Queries will accept Query Builder restrictors such as +where(), or_where(), like(), or_like(), etc. Example:

    +
    echo $this->db->count_all_results('my_table');  // Produces an integer, like 25
    +$this->db->like('title', 'match');
    +$this->db->from('my_table');
    +echo $this->db->count_all_results(); // Produces an integer, like 17
    +
    +
    +

    However, this method also resets any field values that you may have passed +to select(). If you need to keep them, you can pass FALSE as the +second parameter:

    +
    echo $this->db->count_all_results('my_table', FALSE);
    +
    +
    +

    $this->db->count_all()

    +

    Permits you to determine the number of rows in a particular table. +Submit the table name in the first parameter. Example:

    +
    echo $this->db->count_all('my_table');  // Produces an integer, like 25
    +
    +
    +
    +
    +

    Query grouping

    +

    Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow +you to create queries with complex WHERE clauses. Nested groups are supported. Example:

    +
    $this->db->select('*')->from('my_table')
    +        ->group_start()
    +                ->where('a', 'a')
    +                ->or_group_start()
    +                        ->where('b', 'b')
    +                        ->where('c', 'c')
    +                ->group_end()
    +        ->group_end()
    +        ->where('d', 'd')
    +->get();
    +
    +// Generates:
    +// SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'
    +
    +
    +
    +

    Note

    +

    groups need to be balanced, make sure every group_start() is matched by a group_end().

    +
    +

    $this->db->group_start()

    +

    Starts a new group by adding an opening parenthesis to the WHERE clause of the query.

    +

    $this->db->or_group_start()

    +

    Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘OR’.

    +

    $this->db->not_group_start()

    +

    Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘NOT’.

    +

    $this->db->or_not_group_start()

    +

    Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with ‘OR NOT’.

    +

    $this->db->group_end()

    +

    Ends the current group by adding an closing parenthesis to the WHERE clause of the query.

    +
    +
    +

    Inserting Data

    +

    $this->db->insert()

    +

    Generates an insert string based on the data you supply, and runs the +query. You can either pass an array or an object to the +function. Here is an example using an array:

    +
    $data = array(
    +        'title' => 'My title',
    +        'name' => 'My Name',
    +        'date' => 'My date'
    +);
    +
    +$this->db->insert('mytable', $data);
    +// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
    +
    +
    +

    The first parameter will contain the table name, the second is an +associative array of values.

    +

    Here is an example using an object:

    +
    /*
    +class Myclass {
    +        public $title = 'My Title';
    +        public $content = 'My Content';
    +        public $date = 'My Date';
    +}
    +*/
    +
    +$object = new Myclass;
    +$this->db->insert('mytable', $object);
    +// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')
    +
    +
    +

    The first parameter will contain the table name, the second is an +object.

    +
    +

    Note

    +

    All values are escaped automatically producing safer queries.

    +
    +

    $this->db->get_compiled_insert()

    +

    Compiles the insertion query just like $this->db->insert() but does not +run the query. This method simply returns the SQL query as a string.

    +

    Example:

    +
    $data = array(
    +        'title' => 'My title',
    +        'name'  => 'My Name',
    +        'date'  => 'My date'
    +);
    +
    +$sql = $this->db->set($data)->get_compiled_insert('mytable');
    +echo $sql;
    +
    +// Produces string: INSERT INTO mytable (`title`, `name`, `date`) VALUES ('My title', 'My name', 'My date')
    +
    +
    +

    The second parameter enables you to set whether or not the query builder query +will be reset (by default it will be–just like $this->db->insert()):

    +
    echo $this->db->set('title', 'My Title')->get_compiled_insert('mytable', FALSE);
    +
    +// Produces string: INSERT INTO mytable (`title`) VALUES ('My Title')
    +
    +echo $this->db->set('content', 'My Content')->get_compiled_insert();
    +
    +// Produces string: INSERT INTO mytable (`title`, `content`) VALUES ('My Title', 'My Content')
    +
    +
    +

    The key thing to notice in the above example is that the second query did not +utlize $this->db->from() nor did it pass a table name into the first +parameter. The reason this worked is because the query has not been executed +using $this->db->insert() which resets values or reset directly using +$this->db->reset_query().

    +
    +

    Note

    +

    This method doesn’t work for batched inserts.

    +
    +

    $this->db->insert_batch()

    +

    Generates an insert string based on the data you supply, and runs the +query. You can either pass an array or an object to the +function. Here is an example using an array:

    +
    $data = array(
    +        array(
    +                'title' => 'My title',
    +                'name' => 'My Name',
    +                'date' => 'My date'
    +        ),
    +        array(
    +                'title' => 'Another title',
    +                'name' => 'Another Name',
    +                'date' => 'Another date'
    +        )
    +);
    +
    +$this->db->insert_batch('mytable', $data);
    +// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'),  ('Another title', 'Another name', 'Another date')
    +
    +
    +

    The first parameter will contain the table name, the second is an +associative array of values.

    +
    +

    Note

    +

    All values are escaped automatically producing safer queries.

    +
    +
    +
    +

    Updating Data

    +

    $this->db->replace()

    +

    This method executes a REPLACE statement, which is basically the SQL +standard for (optional) DELETE + INSERT, using PRIMARY and UNIQUE +keys as the determining factor. +In our case, it will save you from the need to implement complex +logics with different combinations of select(), update(), +delete() and insert() calls.

    +

    Example:

    +
    $data = array(
    +        'title' => 'My title',
    +        'name'  => 'My Name',
    +        'date'  => 'My date'
    +);
    +
    +$this->db->replace('table', $data);
    +
    +// Executes: REPLACE INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
    +
    +
    +

    In the above example, if we assume that the title field is our primary +key, then if a row containing ‘My title’ as the title value, that row +will be deleted with our new row data replacing it.

    +

    Usage of the set() method is also allowed and all fields are +automatically escaped, just like with insert().

    +

    $this->db->set()

    +

    This function enables you to set values for inserts or updates.

    +

    It can be used instead of passing a data array directly to the insert +or update functions:

    +
    $this->db->set('name', $name);
    +$this->db->insert('mytable');  // Produces: INSERT INTO mytable (`name`) VALUES ('{$name}')
    +
    +
    +

    If you use multiple function called they will be assembled properly +based on whether you are doing an insert or an update:

    +
    $this->db->set('name', $name);
    +$this->db->set('title', $title);
    +$this->db->set('status', $status);
    +$this->db->insert('mytable');
    +
    +
    +

    set() will also accept an optional third parameter ($escape), that +will prevent data from being escaped if set to FALSE. To illustrate the +difference, here is set() used both with and without the escape +parameter.

    +
    $this->db->set('field', 'field+1', FALSE);
    +$this->db->where('id', 2);
    +$this->db->update('mytable'); // gives UPDATE mytable SET field = field+1 WHERE id = 2
    +
    +$this->db->set('field', 'field+1');
    +$this->db->where('id', 2);
    +$this->db->update('mytable'); // gives UPDATE `mytable` SET `field` = 'field+1' WHERE `id` = 2
    +
    +
    +

    You can also pass an associative array to this function:

    +
    $array = array(
    +        'name' => $name,
    +        'title' => $title,
    +        'status' => $status
    +);
    +
    +$this->db->set($array);
    +$this->db->insert('mytable');
    +
    +
    +

    Or an object:

    +
    /*
    +class Myclass {
    +        public $title = 'My Title';
    +        public $content = 'My Content';
    +        public $date = 'My Date';
    +}
    +*/
    +
    +$object = new Myclass;
    +$this->db->set($object);
    +$this->db->insert('mytable');
    +
    +
    +

    $this->db->update()

    +

    Generates an update string and runs the query based on the data you +supply. You can pass an array or an object to the function. Here +is an example using an array:

    +
    $data = array(
    +        'title' => $title,
    +        'name' => $name,
    +        'date' => $date
    +);
    +
    +$this->db->where('id', $id);
    +$this->db->update('mytable', $data);
    +// Produces:
    +//
    +//      UPDATE mytable
    +//      SET title = '{$title}', name = '{$name}', date = '{$date}'
    +//      WHERE id = $id
    +
    +
    +

    Or you can supply an object:

    +
    /*
    +class Myclass {
    +        public $title = 'My Title';
    +        public $content = 'My Content';
    +        public $date = 'My Date';
    +}
    +*/
    +
    +$object = new Myclass;
    +$this->db->where('id', $id);
    +$this->db->update('mytable', $object);
    +// Produces:
    +//
    +// UPDATE `mytable`
    +// SET `title` = '{$title}', `name` = '{$name}', `date` = '{$date}'
    +// WHERE id = `$id`
    +
    +
    +
    +

    Note

    +

    All values are escaped automatically producing safer queries.

    +
    +

    You’ll notice the use of the $this->db->where() function, enabling you +to set the WHERE clause. You can optionally pass this information +directly into the update function as a string:

    +
    $this->db->update('mytable', $data, "id = 4");
    +
    +
    +

    Or as an array:

    +
    $this->db->update('mytable', $data, array('id' => $id));
    +
    +
    +

    You may also use the $this->db->set() function described above when +performing updates.

    +

    $this->db->update_batch()

    +

    Generates an update string based on the data you supply, and runs the query. +You can either pass an array or an object to the function. +Here is an example using an array:

    +
    $data = array(
    +   array(
    +      'title' => 'My title' ,
    +      'name' => 'My Name 2' ,
    +      'date' => 'My date 2'
    +   ),
    +   array(
    +      'title' => 'Another title' ,
    +      'name' => 'Another Name 2' ,
    +      'date' => 'Another date 2'
    +   )
    +);
    +
    +$this->db->update_batch('mytable', $data, 'title');
    +
    +// Produces:
    +// UPDATE `mytable` SET `name` = CASE
    +// WHEN `title` = 'My title' THEN 'My Name 2'
    +// WHEN `title` = 'Another title' THEN 'Another Name 2'
    +// ELSE `name` END,
    +// `date` = CASE
    +// WHEN `title` = 'My title' THEN 'My date 2'
    +// WHEN `title` = 'Another title' THEN 'Another date 2'
    +// ELSE `date` END
    +// WHERE `title` IN ('My title','Another title')
    +
    +
    +

    The first parameter will contain the table name, the second is an associative +array of values, the third parameter is the where key.

    +
    +

    Note

    +

    All values are escaped automatically producing safer queries.

    +
    +
    +

    Note

    +

    affected_rows() won’t give you proper results with this method, +due to the very nature of how it works. Instead, update_batch() +returns the number of rows affected.

    +
    +

    $this->db->get_compiled_update()

    +

    This works exactly the same way as $this->db->get_compiled_insert() except +that it produces an UPDATE SQL string instead of an INSERT SQL string.

    +

    For more information view documentation for $this->db->get_compiled_insert().

    +
    +

    Note

    +

    This method doesn’t work for batched updates.

    +
    +
    +
    +

    Deleting Data

    +

    $this->db->delete()

    +

    Generates a delete SQL string and runs the query.

    +
    $this->db->delete('mytable', array('id' => $id));  // Produces: // DELETE FROM mytable  // WHERE id = $id
    +
    +
    +

    The first parameter is the table name, the second is the where clause. +You can also use the where() or or_where() functions instead of passing +the data to the second parameter of the function:

    +
    $this->db->where('id', $id);
    +$this->db->delete('mytable');
    +
    +// Produces:
    +// DELETE FROM mytable
    +// WHERE id = $id
    +
    +
    +

    An array of table names can be passed into delete() if you would like to +delete data from more than 1 table.

    +
    $tables = array('table1', 'table2', 'table3');
    +$this->db->where('id', '5');
    +$this->db->delete($tables);
    +
    +
    +

    If you want to delete all data from a table, you can use the truncate() +function, or empty_table().

    +

    $this->db->empty_table()

    +

    Generates a delete SQL string and runs the +query.:

    +
    $this->db->empty_table('mytable'); // Produces: DELETE FROM mytable
    +
    +
    +

    $this->db->truncate()

    +

    Generates a truncate SQL string and runs the query.

    +
    $this->db->from('mytable');
    +$this->db->truncate();
    +
    +// or
    +
    +$this->db->truncate('mytable');
    +
    +// Produce:
    +// TRUNCATE mytable
    +
    +
    +
    +

    Note

    +

    If the TRUNCATE command isn’t available, truncate() will +execute as “DELETE FROM table”.

    +
    +

    $this->db->get_compiled_delete()

    +

    This works exactly the same way as $this->db->get_compiled_insert() except +that it produces a DELETE SQL string instead of an INSERT SQL string.

    +

    For more information view documentation for $this->db->get_compiled_insert().

    +
    +
    +

    Method Chaining

    +

    Method chaining allows you to simplify your syntax by connecting +multiple functions. Consider this example:

    +
    $query = $this->db->select('title')
    +                ->where('id', $id)
    +                ->limit(10, 20)
    +                ->get('mytable');
    +
    +
    +
    +
    +

    Query Builder Caching

    +

    While not “true” caching, Query Builder enables you to save (or “cache”) +certain parts of your queries for reuse at a later point in your +script’s execution. Normally, when an Query Builder call is completed, +all stored information is reset for the next call. With caching, you can +prevent this reset, and reuse information easily.

    +

    Cached calls are cumulative. If you make 2 cached select() calls, and +then 2 uncached select() calls, this will result in 4 select() calls. +There are three Caching functions available:

    +

    $this->db->start_cache()

    +

    This function must be called to begin caching. All Query Builder queries +of the correct type (see below for supported queries) are stored for +later use.

    +

    $this->db->stop_cache()

    +

    This function can be called to stop caching.

    +

    $this->db->flush_cache()

    +

    This function deletes all items from the Query Builder cache.

    +
    +

    An example of caching

    +

    Here’s a usage example:

    +
    $this->db->start_cache();
    +$this->db->select('field1');
    +$this->db->stop_cache();
    +$this->db->get('tablename');
    +//Generates: SELECT `field1` FROM (`tablename`)
    +
    +$this->db->select('field2');
    +$this->db->get('tablename');
    +//Generates:  SELECT `field1`, `field2` FROM (`tablename`)
    +
    +$this->db->flush_cache();
    +$this->db->select('field2');
    +$this->db->get('tablename');
    +//Generates:  SELECT `field2` FROM (`tablename`)
    +
    +
    +
    +

    Note

    +

    The following statements can be cached: select, from, join, +where, like, group_by, having, order_by

    +
    +
    +
    +
    +

    Resetting Query Builder

    +

    $this->db->reset_query()

    +

    Resetting Query Builder allows you to start fresh with your query without +executing it first using a method like $this->db->get() or $this->db->insert(). +Just like the methods that execute a query, this will not reset items you’ve +cached using Query Builder Caching.

    +

    This is useful in situations where you are using Query Builder to generate SQL +(ex. $this->db->get_compiled_select()) but then choose to, for instance, +run the query:

    +
    // Note that the second parameter of the get_compiled_select method is FALSE
    +$sql = $this->db->select(array('field1','field2'))
    +                                ->where('field3',5)
    +                                ->get_compiled_select('mytable', FALSE);
    +
    +// ...
    +// Do something crazy with the SQL code... like add it to a cron script for
    +// later execution or something...
    +// ...
    +
    +$data = $this->db->get()->result_array();
    +
    +// Would execute and return an array of results of the following query:
    +// SELECT field1, field1 from mytable where field3 = 5;
    +
    +
    +
    +

    Note

    +

    Double calls to get_compiled_select() while you’re using the +Query Builder Caching functionality and NOT resetting your queries +will results in the cache being merged twice. That in turn will +i.e. if you’re caching a select() - select the same field twice.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_DB_query_builder
    +
    +
    +reset_query()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Resets the current Query Builder state. Useful when you want +to build a query that can be cancelled under certain conditions.

    +
    + +
    +
    +start_cache()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Starts the Query Builder cache.

    +
    + +
    +
    +stop_cache()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Stops the Query Builder cache.

    +
    + +
    +
    +flush_cache()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Empties the Query Builder cache.

    +
    + +
    +
    +set_dbprefix([$prefix = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $prefix (string) – The new prefix to use
    • +
    +
    Returns:

    The DB prefix in use

    +
    Return type:

    string

    +
    +

    Sets the database prefix, without having to reconnect.

    +
    + +
    +
    +dbprefix([$table = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The table name to prefix
    • +
    +
    Returns:

    The prefixed table name

    +
    Return type:

    string

    +
    +

    Prepends a database prefix, if one exists in configuration.

    +
    + +
    +
    +count_all_results([$table = ''[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $reset (bool) – Whether to reset values for SELECTs
    • +
    +
    Returns:

    Number of rows in the query result

    +
    Return type:

    int

    +
    +

    Generates a platform-specific query string that counts +all records returned by an Query Builder query.

    +
    + +
    +
    +get([$table = ''[, $limit = NULL[, $offset = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – The table to query
    • +
    • $limit (int) – The LIMIT clause
    • +
    • $offset (int) – The OFFSET clause
    • +
    +
    Returns:

    CI_DB_result instance (method chaining)

    +
    Return type:

    CI_DB_result

    +
    +

    Compiles and runs SELECT statement based on the already +called Query Builder methods.

    +
    + +
    +
    +get_where([$table = ''[, $where = NULL[, $limit = NULL[, $offset = NULL]]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (mixed) – The table(s) to fetch data from; string or array
    • +
    • $where (string) – The WHERE clause
    • +
    • $limit (int) – The LIMIT clause
    • +
    • $offset (int) – The OFFSET clause
    • +
    +
    Returns:

    CI_DB_result instance (method chaining)

    +
    Return type:

    CI_DB_result

    +
    +

    Same as get(), but also allows the WHERE to be added directly.

    +
    + +
    +
    +select([$select = '*'[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $select (string) – The SELECT portion of a query
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a SELECT clause to a query.

    +
    + +
    +
    +select_avg([$select = ''[, $alias = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $select (string) – Field to compute the average of
    • +
    • $alias (string) – Alias for the resulting value name
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a SELECT AVG(field) clause to a query.

    +
    + +
    +
    +select_max([$select = ''[, $alias = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $select (string) – Field to compute the maximum of
    • +
    • $alias (string) – Alias for the resulting value name
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a SELECT MAX(field) clause to a query.

    +
    + +
    +
    +select_min([$select = ''[, $alias = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $select (string) – Field to compute the minimum of
    • +
    • $alias (string) – Alias for the resulting value name
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a SELECT MIN(field) clause to a query.

    +
    + +
    +
    +select_sum([$select = ''[, $alias = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $select (string) – Field to compute the sum of
    • +
    • $alias (string) – Alias for the resulting value name
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a SELECT SUM(field) clause to a query.

    +
    + +
    +
    +distinct([$val = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $val (bool) – Desired value of the “distinct” flag
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Sets a flag which tells the query builder to add +a DISTINCT clause to the SELECT portion of the query.

    +
    + +
    +
    +from($from)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $from (mixed) – Table name(s); string or array
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Specifies the FROM clause of a query.

    +
    + +
    +
    +join($table, $cond[, $type = ''[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name to join
    • +
    • $cond (string) – The JOIN ON condition
    • +
    • $type (string) – The JOIN type
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a JOIN clause to a query.

    +
    + +
    +
    +where($key[, $value = NULL[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Name of field to compare, or associative array
    • +
    • $value (mixed) – If a single key, compared to this value
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates the WHERE portion of the query. +Separates multiple calls with ‘AND’.

    +
    + +
    +
    +or_where($key[, $value = NULL[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Name of field to compare, or associative array
    • +
    • $value (mixed) – If a single key, compared to this value
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates the WHERE portion of the query. +Separates multiple calls with ‘OR’.

    +
    + +
    +
    +or_where_in([$key = NULL[, $values = NULL[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – The field to search
    • +
    • $values (array) – The values searched on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates a WHERE field IN(‘item’, ‘item’) SQL query, +joined with ‘OR’ if appropriate.

    +
    + +
    +
    +or_where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – The field to search
    • +
    • $values (array) – The values searched on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates a WHERE field NOT IN(‘item’, ‘item’) SQL query, +joined with ‘OR’ if appropriate.

    +
    + +
    +
    +where_in([$key = NULL[, $values = NULL[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Name of field to examine
    • +
    • $values (array) – Array of target values
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates a WHERE field IN(‘item’, ‘item’) SQL query, +joined with ‘AND’ if appropriate.

    +
    + +
    +
    +where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Name of field to examine
    • +
    • $values (array) – Array of target values
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    DB_query_builder instance

    +
    Return type:

    object

    +
    +

    Generates a WHERE field NOT IN(‘item’, ‘item’) SQL query, +joined with ‘AND’ if appropriate.

    +
    + +
    +
    +group_start()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Starts a group expression, using ANDs for the conditions inside it.

    +
    + +
    +
    +or_group_start()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Starts a group expression, using ORs for the conditions inside it.

    +
    + +
    +
    +not_group_start()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Starts a group expression, using AND NOTs for the conditions inside it.

    +
    + +
    +
    +or_not_group_start()
    +
    +++ + + + + + +
    Returns:CI_DB_query_builder instance (method chaining)
    Return type:CI_DB_query_builder
    +

    Starts a group expression, using OR NOTs for the conditions inside it.

    +
    + +
    +
    +group_end()
    +
    +++ + + + + + +
    Returns:DB_query_builder instance
    Return type:object
    +

    Ends a group expression.

    +
    + +
    +
    +like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $match (string) – Text portion to match
    • +
    • $side (string) – Which side of the expression to put the ‘%’ wildcard on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a LIKE clause to a query, separating multiple calls with AND.

    +
    + +
    +
    +or_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $match (string) – Text portion to match
    • +
    • $side (string) – Which side of the expression to put the ‘%’ wildcard on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a LIKE clause to a query, separating multiple class with OR.

    +
    + +
    +
    +not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $match (string) – Text portion to match
    • +
    • $side (string) – Which side of the expression to put the ‘%’ wildcard on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a NOT LIKE clause to a query, separating multiple calls with AND.

    +
    + +
    +
    +or_not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $match (string) – Text portion to match
    • +
    • $side (string) – Which side of the expression to put the ‘%’ wildcard on
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a NOT LIKE clause to a query, separating multiple calls with OR.

    +
    + +
    +
    +having($key[, $value = NULL[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Identifier (string) or associative array of field/value pairs
    • +
    • $value (string) – Value sought if $key is an identifier
    • +
    • $escape (string) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a HAVING clause to a query, separating multiple calls with AND.

    +
    + +
    +
    +or_having($key[, $value = NULL[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Identifier (string) or associative array of field/value pairs
    • +
    • $value (string) – Value sought if $key is an identifier
    • +
    • $escape (string) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a HAVING clause to a query, separating multiple calls with OR.

    +
    + +
    +
    +group_by($by[, $escape = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $by (mixed) – Field(s) to group by; string or array
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds a GROUP BY clause to a query.

    +
    + +
    +
    +order_by($orderby[, $direction = ''[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $orderby (string) – Field to order by
    • +
    • $direction (string) – The order requested - ASC, DESC or random
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds an ORDER BY clause to a query.

    +
    + +
    +
    +limit($value[, $offset = 0])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $value (int) – Number of rows to limit the results to
    • +
    • $offset (int) – Number of rows to skip
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds LIMIT and OFFSET clauses to a query.

    +
    + +
    +
    +offset($offset)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $offset (int) – Number of rows to skip
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds an OFFSET clause to a query.

    +
    + +
    +
    +set($key[, $value = ''[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Field name, or an array of field/value pairs
    • +
    • $value (string) – Field value, if $key is a single field
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds field/value pairs to be passed later to insert(), +update() or replace().

    +
    + +
    +
    +insert([$table = ''[, $set = NULL[, $escape = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $set (array) – An associative array of field/value pairs
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Compiles and executes an INSERT statement.

    +
    + +
    +
    +insert_batch($table[, $set = NULL[, $escape = NULL[, $batch_size = 100]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $set (array) – Data to insert
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    • $batch_size (int) – Count of rows to insert at once
    • +
    +
    Returns:

    Number of rows inserted or FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Compiles and executes batch INSERT statements.

    +
    +

    Note

    +

    When more than $batch_size rows are provided, multiple +INSERT queries will be executed, each trying to insert +up to $batch_size rows.

    +
    +
    + +
    +
    +set_insert_batch($key[, $value = ''[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Field name or an array of field/value pairs
    • +
    • $value (string) – Field value, if $key is a single field
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds field/value pairs to be inserted in a table later via insert_batch().

    +
    + +
    +
    +update([$table = ''[, $set = NULL[, $where = NULL[, $limit = NULL]]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $set (array) – An associative array of field/value pairs
    • +
    • $where (string) – The WHERE clause
    • +
    • $limit (int) – The LIMIT clause
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Compiles and executes an UPDATE statement.

    +
    + +
    +
    +update_batch($table[, $set = NULL[, $value = NULL[, $batch_size = 100]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $set (array) – Field name, or an associative array of field/value pairs
    • +
    • $value (string) – Field value, if $set is a single field
    • +
    • $batch_size (int) – Count of conditions to group in a single query
    • +
    +
    Returns:

    Number of rows updated or FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Compiles and executes batch UPDATE statements.

    +
    +

    Note

    +

    When more than $batch_size field/value pairs are provided, +multiple queries will be executed, each handling up to +$batch_size field/value pairs.

    +
    +
    + +
    +
    +set_update_batch($key[, $value = ''[, $escape = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Field name or an array of field/value pairs
    • +
    • $value (string) – Field value, if $key is a single field
    • +
    • $escape (bool) – Whether to escape values and identifiers
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining)

    +
    Return type:

    CI_DB_query_builder

    +
    +

    Adds field/value pairs to be updated in a table later via update_batch().

    +
    + +
    +
    +replace([$table = ''[, $set = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $set (array) – An associative array of field/value pairs
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Compiles and executes a REPLACE statement.

    +
    + +
    +
    +delete([$table = ''[, $where = ''[, $limit = NULL[, $reset_data = TRUE]]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (mixed) – The table(s) to delete from; string or array
    • +
    • $where (string) – The WHERE clause
    • +
    • $limit (int) – The LIMIT clause
    • +
    • $reset_data (bool) – TRUE to reset the query “write” clause
    • +
    +
    Returns:

    CI_DB_query_builder instance (method chaining) or FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Compiles and executes a DELETE query.

    +
    + +
    +
    +truncate([$table = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Executes a TRUNCATE statement on a table.

    +
    +

    Note

    +

    If the database platform in use doesn’t support TRUNCATE, +a DELETE statement will be used instead.

    +
    +
    + +
    +
    +empty_table([$table = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Deletes all records from a table via a DELETE statement.

    +
    + +
    +
    +get_compiled_select([$table = ''[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $reset (bool) – Whether to reset the current QB values or not
    • +
    +
    Returns:

    The compiled SQL statement as a string

    +
    Return type:

    string

    +
    +

    Compiles a SELECT statement and returns it as a string.

    +
    + +
    +
    +get_compiled_insert([$table = ''[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $reset (bool) – Whether to reset the current QB values or not
    • +
    +
    Returns:

    The compiled SQL statement as a string

    +
    Return type:

    string

    +
    +

    Compiles an INSERT statement and returns it as a string.

    +
    + +
    +
    +get_compiled_update([$table = ''[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $reset (bool) – Whether to reset the current QB values or not
    • +
    +
    Returns:

    The compiled SQL statement as a string

    +
    Return type:

    string

    +
    +

    Compiles an UPDATE statement and returns it as a string.

    +
    + +
    +
    +get_compiled_delete([$table = ''[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table (string) – Table name
    • +
    • $reset (bool) – Whether to reset the current QB values or not
    • +
    +
    Returns:

    The compiled SQL statement as a string

    +
    Return type:

    string

    +
    +

    Compiles a DELETE statement and returns it as a string.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/results.html b/user_guide/database/results.html new file mode 100755 index 0000000..269a119 --- /dev/null +++ b/user_guide/database/results.html @@ -0,0 +1,1231 @@ + + + + + + + + + + Generating Query Results — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Generating Query Results

    +

    There are several ways to generate query results:

    + +
    +

    Result Arrays

    +

    result()

    +

    This method returns the query result as an array of objects, or +an empty array on failure. Typically you’ll use this in a foreach +loop, like this:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +foreach ($query->result() as $row)
    +{
    +        echo $row->title;
    +        echo $row->name;
    +        echo $row->body;
    +}
    +
    +
    +

    The above method is an alias of result_object().

    +

    You can also pass a string to result() which represents a class to +instantiate for each result object (note: this class must be loaded)

    +
    $query = $this->db->query("SELECT * FROM users;");
    +
    +foreach ($query->result('User') as $user)
    +{
    +        echo $user->name; // access attributes
    +        echo $user->reverse_name(); // or methods defined on the 'User' class
    +}
    +
    +
    +

    result_array()

    +

    This method returns the query result as a pure array, or an empty +array when no result is produced. Typically you’ll use this in a foreach +loop, like this:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +foreach ($query->result_array() as $row)
    +{
    +        echo $row['title'];
    +        echo $row['name'];
    +        echo $row['body'];
    +}
    +
    +
    +
    +
    +

    Result Rows

    +

    row()

    +

    This method returns a single result row. If your query has more than +one row, it returns only the first row. The result is returned as an +object. Here’s a usage example:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +$row = $query->row();
    +
    +if (isset($row))
    +{
    +        echo $row->title;
    +        echo $row->name;
    +        echo $row->body;
    +}
    +
    +
    +

    If you want a specific row returned you can submit the row number as a +digit in the first parameter:

    +
    $row = $query->row(5);
    +
    +
    +

    You can also add a second String parameter, which is the name of a class +to instantiate the row with:

    +
    $query = $this->db->query("SELECT * FROM users LIMIT 1;");
    +$row = $query->row(0, 'User');
    +
    +echo $row->name; // access attributes
    +echo $row->reverse_name(); // or methods defined on the 'User' class
    +
    +
    +

    row_array()

    +

    Identical to the above row() method, except it returns an array. +Example:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +$row = $query->row_array();
    +
    +if (isset($row))
    +{
    +        echo $row['title'];
    +        echo $row['name'];
    +        echo $row['body'];
    +}
    +
    +
    +

    If you want a specific row returned you can submit the row number as a +digit in the first parameter:

    +
    $row = $query->row_array(5);
    +
    +
    +

    In addition, you can walk forward/backwards/first/last through your +results using these variations:

    +
    +
    +
    $row = $query->first_row()
    +
    $row = $query->last_row()
    +
    $row = $query->next_row()
    +
    $row = $query->previous_row()
    +
    +
    +

    By default they return an object unless you put the word “array” in the +parameter:

    +
    +
    +
    $row = $query->first_row(‘array’)
    +
    $row = $query->last_row(‘array’)
    +
    $row = $query->next_row(‘array’)
    +
    $row = $query->previous_row(‘array’)
    +
    +
    +
    +

    Note

    +

    All the methods above will load the whole result into memory +(prefetching). Use unbuffered_row() for processing large +result sets.

    +
    +

    unbuffered_row()

    +

    This method returns a single result row without prefetching the whole +result in memory as row() does. If your query has more than one row, +it returns the current row and moves the internal data pointer ahead.

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +while ($row = $query->unbuffered_row())
    +{
    +        echo $row->title;
    +        echo $row->name;
    +        echo $row->body;
    +}
    +
    +
    +

    You can optionally pass ‘object’ (default) or ‘array’ in order to specify +the returned value’s type:

    +
    $query->unbuffered_row();               // object
    +$query->unbuffered_row('object');       // object
    +$query->unbuffered_row('array');        // associative array
    +
    +
    +
    +
    +

    Custom Result Objects

    +

    You can have the results returned as an instance of a custom class instead +of a stdClass or array, as the result() and result_array() +methods allow. This requires that the class is already loaded into memory. +The object will have all values returned from the database set as properties. +If these have been declared and are non-public then you should provide a +__set() method to allow them to be set.

    +

    Example:

    +
    class User {
    +
    +        public $id;
    +        public $email;
    +        public $username;
    +
    +        protected $last_login;
    +
    +        public function last_login($format)
    +        {
    +                return $this->last_login->format($format);
    +        }
    +
    +        public function __set($name, $value)
    +        {
    +                if ($name === 'last_login')
    +                {
    +                        $this->last_login = DateTime::createFromFormat('U', $value);
    +                }
    +        }
    +
    +        public function __get($name)
    +        {
    +                if (isset($this->$name))
    +                {
    +                        return $this->$name;
    +                }
    +        }
    +}
    +
    +
    +

    In addition to the two methods listed below, the following methods also can +take a class name to return the results as: first_row(), last_row(), +next_row(), and previous_row().

    +

    custom_result_object()

    +

    Returns the entire result set as an array of instances of the class requested. +The only parameter is the name of the class to instantiate.

    +

    Example:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +$rows = $query->custom_result_object('User');
    +
    +foreach ($rows as $row)
    +{
    +        echo $row->id;
    +        echo $row->email;
    +        echo $row->last_login('Y-m-d');
    +}
    +
    +
    +

    custom_row_object()

    +

    Returns a single row from your query results. The first parameter is the row +number of the results. The second parameter is the class name to instantiate.

    +

    Example:

    +
    $query = $this->db->query("YOUR QUERY");
    +
    +$row = $query->custom_row_object(0, 'User');
    +
    +if (isset($row))
    +{
    +        echo $row->email;   // access attributes
    +        echo $row->last_login('Y-m-d');   // access class methods
    +}
    +
    +
    +

    You can also use the row() method in exactly the same way.

    +

    Example:

    +
    $row = $query->custom_row_object(0, 'User');
    +
    +
    +
    +
    +

    Result Helper Methods

    +

    num_rows()

    +

    The number of rows returned by the query. Note: In this example, $query +is the variable that the query result object is assigned to:

    +
    $query = $this->db->query('SELECT * FROM my_table');
    +
    +echo $query->num_rows();
    +
    +
    +
    +

    Note

    +

    Not all database drivers have a native way of getting the total +number of rows for a result set. When this is the case, all of +the data is prefetched and count() is manually called on the +resulting array in order to achieve the same result.

    +
    +

    num_fields()

    +

    The number of FIELDS (columns) returned by the query. Make sure to call +the method using your query result object:

    +
    $query = $this->db->query('SELECT * FROM my_table');
    +
    +echo $query->num_fields();
    +
    +
    +

    free_result()

    +

    It frees the memory associated with the result and deletes the result +resource ID. Normally PHP frees its memory automatically at the end of +script execution. However, if you are running a lot of queries in a +particular script you might want to free the result after each query +result has been generated in order to cut down on memory consumption.

    +

    Example:

    +
    $query = $this->db->query('SELECT title FROM my_table');
    +
    +foreach ($query->result() as $row)
    +{
    +        echo $row->title;
    +}
    +
    +$query->free_result();  // The $query result object will no longer be available
    +
    +$query2 = $this->db->query('SELECT name FROM some_table');
    +
    +$row = $query2->row();
    +echo $row->name;
    +$query2->free_result(); // The $query2 result object will no longer be available
    +
    +
    +

    data_seek()

    +

    This method sets the internal pointer for the next result row to be +fetched. It is only useful in combination with unbuffered_row().

    +

    It accepts a positive integer value, which defaults to 0 and returns +TRUE on success or FALSE on failure.

    +
    $query = $this->db->query('SELECT `field_name` FROM `table_name`');
    +$query->data_seek(5); // Skip the first 5 rows
    +$row = $query->unbuffered_row();
    +
    +
    +
    +

    Note

    +

    Not all database drivers support this feature and will return FALSE. +Most notably - you won’t be able to use it with PDO.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_DB_result
    +
    +
    +result([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of requested results - array, object, or class name
    • +
    +
    Returns:

    Array containing the fetched rows

    +
    Return type:

    array

    +
    +

    A wrapper for the result_array(), result_object() +and custom_result_object() methods.

    +

    Usage: see Result Arrays.

    +
    + +
    +
    +result_array()
    +
    +++ + + + + + +
    Returns:Array containing the fetched rows
    Return type:array
    +

    Returns the query results as an array of rows, where each +row is itself an associative array.

    +

    Usage: see Result Arrays.

    +
    + +
    +
    +result_object()
    +
    +++ + + + + + +
    Returns:Array containing the fetched rows
    Return type:array
    +

    Returns the query results as an array of rows, where each +row is an object of type stdClass.

    +

    Usage: see Result Arrays.

    +
    + +
    +
    +custom_result_object($class_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $class_name (string) – Class name for the resulting rows
    • +
    +
    Returns:

    Array containing the fetched rows

    +
    Return type:

    array

    +
    +

    Returns the query results as an array of rows, where each +row is an instance of the specified class.

    +
    + +
    +
    +row([$n = 0[, $type = 'object']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Index of the query results row to be returned
    • +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    The requested row or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    A wrapper for the row_array(), row_object() and +``custom_row_object() methods.

    +

    Usage: see Result Rows.

    +
    + +
    +
    +unbuffered_row([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    Next row from the result set or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    Fetches the next result row and returns it in the +requested form.

    +

    Usage: see Result Rows.

    +
    + +
    +
    +row_array([$n = 0])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Index of the query results row to be returned
    • +
    +
    Returns:

    The requested row or NULL if it doesn’t exist

    +
    Return type:

    array

    +
    +

    Returns the requested result row as an associative array.

    +

    Usage: see Result Rows.

    +
    + +
    +
    +row_object([$n = 0])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Index of the query results row to be returned
    • +
    +
    Returns:

    The requested row or NULL if it doesn’t exist

    +
    Return type:

    stdClass

    +
    +

    Returns the requested result row as an object of type +stdClass.

    +

    Usage: see Result Rows.

    +
    + +
    +
    +custom_row_object($n, $type)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Index of the results row to return
    • +
    • $class_name (string) – Class name for the resulting row
    • +
    +
    Returns:

    The requested row or NULL if it doesn’t exist

    +
    Return type:

    $type

    +
    +

    Returns the requested result row as an instance of the +requested class.

    +
    + +
    +
    +data_seek([$n = 0])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Index of the results row to be returned next
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Moves the internal results row pointer to the desired offset.

    +

    Usage: see Result Helper Methods.

    +
    + +
    +
    +set_row($key[, $value = NULL])
    +
    +++ + + + + + +
    Parameters:
      +
    • $key (mixed) – Column name or array of key/value pairs
    • +
    • $value (mixed) – Value to assign to the column, $key is a single field name
    • +
    +
    Return type:

    void

    +
    +

    Assigns a value to a particular column.

    +
    + +
    +
    +next_row([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    Next row of result set, or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    Returns the next row from the result set.

    +
    + +
    +
    +previous_row([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    Previous row of result set, or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    Returns the previous row from the result set.

    +
    + +
    +
    +first_row([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    First row of result set, or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    Returns the first row from the result set.

    +
    + +
    +
    +last_row([$type = 'object'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Type of the requested result - array, object, or class name
    • +
    +
    Returns:

    Last row of result set, or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    Returns the last row from the result set.

    +
    + +
    +
    +num_rows()
    +
    +++ + + + + + +
    Returns:Number of rows in the result set
    Return type:int
    +

    Returns the number of rows in the result set.

    +

    Usage: see Result Helper Methods.

    +
    + +
    +
    +num_fields()
    +
    +++ + + + + + +
    Returns:Number of fields in the result set
    Return type:int
    +

    Returns the number of fields in the result set.

    +

    Usage: see Result Helper Methods.

    +
    + +
    +
    +field_data()
    +
    +++ + + + + + +
    Returns:Array containing field meta-data
    Return type:array
    +

    Generates an array of stdClass objects containing +field meta-data.

    +
    + +
    +
    +free_result()
    +
    +++ + + + +
    Return type:void
    +

    Frees a result set.

    +

    Usage: see Result Helper Methods.

    +
    + +
    +
    +list_fields()
    +
    +++ + + + + + +
    Returns:Array of column names
    Return type:array
    +

    Returns an array containing the field names in the +result set.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html new file mode 100755 index 0000000..b0c40a0 --- /dev/null +++ b/user_guide/database/transactions.html @@ -0,0 +1,615 @@ + + + + + + + + + + Transactions — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Transactions

    +

    CodeIgniter’s database abstraction allows you to use transactions with +databases that support transaction-safe table types. In MySQL, you’ll +need to be running InnoDB or BDB table types rather than the more common +MyISAM. Most other database platforms support transactions natively.

    +

    If you are not familiar with transactions we recommend you find a good +online resource to learn about them for your particular database. The +information below assumes you have a basic understanding of +transactions.

    +
    +

    CodeIgniter’s Approach to Transactions

    +

    CodeIgniter utilizes an approach to transactions that is very similar to +the process used by the popular database class ADODB. We’ve chosen that +approach because it greatly simplifies the process of running +transactions. In most cases all that is required are two lines of code.

    +

    Traditionally, transactions have required a fair amount of work to +implement since they demand that you keep track of your queries and +determine whether to commit or rollback based on the success or failure +of your queries. This is particularly cumbersome with nested queries. In +contrast, we’ve implemented a smart transaction system that does all +this for you automatically (you can also manage your transactions +manually if you choose to, but there’s really no benefit).

    +
    +
    +

    Running Transactions

    +

    To run your queries using transactions you will use the +$this->db->trans_start() and $this->db->trans_complete() functions as +follows:

    +
    $this->db->trans_start();
    +$this->db->query('AN SQL QUERY...');
    +$this->db->query('ANOTHER QUERY...');
    +$this->db->query('AND YET ANOTHER QUERY...');
    +$this->db->trans_complete();
    +
    +
    +

    You can run as many queries as you want between the start/complete +functions and they will all be committed or rolled back based on success +or failure of any given query.

    +
    +
    +

    Strict Mode

    +

    By default CodeIgniter runs all transactions in Strict Mode. When strict +mode is enabled, if you are running multiple groups of transactions, if +one group fails all groups will be rolled back. If strict mode is +disabled, each group is treated independently, meaning a failure of one +group will not affect any others.

    +

    Strict Mode can be disabled as follows:

    +
    $this->db->trans_strict(FALSE);
    +
    +
    +
    +
    +

    Managing Errors

    +

    If you have error reporting enabled in your config/database.php file +you’ll see a standard error message if the commit was unsuccessful. If +debugging is turned off, you can manage your own errors like this:

    +
    $this->db->trans_start();
    +$this->db->query('AN SQL QUERY...');
    +$this->db->query('ANOTHER QUERY...');
    +$this->db->trans_complete();
    +
    +if ($this->db->trans_status() === FALSE)
    +{
    +        // generate an error... or use the log_message() function to log your error
    +}
    +
    +
    +
    +
    +

    Disabling Transactions

    +

    If you would like to disable transactions you can do so using +$this->db->trans_off():

    +
    $this->db->trans_off();
    +
    +$this->db->trans_start();
    +$this->db->query('AN SQL QUERY...');
    +$this->db->trans_complete();
    +
    +
    +

    When transactions are disabled, your queries will be auto-committed, just as +they are when running queries without transactions, practically ignoring +any calls to trans_start(), trans_complete(), etc.

    +
    +
    +

    Test Mode

    +

    You can optionally put the transaction system into “test mode”, which +will cause your queries to be rolled back – even if the queries produce +a valid result. To use test mode simply set the first parameter in the +$this->db->trans_start() function to TRUE:

    +
    $this->db->trans_start(TRUE); // Query will be rolled back
    +$this->db->query('AN SQL QUERY...');
    +$this->db->trans_complete();
    +
    +
    +
    +
    +

    Running Transactions Manually

    +

    If you would like to run transactions manually you can do so as follows:

    +
    $this->db->trans_begin();
    +
    +$this->db->query('AN SQL QUERY...');
    +$this->db->query('ANOTHER QUERY...');
    +$this->db->query('AND YET ANOTHER QUERY...');
    +
    +if ($this->db->trans_status() === FALSE)
    +{
    +        $this->db->trans_rollback();
    +}
    +else
    +{
    +        $this->db->trans_commit();
    +}
    +
    +
    +
    +

    Note

    +

    Make sure to use $this->db->trans_begin() when running manual +transactions, NOT $this->db->trans_start().

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html new file mode 100755 index 0000000..da82f1f --- /dev/null +++ b/user_guide/database/utilities.html @@ -0,0 +1,993 @@ + + + + + + + + + + Database Utility Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Database Utility Class

    +

    The Database Utility Class contains methods that help you manage your +database.

    + +
    +

    Initializing the Utility Class

    +
    +

    Important

    +

    In order to initialize the Utility class, your database +driver must already be running, since the utilities class relies on it.

    +
    +

    Load the Utility Class as follows:

    +
    $this->load->dbutil();
    +
    +
    +

    You can also pass another database object to the DB Utility loader, in case +the database you want to manage isn’t the default one:

    +
    $this->myutil = $this->load->dbutil($this->other_db, TRUE);
    +
    +
    +

    In the above example, we’re passing a custom database object as the first +parameter and then tell it to return the dbutil object, instead of +assigning it directly to $this->dbutil.

    +
    +

    Note

    +

    Both of the parameters can be used individually, just pass an empty +value as the first one if you wish to skip it.

    +
    +

    Once initialized you will access the methods using the $this->dbutil +object:

    +
    $this->dbutil->some_method();
    +
    +
    +
    +
    +

    Using the Database Utilities

    +
    +

    Retrieve list of database names

    +

    Returns an array of database names:

    +
    $dbs = $this->dbutil->list_databases();
    +
    +foreach ($dbs as $db)
    +{
    +        echo $db;
    +}
    +
    +
    +
    +
    +

    Determine If a Database Exists

    +

    Sometimes it’s helpful to know whether a particular database exists. +Returns a boolean TRUE/FALSE. Usage example:

    +
    if ($this->dbutil->database_exists('database_name'))
    +{
    +        // some code...
    +}
    +
    +
    +
    +

    Note

    +

    Replace database_name with the name of the database you are +looking for. This method is case sensitive.

    +
    +
    +
    +

    Optimize a Table

    +

    Permits you to optimize a table using the table name specified in the +first parameter. Returns TRUE/FALSE based on success or failure:

    +
    if ($this->dbutil->optimize_table('table_name'))
    +{
    +        echo 'Success!';
    +}
    +
    +
    +
    +

    Note

    +

    Not all database platforms support table optimization. It is +mostly for use with MySQL.

    +
    +
    +
    +

    Repair a Table

    +

    Permits you to repair a table using the table name specified in the +first parameter. Returns TRUE/FALSE based on success or failure:

    +
    if ($this->dbutil->repair_table('table_name'))
    +{
    +        echo 'Success!';
    +}
    +
    +
    +
    +

    Note

    +

    Not all database platforms support table repairs.

    +
    +
    +
    +

    Optimize a Database

    +

    Permits you to optimize the database your DB class is currently +connected to. Returns an array containing the DB status messages or +FALSE on failure.

    +
    $result = $this->dbutil->optimize_database();
    +
    +if ($result !== FALSE)
    +{
    +        print_r($result);
    +}
    +
    +
    +
    +

    Note

    +

    Not all database platforms support database optimization. It +it is mostly for use with MySQL.

    +
    +
    +
    +

    Export a Query Result as a CSV File

    +

    Permits you to generate a CSV file from a query result. The first +parameter of the method must contain the result object from your +query. Example:

    +
    $this->load->dbutil();
    +
    +$query = $this->db->query("SELECT * FROM mytable");
    +
    +echo $this->dbutil->csv_from_result($query);
    +
    +
    +

    The second, third, and fourth parameters allow you to set the delimiter +newline, and enclosure characters respectively. By default commas are +used as the delimiter, “n” is used as a new line, and a double-quote +is used as the enclosure. Example:

    +
    $delimiter = ",";
    +$newline = "\r\n";
    +$enclosure = '"';
    +
    +echo $this->dbutil->csv_from_result($query, $delimiter, $newline, $enclosure);
    +
    +
    +
    +

    Important

    +

    This method will NOT write the CSV file for you. It +simply creates the CSV layout. If you need to write the file +use the File Helper.

    +
    +
    +
    +

    Export a Query Result as an XML Document

    +

    Permits you to generate an XML file from a query result. The first +parameter expects a query result object, the second may contain an +optional array of config parameters. Example:

    +
    $this->load->dbutil();
    +
    +$query = $this->db->query("SELECT * FROM mytable");
    +
    +$config = array (
    +        'root'          => 'root',
    +        'element'       => 'element',
    +        'newline'       => "\n",
    +        'tab'           => "\t"
    +);
    +
    +echo $this->dbutil->xml_from_result($query, $config);
    +
    +
    +
    +

    Important

    +

    This method will NOT write the XML file for you. It +simply creates the XML layout. If you need to write the file +use the File Helper.

    +
    +
    +
    +
    +

    Backup Your Database

    +
    +

    Database Backup Notes

    +

    Permits you to backup your full database or individual tables. The +backup data can be compressed in either Zip or Gzip format.

    +
    +

    Note

    +

    This feature is only available for MySQL and Interbase/Firebird databases.

    +
    +
    +

    Note

    +

    For Interbase/Firebird databases, the backup file name is the only parameter.

    +

    $this->dbutil->backup(‘db_backup_filename’);

    +
    +
    +

    Note

    +

    Due to the limited execution time and memory available to PHP, +backing up very large databases may not be possible. If your database is +very large you might need to backup directly from your SQL server via +the command line, or have your server admin do it for you if you do not +have root privileges.

    +
    +
    +
    +

    Usage Example

    +
    // Load the DB utility class
    +$this->load->dbutil();
    +
    +// Backup your entire database and assign it to a variable
    +$backup = $this->dbutil->backup();
    +
    +// Load the file helper and write the file to your server
    +$this->load->helper('file');
    +write_file('/path/to/mybackup.gz', $backup);
    +
    +// Load the download helper and send the file to your desktop
    +$this->load->helper('download');
    +force_download('mybackup.gz', $backup);
    +
    +
    +
    +
    +

    Setting Backup Preferences

    +

    Backup preferences are set by submitting an array of values to the first +parameter of the backup() method. Example:

    +
    $prefs = array(
    +        'tables'        => array('table1', 'table2'),   // Array of tables to backup.
    +        'ignore'        => array(),                     // List of tables to omit from the backup
    +        'format'        => 'txt',                       // gzip, zip, txt
    +        'filename'      => 'mybackup.sql',              // File name - NEEDED ONLY WITH ZIP FILES
    +        'add_drop'      => TRUE,                        // Whether to add DROP TABLE statements to backup file
    +        'add_insert'    => TRUE,                        // Whether to add INSERT data to backup file
    +        'newline'       => "\n"                         // Newline character used in backup file
    +);
    +
    +$this->dbutil->backup($prefs);
    +
    +
    +
    +
    +

    Description of Backup Preferences

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    tablesempty arrayNoneAn array of tables you want backed up. If left blank all tables will be +exported.
    ignoreempty arrayNoneAn array of tables you want the backup routine to ignore.
    formatgzipgzip, zip, txtThe file format of the export file.
    filenamethe current date/timeNoneThe name of the backed-up file. The name is needed only if you are using +zip compression.
    add_dropTRUETRUE/FALSEWhether to include DROP TABLE statements in your SQL export file.
    add_insertTRUETRUE/FALSEWhether to include INSERT statements in your SQL export file.
    newline“\n”“\n”, “\r”, “\r\n”Type of newline to use in your SQL export file.
    foreign_key_checksTRUETRUE/FALSEWhether output should keep foreign key checks enabled.
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_DB_utility
    +
    +
    +backup([$params = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $params (array) – An associative array of options
    • +
    +
    Returns:

    raw/(g)zipped SQL query string

    +
    Return type:

    string

    +
    +

    Perform a database backup, per user preferences.

    +
    + +
    +
    +database_exists($database_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $database_name (string) – Database name
    • +
    +
    Returns:

    TRUE if the database exists, FALSE otherwise

    +
    Return type:

    bool

    +
    +

    Check for the existence of a database.

    +
    + +
    +
    +list_databases()
    +
    +++ + + + + + +
    Returns:Array of database names found
    Return type:array
    +

    Retrieve a list of all the database names.

    +
    + +
    +
    +optimize_database()
    +
    +++ + + + + + +
    Returns:Array of optimization messages or FALSE on failure
    Return type:array
    +

    Optimizes the database.

    +
    + +
    +
    +optimize_table($table_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table_name (string) – Name of the table to optimize
    • +
    +
    Returns:

    Array of optimization messages or FALSE on failure

    +
    Return type:

    array

    +
    +

    Optimizes a database table.

    +
    + +
    +
    +repair_table($table_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table_name (string) – Name of the table to repair
    • +
    +
    Returns:

    Array of repair messages or FALSE on failure

    +
    Return type:

    array

    +
    +

    Repairs a database table.

    +
    + +
    +
    +csv_from_result($query[, $delim = ', '[, $newline = "n"[, $enclosure = '"']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $query (object) – A database result object
    • +
    • $delim (string) – The CSV field delimiter to use
    • +
    • $newline (string) – The newline character to use
    • +
    • $enclosure (string) – The enclosure delimiter to use
    • +
    +
    Returns:

    The generated CSV file as a string

    +
    Return type:

    string

    +
    +

    Translates a database result object into a CSV document.

    +
    + +
    +
    +xml_from_result($query[, $params = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $query (object) – A database result object
    • +
    • $params (array) – An associative array of preferences
    • +
    +
    Returns:

    The generated XML document as a string

    +
    Return type:

    string

    +
    +

    Translates a database result object into an XML document.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/documentation/index.html b/user_guide/documentation/index.html new file mode 100755 index 0000000..7758817 --- /dev/null +++ b/user_guide/documentation/index.html @@ -0,0 +1,702 @@ + + + + + + + + + + Writing CodeIgniter Documentation — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Writing CodeIgniter Documentation

    +

    CodeIgniter uses Sphinx to generate its documentation in a variety of formats, +using reStructuredText to handle the formatting. If you are familiar with +Markdown or Textile, you will quickly grasp reStructuredText. The focus is +on readability and user friendliness. +While they can be quite technical, we always write for humans!

    +

    A local table of contents should always be included, like the one below. +It is created automatically by inserting the following:

    +
    .. contents::
    +        :local:
    +
    +.. raw:: html
    +
    +<div class="custom-index container"></div>
    +
    +
    + +

    The <div> that is inserted as raw HTML is a hook for the documentation’s +JavaScript to dynamically add links to any function and method definitions +contained in the current page.

    +
    +

    Tools Required

    +

    To see the rendered HTML, ePub, PDF, etc., you will need to install Sphinx +along with the PHP domain extension for Sphinx. The underlying requirement +is to have Python installed. Lastly, you will install the CI Lexer for +Pygments, so that code blocks can be properly highlighted.

    +
    easy_install "sphinx==1.2.3"
    +easy_install "sphinxcontrib-phpdomain==0.1.3.post1"
    +
    +
    +

    Then follow the directions in the README file in the cilexer folder +inside the documentation repository to install the CI Lexer.

    +
    +
    +

    Page and Section Headings and Subheadings

    +

    Headings not only provide order and sections within a page, but they also +are used to automatically build both the page and document table of contents. +Headings are formed by using certain characters as underlines for a bit of +text. Major headings, like page titles and section headings also use +overlines. Other headings just use underlines, with the following hierarchy:

    +
    # with overline for page titles
    +* with overline for major sections
    += for subsections
    +- for subsubsections
    +^ for subsubsubsections
    +" for subsubsubsubsections (!)
    +
    +
    +

    The TextMate ELDocs Bundle can help you +create these with the following tab triggers:

    +
    title->
    +
    +        ##########
    +        Page Title
    +        ##########
    +
    +sec->
    +
    +        *************
    +        Major Section
    +        *************
    +
    +sub->
    +
    +        Subsection
    +        ==========
    +
    +sss->
    +
    +        SubSubSection
    +        -------------
    +
    +ssss->
    +
    +        SubSubSubSection
    +        ^^^^^^^^^^^^^^^^
    +
    +sssss->
    +
    +        SubSubSubSubSection (!)
    +        """""""""""""""""""""""
    +
    +
    +
    +
    +

    Method Documentation

    +

    When documenting class methods for third party developers, Sphinx provides +directives to assist and keep things simple. +For example, consider the following ReST:

    +
    .. php:class:: Some_class
    +
    +        .. php:method:: some_method ( $foo [, $bar [, $bat]])
    +
    +                This function will perform some action. The ``$bar`` array must contain
    +                a something and something else, and along with ``$bat`` is an optional
    +                parameter.
    +
    +                :param int $foo: the foo id to do something in
    +                :param mixed $bar: A data array that must contain a something and something else
    +                :param bool $bat: whether or not to do something
    +                :returns: FALSE on failure, TRUE if successful
    +                :rtype: bool
    +
    +                ::
    +
    +                        $this->load->library('some_class');
    +
    +                        $bar = array(
    +                                'something'             => 'Here is this parameter!',
    +                                'something_else'        => 42
    +                        );
    +
    +                        $bat = $this->some_class->should_do_something();
    +
    +                        if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
    +                        {
    +                                show_error('An Error Occurred Doing Some Method');
    +                        }
    +
    +                .. note:: Here is something that you should be aware of when using some_method().
    +                                For real.
    +
    +                See also :meth:`Some_class::should_do_something`
    +
    +
    +        .. php:method:: should_do_something()
    +
    +                :returns: Whether or not something should be done
    +                :rtype: bool
    +
    +
    +

    It creates the following display:

    +
    +
    +class Some_class
    +
    +
    +some_method($foo[, $bar[, $bat]])
    +

    This function will perform some action. The $bar array must contain +a something and something else, and along with $bat is an optional +parameter.

    + +++ + + + + + + + +
    Parameters:
      +
    • $foo (int) – the foo id to do something in
    • +
    • $bar (mixed) – A data array that must contain a something and something else
    • +
    • $bat (bool) – whether or not to do something
    • +
    +
    Returns:

    FALSE on failure, TRUE if successful

    +
    Return type:

    bool

    +
    +
    $this->load->library('some_class');
    +
    +$bar = array(
    +        'something'             => 'Here is this parameter!',
    +        'something_else'        => 42
    +);
    +
    +$bat = $this->some_class->should_do_something();
    +
    +if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
    +{
    +        show_error('An Error Occurred Doing Some Method');
    +}
    +
    +
    +
    +

    Note

    +

    Here is something that you should be aware of when using some_method(). +For real.

    +
    +

    See also Some_class::should_do_something()

    +
    + +
    +
    +should_do_something()
    +
    +++ + + + + + +
    Returns:Whether or not something should be done
    Return type:bool
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html new file mode 100755 index 0000000..b79c855 --- /dev/null +++ b/user_guide/general/alternative_php.html @@ -0,0 +1,566 @@ + + + + + + + + + + Alternate PHP Syntax for View Files — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Alternate PHP Syntax for View Files

    +

    If you do not utilize CodeIgniter’s template +engine, you’ll be using pure PHP in your +View files. To minimize the PHP code in these files, and to make it +easier to identify the code blocks it is recommended that you use PHPs +alternative syntax for control structures and short tag echo statements. +If you are not familiar with this syntax, it allows you to eliminate the +braces from your code, and eliminate “echo” statements.

    +
    +

    Automatic Short Tag Support

    +
    +

    Note

    +

    If you find that the syntax described in this page does not +work on your server it might be that “short tags” are disabled in your +PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly, +allowing you to use that syntax even if your server doesn’t support it. +This feature can be enabled in your config/config.php file.

    +
    +

    Please note that if you do use this feature, if PHP errors are +encountered in your view files, the error message and line number +will not be accurately shown. Instead, all errors will be shown as +eval() errors.

    +
    +
    +

    Alternative Echos

    +

    Normally to echo, or print out a variable you would do this:

    +
    <?php echo $variable; ?>
    +
    +
    +

    With the alternative syntax you can instead do it this way:

    +
    <?=$variable?>
    +
    +
    +
    +
    +

    Alternative Control Structures

    +

    Controls structures, like if, for, foreach, and while can be written in +a simplified format as well. Here is an example using foreach:

    +
    <ul>
    +
    +<?php foreach ($todo as $item): ?>
    +
    +        <li><?=$item?></li>
    +
    +<?php endforeach; ?>
    +
    +</ul>
    +
    +
    +

    Notice that there are no braces. Instead, the end brace is replaced with +endforeach. Each of the control structures listed above has a similar +closing syntax: endif, endfor, endforeach, and endwhile

    +

    Also notice that instead of using a semicolon after each structure +(except the last one), there is a colon. This is important!

    +

    Here is another example, using if/elseif/else. Notice the colons:

    +
    <?php if ($username === 'sally'): ?>
    +
    +        <h3>Hi Sally</h3>
    +
    +<?php elseif ($username === 'joe'): ?>
    +
    +        <h3>Hi Joe</h3>
    +
    +<?php else: ?>
    +
    +        <h3>Hi unknown user</h3>
    +
    +<?php endif; ?>
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/ancillary_classes.html b/user_guide/general/ancillary_classes.html new file mode 100755 index 0000000..c3e047c --- /dev/null +++ b/user_guide/general/ancillary_classes.html @@ -0,0 +1,578 @@ + + + + + + + + + + Creating Ancillary Classes — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Creating Ancillary Classes

    +

    In some cases you may want to develop classes that exist apart from your +controllers but have the ability to utilize all of CodeIgniter’s +resources. This is easily possible as you’ll see.

    +
    +

    get_instance()

    +
    +
    +get_instance()
    +
    +++ + + + + + +
    Returns:Reference to your controller’s instance
    Return type:CI_Controller
    +
    + +

    Any class that you instantiate within your controller methods can +access CodeIgniter’s native resources simply by using the +get_instance() function. This function returns the main +CodeIgniter object.

    +

    Normally, to call any of the available methods, CodeIgniter requires +you to use the $this construct:

    +
    $this->load->helper('url');
    +$this->load->library('session');
    +$this->config->item('base_url');
    +// etc.
    +
    +
    +

    $this, however, only works within your controllers, your models, +or your views. If you would like to use CodeIgniter’s classes from +within your own custom classes you can do so as follows:

    +

    First, assign the CodeIgniter object to a variable:

    +
    $CI =& get_instance();
    +
    +
    +

    Once you’ve assigned the object to a variable, you’ll use that variable +instead of $this:

    +
    $CI =& get_instance();
    +
    +$CI->load->helper('url');
    +$CI->load->library('session');
    +$CI->config->item('base_url');
    +// etc.
    +
    +
    +

    If you’ll be using get_instance() inside another class, then it would +be better if you assign it to a property. This way, you won’t need to call +get_instance() in every single method.

    +

    Example:

    +
    class Example {
    +
    +        protected $CI;
    +
    +        // We'll use a constructor, as you can't directly call a function
    +        // from a property definition.
    +        public function __construct()
    +        {
    +                // Assign the CodeIgniter super-object
    +                $this->CI =& get_instance();
    +        }
    +
    +        public function foo()
    +        {
    +                $this->CI->load->helper('url');
    +                redirect();
    +        }
    +
    +        public function bar()
    +        {
    +                $this->CI->config->item('base_url');
    +        }
    +}
    +
    +
    +

    In the above example, both methods foo() and bar() will work +after you instantiate the Example class, without the need to call +get_instance() in each of them.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html new file mode 100755 index 0000000..85e2eed --- /dev/null +++ b/user_guide/general/autoloader.html @@ -0,0 +1,519 @@ + + + + + + + + + + Auto-loading Resources — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Auto-loading Resources

    +

    CodeIgniter comes with an “Auto-load” feature that permits libraries, +helpers, and models to be initialized automatically every time the +system runs. If you need certain resources globally throughout your +application you should consider auto-loading them for convenience.

    +

    The following items can be loaded automatically:

    +
      +
    • Classes found in the libraries/ directory
    • +
    • Helper files found in the helpers/ directory
    • +
    • Custom config files found in the config/ directory
    • +
    • Language files found in the system/language/ directory
    • +
    • Models found in the models/ folder
    • +
    +

    To autoload resources, open the application/config/autoload.php +file and add the item you want loaded to the autoload array. You’ll +find instructions in that file corresponding to each type of item.

    +
    +

    Note

    +

    Do not include the file extension (.php) when adding items to +the autoload array.

    +
    +

    Additionally, if you want CodeIgniter to use a Composer +auto-loader, just set $config['composer_autoload'] to TRUE or +a custom path in application/config/config.php.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html new file mode 100755 index 0000000..5bbdc07 --- /dev/null +++ b/user_guide/general/caching.html @@ -0,0 +1,563 @@ + + + + + + + + + + Web Page Caching — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Web Page Caching

    +

    CodeIgniter lets you cache your pages in order to achieve maximum +performance.

    +

    Although CodeIgniter is quite fast, the amount of dynamic information +you display in your pages will correlate directly to the server +resources, memory, and processing cycles utilized, which affect your +page load speeds. By caching your pages, since they are saved in their +fully rendered state, you can achieve performance that nears that of +static web pages.

    +
    +

    How Does Caching Work?

    +

    Caching can be enabled on a per-page basis, and you can set the length +of time that a page should remain cached before being refreshed. When a +page is loaded for the first time, the cache file will be written to +your application/cache folder. On subsequent page loads the cache file +will be retrieved and sent to the requesting user’s browser. If it has +expired, it will be deleted and refreshed before being sent to the +browser.

    +
    +
    +

    Enabling Caching

    +

    To enable caching, put the following tag in any of your controller +methods:

    +
    $this->output->cache($n);
    +
    +
    +

    Where $n is the number of minutes you wish the page to remain +cached between refreshes.

    +

    The above tag can go anywhere within a method. It is not affected by +the order that it appears, so place it wherever it seems most logical to +you. Once the tag is in place, your pages will begin being cached.

    +
    +

    Important

    +

    Because of the way CodeIgniter stores content for output, +caching will only work if you are generating display for your +controller with a view.

    +
    +
    +

    Important

    +

    If you change configuration options that might affect +your output, you have to manually delete your cache files.

    +
    +
    +

    Note

    +

    Before the cache files can be written you must set the file +permissions on your application/cache/ directory such that +it is writable.

    +
    +
    +
    +

    Deleting Caches

    +

    If you no longer wish to cache a file you can remove the caching tag and +it will no longer be refreshed when it expires.

    +
    +

    Note

    +

    Removing the tag will not delete the cache immediately. It will +have to expire normally.

    +
    +

    If you need to manually delete the cache, you can use the delete_cache() +method:

    +
    // Deletes cache for the currently requested URI
    +$this->output->delete_cache();
    +
    +// Deletes cache for /foo/bar
    +$this->output->delete_cache('/foo/bar');
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html new file mode 100755 index 0000000..6ff40e8 --- /dev/null +++ b/user_guide/general/cli.html @@ -0,0 +1,573 @@ + + + + + + + + + + Running via the CLI — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Running via the CLI

    +

    As well as calling an applications Controllers +via the URL in a browser they can also be loaded via the command-line +interface (CLI).

    + +
    +

    What is the CLI?

    +

    The command-line interface is a text-based method of interacting with +computers. For more information, check the Wikipedia +article.

    +
    +
    +

    Why run via the command-line?

    +

    There are many reasons for running CodeIgniter from the command-line, +but they are not always obvious.

    +
      +
    • Run your cron-jobs without needing to use wget or curl
    • +
    • Make your cron-jobs inaccessible from being loaded in the URL by +checking the return value of is_cli().
    • +
    • Make interactive “tasks” that can do things like set permissions, +prune cache folders, run backups, etc.
    • +
    • Integrate with other applications in other languages. For example, a +random C++ script could call one command and run code in your models!
    • +
    +
    +
    +

    Let’s try it: Hello World!

    +

    Let’s create a simple controller so you can see it in action. Using your +text editor, create a file called Tools.php, and put the following code +in it:

    +
    <?php
    +class Tools extends CI_Controller {
    +
    +        public function message($to = 'World')
    +        {
    +                echo "Hello {$to}!".PHP_EOL;
    +        }
    +}
    +
    +
    +

    Then save the file to your application/controllers/ folder.

    +

    Now normally you would visit the site using a URL similar to this:

    +
    example.com/index.php/tools/message/to
    +
    +
    +

    Instead, we are going to open the terminal in Mac/Linux or go to Run > “cmd” +in Windows and navigate to our CodeIgniter project.

    +
    $ cd /path/to/project;
    +$ php index.php tools message
    +
    +
    +

    If you did it right, you should see Hello World! printed.

    +
    $ php index.php tools message "John Smith"
    +
    +
    +

    Here we are passing it a argument in the same way that URL parameters +work. “John Smith” is passed as a argument and output is:

    +
    Hello John Smith!
    +
    +
    +
    +
    +

    That’s it!

    +

    That, in a nutshell, is all there is to know about controllers on the +command line. Remember that this is just a normal controller, so routing +and _remap() works fine.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html new file mode 100755 index 0000000..c70d810 --- /dev/null +++ b/user_guide/general/common_functions.html @@ -0,0 +1,776 @@ + + + + + + + + + + Common Functions — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Common Functions

    +

    CodeIgniter uses a few functions for its operation that are globally +defined, and are available to you at any point. These do not require +loading any libraries or helpers.

    +
    +
    +is_php($version)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $version (string) – Version number
    • +
    +
    Returns:

    TRUE if the running PHP version is at least the one specified or FALSE if not

    +
    Return type:

    bool

    +
    +

    Determines if the PHP version being used is greater than the +supplied version number.

    +

    Example:

    +
    if (is_php('5.3'))
    +{
    +        $str = quoted_printable_encode($str);
    +}
    +
    +
    +

    Returns boolean TRUE if the installed version of PHP is equal to or +greater than the supplied version number. Returns FALSE if the installed +version of PHP is lower than the supplied version number.

    +
    + +
    +
    +is_really_writable($file)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $file (string) – File path
    • +
    +
    Returns:

    TRUE if the path is writable, FALSE if not

    +
    Return type:

    bool

    +
    +

    is_writable() returns TRUE on Windows servers when you really can’t +write to the file as the OS reports to PHP as FALSE only if the +read-only attribute is marked.

    +

    This function determines if a file is actually writable by attempting +to write to it first. Generally only recommended on platforms where +this information may be unreliable.

    +

    Example:

    +
    if (is_really_writable('file.txt'))
    +{
    +        echo "I could write to this if I wanted to";
    +}
    +else
    +{
    +        echo "File is not writable";
    +}
    +
    +
    +
    +

    Note

    +

    See also PHP bug #54709 for more info.

    +
    +
    + +
    +
    +config_item($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Config item key
    • +
    +
    Returns:

    Configuration key value or NULL if not found

    +
    Return type:

    mixed

    +
    +

    The Config Library is the preferred way of +accessing configuration information, however config_item() can be used +to retrieve single keys. See Config Library +documentation for more information.

    +
    + +
    +
    +set_status_header($code[, $text = ''])
    +
    +++ + + + + + +
    Parameters:
      +
    • $code (int) – HTTP Response status code
    • +
    • $text (string) – A custom message to set with the status code
    • +
    +
    Return type:

    void

    +
    +

    Permits you to manually set a server status header. Example:

    +
    set_status_header(401);
    +// Sets the header as:  Unauthorized
    +
    +
    +

    See here for +a full list of headers.

    +
    + +
    +
    +remove_invisible_characters($str[, $url_encoded = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $url_encoded (bool) – Whether to remove URL-encoded characters as well
    • +
    +
    Returns:

    Sanitized string

    +
    Return type:

    string

    +
    +

    This function prevents inserting NULL characters between ASCII +characters, like Java\0script.

    +

    Example:

    +
    remove_invisible_characters('Java\\0script');
    +// Returns: 'Javascript'
    +
    +
    +
    + +
    +
    +html_escape($var)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $var (mixed) – Variable to escape (string or array)
    • +
    +
    Returns:

    HTML escaped string(s)

    +
    Return type:

    mixed

    +
    +

    This function acts as an alias for PHP’s native htmlspecialchars() +function, with the advantage of being able to accept an array of strings.

    +

    It is useful in preventing Cross Site Scripting (XSS).

    +
    + +
    +
    +get_mimes()
    +
    +++ + + + + + +
    Returns:An associative array of file types
    Return type:array
    +

    This function returns a reference to the MIMEs array from +application/config/mimes.php.

    +
    + +
    +
    +is_https()
    +
    +++ + + + + + +
    Returns:TRUE if currently using HTTP-over-SSL, FALSE if not
    Return type:bool
    +

    Returns TRUE if a secure (HTTPS) connection is used and FALSE +in any other case (including non-HTTP requests).

    +
    + +
    +
    +is_cli()
    +
    +++ + + + + + +
    Returns:TRUE if currently running under CLI, FALSE otherwise
    Return type:bool
    +

    Returns TRUE if the application is run through the command line +and FALSE if not.

    +
    +

    Note

    +

    This function checks both if the PHP_SAPI value is ‘cli’ +or if the STDIN constant is defined.

    +
    +
    + +
    +
    +function_usable($function_name)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $function_name (string) – Function name
    • +
    +
    Returns:

    TRUE if the function can be used, FALSE if not

    +
    Return type:

    bool

    +
    +

    Returns TRUE if a function exists and is usable, FALSE otherwise.

    +

    This function runs a function_exists() check and if the +Suhosin extension <http://www.hardened-php.net/suhosin/> is loaded, +checks if it doesn’t disable the function being checked.

    +

    It is useful if you want to check for the availability of functions +such as eval() and exec(), which are dangerous and might be +disabled on servers with highly restrictive security policies.

    +
    +

    Note

    +

    This function was introduced because Suhosin terminated +script execution, but this turned out to be a bug. A fix +has been available for some time (version 0.9.34), but is +unfortunately not released yet.

    +
    +
    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/compatibility_functions.html b/user_guide/general/compatibility_functions.html new file mode 100755 index 0000000..124b1c0 --- /dev/null +++ b/user_guide/general/compatibility_functions.html @@ -0,0 +1,914 @@ + + + + + + + + + + Compatibility Functions — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Compatibility Functions

    +

    CodeIgniter provides a set of compatibility functions that enable +you to use functions what are otherwise natively available in PHP, +but only in higher versions or depending on a certain extension.

    +

    Being custom implementations, these functions will also have some +set of dependencies on their own, but are still useful if your +PHP setup doesn’t offer them natively.

    +
    +

    Note

    +

    Much like the common functions, the +compatibility functions are always available, as long as +their dependencies are met.

    +
    + +
    +

    Password Hashing

    +

    This set of compatibility functions offers a “backport” of PHP’s +standard Password Hashing extension +that is otherwise available only since PHP 5.5.

    +
    +

    Dependencies

    +
      +
    • PHP 5.3.7
    • +
    • CRYPT_BLOWFISH support for crypt()
    • +
    +
    +
    +

    Constants

    +
      +
    • PASSWORD_BCRYPT
    • +
    • PASSWORD_DEFAULT
    • +
    +
    +
    +

    Function reference

    +
    +
    +password_get_info($hash)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $hash (string) – Password hash
    • +
    +
    Returns:

    Information about the hashed password

    +
    Return type:

    array

    +
    +

    For more information, please refer to the PHP manual for +password_get_info().

    +
    + +
    +
    +password_hash($password, $algo[, $options = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $password (string) – Plain-text password
    • +
    • $algo (int) – Hashing algorithm
    • +
    • $options (array) – Hashing options
    • +
    +
    Returns:

    Hashed password or FALSE on failure

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for +password_hash().

    +
    +

    Note

    +

    Unless you provide your own (and valid) salt, this function +has a further dependency on an available CSPRNG source. Each +of the following would satisfy that: +- mcrypt_create_iv() with MCRYPT_DEV_URANDOM +- openssl_random_pseudo_bytes() +- /dev/arandom +- /dev/urandom

    +
    +
    + +
    +
    +password_needs_rehash()
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $hash (string) – Password hash
    • +
    • $algo (int) – Hashing algorithm
    • +
    • $options (array) – Hashing options
    • +
    +
    Returns:

    TRUE if the hash should be rehashed to match the given algorithm and options, FALSE otherwise

    +
    Return type:

    bool

    +
    +

    For more information, please refer to the PHP manual for +password_needs_rehash().

    +
    + +
    +
    +password_verify($password, $hash)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $password (string) – Plain-text password
    • +
    • $hash (string) – Password hash
    • +
    +
    Returns:

    TRUE if the password matches the hash, FALSE if not

    +
    Return type:

    bool

    +
    +

    For more information, please refer to the PHP manual for +password_verify().

    +
    + +
    +
    +
    +

    Hash (Message Digest)

    +

    This compatibility layer contains backports for the hash_equals() +and hash_pbkdf2() functions, which otherwise require PHP 5.6 and/or +PHP 5.5 respectively.

    +
    +

    Dependencies

    +
      +
    • None
    • +
    +
    +
    +

    Function reference

    +
    +
    +hash_equals($known_string, $user_string)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $known_string (string) – Known string
    • +
    • $user_string (string) – User-supplied string
    • +
    +
    Returns:

    TRUE if the strings match, FALSE otherwise

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for +hash_equals().

    +
    + +
    +
    +hash_pbkdf2($algo, $password, $salt, $iterations[, $length = 0[, $raw_output = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $algo (string) – Hashing algorithm
    • +
    • $password (string) – Password
    • +
    • $salt (string) – Hash salt
    • +
    • $iterations (int) – Number of iterations to perform during derivation
    • +
    • $length (int) – Output string length
    • +
    • $raw_output (bool) – Whether to return raw binary data
    • +
    +
    Returns:

    Password-derived key or FALSE on failure

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for +hash_pbkdf2().

    +
    + +
    +
    +
    +

    Multibyte String

    +

    This set of compatibility functions offers limited support for PHP’s +Multibyte String extension. Because of +the limited alternative solutions, only a few functions are available.

    +
    +

    Note

    +

    When a character set parameter is ommited, +$config['charset'] will be used.

    +
    +
    +

    Dependencies

    + +
    +

    Important

    +

    This dependency is optional and these functions will +always be declared. If iconv is not available, they WILL +fall-back to their non-mbstring versions.

    +
    +
    +

    Important

    +

    Where a character set is supplied, it must be +supported by iconv and in a format that it recognizes.

    +
    +
    +

    Note

    +

    For you own dependency check on the actual mbstring +extension, use the MB_ENABLED constant.

    +
    +
    +
    +

    Function reference

    +
    +
    +mb_strlen($str[, $encoding = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $encoding (string) – Character set
    • +
    +
    Returns:

    Number of characters in the input string or FALSE on failure

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for +mb_strlen().

    +
    + +
    +
    +mb_strpos($haystack, $needle[, $offset = 0[, $encoding = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $haystack (string) – String to search in
    • +
    • $needle (string) – Part of string to search for
    • +
    • $offset (int) – Search offset
    • +
    • $encoding (string) – Character set
    • +
    +
    Returns:

    Numeric character position of where $needle was found or FALSE if not found

    +
    Return type:

    mixed

    +
    +

    For more information, please refer to the PHP manual for +mb_strpos().

    +
    + +
    +
    +mb_substr($str, $start[, $length = NULL[, $encoding = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $start (int) – Position of first character
    • +
    • $length (int) – Maximum number of characters
    • +
    • $encoding (string) – Character set
    • +
    +
    Returns:

    Portion of $str specified by $start and $length or FALSE on failure

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for +mb_substr().

    +
    + +
    +
    +
    +

    Standard Functions

    +

    This set of compatibility functions offers support for a few +standard functions in PHP that otherwise require a newer PHP version.

    +
    +

    Dependencies

    +
      +
    • None
    • +
    +
    +
    +

    Function reference

    +
    +
    +array_column(array $array, $column_key[, $index_key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $array (array) – Array to fetch results from
    • +
    • $column_key (mixed) – Key of the column to return values from
    • +
    • $index_key (mixed) – Key to use for the returned values
    • +
    +
    Returns:

    An array of values representing a single column from the input array

    +
    Return type:

    array

    +
    +

    For more information, please refer to the PHP manual for +array_column().

    +
    + +
    +
    +hex2bin($data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Hexadecimal representation of data
    • +
    +
    Returns:

    Binary representation of the given data

    +
    Return type:

    string

    +
    +

    For more information, please refer to the PHP manual for hex2bin().

    +
    + +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html new file mode 100755 index 0000000..46caf35 --- /dev/null +++ b/user_guide/general/controllers.html @@ -0,0 +1,845 @@ + + + + + + + + + + Controllers — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Controllers

    +

    Controllers are the heart of your application, as they determine how +HTTP requests should be handled.

    + +
    +

    What is a Controller?

    +

    A Controller is simply a class file that is named in a way that can be +associated with a URI.

    +

    Consider this URI:

    +
    example.com/index.php/blog/
    +
    +
    +

    In the above example, CodeIgniter would attempt to find a controller +named Blog.php and load it.

    +

    When a controller’s name matches the first segment of a URI, it will +be loaded.

    +
    +
    +

    Let’s try it: Hello World!

    +

    Let’s create a simple controller so you can see it in action. Using your +text editor, create a file called Blog.php, and put the following code +in it:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function index()
    +        {
    +                echo 'Hello World!';
    +        }
    +}
    +
    +
    +

    Then save the file to your application/controllers/ directory.

    +
    +

    Important

    +

    The file must be called ‘Blog.php’, with a capital ‘B’.

    +
    +

    Now visit the your site using a URL similar to this:

    +
    example.com/index.php/blog/
    +
    +
    +

    If you did it right, you should see:

    +
    +
    Hello World!
    +
    +

    Important

    +

    Class names must start with an uppercase letter.

    +
    +

    This is valid:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +}
    +
    +
    +

    This is not valid:

    +
    <?php
    +class blog extends CI_Controller {
    +
    +}
    +
    +
    +

    Also, always make sure your controller extends the parent controller +class so that it can inherit all its methods.

    +
    +
    +

    Methods

    +

    In the above example the method name is index(). The “index” method +is always loaded by default if the second segment of the URI is +empty. Another way to show your “Hello World” message would be this:

    +
    example.com/index.php/blog/index/
    +
    +
    +

    The second segment of the URI determines which method in the +controller gets called.

    +

    Let’s try it. Add a new method to your controller:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function index()
    +        {
    +                echo 'Hello World!';
    +        }
    +
    +        public function comments()
    +        {
    +                echo 'Look at this!';
    +        }
    +}
    +
    +
    +

    Now load the following URL to see the comment method:

    +
    example.com/index.php/blog/comments/
    +
    +
    +

    You should see your new message.

    +
    +
    +

    Passing URI Segments to your methods

    +

    If your URI contains more than two segments they will be passed to your +method as parameters.

    +

    For example, let’s say you have a URI like this:

    +
    example.com/index.php/products/shoes/sandals/123
    +
    +
    +

    Your method will be passed URI segments 3 and 4 (“sandals” and “123”):

    +
    <?php
    +class Products extends CI_Controller {
    +
    +        public function shoes($sandals, $id)
    +        {
    +                echo $sandals;
    +                echo $id;
    +        }
    +}
    +
    +
    +
    +

    Important

    +

    If you are using the URI Routing +feature, the segments passed to your method will be the re-routed +ones.

    +
    +
    +
    +

    Defining a Default Controller

    +

    CodeIgniter can be told to load a default controller when a URI is not +present, as will be the case when only your site root URL is requested. +To specify a default controller, open your application/config/routes.php +file and set this variable:

    +
    $route['default_controller'] = 'blog';
    +
    +
    +

    Where ‘blog’ is the name of the controller class you want used. If you now +load your main index.php file without specifying any URI segments you’ll +see your “Hello World” message by default.

    +

    For more information, please refer to the “Reserved Routes” section of the +URI Routing documentation.

    +
    +
    +

    Remapping Method Calls

    +

    As noted above, the second segment of the URI typically determines which +method in the controller gets called. CodeIgniter permits you to override +this behavior through the use of the _remap() method:

    +
    public function _remap()
    +{
    +        // Some code here...
    +}
    +
    +
    +
    +

    Important

    +

    If your controller contains a method named _remap(), +it will always get called regardless of what your URI contains. It +overrides the normal behavior in which the URI determines which method +is called, allowing you to define your own method routing rules.

    +
    +

    The overridden method call (typically the second segment of the URI) will +be passed as a parameter to the _remap() method:

    +
    public function _remap($method)
    +{
    +        if ($method === 'some_method')
    +        {
    +                $this->$method();
    +        }
    +        else
    +        {
    +                $this->default_method();
    +        }
    +}
    +
    +
    +

    Any extra segments after the method name are passed into _remap() as an +optional second parameter. This array can be used in combination with +PHP’s call_user_func_array() +to emulate CodeIgniter’s default behavior.

    +

    Example:

    +
    public function _remap($method, $params = array())
    +{
    +        $method = 'process_'.$method;
    +        if (method_exists($this, $method))
    +        {
    +                return call_user_func_array(array($this, $method), $params);
    +        }
    +        show_404();
    +}
    +
    +
    +
    +
    +

    Processing Output

    +

    CodeIgniter has an output class that takes care of sending your final +rendered data to the web browser automatically. More information on this +can be found in the Views and Output Class pages. In some cases, however, you might want to +post-process the finalized data in some way and send it to the browser +yourself. CodeIgniter permits you to add a method named _output() +to your controller that will receive the finalized output data.

    +
    +

    Important

    +

    If your controller contains a method named _output(), +it will always be called by the output class instead of +echoing the finalized data directly. The first parameter of the +method will contain the finalized output.

    +
    +

    Here is an example:

    +
    public function _output($output)
    +{
    +        echo $output;
    +}
    +
    +
    +
    +

    Note

    +

    Please note that your _output() method will receive the +data in its finalized state. Benchmark and memory usage data +will be rendered, cache files written (if you have caching +enabled), and headers will be sent (if you use that +feature) before it is handed off +to the _output() method. +To have your controller’s output cached properly, its +_output() method can use:

    +
    if ($this->output->cache_expiration > 0)
    +{
    +        $this->output->_write_cache($output);
    +}
    +
    +
    +

    If you are using this feature the page execution timer and +memory usage stats might not be perfectly accurate since they +will not take into account any further processing you do. +For an alternate way to control output before any of the +final processing is done, please see the available methods +in the Output Library.

    +
    +
    +
    +

    Private methods

    +

    In some cases you may want certain methods hidden from public access. +In order to achieve this, simply declare the method as being private +or protected and it will not be served via a URL request. For example, +if you were to have a method like this:

    +
    private function _utility()
    +{
    +        // some code
    +}
    +
    +
    +

    Trying to access it via the URL, like this, will not work:

    +
    example.com/index.php/blog/_utility/
    +
    +
    +
    +

    Note

    +

    Prefixing method names with an underscore will also prevent +them from being called. This is a legacy feature that is left +for backwards-compatibility.

    +
    +
    +
    +

    Organizing Your Controllers into Sub-directories

    +

    If you are building a large application you might want to hierarchically +organize or structure your controllers into sub-directories. CodeIgniter +permits you to do this.

    +

    Simply create sub-directories under the main application/controllers/ +one and place your controller classes within them.

    +
    +

    Note

    +

    When using this feature the first segment of your URI must +specify the folder. For example, let’s say you have a controller located +here:

    +
    application/controllers/products/Shoes.php
    +
    +
    +

    To call the above controller your URI will look something like this:

    +
    example.com/index.php/products/shoes/show/123
    +
    +
    +
    +

    Each of your sub-directories may contain a default controller which will be +called if the URL contains only the sub-directory. Simply put a controller +in there that matches the name of your ‘default_controller’ as specified in +your application/config/routes.php file.

    +

    CodeIgniter also permits you to remap your URIs using its URI +Routing feature.

    +
    +
    +

    Class Constructors

    +

    If you intend to use a constructor in any of your Controllers, you +MUST place the following line of code in it:

    +
    parent::__construct();
    +
    +
    +

    The reason this line is necessary is because your local constructor will +be overriding the one in the parent controller class so we need to +manually call it.

    +

    Example:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                // Your own constructor code
    +        }
    +}
    +
    +
    +

    Constructors are useful if you need to set some default values, or run a +default process when your class is instantiated. Constructors can’t +return a value, but they can do some default work.

    +
    +
    +

    Reserved method names

    +

    Since your controller classes will extend the main application +controller you must be careful not to name your methods identically to +the ones used by that class, otherwise your local functions will +override them. See Reserved Names for a full +list.

    +
    +

    Important

    +

    You should also never have a method named identically +to its class name. If you do, and there is no __construct() +method in the same class, then your e.g. Index::index() +method will be executed as a class constructor! This is a PHP4 +backwards-compatibility feature.

    +
    +
    +
    +

    That’s it!

    +

    That, in a nutshell, is all there is to know about controllers.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html new file mode 100755 index 0000000..e9414e6 --- /dev/null +++ b/user_guide/general/core_classes.html @@ -0,0 +1,612 @@ + + + + + + + + + + Creating Core System Classes — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Creating Core System Classes

    +

    Every time CodeIgniter runs there are several base classes that are +initialized automatically as part of the core framework. It is possible, +however, to swap any of the core system classes with your own versions +or even extend the core versions.

    +

    Most users will never have any need to do this, but the option to +replace or extend them does exist for those who would like to +significantly alter the CodeIgniter core.

    +
    +

    Note

    +

    Messing with a core system class has a lot of implications, so +make sure you know what you are doing before attempting it.

    +
    +
    +

    System Class List

    +

    The following is a list of the core system files that are invoked every +time CodeIgniter runs:

    +
      +
    • Benchmark
    • +
    • Config
    • +
    • Controller
    • +
    • Exceptions
    • +
    • Hooks
    • +
    • Input
    • +
    • Language
    • +
    • Loader
    • +
    • Log
    • +
    • Output
    • +
    • Router
    • +
    • Security
    • +
    • URI
    • +
    • Utf8
    • +
    +
    +
    +

    Replacing Core Classes

    +

    To use one of your own system classes instead of a default one simply +place your version inside your local application/core/ directory:

    +
    application/core/some_class.php
    +
    +
    +

    If this directory does not exist you can create it.

    +

    Any file named identically to one from the list above will be used +instead of the one normally used.

    +

    Please note that your class must use CI as a prefix. For example, if +your file is named Input.php the class will be named:

    +
    class CI_Input {
    +
    +}
    +
    +
    +
    +
    +

    Extending Core Class

    +

    If all you need to do is add some functionality to an existing library - +perhaps add a method or two - then it’s overkill to replace the entire +library with your version. In this case it’s better to simply extend the +class. Extending a class is nearly identical to replacing a class with a +couple exceptions:

    +
      +
    • The class declaration must extend the parent class.
    • +
    • Your new class name and filename must be prefixed with MY_ (this +item is configurable. See below.).
    • +
    +

    For example, to extend the native Input class you’ll create a file named +application/core/MY_Input.php, and declare your class with:

    +
    class MY_Input extends CI_Input {
    +
    +}
    +
    +
    +
    +

    Note

    +

    If you need to use a constructor in your class make sure you +extend the parent constructor:

    +
    class MY_Input extends CI_Input {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +        }
    +}
    +
    +
    +
    +

    Tip: Any functions in your class that are named identically to the +methods in the parent class will be used instead of the native ones +(this is known as “method overriding”). This allows you to substantially +alter the CodeIgniter core.

    +

    If you are extending the Controller core class, then be sure to extend +your new class in your application controller’s constructors.

    +
    class Welcome extends MY_Controller {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                // Your own constructor code
    +        }
    +
    +        public function index()
    +        {
    +                $this->load->view('welcome_message');
    +        }
    +}
    +
    +
    +
    +

    Setting Your Own Prefix

    +

    To set your own sub-class prefix, open your +application/config/config.php file and look for this item:

    +
    $config['subclass_prefix'] = 'MY_';
    +
    +
    +

    Please note that all native CodeIgniter libraries are prefixed +with CI_ so DO NOT use that as your prefix.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/creating_drivers.html b/user_guide/general/creating_drivers.html new file mode 100755 index 0000000..c5c4898 --- /dev/null +++ b/user_guide/general/creating_drivers.html @@ -0,0 +1,524 @@ + + + + + + + + + + Creating Drivers — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Creating Drivers

    +
    +

    Driver Directory and File Structure

    +

    Sample driver directory and file structure layout:

    +
      +
    • /application/libraries/Driver_name
        +
      • Driver_name.php
      • +
      • drivers
          +
        • Driver_name_subclass_1.php
        • +
        • Driver_name_subclass_2.php
        • +
        • Driver_name_subclass_3.php
        • +
        +
      • +
      +
    • +
    +
    +

    Note

    +

    In order to maintain compatibility on case-sensitive +file systems, the Driver_name directory must be +named in the format returned by ucfirst().

    +
    +
    +

    Note

    +

    The Driver library’s architecture is such that +the subclasses don’t extend and therefore don’t inherit +properties or methods of the main driver.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html new file mode 100755 index 0000000..706c004 --- /dev/null +++ b/user_guide/general/creating_libraries.html @@ -0,0 +1,753 @@ + + + + + + + + + + Creating Libraries — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Creating Libraries

    +

    When we use the term “Libraries” we are normally referring to the +classes that are located in the libraries directory and described in the +Class Reference of this user guide. In this case, however, we will +instead describe how you can create your own libraries within your +application/libraries directory in order to maintain separation between +your local resources and the global framework resources.

    +

    As an added bonus, CodeIgniter permits your libraries to extend native +classes if you simply need to add some functionality to an existing +library. Or you can even replace native libraries just by placing +identically named versions in your application/libraries directory.

    +

    In summary:

    +
      +
    • You can create entirely new libraries.
    • +
    • You can extend native libraries.
    • +
    • You can replace native libraries.
    • +
    +

    The page below explains these three concepts in detail.

    +
    +

    Note

    +

    The Database classes can not be extended or replaced with your +own classes. All other classes are able to be replaced/extended.

    +
    +
    +

    Storage

    +

    Your library classes should be placed within your application/libraries +directory, as this is where CodeIgniter will look for them when they are +initialized.

    +
    +
    +

    Naming Conventions

    +
      +
    • File names must be capitalized. For example: Myclass.php
    • +
    • Class declarations must be capitalized. For example: class Myclass
    • +
    • Class names and file names must match.
    • +
    +
    +
    +

    The Class File

    +

    Classes should have this basic prototype:

    +
    <?php
    +defined('BASEPATH') OR exit('No direct script access allowed');
    +
    +class Someclass {
    +
    +        public function some_method()
    +        {
    +        }
    +}
    +
    +
    +
    +

    Note

    +

    We are using the name Someclass purely as an example.

    +
    +
    +
    +

    Using Your Class

    +

    From within any of your Controller methods you +can initialize your class using the standard:

    +
    $this->load->library('someclass');
    +
    +
    +

    Where someclass is the file name, without the “.php” file extension. +You can submit the file name capitalized or lower case. CodeIgniter +doesn’t care.

    +

    Once loaded you can access your class using the lower case version:

    +
    $this->someclass->some_method();  // Object instances will always be lower case
    +
    +
    +
    +
    +

    Passing Parameters When Initializing Your Class

    +

    In the library loading method you can dynamically pass data as an +array via the second parameter and it will be passed to your class +constructor:

    +
    $params = array('type' => 'large', 'color' => 'red');
    +
    +$this->load->library('someclass', $params);
    +
    +
    +

    If you use this feature you must set up your class constructor to expect +data:

    +
    <?php defined('BASEPATH') OR exit('No direct script access allowed');
    +
    +class Someclass {
    +
    +        public function __construct($params)
    +        {
    +                // Do something with $params
    +        }
    +}
    +
    +
    +

    You can also pass parameters stored in a config file. Simply create a +config file named identically to the class file name and store it in +your application/config/ directory. Note that if you dynamically pass +parameters as described above, the config file option will not be +available.

    +
    +
    +

    Utilizing CodeIgniter Resources within Your Library

    +

    To access CodeIgniter’s native resources within your library use the +get_instance() method. This method returns the CodeIgniter super +object.

    +

    Normally from within your controller methods you will call any of the +available CodeIgniter methods using the $this construct:

    +
    $this->load->helper('url');
    +$this->load->library('session');
    +$this->config->item('base_url');
    +// etc.
    +
    +
    +

    $this, however, only works directly within your controllers, your +models, or your views. If you would like to use CodeIgniter’s classes +from within your own custom classes you can do so as follows:

    +

    First, assign the CodeIgniter object to a variable:

    +
    $CI =& get_instance();
    +
    +
    +

    Once you’ve assigned the object to a variable, you’ll use that variable +instead of $this:

    +
    $CI =& get_instance();
    +
    +$CI->load->helper('url');
    +$CI->load->library('session');
    +$CI->config->item('base_url');
    +// etc.
    +
    +
    +
    +

    Note

    +

    You’ll notice that the above get_instance() function is being +passed by reference:

    +
    $CI =& get_instance();
    +
    +
    +

    This is very important. Assigning by reference allows you to use the +original CodeIgniter object rather than creating a copy of it.

    +
    +

    However, since a library is a class, it would be better if you +take full advantage of the OOP principles. So, in order to +be able to use the CodeIgniter super-object in all of the class +methods, you’re encouraged to assign it to a property instead:

    +
    class Example_library {
    +
    +        protected $CI;
    +
    +        // We'll use a constructor, as you can't directly call a function
    +        // from a property definition.
    +        public function __construct()
    +        {
    +                // Assign the CodeIgniter super-object
    +                $this->CI =& get_instance();
    +        }
    +
    +        public function foo()
    +        {
    +                $this->CI->load->helper('url');
    +                redirect();
    +        }
    +
    +        public function bar()
    +        {
    +                echo $this->CI->config->item('base_url');
    +        }
    +
    +}
    +
    +
    +
    +
    +

    Replacing Native Libraries with Your Versions

    +

    Simply by naming your class files identically to a native library will +cause CodeIgniter to use it instead of the native one. To use this +feature you must name the file and the class declaration exactly the +same as the native library. For example, to replace the native Email +library you’ll create a file named application/libraries/Email.php, +and declare your class with:

    +
    class CI_Email {
    +
    +}
    +
    +
    +

    Note that most native classes are prefixed with CI_.

    +

    To load your library you’ll see the standard loading method:

    +
    $this->load->library('email');
    +
    +
    +
    +

    Note

    +

    At this time the Database classes can not be replaced with +your own versions.

    +
    +
    +
    +

    Extending Native Libraries

    +

    If all you need to do is add some functionality to an existing library - +perhaps add a method or two - then it’s overkill to replace the entire +library with your version. In this case it’s better to simply extend the +class. Extending a class is nearly identical to replacing a class with a +couple exceptions:

    +
      +
    • The class declaration must extend the parent class.
    • +
    • Your new class name and filename must be prefixed with MY_ (this +item is configurable. See below.).
    • +
    +

    For example, to extend the native Email class you’ll create a file named +application/libraries/MY_Email.php, and declare your class with:

    +
    class MY_Email extends CI_Email {
    +
    +}
    +
    +
    +

    If you need to use a constructor in your class make sure you +extend the parent constructor:

    +
    class MY_Email extends CI_Email {
    +
    +        public function __construct($config = array())
    +        {
    +                parent::__construct($config);
    +        }
    +
    +}
    +
    +
    +
    +

    Note

    +

    Not all of the libraries have the same (or any) parameters +in their constructor. Take a look at the library that you’re +extending first to see how it should be implemented.

    +
    +
    +

    Loading Your Sub-class

    +

    To load your sub-class you’ll use the standard syntax normally used. DO +NOT include your prefix. For example, to load the example above, which +extends the Email class, you will use:

    +
    $this->load->library('email');
    +
    +
    +

    Once loaded you will use the class variable as you normally would for +the class you are extending. In the case of the email class all calls +will use:

    +
    $this->email->some_method();
    +
    +
    +
    +
    +

    Setting Your Own Prefix

    +

    To set your own sub-class prefix, open your +application/config/config.php file and look for this item:

    +
    $config['subclass_prefix'] = 'MY_';
    +
    +
    +

    Please note that all native CodeIgniter libraries are prefixed with CI_ +so DO NOT use that as your prefix.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html new file mode 100755 index 0000000..3713d75 --- /dev/null +++ b/user_guide/general/credits.html @@ -0,0 +1,502 @@ + + + + + + + + + + Credits — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Credits
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Credits

    +

    CodeIgniter was originally developed by Rick Ellis +(CEO of EllisLab, Inc.). The framework was written for +performance in the real world, with many of the class libraries, helpers, and +sub-systems borrowed from the code-base of ExpressionEngine.

    +

    It was, for years, developed and maintained by EllisLab, the ExpressionEngine +Development Team and a group of community members called the Reactor Team.

    +

    In 2014, CodeIgniter was acquired by the British Columbia Institute of Technology and was then officially announced as a community-maintained +project.

    +

    Bleeding edge development is spearheaded by the handpicked contributors +of the Reactor Team.

    +

    A hat tip goes to Ruby on Rails for inspiring us to create a PHP framework, and +for bringing frameworks into the general consciousness of the web community.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html new file mode 100755 index 0000000..76f2d46 --- /dev/null +++ b/user_guide/general/drivers.html @@ -0,0 +1,530 @@ + + + + + + + + + + Using CodeIgniter Drivers — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Using CodeIgniter Drivers

    +

    Drivers are a special type of Library that has a parent class and any +number of potential child classes. Child classes have access to the +parent class, but not their siblings. Drivers provide an elegant syntax +in your controllers for libraries that benefit +from or require being broken down into discrete classes.

    +

    Drivers are found in the system/libraries/ directory, in their own +sub-directory which is identically named to the parent library class. +Also inside that directory is a subdirectory named drivers, which +contains all of the possible child class files.

    +

    To use a driver you will initialize it within a controller using the +following initialization method:

    +
    $this->load->driver('class_name');
    +
    +
    +

    Where class name is the name of the driver class you want to invoke. For +example, to load a driver named “Some_parent” you would do this:

    +
    $this->load->driver('some_parent');
    +
    +
    +

    Methods of that class can then be invoked with:

    +
    $this->some_parent->some_method();
    +
    +
    +

    The child classes, the drivers themselves, can then be called directly +through the parent class, without initializing them:

    +
    $this->some_parent->child_one->some_method();
    +$this->some_parent->child_two->another_method();
    +
    +
    +
    +

    Creating Your Own Drivers

    +

    Please read the section of the user guide that discusses how to create +your own drivers.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/environments.html b/user_guide/general/environments.html new file mode 100755 index 0000000..896abe9 --- /dev/null +++ b/user_guide/general/environments.html @@ -0,0 +1,538 @@ + + + + + + + + + + Handling Multiple Environments — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Handling Multiple Environments

    +

    Developers often desire different system behavior depending on whether +an application is running in a development or production environment. +For example, verbose error output is something that would be useful +while developing an application, but it may also pose a security issue +when “live”.

    +
    +

    The ENVIRONMENT Constant

    +

    By default, CodeIgniter comes with the environment constant set to use +the value provided in $_SERVER['CI_ENV'], otherwise defaults to +‘development’. At the top of index.php, you will see:

    +
    define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
    +
    +
    +

    This server variable can be set in your .htaccess file, or Apache +config using SetEnv. +Alternative methods are available for nginx and other servers, or you can +remove this logic entirely and set the constant based on the server’s IP address.

    +

    In addition to affecting some basic framework behavior (see the next +section), you may use this constant in your own development to +differentiate between which environment you are running in.

    +
    +
    +

    Effects On Default Framework Behavior

    +

    There are some places in the CodeIgniter system where the ENVIRONMENT +constant is used. This section describes how default framework behavior +is affected.

    +
    +

    Error Reporting

    +

    Setting the ENVIRONMENT constant to a value of ‘development’ will cause +all PHP errors to be rendered to the browser when they occur. +Conversely, setting the constant to ‘production’ will disable all error +output. Disabling error reporting in production is a good security +practice.

    +
    +
    +

    Configuration Files

    +

    Optionally, you can have CodeIgniter load environment-specific +configuration files. This may be useful for managing things like +differing API keys across multiple environments. This is described in +more detail in the environment section of the Config Class documentation.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/errors.html b/user_guide/general/errors.html new file mode 100755 index 0000000..ffdf37c --- /dev/null +++ b/user_guide/general/errors.html @@ -0,0 +1,649 @@ + + + + + + + + + + Error Handling — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Error Handling

    +

    CodeIgniter lets you build error reporting into your applications using +the functions described below. In addition, it has an error logging +class that permits error and debugging messages to be saved as text +files.

    +
    +

    Note

    +

    By default, CodeIgniter displays all PHP errors. You might +wish to change this behavior once your development is complete. You’ll +find the error_reporting() function located at the top of your main +index.php file. Disabling error reporting will NOT prevent log files +from being written if there are errors.

    +
    +

    Unlike most systems in CodeIgniter, the error functions are simple +procedural interfaces that are available globally throughout the +application. This approach permits error messages to get triggered +without having to worry about class/function scoping.

    +

    CodeIgniter also returns a status code whenever a portion of the core +calls exit(). This exit status code is separate from the HTTP status +code, and serves as a notice to other processes that may be watching of +whether the script completed successfully, or if not, what kind of +problem it encountered that caused it to abort. These values are +defined in application/config/constants.php. While exit status codes +are most useful in CLI settings, returning the proper code helps server +software keep track of your scripts and the health of your application.

    +

    The following functions let you generate errors:

    +
    +
    +show_error($message, $status_code, $heading = 'An Error Was Encountered')
    +
    +++ + + + + + +
    Parameters:
      +
    • $message (mixed) – Error message
    • +
    • $status_code (int) – HTTP Response status code
    • +
    • $heading (string) – Error page heading
    • +
    +
    Return type:

    void

    +
    +

    This function will display the error message supplied to it using +the error template appropriate to your execution:

    +
    application/views/errors/html/error_general.php
    +
    +
    +

    or:

    +
    +
    application/views/errors/cli/error_general.php
    +

    The optional parameter $status_code determines what HTTP status +code should be sent with the error. If $status_code is less +than 100, the HTTP status code will be set to 500, and the exit +status code will be set to $status_code + EXIT__AUTO_MIN. +If that value is larger than EXIT__AUTO_MAX, or if +$status_code is 100 or higher, the exit status code will be set +to EXIT_ERROR. +You can check in application/config/constants.php for more detail.

    +
    + +
    +
    +show_404($page = '', $log_error = TRUE)
    +
    +++ + + + + + +
    Parameters:
      +
    • $page (string) – URI string
    • +
    • $log_error (bool) – Whether to log the error
    • +
    +
    Return type:

    void

    +
    +

    This function will display the 404 error message supplied to it +using the error template appropriate to your execution:

    +
    application/views/errors/html/error_404.php
    +
    +
    +

    or:

    +
    +
    application/views/errors/cli/error_404.php
    +

    The function expects the string passed to it to be the file path to +the page that isn’t found. The exit status code will be set to +EXIT_UNKNOWN_FILE. +Note that CodeIgniter automatically shows 404 messages if +controllers are not found.

    +

    CodeIgniter automatically logs any show_404() calls. Setting the +optional second parameter to FALSE will skip logging.

    +
    + +
    +
    +log_message($level, $message)
    +
    +++ + + + + + +
    Parameters:
      +
    • $level (string) – Log level: ‘error’, ‘debug’ or ‘info’
    • +
    • $message (string) – Message to log
    • +
    +
    Return type:

    void

    +
    +

    This function lets you write messages to your log files. You must +supply one of three “levels” in the first parameter, indicating what +type of message it is (debug, error, info), with the message itself +in the second parameter.

    +

    Example:

    +
    if ($some_var == '')
    +{
    +        log_message('error', 'Some variable did not contain a value.');
    +}
    +else
    +{
    +        log_message('debug', 'Some variable was correctly set');
    +}
    +
    +log_message('info', 'The purpose of some variable is to provide some value.');
    +
    +
    +

    There are three message types:

    +
      +
    1. Error Messages. These are actual errors, such as PHP errors or +user errors.
    2. +
    3. Debug Messages. These are messages that assist in debugging. For +example, if a class has been initialized, you could log this as +debugging info.
    4. +
    5. Informational Messages. These are the lowest priority messages, +simply giving information regarding some process.
    6. +
    +
    +

    Note

    +

    In order for the log file to actually be written, the +logs/ directory must be writable. In addition, you must +set the “threshold” for logging in +application/config/config.php. You might, for example, +only want error messages to be logged, and not the other +two types. If you set it to zero logging will be disabled.

    +
    +
    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/helpers.html b/user_guide/general/helpers.html new file mode 100755 index 0000000..cf116c6 --- /dev/null +++ b/user_guide/general/helpers.html @@ -0,0 +1,629 @@ + + + + + + + + + + Helper Functions — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Helper Functions

    +

    Helpers, as the name suggests, help you with tasks. Each helper file is +simply a collection of functions in a particular category. There are URL +Helpers, that assist in creating links, there are Form Helpers that help +you create form elements, Text Helpers perform various text formatting +routines, Cookie Helpers set and read cookies, File Helpers help you +deal with files, etc.

    +

    Unlike most other systems in CodeIgniter, Helpers are not written in an +Object Oriented format. They are simple, procedural functions. Each +helper function performs one specific task, with no dependence on other +functions.

    +

    CodeIgniter does not load Helper Files by default, so the first step in +using a Helper is to load it. Once loaded, it becomes globally available +in your controller and +views.

    +

    Helpers are typically stored in your system/helpers, or +application/helpers directory. CodeIgniter will look first in your +application/helpers directory. If the directory does not exist or the +specified helper is not located there CI will instead look in your +global system/helpers/ directory.

    +
    +

    Loading a Helper

    +

    Loading a helper file is quite simple using the following method:

    +
    $this->load->helper('name');
    +
    +
    +

    Where name is the file name of the helper, without the .php file +extension or the “helper” part.

    +

    For example, to load the URL Helper file, which is named +url_helper.php, you would do this:

    +
    $this->load->helper('url');
    +
    +
    +

    A helper can be loaded anywhere within your controller methods (or +even within your View files, although that’s not a good practice), as +long as you load it before you use it. You can load your helpers in your +controller constructor so that they become available automatically in +any function, or you can load a helper in a specific function that needs +it.

    +
    +

    Note

    +

    The Helper loading method above does not return a value, so +don’t try to assign it to a variable. Just use it as shown.

    +
    +
    +
    +

    Loading Multiple Helpers

    +

    If you need to load more than one helper you can specify them in an +array, like this:

    +
    $this->load->helper(
    +        array('helper1', 'helper2', 'helper3')
    +);
    +
    +
    +
    +
    +

    Auto-loading Helpers

    +

    If you find that you need a particular helper globally throughout your +application, you can tell CodeIgniter to auto-load it during system +initialization. This is done by opening the application/config/autoload.php +file and adding the helper to the autoload array.

    +
    +
    +

    Using a Helper

    +

    Once you’ve loaded the Helper File containing the function you intend to +use, you’ll call it the way you would a standard PHP function.

    +

    For example, to create a link using the anchor() function in one of +your view files you would do this:

    +
    <?php echo anchor('blog/comments', 'Click Here');?>
    +
    +
    +

    Where “Click Here” is the name of the link, and “blog/comments” is the +URI to the controller/method you wish to link to.

    +
    +
    +

    “Extending” Helpers

    +

    To “extend” Helpers, create a file in your application/helpers/ folder +with an identical name to the existing Helper, but prefixed with MY_ +(this item is configurable. See below.).

    +

    If all you need to do is add some functionality to an existing helper - +perhaps add a function or two, or change how a particular helper +function operates - then it’s overkill to replace the entire helper with +your version. In this case it’s better to simply “extend” the Helper.

    +
    +

    Note

    +

    The term “extend” is used loosely since Helper functions are +procedural and discrete and cannot be extended in the traditional +programmatic sense. Under the hood, this gives you the ability to +add to or or to replace the functions a Helper provides.

    +
    +

    For example, to extend the native Array Helper you’ll create a file +named application/helpers/MY_array_helper.php, and add or override +functions:

    +
    // any_in_array() is not in the Array Helper, so it defines a new function
    +function any_in_array($needle, $haystack)
    +{
    +        $needle = is_array($needle) ? $needle : array($needle);
    +
    +        foreach ($needle as $item)
    +        {
    +                if (in_array($item, $haystack))
    +                {
    +                        return TRUE;
    +                }
    +        }
    +
    +        return FALSE;
    +}
    +
    +// random_element() is included in Array Helper, so it overrides the native function
    +function random_element($array)
    +{
    +        shuffle($array);
    +        return array_pop($array);
    +}
    +
    +
    +
    +

    Setting Your Own Prefix

    +

    The filename prefix for “extending” Helpers is the same used to extend +libraries and core classes. To set your own prefix, open your +application/config/config.php file and look for this item:

    +
    $config['subclass_prefix'] = 'MY_';
    +
    +
    +

    Please note that all native CodeIgniter libraries are prefixed with CI_ +so DO NOT use that as your prefix.

    +
    +
    +
    +

    Now What?

    +

    In the Table of Contents you’ll find a list of all the available Helper +Files. Browse each one to see what they do.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html new file mode 100755 index 0000000..070fd91 --- /dev/null +++ b/user_guide/general/hooks.html @@ -0,0 +1,617 @@ + + + + + + + + + + Hooks - Extending the Framework Core — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Hooks - Extending the Framework Core

    +

    CodeIgniter’s Hooks feature provides a means to tap into and modify the +inner workings of the framework without hacking the core files. When +CodeIgniter runs it follows a specific execution process, diagramed in +the Application Flow page. There may be +instances, however, where you’d like to cause some action to take place +at a particular stage in the execution process. For example, you might +want to run a script right before your controllers get loaded, or right +after, or you might want to trigger one of your own scripts in some +other location.

    +
    +

    Enabling Hooks

    +

    The hooks feature can be globally enabled/disabled by setting the +following item in the application/config/config.php file:

    +
    $config['enable_hooks'] = TRUE;
    +
    +
    +
    +
    +

    Defining a Hook

    +

    Hooks are defined in the application/config/hooks.php file. +Each hook is specified as an array with this prototype:

    +
    $hook['pre_controller'] = array(
    +        'class'    => 'MyClass',
    +        'function' => 'Myfunction',
    +        'filename' => 'Myclass.php',
    +        'filepath' => 'hooks',
    +        'params'   => array('beer', 'wine', 'snacks')
    +);
    +
    +
    +

    Notes:

    +

    The array index correlates to the name of the particular hook point you +want to use. In the above example the hook point is pre_controller. A +list of hook points is found below. The following items should be +defined in your associative hook array:

    +
      +
    • class The name of the class you wish to invoke. If you prefer to +use a procedural function instead of a class, leave this item blank.
    • +
    • function The function (or method) name you wish to call.
    • +
    • filename The file name containing your class/function.
    • +
    • filepath The name of the directory containing your script. +Note: +Your script must be located in a directory INSIDE your application/ +directory, so the file path is relative to that directory. For example, +if your script is located in application/hooks/, you will simply use +‘hooks’ as your filepath. If your script is located in +application/hooks/utilities/ you will use ‘hooks/utilities’ as your +filepath. No trailing slash.
    • +
    • params Any parameters you wish to pass to your script. This item +is optional.
    • +
    +

    You can also use lambda/anoymous functions (or closures) as hooks, with +a simpler syntax:

    +
    $hook['post_controller'] = function()
    +{
    +        /* do something here */
    +};
    +
    +
    +
    +
    +

    Multiple Calls to the Same Hook

    +

    If want to use the same hook point with more than one script, simply +make your array declaration multi-dimensional, like this:

    +
    $hook['pre_controller'][] = array(
    +        'class'    => 'MyClass',
    +        'function' => 'MyMethod',
    +        'filename' => 'Myclass.php',
    +        'filepath' => 'hooks',
    +        'params'   => array('beer', 'wine', 'snacks')
    +);
    +
    +$hook['pre_controller'][] = array(
    +        'class'    => 'MyOtherClass',
    +        'function' => 'MyOtherMethod',
    +        'filename' => 'Myotherclass.php',
    +        'filepath' => 'hooks',
    +        'params'   => array('red', 'yellow', 'blue')
    +);
    +
    +
    +

    Notice the brackets after each array index:

    +
    $hook['pre_controller'][]
    +
    +
    +

    This permits you to have the same hook point with multiple scripts. The +order you define your array will be the execution order.

    +
    +
    +

    Hook Points

    +

    The following is a list of available hook points.

    +
      +
    • pre_system +Called very early during system execution. Only the benchmark and +hooks class have been loaded at this point. No routing or other +processes have happened.
    • +
    • pre_controller +Called immediately prior to any of your controllers being called. +All base classes, routing, and security checks have been done.
    • +
    • post_controller_constructor +Called immediately after your controller is instantiated, but prior +to any method calls happening.
    • +
    • post_controller +Called immediately after your controller is fully executed.
    • +
    • display_override +Overrides the _display() method, used to send the finalized page +to the web browser at the end of system execution. This permits you +to use your own display methodology. Note that you will need to +reference the CI superobject with $this->CI =& get_instance() and +then the finalized data will be available by calling +$this->CI->output->get_output().
    • +
    • cache_override +Enables you to call your own method instead of the _display_cache() +method in the Output Library. This permits +you to use your own cache display mechanism.
    • +
    • post_system +Called after the final rendered page is sent to the browser, at the +end of system execution after the finalized data is sent to the +browser.
    • +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/index.html b/user_guide/general/index.html new file mode 100755 index 0000000..0ea59df --- /dev/null +++ b/user_guide/general/index.html @@ -0,0 +1,523 @@ + + + + + + + + + + General Topics — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/libraries.html b/user_guide/general/libraries.html new file mode 100755 index 0000000..785c9b5 --- /dev/null +++ b/user_guide/general/libraries.html @@ -0,0 +1,521 @@ + + + + + + + + + + Using CodeIgniter Libraries — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Using CodeIgniter Libraries

    +

    All of the available libraries are located in your system/libraries/ +directory. In most cases, to use one of these classes involves initializing +it within a controller using the following +initialization method:

    +
    $this->load->library('class_name');
    +
    +
    +

    Where ‘class_name’ is the name of the class you want to invoke. For +example, to load the Form Validation Library you would do this:

    +
    $this->load->library('form_validation');
    +
    +
    +

    Once initialized you can use it as indicated in the user guide page +corresponding to that class.

    +

    Additionally, multiple libraries can be loaded at the same time by +passing an array of libraries to the load method.

    +

    Example:

    +
    $this->load->library(array('email', 'table'));
    +
    +
    +
    +

    Creating Your Own Libraries

    +

    Please read the section of the user guide that discusses how to +create your own libraries.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html new file mode 100755 index 0000000..7a48db9 --- /dev/null +++ b/user_guide/general/managing_apps.html @@ -0,0 +1,554 @@ + + + + + + + + + + Managing your Applications — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Managing your Applications

    +

    By default it is assumed that you only intend to use CodeIgniter to +manage one application, which you will build in your application/ +directory. It is possible, however, to have multiple sets of +applications that share a single CodeIgniter installation, or even to +rename or relocate your application directory.

    +
    +

    Renaming the Application Directory

    +

    If you would like to rename your application directory you may do so +as long as you open your main index.php file and set its name using +the $application_folder variable:

    +
    $application_folder = 'application';
    +
    +
    +
    +
    +

    Relocating your Application Directory

    +

    It is possible to move your application directory to a different +location on your server than your web root. To do so open +your main index.php and set a full server path in the +$application_folder variable:

    +
    $application_folder = '/path/to/your/application';
    +
    +
    +
    +
    +

    Running Multiple Applications with one CodeIgniter Installation

    +

    If you would like to share a common CodeIgniter installation to manage +several different applications simply put all of the directories located +inside your application directory into their own sub-directory.

    +

    For example, let’s say you want to create two applications, named “foo” +and “bar”. You could structure your application directories like this:

    +
    applications/foo/
    +applications/foo/config/
    +applications/foo/controllers/
    +applications/foo/libraries/
    +applications/foo/models/
    +applications/foo/views/
    +applications/bar/
    +applications/bar/config/
    +applications/bar/controllers/
    +applications/bar/libraries/
    +applications/bar/models/
    +applications/bar/views/
    +
    +
    +

    To select a particular application for use requires that you open your +main index.php file and set the $application_folder variable. For +example, to select the “foo” application for use you would do this:

    +
    $application_folder = 'applications/foo';
    +
    +
    +
    +

    Note

    +

    Each of your applications will need its own index.php file +which calls the desired application. The index.php file can be named +anything you want.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/models.html b/user_guide/general/models.html new file mode 100755 index 0000000..5055eb3 --- /dev/null +++ b/user_guide/general/models.html @@ -0,0 +1,685 @@ + + + + + + + + + + Models — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Models

    +

    Models are optionally available for those who want to use a more +traditional MVC approach.

    + +
    +

    What is a Model?

    +

    Models are PHP classes that are designed to work with information in +your database. For example, let’s say you use CodeIgniter to manage a +blog. You might have a model class that contains functions to insert, +update, and retrieve your blog data. Here is an example of what such a +model class might look like:

    +
    class Blog_model extends CI_Model {
    +
    +        public $title;
    +        public $content;
    +        public $date;
    +
    +        public function get_last_ten_entries()
    +        {
    +                $query = $this->db->get('entries', 10);
    +                return $query->result();
    +        }
    +
    +        public function insert_entry()
    +        {
    +                $this->title    = $_POST['title']; // please read the below note
    +                $this->content  = $_POST['content'];
    +                $this->date     = time();
    +
    +                $this->db->insert('entries', $this);
    +        }
    +
    +        public function update_entry()
    +        {
    +                $this->title    = $_POST['title'];
    +                $this->content  = $_POST['content'];
    +                $this->date     = time();
    +
    +                $this->db->update('entries', $this, array('id' => $_POST['id']));
    +        }
    +
    +}
    +
    +
    +
    +

    Note

    +

    The methods in the above example use the Query Builder database methods.

    +
    +
    +

    Note

    +

    For the sake of simplicity in this example we’re using $_POST +directly. This is generally bad practice, and a more common approach +would be to use the Input Library +$this->input->post('title').

    +
    +
    +
    +

    Anatomy of a Model

    +

    Model classes are stored in your application/models/ directory. +They can be nested within sub-directories if you want this type of +organization.

    +

    The basic prototype for a model class is this:

    +
    class Model_name extends CI_Model {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                // Your own constructor code
    +        }
    +
    +}
    +
    +
    +

    Where Model_name is the name of your class. Class names must have +the first letter capitalized with the rest of the name lowercase. Make +sure your class extends the base Model class.

    +

    The file name must match the class name. For example, if this is your class:

    +
    class User_model extends CI_Model {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                // Your own constructor code
    +        }
    +
    +}
    +
    +
    +

    Your file will be this:

    +
    application/models/User_model.php
    +
    +
    +
    +
    +

    Loading a Model

    +

    Your models will typically be loaded and called from within your +controller methods. To load a model you will use +the following method:

    +
    $this->load->model('model_name');
    +
    +
    +

    If your model is located in a sub-directory, include the relative path +from your models directory. For example, if you have a model located at +application/models/blog/Queries.php you’ll load it using:

    +
    $this->load->model('blog/queries');
    +
    +
    +

    Once loaded, you will access your model methods using an object with the +same name as your class:

    +
    $this->load->model('model_name');
    +
    +$this->model_name->method();
    +
    +
    +

    If you would like your model assigned to a different object name you can +specify it via the second parameter of the loading method:

    +
    $this->load->model('model_name', 'foobar');
    +
    +$this->foobar->method();
    +
    +
    +

    Here is an example of a controller, that loads a model, then serves a +view:

    +
    class Blog_controller extends CI_Controller {
    +
    +        public function blog()
    +        {
    +                $this->load->model('blog');
    +
    +                $data['query'] = $this->blog->get_last_ten_entries();
    +
    +                $this->load->view('blog', $data);
    +        }
    +}
    +
    +
    +
    +
    +

    Auto-loading Models

    +

    If you find that you need a particular model globally throughout your +application, you can tell CodeIgniter to auto-load it during system +initialization. This is done by opening the +application/config/autoload.php file and adding the model to the +autoload array.

    +
    +
    +

    Connecting to your Database

    +

    When a model is loaded it does NOT connect automatically to your +database. The following options for connecting are available to you:

    +
      +
    • You can connect using the standard database methods described +here, either from within your +Controller class or your Model class.

      +
    • +
    • You can tell the model loading method to auto-connect by passing +TRUE (boolean) via the third parameter, and connectivity settings, +as defined in your database config file will be used:

      +
      $this->load->model('model_name', '', TRUE);
      +
      +
      +
    • +
    • You can manually pass database connectivity settings via the third +parameter:

      +
      $config['hostname'] = 'localhost';
      +$config['username'] = 'myusername';
      +$config['password'] = 'mypassword';
      +$config['database'] = 'mydatabase';
      +$config['dbdriver'] = 'mysqli';
      +$config['dbprefix'] = '';
      +$config['pconnect'] = FALSE;
      +$config['db_debug'] = TRUE;
      +
      +$this->load->model('model_name', '', $config);
      +
      +
      +
    • +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html new file mode 100755 index 0000000..7da2b96 --- /dev/null +++ b/user_guide/general/profiling.html @@ -0,0 +1,624 @@ + + + + + + + + + + Profiling Your Application — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Profiling Your Application

    +

    The Profiler Class will display benchmark results, queries you have run, +and $_POST data at the bottom of your pages. This information can be +useful during development in order to help with debugging and +optimization.

    +
    +

    Initializing the Class

    +
    +

    Important

    +

    This class does NOT need to be initialized. It is loaded +automatically by the Output Library +if profiling is enabled as shown below.

    +
    +
    +
    +

    Enabling the Profiler

    +

    To enable the profiler place the following line anywhere within your +Controller methods:

    +
    $this->output->enable_profiler(TRUE);
    +
    +
    +

    When enabled a report will be generated and inserted at the bottom of +your pages.

    +

    To disable the profiler you will use:

    +
    $this->output->enable_profiler(FALSE);
    +
    +
    +
    +
    +

    Setting Benchmark Points

    +

    In order for the Profiler to compile and display your benchmark data you +must name your mark points using specific syntax.

    +

    Please read the information on setting Benchmark points in the +Benchmark Library page.

    +
    +
    +

    Enabling and Disabling Profiler Sections

    +

    Each section of Profiler data can be enabled or disabled by setting a +corresponding config variable to TRUE or FALSE. This can be done one of +two ways. First, you can set application wide defaults with the +application/config/profiler.php config file.

    +

    Example:

    +
    $config['config']          = FALSE;
    +$config['queries']         = FALSE;
    +
    +
    +

    In your controllers, you can override the defaults and config file +values by calling the set_profiler_sections() method of the +Output Library:

    +
    $sections = array(
    +        'config'  => TRUE,
    +        'queries' => TRUE
    +);
    +
    +$this->output->set_profiler_sections($sections);
    +
    +
    +

    Available sections and the array key used to access them are described +in the table below.

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyDescriptionDefault
    benchmarksElapsed time of Benchmark points and total execution timeTRUE
    configCodeIgniter Config variablesTRUE
    controller_infoThe Controller class and method requestedTRUE
    getAny GET data passed in the requestTRUE
    http_headersThe HTTP headers for the current requestTRUE
    memory_usageAmount of memory consumed by the current request, in bytesTRUE
    postAny POST data passed in the requestTRUE
    queriesListing of all database queries executed, including execution timeTRUE
    uri_stringThe URI of the current requestTRUE
    session_dataData stored in the current sessionTRUE
    query_toggle_countThe number of queries after which the query block will default to +hidden.25
    +
    +

    Note

    +

    Disabling the save_queries setting in +your database configuration will also effectively disable profiling for +database queries and render the ‘queries’ setting above useless. You can +optionally override this setting with $this->db->save_queries = TRUE;. +Without this setting you won’t be able to view the queries or the +last_query <database/helpers>.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/requirements.html b/user_guide/general/requirements.html new file mode 100755 index 0000000..34f11da --- /dev/null +++ b/user_guide/general/requirements.html @@ -0,0 +1,511 @@ + + + + + + + + + + Server Requirements — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Server Requirements
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Server Requirements

    +

    PHP version 5.6 or newer is recommended.

    +

    It should work on 5.3.7 as well, but we strongly advise you NOT to run +such old versions of PHP, because of potential security and performance +issues, as well as missing features.

    +

    A database is required for most web application programming. +Currently supported databases are:

    +
    +
      +
    • MySQL (5.1+) via the mysql (deprecated), mysqli and pdo drivers
    • +
    • Oracle via the oci8 and pdo drivers
    • +
    • PostgreSQL via the postgre and pdo drivers
    • +
    • MS SQL via the mssql, sqlsrv (version 2005 and above only) and pdo drivers
    • +
    • SQLite via the sqlite (version 2), sqlite3 (version 3) and pdo drivers
    • +
    • CUBRID via the cubrid and pdo drivers
    • +
    • Interbase/Firebird via the ibase and pdo drivers
    • +
    • ODBC via the odbc and pdo drivers (you should know that ODBC is actually an abstraction layer)
    • +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/reserved_names.html b/user_guide/general/reserved_names.html new file mode 100755 index 0000000..41d3696 --- /dev/null +++ b/user_guide/general/reserved_names.html @@ -0,0 +1,583 @@ + + + + + + + + + + Reserved Names — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Reserved Names

    +

    In order to help out, CodeIgniter uses a series of function, method, +class and variable names in its operation. Because of this, some names +cannot be used by a developer. Following is a list of reserved names +that cannot be used.

    +
    +

    Controller names

    +

    Since your controller classes will extend the main application +controller you must be careful not to name your methods identically to +the ones used by that class, otherwise your local methods will +override them. The following is a list of reserved names. Do not name +your controller any of these:

    +
      +
    • CI_Controller
    • +
    • Default
    • +
    • index
    • +
    +
    +
    +

    Functions

    + +
    +
    +

    Variables

    +
      +
    • $config
    • +
    • $db
    • +
    • $lang
    • +
    +
    +
    +

    Constants

    +
      +
    • ENVIRONMENT
    • +
    • FCPATH
    • +
    • SELF
    • +
    • BASEPATH
    • +
    • APPPATH
    • +
    • VIEWPATH
    • +
    • CI_VERSION
    • +
    • MB_ENABLED
    • +
    • ICONV_ENABLED
    • +
    • UTF8_ENABLED
    • +
    • FILE_READ_MODE
    • +
    • FILE_WRITE_MODE
    • +
    • DIR_READ_MODE
    • +
    • DIR_WRITE_MODE
    • +
    • FOPEN_READ
    • +
    • FOPEN_READ_WRITE
    • +
    • FOPEN_WRITE_CREATE_DESTRUCTIVE
    • +
    • FOPEN_READ_WRITE_CREATE_DESTRUCTIVE
    • +
    • FOPEN_WRITE_CREATE
    • +
    • FOPEN_READ_WRITE_CREATE
    • +
    • FOPEN_WRITE_CREATE_STRICT
    • +
    • FOPEN_READ_WRITE_CREATE_STRICT
    • +
    • SHOW_DEBUG_BACKTRACE
    • +
    • EXIT_SUCCESS
    • +
    • EXIT_ERROR
    • +
    • EXIT_CONFIG
    • +
    • EXIT_UNKNOWN_FILE
    • +
    • EXIT_UNKNOWN_CLASS
    • +
    • EXIT_UNKNOWN_METHOD
    • +
    • EXIT_USER_INPUT
    • +
    • EXIT_DATABASE
    • +
    • EXIT__AUTO_MIN
    • +
    • EXIT__AUTO_MAX
    • +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html new file mode 100755 index 0000000..5b9f484 --- /dev/null +++ b/user_guide/general/routing.html @@ -0,0 +1,689 @@ + + + + + + + + + + URI Routing — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    URI Routing

    +

    Typically there is a one-to-one relationship between a URL string and +its corresponding controller class/method. The segments in a URI +normally follow this pattern:

    +
    example.com/class/function/id/
    +
    +
    +

    In some instances, however, you may want to remap this relationship so +that a different class/method can be called instead of the one +corresponding to the URL.

    +

    For example, let’s say you want your URLs to have this prototype:

    +
    example.com/product/1/
    +example.com/product/2/
    +example.com/product/3/
    +example.com/product/4/
    +
    +
    +

    Normally the second segment of the URL is reserved for the method +name, but in the example above it instead has a product ID. To +overcome this, CodeIgniter allows you to remap the URI handler.

    +
    +

    Setting your own routing rules

    +

    Routing rules are defined in your application/config/routes.php file. +In it you’ll see an array called $route that permits you to specify +your own routing criteria. Routes can either be specified using wildcards +or Regular Expressions.

    +
    +
    +

    Wildcards

    +

    A typical wildcard route might look something like this:

    +
    $route['product/:num'] = 'catalog/product_lookup';
    +
    +
    +

    In a route, the array key contains the URI to be matched, while the +array value contains the destination it should be re-routed to. In the +above example, if the literal word “product” is found in the first +segment of the URL, and a number is found in the second segment, the +“catalog” class and the “product_lookup” method are instead used.

    +

    You can match literal values or you can use two wildcard types:

    +

    (:num) will match a segment containing only numbers. +(:any) will match a segment containing any character (except for ‘/’, which is the segment delimiter).

    +
    +

    Note

    +

    Wildcards are actually aliases for regular expressions, with +:any being translated to [^/]+ and :num to [0-9]+, +respectively.

    +
    +
    +

    Note

    +

    Routes will run in the order they are defined. Higher routes +will always take precedence over lower ones.

    +
    +
    +

    Note

    +

    Route rules are not filters! Setting a rule of e.g. +‘foo/bar/(:num)’ will not prevent controller Foo and method +bar to be called with a non-numeric value if that is a valid +route.

    +
    +
    +
    +

    Examples

    +

    Here are a few routing examples:

    +
    $route['journals'] = 'blogs';
    +
    +
    +

    A URL containing the word “journals” in the first segment will be +remapped to the “blogs” class.

    +
    $route['blog/joe'] = 'blogs/users/34';
    +
    +
    +

    A URL containing the segments blog/joe will be remapped to the “blogs” +class and the “users” method. The ID will be set to “34”.

    +
    $route['product/(:any)'] = 'catalog/product_lookup';
    +
    +
    +

    A URL with “product” as the first segment, and anything in the second +will be remapped to the “catalog” class and the “product_lookup” +method.

    +
    $route['product/(:num)'] = 'catalog/product_lookup_by_id/$1';
    +
    +
    +

    A URL with “product” as the first segment, and a number in the second +will be remapped to the “catalog” class and the +“product_lookup_by_id” method passing in the match as a variable to +the method.

    +
    +

    Important

    +

    Do not use leading/trailing slashes.

    +
    +
    +
    +

    Regular Expressions

    +

    If you prefer you can use regular expressions to define your routing +rules. Any valid regular expression is allowed, as are back-references.

    +
    +

    Note

    +

    If you use back-references you must use the dollar syntax +rather than the double backslash syntax.

    +
    +

    A typical RegEx route might look something like this:

    +
    $route['products/([a-z]+)/(\d+)'] = '$1/id_$2';
    +
    +
    +

    In the above example, a URI similar to products/shirts/123 would instead +call the “shirts” controller class and the “id_123” method.

    +

    With regular expressions, you can also catch multiple segments at once. +For example, if a user accesses a password protected area of your web +application and you wish to be able to redirect them back to the same +page after they log in, you may find this example useful:

    +
    $route['login/(.+)'] = 'auth/login/$1';
    +
    +
    +
    +

    Note

    +

    In the above example, if the $1 placeholder contains a +slash, it will still be split into multiple parameters when +passed to Auth::login().

    +
    +

    For those of you who don’t know regular expressions and want to learn +more about them, regular-expressions.info +might be a good starting point.

    +
    +

    Note

    +

    You can also mix and match wildcards with regular expressions.

    +
    +
    +
    +

    Callbacks

    +

    You can also use callbacks in place of the normal routing rules to process +the back-references. Example:

    +
    $route['products/([a-zA-Z]+)/edit/(\d+)'] = function ($product_type, $id)
    +{
    +        return 'catalog/product_edit/' . strtolower($product_type) . '/' . $id;
    +};
    +
    +
    +
    +
    +

    Using HTTP verbs in routes

    +

    It is possible to use HTTP verbs (request method) to define your routing rules. +This is particularly useful when building RESTful applications. You can use standard HTTP +verbs (GET, PUT, POST, DELETE, PATCH) or a custom one such (e.g. PURGE). HTTP verb rules +are case-insensitive. All you need to do is to add the verb as an array key to your route. +Example:

    +
    $route['products']['put'] = 'product/insert';
    +
    +
    +

    In the above example, a PUT request to URI “products” would call the Product::insert() +controller method.

    +
    $route['products/(:num)']['DELETE'] = 'product/delete/$1';
    +
    +
    +

    A DELETE request to URL with “products” as first the segment and a number in the second will be +mapped to the Product::delete() method, passing the numeric value as the first parameter.

    +

    Using HTTP verbs is of course, optional.

    +
    +
    +

    Reserved Routes

    +

    There are three reserved routes:

    +
    $route['default_controller'] = 'welcome';
    +
    +
    +

    This route points to the action that should be executed if the URI contains +no data, which will be the case when people load your root URL. +The setting accepts a controller/method value and index() would be +the default method if you don’t specify one. In the above example, it is +Welcome::index() that would be called.

    +
    +

    Note

    +

    You can NOT use a directory as a part of this setting!

    +
    +

    You are encouraged to always have a default route as otherwise a 404 page +will appear by default.

    +
    $route['404_override'] = '';
    +
    +
    +

    This route indicates which controller class should be loaded if the +requested controller is not found. It will override the default 404 +error page. Same per-directory rules as with ‘default_controller’ +apply here as well.

    +

    It won’t affect to the show_404() function, which will +continue loading the default error_404.php file at +application/views/errors/error_404.php.

    +
    $route['translate_uri_dashes'] = FALSE;
    +
    +
    +

    As evident by the boolean value, this is not exactly a route. This +option enables you to automatically replace dashes (‘-‘) with +underscores in the controller and method URI segments, thus saving you +additional route entries if you need to do that. +This is required, because the dash isn’t a valid class or method name +character and would cause a fatal error if you try to use it.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/security.html b/user_guide/general/security.html new file mode 100755 index 0000000..ceba49b --- /dev/null +++ b/user_guide/general/security.html @@ -0,0 +1,663 @@ + + + + + + + + + + Security — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Security

    +

    This page describes some “best practices” regarding web security, and +details CodeIgniter’s internal security features.

    +
    +

    Note

    +

    If you came here looking for a security contact, please refer to +our Contribution Guide <../contributing/index>.

    +
    +
    +

    URI Security

    +

    CodeIgniter is fairly restrictive regarding which characters it allows +in your URI strings in order to help minimize the possibility that +malicious data can be passed to your application. URIs may only contain +the following:

    +
      +
    • Alpha-numeric text (latin characters only)
    • +
    • Tilde: ~
    • +
    • Percent sign: %
    • +
    • Period: .
    • +
    • Colon: :
    • +
    • Underscore: _
    • +
    • Dash: -
    • +
    • Space
    • +
    +
    +
    +

    Register_globals

    +

    During system initialization all global variables that are found to exist +in the $_GET, $_POST, $_REQUEST and $_COOKIE are unset.

    +

    The unsetting routine is effectively the same as register_globals = off.

    +
    +
    +

    display_errors

    +

    In production environments, it is typically desirable to “disable” PHP’s +error reporting by setting the internal display_errors flag to a value +of 0. This disables native PHP errors from being rendered as output, +which may potentially contain sensitive information.

    +

    Setting CodeIgniter’s ENVIRONMENT constant in index.php to a value of +‘production’ will turn off these errors. In development mode, it is +recommended that a value of ‘development’ is used. More information +about differentiating between environments can be found on the +Handling Environments page.

    +
    +
    +

    magic_quotes_runtime

    +

    The magic_quotes_runtime directive is turned off during system +initialization so that you don’t have to remove slashes when retrieving +data from your database.

    +
    +

    Best Practices

    +

    Before accepting any data into your application, whether it be POST data +from a form submission, COOKIE data, URI data, XML-RPC data, or even +data from the SERVER array, you are encouraged to practice this three +step approach:

    +
      +
    1. Validate the data to ensure it conforms to the correct type, length, +size, etc.
    2. +
    3. Filter the data as if it were tainted.
    4. +
    5. Escape the data before submitting it into your database or outputting +it to a browser.
    6. +
    +

    CodeIgniter provides the following functions and tips to assist you +in this process:

    +
    +
    +
    +

    XSS Filtering

    +

    CodeIgniter comes with a Cross Site Scripting filter. This filter +looks for commonly used techniques to embed malicious JavaScript into +your data, or other types of code that attempt to hijack cookies or +do other malicious things. The XSS Filter is described +here.

    +
    +

    Note

    +

    XSS filtering should only be performed on output. Filtering +input data may modify the data in undesirable ways, including +stripping special characters from passwords, which reduces +security instead of improving it.

    +
    +
    +
    +

    CSRF protection

    +

    CSRF stands for Cross-Site Request Forgery, which is the process of an +attacker tricking their victim into unknowingly submitting a request.

    +

    CodeIgniter provides CSRF protection out of the box, which will get +automatically triggered for every non-GET HTTP request, but also needs +you to create your submit forms in a certain way. This is explained in +the Security Library documentation.

    +
    +
    +

    Password handling

    +

    It is critical that you handle passwords in your application properly.

    +

    Unfortunately, many developers don’t know how to do that, and the web is +full of outdated or otherwise wrongful advices, which doesn’t help.

    +

    We would like to give you a list of combined do’s and don’ts to help you +with that. Please read below.

    +
      +
    • DO NOT store passwords in plain-text format.

      +

      Always hash your passwords.

      +
    • +
    • DO NOT use Base64 or similar encoding for storing passwords.

      +

      This is as good as storing them in plain-text. Really. Do hashing, +not encoding.

      +

      Encoding, and encryption too, are two-way processes. Passwords are +secrets that must only be known to their owner, and thus must work +only in one direction. Hashing does that - there’s no un-hashing or +de-hashing, but there is decoding and decryption.

      +
    • +
    • DO NOT use weak or broken hashing algorithms like MD5 or SHA1.

      +

      These algorithms are old, proven to be flawed, and not designed for +password hashing in the first place.

      +

      Also, DON’T invent your own algorithms.

      +

      Only use strong password hashing algorithms like BCrypt, which is used +in PHP’s own Password Hashing functions.

      +

      Please use them, even if you’re not running PHP 5.5+, CodeIgniter +provides them for you.

      +
    • +
    • DO NOT ever display or send a password in plain-text format!

      +

      Even to the password’s owner, if you need a “Forgotten password” +feature, just randomly generate a new, one-time (this is also important) +password and send that instead.

      +
    • +
    • DO NOT put unnecessary limits on your users’ passwords.

      +

      If you’re using a hashing algorithm other than BCrypt (which has a limit +of 72 characters), you should set a relatively high limit on password +lengths in order to mitigate DoS attacks - say, 1024 characters.

      +

      Other than that however, there’s no point in forcing a rule that a +password can only be up to a number of characters, or that it can’t +contain a certain set of special characters.

      +

      Not only does this reduce security instead of improving it, but +there’s literally no reason to do it. No technical limitations and +no (practical) storage constraints apply once you’ve hashed them, none!

      +
    • +
    +
    +
    +

    Validate input data

    +

    CodeIgniter has a Form Validation Library that assists you in +validating, filtering, and prepping your data.

    +

    Even if that doesn’t work for your use case however, be sure to always +validate and sanitize all input data. For example, if you expect a numeric +string for an input variable, you can check for that with is_numeric() +or ctype_digit(). Always try to narrow down your checks to a certain +pattern.

    +

    Have it in mind that this includes not only $_POST and $_GET +variables, but also cookies, the user-agent string and basically +all data that is not created directly by your own code.

    +
    +
    +

    Escape all data before database insertion

    +

    Never insert information into your database without escaping it. +Please see the section that discusses database queries for more information.

    +
    +
    +

    Hide your files

    +

    Another good security practice is to only leave your index.php +and “assets” (e.g. .js, css and image files) under your server’s +webroot directory (most commonly named “htdocs/”). These are +the only files that you would need to be accessible from the web.

    +

    Allowing your visitors to see anything else would potentially +allow them to access sensitive data, execute scripts, etc.

    +

    If you’re not allowed to do that, you can try using a .htaccess +file to restrict access to those resources.

    +

    CodeIgniter will have an index.html file in all of its +directories in an attempt to hide some of this data, but have +it in mind that this is not enough to prevent a serious +attacker.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html new file mode 100755 index 0000000..4b8e73c --- /dev/null +++ b/user_guide/general/styleguide.html @@ -0,0 +1,1128 @@ + + + + + + + + + + PHP Style Guide — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    PHP Style Guide

    +

    The following page describes the coding styles adhered to when +contributing to the development of CodeIgniter. There is no requirement +to use these styles in your own CodeIgniter application, though they +are recommended.

    + +
    +

    File Format

    +

    Files should be saved with Unicode (UTF-8) encoding. The BOM should +not be used. Unlike UTF-16 and UTF-32, there’s no byte order to +indicate in a UTF-8 encoded file, and the BOM can have a negative side +effect in PHP of sending output, preventing the application from being +able to set its own headers. Unix line endings should be used (LF).

    +

    Here is how to apply these settings in some of the more common text +editors. Instructions for your text editor may vary; check your text +editor’s documentation.

    +
    +

    TextMate

    +
      +
    1. Open the Application Preferences
    2. +
    3. Click Advanced, and then the “Saving” tab
    4. +
    5. In “File Encoding”, select “UTF-8 (recommended)”
    6. +
    7. In “Line Endings”, select “LF (recommended)”
    8. +
    9. Optional: Check “Use for existing files as well” if you wish to +modify the line endings of files you open to your new preference.
    10. +
    +
    +
    +

    BBEdit

    +
      +
    1. Open the Application Preferences
    2. +
    3. Select “Text Encodings” on the left.
    4. +
    5. In “Default text encoding for new documents”, select “Unicode (UTF-8, +no BOM)”
    6. +
    7. Optional: In “If file’s encoding can’t be guessed, use”, select +“Unicode (UTF-8, no BOM)”
    8. +
    9. Select “Text Files” on the left.
    10. +
    11. In “Default line breaks”, select “Mac OS X and Unix (LF)”
    12. +
    +
    +
    +
    +

    PHP Closing Tag

    +

    The PHP closing tag on a PHP document ?> is optional to the PHP +parser. However, if used, any whitespace following the closing tag, +whether introduced by the developer, user, or an FTP application, can +cause unwanted output, PHP errors, or if the latter are suppressed, +blank pages. For this reason, all PHP files MUST OMIT the PHP closing +tag and end with a single empty line instead.

    +
    +
    +

    File Naming

    +

    Class files must be named in a Ucfirst-like manner, while any other file name +(configurations, views, generic scripts, etc.) should be in all lowercase.

    +

    INCORRECT:

    +
    somelibrary.php
    +someLibrary.php
    +SOMELIBRARY.php
    +Some_Library.php
    +
    +Application_config.php
    +Application_Config.php
    +applicationConfig.php
    +
    +
    +

    CORRECT:

    +
    Somelibrary.php
    +Some_library.php
    +
    +applicationconfig.php
    +application_config.php
    +
    +
    +

    Furthermore, class file names should match the name of the class itself. +For example, if you have a class named Myclass, then its filename must +be Myclass.php.

    +
    +
    +

    Class and Method Naming

    +

    Class names should always start with an uppercase letter. Multiple words +should be separated with an underscore, and not CamelCased.

    +

    INCORRECT:

    +
    class superclass
    +class SuperClass
    +
    +
    +

    CORRECT:

    +
    class Super_class
    +
    +
    +
    class Super_class {
    +
    +        public function __construct()
    +        {
    +
    +        }
    +}
    +
    +
    +

    Class methods should be entirely lowercased and named to clearly +indicate their function, preferably including a verb. Try to avoid +overly long and verbose names. Multiple words should be separated +with an underscore.

    +

    INCORRECT:

    +
    function fileproperties()               // not descriptive and needs underscore separator
    +function fileProperties()               // not descriptive and uses CamelCase
    +function getfileproperties()            // Better!  But still missing underscore separator
    +function getFileProperties()            // uses CamelCase
    +function get_the_file_properties_from_the_file()        // wordy
    +
    +
    +

    CORRECT:

    +
    function get_file_properties()  // descriptive, underscore separator, and all lowercase letters
    +
    +
    +
    +
    +

    Variable Names

    +

    The guidelines for variable naming are very similar to those used for +class methods. Variables should contain only lowercase letters, +use underscore separators, and be reasonably named to indicate their +purpose and contents. Very short, non-word variables should only be used +as iterators in for() loops.

    +

    INCORRECT:

    +
    $j = 'foo';             // single letter variables should only be used in for() loops
    +$Str                    // contains uppercase letters
    +$bufferedText           // uses CamelCasing, and could be shortened without losing semantic meaning
    +$groupid                // multiple words, needs underscore separator
    +$name_of_last_city_used // too long
    +
    +
    +

    CORRECT:

    +
    for ($j = 0; $j < 10; $j++)
    +$str
    +$buffer
    +$group_id
    +$last_city
    +
    +
    +
    +
    +

    Commenting

    +

    In general, code should be commented prolifically. It not only helps +describe the flow and intent of the code for less experienced +programmers, but can prove invaluable when returning to your own code +months down the line. There is not a required format for comments, but +the following are recommended.

    +

    DocBlock +style comments preceding class, method, and property declarations so they can be +picked up by IDEs:

    +
    /**
    + * Super Class
    + *
    + * @package     Package Name
    + * @subpackage  Subpackage
    + * @category    Category
    + * @author      Author Name
    + * @link        http://example.com
    + */
    +class Super_class {
    +
    +
    +
    /**
    + * Encodes string for use in XML
    + *
    + * @param       string  $str    Input string
    + * @return      string
    + */
    +function xml_encode($str)
    +
    +
    +
    /**
    + * Data for class manipulation
    + *
    + * @var array
    + */
    +public $data = array();
    +
    +
    +

    Use single line comments within code, leaving a blank line between large +comment blocks and code.

    +
    // break up the string by newlines
    +$parts = explode("\n", $str);
    +
    +// A longer comment that needs to give greater detail on what is
    +// occurring and why can use multiple single-line comments.  Try to
    +// keep the width reasonable, around 70 characters is the easiest to
    +// read.  Don't hesitate to link to permanent external resources
    +// that may provide greater detail:
    +//
    +// http://example.com/information_about_something/in_particular/
    +
    +$parts = $this->foo($parts);
    +
    +
    +
    +
    +

    Constants

    +

    Constants follow the same guidelines as do variables, except constants +should always be fully uppercase. Always use CodeIgniter constants when +appropriate, i.e. SLASH, LD, RD, PATH_CACHE, etc.

    +

    INCORRECT:

    +
    myConstant      // missing underscore separator and not fully uppercase
    +N               // no single-letter constants
    +S_C_VER         // not descriptive
    +$str = str_replace('{foo}', 'bar', $str);       // should use LD and RD constants
    +
    +
    +

    CORRECT:

    +
    MY_CONSTANT
    +NEWLINE
    +SUPER_CLASS_VERSION
    +$str = str_replace(LD.'foo'.RD, 'bar', $str);
    +
    +
    +
    +
    +

    TRUE, FALSE, and NULL

    +

    TRUE, FALSE, and NULL keywords should always be fully +uppercase.

    +

    INCORRECT:

    +
    if ($foo == true)
    +$bar = false;
    +function foo($bar = null)
    +
    +
    +

    CORRECT:

    +
    if ($foo == TRUE)
    +$bar = FALSE;
    +function foo($bar = NULL)
    +
    +
    +
    +
    +

    Logical Operators

    +

    Use of the || “or” comparison operator is discouraged, as its clarity +on some output devices is low (looking like the number 11, for instance). +&& is preferred over AND but either are acceptable, and a space should +always precede and follow !.

    +

    INCORRECT:

    +
    if ($foo || $bar)
    +if ($foo AND $bar)  // okay but not recommended for common syntax highlighting applications
    +if (!$foo)
    +if (! is_array($foo))
    +
    +
    +

    CORRECT:

    +
    if ($foo OR $bar)
    +if ($foo && $bar) // recommended
    +if ( ! $foo)
    +if ( ! is_array($foo))
    +
    +
    +
    +
    +

    Comparing Return Values and Typecasting

    +

    Some PHP functions return FALSE on failure, but may also have a valid +return value of “” or 0, which would evaluate to FALSE in loose +comparisons. Be explicit by comparing the variable type when using these +return values in conditionals to ensure the return value is indeed what +you expect, and not a value that has an equivalent loose-type +evaluation.

    +

    Use the same stringency in returning and checking your own variables. +Use === and !== as necessary.

    +

    INCORRECT:

    +
    // If 'foo' is at the beginning of the string, strpos will return a 0,
    +// resulting in this conditional evaluating as TRUE
    +if (strpos($str, 'foo') == FALSE)
    +
    +
    +

    CORRECT:

    +
    if (strpos($str, 'foo') === FALSE)
    +
    +
    +

    INCORRECT:

    +
    function build_string($str = "")
    +{
    +        if ($str == "") // uh-oh!  What if FALSE or the integer 0 is passed as an argument?
    +        {
    +
    +        }
    +}
    +
    +
    +

    CORRECT:

    +
    function build_string($str = "")
    +{
    +        if ($str === "")
    +        {
    +
    +        }
    +}
    +
    +
    +

    See also information regarding typecasting, +which can be quite useful. Typecasting has a slightly different effect +which may be desirable. When casting a variable as a string, for +instance, NULL and boolean FALSE variables become empty strings, 0 (and +other numbers) become strings of digits, and boolean TRUE becomes “1”:

    +
    $str = (string) $str; // cast $str as a string
    +
    +
    +
    +
    +

    Debugging Code

    +

    Do not leave debugging code in your submissions, even when commented out. +Things such as var_dump(), print_r(), die()/exit() should not be included +in your code unless it serves a specific purpose other than debugging.

    +
    +
    +

    Whitespace in Files

    +

    No whitespace can precede the opening PHP tag or follow the closing PHP +tag. Output is buffered, so whitespace in your files can cause output to +begin before CodeIgniter outputs its content, leading to errors and an +inability for CodeIgniter to send proper headers.

    +
    +
    +

    Compatibility

    +

    CodeIgniter recommends PHP 5.6 or newer to be used, but it should be +compatible with PHP 5.3.7. Your code must either be compatible with this +requirement, provide a suitable fallback, or be an optional feature that +dies quietly without affecting a user’s application.

    +

    Additionally, do not use PHP functions that require non-default libraries +to be installed unless your code contains an alternative method when the +function is not available.

    +
    +
    +

    One File per Class

    +

    Use separate files for each class, unless the classes are closely related. +An example of a CodeIgniter file that contains multiple classes is the +Xmlrpc library file.

    +
    +
    +

    Whitespace

    +

    Use tabs for whitespace in your code, not spaces. This may seem like a +small thing, but using tabs instead of whitespace allows the developer +looking at your code to have indentation at levels that they prefer and +customize in whatever application they use. And as a side benefit, it +results in (slightly) more compact files, storing one tab character +versus, say, four space characters.

    +
    +
    +

    Line Breaks

    +

    Files must be saved with Unix line breaks. This is more of an issue for +developers who work in Windows, but in any case ensure that your text +editor is setup to save files with Unix line breaks.

    +
    +
    +

    Code Indenting

    +

    Use Allman style indenting. With the exception of Class declarations, +braces are always placed on a line by themselves, and indented at the +same level as the control statement that “owns” them.

    +

    INCORRECT:

    +
    function foo($bar) {
    +        // ...
    +}
    +
    +foreach ($arr as $key => $val) {
    +        // ...
    +}
    +
    +if ($foo == $bar) {
    +        // ...
    +} else {
    +        // ...
    +}
    +
    +for ($i = 0; $i < 10; $i++)
    +        {
    +        for ($j = 0; $j < 10; $j++)
    +                {
    +                // ...
    +                }
    +        }
    +
    +try {
    +        // ...
    +}
    +catch() {
    +        // ...
    +}
    +
    +
    +

    CORRECT:

    +
    function foo($bar)
    +{
    +        // ...
    +}
    +
    +foreach ($arr as $key => $val)
    +{
    +        // ...
    +}
    +
    +if ($foo == $bar)
    +{
    +        // ...
    +}
    +else
    +{
    +        // ...
    +}
    +
    +for ($i = 0; $i < 10; $i++)
    +{
    +        for ($j = 0; $j < 10; $j++)
    +        {
    +                // ...
    +        }
    +}
    +
    +try
    +{
    +        // ...
    +}
    +catch()
    +{
    +        // ...
    +}
    +
    +
    +
    +
    +

    Bracket and Parenthetic Spacing

    +

    In general, parenthesis and brackets should not use any additional +spaces. The exception is that a space should always follow PHP control +structures that accept arguments with parenthesis (declare, do-while, +elseif, for, foreach, if, switch, while), to help distinguish them from +functions and increase readability.

    +

    INCORRECT:

    +
    $arr[ $foo ] = 'foo';
    +
    +
    +

    CORRECT:

    +
    $arr[$foo] = 'foo'; // no spaces around array keys
    +
    +
    +

    INCORRECT:

    +
    function foo ( $bar )
    +{
    +
    +}
    +
    +
    +

    CORRECT:

    +
    function foo($bar) // no spaces around parenthesis in function declarations
    +{
    +
    +}
    +
    +
    +

    INCORRECT:

    +
    foreach( $query->result() as $row )
    +
    +
    +

    CORRECT:

    +
    foreach ($query->result() as $row) // single space following PHP control structures, but not in interior parenthesis
    +
    +
    +
    +
    +

    Localized Text

    +

    CodeIgniter libraries should take advantage of corresponding language files +whenever possible.

    +

    INCORRECT:

    +
    return "Invalid Selection";
    +
    +
    +

    CORRECT:

    +
    return $this->lang->line('invalid_selection');
    +
    +
    +
    +
    +

    Private Methods and Variables

    +

    Methods and variables that are only accessed internally, +such as utility and helper functions that your public methods use for +code abstraction, should be prefixed with an underscore.

    +
    public function convert_text()
    +private function _convert_text()
    +
    +
    +
    +
    +

    PHP Errors

    +

    Code must run error free and not rely on warnings and notices to be +hidden to meet this requirement. For instance, never access a variable +that you did not set yourself (such as $_POST array keys) without first +checking to see that it isset().

    +

    Make sure that your dev environment has error reporting enabled +for ALL users, and that display_errors is enabled in the PHP +environment. You can check this setting with:

    +
    if (ini_get('display_errors') == 1)
    +{
    +        exit "Enabled";
    +}
    +
    +
    +

    On some servers where display_errors is disabled, and you do not have +the ability to change this in the php.ini, you can often enable it with:

    +
    ini_set('display_errors', 1);
    +
    +
    +
    +

    Note

    +

    Setting the display_errors +setting with ini_set() at runtime is not identical to having +it enabled in the PHP environment. Namely, it will not have any +effect if the script has fatal errors.

    +
    +
    +
    +

    Short Open Tags

    +

    Always use full PHP opening tags, in case a server does not have +short_open_tag enabled.

    +

    INCORRECT:

    +
    <? echo $foo; ?>
    +
    +<?=$foo?>
    +
    +
    +

    CORRECT:

    +
    <?php echo $foo; ?>
    +
    +
    +
    +

    Note

    +

    PHP 5.4 will always have the <?= tag available.

    +
    +
    +
    +

    One Statement Per Line

    +

    Never combine statements on one line.

    +

    INCORRECT:

    +
    $foo = 'this'; $bar = 'that'; $bat = str_replace($foo, $bar, $bag);
    +
    +
    +

    CORRECT:

    +
    $foo = 'this';
    +$bar = 'that';
    +$bat = str_replace($foo, $bar, $bag);
    +
    +
    +
    +
    +

    Strings

    +

    Always use single quoted strings unless you need variables parsed, and +in cases where you do need variables parsed, use braces to prevent +greedy token parsing. You may also use double-quoted strings if the +string contains single quotes, so you do not have to use escape +characters.

    +

    INCORRECT:

    +
    "My String"                                     // no variable parsing, so no use for double quotes
    +"My string $foo"                                // needs braces
    +'SELECT foo FROM bar WHERE baz = \'bag\''       // ugly
    +
    +
    +

    CORRECT:

    +
    'My String'
    +"My string {$foo}"
    +"SELECT foo FROM bar WHERE baz = 'bag'"
    +
    +
    +
    +
    +

    SQL Queries

    +

    SQL keywords are always capitalized: SELECT, INSERT, UPDATE, WHERE, +AS, JOIN, ON, IN, etc.

    +

    Break up long queries into multiple lines for legibility, preferably +breaking for each clause.

    +

    INCORRECT:

    +
    // keywords are lowercase and query is too long for
    +// a single line (... indicates continuation of line)
    +$query = $this->db->query("select foo, bar, baz, foofoo, foobar as raboof, foobaz from exp_pre_email_addresses
    +...where foo != 'oof' and baz != 'zab' order by foobaz limit 5, 100");
    +
    +
    +

    CORRECT:

    +
    $query = $this->db->query("SELECT foo, bar, baz, foofoo, foobar AS raboof, foobaz
    +                                FROM exp_pre_email_addresses
    +                                WHERE foo != 'oof'
    +                                AND baz != 'zab'
    +                                ORDER BY foobaz
    +                                LIMIT 5, 100");
    +
    +
    +
    +
    +

    Default Function Arguments

    +

    Whenever appropriate, provide function argument defaults, which helps +prevent PHP errors with mistaken calls and provides common fallback +values which can save a few lines of code. Example:

    +
    function foo($bar = '', $baz = FALSE)
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/urls.html b/user_guide/general/urls.html new file mode 100755 index 0000000..727f8cc --- /dev/null +++ b/user_guide/general/urls.html @@ -0,0 +1,599 @@ + + + + + + + + + + CodeIgniter URLs — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    CodeIgniter URLs

    +

    By default, URLs in CodeIgniter are designed to be search-engine and +human friendly. Rather than using the standard “query string” approach +to URLs that is synonymous with dynamic systems, CodeIgniter uses a +segment-based approach:

    +
    example.com/news/article/my_article
    +
    +
    +
    +

    Note

    +

    Query string URLs can be optionally enabled, as described +below.

    +
    +
    +

    URI Segments

    +

    The segments in the URL, in following with the Model-View-Controller +approach, usually represent:

    +
    example.com/class/function/ID
    +
    +
    +
      +
    1. The first segment represents the controller class that should be +invoked.
    2. +
    3. The second segment represents the class function, or method, that +should be called.
    4. +
    5. The third, and any additional segments, represent the ID and any +variables that will be passed to the controller.
    6. +
    +

    The URI Library and the URL Helper contain functions that make it easy to work +with your URI data. In addition, your URLs can be remapped using the +URI Routing feature for more flexibility.

    +
    +
    +

    Removing the index.php file

    +

    By default, the index.php file will be included in your URLs:

    +
    example.com/index.php/news/article/my_article
    +
    +
    +

    If your Apache server has mod_rewrite enabled, you can easily remove this +file by using a .htaccess file with some simple rules. Here is an example +of such a file, using the “negative” method in which everything is redirected +except the specified items:

    +
    .. code-block:: console
    +
    +
    +
    +
    RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ index.php/$1 [L]
    +

    In the above example, any HTTP request other than those for existing +directories and existing files is treated as a request for your index.php file.

    +
    +

    Note

    +

    These specific rules might not work for all server configurations.

    +
    +
    +

    Note

    +

    Make sure to also exclude from the above rule any assets that you +might need to be accessible from the outside world.

    +
    +
    +
    +

    Adding a URL Suffix

    +

    In your config/config.php file you can specify a suffix that will be +added to all URLs generated by CodeIgniter. For example, if a URL is +this:

    +
    example.com/index.php/products/view/shoes
    +
    +
    +

    You can optionally add a suffix, like .html, making the page appear to +be of a certain type:

    +
    example.com/index.php/products/view/shoes.html
    +
    +
    +
    +
    +

    Enabling Query Strings

    +

    In some cases you might prefer to use query strings URLs:

    +
    index.php?c=products&m=view&id=345
    +
    +
    +

    CodeIgniter optionally supports this capability, which can be enabled in +your application/config.php file. If you open your config file you’ll +see these items:

    +
    $config['enable_query_strings'] = FALSE;
    +$config['controller_trigger'] = 'c';
    +$config['function_trigger'] = 'm';
    +
    +
    +

    If you change “enable_query_strings” to TRUE this feature will become +active. Your controllers and functions will then be accessible using the +“trigger” words you’ve set to invoke your controllers and methods:

    +
    index.php?c=controller&m=method
    +
    +
    +
    +

    Note

    +

    If you are using query strings you will have to build your own +URLs, rather than utilizing the URL helpers (and other helpers +that generate URLs, like some of the form helpers) as these are +designed to work with segment based URLs.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/views.html b/user_guide/general/views.html new file mode 100755 index 0000000..79c442a --- /dev/null +++ b/user_guide/general/views.html @@ -0,0 +1,704 @@ + + + + + + + + + + Views — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Views

    +

    A view is simply a web page, or a page fragment, like a header, footer, +sidebar, etc. In fact, views can flexibly be embedded within other views +(within other views, etc., etc.) if you need this type of hierarchy.

    +

    Views are never called directly, they must be loaded by a +controller. Remember that in an MVC framework, the +Controller acts as the traffic cop, so it is responsible for fetching a +particular view. If you have not read the +Controllers page you should do so before +continuing.

    +

    Using the example controller you created in the +controller page, let’s add a view to it.

    +
    +

    Creating a View

    +

    Using your text editor, create a file called blogview.php, and put this +in it:

    +
    <html>
    +<head>
    +        <title>My Blog</title>
    +</head>
    +<body>
    +        <h1>Welcome to my Blog!</h1>
    +</body>
    +</html>
    +
    +
    +

    Then save the file in your application/views/ directory.

    +
    +
    +

    Loading a View

    +

    To load a particular view file you will use the following method:

    +
    $this->load->view('name');
    +
    +
    +

    Where name is the name of your view file.

    +
    +

    Note

    +

    The .php file extension does not need to be specified +unless you use something other than .php.

    +
    +

    Now, open the controller file you made earlier called Blog.php, and +replace the echo statement with the view loading method:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->view('blogview');
    +        }
    +}
    +
    +
    +

    If you visit your site using the URL you did earlier you should see your +new view. The URL was similar to this:

    +
    example.com/index.php/blog/
    +
    +
    +
    +
    +

    Loading multiple views

    +

    CodeIgniter will intelligently handle multiple calls to +$this->load->view() from within a controller. If more than one call +happens they will be appended together. For example, you may wish to +have a header view, a menu view, a content view, and a footer view. That +might look something like this:

    +
    <?php
    +
    +class Page extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $data['page_title'] = 'Your title';
    +                $this->load->view('header');
    +                $this->load->view('menu');
    +                $this->load->view('content', $data);
    +                $this->load->view('footer');
    +        }
    +
    +}
    +
    +
    +

    In the example above, we are using “dynamically added data”, which you +will see below.

    +
    +
    +

    Storing Views within Sub-directories

    +

    Your view files can also be stored within sub-directories if you prefer +that type of organization. When doing so you will need to include the +directory name loading the view. Example:

    +
    $this->load->view('directory_name/file_name');
    +
    +
    +
    +
    +

    Adding Dynamic Data to the View

    +

    Data is passed from the controller to the view by way of an array or +an object in the second parameter of the view loading method. Here +is an example using an array:

    +
    $data = array(
    +        'title' => 'My Title',
    +        'heading' => 'My Heading',
    +        'message' => 'My Message'
    +);
    +
    +$this->load->view('blogview', $data);
    +
    +
    +

    And here’s an example using an object:

    +
    $data = new Someclass();
    +$this->load->view('blogview', $data);
    +
    +
    +
    +

    Note

    +

    If you use an object, the class variables will be turned +into array elements.

    +
    +

    Let’s try it with your controller file. Open it add this code:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $data['title'] = "My Real Title";
    +                $data['heading'] = "My Real Heading";
    +
    +                $this->load->view('blogview', $data);
    +        }
    +}
    +
    +
    +

    Now open your view file and change the text to variables that correspond +to the array keys in your data:

    +
    <html>
    +<head>
    +        <title><?php echo $title;?></title>
    +</head>
    +<body>
    +        <h1><?php echo $heading;?></h1>
    +</body>
    +</html>
    +
    +
    +

    Then load the page at the URL you’ve been using and you should see the +variables replaced.

    +
    +
    +

    Creating Loops

    +

    The data array you pass to your view files is not limited to simple +variables. You can pass multi dimensional arrays, which can be looped to +generate multiple rows. For example, if you pull data from your database +it will typically be in the form of a multi-dimensional array.

    +

    Here’s a simple example. Add this to your controller:

    +
    <?php
    +class Blog extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $data['todo_list'] = array('Clean House', 'Call Mom', 'Run Errands');
    +
    +                $data['title'] = "My Real Title";
    +                $data['heading'] = "My Real Heading";
    +
    +                $this->load->view('blogview', $data);
    +        }
    +}
    +
    +
    +

    Now open your view file and create a loop:

    +
    <html>
    +<head>
    +        <title><?php echo $title;?></title>
    +</head>
    +<body>
    +        <h1><?php echo $heading;?></h1>
    +
    +        <h3>My Todo List</h3>
    +
    +        <ul>
    +        <?php foreach ($todo_list as $item):?>
    +
    +                <li><?php echo $item;?></li>
    +
    +        <?php endforeach;?>
    +        </ul>
    +
    +</body>
    +</html>
    +
    +
    +
    +

    Note

    +

    You’ll notice that in the example above we are using PHP’s +alternative syntax. If you are not familiar with it you can read about +it here.

    +
    +
    +
    +

    Returning views as data

    +

    There is a third optional parameter lets you change the behavior of +the method so that it returns data as a string rather than sending it +to your browser. This can be useful if you want to process the data in +some way. If you set the parameter to TRUE (boolean) it will return +data. The default behavior is false, which sends it to your browser. +Remember to assign it to a variable if you want the data returned:

    +
    $string = $this->load->view('myfile', '', TRUE);
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/general/welcome.html b/user_guide/general/welcome.html new file mode 100755 index 0000000..2bd4351 --- /dev/null +++ b/user_guide/general/welcome.html @@ -0,0 +1,520 @@ + + + + + + + + + + Welcome to CodeIgniter — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Welcome to CodeIgniter
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Welcome to CodeIgniter

    +

    CodeIgniter is an Application Development Framework - a toolkit - for +people who build web sites using PHP. Its goal is to enable you to +develop projects much faster than you could if you were writing code +from scratch, by providing a rich set of libraries for commonly needed +tasks, as well as a simple interface and logical structure to access +these libraries. CodeIgniter lets you creatively focus on your project +by minimizing the amount of code needed for a given task.

    +
    +

    Who is CodeIgniter For?

    +

    CodeIgniter is right for you if:

    +
      +
    • You want a framework with a small footprint.
    • +
    • You need exceptional performance.
    • +
    • You need broad compatibility with standard hosting accounts that run +a variety of PHP versions and configurations.
    • +
    • You want a framework that requires nearly zero configuration.
    • +
    • You want a framework that does not require you to use the command +line.
    • +
    • You want a framework that does not require you to adhere to +restrictive coding rules.
    • +
    • You are not interested in large-scale monolithic libraries like PEAR.
    • +
    • You do not want to be forced to learn a templating language (although +a template parser is optionally available if you desire one).
    • +
    • You eschew complexity, favoring simple solutions.
    • +
    • You need clear, thorough documentation.
    • +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/genindex.html b/user_guide/genindex.html new file mode 100755 index 0000000..5d07cfc --- /dev/null +++ b/user_guide/genindex.html @@ -0,0 +1,1935 @@ + + + + + + + + + + + Index — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + + +

    Index

    + +
    + _ + | A + | B + | C + | D + | E + | F + | G + | H + | I + | J + | K + | L + | M + | N + | O + | P + | Q + | R + | S + | T + | U + | V + | W + | X + +
    +

    _

    + + + +
    + +

    A

    + + + +
    + +

    B

    + + + +
    + +

    C

    + + + +
    + +

    D

    + + + +
    + +

    E

    + + + +
    + +

    F

    + + + +
    + +

    G

    + + + +
    + +

    H

    + + + +
    + +

    I

    + + + +
    + +

    J

    + + +
    + +

    K

    + + +
    + +

    L

    + + + +
    + +

    M

    + + + +
    + +

    N

    + + + +
    + +

    O

    + + + +
    + +

    P

    + + + +
    + +

    Q

    + + + +
    + +

    R

    + + + +
    + +

    S

    + + + +
    + +

    T

    + + + +
    + +

    U

    + + + +
    + +

    V

    + + + +
    + +

    W

    + + + +
    + +

    X

    + + + +
    + + + +
    +
    + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/array_helper.html b/user_guide/helpers/array_helper.html new file mode 100755 index 0000000..c44a9d8 --- /dev/null +++ b/user_guide/helpers/array_helper.html @@ -0,0 +1,660 @@ + + + + + + + + + + Array Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Array Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Array Helper

    +

    The Array Helper file contains functions that assist in working with +arrays.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('array');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +element($item, $array[, $default = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – Item to fetch from the array
    • +
    • $array (array) – Input array
    • +
    • $default (bool) – What to return if the array isn’t valid
    • +
    +
    Returns:

    NULL on failure or the array item.

    +
    Return type:

    mixed

    +
    +

    Lets you fetch an item from an array. The function tests whether the +array index is set and whether it has a value. If a value exists it is +returned. If a value does not exist it returns NULL, or whatever you’ve +specified as the default value via the third parameter.

    +

    Example:

    +
    $array = array(
    +        'color' => 'red',
    +        'shape' => 'round',
    +        'size'  => ''
    +);
    +
    +echo element('color', $array); // returns "red"
    +echo element('size', $array, 'foobar'); // returns "foobar"
    +
    +
    +
    + +
    +
    +elements($items, $array[, $default = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – Item to fetch from the array
    • +
    • $array (array) – Input array
    • +
    • $default (bool) – What to return if the array isn’t valid
    • +
    +
    Returns:

    NULL on failure or the array item.

    +
    Return type:

    mixed

    +
    +

    Lets you fetch a number of items from an array. The function tests +whether each of the array indices is set. If an index does not exist it +is set to NULL, or whatever you’ve specified as the default value via +the third parameter.

    +

    Example:

    +
    $array = array(
    +        'color' => 'red',
    +        'shape' => 'round',
    +        'radius' => '10',
    +        'diameter' => '20'
    +);
    +
    +$my_shape = elements(array('color', 'shape', 'height'), $array);
    +
    +
    +

    The above will return the following array:

    +
    array(
    +        'color' => 'red',
    +        'shape' => 'round',
    +        'height' => NULL
    +);
    +
    +
    +

    You can set the third parameter to any default value you like.

    +
    $my_shape = elements(array('color', 'shape', 'height'), $array, 'foobar');
    +
    +
    +

    The above will return the following array:

    +
    array(
    +        'color'         => 'red',
    +        'shape'         => 'round',
    +        'height'        => 'foobar'
    +);
    +
    +
    +

    This is useful when sending the $_POST array to one of your Models. +This prevents users from sending additional POST data to be entered into +your tables.

    +
    $this->load->model('post_model');
    +$this->post_model->update(
    +        elements(array('id', 'title', 'content'), $_POST)
    +);
    +
    +
    +

    This ensures that only the id, title and content fields are sent to be +updated.

    +
    + +
    +
    +random_element($array)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $array (array) – Input array
    • +
    +
    Returns:

    A random element from the array

    +
    Return type:

    mixed

    +
    +

    Takes an array as input and returns a random element from it.

    +

    Usage example:

    +
    $quotes = array(
    +        "I find that the harder I work, the more luck I seem to have. - Thomas Jefferson",
    +        "Don't stay in bed, unless you can make money in bed. - George Burns",
    +        "We didn't lose the game; we just ran out of time. - Vince Lombardi",
    +        "If everything seems under control, you're not going fast enough. - Mario Andretti",
    +        "Reality is merely an illusion, albeit a very persistent one. - Albert Einstein",
    +        "Chance favors the prepared mind - Louis Pasteur"
    +);
    +
    +echo random_element($quotes);
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html new file mode 100755 index 0000000..f07e59a --- /dev/null +++ b/user_guide/helpers/captcha_helper.html @@ -0,0 +1,670 @@ + + + + + + + + + + CAPTCHA Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • CAPTCHA Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    CAPTCHA Helper

    +

    The CAPTCHA Helper file contains functions that assist in creating +CAPTCHA images.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('captcha');
    +
    +
    +
    +
    +

    Using the CAPTCHA helper

    +

    Once loaded you can generate a CAPTCHA like this:

    +
    $vals = array(
    +        'word'          => 'Random word',
    +        'img_path'      => './captcha/',
    +        'img_url'       => 'http://example.com/captcha/',
    +        'font_path'     => './path/to/fonts/texb.ttf',
    +        'img_width'     => '150',
    +        'img_height'    => 30,
    +        'expiration'    => 7200,
    +        'word_length'   => 8,
    +        'font_size'     => 16,
    +        'img_id'        => 'Imageid',
    +        'pool'          => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
    +
    +        // White background and border, black text and red grid
    +        'colors'        => array(
    +                'background' => array(255, 255, 255),
    +                'border' => array(255, 255, 255),
    +                'text' => array(0, 0, 0),
    +                'grid' => array(255, 40, 40)
    +        )
    +);
    +
    +$cap = create_captcha($vals);
    +echo $cap['image'];
    +
    +
    +
      +
    • The captcha function requires the GD image library.
    • +
    • Only the img_path and img_url are required.
    • +
    • If a word is not supplied, the function will generate a random +ASCII string. You might put together your own word library that you +can draw randomly from.
    • +
    • If you do not specify a path to a TRUE TYPE font, the native ugly GD +font will be used.
    • +
    • The “captcha” directory must be writable
    • +
    • The expiration (in seconds) signifies how long an image will remain +in the captcha folder before it will be deleted. The default is two +hours.
    • +
    • word_length defaults to 8, pool defaults to ‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’
    • +
    • font_size defaults to 16, the native GD font has a size limit. Specify a “true type” font for bigger sizes.
    • +
    • The img_id will be set as the “id” of the captcha image.
    • +
    • If any of the colors values is missing, it will be replaced by the default.
    • +
    +
    +

    Adding a Database

    +

    In order for the captcha function to prevent someone from submitting, +you will need to add the information returned from create_captcha() +to your database. Then, when the data from the form is submitted by +the user you will need to verify that the data exists in the database +and has not expired.

    +

    Here is a table prototype:

    +
    CREATE TABLE captcha (
    +        captcha_id bigint(13) unsigned NOT NULL auto_increment,
    +        captcha_time int(10) unsigned NOT NULL,
    +        ip_address varchar(45) NOT NULL,
    +        word varchar(20) NOT NULL,
    +        PRIMARY KEY `captcha_id` (`captcha_id`),
    +        KEY `word` (`word`)
    +);
    +
    +
    +

    Here is an example of usage with a database. On the page where the +CAPTCHA will be shown you’ll have something like this:

    +
    $this->load->helper('captcha');
    +$vals = array(
    +        'img_path'      => './captcha/',
    +        'img_url'       => 'http://example.com/captcha/'
    +);
    +
    +$cap = create_captcha($vals);
    +$data = array(
    +        'captcha_time'  => $cap['time'],
    +        'ip_address'    => $this->input->ip_address(),
    +        'word'          => $cap['word']
    +);
    +
    +$query = $this->db->insert_string('captcha', $data);
    +$this->db->query($query);
    +
    +echo 'Submit the word you see below:';
    +echo $cap['image'];
    +echo '<input type="text" name="captcha" value="" />';
    +
    +
    +

    Then, on the page that accepts the submission you’ll have something like +this:

    +
    // First, delete old captchas
    +$expiration = time() - 7200; // Two hour limit
    +$this->db->where('captcha_time < ', $expiration)
    +        ->delete('captcha');
    +
    +// Then see if a captcha exists:
    +$sql = 'SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?';
    +$binds = array($_POST['captcha'], $this->input->ip_address(), $expiration);
    +$query = $this->db->query($sql, $binds);
    +$row = $query->row();
    +
    +if ($row->count == 0)
    +{
    +        echo 'You must submit the word that appears in the image.';
    +}
    +
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Array of data for the CAPTCHA
    • +
    • $img_path (string) – Path to create the image in
    • +
    • $img_url (string) – URL to the CAPTCHA image folder
    • +
    • $font_path (string) – Server path to font
    • +
    +
    Returns:

    array(‘word’ => $word, ‘time’ => $now, ‘image’ => $img)

    +
    Return type:

    array

    +
    +

    Takes an array of information to generate the CAPTCHA as input and +creates the image to your specifications, returning an array of +associative data about the image.

    +
    array(
    +        'image' => IMAGE TAG
    +        'time'  => TIMESTAMP (in microtime)
    +        'word'  => CAPTCHA WORD
    +)
    +
    +
    +

    The image is the actual image tag:

    +
    <img src="http://example.com/captcha/12345.jpg" width="140" height="50" />
    +
    +
    +

    The time is the micro timestamp used as the image name without the +file extension. It will be a number like this: 1139612155.3422

    +

    The word is the word that appears in the captcha image, which if not +supplied to the function, will be a random string.

    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/cookie_helper.html b/user_guide/helpers/cookie_helper.html new file mode 100755 index 0000000..7dea3b4 --- /dev/null +++ b/user_guide/helpers/cookie_helper.html @@ -0,0 +1,608 @@ + + + + + + + + + + Cookie Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Cookie Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + + + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html new file mode 100755 index 0000000..fbe45f1 --- /dev/null +++ b/user_guide/helpers/date_helper.html @@ -0,0 +1,1256 @@ + + + + + + + + + + Date Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Date Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Date Helper

    +

    The Date Helper file contains functions that help you work with dates.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('date');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +now([$timezone = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $timezone (string) – Timezone
    • +
    +
    Returns:

    UNIX timestamp

    +
    Return type:

    int

    +
    +

    Returns the current time as a UNIX timestamp, referenced either to your server’s +local time or any PHP supported timezone, based on the “time reference” setting +in your config file. If you do not intend to set your master time reference to +any other PHP supported timezone (which you’ll typically do if you run a site +that lets each user set their own timezone settings) there is no benefit to using +this function over PHP’s time() function.

    +
    echo now('Australia/Victoria');
    +
    +
    +

    If a timezone is not provided, it will return time() based on the +time_reference setting.

    +
    + +
    +
    +mdate([$datestr = ''[, $time = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $datestr (string) – Date string
    • +
    • $time (int) – UNIX timestamp
    • +
    +
    Returns:

    MySQL-formatted date

    +
    Return type:

    string

    +
    +

    This function is identical to PHP’s date() +function, except that it lets you use MySQL style date codes, where each +code letter is preceded with a percent sign, e.g. %Y %m %d

    +

    The benefit of doing dates this way is that you don’t have to worry +about escaping any characters that are not date codes, as you would +normally have to do with the date() function.

    +

    Example:

    +
    $datestring = 'Year: %Y Month: %m Day: %d - %h:%i %a';
    +$time = time();
    +echo mdate($datestring, $time);
    +
    +
    +

    If a timestamp is not included in the second parameter the current time +will be used.

    +
    + +
    +
    +standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $fmt (string) – Date format
    • +
    • $time (int) – UNIX timestamp
    • +
    +
    Returns:

    Formatted date or FALSE on invalid format

    +
    Return type:

    string

    +
    +

    Lets you generate a date string in one of several standardized formats.

    +

    Example:

    +
    $format = 'DATE_RFC822';
    +$time = time();
    +echo standard_date($format, $time);
    +
    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native date() combined with +DateTime’s format constants +instead:

    +
    echo date(DATE_RFC822, time());
    +
    +
    +
    +

    Supported formats:

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ConstantDescriptionExample
    DATE_ATOMAtom2005-08-15T16:13:03+0000
    DATE_COOKIEHTTP CookiesSun, 14 Aug 2005 16:13:03 UTC
    DATE_ISO8601ISO-86012005-08-14T16:13:03+00:00
    DATE_RFC822RFC 822Sun, 14 Aug 05 16:13:03 UTC
    DATE_RFC850RFC 850Sunday, 14-Aug-05 16:13:03 UTC
    DATE_RFC1036RFC 1036Sunday, 14-Aug-05 16:13:03 UTC
    DATE_RFC1123RFC 1123Sun, 14 Aug 2005 16:13:03 UTC
    DATE_RFC2822RFC 2822Sun, 14 Aug 2005 16:13:03 +0000
    DATE_RSSRSSSun, 14 Aug 2005 16:13:03 UTC
    DATE_W3CW3C2005-08-14T16:13:03+0000
    +
    + +
    +
    +local_to_gmt([$time = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $time (int) – UNIX timestamp
    • +
    +
    Returns:

    UNIX timestamp

    +
    Return type:

    int

    +
    +

    Takes a UNIX timestamp as input and returns it as GMT.

    +

    Example:

    +
    $gmt = local_to_gmt(time());
    +
    +
    +
    + +
    +
    +gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $time (int) – UNIX timestamp
    • +
    • $timezone (string) – Timezone
    • +
    • $dst (bool) – Whether DST is active
    • +
    +
    Returns:

    UNIX timestamp

    +
    Return type:

    int

    +
    +

    Takes a UNIX timestamp (referenced to GMT) as input, and converts it to +a localized timestamp based on the timezone and Daylight Saving Time +submitted.

    +

    Example:

    +
    $timestamp = 1140153693;
    +$timezone  = 'UM8';
    +$daylight_saving = TRUE;
    +echo gmt_to_local($timestamp, $timezone, $daylight_saving);
    +
    +
    +
    +

    Note

    +

    For a list of timezones see the reference at the bottom of this page.

    +
    +
    + +
    +
    +mysql_to_unix([$time = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $time (string) – MySQL timestamp
    • +
    +
    Returns:

    UNIX timestamp

    +
    Return type:

    int

    +
    +

    Takes a MySQL Timestamp as input and returns it as a UNIX timestamp.

    +

    Example:

    +
    $unix = mysql_to_unix('20061124092345');
    +
    +
    +
    + +
    +
    +unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $time (int) – UNIX timestamp
    • +
    • $seconds (bool) – Whether to show seconds
    • +
    • $fmt (string) – format (us or euro)
    • +
    +
    Returns:

    Formatted date

    +
    Return type:

    string

    +
    +

    Takes a UNIX timestamp as input and returns it in a human readable +format with this prototype:

    +
    YYYY-MM-DD HH:MM:SS AM/PM
    +
    +
    +

    This can be useful if you need to display a date in a form field for +submission.

    +

    The time can be formatted with or without seconds, and it can be set to +European or US format. If only the timestamp is submitted it will return +the time without seconds formatted for the U.S.

    +

    Examples:

    +
    $now = time();
    +echo unix_to_human($now); // U.S. time, no seconds
    +echo unix_to_human($now, TRUE, 'us'); // U.S. time with seconds
    +echo unix_to_human($now, TRUE, 'eu'); // Euro time with seconds
    +
    +
    +
    + +
    +
    +human_to_unix([$datestr = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $datestr (int) – Date string
    • +
    +
    Returns:

    UNIX timestamp or FALSE on failure

    +
    Return type:

    int

    +
    +

    The opposite of the unix_to_time() function. Takes a “human” +time as input and returns it as a UNIX timestamp. This is useful if you +accept “human” formatted dates submitted via a form. Returns boolean FALSE +date string passed to it is not formatted as indicated above.

    +

    Example:

    +
    $now = time();
    +$human = unix_to_human($now);
    +$unix = human_to_unix($human);
    +
    +
    +
    + +
    +
    +nice_date([$bad_date = ''[, $format = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $bad_date (int) – The terribly formatted date-like string
    • +
    • $format (string) – Date format to return (same as PHP’s date() function)
    • +
    +
    Returns:

    Formatted date

    +
    Return type:

    string

    +
    +

    This function can take a number poorly-formed date formats and convert +them into something useful. It also accepts well-formed dates.

    +

    The function will return a UNIX timestamp by default. You can, optionally, +pass a format string (the same type as the PHP date() function accepts) +as the second parameter.

    +

    Example:

    +
    $bad_date = '199605';
    +// Should Produce: 1996-05-01
    +$better_date = nice_date($bad_date, 'Y-m-d');
    +
    +$bad_date = '9-11-2001';
    +// Should Produce: 2001-09-11
    +$better_date = nice_date($bad_date, 'Y-m-d');
    +
    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use PHP’s native DateTime class instead.

    +
    +
    + +
    +
    +timespan([$seconds = 1[, $time = ''[, $units = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $seconds (int) – Number of seconds
    • +
    • $time (string) – UNIX timestamp
    • +
    • $units (int) – Number of time units to display
    • +
    +
    Returns:

    Formatted time difference

    +
    Return type:

    string

    +
    +

    Formats a UNIX timestamp so that is appears similar to this:

    +
    1 Year, 10 Months, 2 Weeks, 5 Days, 10 Hours, 16 Minutes
    +
    +
    +

    The first parameter must contain a UNIX timestamp. +The second parameter must contain a timestamp that is greater that the +first timestamp. +The thirdparameter is optional and limits the number of time units to display.

    +

    If the second parameter empty, the current time will be used.

    +

    The most common purpose for this function is to show how much time has +elapsed from some point in time in the past to now.

    +

    Example:

    +
    $post_date = '1079621429';
    +$now = time();
    +$units = 2;
    +echo timespan($post_date, $now, $units);
    +
    +
    +
    +

    Note

    +

    The text generated by this function is found in the following language +file: language/<your_lang>/date_lang.php

    +
    +
    + +
    +
    +days_in_month([$month = 0[, $year = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $month (int) – a numeric month
    • +
    • $year (int) – a numeric year
    • +
    +
    Returns:

    Count of days in the specified month

    +
    Return type:

    int

    +
    +

    Returns the number of days in a given month/year. Takes leap years into +account.

    +

    Example:

    +
    echo days_in_month(06, 2005);
    +
    +
    +

    If the second parameter is empty, the current year will be used.

    +
    +

    Note

    +

    This function will alias the native cal_days_in_month(), if +it is available.

    +
    +
    + +
    +
    +date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $unix_start (int) – UNIX timestamp of the range start date
    • +
    • $mixed (int) – UNIX timestamp of the range end date or interval in days
    • +
    • $is_unix (bool) – set to FALSE if $mixed is not a timestamp
    • +
    • $format (string) – Output date format, same as in date()
    • +
    +
    Returns:

    An array of dates

    +
    Return type:

    array

    +
    +

    Returns a list of dates within a specified period.

    +

    Example:

    +
    $range = date_range('2012-01-01', '2012-01-15');
    +echo "First 15 days of 2012:";
    +foreach ($range as $date)
    +{
    +        echo $date."\n";
    +}
    +
    +
    +
    + +
    +
    +timezones([$tz = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $tz (string) – A numeric timezone
    • +
    +
    Returns:

    Hour difference from UTC

    +
    Return type:

    int

    +
    +

    Takes a timezone reference (for a list of valid timezones, see the +“Timezone Reference” below) and returns the number of hours offset from +UTC.

    +

    Example:

    +
    echo timezones('UM5');
    +
    +
    +

    This function is useful when used with timezone_menu().

    +
    + +
    +
    +timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $default (string) – Timezone
    • +
    • $class (string) – Class name
    • +
    • $name (string) – Menu name
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    HTML drop down menu with time zones

    +
    Return type:

    string

    +
    +

    Generates a pull-down menu of timezones, like this one:

    +
    + +

    This menu is useful if you run a membership site in which your users are +allowed to set their local timezone value.

    +

    The first parameter lets you set the “selected” state of the menu. For +example, to set Pacific time as the default you will do this:

    +
    echo timezone_menu('UM8');
    +
    +
    +

    Please see the timezone reference below to see the values of this menu.

    +

    The second parameter lets you set a CSS class name for the menu.

    +

    The fourth parameter lets you set one or more attributes on the generated select tag.

    +
    +

    Note

    +

    The text contained in the menu is found in the following +language file: language/<your_lang>/date_lang.php

    +
    +
    + +
    +
    +

    Timezone Reference

    +

    The following table indicates each timezone and its location.

    +

    Note some of the location lists have been abridged for clarity and formatting.

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Time ZoneLocation
    UM12(UTC - 12:00) Baker/Howland Island
    UM11(UTC - 11:00) Samoa Time Zone, Niue
    UM10(UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands
    UM95(UTC - 09:30) Marquesas Islands
    UM9(UTC - 09:00) Alaska Standard Time, Gambier Islands
    UM8(UTC - 08:00) Pacific Standard Time, Clipperton Island
    UM7(UTC - 07:00) Mountain Standard Time
    UM6(UTC - 06:00) Central Standard Time
    UM5(UTC - 05:00) Eastern Standard Time, Western Caribbean
    UM45(UTC - 04:30) Venezuelan Standard Time
    UM4(UTC - 04:00) Atlantic Standard Time, Eastern Caribbean
    UM35(UTC - 03:30) Newfoundland Standard Time
    UM3(UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay
    UM2(UTC - 02:00) South Georgia/South Sandwich Islands
    UM1(UTC -1:00) Azores, Cape Verde Islands
    UTC(UTC) Greenwich Mean Time, Western European Time
    UP1(UTC +1:00) Central European Time, West Africa Time
    UP2(UTC +2:00) Central Africa Time, Eastern European Time
    UP3(UTC +3:00) Moscow Time, East Africa Time
    UP35(UTC +3:30) Iran Standard Time
    UP4(UTC +4:00) Azerbaijan Standard Time, Samara Time
    UP45(UTC +4:30) Afghanistan
    UP5(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time
    UP55(UTC +5:30) Indian Standard Time, Sri Lanka Time
    UP575(UTC +5:45) Nepal Time
    UP6(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time
    UP65(UTC +6:30) Cocos Islands, Myanmar
    UP7(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam
    UP8(UTC +8:00) Australian Western Standard Time, Beijing Time
    UP875(UTC +8:45) Australian Central Western Standard Time
    UP9(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk
    UP95(UTC +9:30) Australian Central Standard Time
    UP10(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time
    UP105(UTC +10:30) Lord Howe Island
    UP11(UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu
    UP115(UTC +11:30) Norfolk Island
    UP12(UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand
    UP1275(UTC +12:45) Chatham Islands Standard Time
    UP13(UTC +13:00) Phoenix Islands Time, Tonga
    UP14(UTC +14:00) Line Islands
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/directory_helper.html b/user_guide/helpers/directory_helper.html new file mode 100755 index 0000000..e6dba2a --- /dev/null +++ b/user_guide/helpers/directory_helper.html @@ -0,0 +1,587 @@ + + + + + + + + + + Directory Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Directory Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Directory Helper

    +

    The Directory Helper file contains functions that assist in working with +directories.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('directory');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $source_dir (string) – Path to the source directory
    • +
    • $directory_depth (int) – Depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
    • +
    • $hidden (bool) – Whether to include hidden directories
    • +
    +
    Returns:

    An array of files

    +
    Return type:

    array

    +
    +

    Examples:

    +
    $map = directory_map('./mydirectory/');
    +
    +
    +
    +

    Note

    +

    Paths are almost always relative to your main index.php file.

    +
    +

    Sub-folders contained within the directory will be mapped as well. If +you wish to control the recursion depth, you can do so using the second +parameter (integer). A depth of 1 will only map the top level directory:

    +
    $map = directory_map('./mydirectory/', 1);
    +
    +
    +

    By default, hidden files will not be included in the returned array. To +override this behavior, you may set a third parameter to true (boolean):

    +
    $map = directory_map('./mydirectory/', FALSE, TRUE);
    +
    +
    +

    Each folder name will be an array index, while its contained files will +be numerically indexed. Here is an example of a typical array:

    +
    Array (
    +        [libraries] => Array
    +                (
    +                        [0] => benchmark.html
    +                        [1] => config.html
    +                        ["database/"] => Array
    +                                (
    +                                        [0] => query_builder.html
    +                                        [1] => binds.html
    +                                        [2] => configuration.html
    +                                        [3] => connecting.html
    +                                        [4] => examples.html
    +                                        [5] => fields.html
    +                                        [6] => index.html
    +                                        [7] => queries.html
    +                                )
    +                        [2] => email.html
    +                        [3] => file_uploading.html
    +                        [4] => image_lib.html
    +                        [5] => input.html
    +                        [6] => language.html
    +                        [7] => loader.html
    +                        [8] => pagination.html
    +                        [9] => uri.html
    +                )
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/download_helper.html b/user_guide/helpers/download_helper.html new file mode 100755 index 0000000..d70cb15 --- /dev/null +++ b/user_guide/helpers/download_helper.html @@ -0,0 +1,556 @@ + + + + + + + + + + Download Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Download Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Download Helper

    +

    The Download Helper lets you download data to your desktop.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('download');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]])
    +
    +++ + + + + + +
    Parameters:
      +
    • $filename (string) – Filename
    • +
    • $data (mixed) – File contents
    • +
    • $set_mime (bool) – Whether to try to send the actual MIME type
    • +
    +
    Return type:

    void

    +
    +

    Generates server headers which force data to be downloaded to your +desktop. Useful with file downloads. The first parameter is the name +you want the downloaded file to be named, the second parameter is the +file data.

    +

    If you set the second parameter to NULL and $filename is an existing, readable +file path, then its content will be read instead.

    +

    If you set the third parameter to boolean TRUE, then the actual file MIME type +(based on the filename extension) will be sent, so that if your browser has a +handler for that type - it can use it.

    +

    Example:

    +
    $data = 'Here is some text!';
    +$name = 'mytext.txt';
    +force_download($name, $data);
    +
    +
    +

    If you want to download an existing file from your server you’ll need to +do the following:

    +
    // Contents of photo.jpg will be automatically read
    +force_download('/path/to/photo.jpg', NULL);
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/email_helper.html b/user_guide/helpers/email_helper.html new file mode 100755 index 0000000..ae761d1 --- /dev/null +++ b/user_guide/helpers/email_helper.html @@ -0,0 +1,598 @@ + + + + + + + + + + Email Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Email Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Email Helper

    +

    The Email Helper provides some assistive functions for working with +Email. For a more robust email solution, see CodeIgniter’s Email +Class.

    +
    +

    Important

    +

    The Email helper is DEPRECATED and is currently +only kept for backwards compatibility.

    +
    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('email');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +valid_email($email)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $email (string) – E-mail address
    • +
    +
    Returns:

    TRUE if a valid email is supplied, FALSE otherwise

    +
    Return type:

    bool

    +
    +

    Checks if the input is a correctly formatted e-mail address. Note that is +doesn’t actually prove that the address will be able recieve mail, but +simply that it is a validly formed address.

    +

    Example:

    +
    if (valid_email('email@somesite.com'))
    +{
    +        echo 'email is valid';
    +}
    +else
    +{
    +        echo 'email is not valid';
    +}
    +
    +
    +
    +

    Note

    +

    All that this function does is to use PHP’s native filter_var():

    +
    (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
    +
    +
    +
    +
    + +
    +
    +send_email($recipient, $subject, $message)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $recipient (string) – E-mail address
    • +
    • $subject (string) – Mail subject
    • +
    • $message (string) – Message body
    • +
    +
    Returns:

    TRUE if the mail was successfully sent, FALSE in case of an error

    +
    Return type:

    bool

    +
    +

    Sends an email using PHP’s native mail() +function.

    +
    +

    Note

    +

    All that this function does is to use PHP’s native mail

    +
    mail($recipient, $subject, $message);
    +
    +
    +
    +

    For a more robust email solution, see CodeIgniter’s Email Library.

    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html new file mode 100755 index 0000000..e29168c --- /dev/null +++ b/user_guide/helpers/file_helper.html @@ -0,0 +1,829 @@ + + + + + + + + + + File Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • File Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    File Helper

    +

    The File Helper file contains functions that assist in working with files.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('file');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +read_file($file)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $file (string) – File path
    • +
    +
    Returns:

    File contents or FALSE on failure

    +
    Return type:

    string

    +
    +

    Returns the data contained in the file specified in the path.

    +

    Example:

    +
    $string = read_file('./path/to/file.php');
    +
    +
    +

    The path can be a relative or full server path. Returns FALSE (boolean) on failure.

    +
    +

    Note

    +

    The path is relative to your main site index.php file, NOT your +controller or view files. CodeIgniter uses a front controller so paths +are always relative to the main site index.

    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native file_get_contents() +instead.

    +
    +
    +

    Important

    +

    If your server is running an open_basedir restriction this +function might not work if you are trying to access a file above the +calling script.

    +
    +
    + +
    +
    +write_file($path, $data[, $mode = 'wb'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – File path
    • +
    • $data (string) – Data to write to file
    • +
    • $mode (string) – fopen() mode
    • +
    +
    Returns:

    TRUE if the write was successful, FALSE in case of an error

    +
    Return type:

    bool

    +
    +

    Writes data to the file specified in the path. If the file does not exist then the +function will create it.

    +

    Example:

    +
    $data = 'Some file data';
    +if ( ! write_file('./path/to/file.php', $data))
    +{
    +        echo 'Unable to write the file';
    +}
    +else
    +{
    +        echo 'File written!';
    +}
    +
    +
    +

    You can optionally set the write mode via the third parameter:

    +
    write_file('./path/to/file.php', $data, 'r+');
    +
    +
    +

    The default mode is ‘wb’. Please see the PHP user guide +for mode options.

    +
    +

    Note

    +

    The path is relative to your main site index.php file, NOT your +controller or view files. CodeIgniter uses a front controller so paths +are always relative to the main site index.

    +
    +
    +

    Note

    +

    This function acquires an exclusive lock on the file while writing to it.

    +
    +
    + +
    +
    +delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Directory path
    • +
    • $del_dir (bool) – Whether to also delete directories
    • +
    • $htdocs (bool) – Whether to skip deleting .htaccess and index page files
    • +
    +
    Returns:

    TRUE on success, FALSE in case of an error

    +
    Return type:

    bool

    +
    +

    Deletes ALL files contained in the supplied path.

    +

    Example:

    +
    delete_files('./path/to/directory/');
    +
    +
    +

    If the second parameter is set to TRUE, any directories contained within the supplied +root path will be deleted as well.

    +

    Example:

    +
    delete_files('./path/to/directory/', TRUE);
    +
    +
    +
    +

    Note

    +

    The files must be writable or owned by the system in order to be deleted.

    +
    +
    + +
    +
    +get_filenames($source_dir[, $include_path = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $source_dir (string) – Directory path
    • +
    • $include_path (bool) – Whether to include the path as part of the filenames
    • +
    +
    Returns:

    An array of file names

    +
    Return type:

    array

    +
    +

    Takes a server path as input and returns an array containing the names of all files +contained within it. The file path can optionally be added to the file names by setting +the second parameter to TRUE.

    +

    Example:

    +
    $controllers = get_filenames(APPPATH.'controllers/');
    +
    +
    +
    + +
    +
    +get_dir_file_info($source_dir, $top_level_only)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $source_dir (string) – Directory path
    • +
    • $top_level_only (bool) – Whether to look only at the specified directory (excluding sub-directories)
    • +
    +
    Returns:

    An array containing info on the supplied directory’s contents

    +
    Return type:

    array

    +
    +

    Reads the specified directory and builds an array containing the filenames, filesize, +dates, and permissions. Sub-folders contained within the specified path are only read +if forced by sending the second parameter to FALSE, as this can be an intensive +operation.

    +

    Example:

    +
    $models_info = get_dir_file_info(APPPATH.'models/');
    +
    +
    +
    + +
    +
    +get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $file (string) – File path
    • +
    • $returned_values (array) – What type of info to return
    • +
    +
    Returns:

    An array containing info on the specified file or FALSE on failure

    +
    Return type:

    array

    +
    +

    Given a file and path, returns (optionally) the name, path, size and date modified +information attributes for a file. Second parameter allows you to explicitly declare what +information you want returned.

    +

    Valid $returned_values options are: name, size, date, readable, writeable, +executable and fileperms.

    +
    + +
    +
    +get_mime_by_extension($filename)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filename (string) – File name
    • +
    +
    Returns:

    MIME type string or FALSE on failure

    +
    Return type:

    string

    +
    +

    Translates a filename extension into a MIME type based on config/mimes.php. +Returns FALSE if it can’t determine the type, or read the MIME config file.

    +
    $file = 'somefile.png';
    +echo $file.' is has a mime type of '.get_mime_by_extension($file);
    +
    +
    +
    +

    Note

    +

    This is not an accurate way of determining file MIME types, and +is here strictly for convenience. It should not be used for security +purposes.

    +
    +
    + +
    +
    +symbolic_permissions($perms)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $perms (int) – Permissions
    • +
    +
    Returns:

    Symbolic permissions string

    +
    Return type:

    string

    +
    +

    Takes numeric permissions (such as is returned by fileperms()) and returns +standard symbolic notation of file permissions.

    +
    echo symbolic_permissions(fileperms('./index.php'));  // -rw-r--r--
    +
    +
    +
    + +
    +
    +octal_permissions($perms)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $perms (int) – Permissions
    • +
    +
    Returns:

    Octal permissions string

    +
    Return type:

    string

    +
    +

    Takes numeric permissions (such as is returned by fileperms()) and returns +a three character octal notation of file permissions.

    +
    echo octal_permissions(fileperms('./index.php')); // 644
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html new file mode 100755 index 0000000..d8164a6 --- /dev/null +++ b/user_guide/helpers/form_helper.html @@ -0,0 +1,1598 @@ + + + + + + + + + + Form Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Form Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Form Helper

    +

    The Form Helper file contains functions that assist in working with +forms.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('form');
    +
    +
    +
    +
    +

    Escaping field values

    +

    You may need to use HTML and characters such as quotes within your form +elements. In order to do that safely, you’ll need to use +common function +html_escape().

    +

    Consider the following example:

    +
    $string = 'Here is a string containing "quoted" text.';
    +
    +<input type="text" name="myfield" value="<?php echo $string; ?>" />
    +
    +
    +

    Since the above string contains a set of quotes, it will cause the form +to break. The html_escape() function converts HTML special +characters so that it can be used safely:

    +
    <input type="text" name="myfield" value="<?php echo html_escape($string); ?>" />
    +
    +
    +
    +

    Note

    +

    If you use any of the form helper functions listed on this page, +the form values will be automatically escaped, so there is no need +to call this function. Use it only if you are creating your own +form elements.

    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +form_open([$action = ''[, $attributes = ''[, $hidden = array()]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $action (string) – Form action/target URI string
    • +
    • $attributes (array) – HTML attributes
    • +
    • $hidden (array) – An array of hidden fields’ definitions
    • +
    +
    Returns:

    An HTML form opening tag

    +
    Return type:

    string

    +
    +

    Creates an opening form tag with a base URL built from your config preferences. +It will optionally let you add form attributes and hidden input fields, and +will always add the accept-charset attribute based on the charset value in your +config file.

    +

    The main benefit of using this tag rather than hard coding your own HTML is that +it permits your site to be more portable in the event your URLs ever change.

    +

    Here’s a simple example:

    +
    echo form_open('email/send');
    +
    +
    +

    The above example would create a form that points to your base URL plus the +“email/send” URI segments, like this:

    +
    <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send">
    +
    +
    +

    Adding Attributes

    +
    +

    Attributes can be added by passing an associative array to the second +parameter, like this:

    +
    $attributes = array('class' => 'email', 'id' => 'myform');
    +echo form_open('email/send', $attributes);
    +
    +
    +

    Alternatively, you can specify the second parameter as a string:

    +
    echo form_open('email/send', 'class="email" id="myform"');
    +
    +
    +

    The above examples would create a form similar to this:

    +
    <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" class="email" id="myform">
    +
    +
    +
    +

    Adding Hidden Input Fields

    +
    +

    Hidden fields can be added by passing an associative array to the +third parameter, like this:

    +
    $hidden = array('username' => 'Joe', 'member_id' => '234');
    +echo form_open('email/send', '', $hidden);
    +
    +
    +

    You can skip the second parameter by passing any falsy value to it.

    +

    The above example would create a form similar to this:

    +
    <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send">
    +        <input type="hidden" name="username" value="Joe" />
    +        <input type="hidden" name="member_id" value="234" />
    +
    +
    +
    +
    + +
    +
    +form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $action (string) – Form action/target URI string
    • +
    • $attributes (array) – HTML attributes
    • +
    • $hidden (array) – An array of hidden fields’ definitions
    • +
    +
    Returns:

    An HTML multipart form opening tag

    +
    Return type:

    string

    +
    +

    This function is absolutely identical to form_open() above, +except that it adds a multipart attribute, which is necessary if you +would like to use the form to upload files with.

    +
    + +
    +
    +form_hidden($name[, $value = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $name (string) – Field name
    • +
    • $value (string) – Field value
    • +
    +
    Returns:

    An HTML hidden input field tag

    +
    Return type:

    string

    +
    +

    Lets you generate hidden input fields. You can either submit a +name/value string to create one field:

    +
    form_hidden('username', 'johndoe');
    +// Would produce: <input type="hidden" name="username" value="johndoe" />
    +
    +
    +

    … or you can submit an associative array to create multiple fields:

    +
    $data = array(
    +        'name'  => 'John Doe',
    +        'email' => 'john@example.com',
    +        'url'   => 'http://example.com'
    +);
    +
    +echo form_hidden($data);
    +
    +/*
    +        Would produce:
    +        <input type="hidden" name="name" value="John Doe" />
    +        <input type="hidden" name="email" value="john@example.com" />
    +        <input type="hidden" name="url" value="http://example.com" />
    +*/
    +
    +
    +

    You can also pass an associative array to the value field:

    +
    $data = array(
    +        'name'  => 'John Doe',
    +        'email' => 'john@example.com',
    +        'url'   => 'http://example.com'
    +);
    +
    +echo form_hidden('my_array', $data);
    +
    +/*
    +        Would produce:
    +
    +        <input type="hidden" name="my_array[name]" value="John Doe" />
    +        <input type="hidden" name="my_array[email]" value="john@example.com" />
    +        <input type="hidden" name="my_array[url]" value="http://example.com" />
    +*/
    +
    +
    +

    If you want to create hidden input fields with extra attributes:

    +
    $data = array(
    +        'type'  => 'hidden',
    +        'name'  => 'email',
    +        'id'    => 'hiddenemail',
    +        'value' => 'john@example.com',
    +        'class' => 'hiddenemail'
    +);
    +
    +echo form_input($data);
    +
    +/*
    +        Would produce:
    +
    +        <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" />
    +*/
    +
    +
    +
    + +
    +
    +form_input([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML text input field tag

    +
    Return type:

    string

    +
    +

    Lets you generate a standard text input field. You can minimally pass +the field name and value in the first and second parameter:

    +
    echo form_input('username', 'johndoe');
    +
    +
    +

    Or you can pass an associative array containing any data you wish your +form to contain:

    +
    $data = array(
    +        'name'          => 'username',
    +        'id'            => 'username',
    +        'value'         => 'johndoe',
    +        'maxlength'     => '100',
    +        'size'          => '50',
    +        'style'         => 'width:50%'
    +);
    +
    +echo form_input($data);
    +
    +/*
    +        Would produce:
    +
    +        <input type="text" name="username" value="johndoe" id="username" maxlength="100" size="50" style="width:50%"  />
    +*/
    +
    +
    +

    If you would like your form to contain some additional data, like +JavaScript, you can pass it as a string in the third parameter:

    +
    $js = 'onClick="some_function()"';
    +echo form_input('username', 'johndoe', $js);
    +
    +
    +

    Or you can pass it as an array:

    +
    $js = array('onClick' => 'some_function();');
    +echo form_input('username', 'johndoe', $js);
    +
    +
    +
    + +
    +
    +form_password([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML password input field tag

    +
    Return type:

    string

    +
    +

    This function is identical in all respects to the form_input() +function above except that it uses the “password” input type.

    +
    + +
    +
    +form_upload([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML file upload input field tag

    +
    Return type:

    string

    +
    +

    This function is identical in all respects to the form_input() +function above except that it uses the “file” input type, allowing it to +be used to upload files.

    +
    + +
    +
    +form_textarea([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML textarea tag

    +
    Return type:

    string

    +
    +

    This function is identical in all respects to the form_input() +function above except that it generates a “textarea” type.

    +
    +

    Note

    +

    Instead of the maxlength and size attributes in the above example, +you will instead specify rows and cols.

    +
    +
    + +
    +
    +form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $name (string) – Field name
    • +
    • $options (array) – An associative array of options to be listed
    • +
    • $selected (array) – List of fields to mark with the selected attribute
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML dropdown select field tag

    +
    Return type:

    string

    +
    +

    Lets you create a standard drop-down field. The first parameter will +contain the name of the field, the second parameter will contain an +associative array of options, and the third parameter will contain the +value you wish to be selected. You can also pass an array of multiple +items through the third parameter, and CodeIgniter will create a +multiple select for you.

    +

    Example:

    +
    $options = array(
    +        'small'         => 'Small Shirt',
    +        'med'           => 'Medium Shirt',
    +        'large'         => 'Large Shirt',
    +        'xlarge'        => 'Extra Large Shirt',
    +);
    +
    +$shirts_on_sale = array('small', 'large');
    +echo form_dropdown('shirts', $options, 'large');
    +
    +/*
    +        Would produce:
    +
    +        <select name="shirts">
    +                <option value="small">Small Shirt</option>
    +                <option value="med">Medium  Shirt</option>
    +                <option value="large" selected="selected">Large Shirt</option>
    +                <option value="xlarge">Extra Large Shirt</option>
    +        </select>
    +*/
    +
    +echo form_dropdown('shirts', $options, $shirts_on_sale);
    +
    +/*
    +        Would produce:
    +
    +        <select name="shirts" multiple="multiple">
    +                <option value="small" selected="selected">Small Shirt</option>
    +                <option value="med">Medium  Shirt</option>
    +                <option value="large" selected="selected">Large Shirt</option>
    +                <option value="xlarge">Extra Large Shirt</option>
    +        </select>
    +*/
    +
    +
    +

    If you would like the opening <select> to contain additional data, like +an id attribute or JavaScript, you can pass it as a string in the fourth +parameter:

    +
    $js = 'id="shirts" onChange="some_function();"';
    +echo form_dropdown('shirts', $options, 'large', $js);
    +
    +
    +

    Or you can pass it as an array:

    +
    $js = array(
    +        'id'       => 'shirts',
    +        'onChange' => 'some_function();'
    +);
    +echo form_dropdown('shirts', $options, 'large', $js);
    +
    +
    +

    If the array passed as $options is a multidimensional array, then +form_dropdown() will produce an <optgroup> with the array key as the +label.

    +
    + +
    +
    +form_multiselect([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $name (string) – Field name
    • +
    • $options (array) – An associative array of options to be listed
    • +
    • $selected (array) – List of fields to mark with the selected attribute
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML dropdown multiselect field tag

    +
    Return type:

    string

    +
    +

    Lets you create a standard multiselect field. The first parameter will +contain the name of the field, the second parameter will contain an +associative array of options, and the third parameter will contain the +value or values you wish to be selected.

    +

    The parameter usage is identical to using form_dropdown() above, +except of course that the name of the field will need to use POST array +syntax, e.g. foo[].

    +
    + +
    +
    +form_fieldset([$legend_text = ''[, $attributes = array()]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $legend_text (string) – Text to put in the <legend> tag
    • +
    • $attributes (array) – Attributes to be set on the <fieldset> tag
    • +
    +
    Returns:

    An HTML fieldset opening tag

    +
    Return type:

    string

    +
    +

    Lets you generate fieldset/legend fields.

    +

    Example:

    +
    echo form_fieldset('Address Information');
    +echo "<p>fieldset content here</p>\n";
    +echo form_fieldset_close();
    +
    +/*
    +        Produces:
    +
    +                <fieldset>
    +                        <legend>Address Information</legend>
    +                                <p>form content here</p>
    +                </fieldset>
    +*/
    +
    +
    +

    Similar to other functions, you can submit an associative array in the +second parameter if you prefer to set additional attributes:

    +
    $attributes = array(
    +        'id'    => 'address_info',
    +        'class' => 'address_info'
    +);
    +
    +echo form_fieldset('Address Information', $attributes);
    +echo "<p>fieldset content here</p>\n";
    +echo form_fieldset_close();
    +
    +/*
    +        Produces:
    +
    +        <fieldset id="address_info" class="address_info">
    +                <legend>Address Information</legend>
    +                <p>form content here</p>
    +        </fieldset>
    +*/
    +
    +
    +
    + +
    +
    +form_fieldset_close([$extra = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $extra (string) – Anything to append after the closing tag, as is
    • +
    +
    Returns:

    An HTML fieldset closing tag

    +
    Return type:

    string

    +
    +

    Produces a closing </fieldset> tag. The only advantage to using this +function is it permits you to pass data to it which will be added below +the tag. For example

    +
    $string = '</div></div>';
    +echo form_fieldset_close($string);
    +// Would produce: </fieldset></div></div>
    +
    +
    +
    + +
    +
    +form_checkbox([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $checked (bool) – Whether to mark the checkbox as being checked
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML checkbox input tag

    +
    Return type:

    string

    +
    +

    Lets you generate a checkbox field. Simple example:

    +
    echo form_checkbox('newsletter', 'accept', TRUE);
    +// Would produce:  <input type="checkbox" name="newsletter" value="accept" checked="checked" />
    +
    +
    +

    The third parameter contains a boolean TRUE/FALSE to determine whether +the box should be checked or not.

    +

    Similar to the other form functions in this helper, you can also pass an +array of attributes to the function:

    +
    $data = array(
    +        'name'          => 'newsletter',
    +        'id'            => 'newsletter',
    +        'value'         => 'accept',
    +        'checked'       => TRUE,
    +        'style'         => 'margin:10px'
    +);
    +
    +echo form_checkbox($data);
    +// Would produce: <input type="checkbox" name="newsletter" id="newsletter" value="accept" checked="checked" style="margin:10px" />
    +
    +
    +

    Also as with other functions, if you would like the tag to contain +additional data like JavaScript, you can pass it as a string in the +fourth parameter:

    +
    $js = 'onClick="some_function()"';
    +echo form_checkbox('newsletter', 'accept', TRUE, $js);
    +
    +
    +

    Or you can pass it as an array:

    +
    $js = array('onClick' => 'some_function();');
    +echo form_checkbox('newsletter', 'accept', TRUE, $js);
    +
    +
    +
    + +
    +
    +form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Field attributes data
    • +
    • $value (string) – Field value
    • +
    • $checked (bool) – Whether to mark the radio button as being checked
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML radio input tag

    +
    Return type:

    string

    +
    +

    This function is identical in all respects to the form_checkbox() +function above except that it uses the “radio” input type.

    +
    + +
    +
    +form_label([$label_text = ''[, $id = ''[, $attributes = array()]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $label_text (string) – Text to put in the <label> tag
    • +
    • $id (string) – ID of the form element that we’re making a label for
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    An HTML field label tag

    +
    Return type:

    string

    +
    +

    Lets you generate a <label>. Simple example:

    +
    echo form_label('What is your Name', 'username');
    +// Would produce:  <label for="username">What is your Name</label>
    +
    +
    +

    Similar to other functions, you can submit an associative array in the +third parameter if you prefer to set additional attributes.

    +

    Example:

    +
    $attributes = array(
    +        'class' => 'mycustomclass',
    +        'style' => 'color: #000;'
    +);
    +
    +echo form_label('What is your Name', 'username', $attributes);
    +// Would produce:  <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label>
    +
    +
    +
    + +
    +
    +form_submit([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Button name
    • +
    • $value (string) – Button value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML input submit tag

    +
    Return type:

    string

    +
    +

    Lets you generate a standard submit button. Simple example:

    +
    echo form_submit('mysubmit', 'Submit Post!');
    +// Would produce:  <input type="submit" name="mysubmit" value="Submit Post!" />
    +
    +
    +

    Similar to other functions, you can submit an associative array in the +first parameter if you prefer to set your own attributes. The third +parameter lets you add extra data to your form, like JavaScript.

    +
    + +
    +
    +form_reset([$data = ''[, $value = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Button name
    • +
    • $value (string) – Button value
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML input reset button tag

    +
    Return type:

    string

    +
    +

    Lets you generate a standard reset button. Use is identical to +form_submit().

    +
    + +
    +
    +form_button([$data = ''[, $content = ''[, $extra = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Button name
    • +
    • $content (string) – Button label
    • +
    • $extra (mixed) – Extra attributes to be added to the tag either as an array or a literal string
    • +
    +
    Returns:

    An HTML button tag

    +
    Return type:

    string

    +
    +

    Lets you generate a standard button element. You can minimally pass the +button name and content in the first and second parameter:

    +
    echo form_button('name','content');
    +// Would produce: <button name="name" type="button">Content</button>
    +
    +
    +

    Or you can pass an associative array containing any data you wish your +form to contain:

    +
    $data = array(
    +        'name'          => 'button',
    +        'id'            => 'button',
    +        'value'         => 'true',
    +        'type'          => 'reset',
    +        'content'       => 'Reset'
    +);
    +
    +echo form_button($data);
    +// Would produce: <button name="button" id="button" value="true" type="reset">Reset</button>
    +
    +
    +

    If you would like your form to contain some additional data, like +JavaScript, you can pass it as a string in the third parameter:

    +
    $js = 'onClick="some_function()"';
    +echo form_button('mybutton', 'Click Me', $js);
    +
    +
    +
    + +
    +
    +form_close([$extra = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $extra (string) – Anything to append after the closing tag, as is
    • +
    +
    Returns:

    An HTML form closing tag

    +
    Return type:

    string

    +
    +

    Produces a closing </form> tag. The only advantage to using this +function is it permits you to pass data to it which will be added below +the tag. For example:

    +
    $string = '</div></div>';
    +echo form_close($string);
    +// Would produce:  </form> </div></div>
    +
    +
    +
    + +
    +
    +set_value($field[, $default = ''[, $html_escape = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $default (string) – Default value
    • +
    • $html_escape (bool) – Whether to turn off HTML escaping of the value
    • +
    +
    Returns:

    Field value

    +
    Return type:

    string

    +
    +

    Permits you to set the value of an input form or textarea. You must +supply the field name via the first parameter of the function. The +second (optional) parameter allows you to set a default value for the +form. The third (optional) parameter allows you to turn off HTML escaping +of the value, in case you need to use this function in combination with +i.e. form_input() and avoid double-escaping.

    +

    Example:

    +
    <input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" />
    +
    +
    +

    The above form will show “0” when loaded for the first time.

    +
    +

    Note

    +

    If you’ve loaded the Form Validation Library and +have set a validation rule for the field name in use with this helper, then it will +forward the call to the Form Validation Library’s +own set_value() method. Otherwise, this function looks in $_POST for the +field value.

    +
    +
    + +
    +
    +set_select($field[, $value = ''[, $default = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $value (string) – Value to check for
    • +
    • $default (string) – Whether the value is also a default one
    • +
    +
    Returns:

    ‘selected’ attribute or an empty string

    +
    Return type:

    string

    +
    +

    If you use a <select> menu, this function permits you to display the +menu item that was selected.

    +

    The first parameter must contain the name of the select menu, the second +parameter must contain the value of each item, and the third (optional) +parameter lets you set an item as the default (use boolean TRUE/FALSE).

    +

    Example:

    +
    <select name="myselect">
    +        <option value="one" <?php echo  set_select('myselect', 'one', TRUE); ?> >One</option>
    +        <option value="two" <?php echo  set_select('myselect', 'two'); ?> >Two</option>
    +        <option value="three" <?php echo  set_select('myselect', 'three'); ?> >Three</option>
    +</select>
    +
    +
    +
    + +
    +
    +set_checkbox($field[, $value = ''[, $default = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $value (string) – Value to check for
    • +
    • $default (string) – Whether the value is also a default one
    • +
    +
    Returns:

    ‘checked’ attribute or an empty string

    +
    Return type:

    string

    +
    +

    Permits you to display a checkbox in the state it was submitted.

    +

    The first parameter must contain the name of the checkbox, the second +parameter must contain its value, and the third (optional) parameter +lets you set an item as the default (use boolean TRUE/FALSE).

    +

    Example:

    +
    <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
    +<input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> />
    +
    +
    +
    + +
    +
    +set_radio($field[, $value = ''[, $default = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $value (string) – Value to check for
    • +
    • $default (string) – Whether the value is also a default one
    • +
    +
    Returns:

    ‘checked’ attribute or an empty string

    +
    Return type:

    string

    +
    +

    Permits you to display radio buttons in the state they were submitted. +This function is identical to the set_checkbox() function above.

    +

    Example:

    +
    <input type="radio" name="myradio" value="1" <?php echo  set_radio('myradio', '1', TRUE); ?> />
    +<input type="radio" name="myradio" value="2" <?php echo  set_radio('myradio', '2'); ?> />
    +
    +
    +
    +

    Note

    +

    If you are using the Form Validation class, you must always specify +a rule for your field, even if empty, in order for the set_*() +functions to work. This is because if a Form Validation object is +defined, the control for set_*() is handed over to a method of the +class instead of the generic helper function.

    +
    +
    + +
    +
    +form_error([$field = ''[, $prefix = ''[, $suffix = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $prefix (string) – Error opening tag
    • +
    • $suffix (string) – Error closing tag
    • +
    +
    Returns:

    HTML-formatted form validation error message(s)

    +
    Return type:

    string

    +
    +

    Returns a validation error message from the Form Validation Library, associated with the specified field name. +You can optionally specify opening and closing tag(s) to put around the error +message.

    +

    Example:

    +
    // Assuming that the 'username' field value was incorrect:
    +echo form_error('myfield', '<div class="error">', '</div>');
    +
    +// Would produce: <div class="error">Error message associated with the "username" field.</div>
    +
    +
    +
    + +
    +
    +validation_errors([$prefix = ''[, $suffix = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $prefix (string) – Error opening tag
    • +
    • $suffix (string) – Error closing tag
    • +
    +
    Returns:

    HTML-formatted form validation error message(s)

    +
    Return type:

    string

    +
    +

    Similarly to the form_error() function, returns all validation +error messages produced by the Form Validation Library, with optional opening and closing tags +around each of the messages.

    +

    Example:

    +
    echo validation_errors('<span class="error">', '</span>');
    +
    +/*
    +        Would produce, e.g.:
    +
    +        <span class="error">The "email" field doesn't contain a valid e-mail address!</span>
    +        <span class="error">The "password" field doesn't match the "repeat_password" field!</span>
    +
    + */
    +
    +
    +
    + +
    +
    +form_prep($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Value to escape
    • +
    +
    Returns:

    Escaped value

    +
    Return type:

    string

    +
    +

    Allows you to safely use HTML and characters such as quotes within form +elements without breaking out of the form.

    +
    +

    Note

    +

    If you use any of the form helper functions listed in this page the form +values will be prepped automatically, so there is no need to call this +function. Use it only if you are creating your own form elements.

    +
    +
    +

    Note

    +

    This function is DEPRECATED and is just an alias for +common function +html_escape() - please use that instead.

    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html new file mode 100755 index 0000000..19b838c --- /dev/null +++ b/user_guide/helpers/html_helper.html @@ -0,0 +1,1091 @@ + + + + + + + + + + HTML Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • HTML Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    HTML Helper

    +

    The HTML Helper file contains functions that assist in working with +HTML.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('html');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +heading([$data = ''[, $h = '1'[, $attributes = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Content
    • +
    • $h (string) – Heading level
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    HTML heading tag

    +
    Return type:

    string

    +
    +

    Lets you create HTML heading tags. The first parameter will contain the +data, the second the size of the heading. Example:

    +
    echo heading('Welcome!', 3);
    +
    +
    +

    The above would produce: <h3>Welcome!</h3>

    +

    Additionally, in order to add attributes to the heading tag such as HTML +classes, ids or inline styles, a third parameter accepts either a string +or an array:

    +
    echo heading('Welcome!', 3, 'class="pink"');
    +echo heading('How are you?', 4, array('id' => 'question', 'class' => 'green'));
    +
    +
    +

    The above code produces:

    +
    <h3 class="pink">Welcome!<h3>
    +<h4 id="question" class="green">How are you?</h4>
    +
    +
    +
    + +
    +
    +img([$src = ''[, $index_page = FALSE[, $attributes = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $src (string) – Image source data
    • +
    • $index_page (bool) – Whether to treat $src as a routed URI string
    • +
    • $attributes (array) – HTML attributes
    • +
    +
    Returns:

    HTML image tag

    +
    Return type:

    string

    +
    +

    Lets you create HTML <img /> tags. The first parameter contains the +image source. Example:

    +
    echo img('images/picture.jpg'); // gives <img src="http://site.com/images/picture.jpg" />
    +
    +
    +

    There is an optional second parameter that is a TRUE/FALSE value that +specifics if the src should have the page specified by +$config['index_page'] added to the address it creates. +Presumably, this would be if you were using a media controller:

    +
    echo img('images/picture.jpg', TRUE); // gives <img src="http://site.com/index.php/images/picture.jpg" alt="" />
    +
    +
    +

    Additionally, an associative array can be passed to the img() function +for complete control over all attributes and values. If an alt attribute +is not provided, CodeIgniter will generate an empty string.

    +

    Example:

    +
    $image_properties = array(
    +        'src'   => 'images/picture.jpg',
    +        'alt'   => 'Me, demonstrating how to eat 4 slices of pizza at one time',
    +        'class' => 'post_images',
    +        'width' => '200',
    +        'height'=> '200',
    +        'title' => 'That was quite a night',
    +        'rel'   => 'lightbox'
    +);
    +
    +img($image_properties);
    +// <img src="http://site.com/index.php/images/picture.jpg" alt="Me, demonstrating how to eat 4 slices of pizza at one time" class="post_images" width="200" height="200" title="That was quite a night" rel="lightbox" />
    +
    +
    +
    + +
    + +
    +++ + + + + + + + +
    Parameters:
      +
    • $href (string) – What are we linking to
    • +
    • $rel (string) – Relation type
    • +
    • $type (string) – Type of the related document
    • +
    • $title (string) – Link title
    • +
    • $media (string) – Media type
    • +
    • $index_page (bool) – Whether to treat $src as a routed URI string
    • +
    +
    Returns:

    HTML link tag

    +
    Return type:

    string

    +
    +

    Lets you create HTML <link /> tags. This is useful for stylesheet links, +as well as other links. The parameters are href, with optional rel, +type, title, media and index_page.

    +

    index_page is a boolean value that specifies if the href should have +the page specified by $config['index_page'] added to the address it creates.

    +

    Example:

    +
    echo link_tag('css/mystyles.css');
    +// gives <link href="http://site.com/css/mystyles.css" rel="stylesheet" type="text/css" />
    +
    +
    +

    Further examples:

    +
    echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');
    +// <link href="http://site.com/favicon.ico" rel="shortcut icon" type="image/ico" />
    +
    +echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');
    +// <link href="http://site.com/feed" rel="alternate" type="application/rss+xml" title="My RSS Feed" />
    +
    +
    +

    Additionally, an associative array can be passed to the link() function +for complete control over all attributes and values:

    +
    $link = array(
    +        'href'  => 'css/printer.css',
    +        'rel'   => 'stylesheet',
    +        'type'  => 'text/css',
    +        'media' => 'print'
    +);
    +
    +echo link_tag($link);
    +// <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" />
    +
    +
    +
    + +
    +
    +ul($list[, $attributes = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $list (array) – List entries
    • +
    • $attributes (array) – HTML attributes
    • +
    +
    Returns:

    HTML-formatted unordered list

    +
    Return type:

    string

    +
    +

    Permits you to generate unordered HTML lists from simple or +multi-dimensional arrays. Example:

    +
    $list = array(
    +        'red',
    +        'blue',
    +        'green',
    +        'yellow'
    +);
    +
    +$attributes = array(
    +        'class' => 'boldlist',
    +        'id'    => 'mylist'
    +);
    +
    +echo ul($list, $attributes);
    +
    +
    +

    The above code will produce this:

    +
    <ul class="boldlist" id="mylist">
    +        <li>red</li>
    +        <li>blue</li>
    +        <li>green</li>
    +        <li>yellow</li>
    +</ul>
    +
    +
    +

    Here is a more complex example, using a multi-dimensional array:

    +
    $attributes = array(
    +        'class' => 'boldlist',
    +        'id'    => 'mylist'
    +);
    +
    +$list = array(
    +        'colors'  => array(
    +                'red',
    +                'blue',
    +                'green'
    +        ),
    +        'shapes'  => array(
    +                'round',
    +                'square',
    +                'circles' => array(
    +                        'ellipse',
    +                        'oval',
    +                        'sphere'
    +                )
    +        ),
    +        'moods'  => array(
    +                'happy',
    +                'upset' => array(
    +                        'defeated' => array(
    +                                'dejected',
    +                                'disheartened',
    +                                'depressed'
    +                        ),
    +                        'annoyed',
    +                        'cross',
    +                        'angry'
    +                )
    +        )
    +);
    +
    +echo ul($list, $attributes);
    +
    +
    +

    The above code will produce this:

    +
    <ul class="boldlist" id="mylist">
    +        <li>colors
    +                <ul>
    +                        <li>red</li>
    +                        <li>blue</li>
    +                        <li>green</li>
    +                </ul>
    +        </li>
    +        <li>shapes
    +                <ul>
    +                        <li>round</li>
    +                        <li>suare</li>
    +                        <li>circles
    +                                <ul>
    +                                        <li>elipse</li>
    +                                        <li>oval</li>
    +                                        <li>sphere</li>
    +                                </ul>
    +                        </li>
    +                </ul>
    +        </li>
    +        <li>moods
    +                <ul>
    +                        <li>happy</li>
    +                        <li>upset
    +                                <ul>
    +                                        <li>defeated
    +                                                <ul>
    +                                                        <li>dejected</li>
    +                                                        <li>disheartened</li>
    +                                                        <li>depressed</li>
    +                                                </ul>
    +                                        </li>
    +                                        <li>annoyed</li>
    +                                        <li>cross</li>
    +                                        <li>angry</li>
    +                                </ul>
    +                        </li>
    +                </ul>
    +        </li>
    +</ul>
    +
    +
    +
    + +
    +
    +ol($list, $attributes = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $list (array) – List entries
    • +
    • $attributes (array) – HTML attributes
    • +
    +
    Returns:

    HTML-formatted ordered list

    +
    Return type:

    string

    +
    +

    Identical to ul(), only it produces the <ol> tag for +ordered lists instead of <ul>.

    +
    + +
    +
    +meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "n"]]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $name (string) – Meta name
    • +
    • $content (string) – Meta content
    • +
    • $type (string) – Meta type
    • +
    • $newline (string) – Newline character
    • +
    +
    Returns:

    HTML meta tag

    +
    Return type:

    string

    +
    +

    Helps you generate meta tags. You can pass strings to the function, or +simple arrays, or multidimensional ones.

    +

    Examples:

    +
    echo meta('description', 'My Great site');
    +// Generates:  <meta name="description" content="My Great Site" />
    +
    +echo meta('Content-type', 'text/html; charset=utf-8', 'equiv');
    +// Note the third parameter.  Can be "equiv" or "name"
    +// Generates:  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    +
    +echo meta(array('name' => 'robots', 'content' => 'no-cache'));
    +// Generates:  <meta name="robots" content="no-cache" />
    +
    +$meta = array(
    +        array(
    +                'name' => 'robots',
    +                'content' => 'no-cache'
    +        ),
    +        array(
    +                'name' => 'description',
    +                'content' => 'My Great Site'
    +        ),
    +        array(
    +                'name' => 'keywords',
    +                'content' => 'love, passion, intrigue, deception'
    +        ),
    +        array(
    +                'name' => 'robots',
    +                'content' => 'no-cache'
    +        ),
    +        array(
    +                'name' => 'Content-type',
    +                'content' => 'text/html; charset=utf-8', 'type' => 'equiv'
    +        )
    +);
    +
    +echo meta($meta);
    +// Generates:
    +// <meta name="robots" content="no-cache" />
    +// <meta name="description" content="My Great Site" />
    +// <meta name="keywords" content="love, passion, intrigue, deception" />
    +// <meta name="robots" content="no-cache" />
    +// <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    +
    +
    +
    + +
    +
    +doctype([$type = 'xhtml1-strict'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Doctype name
    • +
    +
    Returns:

    HTML DocType tag

    +
    Return type:

    string

    +
    +

    Helps you generate document type declarations, or DTD’s. XHTML 1.0 +Strict is used by default, but many doctypes are available.

    +

    Example:

    +
    echo doctype(); // <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    +
    +echo doctype('html4-trans'); // <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    +
    +
    +

    The following is a list of doctype choices. These are configurable, and +pulled from application/config/doctypes.php

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Document typeOptionResult
    XHTML 1.1xhtml11<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
    XHTML 1.0 Strictxhtml1-strict<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
    XHTML 1.0 Transitionalxhtml1-trans<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
    XHTML 1.0 Framesetxhtml1-frame<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>
    XHTML Basic 1.1xhtml-basic11<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML Basic 1.1//EN” “http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd”>
    HTML 5html5<!DOCTYPE html>
    HTML 4 Stricthtml4-strict<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
    HTML 4 Transitionalhtml4-trans<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
    HTML 4 Framesethtml4-frame<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>
    MathML 1.01mathml1<!DOCTYPE math SYSTEM “http://www.w3.org/Math/DTD/mathml1/mathml.dtd”>
    MathML 2.0mathml2<!DOCTYPE math PUBLIC “-//W3C//DTD MathML 2.0//EN” “http://www.w3.org/Math/DTD/mathml2/mathml2.dtd”>
    SVG 1.0svg10<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.0//EN” “http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd”>
    SVG 1.1 Fullsvg11<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”>
    SVG 1.1 Basicsvg11-basic<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1 Basic//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd”>
    SVG 1.1 Tinysvg11-tiny<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1 Tiny//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd”>
    XHTML+MathML+SVG (XHTML host)xhtml-math-svg-xh<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN” “http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd”>
    XHTML+MathML+SVG (SVG host)xhtml-math-svg-sh<!DOCTYPE svg:svg PUBLIC “-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN” “http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd”>
    XHTML+RDFa 1.0xhtml-rdfa-1<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML+RDFa 1.0//EN” “http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd”>
    XHTML+RDFa 1.1xhtml-rdfa-2<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML+RDFa 1.1//EN” “http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd”>
    +
    + +
    +
    +br([$count = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $count (int) – Number of times to repeat the tag
    • +
    +
    Returns:

    HTML line break tag

    +
    Return type:

    string

    +
    +

    Generates line break tags (<br />) based on the number you submit. +Example:

    +
    echo br(3);
    +
    +
    +

    The above would produce:

    +
    <br /><br /><br />
    +
    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native str_repeat() +in combination with <br /> instead.

    +
    +
    + +
    +
    +nbs([$num = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $num (int) – Number of space entities to produce
    • +
    +
    Returns:

    A sequence of non-breaking space HTML entities

    +
    Return type:

    string

    +
    +

    Generates non-breaking spaces (&nbsp;) based on the number you submit. +Example:

    +
    echo nbs(3);
    +
    +
    +

    The above would produce:

    +
    &nbsp;&nbsp;&nbsp;
    +
    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native str_repeat() +in combination with &nbsp; instead.

    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/index.html b/user_guide/helpers/index.html new file mode 100755 index 0000000..cb0eba1 --- /dev/null +++ b/user_guide/helpers/index.html @@ -0,0 +1,518 @@ + + + + + + + + + + Helpers — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    + +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/inflector_helper.html b/user_guide/helpers/inflector_helper.html new file mode 100755 index 0000000..30dfaf3 --- /dev/null +++ b/user_guide/helpers/inflector_helper.html @@ -0,0 +1,680 @@ + + + + + + + + + + Inflector Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Inflector Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Inflector Helper

    +

    The Inflector Helper file contains functions that permits you to change +English words to plural, singular, camel case, etc.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('inflector');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +singular($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    A singular word

    +
    Return type:

    string

    +
    +

    Changes a plural word to singular. Example:

    +
    echo singular('dogs'); // Prints 'dog'
    +
    +
    +
    + +
    +
    +plural($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    A plural word

    +
    Return type:

    string

    +
    +

    Changes a singular word to plural. Example:

    +
    echo plural('dog'); // Prints 'dogs'
    +
    +
    +
    + +
    +
    +camelize($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Camelized string

    +
    Return type:

    string

    +
    +

    Changes a string of words separated by spaces or underscores to camel +case. Example:

    +
    echo camelize('my_dog_spot'); // Prints 'myDogSpot'
    +
    +
    +
    + +
    +
    +underscore($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    String containing underscores instead of spaces

    +
    Return type:

    string

    +
    +

    Takes multiple words separated by spaces and underscores them. +Example:

    +
    echo underscore('my dog spot'); // Prints 'my_dog_spot'
    +
    +
    +
    + +
    +
    +humanize($str[, $separator = '_'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $separator (string) – Input separator
    • +
    +
    Returns:

    Humanized string

    +
    Return type:

    string

    +
    +

    Takes multiple words separated by underscores and adds spaces between +them. Each word is capitalized.

    +

    Example:

    +
    echo humanize('my_dog_spot'); // Prints 'My Dog Spot'
    +
    +
    +

    To use dashes instead of underscores:

    +
    echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'
    +
    +
    +
    + +
    +
    +is_countable($word)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $word (string) – Input string
    • +
    +
    Returns:

    TRUE if the word is countable or FALSE if not

    +
    Return type:

    bool

    +
    +

    Checks if the given word has a plural version. Example:

    +
    is_countable('equipment'); // Returns FALSE
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/language_helper.html b/user_guide/helpers/language_helper.html new file mode 100755 index 0000000..2668111 --- /dev/null +++ b/user_guide/helpers/language_helper.html @@ -0,0 +1,550 @@ + + + + + + + + + + Language Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Language Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Language Helper

    +

    The Language Helper file contains functions that assist in working with +language files.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('language');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +lang($line[, $for = ''[, $attributes = array()]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $line (string) – Language line key
    • +
    • $for (string) – HTML “for” attribute (ID of the element we’re creating a label for)
    • +
    • $attributes (array) – Any additional HTML attributes
    • +
    +
    Returns:

    The language line; in an HTML label tag, if the $for parameter is not empty

    +
    Return type:

    string

    +
    +

    This function returns a line of text from a loaded language file with +simplified syntax that may be more desirable for view files than +CI_Lang::line().

    +

    Examples:

    +
    echo lang('language_key');
    +// Outputs: Language line
    +
    +echo lang('language_key', 'form_item_id', array('class' => 'myClass'));
    +// Outputs: <label for="form_item_id" class="myClass">Language line</label>
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/number_helper.html b/user_guide/helpers/number_helper.html new file mode 100755 index 0000000..bf29899 --- /dev/null +++ b/user_guide/helpers/number_helper.html @@ -0,0 +1,559 @@ + + + + + + + + + + Number Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Number Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Number Helper

    +

    The Number Helper file contains functions that help you work with +numeric data.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('number');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +byte_format($num[, $precision = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $num (mixed) – Number of bytes
    • +
    • $precision (int) – Floating point precision
    • +
    +
    Returns:

    Formatted data size string

    +
    Return type:

    string

    +
    +

    Formats numbers as bytes, based on size, and adds the appropriate +suffix. Examples:

    +
    echo byte_format(456); // Returns 456 Bytes
    +echo byte_format(4567); // Returns 4.5 KB
    +echo byte_format(45678); // Returns 44.6 KB
    +echo byte_format(456789); // Returns 447.8 KB
    +echo byte_format(3456789); // Returns 3.3 MB
    +echo byte_format(12345678912345); // Returns 1.8 GB
    +echo byte_format(123456789123456789); // Returns 11,228.3 TB
    +
    +
    +

    An optional second parameter allows you to set the precision of the +result:

    +
    echo byte_format(45678, 2); // Returns 44.61 KB
    +
    +
    +
    +

    Note

    +

    The text generated by this function is found in the following +language file: language/<your_lang>/number_lang.php

    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/path_helper.html b/user_guide/helpers/path_helper.html new file mode 100755 index 0000000..a0c4ef6 --- /dev/null +++ b/user_guide/helpers/path_helper.html @@ -0,0 +1,557 @@ + + + + + + + + + + Path Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Path Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Path Helper

    +

    The Path Helper file contains functions that permits you to work with +file paths on the server.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('path');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +set_realpath($path[, $check_existance = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path
    • +
    • $check_existance (bool) – Whether to check if the path actually exists
    • +
    +
    Returns:

    An absolute path

    +
    Return type:

    string

    +
    +

    This function will return a server path without symbolic links or +relative directory structures. An optional second argument will +cause an error to be triggered if the path cannot be resolved.

    +

    Examples:

    +
    $file = '/etc/php5/apache2/php.ini';
    +echo set_realpath($file); // Prints '/etc/php5/apache2/php.ini'
    +
    +$non_existent_file = '/path/to/non-exist-file.txt';
    +echo set_realpath($non_existent_file, TRUE);    // Shows an error, as the path cannot be resolved
    +echo set_realpath($non_existent_file, FALSE);   // Prints '/path/to/non-exist-file.txt'
    +
    +$directory = '/etc/php5';
    +echo set_realpath($directory);  // Prints '/etc/php5/'
    +
    +$non_existent_directory = '/path/to/nowhere';
    +echo set_realpath($non_existent_directory, TRUE);       // Shows an error, as the path cannot be resolved
    +echo set_realpath($non_existent_directory, FALSE);      // Prints '/path/to/nowhere'
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/security_helper.html b/user_guide/helpers/security_helper.html new file mode 100755 index 0000000..399c034 --- /dev/null +++ b/user_guide/helpers/security_helper.html @@ -0,0 +1,669 @@ + + + + + + + + + + Security Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Security Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Security Helper

    +

    The Security Helper file contains security related functions.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('security');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +xss_clean($str[, $is_image = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input data
    • +
    • $is_image (bool) – Whether we’re dealing with an image
    • +
    +
    Returns:

    XSS-clean string

    +
    Return type:

    string

    +
    +

    Provides Cross Site Script Hack filtering.

    +

    This function is an alias for CI_Input::xss_clean(). For more info, +please see the Input Library documentation.

    +
    + +
    +
    +sanitize_filename($filename)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filename (string) – Filename
    • +
    +
    Returns:

    Sanitized file name

    +
    Return type:

    string

    +
    +

    Provides protection against directory traversal.

    +

    This function is an alias for CI_Security::sanitize_filename(). +For more info, please see the Security Library +documentation.

    +
    + +
    +
    +do_hash($str[, $type = 'sha1'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input
    • +
    • $type (string) – Algorithm
    • +
    +
    Returns:

    Hex-formatted hash

    +
    Return type:

    string

    +
    +

    Permits you to create one way hashes suitable for encrypting +passwords. Will use SHA1 by default.

    +

    See hash_algos() +for a full list of supported algorithms.

    +

    Examples:

    +
    $str = do_hash($str); // SHA1
    +$str = do_hash($str, 'md5'); // MD5
    +
    +
    +
    +

    Note

    +

    This function was formerly named dohash(), which has been +removed in favor of do_hash().

    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native hash() instead.

    +
    +
    + +
    +
    +strip_image_tags($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    The input string with no image tags

    +
    Return type:

    string

    +
    +

    This is a security function that will strip image tags from a string. +It leaves the image URL as plain text.

    +

    Example:

    +
    $string = strip_image_tags($string);
    +
    +
    +

    This function is an alias for CI_Security::strip_image_tags(). For +more info, please see the Security Library +documentation.

    +
    + +
    +
    +encode_php_tags($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Safely formatted string

    +
    Return type:

    string

    +
    +

    This is a security function that converts PHP tags to entities.

    +
    +

    Note

    +

    xss_clean() does this automatically, if you use it.

    +
    +

    Example:

    +
    $string = encode_php_tags($string);
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html new file mode 100755 index 0000000..122ded0 --- /dev/null +++ b/user_guide/helpers/smiley_helper.html @@ -0,0 +1,708 @@ + + + + + + + + + + Smiley Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Smiley Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Smiley Helper

    +

    The Smiley Helper file contains functions that let you manage smileys +(emoticons).

    +
    +

    Important

    +

    The Smiley helper is DEPRECATED and should not be used. +It is currently only kept for backwards compatibility.

    +
    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('smiley');
    +
    +
    +
    +
    +

    Overview

    +

    The Smiley helper has a renderer that takes plain text smileys, like +:-) and turns them into a image representation, like smile!

    +

    It also lets you display a set of smiley images that when clicked will +be inserted into a form field. For example, if you have a blog that +allows user commenting you can show the smileys next to the comment +form. Your users can click a desired smiley and with the help of some +JavaScript it will be placed into the form field.

    +
    +
    +

    Clickable Smileys Tutorial

    +

    Here is an example demonstrating how you might create a set of clickable +smileys next to a form field. This example requires that you first +download and install the smiley images, then create a controller and the +View as described.

    +
    +

    Important

    +

    Before you begin, please download the smiley images +and put them in a publicly accessible place on your server. +This helper also assumes you have the smiley replacement array +located at application/config/smileys.php

    +
    +
    +

    The Controller

    +

    In your application/controllers/ directory, create a file called +Smileys.php and place the code below in it.

    +
    +

    Important

    +

    Change the URL in the get_clickable_smileys() +function below so that it points to your smiley folder.

    +
    +

    You’ll notice that in addition to the smiley helper, we are also using +the Table Class:

    +
    <?php
    +
    +class Smileys extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->helper('smiley');
    +                $this->load->library('table');
    +
    +                $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comments');
    +                $col_array = $this->table->make_columns($image_array, 8);
    +
    +                $data['smiley_table'] = $this->table->generate($col_array);
    +                $this->load->view('smiley_view', $data);
    +        }
    +
    +}
    +
    +
    +

    In your application/views/ directory, create a file called smiley_view.php +and place this code in it:

    +
    <html>
    +        <head>
    +                <title>Smileys</title>
    +                <?php echo smiley_js(); ?>
    +        </head>
    +        <body>
    +                <form name="blog">
    +                        <textarea name="comments" id="comments" cols="40" rows="4"></textarea>
    +                </form>
    +                <p>Click to insert a smiley!</p>
    +                <?php echo $smiley_table; ?> </body> </html>
    +                When you have created the above controller and view, load it by visiting http://www.example.com/index.php/smileys/
    +        </body>
    +</html>
    +
    +
    +
    +
    +

    Field Aliases

    +

    When making changes to a view it can be inconvenient to have the field +id in the controller. To work around this, you can give your smiley +links a generic name that will be tied to a specific id in your view.

    +
    $image_array = get_smiley_links("http://example.com/images/smileys/", "comment_textarea_alias");
    +
    +
    +

    To map the alias to the field id, pass them both into the +smiley_js() function:

    +
    $image_array = smiley_js("comment_textarea_alias", "comments");
    +
    +
    +
    +
    +
    +

    Available Functions

    +
    +
    +get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $image_url (string) – URL path to the smileys directory
    • +
    • $alias (string) – Field alias
    • +
    +
    Returns:

    An array of ready to use smileys

    +
    Return type:

    array

    +
    +

    Returns an array containing your smiley images wrapped in a clickable +link. You must supply the URL to your smiley folder and a field id or +field alias.

    +

    Example:

    +
    $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment');
    +
    +
    +
    + +
    +
    +smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $alias (string) – Field alias
    • +
    • $field_id (string) – Field ID
    • +
    • $inline (bool) – Whether we’re inserting an inline smiley
    • +
    +
    Returns:

    Smiley-enabling JavaScript code

    +
    Return type:

    string

    +
    +

    Generates the JavaScript that allows the images to be clicked and +inserted into a form field. If you supplied an alias instead of an id +when generating your smiley links, you need to pass the alias and +corresponding form id into the function. This function is designed to be +placed into the <head> area of your web page.

    +

    Example:

    +
    <?php echo smiley_js(); ?>
    +
    +
    +
    + +
    +
    +parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Text containing smiley codes
    • +
    • $image_url (string) – URL path to the smileys directory
    • +
    • $smileys (array) – An array of smileys
    • +
    +
    Returns:

    Parsed smileys

    +
    Return type:

    string

    +
    +

    Takes a string of text as input and replaces any contained plain text +smileys into the image equivalent. The first parameter must contain your +string, the second must contain the URL to your smiley folder

    +

    Example:

    +
    $str = 'Here are some smileys: :-)  ;-)';
    +$str = parse_smileys($str, 'http://example.com/images/smileys/');
    +echo $str;
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html new file mode 100755 index 0000000..00b2847 --- /dev/null +++ b/user_guide/helpers/string_helper.html @@ -0,0 +1,873 @@ + + + + + + + + + + String Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • String Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    String Helper

    +

    The String Helper file contains functions that assist in working with +strings.

    +
    +

    Important

    +

    Please note that these functions are NOT intended, nor +suitable to be used for any kind of security-related logic.

    +
    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('string');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +random_string([$type = 'alnum'[, $len = 8]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $type (string) – Randomization type
    • +
    • $len (int) – Output string length
    • +
    +
    Returns:

    A random string

    +
    Return type:

    string

    +
    +

    Generates a random string based on the type and length you specify. +Useful for creating passwords or generating random hashes.

    +

    The first parameter specifies the type of string, the second parameter +specifies the length. The following choices are available:

    +
      +
    • alpha: A string with lower and uppercase letters only.
    • +
    • alnum: Alpha-numeric string with lower and uppercase characters.
    • +
    • basic: A random number based on mt_rand().
    • +
    • numeric: Numeric string.
    • +
    • nozero: Numeric string with no zeros.
    • +
    • md5: An encrypted random number based on md5() (fixed length of 32).
    • +
    • sha1: An encrypted random number based on sha1() (fixed length of 40).
    • +
    +

    Usage example:

    +
    echo random_string('alnum', 16);
    +
    +
    +
    +

    Note

    +

    Usage of the unique and encrypt types is DEPRECATED. They +are just aliases for md5 and sha1 respectively.

    +
    +
    + +
    +
    +increment_string($str[, $separator = '_'[, $first = 1]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $separator (string) – Separator to append a duplicate number with
    • +
    • $first (int) – Starting number
    • +
    +
    Returns:

    An incremented string

    +
    Return type:

    string

    +
    +

    Increments a string by appending a number to it or increasing the +number. Useful for creating “copies” or a file or duplicating database +content which has unique titles or slugs.

    +

    Usage example:

    +
    echo increment_string('file', '_'); // "file_1"
    +echo increment_string('file', '-', 2); // "file-2"
    +echo increment_string('file_4'); // "file_5"
    +
    +
    +
    + +
    +
    +alternator($args)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $args (mixed) – A variable number of arguments
    • +
    +
    Returns:

    Alternated string(s)

    +
    Return type:

    mixed

    +
    +

    Allows two or more items to be alternated between, when cycling through +a loop. Example:

    +
    for ($i = 0; $i < 10; $i++)
    +{
    +        echo alternator('string one', 'string two');
    +}
    +
    +
    +

    You can add as many parameters as you want, and with each iteration of +your loop the next item will be returned.

    +
    for ($i = 0; $i < 10; $i++)
    +{
    +        echo alternator('one', 'two', 'three', 'four', 'five');
    +}
    +
    +
    +
    +

    Note

    +

    To use multiple separate calls to this function simply call the +function with no arguments to re-initialize.

    +
    +
    + +
    +
    +repeater($data[, $num = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Input
    • +
    • $num (int) – Number of times to repeat
    • +
    +
    Returns:

    Repeated string

    +
    Return type:

    string

    +
    +

    Generates repeating copies of the data you submit. Example:

    +
    $string = "\n";
    +echo repeater($string, 30);
    +
    +
    +

    The above would generate 30 newlines.

    +
    +

    Note

    +

    This function is DEPRECATED. Use the native str_repeat() +instead.

    +
    +
    + +
    +
    +reduce_double_slashes($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    A string with normalized slashes

    +
    Return type:

    string

    +
    +

    Converts double slashes in a string to a single slash, except those +found in URL protocol prefixes (e.g. http&#58;//).

    +

    Example:

    +
    $string = "http://example.com//index.php";
    +echo reduce_double_slashes($string); // results in "http://example.com/index.php"
    +
    +
    +
    + +
    +
    +strip_slashes($data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (mixed) – Input string or an array of strings
    • +
    +
    Returns:

    String(s) with stripped slashes

    +
    Return type:

    mixed

    +
    +

    Removes any slashes from an array of strings.

    +

    Example:

    +
    $str = array(
    +        'question'  => 'Is your name O\'reilly?',
    +        'answer' => 'No, my name is O\'connor.'
    +);
    +
    +$str = strip_slashes($str);
    +
    +
    +

    The above will return the following array:

    +
    array(
    +        'question'  => "Is your name O'reilly?",
    +        'answer' => "No, my name is O'connor."
    +);
    +
    +
    +
    +

    Note

    +

    For historical reasons, this function will also accept +and handle string inputs. This however makes it just an +alias for stripslashes().

    +
    +
    + +
    +
    +trim_slashes($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Slash-trimmed string

    +
    Return type:

    string

    +
    +

    Removes any leading/trailing slashes from a string. Example:

    +
    $string = "/this/that/theother/";
    +echo trim_slashes($string); // results in this/that/theother
    +
    +
    +
    +

    Note

    +

    This function is DEPRECATED. Use the native trim() instead: +| +| trim($str, ‘/’);

    +
    +
    + +
    +
    +reduce_multiples($str[, $character = ''[, $trim = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Text to search in
    • +
    • $character (string) – Character to reduce
    • +
    • $trim (bool) – Whether to also trim the specified character
    • +
    +
    Returns:

    Reduced string

    +
    Return type:

    string

    +
    +

    Reduces multiple instances of a particular character occurring directly +after each other. Example:

    +
    $string = "Fred, Bill,, Joe, Jimmy";
    +$string = reduce_multiples($string,","); //results in "Fred, Bill, Joe, Jimmy"
    +
    +
    +

    If the third parameter is set to TRUE it will remove occurrences of the +character at the beginning and the end of the string. Example:

    +
    $string = ",Fred, Bill,, Joe, Jimmy,";
    +$string = reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy"
    +
    +
    +
    + +
    +
    +quotes_to_entities($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    String with quotes converted to HTML entities

    +
    Return type:

    string

    +
    +

    Converts single and double quotes in a string to the corresponding HTML +entities. Example:

    +
    $string = "Joe's \"dinner\"";
    +$string = quotes_to_entities($string); //results in "Joe&#39;s &quot;dinner&quot;"
    +
    +
    +
    + +
    +
    +strip_quotes($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    String with quotes stripped

    +
    Return type:

    string

    +
    +

    Removes single and double quotes from a string. Example:

    +
    $string = "Joe's \"dinner\"";
    +$string = strip_quotes($string); //results in "Joes dinner"
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html new file mode 100755 index 0000000..c584acc --- /dev/null +++ b/user_guide/helpers/text_helper.html @@ -0,0 +1,847 @@ + + + + + + + + + + Text Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Text Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Text Helper

    +

    The Text Helper file contains functions that assist in working with +text.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('text');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +word_limiter($str[, $limit = 100[, $end_char = '&#8230;']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $limit (int) – Limit
    • +
    • $end_char (string) – End character (usually an ellipsis)
    • +
    +
    Returns:

    Word-limited string

    +
    Return type:

    string

    +
    +

    Truncates a string to the number of words specified. Example:

    +
    $string = "Here is a nice text string consisting of eleven words.";
    +$string = word_limiter($string, 4);
    +// Returns:  Here is a nice
    +
    +
    +

    The third parameter is an optional suffix added to the string. By +default it adds an ellipsis.

    +
    + +
    +
    +character_limiter($str[, $n = 500[, $end_char = '&#8230;']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $n (int) – Number of characters
    • +
    • $end_char (string) – End character (usually an ellipsis)
    • +
    +
    Returns:

    Character-limited string

    +
    Return type:

    string

    +
    +

    Truncates a string to the number of characters specified. It +maintains the integrity of words so the character count may be slightly +more or less than what you specify.

    +

    Example:

    +
    $string = "Here is a nice text string consisting of eleven words.";
    +$string = character_limiter($string, 20);
    +// Returns:  Here is a nice text string
    +
    +
    +

    The third parameter is an optional suffix added to the string, if +undeclared this helper uses an ellipsis.

    +
    +

    Note

    +

    If you need to truncate to an exact number of characters please +see the ellipsize() function below.

    +
    +
    + +
    +
    +ascii_to_entities($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    A string with ASCII values converted to entities

    +
    Return type:

    string

    +
    +

    Converts ASCII values to character entities, including high ASCII and MS +Word characters that can cause problems when used in a web page, so that +they can be shown consistently regardless of browser settings or stored +reliably in a database. There is some dependence on your server’s +supported character sets, so it may not be 100% reliable in all cases, +but for the most part it should correctly identify characters outside +the normal range (like accented characters).

    +

    Example:

    +
    $string = ascii_to_entities($string);
    +
    +
    +
    + +
    +
    +convert_accented_characters($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    A string with accented characters converted

    +
    Return type:

    string

    +
    +

    Transliterates high ASCII characters to low ASCII equivalents. Useful +when non-English characters need to be used where only standard ASCII +characters are safely used, for instance, in URLs.

    +

    Example:

    +
    $string = convert_accented_characters($string);
    +
    +
    +
    +

    Note

    +

    This function uses a companion config file +application/config/foreign_chars.php to define the to and +from array for transliteration.

    +
    +
    + +
    +
    +word_censor($str, $censored[, $replacement = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $censored (array) – List of bad words to censor
    • +
    • $replacement (string) – What to replace bad words with
    • +
    +
    Returns:

    Censored string

    +
    Return type:

    string

    +
    +

    Enables you to censor words within a text string. The first parameter +will contain the original string. The second will contain an array of +words which you disallow. The third (optional) parameter can contain +a replacement value for the words. If not specified they are replaced +with pound signs: ####.

    +

    Example:

    +
    $disallowed = array('darn', 'shucks', 'golly', 'phooey');
    +$string = word_censor($string, $disallowed, 'Beep!');
    +
    +
    +
    + +
    +
    +highlight_code($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    String with code highlighted via HTML

    +
    Return type:

    string

    +
    +

    Colorizes a string of code (PHP, HTML, etc.). Example:

    +
    $string = highlight_code($string);
    +
    +
    +

    The function uses PHP’s highlight_string() function, so the +colors used are the ones specified in your php.ini file.

    +
    + +
    +
    +highlight_phrase($str, $phrase[, $tag_open = '<mark>'[, $tag_close = '</mark>']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $phrase (string) – Phrase to highlight
    • +
    • $tag_open (string) – Opening tag used for the highlight
    • +
    • $tag_close (string) – Closing tag for the highlight
    • +
    +
    Returns:

    String with a phrase highlighted via HTML

    +
    Return type:

    string

    +
    +

    Will highlight a phrase within a text string. The first parameter will +contain the original string, the second will contain the phrase you wish +to highlight. The third and fourth parameters will contain the +opening/closing HTML tags you would like the phrase wrapped in.

    +

    Example:

    +
    $string = "Here is a nice text string about nothing in particular.";
    +echo highlight_phrase($string, "nice text", '<span style="color:#990000;">', '</span>');
    +
    +
    +

    The above code prints:

    +
    Here is a <span style="color:#990000;">nice text</span> string about nothing in particular.
    +
    +
    +
    +

    Note

    +

    This function used to use the <strong> tag by default. Older browsers +might not support the new HTML5 mark tag, so it is recommended that you +insert the following CSS code into your stylesheet if you need to support +such browsers:

    +
    mark {
    +        background: #ff0;
    +        color: #000;
    +};
    +
    +
    +
    +
    + +
    +
    +word_wrap($str[, $charlim = 76])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $charlim (int) – Character limit
    • +
    +
    Returns:

    Word-wrapped string

    +
    Return type:

    string

    +
    +

    Wraps text at the specified character count while maintaining +complete words.

    +

    Example:

    +
    $string = "Here is a simple string of text that will help us demonstrate this function.";
    +echo word_wrap($string, 25);
    +
    +// Would produce:
    +// Here is a simple string
    +// of text that will help us
    +// demonstrate this
    +// function.
    +
    +
    +
    + +
    +
    +ellipsize($str, $max_length[, $position = 1[, $ellipsis = '&hellip;']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $max_length (int) – String length limit
    • +
    • $position (mixed) – Position to split at (int or float)
    • +
    • $ellipsis (string) – What to use as the ellipsis character
    • +
    +
    Returns:

    Ellipsized string

    +
    Return type:

    string

    +
    +

    This function will strip tags from a string, split it at a defined +maximum length, and insert an ellipsis.

    +

    The first parameter is the string to ellipsize, the second is the number +of characters in the final string. The third parameter is where in the +string the ellipsis should appear from 0 - 1, left to right. For +example. a value of 1 will place the ellipsis at the right of the +string, .5 in the middle, and 0 at the left.

    +

    An optional forth parameter is the kind of ellipsis. By default, +&hellip; will be inserted.

    +

    Example:

    +
    $str = 'this_string_is_entirely_too_long_and_might_break_my_design.jpg';
    +echo ellipsize($str, 32, .5);
    +
    +
    +

    Produces:

    +
    this_string_is_e&hellip;ak_my_design.jpg
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/typography_helper.html b/user_guide/helpers/typography_helper.html new file mode 100755 index 0000000..61ab8fb --- /dev/null +++ b/user_guide/helpers/typography_helper.html @@ -0,0 +1,607 @@ + + + + + + + + + + Typography Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • Typography Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Typography Helper

    +

    The Typography Helper file contains functions that help your format text +in semantically relevant ways.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('typography');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +auto_typography($str[, $reduce_linebreaks = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $reduce_linebreaks (bool) – Whether to reduce multiple instances of double newlines to two
    • +
    +
    Returns:

    HTML-formatted typography-safe string

    +
    Return type:

    string

    +
    +

    Formats text so that it is semantically and typographically correct +HTML.

    +

    This function is an alias for CI_Typography::auto_typography(). +For more info, please see the Typography Library documentation.

    +

    Usage example:

    +
    $string = auto_typography($string);
    +
    +
    +
    +

    Note

    +

    Typographic formatting can be processor intensive, particularly if +you have a lot of content being formatted. If you choose to use this +function you may want to consider caching your +pages.

    +
    +
    + +
    +
    +nl2br_except_pre($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    String with HTML-formatted line breaks

    +
    Return type:

    string

    +
    +

    Converts newlines to <br /> tags unless they appear within <pre> tags. +This function is identical to the native PHP nl2br() function, +except that it ignores <pre> tags.

    +

    Usage example:

    +
    $string = nl2br_except_pre($string);
    +
    +
    +
    + +
    +
    +entity_decode($str, $charset = NULL)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $charset (string) – Character set
    • +
    +
    Returns:

    String with decoded HTML entities

    +
    Return type:

    string

    +
    +

    This function is an alias for CI_Security::entity_decode(). +Fore more info, please see the Security Library documentation.

    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/url_helper.html b/user_guide/helpers/url_helper.html new file mode 100755 index 0000000..f1cad2e --- /dev/null +++ b/user_guide/helpers/url_helper.html @@ -0,0 +1,1044 @@ + + + + + + + + + + URL Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • URL Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    URL Helper

    +

    The URL Helper file contains functions that assist in working with URLs.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code:

    +
    $this->load->helper('url');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +site_url([$uri = ''[, $protocol = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $uri (string) – URI string
    • +
    • $protocol (string) – Protocol, e.g. ‘http’ or ‘https’
    • +
    +
    Returns:

    Site URL

    +
    Return type:

    string

    +
    +

    Returns your site URL, as specified in your config file. The index.php +file (or whatever you have set as your site index_page in your config +file) will be added to the URL, as will any URI segments you pass to the +function, plus the url_suffix as set in your config file.

    +

    You are encouraged to use this function any time you need to generate a +local URL so that your pages become more portable in the event your URL +changes.

    +

    Segments can be optionally passed to the function as a string or an +array. Here is a string example:

    +
    echo site_url('news/local/123');
    +
    +
    +

    The above example would return something like: +http://example.com/index.php/news/local/123

    +

    Here is an example of segments passed as an array:

    +
    $segments = array('news', 'local', '123');
    +echo site_url($segments);
    +
    +
    +

    This function is an alias for CI_Config::site_url(). For more info, +please see the Config Library documentation.

    +
    + +
    +
    +base_url($uri = '', $protocol = NULL)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $uri (string) – URI string
    • +
    • $protocol (string) – Protocol, e.g. ‘http’ or ‘https’
    • +
    +
    Returns:

    Base URL

    +
    Return type:

    string

    +
    +

    Returns your site base URL, as specified in your config file. Example:

    +
    echo base_url();
    +
    +
    +

    This function returns the same thing as site_url(), without +the index_page or url_suffix being appended.

    +

    Also like site_url(), you can supply segments as a string or +an array. Here is a string example:

    +
    echo base_url("blog/post/123");
    +
    +
    +

    The above example would return something like: +http://example.com/blog/post/123

    +

    This is useful because unlike site_url(), you can supply a +string to a file, such as an image or stylesheet. For example:

    +
    echo base_url("images/icons/edit.png");
    +
    +
    +

    This would give you something like: +http://example.com/images/icons/edit.png

    +

    This function is an alias for CI_Config::base_url(). For more info, +please see the Config Library documentation.

    +
    + +
    +
    +current_url()
    +
    +++ + + + + + +
    Returns:The current URL
    Return type:string
    +

    Returns the full URL (including segments) of the page being currently +viewed.

    +
    +

    Note

    +

    Calling this function is the same as doing this: +| +| site_url(uri_string());

    +
    +
    + +
    +
    +uri_string()
    +
    +++ + + + + + +
    Returns:An URI string
    Return type:string
    +

    Returns the URI segments of any page that contains this function. +For example, if your URL was this:

    +
    http://some-site.com/blog/comments/123
    +
    +
    +

    The function would return:

    +
    blog/comments/123
    +
    +
    +

    This function is an alias for CI_Config::uri_string(). For more info, +please see the Config Library documentation.

    +
    + +
    +
    +index_page()
    +
    +++ + + + + + +
    Returns:‘index_page’ value
    Return type:mixed
    +

    Returns your site index_page, as specified in your config file. +Example:

    +
    echo index_page();
    +
    +
    +
    + +
    +
    +anchor($uri = '', $title = '', $attributes = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $uri (string) – URI string
    • +
    • $title (string) – Anchor title
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    HTML hyperlink (anchor tag)

    +
    Return type:

    string

    +
    +

    Creates a standard HTML anchor link based on your local site URL.

    +

    The first parameter can contain any segments you wish appended to the +URL. As with the site_url() function above, segments can +be a string or an array.

    +
    +

    Note

    +

    If you are building links that are internal to your application +do not include the base URL (http&#58;//…). This will be added +automatically from the information specified in your config file. +Include only the URI segments you wish appended to the URL.

    +
    +

    The second segment is the text you would like the link to say. If you +leave it blank, the URL will be used.

    +

    The third parameter can contain a list of attributes you would like +added to the link. The attributes can be a simple string or an +associative array.

    +

    Here are some examples:

    +
    echo anchor('news/local/123', 'My News', 'title="News title"');
    +// Prints: <a href="http://example.com/index.php/news/local/123" title="News title">My News</a>
    +
    +echo anchor('news/local/123', 'My News', array('title' => 'The best news!'));
    +// Prints: <a href="http://example.com/index.php/news/local/123" title="The best news!">My News</a>
    +
    +echo anchor('', 'Click here');
    +// Prints: <a href="http://example.com">Click Here</a>
    +
    +
    +
    + +
    +
    +anchor_popup($uri = '', $title = '', $attributes = FALSE)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $uri (string) – URI string
    • +
    • $title (string) – Anchor title
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    Pop-up hyperlink

    +
    Return type:

    string

    +
    +

    Nearly identical to the anchor() function except that it +opens the URL in a new window. You can specify JavaScript window +attributes in the third parameter to control how the window is opened. +If the third parameter is not set it will simply open a new window with +your own browser settings.

    +

    Here is an example with attributes:

    +
    $atts = array(
    +        'width'       => 800,
    +        'height'      => 600,
    +        'scrollbars'  => 'yes',
    +        'status'      => 'yes',
    +        'resizable'   => 'yes',
    +        'screenx'     => 0,
    +        'screeny'     => 0,
    +        'window_name' => '_blank'
    +);
    +
    +echo anchor_popup('news/local/123', 'Click Me!', $atts);
    +
    +
    +
    +

    Note

    +

    The above attributes are the function defaults so you only need to +set the ones that are different from what you need. If you want the +function to use all of its defaults simply pass an empty array in the +third parameter: +| +| echo anchor_popup(‘news/local/123’, ‘Click Me!’, array());

    +
    +
    +

    Note

    +

    The window_name is not really an attribute, but an argument to +the JavaScript window.open() <http://www.w3schools.com/jsref/met_win_open.asp> +method, which accepts either a window name or a window target.

    +
    +
    +

    Note

    +

    Any other attribute than the listed above will be parsed as an +HTML attribute to the anchor tag.

    +
    +
    + +
    +
    +mailto($email, $title = '', $attributes = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $email (string) – E-mail address
    • +
    • $title (string) – Anchor title
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    A “mail to” hyperlink

    +
    Return type:

    string

    +
    +

    Creates a standard HTML e-mail link. Usage example:

    +
    echo mailto('me@my-site.com', 'Click Here to Contact Me');
    +
    +
    +

    As with the anchor() tab above, you can set attributes using the +third parameter:

    +
    $attributes = array('title' => 'Mail me');
    +echo mailto('me@my-site.com', 'Contact Me', $attributes);
    +
    +
    +
    + +
    +
    +safe_mailto($email, $title = '', $attributes = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $email (string) – E-mail address
    • +
    • $title (string) – Anchor title
    • +
    • $attributes (mixed) – HTML attributes
    • +
    +
    Returns:

    A spam-safe “mail to” hyperlink

    +
    Return type:

    string

    +
    +

    Identical to the mailto() function except it writes an obfuscated +version of the mailto tag using ordinal numbers written with JavaScript to +help prevent the e-mail address from being harvested by spam bots.

    +
    + +
    + +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $type (string) – Link type (‘email’, ‘url’ or ‘both’)
    • +
    • $popup (bool) – Whether to create popup links
    • +
    +
    Returns:

    Linkified string

    +
    Return type:

    string

    +
    +

    Automatically turns URLs and e-mail addresses contained in a string into +links. Example:

    +
    $string = auto_link($string);
    +
    +
    +

    The second parameter determines whether URLs and e-mails are converted or +just one or the other. Default behavior is both if the parameter is not +specified. E-mail links are encoded as safe_mailto() as shown +above.

    +

    Converts only URLs:

    +
    $string = auto_link($string, 'url');
    +
    +
    +

    Converts only e-mail addresses:

    +
    $string = auto_link($string, 'email');
    +
    +
    +

    The third parameter determines whether links are shown in a new window. +The value can be TRUE or FALSE (boolean):

    +
    $string = auto_link($string, 'both', TRUE);
    +
    +
    +
    + +
    +
    +url_title($str, $separator = '-', $lowercase = FALSE)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $separator (string) – Word separator
    • +
    • $lowercase (bool) – Whether to transform the output string to lower-case
    • +
    +
    Returns:

    URL-formatted string

    +
    Return type:

    string

    +
    +

    Takes a string as input and creates a human-friendly URL string. This is +useful if, for example, you have a blog in which you’d like to use the +title of your entries in the URL. Example:

    +
    $title = "What's wrong with CSS?";
    +$url_title = url_title($title);
    +// Produces: Whats-wrong-with-CSS
    +
    +
    +

    The second parameter determines the word delimiter. By default dashes +are used. Preferred options are: - (dash) or _ (underscore)

    +

    Example:

    +
    $title = "What's wrong with CSS?";
    +$url_title = url_title($title, 'underscore');
    +// Produces: Whats_wrong_with_CSS
    +
    +
    +
    +

    Note

    +

    Old usage of ‘dash’ and ‘underscore’ as the second parameter +is DEPRECATED.

    +
    +

    The third parameter determines whether or not lowercase characters are +forced. By default they are not. Options are boolean TRUE/FALSE.

    +

    Example:

    +
    $title = "What's wrong with CSS?";
    +$url_title = url_title($title, 'underscore', TRUE);
    +// Produces: whats_wrong_with_css
    +
    +
    +
    + +
    +
    +prep_url($str = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – URL string
    • +
    +
    Returns:

    Protocol-prefixed URL string

    +
    Return type:

    string

    +
    +

    This function will add http&#58;// in the event that a protocol prefix +is missing from a URL.

    +

    Pass the URL string to the function like this:

    +
    $url = prep_url('example.com');
    +
    +
    +
    + +
    +
    +redirect($uri = '', $method = 'auto', $code = NULL)
    +
    +++ + + + + + +
    Parameters:
      +
    • $uri (string) – URI string
    • +
    • $method (string) – Redirect method (‘auto’, ‘location’ or ‘refresh’)
    • +
    • $code (string) – HTTP Response code (usually 302 or 303)
    • +
    +
    Return type:

    void

    +
    +

    Does a “header redirect” to the URI specified. If you specify the full +site URL that link will be built, but for local links simply providing +the URI segments to the controller you want to direct to will create the +link. The function will build the URL based on your config file values.

    +

    The optional second parameter allows you to force a particular redirection +method. The available methods are auto, location and refresh, +with location being faster but less reliable on IIS servers. +The default is auto, which will attempt to intelligently choose the +method based on the server environment.

    +

    The optional third parameter allows you to send a specific HTTP Response +Code - this could be used for example to create 301 redirects for search +engine purposes. The default Response Code is 302. The third parameter is +only available with location redirects, and not refresh. Examples:

    +
    if ($logged_in == FALSE)
    +{
    +        redirect('/login/form/');
    +}
    +
    +// with 301 redirect
    +redirect('/article/13', 'location', 301);
    +
    +
    +
    +

    Note

    +

    In order for this function to work it must be used before anything +is outputted to the browser since it utilizes server headers.

    +
    +
    +

    Note

    +

    For very fine grained control over headers, you should use the +Output Library set_header() method.

    +
    +
    +

    Note

    +

    To IIS users: if you hide the Server HTTP header, the auto +method won’t detect IIS, in that case it is advised you explicitly +use the refresh method.

    +
    +
    +

    Note

    +

    When the location method is used, an HTTP status code of 303 +will automatically be selected when the page is currently accessed +via POST and HTTP/1.1 is used.

    +
    +
    +

    Important

    +

    This function will terminate script execution.

    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/helpers/xml_helper.html b/user_guide/helpers/xml_helper.html new file mode 100755 index 0000000..4d6041c --- /dev/null +++ b/user_guide/helpers/xml_helper.html @@ -0,0 +1,559 @@ + + + + + + + + + + XML Helper — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Helpers »
    • + +
    • XML Helper
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    XML Helper

    +

    The XML Helper file contains functions that assist in working with XML +data.

    + +
    +

    Loading this Helper

    +

    This helper is loaded using the following code

    +
    $this->load->helper('xml');
    +
    +
    +
    +
    +

    Available Functions

    +

    The following functions are available:

    +
    +
    +xml_convert($str[, $protect_all = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – the text string to convert
    • +
    • $protect_all (bool) – Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo;
    • +
    +
    Returns:

    XML-converted string

    +
    Return type:

    string

    +
    +

    Takes a string as input and converts the following reserved XML +characters to entities:

    +
    +
      +
    • Ampersands: &
    • +
    • Less than and greater than characters: < >
    • +
    • Single and double quotes: ‘ “
    • +
    • Dashes: -
    • +
    +
    +

    This function ignores ampersands if they are part of existing numbered +character entities, e.g. &#123;. Example:

    +
    $string = '<p>Here is a paragraph & an entity (&#123;).</p>';
    +$string = xml_convert($string);
    +echo $string;
    +
    +
    +

    outputs:

    +
    &lt;p&gt;Here is a paragraph &amp; an entity (&#123;).&lt;/p&gt;
    +
    +
    +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/index.html b/user_guide/index.html new file mode 100755 index 0000000..5c59e95 --- /dev/null +++ b/user_guide/index.html @@ -0,0 +1,712 @@ + + + + + + + + + + CodeIgniter User Guide — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • CodeIgniter User Guide
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    CodeIgniter User Guide

    + + + + + + + + + + + + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html new file mode 100755 index 0000000..ebef44c --- /dev/null +++ b/user_guide/installation/downloads.html @@ -0,0 +1,530 @@ + + + + + + + + + + Downloading CodeIgniter — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Downloading CodeIgniter

    + +
    +

    GitHub

    +

    Git is a distributed version control system.

    +

    Public Git access is available at GitHub. +Please note that while every effort is made to keep this code base +functional, we cannot guarantee the functionality of code taken from +the develop branch.

    +

    Beginning with version 2.0.3, stable versions are also available via GitHub Releases.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html new file mode 100755 index 0000000..8001f59 --- /dev/null +++ b/user_guide/installation/index.html @@ -0,0 +1,532 @@ + + + + + + + + + + Installation Instructions — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Installation Instructions
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Installation Instructions

    +

    CodeIgniter is installed in four steps:

    +
      +
    1. Unzip the package.
    2. +
    3. Upload the CodeIgniter folders and files to your server. Normally the +index.php file will be at your root.
    4. +
    5. Open the application/config/config.php file with a text editor and +set your base URL. If you intend to use encryption or sessions, set +your encryption key.
    6. +
    7. If you intend to use a database, open the +application/config/database.php file with a text editor and set your +database settings.
    8. +
    +

    If you wish to increase security by hiding the location of your +CodeIgniter files you can rename the system and application folders to +something more private. If you do rename them, you must open your main +index.php file and set the $system_path and $application_folder +variables at the top of the file with the new name you’ve chosen.

    +

    For the best security, both the system and any application folders +should be placed above web root so that they are not directly accessible +via a browser. By default, .htaccess files are included in each folder +to help prevent direct access, but it is best to remove them from public +access entirely in case the web server configuration changes or doesn’t +abide by the .htaccess.

    +

    If you would like to keep your views public it is also possible to move +the views folder out of your application folder.

    +

    After moving them, open your main index.php file and set the +$system_path, $application_folder and $view_folder variables, +preferably with a full path, e.g. ‘/www/MyUser/system’.

    +

    One additional measure to take in production environments is to disable +PHP error reporting and any other development-only functionality. In +CodeIgniter, this can be done by setting the ENVIRONMENT constant, which +is more fully described on the security +page.

    +

    That’s it!

    +

    If you’re new to CodeIgniter, please read the Getting +Started section of the User Guide +to begin learning how to build dynamic PHP applications. Enjoy!

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/troubleshooting.html b/user_guide/installation/troubleshooting.html new file mode 100755 index 0000000..fc84f3c --- /dev/null +++ b/user_guide/installation/troubleshooting.html @@ -0,0 +1,511 @@ + + + + + + + + + + Troubleshooting — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Troubleshooting

    +

    If you find that no matter what you put in your URL only your default +page is loading, it might be that your server does not support the +REQUEST_URI variable needed to serve search-engine friendly URLs. As a +first step, open your application/config/config.php file and look for +the URI Protocol information. It will recommend that you try a couple +alternate settings. If it still doesn’t work after you’ve tried this +you’ll need to force CodeIgniter to add a question mark to your URLs. To +do this open your application/config/config.php file and change this:

    +
    $config['index_page'] = "index.php";
    +
    +
    +

    To this:

    +
    $config['index_page'] = "index.php?";
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_120.html b/user_guide/installation/upgrade_120.html new file mode 100755 index 0000000..8e33669 --- /dev/null +++ b/user_guide/installation/upgrade_120.html @@ -0,0 +1,516 @@ + + + + + + + + + + Upgrading From Beta 1.0 to Final 1.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading From Beta 1.0 to Final 1.2

    +

    To upgrade to Version 1.2 please replace the following directories with +the new versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • drivers
    • +
    • helpers
    • +
    • init
    • +
    • language
    • +
    • libraries
    • +
    • plugins
    • +
    • scaffolding
    • +
    +

    Please also replace your local copy of the user guide with the new +version.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_130.html b/user_guide/installation/upgrade_130.html new file mode 100755 index 0000000..35c5b94 --- /dev/null +++ b/user_guide/installation/upgrade_130.html @@ -0,0 +1,619 @@ + + + + + + + + + + Upgrading from 1.2 to 1.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.2 to 1.3

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.2. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • application/models/ (new for 1.3)
    • +
    • codeigniter (new for 1.3)
    • +
    • drivers
    • +
    • helpers
    • +
    • init
    • +
    • language
    • +
    • libraries
    • +
    • plugins
    • +
    • scaffolding
    • +
    +
    +
    +

    Step 2: Update your error files

    +

    Version 1.3 contains two new error templates located in +application/errors, and for naming consistency the other error templates +have been renamed.

    +

    If you have not customized any of the error templates simply replace +this folder:

    +
      +
    • application/errors/
    • +
    +

    If you have customized your error templates, rename them as follows:

    +
      +
    • 404.php = error_404.php
    • +
    • error.php = error_general.php
    • +
    • error_db.php (new)
    • +
    • error_php.php (new)
    • +
    +
    +
    +

    Step 3: Update your index.php file

    +

    Please open your main index.php file (located at your root). At the very +bottom of the file, change this:

    +
    require_once BASEPATH.'libraries/Front_controller'.EXT;
    +
    +
    +

    To this:

    +
    require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
    +
    +
    +
    +
    +

    Step 4: Update your config.php file

    +

    Open your application/config/config.php file and add these new items:

    +
    /*
    +|------------------------------------------------
    +| URL suffix
    +|------------------------------------------------
    +|
    +| This option allows you to add a suffix to all URLs.
    +| For example, if a URL is this:
    +|
    +| example.com/index.php/products/view/shoes
    +|
    +| You can optionally add a suffix, like ".html",
    +| making the page appear to be of a certain type:
    +|
    +| example.com/index.php/products/view/shoes.html
    +|
    +*/
    +$config['url_suffix'] = "";
    +
    +
    +/*
    +|------------------------------------------------
    +| Enable Query Strings
    +|------------------------------------------------
    +|
    +| By default CodeIgniter uses search-engine and
    +| human-friendly segment based URLs:
    +|
    +| example.com/who/what/where/
    +|
    +| You can optionally enable standard query string
    +| based URLs:
    +|
    +| example.com?who=me&what=something&where=here
    +|
    +| Options are: TRUE or FALSE (boolean)
    +|
    +| The two other items let you set the query string "words"
    +| that will invoke your controllers and functions:
    +| example.com/index.php?c=controller&m=function
    +|
    +*/
    +$config['enable_query_strings'] = FALSE;
    +$config['controller_trigger'] = 'c';
    +$config['function_trigger'] = 'm';
    +
    +
    +
    +
    +

    Step 5: Update your database.php file

    +

    Open your application/config/database.php file and add these new items:

    +
    $db['default']['dbprefix'] = "";
    +$db['default']['active_r'] = TRUE;
    +
    +
    +
    +
    +

    Step 6: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_131.html b/user_guide/installation/upgrade_131.html new file mode 100755 index 0000000..b009006 --- /dev/null +++ b/user_guide/installation/upgrade_131.html @@ -0,0 +1,527 @@ + + + + + + + + + + Upgrading from 1.3 to 1.3.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.3 to 1.3.1

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.3. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • drivers
    • +
    • init/init_unit_test.php (new for 1.3.1)
    • +
    • language/
    • +
    • libraries
    • +
    • scaffolding
    • +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_132.html b/user_guide/installation/upgrade_132.html new file mode 100755 index 0000000..22e5d93 --- /dev/null +++ b/user_guide/installation/upgrade_132.html @@ -0,0 +1,525 @@ + + + + + + + + + + Upgrading from 1.3.1 to 1.3.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.3.1 to 1.3.2

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.3.1. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • drivers
    • +
    • init
    • +
    • libraries
    • +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_133.html b/user_guide/installation/upgrade_133.html new file mode 100755 index 0000000..1617728 --- /dev/null +++ b/user_guide/installation/upgrade_133.html @@ -0,0 +1,539 @@ + + + + + + + + + + Upgrading from 1.3.2 to 1.3.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.3.2 to 1.3.3

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.3.2. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • codeigniter
    • +
    • drivers
    • +
    • helpers
    • +
    • init
    • +
    • libraries
    • +
    +
    +
    +

    Step 2: Update your Models

    +

    If you are NOT using CodeIgniter’s +Models feature disregard this step.

    +

    As of version 1.3.3, CodeIgniter does not connect automatically to +your database when a model is loaded. This allows you greater +flexibility in determining which databases you would like used with your +models. If your application is not connecting to your database prior to +a model being loaded you will have to update your code. There are +several options for connecting, as described +here.

    +
    +
    +

    Step 3: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_140.html b/user_guide/installation/upgrade_140.html new file mode 100755 index 0000000..ba9f1e1 --- /dev/null +++ b/user_guide/installation/upgrade_140.html @@ -0,0 +1,567 @@ + + + + + + + + + + Upgrading from 1.3.3 to 1.4.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.3.3 to 1.4.0

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.3.3. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • application/config/hooks.php
    • +
    • application/config/mimes.php
    • +
    • codeigniter
    • +
    • drivers
    • +
    • helpers
    • +
    • init
    • +
    • language
    • +
    • libraries
    • +
    • scaffolding
    • +
    +
    +
    +

    Step 2: Update your config.php file

    +

    Open your application/config/config.php file and add these new items:

    +
    /*
    +|--------------------------------------------------------------------------
    +| Enable/Disable System Hooks
    +|--------------------------------------------------------------------------
    +|
    +| If you would like to use the "hooks" feature you must enable it by
    +| setting this variable to TRUE (boolean).  See the user guide for details.
    +|
    +*/
    +$config['enable_hooks'] = FALSE;
    +
    +
    +/*
    +|--------------------------------------------------------------------------
    +| Allowed URL Characters
    +|--------------------------------------------------------------------------
    +|
    +| This lets you specify which characters are permitted within your URLs.
    +| When someone tries to submit a URL with disallowed characters they will
    +| get a warning message.
    +|
    +| As a security measure you are STRONGLY encouraged to restrict URLs to
    +| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
    +|
    +| Leave blank to allow all characters -- but only if you are insane.
    +|
    +| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
    +|
    +*/
    +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
    +
    +
    +
    +
    +

    Step 3: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_141.html b/user_guide/installation/upgrade_141.html new file mode 100755 index 0000000..7189d53 --- /dev/null +++ b/user_guide/installation/upgrade_141.html @@ -0,0 +1,564 @@ + + + + + + + + + + Upgrading from 1.4.0 to 1.4.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.4.0 to 1.4.1

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.4.0. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace the following directories in your “system” folder with the new +versions:

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
      +
    • codeigniter
    • +
    • drivers
    • +
    • helpers
    • +
    • libraries
    • +
    +
    +
    +

    Step 2: Update your config.php file

    +

    Open your application/config/config.php file and add this new item:

    +
    /*
    +|--------------------------------------------------------------------------
    +| Output Compression
    +|--------------------------------------------------------------------------
    +|
    +| Enables Gzip output compression for faster page loads.  When enabled,
    +| the output class will test whether your server supports Gzip.
    +| Even if it does, however, not all browsers support compression
    +| so enable only if you are reasonably sure your visitors can handle it.
    +|
    +| VERY IMPORTANT:  If you are getting a blank page when compression is enabled it
    +| means you are prematurely outputting something to your browser. It could
    +| even be a line of whitespace at the end of one of your scripts.  For
    +| compression to work, nothing can be sent before the output buffer is called
    +| by the output class.  Do not "echo" any values with compression enabled.
    +|
    +*/
    +$config['compress_output'] = FALSE;
    +
    +
    +
    +
    +

    Step 3: Rename an Autoload Item

    +

    Open the following file: application/config/autoload.php

    +

    Find this array item:

    +
    $autoload['core'] = array();
    +
    +
    +

    And rename it to this:

    +
    $autoload['libraries'] = array();
    +
    +
    +

    This change was made to improve clarity since some users were not sure +that their own libraries could be auto-loaded.

    +
    +
    +

    Step 4: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_150.html b/user_guide/installation/upgrade_150.html new file mode 100755 index 0000000..0d2576f --- /dev/null +++ b/user_guide/installation/upgrade_150.html @@ -0,0 +1,591 @@ + + + + + + + + + + Upgrading from 1.4.1 to 1.5.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.4.1 to 1.5.0

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.4.1. If you have not upgraded to that version please do so first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • application/config/user_agents.php (new file for 1.5)
    • +
    • application/config/smileys.php (new file for 1.5)
    • +
    • codeigniter/
    • +
    • database/ (new folder for 1.5. Replaces the “drivers” folder)
    • +
    • helpers/
    • +
    • language/
    • +
    • libraries/
    • +
    • scaffolding/
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your database.php file

    +

    Open your application/config/database.php file and add these new items:

    +
    $db['default']['cache_on'] = FALSE;
    +$db['default']['cachedir'] = '';
    +
    +
    +
    +
    +

    Step 3: Update your config.php file

    +

    Open your application/config/config.php file and ADD these new items:

    +
    /*
    +|--------------------------------------------------------------------------
    +| Class Extension Prefix
    +|--------------------------------------------------------------------------
    +|
    +| This item allows you to set the filename/classname prefix when extending
    +| native libraries.  For more information please see the user guide:
    +|
    +| https://codeigniter.com/user_guide/general/core_classes.html
    +| https://codeigniter.com/user_guide/general/creating_libraries.html
    +|
    +*/
    +$config['subclass_prefix'] = 'MY_';
    +
    +/*
    +|--------------------------------------------------------------------------
    +| Rewrite PHP Short Tags
    +|--------------------------------------------------------------------------
    +|
    +| If your PHP installation does not have short tag support enabled CI
    +| can rewrite the tags on-the-fly, enabling you to utilize that syntax
    +| in your view files.  Options are TRUE or FALSE (boolean)
    +|
    +*/
    +$config['rewrite_short_tags'] = FALSE;
    +
    +
    +

    In that same file REMOVE this item:

    +
    /*
    +|--------------------------------------------------------------------------
    +| Enable/Disable Error Logging
    +|--------------------------------------------------------------------------
    +|
    +| If you would like errors or debug messages logged set this variable to
    +| TRUE (boolean).  Note: You must set the file permissions on the "logs" folder
    +| such that it is writable.
    +|
    +*/
    +$config['log_errors'] = FALSE;
    +
    +
    +

    Error logging is now disabled simply by setting the threshold to zero.

    +
    +
    +

    Step 4: Update your main index.php file

    +

    If you are running a stock index.php file simply replace your version +with the new one.

    +

    If your index.php file has internal modifications, please add your +modifications to the new file and use it.

    +
    +
    +

    Step 5: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_152.html b/user_guide/installation/upgrade_152.html new file mode 100755 index 0000000..5e2758e --- /dev/null +++ b/user_guide/installation/upgrade_152.html @@ -0,0 +1,536 @@ + + + + + + + + + + Upgrading from 1.5.0 to 1.5.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.5.0 to 1.5.2

    +
    +

    Note

    +

    The instructions on this page assume you are running version +1.5.0 or 1.5.1. If you have not upgraded to that version please do so +first.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/helpers/download_helper.php
    • +
    • system/helpers/form_helper.php
    • +
    • system/libraries/Table.php
    • +
    • system/libraries/User_agent.php
    • +
    • system/libraries/Exceptions.php
    • +
    • system/libraries/Input.php
    • +
    • system/libraries/Router.php
    • +
    • system/libraries/Loader.php
    • +
    • system/libraries/Image_lib.php
    • +
    • system/language/english/unit_test_lang.php
    • +
    • system/database/DB_active_rec.php
    • +
    • system/database/drivers/mysqli/mysqli_driver.php
    • +
    • codeigniter/
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_153.html b/user_guide/installation/upgrade_153.html new file mode 100755 index 0000000..1acb8e2 --- /dev/null +++ b/user_guide/installation/upgrade_153.html @@ -0,0 +1,523 @@ + + + + + + + + + + Upgrading from 1.5.2 to 1.5.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.5.2 to 1.5.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/database/drivers
    • +
    • system/helpers
    • +
    • system/libraries/Input.php
    • +
    • system/libraries/Loader.php
    • +
    • system/libraries/Profiler.php
    • +
    • system/libraries/Table.php
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_154.html b/user_guide/installation/upgrade_154.html new file mode 100755 index 0000000..ff6fae1 --- /dev/null +++ b/user_guide/installation/upgrade_154.html @@ -0,0 +1,547 @@ + + + + + + + + + + Upgrading from 1.5.3 to 1.5.4 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.5.3 to 1.5.4

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • application/config/mimes.php
    • +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/libraries
    • +
    • system/plugins
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Add charset to your config.php

    +

    Add the following to application/config/config.php

    +
    /*
    +|--------------------------------------------------------------------------
    +| Default Character Set
    +|--------------------------------------------------------------------------
    +|
    +| This determines which character set is used by default in various methods
    +| that require a character set to be provided.
    +|
    +*/
    +$config['charset'] = "UTF-8";
    +
    +
    +
    +
    +

    Step 3: Autoloading language files

    +

    If you want to autoload any language files, add this line to +application/config/autoload.php

    +
    $autoload['language'] = array();
    +
    +
    +
    +
    +

    Step 4: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_160.html b/user_guide/installation/upgrade_160.html new file mode 100755 index 0000000..0f599ff --- /dev/null +++ b/user_guide/installation/upgrade_160.html @@ -0,0 +1,566 @@ + + + + + + + + + + Upgrading from 1.5.4 to 1.6.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.5.4 to 1.6.0

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/libraries
    • +
    • system/plugins
    • +
    • system/language
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Add time_to_update to your config.php

    +

    Add the following to application/config/config.php with the other +session configuration options

    +
    $config['sess_time_to_update']         = 300;
    +
    +
    +
    +
    +

    Step 3: Add $autoload[‘model’]

    +

    Add the following to application/config/autoload.php

    +
    /*
    +| -------------------------------------------------------------------
    +| Auto-load Model files
    +| -------------------------------------------------------------------
    +| Prototype:
    +|
    +| $autoload['model'] = array('my_model');
    +|
    +*/
    +
    +$autoload['model'] = array();
    +
    +
    +
    +
    +

    Step 4: Add to your database.php

    +

    Make the following changes to your application/config/database.php file:

    +

    Add the following variable above the database configuration options, +with $active_group

    +
    $active_record = TRUE;
    +
    +
    +

    Remove the following from your database configuration options

    +
    $db['default']['active_r'] = TRUE;
    +
    +
    +

    Add the following to your database configuration options

    +
    $db['default']['char_set'] = "utf8";
    +$db['default']['dbcollat'] = "utf8_general_ci";
    +
    +
    +
    +
    +

    Step 5: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_161.html b/user_guide/installation/upgrade_161.html new file mode 100755 index 0000000..24ce0f1 --- /dev/null +++ b/user_guide/installation/upgrade_161.html @@ -0,0 +1,522 @@ + + + + + + + + + + Upgrading from 1.6.0 to 1.6.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.6.0 to 1.6.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_162.html b/user_guide/installation/upgrade_162.html new file mode 100755 index 0000000..a47736e --- /dev/null +++ b/user_guide/installation/upgrade_162.html @@ -0,0 +1,537 @@ + + + + + + + + + + Upgrading from 1.6.1 to 1.6.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.6.1 to 1.6.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Encryption Key

    +

    If you are using sessions, open up application/config/config.php and +verify you’ve set an encryption key.

    +
    +
    +

    Step 3: Constants File

    +

    Copy /application/config/constants.php to your installation, and modify +if necessary.

    +
    +
    +

    Step 4: Mimes File

    +

    Replace /application/config/mimes.php with the dowloaded version. If +you’ve added custom mime types, you’ll need to re-add them.

    +
    +
    +

    Step 5: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_163.html b/user_guide/installation/upgrade_163.html new file mode 100755 index 0000000..a7f8963 --- /dev/null +++ b/user_guide/installation/upgrade_163.html @@ -0,0 +1,522 @@ + + + + + + + + + + Upgrading from 1.6.2 to 1.6.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.6.2 to 1.6.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_170.html b/user_guide/installation/upgrade_170.html new file mode 100755 index 0000000..77c82e1 --- /dev/null +++ b/user_guide/installation/upgrade_170.html @@ -0,0 +1,549 @@ + + + + + + + + + + Upgrading from 1.6.3 to 1.7.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.6.3 to 1.7.0

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your Session Table

    +

    If you are using the Session class in your application, AND if you are +storing session data to a database, you must add a new column named +user_data to your session table. Here is an example of what this column +might look like for MySQL:

    +
    user_data text NOT NULL
    +
    +
    +

    To add this column you will run a query similar to this:

    +
    ALTER TABLE `ci_sessions` ADD `user_data` text NOT NULL
    +
    +
    +

    You’ll find more information regarding the new Session functionality in +the Session class page.

    +
    +
    +

    Step 3: Update your Validation Syntax

    +

    This is an optional, but recommended step, for people currently +using the Validation class. CI 1.7 introduces a new Form Validation +class, which deprecates the old +Validation library. We have left the old one in place so that existing +applications that use it will not break, but you are encouraged to +migrate to the new version as soon as possible. Please read the user +guide carefully as the new library works a little differently, and has +several new features.

    +
    +
    +

    Step 4: Update your user guide

    +

    Please replace your local copy of the user guide with the new version, +including the image files.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_171.html b/user_guide/installation/upgrade_171.html new file mode 100755 index 0000000..4e510d8 --- /dev/null +++ b/user_guide/installation/upgrade_171.html @@ -0,0 +1,522 @@ + + + + + + + + + + Upgrading from 1.7.0 to 1.7.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.7.0 to 1.7.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please replace your local copy of the user guide with the new version, +including the image files.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_172.html b/user_guide/installation/upgrade_172.html new file mode 100755 index 0000000..4e6bf5c --- /dev/null +++ b/user_guide/installation/upgrade_172.html @@ -0,0 +1,539 @@ + + + + + + + + + + Upgrading from 1.7.1 to 1.7.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.7.1 to 1.7.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace these files and directories in your “system” folder with the new +versions:

    +
      +
    • system/codeigniter
    • +
    • system/database
    • +
    • system/helpers
    • +
    • system/language
    • +
    • system/libraries
    • +
    • index.php
    • +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Remove header() from 404 error template

    +

    If you are using header() in your 404 error template, such as the case +with the default error_404.php template shown below, remove that line +of code.

    +
    <?php header("HTTP/1.1 404 Not Found"); ?>
    +
    +
    +

    404 status headers are now properly handled in the show_404() method +itself.

    +
    +
    +

    Step 3: Confirm your system_path

    +

    In your updated index.php file, confirm that the $system_path variable +is set to your application’s system folder.

    +
    +
    +

    Step 4: Update your user guide

    +

    Please replace your local copy of the user guide with the new version, +including the image files.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_200.html b/user_guide/installation/upgrade_200.html new file mode 100755 index 0000000..34d9a2d --- /dev/null +++ b/user_guide/installation/upgrade_200.html @@ -0,0 +1,632 @@ + + + + + + + + + + Upgrading from 1.7.2 to 2.0.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 1.7.2 to 2.0.0

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Update Instructions

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder except +your application folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Adjust get_dir_file_info() where necessary

    +

    Version 2.0.0 brings a non-backwards compatible change to +get_dir_file_info() in the File +Helper. Non-backwards compatible changes +are extremely rare in CodeIgniter, but this one we feel was warranted +due to how easy it was to create serious server performance issues. If +you need recursiveness where you are using this helper function, +change such instances, setting the second parameter, $top_level_only +to FALSE:

    +
    get_dir_file_info('/path/to/directory', FALSE);
    +
    +
    +
    +
    +

    Step 3: Convert your Plugins to Helpers

    +

    2.0.0 gets rid of the “Plugin” system as their functionality was +identical to Helpers, but non-extensible. You will need to rename your +plugin files from filename_pi.php to filename_helper.php, move them to +your helpers folder, and change all instances of:

    +
    $this->load->plugin('foo');
    +
    +
    +

    to

    +
    $this->load->helper('foo');
    +
    +
    +
    +
    +

    Step 4: Update stored encrypted data

    +
    +

    Note

    +

    If your application does not use the Encrypt library, does +not store Encrypted data permanently, or is on an environment that does +not support Mcrypt, you may skip this step.

    +
    +

    The Encrypt library has had a number of improvements, some for +encryption strength and some for performance, that has an unavoidable +consequence of making it no longer possible to decode encrypted data +produced by the original version of this library. To help with the +transition, a new method has been added, encode_from_legacy() that +will decode the data with the original algorithm and return a re-encoded +string using the improved methods. This will enable you to easily +replace stale encrypted data with fresh in your applications, either on +the fly or en masse.

    +

    Please read how to use this +method in the Encrypt library +documentation.

    +
    +
    +

    Step 5: Remove loading calls for the compatibility helper.

    +

    The compatibility helper has been removed from the CodeIgniter core. All +methods in it should be natively available in supported PHP versions.

    +
    +
    +

    Step 6: Update Class extension

    +

    All core classes are now prefixed with CI_. Update Models and +Controllers to extend CI_Model and CI_Controller, respectively.

    +
    +
    +

    Step 7: Update Parent Constructor calls

    +

    All native CodeIgniter classes now use the PHP 5 __construct() +convention. Please update extended libraries to call +parent::__construct().

    +
    +
    +

    Step 8: Move any core extensions to application/core

    +

    Any extensions to core classes (e.g. MY_Controller.php) in your +application/libraries folder must be moved to the new +application/core folder.

    +
    +
    +

    Step 9: Update your user guide

    +

    Please replace your local copy of the user guide with the new version, +including the image files.

    +
    +
    +
    +

    Update Notes

    +

    Please refer to the 2.0.0 Change Log for full +details, but here are some of the larger changes that are more likely to +impact your code:

    +
      +
    • Scaffolding has been removed.
    • +
    • The CAPTCHA plugin in now a helper.
    • +
    • The JavaScript calendar plugin was removed.
    • +
    • The system/cache and system/logs directories are now in the application +directory.
    • +
    • The Validation class has been removed. Please see the +Form Validation library
    • +
    • “default” is now a reserved name.
    • +
    • The xss_clean() function has moved to the Security Class.
    • +
    • do_xss_clean() now returns FALSE if the uploaded file fails XSS checks.
    • +
    • The Session Class requires now the use of an +encryption key set in the config file.
    • +
    • The following deprecated Active Record functions have been removed: +orwhere, orlike, groupby, orhaving, orderby, +getwhere.
    • +
    • _drop_database() and _create_database() functions have been removed +from the db utility drivers.
    • +
    • The dohash() function of the Security helper +has been renamed to do_hash() for naming consistency.
    • +
    +
    +

    The config folder

    +

    The following files have been changed:

    +
      +
    • config.php
    • +
    • database.php
    • +
    • mimes.php
    • +
    • routes.php
    • +
    • user_agents.php
    • +
    +

    The following files have been added:

    +
      +
    • foreign_chars.php
    • +
    • profiler.php
    • +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_201.html b/user_guide/installation/upgrade_201.html new file mode 100755 index 0000000..db54153 --- /dev/null +++ b/user_guide/installation/upgrade_201.html @@ -0,0 +1,532 @@ + + + + + + + + + + Upgrading from 2.0.0 to 2.0.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.0.0 to 2.0.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder and replace +your index.php file. If any modifications were made to your index.php +they will need to be made fresh in this new one.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Replace config/mimes.php

    +

    This config file has been updated to contain more mime types, please +copy it to application/config/mimes.php.

    +
    +
    +

    Step 3: Check for forms posting to default controller

    +

    The default behavior for form_open() when called with no parameters +used to be to post to the default controller, but it will now just leave +an empty action=”” meaning the form will submit to the current URL. If +submitting to the default controller was the expected behavior it will +need to be changed from:

    +
    echo form_open(); //<form action="" method="post" accept-charset="utf-8">
    +
    +
    +

    to use either a / or base_url():

    +
    echo form_open('/'); //<form action="http://example.com/index.php/" method="post" accept-charset="utf-8">
    +echo form_open(base_url()); //<form action="http://example.com/" method="post" accept-charset="utf-8">
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_202.html b/user_guide/installation/upgrade_202.html new file mode 100755 index 0000000..181cefe --- /dev/null +++ b/user_guide/installation/upgrade_202.html @@ -0,0 +1,525 @@ + + + + + + + + + + Upgrading from 2.0.1 to 2.0.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.0.1 to 2.0.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder and replace +your index.php file. If any modifications were made to your index.php +they will need to be made fresh in this new one.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Remove loading calls for the Security Library

    +

    Security has been moved to the core and is now always loaded +automatically. Make sure you remove any loading calls as they will +result in PHP errors.

    +
    +
    +

    Step 3: Move MY_Security

    +

    If you are overriding or extending the Security library, you will need +to move it to application/core.

    +

    csrf_token_name and csrf_hash have changed to protected class +properties. Please use security->get_csrf_hash() and +security->get_csrf_token_name() to access those values.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html new file mode 100755 index 0000000..2e1a2fd --- /dev/null +++ b/user_guide/installation/upgrade_203.html @@ -0,0 +1,555 @@ + + + + + + + + + + Upgrading from 2.0.2 to 2.0.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.0.2 to 2.0.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder and replace +your index.php file. If any modifications were made to your index.php +they will need to be made fresh in this new one.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your main index.php file

    +

    If you are running a stock index.php file simply replace your version +with the new one.

    +

    If your index.php file has internal modifications, please add your +modifications to the new file and use it.

    +
    +
    +

    Step 3: Replace config/user_agents.php

    +

    This config file has been updated to contain more user agent types, +please copy it to application/config/user_agents.php.

    +
    +
    +

    Step 4: Change references of the EXT constant to “.php”

    +
    +

    Note

    +

    The EXT Constant has been marked as deprecated, but has not +been removed from the application. You are encouraged to make the +changes sooner rather than later.

    +
    +
    +
    +

    Step 5: Remove APPPATH.’third_party’ from autoload.php

    +

    Open application/config/autoload.php, and look for the following:

    +
    $autoload['packages'] = array(APPPATH.'third_party');
    +
    +
    +

    If you have not chosen to load any additional packages, that line can be +changed to:

    +
    $autoload['packages'] = array();
    +
    +
    +

    Which should provide for nominal performance gains if not autoloading +packages.

    +
    +
    +

    Update Sessions Database Tables

    +

    If you are using database sessions with the CI Session Library, please +update your ci_sessions database table as follows:

    +
    CREATE INDEX last_activity_idx ON ci_sessions(last_activity);
    +ALTER TABLE ci_sessions MODIFY user_agent VARCHAR(120);
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_210.html b/user_guide/installation/upgrade_210.html new file mode 100755 index 0000000..ea3f8e1 --- /dev/null +++ b/user_guide/installation/upgrade_210.html @@ -0,0 +1,519 @@ + + + + + + + + + + Upgrading from 2.0.3 to 2.1.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.0.3 to 2.1.0

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Replace config/mimes.php

    +

    This config file has been updated to contain more user agent types, +please copy it to application/config/mimes.php.

    +
    +
    +

    Step 3: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_211.html b/user_guide/installation/upgrade_211.html new file mode 100755 index 0000000..c2ef3b8 --- /dev/null +++ b/user_guide/installation/upgrade_211.html @@ -0,0 +1,523 @@ + + + + + + + + + + Upgrading from 2.1.0 to 2.1.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.1.0 to 2.1.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Replace config/mimes.php

    +

    This config file has been updated to contain more user mime-types, please copy +it to _application/config/mimes.php*.

    +
    +
    +

    Step 3: Update your IP address tables

    +

    This upgrade adds support for IPv6 IP addresses. In order to store them, you need +to enlarge your ip_address columns to 45 characters. For example, CodeIgniter’s +session table will need to change

    +
    ALTER TABLE ci_sessions CHANGE ip_address ip_address varchar(45) default '0' NOT NULL
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_212.html b/user_guide/installation/upgrade_212.html new file mode 100755 index 0000000..dce4e80 --- /dev/null +++ b/user_guide/installation/upgrade_212.html @@ -0,0 +1,514 @@ + + + + + + + + + + Upgrading from 2.1.1 to 2.1.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.1.1 to 2.1.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_213.html b/user_guide/installation/upgrade_213.html new file mode 100755 index 0000000..8b3c448 --- /dev/null +++ b/user_guide/installation/upgrade_213.html @@ -0,0 +1,514 @@ + + + + + + + + + + Upgrading from 2.1.2 to 2.1.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.1.2 to 2.1.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your user guide

    +

    Please also replace your local copy of the user guide with the new +version.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_214.html b/user_guide/installation/upgrade_214.html new file mode 100755 index 0000000..6f74485 --- /dev/null +++ b/user_guide/installation/upgrade_214.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 2.1.3 to 2.1.4 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.1.3 to 2.1.4

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_220.html b/user_guide/installation/upgrade_220.html new file mode 100755 index 0000000..272007a --- /dev/null +++ b/user_guide/installation/upgrade_220.html @@ -0,0 +1,518 @@ + + + + + + + + + + Upgrading from 2.1.4 to 2.2.x — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.1.4 to 2.2.x

    +
    +

    Note

    +

    The Encrypt Class now requires the +Mcrypt extension. If you were previously using the Encrypt Class +without Mcrypt, then this is a breaking change. You must install +the Mcrypt extension in order to upgrade. For information on +installing Mcrypt please see the PHP documentation +<http://php.net/manual/en/mcrypt.setup.php>.

    +
    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_221.html b/user_guide/installation/upgrade_221.html new file mode 100755 index 0000000..883df1b --- /dev/null +++ b/user_guide/installation/upgrade_221.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 2.2.0 to 2.2.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.2.0 to 2.2.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_222.html b/user_guide/installation/upgrade_222.html new file mode 100755 index 0000000..ff4590a --- /dev/null +++ b/user_guide/installation/upgrade_222.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 2.2.1 to 2.2.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.2.1 to 2.2.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_223.html b/user_guide/installation/upgrade_223.html new file mode 100755 index 0000000..ab03ee7 --- /dev/null +++ b/user_guide/installation/upgrade_223.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 2.2.2 to 2.2.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.2.2 to 2.2.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your “system” folder.

    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_300.html b/user_guide/installation/upgrade_300.html new file mode 100755 index 0000000..60f866c --- /dev/null +++ b/user_guide/installation/upgrade_300.html @@ -0,0 +1,1330 @@ + + + + + + + + + + Upgrading from 2.2.x to 3.0.x — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 2.2.x to 3.0.x

    +

    Before performing an update you should take your site offline by replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory and +replace your index.php file. If any modifications were made to your +index.php they will need to be made fresh in this new one.

    +
    +

    Important

    +

    You have to delete the old system/ directory first and +then put the new one in its place. A simple copy-paste may cause +issues.

    +
    +
    +

    Note

    +

    If you have any custom developed files in these folders please +make copies of them first.

    +
    +
    +
    +

    Step 2: Update your classes file names

    +

    Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers +and models) must be named in a Ucfirst-like manner or in other words - they must +start with a capital letter.

    +

    For example, if you have the following library file:

    +
    +
    application/libraries/mylibrary.php
    +

    … then you’ll have to rename it to:

    +
    +
    application/libraries/Mylibrary.php
    +

    The same goes for driver libraries and extensions and/or overrides of CodeIgniter’s +own libraries and core classes.

    +
    +
    application/libraries/MY_email.php +application/core/MY_log.php
    +

    The above files should respectively be renamed to the following:

    +
    +
    application/libraries/MY_Email.php +application/core/MY_Log.php
    +

    Controllers:

    +
    +
    application/controllers/welcome.php -> application/controllers/Welcome.php
    +

    Models:

    +
    +
    application/models/misc_model.php -> application/models/Misc_model.php
    +

    Please note that this DOES NOT affect directories, configuration files, views, +helpers, hooks and anything else - it is only applied to classes.

    +

    You must now follow just one simple rule - class names in Ucfirst and everything else +in lowercase.

    +
    +
    +

    Step 3: Replace config/mimes.php

    +

    This config file has been updated to contain more user mime-types, please copy +it to application/config/mimes.php.

    +
    +
    +

    Step 4: Remove $autoload[‘core’] from your config/autoload.php

    +

    Use of the $autoload['core'] config array has been deprecated as of CodeIgniter 1.4.1 and is now removed. +Move any entries that you might have listed there to $autoload['libraries'] instead.

    +
    +
    +

    Step 5: Move your Log class overrides or extensions

    +

    The Log Class is considered as a “core” class and is now located in the +system/core/ directory. Therefore, in order for your Log class overrides +or extensions to work, you need to move them to application/core/:

    +
    +
    application/libraries/Log.php -> application/core/Log.php +application/libraries/MY_Log.php -> application/core/MY_Log.php
    +
    +
    +

    Step 6: Update your Session library usage

    +

    The Session Library has been completely +re-written in CodeIgniter 3 and now comes with a bunch of new features, +but that also means that there are changes that you should make …

    +

    Most notably, the library now uses separate storage drivers instead of +always relying on (encrypted) cookies. +In fact, cookies as storage have now been removed and you must always use +some kind of server-side storage engine, with the file-system being the +default option.

    +

    The Session Class now utilizes PHP’s own mechanisms for building custom +session handlers, which also means that your session data is now +accessible via the $_SESSION superglobal (though, we’ve kept the +possibility to use it as “userdata”, like you’ve done until now).

    +

    A few configuration options have been removed and a few have been added. +You should really read the whole Session library manual for the details, but here’s a short list of changes +that you should make:

    +
    +
      +
    • Set your $config['sess_driver'] value

      +

      It will default to ‘files’, unless you’ve previously used +$config['sess_use_database'], in which case it will be set to +‘database’.

      +
    • +
    • Set a $config['sess_save_path'] value

      +

      For the ‘database’ driver, a fallback to $config['sess_table_name'] +is in place, but otherwise requires you to read the manual for the +specific driver of your choice.

      +
    • +
    • Update your ci_sessions table (‘database’ driver only)

      +

      The table structure has changed a bit, and more specifically:

      +
      +
        +
      • session_id field is renamed to id
      • +
      • user_agent field is dropped
      • +
      • user_data field is renamed to data and under MySQL is now of type BLOB
      • +
      • last_activity field is renamed to timestamp
      • +
      +
      +

      This is accompanied by a slight change in the table indexes too, so +please read the manual about the Session Database Driver for more information.

      +
      +

      Important

      +

      Only MySQL and PostgreSQL are officially supported +now. Other databases may still work, but due to lack of advisory +locking features, they are unsafe for concurrent requests and +you should consider using another driver instead.

      +
      +
    • +
    • Remove $config['sess_match_useragent']

      +

      The user-agent string is input supplied by the user’s browser, or in +other words: client side input. As such, it is an ineffective feature +and hence why it has been removed.

      +
    • +
    • Remove $config['sess_encrypt_cookie']

      +

      As already noted, the library no longer uses cookies as a storage +mechanism, which renders this option useless.

      +
    • +
    • Remove $config['sess_expire_on_close']

      +

      This option is still usable, but only for backwards compatibility +purposes and it should be otherwise removed. The same effect is +achieved by setting $config['sess_expiration'] to 0.

      +
    • +
    • Check “flashdata” for collisions with “userdata”

      +

      Flashdata is now just regular “userdata”, only marked for deletion on +the next request. In other words: you can’t have both “userdata” and +“flashdata” with the same name, because it’s the same thing.

      +
    • +
    • Check usage of session metadata

      +

      Previously, you could access the ‘session_id’, ‘ip_address’, +‘user_agent’ and ‘last_activity’ metadata items as userdata. +This is no longer possible, and you should read the notes about +Session Metadata +if your application relies on those values.

      +
    • +
    • Check unset_userdata() usage

      +

      Previously, this method used to accept an associative array of +'key' => 'dummy value' pairs for unsetting multiple keys. That +however makes no sense and you now have to pass only the keys, as +the elements of an array.

      +
      // Old
      +$this->session->unset_userdata(array('item' => '', 'item2' => ''));
      +
      +// New
      +$this->session->unset_userdata(array('item', 'item2'));
      +
      +
      +
    • +
    +
    +

    Finally, if you have written a Session extension, you must now move it to +the application/libraries/Session/ directory, although chances are that +it will now also have to be re-factored.

    +
    +
    +

    Step 7: Update your config/database.php

    +

    Due to 3.0.0’s renaming of Active Record to Query Builder, inside your +config/database.php, you will need to rename the $active_record +variable to $query_builder:

    +
    $active_group = 'default';
    +// $active_record = TRUE;
    +$query_builder = TRUE;
    +
    +
    +
    +
    +

    Step 8: Replace your error templates

    +

    In CodeIgniter 3.0, the error templates are now considered as views and have been moved to the +application/views/errors directory.

    +

    Furthermore, we’ve added support for CLI error templates in plain-text format that unlike HTML, +is suitable for the command line. This of course requires another level of separation.

    +

    It is safe to move your old templates from application/errors to application/views/errors/html, +but you’ll have to copy the new application/views/errors/cli directory from the CodeIgniter archive.

    +
    +
    +

    Step 9: Update your config/routes.php file

    +
    +

    Routes containing :any

    +

    Historically, CodeIgniter has always provided the :any wildcard in +routing, with the intention of providing a way to match any character +within an URI segment.

    +

    However, the :any wildcard is actually just an alias for a regular +expression and used to be executed in that manner as .+. This is +considered a bug, as it also matches the / (forward slash) character, which +is the URI segment delimiter and that was never the intention.

    +

    In CodeIgniter 3, the :any wildcard will now represent [^/]+, so +that it will not match a forward slash.

    +

    There are certainly many developers that have utilized this bug as an actual +feature. If you’re one of them and want to match a forward slash, please use +the .+ regular expression:

    +
    (.+)    // matches ANYTHING
    +(:any)  // matches any character, except for '/'
    +
    +
    +
    +
    +

    Directories and ‘default_controller’, ‘404_override’

    +

    As you should know, the $route['default_controller'] and +$route['404_override'] settings accept not only a controller name, but +also controller/method pairs. However, a bug in the routing logic has +made it possible for some users to use that as directory/controller +instead.

    +

    As already said, this behavior was incidental and was never intended, nor +documented. If you’ve relied on it, your application will break with +CodeIgniter 3.0.

    +

    Another notable change in version 3 is that ‘default_controller’ and +‘404_override’ are now applied per directory. To explain what this means, +let’s take the following example:

    +
    $route['default_controller'] = 'main';
    +
    +
    +

    Now, assuming that your website is located at example.com, you already +know that if a user visits http://example.com/, the above setting will +cause your ‘Main’ controller to be loaded.

    +

    However, what happens if you have an application/controllers/admin/ +directory and the user visits http://example.com/admin/? +In CodeIgniter 3, the router will look for a ‘Main’ controller under the +admin/ directory as well. If not found, a Not Found (404) will be triggered.

    +

    The same rule applies to the ‘404_override’ setting.

    +
    +
    +
    +

    Step 10: Many functions now return NULL instead of FALSE on missing items

    +

    Many methods and functions now return NULL instead of FALSE when the required items don’t exist:

    +
    +
      +
    • Common functions
        +
      • config_item()
      • +
      +
    • +
    • Config Class
        +
      • config->item()
      • +
      • config->slash_item()
      • +
      +
    • +
    • Input Class
        +
      • input->get()
      • +
      • input->post()
      • +
      • input->get_post()
      • +
      • input->cookie()
      • +
      • input->server()
      • +
      • input->input_stream()
      • +
      • input->get_request_header()
      • +
      +
    • +
    • Session Class
        +
      • session->userdata()
      • +
      • session->flashdata()
      • +
      +
    • +
    • URI Class
        +
      • uri->segment()
      • +
      • uri->rsegment()
      • +
      +
    • +
    • Array Helper
        +
      • element()
      • +
      • elements()
      • +
      +
    • +
    +
    +
    +
    +

    Step 11: Usage of XSS filtering

    +

    Many functions in CodeIgniter allow you to use its XSS filtering feature +on demand by passing a boolean parameter. The default value of that +parameter used to be boolean FALSE, but it is now changed to NULL and it +will be dynamically determined by your $config['global_xss_filtering'] +value.

    +

    If you used to manually pass a boolean value for the $xss_filter +parameter or if you’ve always had $config['global_xss_filtering'] set +to FALSE, then this change doesn’t concern you.

    +

    Otherwise however, please review your usage of the following functions:

    +
    +
    +
    +
    +

    Important

    +

    Another related change is that the $_GET, $_POST, +$_COOKIE and $_SERVER superglobals are no longer +automatically overwritten when global XSS filtering is turned on.

    +
    +
    +
    +

    Step 12: Check for potential XSS issues with URIs

    +

    The URI Library used to automatically convert +a certain set of “programmatic characters” to HTML entities when they +are encountered in a URI segment.

    +

    This was aimed at providing some automatic XSS protection, in addition +to the $config['permitted_uri_chars'] setting, but has proven to be +problematic and is now removed in CodeIgniter 3.0.

    +

    If your application has relied on this feature, you should update it to +filter URI segments through $this->security->xss_clean() whenever you +output them.

    +
    +
    +

    Step 13: Check for usage of the ‘xss_clean’ Form validation rule

    +

    A largely unknown rule about XSS cleaning is that it should only be +applied to output, as opposed to input data.

    +

    We’ve made that mistake ourselves with our automatic and global XSS cleaning +feature (see previous step about XSS above), so now in an effort to discourage that +practice, we’re also removing ‘xss_clean’ from the officially supported +list of form validation rules.

    +

    Because the Form Validation library +generally validates input data, the ‘xss_clean’ rule simply doesn’t +belong in it.

    +

    If you really, really need to apply that rule, you should now also load the +Security Helper, which contains +xss_clean() as a regular function and therefore can be also used as +a validation rule.

    +
    +
    +

    Step 14: Update usage of Input Class’s get_post() method

    +

    Previously, the Input Class method get_post() +was searching first in POST data, then in GET data. This method has been +modified so that it searches in GET then in POST, as its name suggests.

    +

    A method has been added, post_get(), which searches in POST then in GET, as +get_post() was doing before.

    +
    +
    +

    Step 15: Update usage of Directory Helper’s directory_map() function

    +

    In the resulting array, directories now end with a trailing directory +separator (i.e. a slash, usually).

    +
    +
    +

    Step 16: Update usage of Database Forge’s drop_table() method

    +

    Up until now, drop_table() added an IF EXISTS clause by default or it didn’t work +at all with some drivers. In CodeIgniter 3.0, the IF EXISTS condition is no longer added +by default and has an optional second parameter that allows that instead and is set to +FALSE by default.

    +

    If your application relies on IF EXISTS, you’ll have to change its usage.

    +
    // Now produces just DROP TABLE `table_name`
    +$this->dbforge->drop_table('table_name');
    +
    +// Produces DROP TABLE IF EXISTS `table_name`
    +$this->dbforge->drop_table('table_name', TRUE);
    +
    +
    +
    +

    Note

    +

    The given example uses MySQL-specific syntax, but it should work across +all drivers with the exception of ODBC.

    +
    +
    +
    +

    Step 17: Change usage of Email library with multiple emails

    +

    The Email Library will automatically clear the +set parameters after successfully sending emails. To override this behaviour, +pass FALSE as the first parameter in the send() method:

    +
    if ($this->email->send(FALSE))
    +{
    +        // Parameters won't be cleared
    +}
    +
    +
    +
    +
    +

    Step 18: Update your Form_validation language lines

    +

    Two improvements have been made to the Form Validation Library’s language +files and error messages format:

    +
    +
      +
    • Language Library line keys now must be +prefixed with form_validation_ in order to avoid collisions:

      +
      // Old
      +$lang['rule'] = ...
      +
      +// New
      +$lang['form_validation_rule'] = ...
      +
      +
      +
    • +
    • The error messages format has been changed to use named parameters, to +allow more flexibility than what sprintf() offers:

      +
      // Old
      +'The %s field does not match the %s field.'
      +
      +// New
      +'The {field} field does not match the {param} field.'
      +
      +
      +
    • +
    +
    +
    +

    Note

    +

    The old formatting still works, but the non-prefixed line keys +are DEPRECATED and scheduled for removal in CodeIgniter 3.1+. +Therefore you’re encouraged to update its usage sooner rather than +later.

    +
    +
    +
    +

    Step 19: Make sure your ‘base_url’ config value is not empty

    +

    When $config['base_url'] is not set, CodeIgniter tries to automatically +detect what your website’s base URL is. This is done purely for convenience +when you are starting development of a new application.

    +

    Auto-detection is never reliable and also has security implications, which +is why you should always have it manually configured!

    +

    One of the changes in CodeIgniter 3.0.3 is how this auto-detection works, +and more specifically it now falls back to the server’s IP address instead +of the hostname requested by the client. Therefore, if you’ve ever relied +on auto-detection, it will change how your website works now.

    +

    In case you need to allow e.g. multiple domains, or both http:// and +https:// prefixes to be dynamically used depending on the request, +remember that application/config/config.php is still a PHP script, in +which you can create this logic with a few lines of code. For example:

    +
    $allowed_domains = array('domain1.tld', 'domain2.tld');
    +$default_domain  = 'domain1.tld';
    +
    +if (in_array($_SERVER['HTTP_HOST'], $allowed_domains, TRUE))
    +{
    +        $domain = $_SERVER['HTTP_HOST'];
    +}
    +else
    +{
    +        $domain = $default_domain;
    +}
    +
    +if ( ! empty($_SERVER['HTTPS']))
    +{
    +        $config['base_url'] = 'https://'.$domain;
    +}
    +else
    +{
    +        $config['base_url'] = 'http://'.$domain;
    +}
    +
    +
    +
    +
    +

    Step 20: Remove usage of (previously) deprecated functionalities

    +

    In addition to the $autoload['core'] configuration setting, there’s a +number of other functionalities that have been removed in CodeIgniter 3.0.0:

    +
    +

    The SHA1 library

    +

    The previously deprecated SHA1 library has been removed, alter your code to use PHP’s native +sha1() function to generate a SHA1 hash.

    +

    Additionally, the sha1() method in the Encrypt Library has been removed.

    +
    +
    +

    The EXT constant

    +

    Usage of the EXT constant has been deprecated since dropping support for PHP 4. There’s no +longer a need to maintain different filename extensions and in this new CodeIgniter version, +the EXT constant has been removed. Use just ‘.php’ instead.

    +
    +
    +

    Smiley helper

    +

    The Smiley Helper is a legacy feature from EllisLab’s +ExpressionEngine product. However, it is too specific for a general purpose framework like +CodeIgniter and as such it is now deprecated.

    +

    Also, the previously deprecated js_insert_smiley() (since version 1.7.2) is now removed.

    +
    +
    +

    The Encrypt library

    +

    Following numerous vulnerability reports, the Encrypt Library has +been deprecated and a new, Encryption Library is added to take +its place.

    +

    The new library requires either the MCrypt extension (and /dev/urandom +availability) or PHP 5.3.3 and the OpenSSL extension. +While this might be rather inconvenient, it is a requirement that allows us to have properly +implemented cryptographic functions.

    +
    +

    Note

    +

    The Encrypt Library is still available for the purpose +of keeping backwards compatibility.

    +
    +
    +

    Important

    +

    You are strongly encouraged to switch to the new Encryption Library as soon as possible!

    +
    +
    +
    +

    The Cart library

    +

    The Cart Library, similarly to the Smiley Helper is too specific for CodeIgniter. It is now deprecated +and scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    The library is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    Database drivers ‘mysql’, ‘sqlite’, ‘mssql’, ‘pdo/dblib’

    +

    The mysql driver utilizes the old ‘mysql’ PHP extension, known for its aging code base and +many low-level problems. The extension is deprecated as of PHP 5.5 and CodeIgniter deprecates +it in version 3.0, switching the default configured MySQL driver to mysqli.

    +

    Please use either the ‘mysqli’ or ‘pdo/mysql’ drivers for MySQL. The old ‘mysql’ driver will be +removed at some point in the future.

    +

    The sqlite, mssql and pdo/dblib (also known as pdo/mssql or pdo/sybase) drivers +all depend on PHP extensions that for different reasons no longer exist since PHP 5.3.

    +

    Therefore we are now deprecating these drivers as we will have to remove them in one of the next +CodeIgniter versions. You should use the more advanced, sqlite3, sqlsrv or pdo/sqlsrv +drivers respectively.

    +
    +

    Note

    +

    These drivers are still available, but you’re strongly encouraged to switch to other ones +sooner rather than later.

    +
    +
    +
    +

    Security helper do_hash()

    +

    Security Helper function do_hash() is now just an alias for +PHP’s native hash() function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    The $config[‘global_xss_filtering’] setting

    +

    As already explained above, XSS filtering should not be done on input data, +but on output instead. Therefore, the $config['global_xss_filtering'], +which automatically filters input data, is considered a bad practice and +is now deprecated.

    +

    Instead, you should manually escape any user-provided data via the +xss_clean() function when you need to output it, or use a +library like HTML Purifier that does that +for you.

    +
    +

    Note

    +

    The setting is still available, but you’re strongly encouraged to +remove its usage sooner rather than later.

    +
    +
    +
    +

    File helper read_file()

    +

    File Helper function read_file() is now just an alias for +PHP’s native file_get_contents() function. It is deprecated and scheduled for removal in +CodeIgniter 3.1+.

    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    String helper repeater()

    +

    String Helper function repeater() is now just an alias for +PHP’s native str_repeat() function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    String helper trim_slashes()

    +

    String Helper function trim_slashes() is now just an alias +for PHP’s native trim() function (with a slash passed as its second argument). It is deprecated and +scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    Form helper form_prep()

    +

    Form Helper function form_prep() +is now just an alias for common function +html_escape(). It is deprecated and will be removed in the future.

    +

    Please use html_escape() instead.

    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged +to remove its usage sooner rather than later.

    +
    +
    +
    +

    Email helper functions

    +

    Email Helper only has two functions

    +
    +
    +

    Both of them are now aliases for PHP’s native filter_var() and mail() functions, respectively. +Therefore the Email Helper altogether is being deprecated and +is scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    These functions are still available, but you’re strongly encouraged to remove their usage +sooner rather than later.

    +
    +
    +
    +

    Date helper standard_date()

    +

    Date Helper function standard_date() is being deprecated due +to the availability of native PHP constants, +which when combined with date() provide the same functionality. Furthermore, they have the +exact same names as the ones supported by standard_date(). Here are examples of how to replace +its usage:

    +
    // Old way
    +standard_date(); // defaults to standard_date('DATE_RFC822', now());
    +
    +// Replacement
    +date(DATE_RFC822, now());
    +
    +// Old way
    +standard_date('DATE_ATOM', $time);
    +
    +// Replacement
    +date(DATE_ATOM, $time);
    +
    +
    +
    +

    Note

    +

    This function is still available, but you’re strongly encouraged to remove its usage sooner +rather than later as it is scheduled for removal in CodeIgniter 3.1+.

    +
    +
    +
    +

    HTML helpers nbs(), br()

    +

    HTML Helper functions nbs() and br() are just aliases +for the native str_repeat() function used with &nbsp; and <br > respectively.

    +

    Because there’s no point in just aliasing native PHP functions, they are now deprecated and +scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    These functions are still available, but you’re strongly encouraged to remove their usage +sooner rather than later.

    +
    +
    +
    +

    Pagination library ‘anchor_class’ setting

    +

    The Pagination Library now supports adding pretty much any HTML +attribute to your anchors via the ‘attributes’ configuration setting. This includes passing the +‘class’ attribute and using the separate ‘anchor_class’ setting no longer makes sense. +As a result of that, the ‘anchor_class’ setting is now deprecated and scheduled for removal in +CodeIgniter 3.1+.

    +
    +

    Note

    +

    This setting is still available, but you’re strongly encouraged to remove its usage sooner +rather than later.

    +
    +
    +
    +

    String helper random_string() types ‘unique’ and ‘encrypt’

    +

    When using the String Helper function random_string(), +you should no longer pass the unique and encrypt randomization types. They are only +aliases for md5 and sha1 respectively and are now deprecated and scheduled for removal +in CodeIgniter 3.1+.

    +
    +

    Note

    +

    These options are still available, but you’re strongly encouraged to remove their usage +sooner rather than later.

    +
    +
    +
    +

    URL helper url_title() separators ‘dash’ and ‘underscore’

    +

    When using the URL Helper function url_title(), you +should no longer pass dash or underscore as the word separator. This function will +now accept any character and you should just pass the chosen character directly, so you +should write ‘-‘ instead of ‘dash’ and ‘_’ instead of ‘underscore’.

    +

    dash and underscore now act as aliases and are deprecated and scheduled for removal +in CodeIgniter 3.1+.

    +
    +

    Note

    +

    These options are still available, but you’re strongly encouraged to remove their usage +sooner rather than later.

    +
    +
    +
    +

    Session Library method all_userdata()

    +

    As seen in the Change Log, Session Library +method userdata() now allows you to fetch all userdata by simply omitting its parameter:

    +
    $this->session->userdata();
    +
    +
    +

    This makes the all_userdata() method redudant and therefore it is now just an alias for +userdata() with the above shown usage and is being deprecated and scheduled for removal +in CodeIgniter 3.1+.

    +
    +

    Note

    +

    This method is still available, but you’re strongly encouraged to remove its usage +sooner rather than later.

    +
    +
    +
    +

    Database Forge method add_column() with an AFTER clause

    +

    If you have used the third parameter for Database Forge method +add_column() to add a field for an AFTER clause, then you should change its usage.

    +

    That third parameter has been deprecated and scheduled for removal in CodeIgniter 3.1+.

    +

    You should now put AFTER clause field names in the field definition array instead:

    +
    // Old usage:
    +$field = array(
    +        'new_field' => array('type' => 'TEXT')
    +);
    +
    +$this->dbforge->add_column('table_name', $field, 'another_field');
    +
    +// New usage:
    +$field = array(
    +        'new_field' => array('type' => 'TEXT', 'after' => 'another_field')
    +);
    +
    +$this->dbforge->add_column('table_name', $field);
    +
    +
    +
    +

    Note

    +

    The parameter is still available, but you’re strongly encouraged to remove its usage +sooner rather than later.

    +
    +
    +

    Note

    +

    This is for MySQL and CUBRID databases only! Other drivers don’t support this +clause and will silently ignore it.

    +
    +
    +
    +

    URI Routing methods fetch_directory(), fetch_class(), fetch_method()

    +

    With properties CI_Router::$directory, CI_Router::$class and CI_Router::$method +being public and their respective fetch_*() no longer doing anything else to just return +the properties - it doesn’t make sense to keep them.

    +

    Those are all internal, undocumented methods, but we’ve opted to deprecate them for now +in order to maintain backwards-compatibility just in case. If some of you have utilized them, +then you can now just access the properties instead:

    +
    $this->router->directory;
    +$this->router->class;
    +$this->router->method;
    +
    +
    +
    +

    Note

    +

    Those methods are still available, but you’re strongly encouraged to remove their usage +sooner rather than later.

    +
    +
    +
    +

    Input library method is_cli_request()

    +

    Calls to the CI_Input::is_cli_request() method are necessary at many places +in the CodeIgniter internals and this is often before the Input Library is loaded. Because of that, it is being replaced by a common +function named is_cli() and this method is now just an alias.

    +

    The new function is both available at all times for you to use and shorter to type.

    +
    // Old
    +$this->input->is_cli_request();
    +
    +// New
    +is_cli();
    +
    +
    +

    CI_Input::is_cli_request() is now now deprecated and scheduled for removal in +CodeIgniter 3.1+.

    +
    +

    Note

    +

    This method is still available, but you’re strongly encouraged to remove its usage +sooner rather than later.

    +
    +
    +
    +

    Config library method system_url()

    +

    Usage of CI_Config::system_url() encourages insecure coding practices. +Namely, your CodeIgniter system/ directory shouldn’t be publicly accessible +from a security point of view.

    +

    Because of this, this method is now deprecated and scheduled for removal in +CodeIgniter 3.1+.

    +
    +

    Note

    +

    This method is still available, but you’re strongly encouraged to remove its usage +sooner rather than later.

    +
    +
    +
    +

    The Javascript library

    +

    The Javascript Library has always had an +‘experimental’ status and was never really useful, nor a proper solution.

    +

    It is now deprecated and scheduled for removal in CodeIgniter 3.1+.

    +
    +

    Note

    +

    This library is still available, but you’re strongly encouraged to remove its usage +sooner rather than later.

    +
    +
    +
    +

    Form Validation method prep_for_form()

    +

    The Form Validation Library has a +prep_for_form() method, which is/can also be used as a rule in +set_rules() to automatically perform HTML encoding on input data.

    +

    Automatically encoding input (instead of output) data is a bad practice in +the first place, and CodeIgniter and PHP itself offer other alternatives +to this method anyway. +For example, Form Helper functions will +automatically perform HTML escaping when necessary.

    +

    Therefore, the prep_for_form method/rule is pretty much useless and is now +deprecated and scheduled for removal in 3.1+.

    +
    +

    Note

    +

    The method is still available, but you’re strongly encouraged to +remove its usage sooner rather than later.

    +
    +
    +
    +
    +

    Step 21: Check your usage of Text helper highlight_phrase()

    +

    The default HTML tag used by Text Helper function +highlight_phrase() has been changed from <strong> to the new HTML5 +tag <mark>.

    +

    Unless you’ve used your own highlighting tags, this might cause trouble +for your visitors who use older web browsers such as Internet Explorer 8. +We therefore suggest that you add the following code to your CSS files +in order to avoid backwards compatibility with old browsers:

    +
    mark {
    +        background: #ff0;
    +        color: #000;
    +};
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_301.html b/user_guide/installation/upgrade_301.html new file mode 100755 index 0000000..7a7619e --- /dev/null +++ b/user_guide/installation/upgrade_301.html @@ -0,0 +1,513 @@ + + + + + + + + + + Upgrading from 3.0.0 to 3.0.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.0 to 3.0.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Update your CLI error templates

    +

    Replace all files under your application/views/errors/cli/ directory.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_302.html b/user_guide/installation/upgrade_302.html new file mode 100755 index 0000000..0cf09bb --- /dev/null +++ b/user_guide/installation/upgrade_302.html @@ -0,0 +1,520 @@ + + + + + + + + + + Upgrading from 3.0.1 to 3.0.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.1 to 3.0.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Update your application/config/constants.php file

    +

    The application/config/constants.php file has been updated to check +if constants aren’t already defined before doing that, making it easier +to add an environment-specific configuration.

    +
    +

    Note

    +

    If you’ve made modifications to this file, please make a +backup first and cross-check the differences first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_303.html b/user_guide/installation/upgrade_303.html new file mode 100755 index 0000000..e5b654b --- /dev/null +++ b/user_guide/installation/upgrade_303.html @@ -0,0 +1,547 @@ + + + + + + + + + + Upgrading from 3.0.2 to 3.0.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.2 to 3.0.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Make sure your ‘base_url’ config value is not empty

    +

    When $config['base_url'] is not set, CodeIgniter tries to automatically +detect what your website’s base URL is. This is done purely for convenience +when you are starting development of a new application.

    +

    Auto-detection is never reliable and also has security implications, which +is why you should always have it manually configured!

    +

    One of the changes in CodeIgniter 3.0.3 is how this auto-detection works, +and more specifically it now falls back to the server’s IP address instead +of the hostname requested by the client. Therefore, if you’ve ever relied +on auto-detection, it will change how your website works now.

    +

    In case you need to allow e.g. multiple domains, or both http:// and +https:// prefixes to be dynamically used depending on the request, +remember that application/config/config.php is still a PHP script, in +which you can create this logic with a few lines of code. For example:

    +
    $allowed_domains = array('domain1.tld', 'domain2.tld');
    +$default_domain  = 'domain1.tld';
    +
    +if (in_array($_SERVER['HTTP_HOST'], $allowed_domains, TRUE))
    +{
    +        $domain = $_SERVER['HTTP_HOST'];
    +}
    +else
    +{
    +        $domain = $default_domain;
    +}
    +
    +if ( ! empty($_SERVER['HTTPS']))
    +{
    +        $config['base_url'] = 'https://'.$domain;
    +}
    +else
    +{
    +        $config['base_url'] = 'http://'.$domain;
    +}
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_304.html b/user_guide/installation/upgrade_304.html new file mode 100755 index 0000000..ab139cf --- /dev/null +++ b/user_guide/installation/upgrade_304.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 3.0.3 to 3.0.4 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.3 to 3.0.4

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_305.html b/user_guide/installation/upgrade_305.html new file mode 100755 index 0000000..ebc74be --- /dev/null +++ b/user_guide/installation/upgrade_305.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 3.0.4 to 3.0.5 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.4 to 3.0.5

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_306.html b/user_guide/installation/upgrade_306.html new file mode 100755 index 0000000..fb6e262 --- /dev/null +++ b/user_guide/installation/upgrade_306.html @@ -0,0 +1,539 @@ + + + + + + + + + + Upgrading from 3.0.5 to 3.0.6 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.5 to 3.0.6

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Update your index.php file (optional)

    +

    We’ve made some tweaks to the index.php file, mostly related to proper +usage of directory separators (i.e. use the DIRECTORY_SEPARATOR +constant instead of a hard coded forward slash “/”).

    +

    Nothing will break if you skip this step, but if you’re running Windows +or just want to be up to date with every change - we do recommend that +you update your index.php file.

    +

    Tip: Just copy the ``ENVIRONMENT``, ``$system_path``, ``$application_folder`` +and ``$view_folder`` declarations from the old file and put them into the +new one, replacing the defaults.

    +
    +
    +

    Step 3: Remove ‘prep_for_form’ usage (deprecation)

    +

    The Form Validation Library has a +prep_for_form() method, which is/can also be used as a rule in +set_rules() to automatically perform HTML encoding on input data.

    +

    Automatically encoding input (instead of output) data is a bad practice in +the first place, and CodeIgniter and PHP itself offer other alternatives +to this method anyway. +For example, Form Helper functions will +automatically perform HTML escaping when necessary.

    +

    Therefore, the prep_for_form method/rule is pretty much useless and is now +deprecated and scheduled for removal in 3.1+.

    +
    +

    Note

    +

    The method is still available, but you’re strongly encouraged to +remove its usage sooner rather than later.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_310.html b/user_guide/installation/upgrade_310.html new file mode 100755 index 0000000..76dff8f --- /dev/null +++ b/user_guide/installation/upgrade_310.html @@ -0,0 +1,527 @@ + + + + + + + + + + Upgrading from 3.0.6 to 3.1.0 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.0.6 to 3.1.0

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Check your PHP version

    +

    We recommend always running versions that are currently supported, which right now is at least PHP 5.6.

    +

    PHP 5.2.x versions are now officially not supported by CodeIgniter, and while 5.3.7+ +may be at least runnable, we strongly discourage you from using any PHP versions below +the ones listed on the PHP.net Supported Versions +page.

    +
    +
    +

    Step 3: If you’re using the ‘odbc’ database driver, check for usage of Query Builder

    +

    Query Builder functionality and escape() can +no longer be used with the ‘odbc’ database driver.

    +

    This is because, due to its nature, the ODBC extension for PHP +does not provide a function that allows to safely escape user-supplied strings for usage +inside an SQL query (which our Query Builder relies on).

    +

    Thus, user inputs MUST be bound, as shown in Running Queries, +under the “Query Bindings” section.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_311.html b/user_guide/installation/upgrade_311.html new file mode 100755 index 0000000..9ec29b2 --- /dev/null +++ b/user_guide/installation/upgrade_311.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 3.1.0 to 3.1.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.0 to 3.1.1

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_312.html b/user_guide/installation/upgrade_312.html new file mode 100755 index 0000000..ee10b6d --- /dev/null +++ b/user_guide/installation/upgrade_312.html @@ -0,0 +1,534 @@ + + + + + + + + + + Upgrading from 3.1.1 to 3.1.2 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.1 to 3.1.2

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Update your “ci_sessions” database table

    +

    If you’re using the Session Library with the +‘database’ driver, you may have to ALTER your sessions table for your +sessions to continue to work.

    +
    +

    Note

    +

    The table in question is not necessarily named “ci_sessions”. +It is what you’ve set as your $config['sess_save_path'].

    +
    +

    This will only affect you if you’ve changed your session.hash_function +php.ini setting to something like ‘sha512’. Or if you’ve been running +an older CodeIgniter version on PHP 7.1+.

    +

    It is recommended that you do this anyway, just to avoid potential issues +in the future if you do change your configuration.

    +

    Just execute the one of the following SQL queries, depending on your +database:

    +
    // MySQL:
    +ALTER TABLE ci_sessions CHANGE id id varchar(128) NOT NULL;
    +
    +// PostgreSQL
    +ALTER TABLE ci_sessions ALTER COLUMN id SET DATA TYPE varchar(128);
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_313.html b/user_guide/installation/upgrade_313.html new file mode 100755 index 0000000..915ef9d --- /dev/null +++ b/user_guide/installation/upgrade_313.html @@ -0,0 +1,539 @@ + + + + + + + + + + Upgrading from 3.1.2 to 3.1.3 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.2 to 3.1.3

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Remove usage of nice_date() helper (deprecation)

    +

    The Date Helper function nice_date() is +no longer useful since the introduction of PHP’s DateTime classes

    +

    You can replace it with the following:

    +
    DateTime::createFromFormat($input_format, $input_date)->format($desired_output_format);
    +
    +
    +

    Thus, nice_date() is now deprecated and scheduled for removal in +CodeIgniter 3.2+.

    +
    +

    Note

    +

    The function is still available, but you’re strongly encouraged +to remove its usage sooner rather than later.

    +
    +
    +
    +

    Step 3: Remove usage of $config[‘standardize_newlines’]

    +

    The Input Library would optionally replace +occurrences of rn, r, n in input data with whatever the PHP_EOL +value is on your system - if you’ve set $config['standardize_newlines'] +to TRUE in your application/config/config.php.

    +

    This functionality is now deprecated and scheduled for removal in +CodeIgniter 3.2.+.

    +
    +

    Note

    +

    The functionality is still available, but you’re strongly +encouraged to remove its usage sooner rather than later.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_314.html b/user_guide/installation/upgrade_314.html new file mode 100755 index 0000000..5770883 --- /dev/null +++ b/user_guide/installation/upgrade_314.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 3.1.3 to 3.1.4 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.3 to 3.1.4

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_315.html b/user_guide/installation/upgrade_315.html new file mode 100755 index 0000000..be6b63e --- /dev/null +++ b/user_guide/installation/upgrade_315.html @@ -0,0 +1,509 @@ + + + + + + + + + + Upgrading from 3.1.4 to 3.1.5 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.4 to 3.1.5

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_316.html b/user_guide/installation/upgrade_316.html new file mode 100755 index 0000000..dd9193f --- /dev/null +++ b/user_guide/installation/upgrade_316.html @@ -0,0 +1,523 @@ + + + + + + + + + + Upgrading from 3.1.5 to 3.1.6 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading from 3.1.5 to 3.1.6

    +

    Before performing an update you should take your site offline by +replacing the index.php file with a static one.

    +
    +

    Step 1: Update your CodeIgniter files

    +

    Replace all files and directories in your system/ directory.

    +
    +

    Note

    +

    If you have any custom developed files in these directories, +please make copies of them first.

    +
    +
    +
    +

    Step 2: Remove usage of the APC Cache driver (deprecation)

    +

    The Cache Library APC driver is now +deprecated, as the APC extension is effectively dead, as explained in its +PHP Manual page.

    +

    If your application happens to be using it, you can switch to another +cache driver, as APC support will be removed in a future CodeIgniter +version.

    +
    +

    Note

    +

    The driver is still available, but you’re strongly encouraged +to remove its usage sooner rather than later.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_b11.html b/user_guide/installation/upgrade_b11.html new file mode 100755 index 0000000..cf5c034 --- /dev/null +++ b/user_guide/installation/upgrade_b11.html @@ -0,0 +1,567 @@ + + + + + + + + + + Upgrading From Beta 1.0 to Beta 1.1 — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading From Beta 1.0 to Beta 1.1

    +

    To upgrade to Beta 1.1 please perform the following steps:

    +
    +

    Step 1: Replace your index file

    +

    Replace your main index.php file with the new index.php file. Note: If +you have renamed your “system” folder you will need to edit this info in +the new file.

    +
    +
    +

    Step 2: Relocate your config folder

    +

    This version of CodeIgniter now permits multiple sets of “applications” +to all share a common set of backend files. In order to enable each +application to have its own configuration values, the config directory +must now reside inside of your application folder, so please move it +there.

    +
    +
    +

    Step 3: Replace directories

    +

    Replace the following directories with the new versions:

    +
      +
    • drivers
    • +
    • helpers
    • +
    • init
    • +
    • libraries
    • +
    • scaffolding
    • +
    +
    +
    +

    Step 4: Add the calendar language file

    +

    There is a new language file corresponding to the new calendaring class +which must be added to your language folder. Add the following item to +your version: language/english/calendar_lang.php

    +
    +
    +

    Step 5: Edit your config file

    +

    The original application/config/config.php file has a typo in it Open +the file and look for the items related to cookies:

    +
    $conf['cookie_prefix']  = "";
    +$conf['cookie_domain']  = "";
    +$conf['cookie_path']    = "/";
    +
    +
    +

    Change the array name from $conf to $config, like this:

    +
    $config['cookie_prefix']        = "";
    +$config['cookie_domain']        = "";
    +$config['cookie_path']  = "/";
    +
    +
    +

    Lastly, add the following new item to the config file (and edit the +option if needed):

    +
    /*
    +|------------------------------------------------
    +| URI PROTOCOL
    +|------------------------------------------------
    +|
    +| This item determines which server global
    +| should be used to retrieve the URI string. The
    +| default setting of "auto" works for most servers.
    +| If your links do not seem to work, try one of
    +| the other delicious flavors:
    +|
    +| 'auto'         Default - auto detects
    +| 'path_info'    Uses the PATH_INFO
    +| 'query_string'        Uses the QUERY_STRING
    +*/
    +
    +$config['uri_protocol'] = "auto";
    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html new file mode 100755 index 0000000..e8bc0b7 --- /dev/null +++ b/user_guide/installation/upgrading.html @@ -0,0 +1,548 @@ + + + + + + + + + + Upgrading From a Previous Version — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Upgrading From a Previous Version

    +

    Please read the upgrade notes corresponding to the version you are +upgrading from.

    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html new file mode 100755 index 0000000..f54f337 --- /dev/null +++ b/user_guide/libraries/benchmark.html @@ -0,0 +1,703 @@ + + + + + + + + + + Benchmarking Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Benchmarking Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Benchmarking Class

    +

    CodeIgniter has a Benchmarking class that is always active, enabling the +time difference between any two marked points to be calculated.

    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    +

    In addition, the benchmark is always started the moment the framework is +invoked, and ended by the output class right before sending the final +view to the browser, enabling a very accurate timing of the entire +system execution to be shown.

    + +
    +

    Using the Benchmark Class

    +

    The Benchmark class can be used within your +controllers, +views, or your models. +The process for usage is this:

    +
      +
    1. Mark a start point
    2. +
    3. Mark an end point
    4. +
    5. Run the “elapsed time” function to view the results
    6. +
    +

    Here’s an example using real code:

    +
    $this->benchmark->mark('code_start');
    +
    +// Some code happens here
    +
    +$this->benchmark->mark('code_end');
    +
    +echo $this->benchmark->elapsed_time('code_start', 'code_end');
    +
    +
    +
    +

    Note

    +

    The words “code_start” and “code_end” are arbitrary. They +are simply words used to set two markers. You can use any words you +want, and you can set multiple sets of markers. Consider this example:

    +
    $this->benchmark->mark('dog');
    +
    +// Some code happens here
    +
    +$this->benchmark->mark('cat');
    +
    +// More code happens here
    +
    +$this->benchmark->mark('bird');
    +
    +echo $this->benchmark->elapsed_time('dog', 'cat');
    +echo $this->benchmark->elapsed_time('cat', 'bird');
    +echo $this->benchmark->elapsed_time('dog', 'bird');
    +
    +
    +
    +
    +

    Profiling Your Benchmark Points

    +

    If you want your benchmark data to be available to the +Profiler all of your marked points must +be set up in pairs, and each mark point name must end with _start and +_end. Each pair of points must otherwise be named identically. Example:

    +
    $this->benchmark->mark('my_mark_start');
    +
    +// Some code happens here...
    +
    +$this->benchmark->mark('my_mark_end');
    +
    +$this->benchmark->mark('another_mark_start');
    +
    +// Some more code happens here...
    +
    +$this->benchmark->mark('another_mark_end');
    +
    +
    +

    Please read the Profiler page for more +information.

    +
    +
    +

    Displaying Total Execution Time

    +

    If you would like to display the total elapsed time from the moment +CodeIgniter starts to the moment the final output is sent to the +browser, simply place this in one of your view templates:

    +
    <?php echo $this->benchmark->elapsed_time();?>
    +
    +
    +

    You’ll notice that it’s the same function used in the examples above to +calculate the time between two point, except you are not using any +parameters. When the parameters are absent, CodeIgniter does not stop +the benchmark until right before the final output is sent to the +browser. It doesn’t matter where you use the function call, the timer +will continue to run until the very end.

    +

    An alternate way to show your elapsed time in your view files is to use +this pseudo-variable, if you prefer not to use the pure PHP:

    +
    {elapsed_time}
    +
    +
    +
    +

    Note

    +

    If you want to benchmark anything within your controller +functions you must set your own start/end points.

    +
    +
    +
    +

    Displaying Memory Consumption

    +

    If your PHP installation is configured with –enable-memory-limit, you +can display the amount of memory consumed by the entire system using the +following code in one of your view file:

    +
    <?php echo $this->benchmark->memory_usage();?>
    +
    +
    +
    +

    Note

    +

    This function can only be used in your view files. The consumption +will reflect the total memory used by the entire app.

    +
    +

    An alternate way to show your memory usage in your view files is to use +this pseudo-variable, if you prefer not to use the pure PHP:

    +
    {memory_usage}
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Benchmark
    +
    +
    +mark($name)
    +
    +++ + + + + + +
    Parameters:
      +
    • $name (string) – the name you wish to assign to your marker
    • +
    +
    Return type:

    void

    +
    +

    Sets a benchmark marker.

    +
    + +
    +
    +elapsed_time([$point1 = ''[, $point2 = ''[, $decimals = 4]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $point1 (string) – a particular marked point
    • +
    • $point2 (string) – a particular marked point
    • +
    • $decimals (int) – number of decimal places for precision
    • +
    +
    Returns:

    Elapsed time

    +
    Return type:

    string

    +
    +

    Calculates and returns the time difference between two marked points.

    +

    If the first parameter is empty this function instead returns the +{elapsed_time} pseudo-variable. This permits the full system +execution time to be shown in a template. The output class will +swap the real value for this variable.

    +
    + +
    +
    +memory_usage()
    +
    +++ + + + + + +
    Returns:Memory usage info
    Return type:string
    +

    Simply returns the {memory_usage} marker.

    +

    This permits it to be put it anywhere in a template without the memory +being calculated until the end. The Output Class will +swap the real value for this variable.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html new file mode 100755 index 0000000..e1f91ec --- /dev/null +++ b/user_guide/libraries/caching.html @@ -0,0 +1,895 @@ + + + + + + + + + + Caching Driver — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Caching Driver

    +

    CodeIgniter features wrappers around some of the most popular forms of +fast and dynamic caching. All but file-based caching require specific +server requirements, and a Fatal Exception will be thrown if server +requirements are not met.

    + +
    +

    Example Usage

    +

    The following example will load the cache driver, specify APC +as the driver to use, and fall back to file-based caching if APC is not +available in the hosting environment.

    +
    $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
    +
    +if ( ! $foo = $this->cache->get('foo'))
    +{
    +        echo 'Saving to the cache!<br />';
    +        $foo = 'foobarbaz!';
    +
    +        // Save into the cache for 5 minutes
    +        $this->cache->save('foo', $foo, 300);
    +}
    +
    +echo $foo;
    +
    +
    +

    You can also prefix cache item names via the key_prefix setting, which is useful +to avoid collisions when you’re running multiple applications on the same environment.

    +
    $this->load->driver('cache',
    +        array('adapter' => 'apc', 'backup' => 'file', 'key_prefix' => 'my_')
    +);
    +
    +$this->cache->get('foo'); // Will get the cache entry named 'my_foo'
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Cache
    +
    +
    +is_supported($driver)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $driver (string) – the name of the caching driver
    • +
    +
    Returns:

    TRUE if supported, FALSE if not

    +
    Return type:

    bool

    +
    +

    This method is automatically called when accessing drivers via +$this->cache->get(). However, if the individual drivers are used, +make sure to call this method to ensure the driver is supported in the +hosting environment.

    +
    if ($this->cache->apc->is_supported())
    +{
    +        if ($data = $this->cache->apc->get('my_cache'))
    +        {
    +                // do things.
    +        }
    +}
    +
    +
    +
    + +
    +
    +get($id)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – Cache item name
    • +
    +
    Returns:

    Item value or FALSE if not found

    +
    Return type:

    mixed

    +
    +

    This method will attempt to fetch an item from the cache store. If the +item does not exist, the method will return FALSE.

    +
    $foo = $this->cache->get('my_cached_item');
    +
    +
    +
    + +
    +
    +save($id, $data[, $ttl = 60[, $raw = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – Cache item name
    • +
    • $data (mixed) – the data to save
    • +
    • $ttl (int) – Time To Live, in seconds (default 60)
    • +
    • $raw (bool) – Whether to store the raw value
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    string

    +
    +

    This method will save an item to the cache store. If saving fails, the +method will return FALSE.

    +
    $this->cache->save('cache_item_id', 'data_to_cache');
    +
    +
    +
    +

    Note

    +

    The $raw parameter is only utilized by APC and Memcache, +in order to allow usage of increment() and decrement().

    +
    +
    + +
    +
    +delete($id)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – name of cached item
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    This method will delete a specific item from the cache store. If item +deletion fails, the method will return FALSE.

    +
    $this->cache->delete('cache_item_id');
    +
    +
    +
    + +
    +
    +increment($id[, $offset = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – Cache ID
    • +
    • $offset (int) – Step/value to add
    • +
    +
    Returns:

    New value on success, FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Performs atomic incrementation of a raw stored value.

    +
    // 'iterator' has a value of 2
    +
    +$this->cache->increment('iterator'); // 'iterator' is now 3
    +
    +$this->cache->increment('iterator', 3); // 'iterator' is now 6
    +
    +
    +
    + +
    +
    +decrement($id[, $offset = 1])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – Cache ID
    • +
    • $offset (int) – Step/value to reduce by
    • +
    +
    Returns:

    New value on success, FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Performs atomic decrementation of a raw stored value.

    +
    // 'iterator' has a value of 6
    +
    +$this->cache->decrement('iterator'); // 'iterator' is now 5
    +
    +$this->cache->decrement('iterator', 2); // 'iterator' is now 3
    +
    +
    +
    + +
    +
    +clean()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    This method will ‘clean’ the entire cache. If the deletion of the +cache files fails, the method will return FALSE.

    +
    $this->cache->clean();
    +
    +
    +
    + +
    +
    +cache_info()
    +
    +++ + + + + + +
    Returns:Information on the entire cache database
    Return type:mixed
    +

    This method will return information on the entire cache.

    +
    var_dump($this->cache->cache_info());
    +
    +
    +
    +

    Note

    +

    The information returned and the structure of the data is dependent +on which adapter is being used.

    +
    +
    + +
    +
    +get_metadata($id)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $id (string) – Cache item name
    • +
    +
    Returns:

    Metadata for the cached item

    +
    Return type:

    mixed

    +
    +

    This method will return detailed information on a specific item in the +cache.

    +
    var_dump($this->cache->get_metadata('my_cached_item'));
    +
    +
    +
    +

    Note

    +

    The information returned and the structure of the data is dependent +on which adapter is being used.

    +
    +
    + +
    + +
    +
    +

    Drivers

    +
    +

    Alternative PHP Cache (APC) Caching

    +

    All of the methods listed above can be accessed without passing a +specific adapter to the driver loader as follows:

    +
    $this->load->driver('cache');
    +$this->cache->apc->save('foo', 'bar', 10);
    +
    +
    +

    For more information on APC, please see +http://php.net/apc.

    +
    +
    +

    File-based Caching

    +

    Unlike caching from the Output Class, the driver file-based caching +allows for pieces of view files to be cached. Use this with care, and +make sure to benchmark your application, as a point can come where disk +I/O will negate positive gains by caching.

    +

    All of the methods listed above can be accessed without passing a +specific adapter to the driver loader as follows:

    +
    $this->load->driver('cache');
    +$this->cache->file->save('foo', 'bar', 10);
    +
    +
    +
    +
    +

    Memcached Caching

    +

    Multiple Memcached servers can be specified in the memcached.php +configuration file, located in the _application/config/* directory.

    +

    All of the methods listed above can be accessed without passing a +specific adapter to the driver loader as follows:

    +
    $this->load->driver('cache');
    +$this->cache->memcached->save('foo', 'bar', 10);
    +
    +
    +

    For more information on Memcached, please see +http://php.net/memcached.

    +
    +
    +

    WinCache Caching

    +

    Under Windows, you can also utilize the WinCache driver.

    +

    All of the methods listed above can be accessed without passing a +specific adapter to the driver loader as follows:

    +
    $this->load->driver('cache');
    +$this->cache->wincache->save('foo', 'bar', 10);
    +
    +
    +

    For more information on WinCache, please see +http://php.net/wincache.

    +
    +
    +

    Redis Caching

    +

    Redis is an in-memory key-value store which can operate in LRU cache mode. +To use it, you need Redis server and phpredis PHP extension.

    +

    Config options to connect to redis server must be stored in the application/config/redis.php file. +Available options are:

    +
    $config['socket_type'] = 'tcp'; //`tcp` or `unix`
    +$config['socket'] = '/var/run/redis.sock'; // in case of `unix` socket type
    +$config['host'] = '127.0.0.1';
    +$config['password'] = NULL;
    +$config['port'] = 6379;
    +$config['timeout'] = 0;
    +
    +
    +

    All of the methods listed above can be accessed without passing a +specific adapter to the driver loader as follows:

    +
    $this->load->driver('cache');
    +$this->cache->redis->save('foo', 'bar', 10);
    +
    +
    +

    For more information on Redis, please see +http://redis.io.

    +
    +
    +

    Dummy Cache

    +

    This is a caching backend that will always ‘miss.’ It stores no data, +but lets you keep your caching code in place in environments that don’t +support your chosen cache.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html new file mode 100755 index 0000000..e474338 --- /dev/null +++ b/user_guide/libraries/calendar.html @@ -0,0 +1,972 @@ + + + + + + + + + + Calendaring Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Calendaring Class

    +

    The Calendar class enables you to dynamically create calendars. Your +calendars can be formatted through the use of a calendar template, +allowing 100% control over every aspect of its design. In addition, you +can pass data to your calendar cells.

    + +
    +

    Using the Calendaring Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Calendar class is +initialized in your controller using the $this->load->library function:

    +
    $this->load->library('calendar');
    +
    +
    +

    Once loaded, the Calendar object will be available using:

    +
    $this->calendar
    +
    +
    +
    +
    +

    Displaying a Calendar

    +

    Here is a very simple example showing how you can display a calendar:

    +
    $this->load->library('calendar');
    +echo $this->calendar->generate();
    +
    +
    +

    The above code will generate a calendar for the current month/year based +on your server time. To show a calendar for a specific month and year +you will pass this information to the calendar generating function:

    +
    $this->load->library('calendar');
    +echo $this->calendar->generate(2006, 6);
    +
    +
    +

    The above code will generate a calendar showing the month of June in +2006. The first parameter specifies the year, the second parameter +specifies the month.

    +
    +
    +

    Passing Data to your Calendar Cells

    +

    To add data to your calendar cells involves creating an associative +array in which the keys correspond to the days you wish to populate and +the array value contains the data. The array is passed to the third +parameter of the calendar generating function. Consider this example:

    +
    $this->load->library('calendar');
    +
    +$data = array(
    +        3  => 'http://example.com/news/article/2006/06/03/',
    +        7  => 'http://example.com/news/article/2006/06/07/',
    +        13 => 'http://example.com/news/article/2006/06/13/',
    +        26 => 'http://example.com/news/article/2006/06/26/'
    +);
    +
    +echo $this->calendar->generate(2006, 6, $data);
    +
    +
    +

    Using the above example, day numbers 3, 7, 13, and 26 will become links +pointing to the URLs you’ve provided.

    +
    +

    Note

    +

    By default it is assumed that your array will contain links. +In the section that explains the calendar template below you’ll see how +you can customize how data passed to your cells is handled so you can +pass different types of information.

    +
    +
    +
    +

    Setting Display Preferences

    +

    There are seven preferences you can set to control various aspects of +the calendar. Preferences are set by passing an array of preferences in +the second parameter of the loading function. Here is an example:

    +
    $prefs = array(
    +        'start_day'    => 'saturday',
    +        'month_type'   => 'long',
    +        'day_type'     => 'short'
    +);
    +
    +$this->load->library('calendar', $prefs);
    +
    +echo $this->calendar->generate();
    +
    +
    +

    The above code would start the calendar on saturday, use the “long” +month heading, and the “short” day names. More information regarding +preferences below.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefaultOptionsDescription
    templateNoneNone
    +
    A string or array containing your calendar template.
    +
    See the template section below.
    +
    +
    local_timetime()NoneA Unix timestamp corresponding to the current time.
    start_daysundayAny week day (sunday, monday, tuesday, etc.)Sets the day of the week the calendar should start on.
    month_typelonglong, short
    +
    Determines what version of the month name to use in the header.
    +
    long = January, short = Jan.
    +
    +
    day_typeabrlong, short, abr
    +
    Determines what version of the weekday names to use in
    +
    the column headers. long = Sunday, short = Sun, abr = Su.
    +
    +
    show_next_prevFALSETRUE/FALSE (boolean)
    +
    Determines whether to display links allowing you to toggle
    +
    to next/previous months. See information on this feature below.
    +
    +
    next_prev_urlcontroller/methodA URLSets the basepath used in the next/previous calendar links.
    show_other_daysFALSETRUE/FALSE (boolean)
    +
    Determines whether to display days of other months that share the
    +
    first or last week of the calendar month.
    +
    +
    +
    + +
    +

    Creating a Calendar Template

    +

    By creating a calendar template you have 100% control over the design of +your calendar. Using the string method, each component of your calendar +will be placed within a pair of pseudo-variables as shown here:

    +
    $prefs['template'] = '
    +
    +        {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}
    +
    +        {heading_row_start}<tr>{/heading_row_start}
    +
    +        {heading_previous_cell}<th><a href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell}
    +        {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
    +        {heading_next_cell}<th><a href="{next_url}">&gt;&gt;</a></th>{/heading_next_cell}
    +
    +        {heading_row_end}</tr>{/heading_row_end}
    +
    +        {week_row_start}<tr>{/week_row_start}
    +        {week_day_cell}<td>{week_day}</td>{/week_day_cell}
    +        {week_row_end}</tr>{/week_row_end}
    +
    +        {cal_row_start}<tr>{/cal_row_start}
    +        {cal_cell_start}<td>{/cal_cell_start}
    +        {cal_cell_start_today}<td>{/cal_cell_start_today}
    +        {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other}
    +
    +        {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
    +        {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
    +
    +        {cal_cell_no_content}{day}{/cal_cell_no_content}
    +        {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
    +
    +        {cal_cell_blank}&nbsp;{/cal_cell_blank}
    +
    +        {cal_cell_other}{day}{/cal_cel_other}
    +
    +        {cal_cell_end}</td>{/cal_cell_end}
    +        {cal_cell_end_today}</td>{/cal_cell_end_today}
    +        {cal_cell_end_other}</td>{/cal_cell_end_other}
    +        {cal_row_end}</tr>{/cal_row_end}
    +
    +        {table_close}</table>{/table_close}
    +';
    +
    +$this->load->library('calendar', $prefs);
    +
    +echo $this->calendar->generate();
    +
    +
    +

    Using the array method, you will pass key => value pairs. You can pass as +many or as few values as you’d like. Omitted keys will use the default values +inherited in the calendar class.

    +

    Example:

    +
    $prefs['template'] = array(
    +        'table_open'           => '<table class="calendar">',
    +        'cal_cell_start'       => '<td class="day">',
    +        'cal_cell_start_today' => '<td class="today">'
    +);
    +
    +$this->load->library('calendar', $prefs);
    +
    +echo $this->calendar->generate();
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Calendar
    +
    +
    +initialize([$config = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $config (array) – Configuration parameters
    • +
    +
    Returns:

    CI_Calendar instance (method chaining)

    +
    Return type:

    CI_Calendar

    +
    +

    Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences.

    +
    + +
    +
    +generate([$year = ''[, $month = ''[, $data = array()]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $year (int) – Year
    • +
    • $month (int) – Month
    • +
    • $data (array) – Data to be shown in the calendar cells
    • +
    +
    Returns:

    HTML-formatted calendar

    +
    Return type:

    string

    +
    +

    Generate the calendar.

    +
    + +
    +
    +get_month_name($month)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $month (int) – Month
    • +
    +
    Returns:

    Month name

    +
    Return type:

    string

    +
    +

    Generates a textual month name based on the numeric month provided.

    +
    + +
    +
    +get_day_names($day_type = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $day_type (string) – ‘long’, ‘short’, or ‘abr’
    • +
    +
    Returns:

    Array of day names

    +
    Return type:

    array

    +
    +

    Returns an array of day names (Sunday, Monday, etc.) based on the type +provided. Options: long, short, abr. If no $day_type is provided (or +if an invalid type is provided) this method will return the “abbreviated” +style.

    +
    + +
    +
    +adjust_date($month, $year)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $month (int) – Month
    • +
    • $year (int) – Year
    • +
    +
    Returns:

    An associative array containing month and year

    +
    Return type:

    array

    +
    +

    This method makes sure that you have a valid month/year. For example, if +you submit 13 as the month, the year will increment and the month will +become January:

    +
    print_r($this->calendar->adjust_date(13, 2014));
    +
    +
    +

    outputs:

    +
    Array
    +(
    +        [month] => '01'
    +        [year] => '2015'
    +)
    +
    +
    +
    + +
    +
    +get_total_days($month, $year)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $month (int) – Month
    • +
    • $year (int) – Year
    • +
    +
    Returns:

    Count of days in the specified month

    +
    Return type:

    int

    +
    +

    Total days in a given month:

    +
    echo $this->calendar->get_total_days(2, 2012);
    +// 29
    +
    +
    +
    +

    Note

    +

    This method is an alias for Date Helper function days_in_month().

    +
    +
    + +
    +
    +default_template()
    +
    +++ + + + + + +
    Returns:An array of template values
    Return type:array
    +

    Sets the default template. This method is used when you have not created +your own template.

    +
    + +
    +
    +parse_template()
    +
    +++ + + + + + +
    Returns:CI_Calendar instance (method chaining)
    Return type:CI_Calendar
    +

    Harvests the data within the template {pseudo-variables} used to +display the calendar.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html new file mode 100755 index 0000000..503d3a6 --- /dev/null +++ b/user_guide/libraries/cart.html @@ -0,0 +1,1025 @@ + + + + + + + + + + Shopping Cart Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Shopping Cart Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Shopping Cart Class

    +

    The Cart Class permits items to be added to a session that stays active +while a user is browsing your site. These items can be retrieved and +displayed in a standard “shopping cart” format, allowing the user to +update the quantity or remove items from the cart.

    +
    +

    Important

    +

    The Cart library is DEPRECATED and should not be used. +It is currently only kept for backwards compatibility.

    +
    +

    Please note that the Cart Class ONLY provides the core “cart” +functionality. It does not provide shipping, credit card authorization, +or other processing components.

    + +
    +

    Using the Cart Class

    +
    +

    Initializing the Shopping Cart Class

    +
    +

    Important

    +

    The Cart class utilizes CodeIgniter’s Session +Class to save the cart information to a database, so +before using the Cart class you must set up a database table as +indicated in the Session Documentation, and set the +session preferences in your application/config/config.php file to +utilize a database.

    +
    +

    To initialize the Shopping Cart Class in your controller constructor, +use the $this->load->library() method:

    +
    $this->load->library('cart');
    +
    +
    +

    Once loaded, the Cart object will be available using:

    +
    $this->cart
    +
    +
    +
    +

    Note

    +

    The Cart Class will load and initialize the Session Class +automatically, so unless you are using sessions elsewhere in your +application, you do not need to load the Session class.

    +
    +
    +
    +

    Adding an Item to The Cart

    +

    To add an item to the shopping cart, simply pass an array with the +product information to the $this->cart->insert() method, as shown +below:

    +
    $data = array(
    +        'id'      => 'sku_123ABC',
    +        'qty'     => 1,
    +        'price'   => 39.95,
    +        'name'    => 'T-Shirt',
    +        'options' => array('Size' => 'L', 'Color' => 'Red')
    +);
    +
    +$this->cart->insert($data);
    +
    +
    +
    +

    Important

    +

    The first four array indexes above (id, qty, price, and +name) are required. If you omit any of them the data will not be +saved to the cart. The fifth index (options) is optional. It is intended +to be used in cases where your product has options associated with it. +Use an array for options, as shown above.

    +
    +

    The five reserved indexes are:

    +
      +
    • id - Each product in your store must have a unique identifier. +Typically this will be an “sku” or other such identifier.
    • +
    • qty - The quantity being purchased.
    • +
    • price - The price of the item.
    • +
    • name - The name of the item.
    • +
    • options - Any additional attributes that are needed to identify +the product. These must be passed via an array.
    • +
    +

    In addition to the five indexes above, there are two reserved words: +rowid and subtotal. These are used internally by the Cart class, so +please do NOT use those words as index names when inserting data into +the cart.

    +

    Your array may contain additional data. Anything you include in your +array will be stored in the session. However, it is best to standardize +your data among all your products in order to make displaying the +information in a table easier.

    +
    $data = array(
    +        'id'      => 'sku_123ABC',
    +        'qty'     => 1,
    +        'price'   => 39.95,
    +        'name'    => 'T-Shirt',
    +        'coupon'         => 'XMAS-50OFF'
    +);
    +
    +$this->cart->insert($data);
    +
    +
    +

    The insert() method will return the $rowid if you successfully insert a +single item.

    +
    +
    +

    Adding Multiple Items to The Cart

    +

    By using a multi-dimensional array, as shown below, it is possible to +add multiple products to the cart in one action. This is useful in cases +where you wish to allow people to select from among several items on the +same page.

    +
    $data = array(
    +        array(
    +                'id'      => 'sku_123ABC',
    +                'qty'     => 1,
    +                'price'   => 39.95,
    +                'name'    => 'T-Shirt',
    +                'options' => array('Size' => 'L', 'Color' => 'Red')
    +        ),
    +        array(
    +                'id'      => 'sku_567ZYX',
    +                'qty'     => 1,
    +                'price'   => 9.95,
    +                'name'    => 'Coffee Mug'
    +        ),
    +        array(
    +                'id'      => 'sku_965QRS',
    +                'qty'     => 1,
    +                'price'   => 29.95,
    +                'name'    => 'Shot Glass'
    +        )
    +);
    +
    +$this->cart->insert($data);
    +
    +
    +
    +
    +

    Displaying the Cart

    +

    To display the cart you will create a view +file with code similar to the one shown below.

    +

    Please note that this example uses the form +helper.

    +
    <?php echo form_open('path/to/controller/update/method'); ?>
    +
    +<table cellpadding="6" cellspacing="1" style="width:100%" border="0">
    +
    +<tr>
    +        <th>QTY</th>
    +        <th>Item Description</th>
    +        <th style="text-align:right">Item Price</th>
    +        <th style="text-align:right">Sub-Total</th>
    +</tr>
    +
    +<?php $i = 1; ?>
    +
    +<?php foreach ($this->cart->contents() as $items): ?>
    +
    +        <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
    +
    +        <tr>
    +                <td><?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td>
    +                <td>
    +                        <?php echo $items['name']; ?>
    +
    +                        <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
    +
    +                                <p>
    +                                        <?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
    +
    +                                                <strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br />
    +
    +                                        <?php endforeach; ?>
    +                                </p>
    +
    +                        <?php endif; ?>
    +
    +                </td>
    +                <td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td>
    +                <td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td>
    +        </tr>
    +
    +<?php $i++; ?>
    +
    +<?php endforeach; ?>
    +
    +<tr>
    +        <td colspan="2"> </td>
    +        <td class="right"><strong>Total</strong></td>
    +        <td class="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td>
    +</tr>
    +
    +</table>
    +
    +<p><?php echo form_submit('', 'Update your Cart'); ?></p>
    +
    +
    +
    +
    +

    Updating The Cart

    +

    To update the information in your cart, you must pass an array +containing the Row ID and one or more pre-defined properties to the +$this->cart->update() method.

    +
    +

    Note

    +

    If the quantity is set to zero, the item will be removed from +the cart.

    +
    +
    $data = array(
    +        'rowid' => 'b99ccdf16028f015540f341130b6d8ec',
    +        'qty'   => 3
    +);
    +
    +$this->cart->update($data);
    +
    +// Or a multi-dimensional array
    +
    +$data = array(
    +        array(
    +                'rowid'   => 'b99ccdf16028f015540f341130b6d8ec',
    +                'qty'     => 3
    +        ),
    +        array(
    +                'rowid'   => 'xw82g9q3r495893iajdh473990rikw23',
    +                'qty'     => 4
    +        ),
    +        array(
    +                'rowid'   => 'fh4kdkkkaoe30njgoe92rkdkkobec333',
    +                'qty'     => 2
    +        )
    +);
    +
    +$this->cart->update($data);
    +
    +
    +

    You may also update any property you have previously defined when +inserting the item such as options, price or other custom fields.

    +
    $data = array(
    +        'rowid'  => 'b99ccdf16028f015540f341130b6d8ec',
    +        'qty'    => 1,
    +        'price'  => 49.95,
    +        'coupon' => NULL
    +);
    +
    +$this->cart->update($data);
    +
    +
    +
    +

    What is a Row ID?

    +

    The row ID is a unique identifier that is generated by the cart code +when an item is added to the cart. The reason a unique ID is created +is so that identical products with different options can be managed +by the cart.

    +

    For example, let’s say someone buys two identical t-shirts (same product +ID), but in different sizes. The product ID (and other attributes) will +be identical for both sizes because it’s the same shirt. The only +difference will be the size. The cart must therefore have a means of +identifying this difference so that the two sizes of shirts can be +managed independently. It does so by creating a unique “row ID” based on +the product ID and any options associated with it.

    +

    In nearly all cases, updating the cart will be something the user does +via the “view cart” page, so as a developer, it is unlikely that you +will ever have to concern yourself with the “row ID”, other than making +sure your “view cart” page contains this information in a hidden form +field, and making sure it gets passed to the update() method when +the update form is submitted. Please examine the construction of the +“view cart” page above for more information.

    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Cart
    +
    +
    +$product_id_rules = '.a-z0-9_-'
    +

    These are the regular expression rules that we use to validate the product +ID - alpha-numeric, dashes, underscores, or periods by default

    +
    + +
    +
    +$product_name_rules = 'w -.:'
    +

    These are the regular expression rules that we use to validate the product ID and product name - alpha-numeric, dashes, underscores, colons or periods by +default

    +
    + +
    +
    +$product_name_safe = TRUE
    +

    Whether or not to only allow safe product names. Default TRUE.

    +
    + +
    +
    +insert([$items = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $items (array) – Items to insert into the cart
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Insert items into the cart and save it to the session table. Returns TRUE +on success and FALSE on failure.

    +
    + +
    +
    +update([$items = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $items (array) – Items to update in the cart
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    This method permits changing the properties of a given item. +Typically it is called from the “view cart” page if a user makes changes +to the quantity before checkout. That array must contain the rowid +for each item.

    +
    + +
    +
    +remove($rowid)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $rowid (int) – ID of the item to remove from the cart
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Allows you to remove an item from the shopping cart by passing it the +$rowid.

    +
    + +
    +
    +total()
    +
    +++ + + + + + +
    Returns:Total amount
    Return type:int
    +

    Displays the total amount in the cart.

    +
    + +
    +
    +total_items()
    +
    +++ + + + + + +
    Returns:Total amount of items in the cart
    Return type:int
    +

    Displays the total number of items in the cart.

    +
    + +
    +
    +contents([$newest_first = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $newest_first (bool) – Whether to order the array with newest items first
    • +
    +
    Returns:

    An array of cart contents

    +
    Return type:

    array

    +
    +

    Returns an array containing everything in the cart. You can sort the +order by which the array is returned by passing it TRUE where the contents +will be sorted from newest to oldest, otherwise it is sorted from oldest +to newest.

    +
    + +
    +
    +get_item($row_id)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $row_id (int) – Row ID to retrieve
    • +
    +
    Returns:

    Array of item data

    +
    Return type:

    array

    +
    +

    Returns an array containing data for the item matching the specified row +ID, or FALSE if no such item exists.

    +
    + +
    +
    +has_options($row_id = '')
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $row_id (int) – Row ID to inspect
    • +
    +
    Returns:

    TRUE if options exist, FALSE otherwise

    +
    Return type:

    bool

    +
    +

    Returns TRUE (boolean) if a particular row in the cart contains options. +This method is designed to be used in a loop with contents(), since +you must pass the rowid to this method, as shown in the Displaying +the Cart example above.

    +
    + +
    +
    +product_options([$row_id = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $row_id (int) – Row ID
    • +
    +
    Returns:

    Array of product options

    +
    Return type:

    array

    +
    +

    Returns an array of options for a particular product. This method is +designed to be used in a loop with contents(), since you +must pass the rowid to this method, as shown in the Displaying the +Cart example above.

    +
    + +
    +
    +destroy()
    +
    +++ + + + +
    Return type:void
    +

    Permits you to destroy the cart. This method will likely be called +when you are finished processing the customer’s order.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html new file mode 100755 index 0000000..eadb090 --- /dev/null +++ b/user_guide/libraries/config.html @@ -0,0 +1,834 @@ + + + + + + + + + + Config Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Config Class

    +

    The Config class provides a means to retrieve configuration preferences. +These preferences can come from the default config file +(application/config/config.php) or from your own custom config files.

    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    + +
    +

    Working with the Config Class

    +
    +

    Anatomy of a Config File

    +

    By default, CodeIgniter has one primary config file, located at +application/config/config.php. If you open the file using your text +editor you’ll see that config items are stored in an array called +$config.

    +

    You can add your own config items to this file, or if you prefer to keep +your configuration items separate (assuming you even need config items), +simply create your own file and save it in config folder.

    +
    +

    Note

    +

    If you do create your own config files use the same format as +the primary one, storing your items in an array called $config. +CodeIgniter will intelligently manage these files so there will be no +conflict even though the array has the same name (assuming an array +index is not named the same as another).

    +
    +
    +
    +

    Loading a Config File

    +
    +

    Note

    +

    CodeIgniter automatically loads the primary config file +(application/config/config.php), so you will only need to load a config +file if you have created your own.

    +
    +

    There are two ways to load a config file:

    +
    +

    Manual Loading

    +

    To load one of your custom config files you will use the following +function within the controller that +needs it:

    +
    $this->config->load('filename');
    +
    +
    +

    Where filename is the name of your config file, without the .php file +extension.

    +

    If you need to load multiple config files normally they will be +merged into one master config array. Name collisions can occur, +however, if you have identically named array indexes in different +config files. To avoid collisions you can set the second parameter to +TRUE and each config file will be stored in an array index +corresponding to the name of the config file. Example:

    +
    // Stored in an array with this prototype: $this->config['blog_settings'] = $config
    +$this->config->load('blog_settings', TRUE);
    +
    +
    +

    Please see the section entitled Fetching Config Items below to learn +how to retrieve config items set this way.

    +

    The third parameter allows you to suppress errors in the event that a +config file does not exist:

    +
    $this->config->load('blog_settings', FALSE, TRUE);
    +
    +
    +
    +
    +

    Auto-loading

    +

    If you find that you need a particular config file globally, you can +have it loaded automatically by the system. To do this, open the +autoload.php file, located at application/config/autoload.php, +and add your config file as indicated in the file.

    +
    +
    +
    +

    Fetching Config Items

    +

    To retrieve an item from your config file, use the following function:

    +
    $this->config->item('item_name');
    +
    +
    +

    Where item_name is the $config array index you want to retrieve. For +example, to fetch your language choice you’ll do this:

    +
    $lang = $this->config->item('language');
    +
    +
    +

    The function returns NULL if the item you are trying to fetch +does not exist.

    +

    If you are using the second parameter of the $this->config->load +function in order to assign your config items to a specific index you +can retrieve it by specifying the index name in the second parameter of +the $this->config->item() function. Example:

    +
    // Loads a config file named blog_settings.php and assigns it to an index named "blog_settings"
    +$this->config->load('blog_settings', TRUE);
    +
    +// Retrieve a config item named site_name contained within the blog_settings array
    +$site_name = $this->config->item('site_name', 'blog_settings');
    +
    +// An alternate way to specify the same item:
    +$blog_config = $this->config->item('blog_settings');
    +$site_name = $blog_config['site_name'];
    +
    +
    +
    +
    +

    Setting a Config Item

    +

    If you would like to dynamically set a config item or change an existing +one, you can do so using:

    +
    $this->config->set_item('item_name', 'item_value');
    +
    +
    +

    Where item_name is the $config array index you want to change, and +item_value is its value.

    +
    +
    +

    Environments

    +

    You may load different configuration files depending on the current +environment. The ENVIRONMENT constant is defined in index.php, and is +described in detail in the Handling +Environments section.

    +

    To create an environment-specific configuration file, create or copy a +configuration file in application/config/{ENVIRONMENT}/{FILENAME}.php

    +

    For example, to create a production-only config.php, you would:

    +
      +
    1. Create the directory application/config/production/
    2. +
    3. Copy your existing config.php into the above directory
    4. +
    5. Edit application/config/production/config.php so it contains your +production settings
    6. +
    +

    When you set the ENVIRONMENT constant to ‘production’, the settings for +your new production-only config.php will be loaded.

    +

    You can place the following configuration files in environment-specific +folders:

    +
      +
    • Default CodeIgniter configuration files
    • +
    • Your own custom configuration files
    • +
    +
    +

    Note

    +

    CodeIgniter always loads the global config file first (i.e., the one in application/config/), +then tries to load the configuration files for the current environment. +This means you are not obligated to place all of your configuration files in an +environment folder. Only the files that change per environment. Additionally you don’t +have to copy all the config items in the environment config file. Only the config items +that you wish to change for your environment. The config items declared in your environment +folders always overwrite those in your global config files.

    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Config
    +
    +
    +$config
    +

    Array of all loaded config values

    +
    + +
    +
    +$is_loaded
    +

    Array of all loaded config files

    +
    + +
    +
    +item($item[, $index=''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – Config item name
    • +
    • $index (string) – Index name
    • +
    +
    Returns:

    Config item value or NULL if not found

    +
    Return type:

    mixed

    +
    +

    Fetch a config file item.

    +
    + +
    +
    +set_item($item, $value)
    +
    +++ + + + + + +
    Parameters:
      +
    • $item (string) – Config item name
    • +
    • $value (string) – Config item value
    • +
    +
    Return type:

    void

    +
    +

    Sets a config file item to the specified value.

    +
    + +
    +
    +slash_item($item)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – config item name
    • +
    +
    Returns:

    Config item value with a trailing forward slash or NULL if not found

    +
    Return type:

    mixed

    +
    +

    This method is identical to item(), except it appends a forward +slash to the end of the item, if it exists.

    +
    + +
    +
    +load([$file = ''[, $use_sections = FALSE[, $fail_gracefully = FALSE]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $file (string) – Configuration file name
    • +
    • $use_sections (bool) – Whether config values should be loaded into their own section (index of the main config array)
    • +
    • $fail_gracefully (bool) – Whether to return FALSE or to display an error message
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Loads a configuration file.

    +
    + +
    +
    +site_url()
    +
    +++ + + + + + +
    Returns:Site URL
    Return type:string
    +

    This method retrieves the URL to your site, along with the “index” value +you’ve specified in the config file.

    +

    This method is normally accessed via the corresponding functions in the +URL Helper.

    +
    + +
    +
    +base_url()
    +
    +++ + + + + + +
    Returns:Base URL
    Return type:string
    +

    This method retrieves the URL to your site, plus an optional path such +as to a stylesheet or image.

    +

    This method is normally accessed via the corresponding functions in the +URL Helper.

    +
    + +
    +
    +system_url()
    +
    +++ + + + + + +
    Returns:URL pointing at your CI system/ directory
    Return type:string
    +

    This method retrieves the URL to your CodeIgniter system/ directory.

    +
    +

    Note

    +

    This method is DEPRECATED because it encourages usage of +insecure coding practices. Your system/ directory shouldn’t +be publicly accessible.

    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html new file mode 100755 index 0000000..1982d83 --- /dev/null +++ b/user_guide/libraries/email.html @@ -0,0 +1,1218 @@ + + + + + + + + + + Email Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Email Class

    +

    CodeIgniter’s robust Email Class supports the following features:

    +
      +
    • Multiple Protocols: Mail, Sendmail, and SMTP
    • +
    • TLS and SSL Encryption for SMTP
    • +
    • Multiple recipients
    • +
    • CC and BCCs
    • +
    • HTML or Plaintext email
    • +
    • Attachments
    • +
    • Word wrapping
    • +
    • Priorities
    • +
    • BCC Batch Mode, enabling large email lists to be broken into small +BCC batches.
    • +
    • Email Debugging tools
    • +
    + +
    +

    Using the Email Library

    +
    +

    Sending Email

    +

    Sending email is not only simple, but you can configure it on the fly or +set your preferences in a config file.

    +

    Here is a basic example demonstrating how you might send email. Note: +This example assumes you are sending the email from one of your +controllers.

    +
    $this->load->library('email');
    +
    +$this->email->from('your@example.com', 'Your Name');
    +$this->email->to('someone@example.com');
    +$this->email->cc('another@another-example.com');
    +$this->email->bcc('them@their-example.com');
    +
    +$this->email->subject('Email Test');
    +$this->email->message('Testing the email class.');
    +
    +$this->email->send();
    +
    +
    +
    +
    +

    Setting Email Preferences

    +

    There are 21 different preferences available to tailor how your email +messages are sent. You can either set them manually as described here, +or automatically via preferences stored in your config file, described +below:

    +

    Preferences are set by passing an array of preference values to the +email initialize method. Here is an example of how you might set some +preferences:

    +
    $config['protocol'] = 'sendmail';
    +$config['mailpath'] = '/usr/sbin/sendmail';
    +$config['charset'] = 'iso-8859-1';
    +$config['wordwrap'] = TRUE;
    +
    +$this->email->initialize($config);
    +
    +
    +
    +

    Note

    +

    Most of the preferences have default values that will be used +if you do not set them.

    +
    +
    +

    Setting Email Preferences in a Config File

    +

    If you prefer not to set preferences using the above method, you can +instead put them into a config file. Simply create a new file called the +email.php, add the $config array in that file. Then save the file at +config/email.php and it will be used automatically. You will NOT need to +use the $this->email->initialize() method if you save your +preferences in a config file.

    +
    +
    +
    +

    Email Preferences

    +

    The following is a list of all the preferences that can be set when +sending email.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    useragentCodeIgniterNoneThe “user agent”.
    protocolmailmail, sendmail, or smtpThe mail sending protocol.
    mailpath/usr/sbin/sendmailNoneThe server path to Sendmail.
    smtp_hostNo DefaultNoneSMTP Server Address.
    smtp_userNo DefaultNoneSMTP Username.
    smtp_passNo DefaultNoneSMTP Password.
    smtp_port25NoneSMTP Port.
    smtp_timeout5NoneSMTP Timeout (in seconds).
    smtp_keepaliveFALSETRUE or FALSE (boolean)Enable persistent SMTP connections.
    smtp_cryptoNo Defaulttls or sslSMTP Encryption
    wordwrapTRUETRUE or FALSE (boolean)Enable word-wrap.
    wrapchars76 Character count to wrap at.
    mailtypetexttext or htmlType of mail. If you send HTML email you must send it as a complete web +page. Make sure you don’t have any relative links or relative image +paths otherwise they will not work.
    charset$config['charset'] Character set (utf-8, iso-8859-1, etc.).
    validateFALSETRUE or FALSE (boolean)Whether to validate the email address.
    priority31, 2, 3, 4, 5Email Priority. 1 = highest. 5 = lowest. 3 = normal.
    crlf\n“\r\n” or “\n” or “\r”Newline character. (Use “\r\n” to comply with RFC 822).
    newline\n“\r\n” or “\n” or “\r”Newline character. (Use “\r\n” to comply with RFC 822).
    bcc_batch_modeFALSETRUE or FALSE (boolean)Enable BCC Batch Mode.
    bcc_batch_size200NoneNumber of emails in each BCC batch.
    dsnFALSETRUE or FALSE (boolean)Enable notify message from server
    +
    +
    +

    Overriding Word Wrapping

    +

    If you have word wrapping enabled (recommended to comply with RFC 822) +and you have a very long link in your email it can get wrapped too, +causing it to become un-clickable by the person receiving it. +CodeIgniter lets you manually override word wrapping within part of your +message like this:

    +
    The text of your email that
    +gets wrapped normally.
    +
    +{unwrap}http://example.com/a_long_link_that_should_not_be_wrapped.html{/unwrap}
    +
    +More text that will be
    +wrapped normally.
    +
    +
    +

    Place the item you do not want word-wrapped between: {unwrap} {/unwrap}

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Email
    +
    +
    +from($from[, $name = ''[, $return_path = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $from (string) – “From” e-mail address
    • +
    • $name (string) – “From” display name
    • +
    • $return_path (string) – Optional email address to redirect undelivered e-mail to
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the email address and name of the person sending the email:

    +
    $this->email->from('you@example.com', 'Your Name');
    +
    +
    +

    You can also set a Return-Path, to help redirect undelivered mail:

    +
    $this->email->from('you@example.com', 'Your Name', 'returned_emails@example.com');
    +
    +
    +
    +

    Note

    +

    Return-Path can’t be used if you’ve configured ‘smtp’ as +your protocol.

    +
    +
    + +
    +
    +reply_to($replyto[, $name = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $replyto (string) – E-mail address for replies
    • +
    • $name (string) – Display name for the reply-to e-mail address
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the reply-to address. If the information is not provided the +information in the :meth:from method is used. Example:

    +
    $this->email->reply_to('you@example.com', 'Your Name');
    +
    +
    +
    + +
    +
    +to($to)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $to (mixed) – Comma-delimited string or an array of e-mail addresses
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the email address(s) of the recipient(s). Can be a single e-mail, +a comma-delimited list or an array:

    +
    $this->email->to('someone@example.com');
    +
    +
    +
    $this->email->to('one@example.com, two@example.com, three@example.com');
    +
    +
    +
    $this->email->to(
    +        array('one@example.com', 'two@example.com', 'three@example.com')
    +);
    +
    +
    +
    + +
    +
    +cc($cc)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $cc (mixed) – Comma-delimited string or an array of e-mail addresses
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the CC email address(s). Just like the “to”, can be a single e-mail, +a comma-delimited list or an array.

    +
    + +
    +
    +bcc($bcc[, $limit = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $bcc (mixed) – Comma-delimited string or an array of e-mail addresses
    • +
    • $limit (int) – Maximum number of e-mails to send per batch
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the BCC email address(s). Just like the to() method, can be a single +e-mail, a comma-delimited list or an array.

    +

    If $limit is set, “batch mode” will be enabled, which will send +the emails to batches, with each batch not exceeding the specified +$limit.

    +
    + +
    +
    +subject($subject)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $subject (string) – E-mail subject line
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the email subject:

    +
    $this->email->subject('This is my subject');
    +
    +
    +
    + +
    +
    +message($body)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $body (string) – E-mail message body
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the e-mail message body:

    +
    $this->email->message('This is my message');
    +
    +
    +
    + +
    +
    +set_alt_message($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Alternative e-mail message body
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Sets the alternative e-mail message body:

    +
    $this->email->set_alt_message('This is the alternative message');
    +
    +
    +

    This is an optional message string which can be used if you send +HTML formatted email. It lets you specify an alternative message +with no HTML formatting which is added to the header string for +people who do not accept HTML email. If you do not set your own +message CodeIgniter will extract the message from your HTML email +and strip the tags.

    +
    + +
    +
    +set_header($header, $value)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $header (string) – Header name
    • +
    • $value (string) – Header value
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Appends additional headers to the e-mail:

    +
    $this->email->set_header('Header1', 'Value1');
    +$this->email->set_header('Header2', 'Value2');
    +
    +
    +
    + +
    +
    +clear([$clear_attachments = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $clear_attachments (bool) – Whether or not to clear attachments
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Initializes all the email variables to an empty state. This method +is intended for use if you run the email sending method in a loop, +permitting the data to be reset between cycles.

    +
    foreach ($list as $name => $address)
    +{
    +        $this->email->clear();
    +
    +        $this->email->to($address);
    +        $this->email->from('your@example.com');
    +        $this->email->subject('Here is your info '.$name);
    +        $this->email->message('Hi '.$name.' Here is the info you requested.');
    +        $this->email->send();
    +}
    +
    +
    +

    If you set the parameter to TRUE any attachments will be cleared as +well:

    +
    $this->email->clear(TRUE);
    +
    +
    +
    + +
    +
    +send([$auto_clear = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $auto_clear (bool) – Whether to clear message data automatically
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    The e-mail sending method. Returns boolean TRUE or FALSE based on +success or failure, enabling it to be used conditionally:

    +
    if ( ! $this->email->send())
    +{
    +        // Generate error
    +}
    +
    +
    +

    This method will automatically clear all parameters if the request was +successful. To stop this behaviour pass FALSE:

    +
    if ($this->email->send(FALSE))
    +{
    +        // Parameters won't be cleared
    +}
    +
    +
    +
    +

    Note

    +

    In order to use the print_debugger() method, you need +to avoid clearing the email parameters.

    +
    +
    + +
    +
    +attach($filename[, $disposition = ''[, $newname = NULL[, $mime = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filename (string) – File name
    • +
    • $disposition (string) – ‘disposition’ of the attachment. Most +email clients make their own decision regardless of the MIME +specification used here. https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
    • +
    • $newname (string) – Custom file name to use in the e-mail
    • +
    • $mime (string) – MIME type to use (useful for buffered data)
    • +
    +
    Returns:

    CI_Email instance (method chaining)

    +
    Return type:

    CI_Email

    +
    +

    Enables you to send an attachment. Put the file path/name in the first +parameter. For multiple attachments use the method multiple times. +For example:

    +
    $this->email->attach('/path/to/photo1.jpg');
    +$this->email->attach('/path/to/photo2.jpg');
    +$this->email->attach('/path/to/photo3.jpg');
    +
    +
    +

    To use the default disposition (attachment), leave the second parameter blank, +otherwise use a custom disposition:

    +
    $this->email->attach('image.jpg', 'inline');
    +
    +
    +

    You can also use a URL:

    +
    $this->email->attach('http://example.com/filename.pdf');
    +
    +
    +

    If you’d like to use a custom file name, you can use the third parameter:

    +
    $this->email->attach('filename.pdf', 'attachment', 'report.pdf');
    +
    +
    +

    If you need to use a buffer string instead of a real - physical - file you can +use the first parameter as buffer, the third parameter as file name and the fourth +parameter as mime-type:

    +
    $this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
    +
    +
    +
    + +
    +
    +attachment_cid($filename)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filename (string) – Existing attachment filename
    • +
    +
    Returns:

    Attachment Content-ID or FALSE if not found

    +
    Return type:

    string

    +
    +

    Sets and returns an attachment’s Content-ID, which enables your to embed an inline +(picture) attachment into HTML. First parameter must be the already attached file name.

    +
    $filename = '/img/photo1.jpg';
    +$this->email->attach($filename);
    +foreach ($list as $address)
    +{
    +        $this->email->to($address);
    +        $cid = $this->email->attachment_cid($filename);
    +        $this->email->message('<img src="cid:'. $cid .'" alt="photo1" />');
    +        $this->email->send();
    +}
    +
    +
    +
    +

    Note

    +

    Content-ID for each e-mail must be re-created for it to be unique.

    +
    +
    + +
    +
    +print_debugger([$include = array('headers', 'subject', 'body')])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $include (array) – Which parts of the message to print out
    • +
    +
    Returns:

    Formatted debug data

    +
    Return type:

    string

    +
    +

    Returns a string containing any server messages, the email headers, and +the email message. Useful for debugging.

    +

    You can optionally specify which parts of the message should be printed. +Valid options are: headers, subject, body.

    +

    Example:

    +
    // You need to pass FALSE while sending in order for the email data
    +// to not be cleared - if that happens, print_debugger() would have
    +// nothing to output.
    +$this->email->send(FALSE);
    +
    +// Will only print the email headers, excluding the message subject and body
    +$this->email->print_debugger(array('headers'));
    +
    +
    +
    +

    Note

    +

    By default, all of the raw data will be printed.

    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/encrypt.html b/user_guide/libraries/encrypt.html new file mode 100755 index 0000000..8952b0a --- /dev/null +++ b/user_guide/libraries/encrypt.html @@ -0,0 +1,787 @@ + + + + + + + + + + Encrypt Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Encrypt Class

    +

    The Encrypt Class provides two-way data encryption. It encrypted using +the Mcrypt PHP extension, which is required for the Encrypt Class to run.

    +
    +

    Important

    +

    This library has been DEPRECATED and is only kept for +backwards compatibility. Please use the new Encryption Library.

    +
    + +
    +

    Using the Encrypt Library

    +
    +

    Setting your Key

    +

    A key is a piece of information that controls the cryptographic +process and permits an encrypted string to be decoded. In fact, the key +you chose will provide the only means to decode data that was +encrypted with that key, so not only must you choose the key carefully, +you must never change it if you intend use it for persistent data.

    +

    It goes without saying that you should guard your key carefully. Should +someone gain access to your key, the data will be easily decoded. If +your server is not totally under your control it’s impossible to ensure +key security so you may want to think carefully before using it for +anything that requires high security, like storing credit card numbers.

    +

    To take maximum advantage of the encryption algorithm, your key should +be 32 characters in length (256 bits). The key should be as random a +string as you can concoct, with numbers and uppercase and lowercase +letters. Your key should not be a simple text string. In order to be +cryptographically secure it needs to be as random as possible.

    +

    Your key can be either stored in your application/config/config.php, or +you can design your own storage mechanism and pass the key dynamically +when encoding/decoding.

    +

    To save your key to your application/config/config.php, open the file +and set:

    +
    $config['encryption_key'] = "YOUR KEY";
    +
    +
    +
    +
    +

    Message Length

    +

    It’s important for you to know that the encoded messages the encryption +function generates will be approximately 2.6 times longer than the +original message. For example, if you encrypt the string “my super +secret data”, which is 21 characters in length, you’ll end up with an +encoded string that is roughly 55 characters (we say “roughly” because +the encoded string length increments in 64 bit clusters, so it’s not +exactly linear). Keep this information in mind when selecting your data +storage mechanism. Cookies, for example, can only hold 4K of +information.

    +
    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Encrypt class is +initialized in your controller using the $this->load->library() +method:

    +
    $this->load->library('encrypt');
    +
    +
    +

    Once loaded, the Encrypt library object will be available using:

    +
    $this->encrypt
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Encrypt
    +
    +
    +encode($string[, $key = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $string (string) – Data to encrypt
    • +
    • $key (string) – Encryption key
    • +
    +
    Returns:

    Encrypted string

    +
    Return type:

    string

    +
    +

    Performs the data encryption and returns it as a string. Example:

    +
    $msg = 'My secret message';
    +
    +$encrypted_string = $this->encrypt->encode($msg);
    +
    +
    +

    You can optionally pass your encryption key via the second parameter if +you don’t want to use the one in your config file:

    +
    $msg = 'My secret message';
    +$key = 'super-secret-key';
    +
    +$encrypted_string = $this->encrypt->encode($msg, $key);
    +
    +
    +
    + +
    +
    +decode($string[, $key = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $string (string) – String to decrypt
    • +
    • $key (string) – Encryption key
    • +
    +
    Returns:

    Plain-text string

    +
    Return type:

    string

    +
    +

    Decrypts an encoded string. Example:

    +
    $encrypted_string = 'APANtByIGI1BpVXZTJgcsAG8GZl8pdwwa84';
    +
    +$plaintext_string = $this->encrypt->decode($encrypted_string);
    +
    +
    +

    You can optionally pass your encryption key via the second parameter if +you don’t want to use the one in your config file:

    +
    $msg = 'My secret message';
    +$key = 'super-secret-key';
    +
    +$encrypted_string = $this->encrypt->decode($msg, $key);
    +
    +
    +
    + +
    +
    +set_cipher($cipher)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $cipher (int) – Valid PHP MCrypt cypher constant
    • +
    +
    Returns:

    CI_Encrypt instance (method chaining)

    +
    Return type:

    CI_Encrypt

    +
    +

    Permits you to set an Mcrypt cipher. By default it uses +MCRYPT_RIJNDAEL_256. Example:

    +
    $this->encrypt->set_cipher(MCRYPT_BLOWFISH);
    +
    +
    +

    Please visit php.net for a list of available ciphers.

    +

    If you’d like to manually test whether your server supports MCrypt you +can use:

    +
    echo extension_loaded('mcrypt') ? 'Yup' : 'Nope';
    +
    +
    +
    + +
    +
    +set_mode($mode)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $mode (int) – Valid PHP MCrypt mode constant
    • +
    +
    Returns:

    CI_Encrypt instance (method chaining)

    +
    Return type:

    CI_Encrypt

    +
    +

    Permits you to set an Mcrypt mode. By default it uses MCRYPT_MODE_CBC. +Example:

    +
    $this->encrypt->set_mode(MCRYPT_MODE_CFB);
    +
    +
    +

    Please visit php.net for a list of available modes.

    +
    + +
    +
    +encode_from_legacy($string[, $legacy_mode = MCRYPT_MODE_ECB[, $key = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $string (string) – String to encrypt
    • +
    • $legacy_mode (int) – Valid PHP MCrypt cipher constant
    • +
    • $key (string) – Encryption key
    • +
    +
    Returns:

    Newly encrypted string

    +
    Return type:

    string

    +
    +

    Enables you to re-encode data that was originally encrypted with +CodeIgniter 1.x to be compatible with the Encrypt library in +CodeIgniter 2.x. It is only necessary to use this method if you have +encrypted data stored permanently such as in a file or database and are +on a server that supports Mcrypt. “Light” use encryption such as +encrypted session data or transitory encrypted flashdata require no +intervention on your part. However, existing encrypted Sessions will be +destroyed since data encrypted prior to 2.x will not be decoded.

    +
    +

    Important

    +

    Why only a method to re-encode the data instead of maintaining legacy +methods for both encoding and decoding? The algorithms in the +Encrypt library have improved in CodeIgniter 2.x both for performance +and security, and we do not wish to encourage continued use of the older +methods. You can of course extend the Encryption library if you wish and +replace the new methods with the old and retain seamless compatibility +with CodeIgniter 1.x encrypted data, but this a decision that a +developer should make cautiously and deliberately, if at all.

    +
    +
    $new_data = $this->encrypt->encode_from_legacy($old_encrypted_string);
    +
    +
    + +++++ + + + + + + + + + + + + + + + + + + + + +
    ParameterDefaultDescription
    $orig_datan/aThe original encrypted data from CodeIgniter 1.x’s Encryption library
    $legacy_modeMCRYPT_MODE_ECBThe Mcrypt mode that was used to generate the original encrypted data. +CodeIgniter 1.x’s default was MCRYPT_MODE_ECB, and it will assume that +to be the case unless overridden by this parameter.
    $keyn/aThe encryption key. This it typically specified in your config file as +outlined above.
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html new file mode 100755 index 0000000..82f4e6c --- /dev/null +++ b/user_guide/libraries/encryption.html @@ -0,0 +1,1405 @@ + + + + + + + + + + Encryption Library — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Encryption Library
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Encryption Library

    +
    +

    Important

    +

    DO NOT use this or any other encryption library for +user password storage! Passwords must be hashed instead, and you +should do that via PHP’s own Password Hashing extension.

    +
    +

    The Encryption Library provides two-way data encryption. To do so in +a cryptographically secure way, it utilizes PHP extensions that are +unfortunately not always available on all systems. +You must meet one of the following dependencies in order to use this +library:

    + +

    If neither of the above dependencies is met, we simply cannot offer +you a good enough implementation to meet the high standards required +for proper cryptography.

    + +
    +

    Using the Encryption Library

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Encryption library is +initialized in your controller using the $this->load->library() +method:

    +
    $this->load->library('encryption');
    +
    +
    +

    Once loaded, the Encryption library object will be available using:

    +
    $this->encryption
    +
    +
    +
    +
    +

    Default behavior

    +

    By default, the Encryption Library will use the AES-128 cipher in CBC +mode, using your configured encryption_key and SHA512 HMAC authentication.

    +
    +

    Note

    +

    AES-128 is chosen both because it is proven to be strong and +because of its wide availability across different cryptographic +software and programming languages’ APIs.

    +
    +

    However, the encryption_key is not used as is.

    +

    If you are somewhat familiar with cryptography, you should already know +that a HMAC also requires a secret key and using the same key for both +encryption and authentication is a bad practice.

    +

    Because of that, two separate keys are derived from your already configured +encryption_key: one for encryption and one for authentication. This is +done via a technique called HMAC-based Key Derivation Function (HKDF).

    +
    +
    +

    Setting your encryption_key

    +

    An encryption key is a piece of information that controls the +cryptographic process and permits a plain-text string to be encrypted, +and afterwards - decrypted. It is the secret “ingredient” in the whole +process that allows you to be the only one who is able to decrypt data +that you’ve decided to hide from the eyes of the public. +After one key is used to encrypt data, that same key provides the only +means to decrypt it, so not only must you chose one carefully, but you +must not lose it or you will also lose access to the data.

    +

    It must be noted that to ensure maximum security, such key should not +only be as strong as possible, but also often changed. Such behavior +however is rarely practical or possible to implement, and that is why +CodeIgniter gives you the ability to configure a single key that is to be +used (almost) every time.

    +

    It goes without saying that you should guard your key carefully. Should +someone gain access to your key, the data will be easily decrypted. If +your server is not totally under your control it’s impossible to ensure +key security so you may want to think carefully before using it for +anything that requires high security, like storing credit card numbers.

    +

    Your encryption key must be as long as the encyption algorithm in use +allows. For AES-128, that’s 128 bits or 16 bytes (charcters) long. +You will find a table below that shows the supported key lengths of +different ciphers.

    +

    The key should be as random as possible and it must not be a regular +text string, nor the output of a hashing function, etc. In order to create +a proper key, you must use the Encryption library’s create_key() method

    +
    // $key will be assigned a 16-byte (128-bit) random key
    +$key = $this->encryption->create_key(16);
    +
    +
    +

    The key can be either stored in your application/config/config.php, or +you can design your own storage mechanism and pass the key dynamically +when encrypting/decrypting.

    +

    To save your key to your application/config/config.php, open the file +and set:

    +
    $config['encryption_key'] = 'YOUR KEY';
    +
    +
    +

    You’ll notice that the create_key() method outputs binary data, which +is hard to deal with (i.e. a copy-paste may damage it), so you may use +bin2hex(), hex2bin() or Base64-encoding to work with the key in +a more friendly manner. For example:

    +
    // Get a hex-encoded representation of the key:
    +$key = bin2hex($this->encryption->create_key(16));
    +
    +// Put the same value in your config with hex2bin(),
    +// so that it is still passed as binary to the library:
    +$config['encryption_key'] = hex2bin(<your hex-encoded key>);
    +
    +
    +
    +
    +

    Supported encryption ciphers and modes

    +
    +

    Note

    +

    The terms ‘cipher’ and ‘encryption algorithm’ are interchangeable.

    +
    +
    +

    Portable ciphers

    +

    Because MCrypt and OpenSSL (also called drivers throughout this document) +each support different sets of encryption algorithms and often implement +them in different ways, our Encryption library is designed to use them in +a portable fashion, or in other words - it enables you to use them +interchangeably, at least for the ciphers supported by both drivers.

    +

    It is also implemented in a way that aims to match the standard +implementations in other programming languages and libraries.

    +

    Here’s a list of the so called “portable” ciphers, where +“CodeIgniter name” is the string value that you’d have to pass to the +Encryption library to use that cipher:

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Cipher nameCodeIgniter nameKey lengths (bits / bytes)Supported modes
    AES-128 / Rijndael-128aes-128128 / 16CBC, CTR, CFB, CFB8, OFB, ECB
    AES-192aes-192192 / 24CBC, CTR, CFB, CFB8, OFB, ECB
    AES-256aes-256256 / 32CBC, CTR, CFB, CFB8, OFB, ECB
    DESdes56 / 7CBC, CFB, CFB8, OFB, ECB
    TripleDEStripledes56 / 7, 112 / 14, 168 / 21CBC, CFB, CFB8, OFB
    Blowfishblowfish128-448 / 16-56CBC, CFB, OFB, ECB
    CAST5 / CAST-128cast588-128 / 11-16CBC, CFB, OFB, ECB
    RC4 / ARCFourrc440-2048 / 5-256Stream
    +
    +

    Important

    +

    Because of how MCrypt works, if you fail to provide a key +with the appropriate length, you might end up using a different +algorithm than the one configured, so be really careful with that!

    +
    +
    +

    Note

    +

    In case it isn’t clear from the above table, Blowfish, CAST5 +and RC4 support variable length keys. That is, any number in the +shown ranges is valid, although in bit terms that only happens +in 8-bit increments.

    +
    +
    +

    Note

    +

    Even though CAST5 supports key lengths lower than 128 bits +(16 bytes), in fact they will just be zero-padded to the +maximum length, as specified in RFC 2144.

    +
    +
    +

    Note

    +

    Blowfish supports key lengths as small as 32 bits (4 bytes), but +our tests have shown that only lengths of 128 bits (16 bytes) or +higher are properly supported by both MCrypt and OpenSSL. It is +also a bad practice to use such low-length keys anyway.

    +
    +
    +
    +

    Driver-specific ciphers

    +

    As noted above, MCrypt and OpenSSL support different sets of encryption +ciphers. For portability reasons and because we haven’t tested them +properly, we do not advise you to use the ones that are driver-specific, +but regardless, here’s a list of most of them:

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Cipher nameDriverKey lengths (bits / bytes)Supported modes
    AES-128OpenSSL128 / 16CBC, CTR, CFB, CFB8, OFB, ECB, XTS
    AES-192OpenSSL192 / 24CBC, CTR, CFB, CFB8, OFB, ECB, XTS
    AES-256OpenSSL256 / 32CBC, CTR, CFB, CFB8, OFB, ECB, XTS
    Rijndael-128MCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    Rijndael-192MCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    Rijndael-256MCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    GOSTMCrypt256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    TwofishMCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    CAST-128MCrypt40-128 / 5-16CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    CAST-256MCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    Loki97MCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    SaferPlusMCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    SerpentMCrypt128 / 16, 192 / 24, 256 / 32CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    XTEAMCrypt128 / 16CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    RC2MCrypt8-1024 / 1-128CBC, CTR, CFB, CFB8, OFB, OFB8, ECB
    RC2OpenSSL8-1024 / 1-128CBC, CFB, OFB, ECB
    Camellia-128OpenSSL128 / 16CBC, CFB, CFB8, OFB, ECB
    Camellia-192OpenSSL192 / 24CBC, CFB, CFB8, OFB, ECB
    Camellia-256OpenSSL256 / 32CBC, CFB, CFB8, OFB, ECB
    SeedOpenSSL128 / 16CBC, CFB, OFB, ECB
    +
    +

    Note

    +

    If you wish to use one of those ciphers, you’d have to pass +its name in lower-case to the Encryption library.

    +
    +
    +

    Note

    +

    You’ve probably noticed that all AES cipers (and Rijndael-128) +are also listed in the portable ciphers list. This is because +drivers support different modes for these ciphers. Also, it is +important to note that AES-128 and Rijndael-128 are actually +the same cipher, but only when used with a 128-bit key.

    +
    +
    +

    Note

    +

    CAST-128 / CAST-5 is also listed in both the portable and +driver-specific ciphers list. This is because OpenSSL’s +implementation doesn’t appear to be working correctly with +key sizes of 80 bits and lower.

    +
    +
    +

    Note

    +

    RC2 is listed as supported by both MCrypt and OpenSSL. +However, both drivers implement them differently and they +are not portable. It is probably worth noting that we only +found one obscure source confirming that it is MCrypt that +is not properly implementing it.

    +
    +
    +
    +

    Encryption modes

    +

    Different modes of encryption have different characteristics and serve +for different purposes. Some are stronger than others, some are faster +and some offer extra features. +We are not going in depth into that here, we’ll leave that to the +cryptography experts. The table below is to provide brief informational +reference to our more experienced users. If you are a beginner, just +stick to the CBC mode - it is widely accepted as strong and secure for +general purposes.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Mode nameCodeIgniter nameDriver supportAdditional info
    CBCcbcMCrypt, OpenSSLA safe default choice
    CTRctrMCrypt, OpenSSLConsidered as theoretically better than CBC, but not as widely available
    CFBcfbMCrypt, OpenSSLN/A
    CFB8cfb8MCrypt, OpenSSLSame as CFB, but operates in 8-bit mode (not recommended).
    OFBofbMCrypt, OpenSSLN/A
    OFB8ofb8MCryptSame as OFB, but operates in 8-bit mode (not recommended).
    ECBecbMCrypt, OpenSSLIgnores IV (not recommended).
    XTSxtsOpenSSLUsually used for encrypting random access data such as RAM or hard-disk storage.
    StreamstreamMCrypt, OpenSSLThis is not actually a mode, it just says that a stream cipher is being used. Required because of the general cipher+mode initialization process.
    +
    +
    +
    +

    Message Length

    +

    It’s probably important for you to know that an encrypted string is usually +longer than the original, plain-text string (depending on the cipher).

    +

    This is influenced by the cipher algorithm itself, the IV prepended to the +cipher-text and the HMAC authentication message that is also prepended. +Furthermore, the encrypted message is also Base64-encoded so that it is safe +for storage and transmission, regardless of a possible character set in use.

    +

    Keep this information in mind when selecting your data storage mechanism. +Cookies, for example, can only hold 4K of information.

    +
    +
    +

    Configuring the library

    +

    For usability, performance, but also historical reasons tied to our old +Encrypt Class, the Encryption library is designed to +use repeatedly the same driver, encryption cipher, mode and key.

    +

    As noted in the “Default behavior” section above, this means using an +auto-detected driver (OpenSSL has a higher priority), the AES-128 ciper +in CBC mode, and your $config['encryption_key'] value.

    +

    If you wish to change that however, you need to use the initialize() +method. It accepts an associative array of parameters, all of which are +optional:

    + ++++ + + + + + + + + + + + + + + + + + + + +
    OptionPossible values
    driver‘mcrypt’, ‘openssl’
    cipherCipher name (see Supported encryption ciphers and modes)
    modeEncryption mode (see Encryption modes)
    keyEncryption key
    +

    For example, if you were to change the encryption algorithm and +mode to AES-256 in CTR mode, this is what you should do:

    +
    $this->encryption->initialize(
    +        array(
    +                'cipher' => 'aes-256',
    +                'mode' => 'ctr',
    +                'key' => '<a 32-character random string>'
    +        )
    +);
    +
    +
    +

    Note that we only mentioned that you want to change the ciper and mode, +but we also included a key in the example. As previously noted, it is +important that you choose a key with a proper size for the used algorithm.

    +

    There’s also the ability to change the driver, if for some reason you +have both, but want to use MCrypt instead of OpenSSL:

    +
    // Switch to the MCrypt driver
    +$this->encryption->initialize(array('driver' => 'mcrypt'));
    +
    +// Switch back to the OpenSSL driver
    +$this->encryption->initialize(array('driver' => 'openssl'));
    +
    +
    +
    +
    +

    Encrypting and decrypting data

    +

    Encrypting and decrypting data with the already configured library +settings is simple. As simple as just passing the string to the +encrypt() and/or decrypt() methods:

    +
    $plain_text = 'This is a plain-text message!';
    +$ciphertext = $this->encryption->encrypt($plain_text);
    +
    +// Outputs: This is a plain-text message!
    +echo $this->encryption->decrypt($ciphertext);
    +
    +
    +

    And that’s it! The Encryption library will do everything necessary +for the whole process to be cryptographically secure out-of-the-box. +You don’t need to worry about it.

    +
    +

    Important

    +

    Both methods will return FALSE in case of an error. +While for encrypt() this can only mean incorrect +configuration, you should always check the return value +of decrypt() in production code.

    +
    +
    +

    How it works

    +

    If you must know how the process works, here’s what happens under +the hood:

    +
      +
    • $this->encryption->encrypt($plain_text)
        +
      1. Derive an encryption key and a HMAC key from your configured +encryption_key via HKDF, using the SHA-512 digest algorithm.
      2. +
      3. Generate a random initialization vector (IV).
      4. +
      5. Encrypt the data via AES-128 in CBC mode (or another previously +configured cipher and mode), using the above-mentioned derived +encryption key and IV.
      6. +
      7. Prepend said IV to the resulting cipher-text.
      8. +
      9. Base64-encode the resulting string, so that it can be safely +stored or transferred without worrying about character sets.
      10. +
      11. Create a SHA-512 HMAC authentication message using the derived +HMAC key to ensure data integrity and prepend it to the Base64 +string.
      12. +
      +
    • +
    • $this->encryption->decrypt($ciphertext)
        +
      1. Derive an encryption key and a HMAC key from your configured +encryption_key via HKDF, using the SHA-512 digest algorithm. +Because your configured encryption_key is the same, this +will produce the same result as in the encrypt() method +above - otherwise you won’t be able to decrypt it.
      2. +
      3. Check if the string is long enough, separate the HMAC out of +it and validate if it is correct (this is done in a way that +prevents timing attacks against it). Return FALSE if either of +the checks fails.
      4. +
      5. Base64-decode the string.
      6. +
      7. Separate the IV out of the cipher-text and decrypt the said +cipher-text using that IV and the derived encryption key.
      8. +
      +
    • +
    +
    +
    +

    Using custom parameters

    +

    Let’s say you have to interact with another system that is out +of your control and uses another method to encrypt data. A +method that will most certainly not match the above-described +sequence and probably not use all of the steps either.

    +

    The Encryption library allows you to change how its encryption +and decryption processes work, so that you can easily tailor a +custom solution for such situations.

    +
    +

    Note

    +

    It is possible to use the library in this way, without +setting an encryption_key in your configuration file.

    +
    +

    All you have to do is to pass an associative array with a few +parameters to either the encrypt() or decrypt() method. +Here’s an example:

    +
    // Assume that we have $ciphertext, $key and $hmac_key
    +// from on outside source
    +
    +$message = $this->encryption->decrypt(
    +        $ciphertext,
    +        array(
    +                'cipher' => 'blowfish',
    +                'mode' => 'cbc',
    +                'key' => $key,
    +                'hmac_digest' => 'sha256',
    +                'hmac_key' => $hmac_key
    +        )
    +);
    +
    +
    +

    In the above example, we are decrypting a message that was encrypted +using the Blowfish cipher in CBC mode and authenticated via a SHA-256 +HMAC.

    +
    +

    Important

    +

    Note that both ‘key’ and ‘hmac_key’ are used in this +example. When using custom parameters, encryption and HMAC keys +are not derived like the default behavior of the library is.

    +
    +

    Below is a list of the available options.

    +

    However, unless you really need to and you know what you are doing, +we advise you to not change the encryption process as this could +impact security, so please do so with caution.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OptionDefault valueMandatory / OptionalDescription
    cipherN/AYesEncryption algorithm (see Supported encryption ciphers and modes).
    modeN/AYesEncryption mode (see Encryption modes).
    keyN/AYesEncryption key.
    hmacTRUENoWhether to use a HMAC. +Boolean. If set to FALSE, then hmac_digest and +hmac_key will be ignored.
    hmac_digestsha512NoHMAC message digest algorithm (see Supported HMAC authentication algorithms).
    hmac_keyN/AYes, unless hmac is FALSEHMAC key.
    raw_dataFALSENoWhether the cipher-text should be raw. +Boolean. If set to TRUE, then Base64 encoding and +decoding will not be performed and HMAC will not +be a hexadecimal string.
    +
    +

    Important

    +

    encrypt() and decrypt() will return FALSE if +a mandatory parameter is not provided or if a provided +value is incorrect. This includes hmac_key, unless hmac +is set to FALSE.

    +
    +
    +
    +

    Supported HMAC authentication algorithms

    +

    For HMAC message authentication, the Encryption library supports +usage of the SHA-2 family of algorithms:

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
    AlgorithmRaw length (bytes)Hex-encoded length (bytes)
    sha51264128
    sha3844896
    sha2563264
    sha2242856
    +

    The reason for not including other popular algorithms, such as +MD5 or SHA1 is that they are no longer considered secure enough +and as such, we don’t want to encourage their usage. +If you absolutely need to use them, it is easy to do so via PHP’s +native hash_hmac() function.

    +

    Stronger algorithms of course will be added in the future as they +appear and become widely available.

    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Encryption
    +
    +
    +initialize($params)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $params (array) – Configuration parameters
    • +
    +
    Returns:

    CI_Encryption instance (method chaining)

    +
    Return type:

    CI_Encryption

    +
    +

    Initializes (configures) the library to use a different +driver, cipher, mode or key.

    +

    Example:

    +
    $this->encryption->initialize(
    +        array('mode' => 'ctr')
    +);
    +
    +
    +

    Please refer to the Configuring the library section for detailed info.

    +
    + +
    +
    +encrypt($data[, $params = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Data to encrypt
    • +
    • $params (array) – Optional parameters
    • +
    +
    Returns:

    Encrypted data or FALSE on failure

    +
    Return type:

    string

    +
    +

    Encrypts the input data and returns its ciphertext.

    +

    Example:

    +
    $ciphertext = $this->encryption->encrypt('My secret message');
    +
    +
    +

    Please refer to the Using custom parameters section for information +on the optional parameters.

    +
    + +
    +
    +decrypt($data[, $params = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Data to decrypt
    • +
    • $params (array) – Optional parameters
    • +
    +
    Returns:

    Decrypted data or FALSE on failure

    +
    Return type:

    string

    +
    +

    Decrypts the input data and returns it in plain-text.

    +

    Example:

    +
    echo $this->encryption->decrypt($ciphertext);
    +
    +
    +

    Please refer to the Using custom parameters secrion for information +on the optional parameters.

    +
    + +
    +
    +create_key($length)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $length (int) – Output length
    • +
    +
    Returns:

    A pseudo-random cryptographic key with the specified length, or FALSE on failure

    +
    Return type:

    string

    +
    +

    Creates a cryptographic key by fetching random data from +the operating system’s sources (i.e. /dev/urandom).

    +
    + +
    +
    +hkdf($key[, $digest = 'sha512'[, $salt = NULL[, $length = NULL[, $info = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Input key material
    • +
    • $digest (string) – A SHA-2 family digest algorithm
    • +
    • $salt (string) – Optional salt
    • +
    • $length (int) – Optional output length
    • +
    • $info (string) – Optional context/application-specific info
    • +
    +
    Returns:

    A pseudo-random key or FALSE on failure

    +
    Return type:

    string

    +
    +

    Derives a key from another, presumably weaker key.

    +

    This method is used internally to derive an encryption and HMAC key +from your configured encryption_key.

    +

    It is publicly available due to its otherwise general purpose. It is +described in RFC 5869.

    +

    However, as opposed to the description in RFC 5869, this implementation +doesn’t support SHA1.

    +

    Example:

    +
    $hmac_key = $this->encryption->hkdf(
    +        $key,
    +        'sha512',
    +        NULL,
    +        NULL,
    +        'authentication'
    +);
    +
    +// $hmac_key is a pseudo-random key with a length of 64 bytes
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html new file mode 100755 index 0000000..137ec68 --- /dev/null +++ b/user_guide/libraries/file_uploading.html @@ -0,0 +1,1025 @@ + + + + + + + + + + File Uploading Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • File Uploading Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    File Uploading Class

    +

    CodeIgniter’s File Uploading Class permits files to be uploaded. You can +set various preferences, restricting the type and size of the files.

    + +
    +

    The Process

    +

    Uploading a file involves the following general process:

    +
      +
    • An upload form is displayed, allowing a user to select a file and +upload it.
    • +
    • When the form is submitted, the file is uploaded to the destination +you specify.
    • +
    • Along the way, the file is validated to make sure it is allowed to be +uploaded based on the preferences you set.
    • +
    • Once uploaded, the user will be shown a success message.
    • +
    +

    To demonstrate this process here is brief tutorial. Afterward you’ll +find reference information.

    +
    +

    Creating the Upload Form

    +

    Using a text editor, create a form called upload_form.php. In it, place +this code and save it to your application/views/ directory:

    +
    <html>
    +<head>
    +<title>Upload Form</title>
    +</head>
    +<body>
    +
    +<?php echo $error;?>
    +
    +<?php echo form_open_multipart('upload/do_upload');?>
    +
    +<input type="file" name="userfile" size="20" />
    +
    +<br /><br />
    +
    +<input type="submit" value="upload" />
    +
    +</form>
    +
    +</body>
    +</html>
    +
    +
    +

    You’ll notice we are using a form helper to create the opening form tag. +File uploads require a multipart form, so the helper creates the proper +syntax for you. You’ll also notice we have an $error variable. This is +so we can show error messages in the event the user does something +wrong.

    +
    +
    +

    The Success Page

    +

    Using a text editor, create a form called upload_success.php. In it, +place this code and save it to your application/views/ directory:

    +
    <html>
    +<head>
    +<title>Upload Form</title>
    +</head>
    +<body>
    +
    +<h3>Your file was successfully uploaded!</h3>
    +
    +<ul>
    +<?php foreach ($upload_data as $item => $value):?>
    +<li><?php echo $item;?>: <?php echo $value;?></li>
    +<?php endforeach; ?>
    +</ul>
    +
    +<p><?php echo anchor('upload', 'Upload Another File!'); ?></p>
    +
    +</body>
    +</html>
    +
    +
    +
    +
    +

    The Controller

    +

    Using a text editor, create a controller called Upload.php. In it, place +this code and save it to your application/controllers/ directory:

    +
    <?php
    +
    +class Upload extends CI_Controller {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                $this->load->helper(array('form', 'url'));
    +        }
    +
    +        public function index()
    +        {
    +                $this->load->view('upload_form', array('error' => ' ' ));
    +        }
    +
    +        public function do_upload()
    +        {
    +                $config['upload_path']          = './uploads/';
    +                $config['allowed_types']        = 'gif|jpg|png';
    +                $config['max_size']             = 100;
    +                $config['max_width']            = 1024;
    +                $config['max_height']           = 768;
    +
    +                $this->load->library('upload', $config);
    +
    +                if ( ! $this->upload->do_upload('userfile'))
    +                {
    +                        $error = array('error' => $this->upload->display_errors());
    +
    +                        $this->load->view('upload_form', $error);
    +                }
    +                else
    +                {
    +                        $data = array('upload_data' => $this->upload->data());
    +
    +                        $this->load->view('upload_success', $data);
    +                }
    +        }
    +}
    +?>
    +
    +
    +
    +
    +

    The Upload Directory

    +

    You’ll need a destination directory for your uploaded images. Create a +directory at the root of your CodeIgniter installation called uploads +and set its file permissions to 777.

    +
    +
    +

    Try it!

    +

    To try your form, visit your site using a URL similar to this one:

    +
    example.com/index.php/upload/
    +
    +
    +

    You should see an upload form. Try uploading an image file (either a +jpg, gif, or png). If the path in your controller is correct it should +work.

    +
    +
    +
    +

    Reference Guide

    +
    +

    Initializing the Upload Class

    +

    Like most other classes in CodeIgniter, the Upload class is initialized +in your controller using the $this->load->library() method:

    +
    $this->load->library('upload');
    +
    +
    +

    Once the Upload class is loaded, the object will be available using: +$this->upload

    +
    +
    +

    Setting Preferences

    +

    Similar to other libraries, you’ll control what is allowed to be upload +based on your preferences. In the controller you built above you set the +following preferences:

    +
    $config['upload_path'] = './uploads/';
    +$config['allowed_types'] = 'gif|jpg|png';
    +$config['max_size']     = '100';
    +$config['max_width'] = '1024';
    +$config['max_height'] = '768';
    +
    +$this->load->library('upload', $config);
    +
    +// Alternately you can set preferences by calling the ``initialize()`` method. Useful if you auto-load the class:
    +$this->upload->initialize($config);
    +
    +
    +

    The above preferences should be fairly self-explanatory. Below is a +table describing all available preferences.

    +
    +
    +

    Preferences

    +

    The following preferences are available. The default value indicates +what will be used if you do not specify that preference.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    upload_pathNoneNoneThe path to the directory where the upload should be placed. The +directory must be writable and the path can be absolute or relative.
    allowed_typesNoneNoneThe mime types corresponding to the types of files you allow to be +uploaded. Usually the file extension can be used as the mime type. +Can be either an array or a pipe-separated string.
    file_nameNoneDesired file nameIf set CodeIgniter will rename the uploaded file to this name. The +extension provided in the file name must also be an allowed file type. +If no extension is provided in the original file_name will be used.
    file_ext_tolowerFALSETRUE/FALSE (boolean)If set to TRUE, the file extension will be forced to lower case
    overwriteFALSETRUE/FALSE (boolean)If set to true, if a file with the same name as the one you are +uploading exists, it will be overwritten. If set to false, a number will +be appended to the filename if another with the same name exists.
    max_size0NoneThe maximum size (in kilobytes) that the file can be. Set to zero for no +limit. Note: Most PHP installations have their own limit, as specified +in the php.ini file. Usually 2 MB (or 2048 KB) by default.
    max_width0NoneThe maximum width (in pixels) that the image can be. Set to zero for no +limit.
    max_height0NoneThe maximum height (in pixels) that the image can be. Set to zero for no +limit.
    min_width0NoneThe minimum width (in pixels) that the image can be. Set to zero for no +limit.
    min_height0NoneThe minimum height (in pixels) that the image can be. Set to zero for no +limit.
    max_filename0NoneThe maximum length that a file name can be. Set to zero for no limit.
    max_filename_increment100NoneWhen overwrite is set to FALSE, use this to set the maximum filename +increment for CodeIgniter to append to the filename.
    encrypt_nameFALSETRUE/FALSE (boolean)If set to TRUE the file name will be converted to a random encrypted +string. This can be useful if you would like the file saved with a name +that can not be discerned by the person uploading it.
    remove_spacesTRUETRUE/FALSE (boolean)If set to TRUE, any spaces in the file name will be converted to +underscores. This is recommended.
    detect_mimeTRUETRUE/FALSE (boolean)If set to TRUE, a server side detection of the file type will be +performed to avoid code injection attacks. DO NOT disable this option +unless you have no other option as that would cause a security risk.
    mod_mime_fixTRUETRUE/FALSE (boolean)If set to TRUE, multiple filename extensions will be suffixed with an +underscore in order to avoid triggering Apache mod_mime. +DO NOT turn off this option if your upload directory is public, as this +is a security risk.
    +
    +
    +

    Setting preferences in a config file

    +

    If you prefer not to set preferences using the above method, you can +instead put them into a config file. Simply create a new file called the +upload.php, add the $config array in that file. Then save the file in: +config/upload.php and it will be used automatically. You will NOT +need to use the $this->upload->initialize() method if you save your +preferences in a config file.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Upload
    +
    +
    +initialize([array $config = array()[, $reset = TRUE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $config (array) – Preferences
    • +
    • $reset (bool) – Whether to reset preferences (that are not provided in $config) to their defaults
    • +
    +
    Returns:

    CI_Upload instance (method chaining)

    +
    Return type:

    CI_Upload

    +
    +
    + +
    +
    +do_upload([$field = 'userfile'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Name of the form field
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Performs the upload based on the preferences you’ve set.

    +
    +

    Note

    +

    By default the upload routine expects the file to come from +a form field called userfile, and the form must be of type +“multipart”.

    +
    +
    <form method="post" action="some_action" enctype="multipart/form-data" />
    +
    +
    +

    If you would like to set your own field name simply pass its value to +the do_upload() method:

    +
    $field_name = "some_field_name";
    +$this->upload->do_upload($field_name);
    +
    +
    +
    + +
    +
    +display_errors([$open = '<p>'[, $close = '</p>']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $open (string) – Opening markup
    • +
    • $close (string) – Closing markup
    • +
    +
    Returns:

    Formatted error message(s)

    +
    Return type:

    string

    +
    +

    Retrieves any error messages if the do_upload() method returned +false. The method does not echo automatically, it returns the data so +you can assign it however you need.

    +

    Formatting Errors

    +
    +

    By default the above method wraps any errors within <p> tags. You can +set your own delimiters like this:

    +
    $this->upload->display_errors('<p>', '</p>');
    +
    +
    +
    +
    + +
    +
    +data([$index = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (string) – Element to return instead of the full array
    • +
    +
    Returns:

    Information about the uploaded file

    +
    Return type:

    mixed

    +
    +

    This is a helper method that returns an array containing all of the +data related to the file you uploaded. Here is the array prototype:

    +
    Array
    +(
    +        [file_name]     => mypic.jpg
    +        [file_type]     => image/jpeg
    +        [file_path]     => /path/to/your/upload/
    +        [full_path]     => /path/to/your/upload/jpg.jpg
    +        [raw_name]      => mypic
    +        [orig_name]     => mypic.jpg
    +        [client_name]   => mypic.jpg
    +        [file_ext]      => .jpg
    +        [file_size]     => 22.2
    +        [is_image]      => 1
    +        [image_width]   => 800
    +        [image_height]  => 600
    +        [image_type]    => jpeg
    +        [image_size_str] => width="800" height="200"
    +)
    +
    +
    +

    To return one element from the array:

    +
    $this->upload->data('file_name');       // Returns: mypic.jpg
    +
    +
    +

    Here’s a table explaining the above-displayed array items:

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ItemDescription
    file_nameName of the file that was uploaded, including the filename extension
    file_typeFile MIME type identifier
    file_pathAbsolute server path to the file
    full_pathAbsolute server path, including the file name
    raw_nameFile name, without the extension
    orig_nameOriginal file name. This is only useful if you use the encrypted name option.
    client_nameFile name as supplied by the client user agent, prior to any file name preparation or incrementing
    file_extFilename extension, period included
    file_sizeFile size in kilobytes
    is_imageWhether the file is an image or not. 1 = image. 0 = not.
    image_widthImage width
    image_heightImage height
    image_typeImage type (usually the file name extension without the period)
    image_size_strA string containing the width and height (useful to put into an image tag)
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html new file mode 100755 index 0000000..66083df --- /dev/null +++ b/user_guide/libraries/form_validation.html @@ -0,0 +1,1932 @@ + + + + + + + + + + Form Validation — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Form Validation

    +

    CodeIgniter provides a comprehensive form validation and data prepping +class that helps minimize the amount of code you’ll write.

    + +
    +

    Overview

    +

    Before explaining CodeIgniter’s approach to data validation, let’s +describe the ideal scenario:

    +
      +
    1. A form is displayed.
    2. +
    3. You fill it in and submit it.
    4. +
    5. If you submitted something invalid, or perhaps missed a required +item, the form is redisplayed containing your data along with an +error message describing the problem.
    6. +
    7. This process continues until you have submitted a valid form.
    8. +
    +

    On the receiving end, the script must:

    +
      +
    1. Check for required data.
    2. +
    3. Verify that the data is of the correct type, and meets the correct +criteria. For example, if a username is submitted it must be +validated to contain only permitted characters. It must be of a +minimum length, and not exceed a maximum length. The username can’t +be someone else’s existing username, or perhaps even a reserved word. +Etc.
    4. +
    5. Sanitize the data for security.
    6. +
    7. Pre-format the data if needed (Does the data need to be trimmed? HTML +encoded? Etc.)
    8. +
    9. Prep the data for insertion in the database.
    10. +
    +

    Although there is nothing terribly complex about the above process, it +usually requires a significant amount of code, and to display error +messages, various control structures are usually placed within the form +HTML. Form validation, while simple to create, is generally very messy +and tedious to implement.

    +
    +
    +

    Form Validation Tutorial

    +

    What follows is a “hands on” tutorial for implementing CodeIgniters Form +Validation.

    +

    In order to implement form validation you’ll need three things:

    +
      +
    1. A View file containing a form.
    2. +
    3. A View file containing a “success” message to be displayed upon +successful submission.
    4. +
    5. A controller method to receive and +process the submitted data.
    6. +
    +

    Let’s create those three things, using a member sign-up form as the +example.

    +
    +

    The Form

    +

    Using a text editor, create a form called myform.php. In it, place this +code and save it to your application/views/ folder:

    +
    <html>
    +<head>
    +<title>My Form</title>
    +</head>
    +<body>
    +
    +<?php echo validation_errors(); ?>
    +
    +<?php echo form_open('form'); ?>
    +
    +<h5>Username</h5>
    +<input type="text" name="username" value="" size="50" />
    +
    +<h5>Password</h5>
    +<input type="text" name="password" value="" size="50" />
    +
    +<h5>Password Confirm</h5>
    +<input type="text" name="passconf" value="" size="50" />
    +
    +<h5>Email Address</h5>
    +<input type="text" name="email" value="" size="50" />
    +
    +<div><input type="submit" value="Submit" /></div>
    +
    +</form>
    +
    +</body>
    +</html>
    +
    +
    +
    +
    +

    The Success Page

    +

    Using a text editor, create a form called formsuccess.php. In it, place +this code and save it to your application/views/ folder:

    +
    <html>
    +<head>
    +<title>My Form</title>
    +</head>
    +<body>
    +
    +<h3>Your form was successfully submitted!</h3>
    +
    +<p><?php echo anchor('form', 'Try it again!'); ?></p>
    +
    +</body>
    +</html>
    +
    +
    +
    +
    +

    The Controller

    +

    Using a text editor, create a controller called Form.php. In it, place +this code and save it to your application/controllers/ folder:

    +
    <?php
    +
    +class Form extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->helper(array('form', 'url'));
    +
    +                $this->load->library('form_validation');
    +
    +                if ($this->form_validation->run() == FALSE)
    +                {
    +                        $this->load->view('myform');
    +                }
    +                else
    +                {
    +                        $this->load->view('formsuccess');
    +                }
    +        }
    +}
    +
    +
    +
    +
    +

    Try it!

    +

    To try your form, visit your site using a URL similar to this one:

    +
    example.com/index.php/form/
    +
    +
    +

    If you submit the form you should simply see the form reload. That’s +because you haven’t set up any validation rules yet.

    +

    Since you haven’t told the Form Validation class to validate anything +yet, it returns FALSE (boolean false) by default. ``The run()`` method +only returns TRUE if it has successfully applied your rules without any +of them failing.

    +
    +
    +

    Explanation

    +

    You’ll notice several things about the above pages:

    +

    The form (myform.php) is a standard web form with a couple exceptions:

    +
      +
    1. It uses a form helper to create the form opening. Technically, this +isn’t necessary. You could create the form using standard HTML. +However, the benefit of using the helper is that it generates the +action URL for you, based on the URL in your config file. This makes +your application more portable in the event your URLs change.

      +
    2. +
    3. At the top of the form you’ll notice the following function call:

      +
      <?php echo validation_errors(); ?>
      +
      +
      +

      This function will return any error messages sent back by the +validator. If there are no messages it returns an empty string.

      +
    4. +
    +

    The controller (Form.php) has one method: index(). This method +initializes the validation class and loads the form helper and URL +helper used by your view files. It also runs the validation routine. +Based on whether the validation was successful it either presents the +form or the success page.

    +
    +
    +

    Setting Validation Rules

    +

    CodeIgniter lets you set as many validation rules as you need for a +given field, cascading them in order, and it even lets you prep and +pre-process the field data at the same time. To set validation rules you +will use the set_rules() method:

    +
    $this->form_validation->set_rules();
    +
    +
    +

    The above method takes three parameters as input:

    +
      +
    1. The field name - the exact name you’ve given the form field.
    2. +
    3. A “human” name for this field, which will be inserted into the error +message. For example, if your field is named “user” you might give it +a human name of “Username”.
    4. +
    5. The validation rules for this form field.
    6. +
    7. (optional) Set custom error messages on any rules given for current field. If not provided will use the default one.
    8. +
    +
    +

    Note

    +

    If you would like the field name to be stored in a language +file, please see Translating Field Names.

    +
    +

    Here is an example. In your controller (Form.php), add this code just +below the validation initialization method:

    +
    $this->form_validation->set_rules('username', 'Username', 'required');
    +$this->form_validation->set_rules('password', 'Password', 'required');
    +$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
    +$this->form_validation->set_rules('email', 'Email', 'required');
    +
    +
    +

    Your controller should now look like this:

    +
    <?php
    +
    +class Form extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->helper(array('form', 'url'));
    +
    +                $this->load->library('form_validation');
    +
    +                $this->form_validation->set_rules('username', 'Username', 'required');
    +                $this->form_validation->set_rules('password', 'Password', 'required',
    +                        array('required' => 'You must provide a %s.')
    +                );
    +                $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
    +                $this->form_validation->set_rules('email', 'Email', 'required');
    +
    +                if ($this->form_validation->run() == FALSE)
    +                {
    +                        $this->load->view('myform');
    +                }
    +                else
    +                {
    +                        $this->load->view('formsuccess');
    +                }
    +        }
    +}
    +
    +
    +

    Now submit the form with the fields blank and you should see the error +messages. If you submit the form with all the fields populated you’ll +see your success page.

    +
    +

    Note

    +

    The form fields are not yet being re-populated with the data +when there is an error. We’ll get to that shortly.

    +
    +
    +
    +

    Setting Rules Using an Array

    +

    Before moving on it should be noted that the rule setting method can +be passed an array if you prefer to set all your rules in one action. If +you use this approach, you must name your array keys as indicated:

    +
    $config = array(
    +        array(
    +                'field' => 'username',
    +                'label' => 'Username',
    +                'rules' => 'required'
    +        ),
    +        array(
    +                'field' => 'password',
    +                'label' => 'Password',
    +                'rules' => 'required',
    +                'errors' => array(
    +                        'required' => 'You must provide a %s.',
    +                ),
    +        ),
    +        array(
    +                'field' => 'passconf',
    +                'label' => 'Password Confirmation',
    +                'rules' => 'required'
    +        ),
    +        array(
    +                'field' => 'email',
    +                'label' => 'Email',
    +                'rules' => 'required'
    +        )
    +);
    +
    +$this->form_validation->set_rules($config);
    +
    +
    +
    +
    +

    Cascading Rules

    +

    CodeIgniter lets you pipe multiple rules together. Let’s try it. Change +your rules in the third parameter of rule setting method, like this:

    +
    $this->form_validation->set_rules(
    +        'username', 'Username',
    +        'required|min_length[5]|max_length[12]|is_unique[users.username]',
    +        array(
    +                'required'      => 'You have not provided %s.',
    +                'is_unique'     => 'This %s already exists.'
    +        )
    +);
    +$this->form_validation->set_rules('password', 'Password', 'required');
    +$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required|matches[password]');
    +$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
    +
    +
    +

    The above code sets the following rules:

    +
      +
    1. The username field be no shorter than 5 characters and no longer than +12.
    2. +
    3. The password field must match the password confirmation field.
    4. +
    5. The email field must contain a valid email address.
    6. +
    +

    Give it a try! Submit your form without the proper data and you’ll see +new error messages that correspond to your new rules. There are numerous +rules available which you can read about in the validation reference.

    +
    +

    Note

    +

    You can also pass an array of rules to set_rules(), +instead of a string. Example:

    +
    $this->form_validation->set_rules('username', 'Username', array('required', 'min_length[5]'));
    +
    +
    +
    +
    +
    +

    Prepping Data

    +

    In addition to the validation method like the ones we used above, you +can also prep your data in various ways. For example, you can set up +rules like this:

    +
    $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]');
    +$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[8]');
    +$this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required|matches[password]');
    +$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
    +
    +
    +

    In the above example, we are “trimming” the fields, checking for length +where necessary and making sure that both password fields match.

    +

    Any native PHP function that accepts one parameter can be used as a +rule, like ``htmlspecialchars()``, ``trim()``, etc.

    +
    +

    Note

    +

    You will generally want to use the prepping functions +after the validation rules so if there is an error, the +original data will be shown in the form.

    +
    +
    +
    +

    Re-populating the form

    +

    Thus far we have only been dealing with errors. It’s time to repopulate +the form field with the submitted data. CodeIgniter offers several +helper functions that permit you to do this. The one you will use most +commonly is:

    +
    set_value('field name')
    +
    +
    +

    Open your myform.php view file and update the value in each field +using the set_value() function:

    +

    Don’t forget to include each field name in the :php:func:`set_value()` +function calls!

    +
    <html>
    +<head>
    +<title>My Form</title>
    +</head>
    +<body>
    +
    +<?php echo validation_errors(); ?>
    +
    +<?php echo form_open('form'); ?>
    +
    +<h5>Username</h5>
    +<input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" />
    +
    +<h5>Password</h5>
    +<input type="text" name="password" value="<?php echo set_value('password'); ?>" size="50" />
    +
    +<h5>Password Confirm</h5>
    +<input type="text" name="passconf" value="<?php echo set_value('passconf'); ?>" size="50" />
    +
    +<h5>Email Address</h5>
    +<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />
    +
    +<div><input type="submit" value="Submit" /></div>
    +
    +</form>
    +
    +</body>
    +</html>
    +
    +
    +

    Now reload your page and submit the form so that it triggers an error. +Your form fields should now be re-populated

    +
    +

    Note

    +

    The Class Reference section below +contains methods that permit you to re-populate <select> menus, +radio buttons, and checkboxes.

    +
    +
    +

    Important

    +

    If you use an array as the name of a form field, you +must supply it as an array to the function. Example:

    +
    <input type="text" name="colors[]" value="<?php echo set_value('colors[]'); ?>" size="50" />
    +
    +
    +
    +

    For more info please see the Using Arrays as Field Names section below.

    +
    +
    +

    Callbacks: Your own Validation Methods

    +

    The validation system supports callbacks to your own validation +methods. This permits you to extend the validation class to meet your +needs. For example, if you need to run a database query to see if the +user is choosing a unique username, you can create a callback method +that does that. Let’s create an example of this.

    +

    In your controller, change the “username” rule to this:

    +
    $this->form_validation->set_rules('username', 'Username', 'callback_username_check');
    +
    +
    +

    Then add a new method called username_check() to your controller. +Here’s how your controller should now look:

    +
    <?php
    +
    +class Form extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->helper(array('form', 'url'));
    +
    +                $this->load->library('form_validation');
    +
    +                $this->form_validation->set_rules('username', 'Username', 'callback_username_check');
    +                $this->form_validation->set_rules('password', 'Password', 'required');
    +                $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
    +                $this->form_validation->set_rules('email', 'Email', 'required|is_unique[users.email]');
    +
    +                if ($this->form_validation->run() == FALSE)
    +                {
    +                        $this->load->view('myform');
    +                }
    +                else
    +                {
    +                        $this->load->view('formsuccess');
    +                }
    +        }
    +
    +        public function username_check($str)
    +        {
    +                if ($str == 'test')
    +                {
    +                        $this->form_validation->set_message('username_check', 'The {field} field can not be the word "test"');
    +                        return FALSE;
    +                }
    +                else
    +                {
    +                        return TRUE;
    +                }
    +        }
    +
    +}
    +
    +
    +

    Reload your form and submit it with the word “test” as the username. You +can see that the form field data was passed to your callback method +for you to process.

    +

    To invoke a callback just put the method name in a rule, with +“callback_” as the rule prefix. If you need to receive an extra +parameter in your callback method, just add it normally after the +method name between square brackets, as in: callback_foo[bar], +then it will be passed as the second argument of your callback method.

    +
    +

    Note

    +

    You can also process the form data that is passed to your +callback and return it. If your callback returns anything other than a +boolean TRUE/FALSE it is assumed that the data is your newly processed +form data.

    +
    +
    +
    +

    Callable: Use anything as a rule

    +

    If callback rules aren’t good enough for you (for example, because they are +limited to your controller), don’t get disappointed, there’s one more way +to create custom rules: anything that is_callable() would return TRUE for.

    +

    Consider the following example:

    +
    $this->form_validation->set_rules(
    +        'username', 'Username',
    +        array(
    +                'required',
    +                array($this->users_model, 'valid_username')
    +        )
    +);
    +
    +
    +

    The above code would use the valid_username() method from your +Users_model object.

    +

    This is just an example of course, and callbacks aren’t limited to models. +You can use any object/method that accepts the field value as its’ first +parameter. You can also use an anonymous function:

    +
    $this->form_validation->set_rules(
    +        'username', 'Username',
    +        array(
    +                'required',
    +                function($value)
    +                {
    +                        // Check $value
    +                }
    +        )
    +);
    +
    +
    +

    Of course, since a Callable rule by itself is not a string, it isn’t +a rule name either. That is a problem when you want to set error messages +for them. In order to get around that problem, you can put such rules as +the second element of an array, with the first one being the rule name:

    +
    $this->form_validation->set_rules(
    +        'username', 'Username',
    +        array(
    +                'required',
    +                array('username_callable', array($this->users_model, 'valid_username'))
    +        )
    +);
    +
    +
    +

    Anonymous function version:

    +
    $this->form_validation->set_rules(
    +        'username', 'Username',
    +        array(
    +                'required',
    +                array(
    +                        'username_callable',
    +                        function($str)
    +                        {
    +                                // Check validity of $str and return TRUE or FALSE
    +                        }
    +                )
    +        )
    +);
    +
    +
    +
    +
    +

    Setting Error Messages

    +

    All of the native error messages are located in the following language +file: system/language/english/form_validation_lang.php

    +

    To set your own global custom message for a rule, you can either +extend/override the language file by creating your own in +application/language/english/form_validation_lang.php (read more +about this in the Language Class documentation), +or use the following method:

    +
    $this->form_validation->set_message('rule', 'Error Message');
    +
    +
    +

    If you need to set a custom error message for a particular field on +some particular rule, use the set_rules() method:

    +
    $this->form_validation->set_rules('field_name', 'Field Label', 'rule1|rule2|rule3',
    +        array('rule2' => 'Error Message on rule2 for this field_name')
    +);
    +
    +
    +

    Where rule corresponds to the name of a particular rule, and Error +Message is the text you would like displayed.

    +

    If you’d like to include a field’s “human” name, or the optional +parameter some rules allow for (such as max_length), you can add the +{field} and {param} tags to your message, respectively:

    +
    $this->form_validation->set_message('min_length', '{field} must have at least {param} characters.');
    +
    +
    +

    On a field with the human name Username and a rule of min_length[5], an +error would display: “Username must have at least 5 characters.”

    +
    +

    Note

    +

    The old sprintf() method of using %s in your error messages +will still work, however it will override the tags above. You should +use one or the other.

    +
    +

    In the callback rule example above, the error message was set by passing +the name of the method (without the “callback_” prefix):

    +
    $this->form_validation->set_message('username_check')
    +
    +
    +
    +
    +

    Translating Field Names

    +

    If you would like to store the “human” name you passed to the +set_rules() method in a language file, and therefore make the name +able to be translated, here’s how:

    +

    First, prefix your “human” name with lang:, as in this example:

    +
    $this->form_validation->set_rules('first_name', 'lang:first_name', 'required');
    +
    +
    +

    Then, store the name in one of your language file arrays (without the +prefix):

    +
    $lang['first_name'] = 'First Name';
    +
    +
    +
    +

    Note

    +

    If you store your array item in a language file that is not +loaded automatically by CI, you’ll need to remember to load it in your +controller using:

    +
    $this->lang->load('file_name');
    +
    +
    +
    +

    See the Language Class page for more info regarding +language files.

    +
    +
    +

    Changing the Error Delimiters

    +

    By default, the Form Validation class adds a paragraph tag (<p>) around +each error message shown. You can either change these delimiters +globally, individually, or change the defaults in a config file.

    +
      +
    1. Changing delimiters Globally +To globally change the error delimiters, in your controller method, +just after loading the Form Validation class, add this:

      +
      $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
      +
      +
      +

      In this example, we’ve switched to using div tags.

      +
    2. +
    3. Changing delimiters Individually +Each of the two error generating functions shown in this tutorial can +be supplied their own delimiters as follows:

      +
      <?php echo form_error('field name', '<div class="error">', '</div>'); ?>
      +
      +
      +

      Or:

      +
      <?php echo validation_errors('<div class="error">', '</div>'); ?>
      +
      +
      +
    4. +
    5. Set delimiters in a config file +You can add your error delimiters in application/config/form_validation.php as follows:

      +
      $config['error_prefix'] = '<div class="error_prefix">';
      +$config['error_suffix'] = '</div>';
      +
      +
      +
    6. +
    +
    +
    +

    Showing Errors Individually

    +

    If you prefer to show an error message next to each form field, rather +than as a list, you can use the form_error() function.

    +

    Try it! Change your form so that it looks like this:

    +
    <h5>Username</h5>
    +<?php echo form_error('username'); ?>
    +<input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" />
    +
    +<h5>Password</h5>
    +<?php echo form_error('password'); ?>
    +<input type="text" name="password" value="<?php echo set_value('password'); ?>" size="50" />
    +
    +<h5>Password Confirm</h5>
    +<?php echo form_error('passconf'); ?>
    +<input type="text" name="passconf" value="<?php echo set_value('passconf'); ?>" size="50" />
    +
    +<h5>Email Address</h5>
    +<?php echo form_error('email'); ?>
    +<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />
    +
    +
    +

    If there are no errors, nothing will be shown. If there is an error, the +message will appear.

    +
    +

    Important

    +

    If you use an array as the name of a form field, you +must supply it as an array to the function. Example:

    +
    <?php echo form_error('options[size]'); ?>
    +<input type="text" name="options[size]" value="<?php echo set_value("options[size]"); ?>" size="50" />
    +
    +
    +
    +

    For more info please see the Using Arrays as Field Names section below.

    +
    +
    +

    Validating an Array (other than $_POST)

    +

    Sometimes you may want to validate an array that does not originate from $_POST data.

    +

    In this case, you can specify the array to be validated:

    +
    $data = array(
    +        'username' => 'johndoe',
    +        'password' => 'mypassword',
    +        'passconf' => 'mypassword'
    +);
    +
    +$this->form_validation->set_data($data);
    +
    +
    +

    Creating validation rules, running the validation, and retrieving error +messages works the same whether you are validating $_POST data or +another array of your choice.

    +
    +

    Important

    +

    You have to call the set_data() method before defining +any validation rules.

    +
    +
    +

    Important

    +

    If you want to validate more than one array during a single +execution, then you should call the reset_validation() method +before setting up rules and validating the new array.

    +
    +

    For more info please see the Class Reference section below.

    +
    +
    +
    +

    Saving Sets of Validation Rules to a Config File

    +

    A nice feature of the Form Validation class is that it permits you to +store all your validation rules for your entire application in a config +file. You can organize these rules into “groups”. These groups can +either be loaded automatically when a matching controller/method is +called, or you can manually call each set as needed.

    +
    +

    How to save your rules

    +

    To store your validation rules, simply create a file named +form_validation.php in your application/config/ folder. In that file +you will place an array named $config with your rules. As shown earlier, +the validation array will have this prototype:

    +
    $config = array(
    +        array(
    +                'field' => 'username',
    +                'label' => 'Username',
    +                'rules' => 'required'
    +        ),
    +        array(
    +                'field' => 'password',
    +                'label' => 'Password',
    +                'rules' => 'required'
    +        ),
    +        array(
    +                'field' => 'passconf',
    +                'label' => 'Password Confirmation',
    +                'rules' => 'required'
    +        ),
    +        array(
    +                'field' => 'email',
    +                'label' => 'Email',
    +                'rules' => 'required'
    +        )
    +);
    +
    +
    +

    Your validation rule file will be loaded automatically and used when you +call the run() method.

    +

    Please note that you MUST name your $config array.

    +
    +
    +

    Creating Sets of Rules

    +

    In order to organize your rules into “sets” requires that you place them +into “sub arrays”. Consider the following example, showing two sets of +rules. We’ve arbitrarily called these two rules “signup” and “email”. +You can name your rules anything you want:

    +
    $config = array(
    +        'signup' => array(
    +                array(
    +                        'field' => 'username',
    +                        'label' => 'Username',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'password',
    +                        'label' => 'Password',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'passconf',
    +                        'label' => 'Password Confirmation',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'email',
    +                        'label' => 'Email',
    +                        'rules' => 'required'
    +                )
    +        ),
    +        'email' => array(
    +                array(
    +                        'field' => 'emailaddress',
    +                        'label' => 'EmailAddress',
    +                        'rules' => 'required|valid_email'
    +                ),
    +                array(
    +                        'field' => 'name',
    +                        'label' => 'Name',
    +                        'rules' => 'required|alpha'
    +                ),
    +                array(
    +                        'field' => 'title',
    +                        'label' => 'Title',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'message',
    +                        'label' => 'MessageBody',
    +                        'rules' => 'required'
    +                )
    +        )
    +);
    +
    +
    +
    +
    +

    Calling a Specific Rule Group

    +

    In order to call a specific group, you will pass its name to the run() +method. For example, to call the signup rule you will do this:

    +
    if ($this->form_validation->run('signup') == FALSE)
    +{
    +        $this->load->view('myform');
    +}
    +else
    +{
    +        $this->load->view('formsuccess');
    +}
    +
    +
    +
    +
    +

    Associating a Controller Method with a Rule Group

    +

    An alternate (and more automatic) method of calling a rule group is to +name it according to the controller class/method you intend to use it +with. For example, let’s say you have a controller named Member and a +method named signup. Here’s what your class might look like:

    +
    <?php
    +
    +class Member extends CI_Controller {
    +
    +        public function signup()
    +        {
    +                $this->load->library('form_validation');
    +
    +                if ($this->form_validation->run() == FALSE)
    +                {
    +                        $this->load->view('myform');
    +                }
    +                else
    +                {
    +                        $this->load->view('formsuccess');
    +                }
    +        }
    +}
    +
    +
    +

    In your validation config file, you will name your rule group +member/signup:

    +
    $config = array(
    +        'member/signup' => array(
    +                array(
    +                        'field' => 'username',
    +                        'label' => 'Username',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'password',
    +                        'label' => 'Password',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'passconf',
    +                        'label' => 'PasswordConfirmation',
    +                        'rules' => 'required'
    +                ),
    +                array(
    +                        'field' => 'email',
    +                        'label' => 'Email',
    +                        'rules' => 'required'
    +                )
    +        )
    +);
    +
    +
    +

    When a rule group is named identically to a controller class/method it +will be used automatically when the run() method is invoked from that +class/method.

    +
    +
    +
    +

    Using Arrays as Field Names

    +

    The Form Validation class supports the use of arrays as field names. +Consider this example:

    +
    <input type="text" name="options[]" value="" size="50" />
    +
    +
    +

    If you do use an array as a field name, you must use the EXACT array +name in the Helper Functions that require the +field name, and as your Validation Rule field name.

    +

    For example, to set a rule for the above field you would use:

    +
    $this->form_validation->set_rules('options[]', 'Options', 'required');
    +
    +
    +

    Or, to show an error for the above field you would use:

    +
    <?php echo form_error('options[]'); ?>
    +
    +
    +

    Or to re-populate the field you would use:

    +
    <input type="text" name="options[]" value="<?php echo set_value('options[]'); ?>" size="50" />
    +
    +
    +

    You can use multidimensional arrays as field names as well. For example:

    +
    <input type="text" name="options[size]" value="" size="50" />
    +
    +
    +

    Or even:

    +
    <input type="text" name="sports[nba][basketball]" value="" size="50" />
    +
    +
    +

    As with our first example, you must use the exact array name in the +helper functions:

    +
    <?php echo form_error('sports[nba][basketball]'); ?>
    +
    +
    +

    If you are using checkboxes (or other fields) that have multiple +options, don’t forget to leave an empty bracket after each option, so +that all selections will be added to the POST array:

    +
    <input type="checkbox" name="options[]" value="red" />
    +<input type="checkbox" name="options[]" value="blue" />
    +<input type="checkbox" name="options[]" value="green" />
    +
    +
    +

    Or if you use a multidimensional array:

    +
    <input type="checkbox" name="options[color][]" value="red" />
    +<input type="checkbox" name="options[color][]" value="blue" />
    +<input type="checkbox" name="options[color][]" value="green" />
    +
    +
    +

    When you use a helper function you’ll include the bracket as well:

    +
    <?php echo form_error('options[color][]'); ?>
    +
    +
    +
    +
    +

    Rule Reference

    +

    The following is a list of all the native rules that are available to +use:

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    RuleParameterDescriptionExample
    requiredNoReturns FALSE if the form element is empty. 
    matchesYesReturns FALSE if the form element does not match the one in the parameter.matches[form_item]
    regex_matchYesReturns FALSE if the form element does not match the regular expression.regex_match[/regex/]
    differsYesReturns FALSE if the form element does not differ from the one in the parameter.differs[form_item]
    is_uniqueYesReturns FALSE if the form element is not unique to the table and field name in the +parameter. Note: This rule requires Query Builder to be +enabled in order to work.is_unique[table.field]
    min_lengthYesReturns FALSE if the form element is shorter than the parameter value.min_length[3]
    max_lengthYesReturns FALSE if the form element is longer than the parameter value.max_length[12]
    exact_lengthYesReturns FALSE if the form element is not exactly the parameter value.exact_length[8]
    greater_thanYesReturns FALSE if the form element is less than or equal to the parameter value or not +numeric.greater_than[8]
    greater_than_equal_toYesReturns FALSE if the form element is less than the parameter value, +or not numeric.greater_than_equal_to[8]
    less_thanYesReturns FALSE if the form element is greater than or equal to the parameter value or +not numeric.less_than[8]
    less_than_equal_toYesReturns FALSE if the form element is greater than the parameter value, +or not numeric.less_than_equal_to[8]
    in_listYesReturns FALSE if the form element is not within a predetermined list.in_list[red,blue,green]
    alphaNoReturns FALSE if the form element contains anything other than alphabetical characters. 
    alpha_numericNoReturns FALSE if the form element contains anything other than alpha-numeric characters. 
    alpha_numeric_spacesNoReturns FALSE if the form element contains anything other than alpha-numeric characters +or spaces. Should be used after trim to avoid spaces at the beginning or end. 
    alpha_dashNoReturns FALSE if the form element contains anything other than alpha-numeric characters, +underscores or dashes. 
    numericNoReturns FALSE if the form element contains anything other than numeric characters. 
    integerNoReturns FALSE if the form element contains anything other than an integer. 
    decimalNoReturns FALSE if the form element contains anything other than a decimal number. 
    is_naturalNoReturns FALSE if the form element contains anything other than a natural number: +0, 1, 2, 3, etc. 
    is_natural_no_zeroNoReturns FALSE if the form element contains anything other than a natural +number, but not zero: 1, 2, 3, etc. 
    valid_urlNoReturns FALSE if the form element does not contain a valid URL. 
    valid_emailNoReturns FALSE if the form element does not contain a valid email address. 
    valid_emailsNoReturns FALSE if any value provided in a comma separated list is not a valid email. 
    valid_ipYesReturns FALSE if the supplied IP address is not valid. +Accepts an optional parameter of ‘ipv4’ or ‘ipv6’ to specify an IP format. 
    valid_base64NoReturns FALSE if the supplied string contains anything other than valid Base64 characters. 
    +
    +

    Note

    +

    These rules can also be called as discrete methods. For +example:

    +
    $this->form_validation->required($string);
    +
    +
    +
    +
    +

    Note

    +

    You can also use any native PHP functions that permit up +to two parameters, where at least one is required (to pass +the field data).

    +
    +
    +
    +

    Prepping Reference

    +

    The following is a list of all the prepping methods that are available +to use:

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
    NameParameterDescription
    prep_for_formNoDEPRECATED: Converts special characters so that HTML data can be shown in a form field without breaking it.
    prep_urlNoAdds “http://” to URLs if missing.
    strip_image_tagsNoStrips the HTML from image tags leaving the raw URL.
    encode_php_tagsNoConverts PHP tags to entities.
    +
    +

    Note

    +

    You can also use any native PHP functions that permits one +parameter, like trim(), htmlspecialchars(), urldecode(), +etc.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Form_validation
    +
    +
    +set_rules($field[, $label = ''[, $rules = ''[, $errors = array()]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $label (string) – Field label
    • +
    • $rules (mixed) – Validation rules, as a string list separated by a pipe “|”, or as an array or rules
    • +
    • $errors (array) – A list of custom error messages
    • +
    +
    Returns:

    CI_Form_validation instance (method chaining)

    +
    Return type:

    CI_Form_validation

    +
    +

    Permits you to set validation rules, as described in the tutorial +sections above:

    + +
    + +
    +
    +run([$group = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $group (string) – The name of the validation group to run
    • +
    +
    Returns:

    TRUE on success, FALSE if validation failed

    +
    Return type:

    bool

    +
    +

    Runs the validation routines. Returns boolean TRUE on success and FALSE +on failure. You can optionally pass the name of the validation group via +the method, as described in: Saving Sets of Validation Rules to a Config File

    +
    + +
    +
    +set_message($lang[, $val = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $lang (string) – The rule the message is for
    • +
    • $val (string) – The message
    • +
    +
    Returns:

    CI_Form_validation instance (method chaining)

    +
    Return type:

    CI_Form_validation

    +
    +

    Permits you to set custom error messages. See Setting Error Messages

    +
    + +
    +
    +set_error_delimiters([$prefix = '<p>'[, $suffix = '</p>']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $prefix (string) – Error message prefix
    • +
    • $suffix (string) – Error message suffix
    • +
    +
    Returns:

    CI_Form_validation instance (method chaining)

    +
    Return type:

    CI_Form_validation

    +
    +

    Sets the default prefix and suffix for error messages.

    +
    + +
    +
    +set_data($data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $data (array) – Array of data validate
    • +
    +
    Returns:

    CI_Form_validation instance (method chaining)

    +
    Return type:

    CI_Form_validation

    +
    +

    Permits you to set an array for validation, instead of using the default +$_POST array.

    +
    + +
    +
    +reset_validation()
    +
    +++ + + + + + +
    Returns:CI_Form_validation instance (method chaining)
    Return type:CI_Form_validation
    +

    Permits you to reset the validation when you validate more than one array. +This method should be called before validating each new array.

    +
    + +
    +
    +error_array()
    +
    +++ + + + + + +
    Returns:Array of error messages
    Return type:array
    +

    Returns the error messages as an array.

    +
    + +
    +
    +error_string([$prefix = ''[, $suffix = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $prefix (string) – Error message prefix
    • +
    • $suffix (string) – Error message suffix
    • +
    +
    Returns:

    Error messages as a string

    +
    Return type:

    string

    +
    +

    Returns all error messages (as returned from error_array()) formatted as a +string and separated by a newline character.

    +
    + +
    +
    +error($field[, $prefix = ''[, $suffix = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    • $prefix (string) – Optional prefix
    • +
    • $suffix (string) – Optional suffix
    • +
    +
    Returns:

    Error message string

    +
    Return type:

    string

    +
    +

    Returns the error message for a specific field, optionally adding a +prefix and/or suffix to it (usually HTML tags).

    +
    + +
    +
    +has_rule($field)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $field (string) – Field name
    • +
    +
    Returns:

    TRUE if the field has rules set, FALSE if not

    +
    Return type:

    bool

    +
    +

    Checks to see if there is a rule set for the specified field.

    +
    + +
    + +
    +
    +

    Helper Reference

    +

    Please refer to the Form Helper manual for +the following functions:

    + +

    Note that these are procedural functions, so they do not require you +to prepend them with $this->form_validation.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html new file mode 100755 index 0000000..76672f5 --- /dev/null +++ b/user_guide/libraries/ftp.html @@ -0,0 +1,1016 @@ + + + + + + + + + + FTP Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    FTP Class

    +

    CodeIgniter’s FTP Class permits files to be transferred to a remote +server. Remote files can also be moved, renamed, and deleted. The FTP +class also includes a “mirroring” function that permits an entire local +directory to be recreated remotely via FTP.

    +
    +

    Note

    +

    SFTP and SSL FTP protocols are not supported, only standard +FTP.

    +
    + +
    +

    Working with the FTP Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the FTP class is initialized in +your controller using the $this->load->library function:

    +
    $this->load->library('ftp');
    +
    +
    +

    Once loaded, the FTP object will be available using: $this->ftp

    +
    +
    +

    Usage Examples

    +

    In this example a connection is opened to the FTP server, and a local +file is read and uploaded in ASCII mode. The file permissions are set to +755.

    +
    $this->load->library('ftp');
    +
    +$config['hostname'] = 'ftp.example.com';
    +$config['username'] = 'your-username';
    +$config['password'] = 'your-password';
    +$config['debug']        = TRUE;
    +
    +$this->ftp->connect($config);
    +
    +$this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);
    +
    +$this->ftp->close();
    +
    +
    +

    In this example a list of files is retrieved from the server.

    +
    $this->load->library('ftp');
    +
    +$config['hostname'] = 'ftp.example.com';
    +$config['username'] = 'your-username';
    +$config['password'] = 'your-password';
    +$config['debug']        = TRUE;
    +
    +$this->ftp->connect($config);
    +
    +$list = $this->ftp->list_files('/public_html/');
    +
    +print_r($list);
    +
    +$this->ftp->close();
    +
    +
    +

    In this example a local directory is mirrored on the server.

    +
    $this->load->library('ftp');
    +
    +$config['hostname'] = 'ftp.example.com';
    +$config['username'] = 'your-username';
    +$config['password'] = 'your-password';
    +$config['debug']        = TRUE;
    +
    +$this->ftp->connect($config);
    +
    +$this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/');
    +
    +$this->ftp->close();
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_FTP
    +
    +
    +connect([$config = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $config (array) – Connection values
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Connects and logs into to the FTP server. Connection preferences are set +by passing an array to the function, or you can store them in a config +file.

    +

    Here is an example showing how you set preferences manually:

    +
    $this->load->library('ftp');
    +
    +$config['hostname'] = 'ftp.example.com';
    +$config['username'] = 'your-username';
    +$config['password'] = 'your-password';
    +$config['port']     = 21;
    +$config['passive']  = FALSE;
    +$config['debug']    = TRUE;
    +
    +$this->ftp->connect($config);
    +
    +
    +

    Setting FTP Preferences in a Config File

    +

    If you prefer you can store your FTP preferences in a config file. +Simply create a new file called the ftp.php, add the $config array in +that file. Then save the file at application/config/ftp.php and it +will be used automatically.

    +

    Available connection options

    + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Option nameDefault valueDescription
    hostnamen/aFTP hostname (usually something like: ftp.example.com)
    usernamen/aFTP username
    passwordn/aFTP password
    port21FTP server port number
    debugFALSETRUE/FALSE (boolean): Whether to enable debugging to display error messages
    passiveTRUETRUE/FALSE (boolean): Whether to use passive mode
    +
    + +
    +
    +upload($locpath, $rempath[, $mode = 'auto'[, $permissions = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $locpath (string) – Local file path
    • +
    • $rempath (string) – Remote file path
    • +
    • $mode (string) – FTP mode, defaults to ‘auto’ (options are: ‘auto’, ‘binary’, ‘ascii’)
    • +
    • $permissions (int) – File permissions (octal)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Uploads a file to your server. You must supply the local path and the +remote path, and you can optionally set the mode and permissions. +Example:

    +
    $this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);
    +
    +
    +

    If ‘auto’ mode is used it will base the mode on the file extension of the source file.

    +

    If set, permissions have to be passed as an octal value.

    +
    + +
    +
    +download($rempath, $locpath[, $mode = 'auto'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $rempath (string) – Remote file path
    • +
    • $locpath (string) – Local file path
    • +
    • $mode (string) – FTP mode, defaults to ‘auto’ (options are: ‘auto’, ‘binary’, ‘ascii’)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Downloads a file from your server. You must supply the remote path and +the local path, and you can optionally set the mode. Example:

    +
    $this->ftp->download('/public_html/myfile.html', '/local/path/to/myfile.html', 'ascii');
    +
    +
    +

    If ‘auto’ mode is used it will base the mode on the file extension of the source file.

    +

    Returns FALSE if the download does not execute successfully +(including if PHP does not have permission to write the local file).

    +
    + +
    +
    +rename($old_file, $new_file[, $move = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $old_file (string) – Old file name
    • +
    • $new_file (string) – New file name
    • +
    • $move (bool) – Whether a move is being performed
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Permits you to rename a file. Supply the source file name/path and the new file name/path.

    +
    // Renames green.html to blue.html
    +$this->ftp->rename('/public_html/foo/green.html', '/public_html/foo/blue.html');
    +
    +
    +
    + +
    +
    +move($old_file, $new_file)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $old_file (string) – Old file name
    • +
    • $new_file (string) – New file name
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Lets you move a file. Supply the source and destination paths:

    +
    // Moves blog.html from "joe" to "fred"
    +$this->ftp->move('/public_html/joe/blog.html', '/public_html/fred/blog.html');
    +
    +
    +
    +

    Note

    +

    If the destination file name is different the file will be renamed.

    +
    +
    + +
    +
    +delete_file($filepath)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filepath (string) – Path to file to delete
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Lets you delete a file. Supply the source path with the file name.

    +
    $this->ftp->delete_file('/public_html/joe/blog.html');
    +
    +
    +
    + +
    +
    +delete_dir($filepath)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filepath (string) – Path to directory to delete
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Lets you delete a directory and everything it contains. Supply the +source path to the directory with a trailing slash.

    +
    +

    Important

    +

    Be VERY careful with this method! +It will recursively delete everything within the supplied path, +including sub-folders and all files. Make absolutely sure your path +is correct. Try using list_files() first to verify that your path is correct.

    +
    +
    $this->ftp->delete_dir('/public_html/path/to/folder/');
    +
    +
    +
    + +
    +
    +list_files([$path = '.'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Directory path
    • +
    +
    Returns:

    An array list of files or FALSE on failure

    +
    Return type:

    array

    +
    +

    Permits you to retrieve a list of files on your server returned as an +array. You must supply the path to the desired directory.

    +
    $list = $this->ftp->list_files('/public_html/');
    +print_r($list);
    +
    +
    +
    + +
    +
    +mirror($locpath, $rempath)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $locpath (string) – Local path
    • +
    • $rempath (string) – Remote path
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Recursively reads a local folder and everything it contains (including +sub-folders) and creates a mirror via FTP based on it. Whatever the +directory structure of the original file path will be recreated on the +server. You must supply a source path and a destination path:

    +
    $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/');
    +
    +
    +
    + +
    +
    +mkdir($path[, $permissions = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to directory to create
    • +
    • $permissions (int) – Permissions (octal)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Lets you create a directory on your server. Supply the path ending in +the folder name you wish to create, with a trailing slash.

    +

    Permissions can be set by passing an octal value in the second parameter.

    +
    // Creates a folder named "bar"
    +$this->ftp->mkdir('/public_html/foo/bar/', 0755);
    +
    +
    +
    + +
    +
    +chmod($path, $perm)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to alter permissions for
    • +
    • $perm (int) – Permissions (octal)
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Permits you to set file permissions. Supply the path to the file or +directory you wish to alter permissions on:

    +
    // Chmod "bar" to 755
    +$this->ftp->chmod('/public_html/foo/bar/', 0755);
    +
    +
    +
    + +
    +
    +changedir($path[, $suppress_debug = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Directory path
    • +
    • $suppress_debug (bool) – Whether to turn off debug messages for this command
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Changes the current working directory to the specified path.

    +

    The $suppress_debug parameter is useful in case you want to use this method +as an is_dir() alternative for FTP.

    +
    + +
    +
    +close()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Closes the connection to your server. It’s recommended that you use this +when you are finished uploading.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html new file mode 100755 index 0000000..94bb678 --- /dev/null +++ b/user_guide/libraries/image_lib.html @@ -0,0 +1,1255 @@ + + + + + + + + + + Image Manipulation Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Image Manipulation Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Image Manipulation Class

    +

    CodeIgniter’s Image Manipulation class lets you perform the following +actions:

    +
      +
    • Image Resizing
    • +
    • Thumbnail Creation
    • +
    • Image Cropping
    • +
    • Image Rotating
    • +
    • Image Watermarking
    • +
    +

    All three major image libraries are supported: GD/GD2, NetPBM, and +ImageMagick

    +
    +

    Note

    +

    Watermarking is only available using the GD/GD2 library. In +addition, even though other libraries are supported, GD is required in +order for the script to calculate the image properties. The image +processing, however, will be performed with the library you specify.

    +
    + +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the image class is initialized +in your controller using the $this->load->library function:

    +
    $this->load->library('image_lib');
    +
    +
    +

    Once the library is loaded it will be ready for use. The image library +object you will use to call all functions is: $this->image_lib

    +
    +

    Processing an Image

    +

    Regardless of the type of processing you would like to perform +(resizing, cropping, rotation, or watermarking), the general process is +identical. You will set some preferences corresponding to the action you +intend to perform, then call one of four available processing functions. +For example, to create an image thumbnail you’ll do this:

    +
    $config['image_library'] = 'gd2';
    +$config['source_image'] = '/path/to/image/mypic.jpg';
    +$config['create_thumb'] = TRUE;
    +$config['maintain_ratio'] = TRUE;
    +$config['width']         = 75;
    +$config['height']       = 50;
    +
    +$this->load->library('image_lib', $config);
    +
    +$this->image_lib->resize();
    +
    +
    +

    The above code tells the image_resize function to look for an image +called mypic.jpg located in the source_image folder, then create a +thumbnail that is 75 X 50 pixels using the GD2 image_library. Since the +maintain_ratio option is enabled, the thumb will be as close to the +target width and height as possible while preserving the original aspect +ratio. The thumbnail will be called mypic_thumb.jpg and located at +the same level as source_image.

    +
    +

    Note

    +

    In order for the image class to be allowed to do any +processing, the folder containing the image files must have write +permissions.

    +
    +
    +

    Note

    +

    Image processing can require a considerable amount of server +memory for some operations. If you are experiencing out of memory errors +while processing images you may need to limit their maximum size, and/or +adjust PHP memory limits.

    +
    +
    +
    +

    Processing Methods

    +

    There are four available processing methods:

    +
      +
    • $this->image_lib->resize()
    • +
    • $this->image_lib->crop()
    • +
    • $this->image_lib->rotate()
    • +
    • $this->image_lib->watermark()
    • +
    +

    These methods return boolean TRUE upon success and FALSE for failure. +If they fail you can retrieve the error message using this function:

    +
    echo $this->image_lib->display_errors();
    +
    +
    +

    A good practice is to use the processing function conditionally, showing an +error upon failure, like this:

    +
    if ( ! $this->image_lib->resize())
    +{
    +        echo $this->image_lib->display_errors();
    +}
    +
    +
    +
    +

    Note

    +

    You can optionally specify the HTML formatting to be applied to +the errors, by submitting the opening/closing tags in the function, +like this:

    +
    $this->image_lib->display_errors('<p>', '</p>');
    +
    +
    +
    +
    +
    +

    Preferences

    +

    The preferences described below allow you to tailor the image processing +to suit your needs.

    +

    Note that not all preferences are available for every function. For +example, the x/y axis preferences are only available for image cropping. +Likewise, the width and height preferences have no effect on cropping. +The “availability” column indicates which functions support a given +preference.

    +

    Availability Legend:

    +
      +
    • R - Image Resizing
    • +
    • C - Image Cropping
    • +
    • X - Image Rotation
    • +
    • W - Image Watermarking
    • +
    + +++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescriptionAvailability
    image_libraryGD2GD, GD2, ImageMagick, NetPBMSets the image library to be used.R, C, X, W
    library_pathNoneNoneSets the server path to your ImageMagick or NetPBM library. If you use +either of those libraries you must supply the path.R, C, X +R, C, S, W
    source_imageNoneNoneSets the source image name/path. The path must be a relative or absolute +server path, not a URL. 
    dynamic_outputFALSETRUE/FALSE (boolean)Determines whether the new image file should be written to disk or +generated dynamically. Note: If you choose the dynamic setting, only one +image can be shown at a time, and it can’t be positioned on the page. It +simply outputs the raw image dynamically to your browser, along with +image headers.R, C, X, W
    file_permissions0644(integer)File system permissions to apply on the resulting image file, +writing it to the disk. WARNING: Use octal integer notation!R, C, X, W
    quality90%1 - 100%Sets the quality of the image. The higher the quality the larger the +file size.R, C, X, W
    new_imageNoneNoneSets the destination image name/path. You’ll use this preference when +creating an image copy. The path must be a relative or absolute server +path, not a URL.R, C, X, W
    widthNoneNoneSets the width you would like the image set to.R, C
    heightNoneNoneSets the height you would like the image set to.R, C
    create_thumbFALSETRUE/FALSE (boolean)Tells the image processing function to create a thumb.R
    thumb_marker_thumbNoneSpecifies the thumbnail indicator. It will be inserted just before the +file extension, so mypic.jpg would become mypic_thumb.jpgR
    maintain_ratioTRUETRUE/FALSE (boolean)Specifies whether to maintain the original aspect ratio when resizing or +use hard values.R, C
    master_dimautoauto, width, heightSpecifies what to use as the master axis when resizing or creating +thumbs. For example, let’s say you want to resize an image to 100 X 75 +pixels. If the source image size does not allow perfect resizing to +those dimensions, this setting determines which axis should be used as +the hard value. “auto” sets the axis automatically based on whether the +image is taller than wider, or vice versa.R
    rotation_angleNone90, 180, 270, vrt, horSpecifies the angle of rotation when rotating images. Note that PHP +rotates counter-clockwise, so a 90 degree rotation to the right must be +specified as 270.X
    x_axisNoneNoneSets the X coordinate in pixels for image cropping. For example, a +setting of 30 will crop an image 30 pixels from the left.C
    y_axisNoneNoneSets the Y coordinate in pixels for image cropping. For example, a +setting of 30 will crop an image 30 pixels from the top.C
    +
    +
    +

    Setting preferences in a config file

    +

    If you prefer not to set preferences using the above method, you can +instead put them into a config file. Simply create a new file called +image_lib.php, add the $config array in that file. Then save the file +in config/image_lib.php and it will be used automatically. You will +NOT need to use the $this->image_lib->initialize() method if you save +your preferences in a config file.

    +
    +
    +
    +

    Image Watermarking

    +

    The Watermarking feature requires the GD/GD2 library.

    +
    +

    Two Types of Watermarking

    +

    There are two types of watermarking that you can use:

    +
      +
    • Text: The watermark message will be generated using text, either +with a True Type font that you specify, or using the native text +output that the GD library supports. If you use the True Type version +your GD installation must be compiled with True Type support (most +are, but not all).
    • +
    • Overlay: The watermark message will be generated by overlaying an +image (usually a transparent PNG or GIF) containing your watermark +over the source image.
    • +
    +
    +
    +

    Watermarking an Image

    +

    Just as with the other methods (resizing, cropping, and rotating) the +general process for watermarking involves setting the preferences +corresponding to the action you intend to perform, then calling the +watermark function. Here is an example:

    +
    $config['source_image'] = '/path/to/image/mypic.jpg';
    +$config['wm_text'] = 'Copyright 2006 - John Doe';
    +$config['wm_type'] = 'text';
    +$config['wm_font_path'] = './system/fonts/texb.ttf';
    +$config['wm_font_size'] = '16';
    +$config['wm_font_color'] = 'ffffff';
    +$config['wm_vrt_alignment'] = 'bottom';
    +$config['wm_hor_alignment'] = 'center';
    +$config['wm_padding'] = '20';
    +
    +$this->image_lib->initialize($config);
    +
    +$this->image_lib->watermark();
    +
    +
    +

    The above example will use a 16 pixel True Type font to create the text +“Copyright 2006 - John Doe”. The watermark will be positioned at the +bottom/center of the image, 20 pixels from the bottom of the image.

    +
    +

    Note

    +

    In order for the image class to be allowed to do any +processing, the image file must have “write” file permissions +For example, 777.

    +
    +
    +
    +

    Watermarking Preferences

    +

    This table shows the preferences that are available for both types of +watermarking (text or overlay)

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    wm_typetexttext, overlaySets the type of watermarking that should be used.
    source_imageNoneNoneSets the source image name/path. The path must be a relative or absolute +server path, not a URL.
    dynamic_outputFALSETRUE/FALSE (boolean)Determines whether the new image file should be written to disk or +generated dynamically. Note: If you choose the dynamic setting, only one +image can be shown at a time, and it can’t be positioned on the page. It +simply outputs the raw image dynamically to your browser, along with +image headers.
    quality90%1 - 100%Sets the quality of the image. The higher the quality the larger the +file size.
    wm_paddingNoneA numberThe amount of padding, set in pixels, that will be applied to the +watermark to set it away from the edge of your images.
    wm_vrt_alignmentbottomtop, middle, bottomSets the vertical alignment for the watermark image.
    wm_hor_alignmentcenterleft, center, rightSets the horizontal alignment for the watermark image.
    wm_hor_offsetNoneNoneYou may specify a horizontal offset (in pixels) to apply to the +watermark position. The offset normally moves the watermark to the +right, except if you have your alignment set to “right” then your offset +value will move the watermark toward the left of the image.
    wm_vrt_offsetNoneNoneYou may specify a vertical offset (in pixels) to apply to the watermark +position. The offset normally moves the watermark down, except if you +have your alignment set to “bottom” then your offset value will move the +watermark toward the top of the image.
    +
    +

    Text Preferences

    +

    This table shows the preferences that are available for the text type of +watermarking.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    wm_textNoneNoneThe text you would like shown as the watermark. Typically this will be a +copyright notice.
    wm_font_pathNoneNoneThe server path to the True Type Font you would like to use. If you do +not use this option, the native GD font will be used.
    wm_font_size16NoneThe size of the text. Note: If you are not using the True Type option +above, the number is set using a range of 1 - 5. Otherwise, you can use +any valid pixel size for the font you’re using.
    wm_font_colorffffffNoneThe font color, specified in hex. Both the full 6-length (ie, 993300) and +the short three character abbreviated version (ie, fff) are supported.
    wm_shadow_colorNoneNoneThe color of the drop shadow, specified in hex. If you leave this blank +a drop shadow will not be used. Both the full 6-length (ie, 993300) and +the short three character abbreviated version (ie, fff) are supported.
    wm_shadow_distance3NoneThe distance (in pixels) from the font that the drop shadow should +appear.
    +
    +
    +

    Overlay Preferences

    +

    This table shows the preferences that are available for the overlay type +of watermarking.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefault ValueOptionsDescription
    wm_overlay_pathNoneNoneThe server path to the image you wish to use as your watermark. Required +only if you are using the overlay method.
    wm_opacity501 - 100Image opacity. You may specify the opacity (i.e. transparency) of your +watermark image. This allows the watermark to be faint and not +completely obscure the details from the original image behind it. A 50% +opacity is typical.
    wm_x_transp4A numberIf your watermark image is a PNG or GIF image, you may specify a color +on the image to be “transparent”. This setting (along with the next) +will allow you to specify that color. This works by specifying the “X” +and “Y” coordinate pixel (measured from the upper left) within the image +that corresponds to a pixel representative of the color you want to be +transparent.
    wm_y_transp4A numberAlong with the previous setting, this allows you to specify the +coordinate to a pixel representative of the color you want to be +transparent.
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Image_lib
    +
    +
    +initialize([$props = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $props (array) – Image processing preferences
    • +
    +
    Returns:

    TRUE on success, FALSE in case of invalid settings

    +
    Return type:

    bool

    +
    +

    Initializes the class for processing an image.

    +
    + +
    +
    +resize()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    The image resizing method lets you resize the original image, create a +copy (with or without resizing), or create a thumbnail image.

    +

    For practical purposes there is no difference between creating a copy +and creating a thumbnail except a thumb will have the thumbnail marker +as part of the name (i.e. mypic_thumb.jpg).

    +

    All preferences listed in the Preferences table are available for this +method except these three: rotation_angle, x_axis and y_axis.

    +

    Creating a Thumbnail

    +

    The resizing method will create a thumbnail file (and preserve the +original) if you set this preference to TRUE:

    +
    $config['create_thumb'] = TRUE;
    +
    +
    +

    This single preference determines whether a thumbnail is created or not.

    +

    Creating a Copy

    +

    The resizing method will create a copy of the image file (and preserve +the original) if you set a path and/or a new filename using this +preference:

    +
    $config['new_image'] = '/path/to/new_image.jpg';
    +
    +
    +

    Notes regarding this preference:

    +
      +
    • If only the new image name is specified it will be placed in the same +folder as the original
    • +
    • If only the path is specified, the new image will be placed in the +destination with the same name as the original.
    • +
    • If both the path and image name are specified it will placed in its +own destination and given the new name.
    • +
    +

    Resizing the Original Image

    +

    If neither of the two preferences listed above (create_thumb, and +new_image) are used, the resizing method will instead target the +original image for processing.

    +
    + +
    +
    +crop()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    The cropping method works nearly identically to the resizing function +except it requires that you set preferences for the X and Y axis (in +pixels) specifying where to crop, like this:

    +
    $config['x_axis'] = 100;
    +$config['y_axis'] = 40;
    +
    +
    +

    All preferences listed in the Preferences table are available for this +method except these: rotation_angle, create_thumb and new_image.

    +

    Here’s an example showing how you might crop an image:

    +
    $config['image_library'] = 'imagemagick';
    +$config['library_path'] = '/usr/X11R6/bin/';
    +$config['source_image'] = '/path/to/image/mypic.jpg';
    +$config['x_axis'] = 100;
    +$config['y_axis'] = 60;
    +
    +$this->image_lib->initialize($config);
    +
    +if ( ! $this->image_lib->crop())
    +{
    +        echo $this->image_lib->display_errors();
    +}
    +
    +
    +
    +

    Note

    +

    Without a visual interface it is difficult to crop images, so this +method is not very useful unless you intend to build such an +interface. That’s exactly what we did using for the photo gallery module +in ExpressionEngine, the CMS we develop. We added a JavaScript UI that +lets the cropping area be selected.

    +
    +
    + +
    +
    +rotate()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    The image rotation method requires that the angle of rotation be set +via its preference:

    +
    $config['rotation_angle'] = '90';
    +
    +
    +

    There are 5 rotation options:

    +
      +
    1. 90 - rotates counter-clockwise by 90 degrees.
    2. +
    3. 180 - rotates counter-clockwise by 180 degrees.
    4. +
    5. 270 - rotates counter-clockwise by 270 degrees.
    6. +
    7. hor - flips the image horizontally.
    8. +
    9. vrt - flips the image vertically.
    10. +
    +

    Here’s an example showing how you might rotate an image:

    +
    $config['image_library'] = 'netpbm';
    +$config['library_path'] = '/usr/bin/';
    +$config['source_image'] = '/path/to/image/mypic.jpg';
    +$config['rotation_angle'] = 'hor';
    +
    +$this->image_lib->initialize($config);
    +
    +if ( ! $this->image_lib->rotate())
    +{
    +        echo $this->image_lib->display_errors();
    +}
    +
    +
    +
    + +
    +
    +watermark()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    Creates a watermark over an image, please refer to the Watermarking an Image +section for more info.

    +
    + +
    +
    +clear()
    +
    +++ + + + +
    Return type:void
    +

    The clear method resets all of the values used when processing an +image. You will want to call this if you are processing images in a +loop.

    +
    $this->image_lib->clear();
    +
    +
    +
    + +
    +
    +display_errors([$open = '<p>[, $close = '</p>']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $open (string) – Error message opening tag
    • +
    • $close (string) – Error message closing tag
    • +
    +
    Returns:

    Error messages

    +
    Return type:

    string

    +
    +

    Returns all detected errors formatted as a string.

    +
    echo $this->image_lib->display_errors();
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/index.html b/user_guide/libraries/index.html new file mode 100755 index 0000000..cde6740 --- /dev/null +++ b/user_guide/libraries/index.html @@ -0,0 +1,527 @@ + + + + + + + + + + Libraries — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html new file mode 100755 index 0000000..a2876f4 --- /dev/null +++ b/user_guide/libraries/input.html @@ -0,0 +1,1191 @@ + + + + + + + + + + Input Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Input Class

    +

    The Input Class serves two purposes:

    +
      +
    1. It pre-processes global input data for security.
    2. +
    3. It provides some helper methods for fetching input data and pre-processing it.
    4. +
    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    + +
    +

    Input Filtering

    +
    +

    Security Filtering

    +

    The security filtering method is called automatically when a new +controller is invoked. It does the +following:

    +
      +
    • If $config['allow_get_array'] is FALSE (default is TRUE), destroys +the global GET array.
    • +
    • Destroys all global variables in the event register_globals is +turned on.
    • +
    • Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric +(and a few other) characters.
    • +
    • Provides XSS (Cross-site Scripting Hacks) filtering. This can be +enabled globally, or upon request.
    • +
    • Standardizes newline characters to PHP_EOL (\n in UNIX-based OSes, +\r\n under Windows). This is configurable.
    • +
    +
    +
    +

    XSS Filtering

    +

    The Input class has the ability to filter input automatically to prevent +cross-site scripting attacks. If you want the filter to run +automatically every time it encounters POST or COOKIE data you can +enable it by opening your application/config/config.php file and setting +this:

    +
    $config['global_xss_filtering'] = TRUE;
    +
    +
    +

    Please refer to the Security class documentation for +information on using XSS Filtering in your application.

    +
    +

    Important

    +

    The ‘global_xss_filtering’ setting is DEPRECATED and kept +solely for backwards-compatibility purposes. XSS escaping should +be performed on output, not input!

    +
    +
    +
    +
    +

    Accessing form data

    +
    +

    Using POST, GET, COOKIE, or SERVER Data

    +

    CodeIgniter comes with helper methods that let you fetch POST, GET, +COOKIE or SERVER items. The main advantage of using the provided +methods rather than fetching an item directly ($_POST['something']) +is that the methods will check to see if the item is set and return +NULL if not. This lets you conveniently use data without +having to test whether an item exists first. In other words, normally +you might do something like this:

    +
    $something = isset($_POST['something']) ? $_POST['something'] : NULL;
    +
    +
    +

    With CodeIgniter’s built in methods you can simply do this:

    +
    $something = $this->input->post('something');
    +
    +
    +

    The main methods are:

    +
      +
    • $this->input->post()
    • +
    • $this->input->get()
    • +
    • $this->input->cookie()
    • +
    • $this->input->server()
    • +
    +
    +
    +

    Using the php://input stream

    +

    If you want to utilize the PUT, DELETE, PATCH or other exotic request +methods, they can only be accessed via a special input stream, that +can only be read once. This isn’t as easy as just reading from e.g. +the $_POST array, because it will always exist and you can try +and access multiple variables without caring that you might only have +one shot at all of the POST data.

    +

    CodeIgniter will take care of that for you, and you can read the data +from the php://input stream at any time, just by using the +$raw_input_stream property:

    +
    $this->input->raw_input_stream;
    +
    +
    +

    Additionally if the input stream is form-encoded like $_POST you can +access its values by calling the +input_stream() method:

    +
    $this->input->input_stream('key');
    +
    +
    +

    Similar to other methods such as get() and post(), if the +requested data is not found, it will return NULL and you can also +decide whether to run the data through xss_clean() by passing +a boolean value as the second parameter:

    +
    $this->input->input_stream('key', TRUE); // XSS Clean
    +$this->input->input_stream('key', FALSE); // No XSS filter
    +
    +
    +
    +

    Note

    +

    You can utilize method() in order to know if you’re reading +PUT, DELETE or PATCH data.

    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Input
    +
    +
    +$raw_input_stream
    +

    Read only property that will return php://input data as is.

    +

    The property can be read multiple times.

    +
    + +
    +
    +post([$index = NULL[, $xss_clean = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (mixed) – POST parameter name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    $_POST if no parameters supplied, otherwise the POST value if found or NULL if not

    +
    Return type:

    mixed

    +
    +

    The first parameter will contain the name of the POST item you are +looking for:

    +
    $this->input->post('some_data');
    +
    +
    +

    The method returns NULL if the item you are attempting to retrieve +does not exist.

    +

    The second optional parameter lets you run the data through the XSS +filter. It’s enabled by setting the second parameter to boolean TRUE +or by setting your $config['global_xss_filtering'] to TRUE.

    +
    $this->input->post('some_data', TRUE);
    +
    +
    +

    To return an array of all POST items call without any parameters.

    +

    To return all POST items and pass them through the XSS filter set the +first parameter NULL while setting the second parameter to boolean TRUE.

    +
    $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
    +$this->input->post(NULL, FALSE); // returns all POST items without XSS filter
    +
    +
    +

    To return an array of multiple POST parameters, pass all the required keys +as an array.

    +
    $this->input->post(array('field1', 'field2'));
    +
    +
    +

    Same rule applied here, to retrieve the parameters with XSS filtering enabled, set the +second parameter to boolean TRUE.

    +
    $this->input->post(array('field1', 'field2'), TRUE);
    +
    +
    +
    + +
    +
    +get([$index = NULL[, $xss_clean = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (mixed) – GET parameter name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    $_GET if no parameters supplied, otherwise the GET value if found or NULL if not

    +
    Return type:

    mixed

    +
    +

    This method is identical to post(), only it fetches GET data.

    +
    $this->input->get('some_data', TRUE);
    +
    +
    +

    To return an array of all GET items call without any parameters.

    +

    To return all GET items and pass them through the XSS filter set the +first parameter NULL while setting the second parameter to boolean TRUE.

    +
    $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
    +$this->input->get(NULL, FALSE); // returns all GET items without XSS filtering
    +
    +
    +

    To return an array of multiple GET parameters, pass all the required keys +as an array.

    +
    $this->input->get(array('field1', 'field2'));
    +
    +
    +

    Same rule applied here, to retrieve the parameters with XSS filtering enabled, set the +second parameter to boolean TRUE.

    +
    $this->input->get(array('field1', 'field2'), TRUE);
    +
    +
    +
    + +
    +
    +post_get($index[, $xss_clean = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (string) – POST/GET parameter name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    POST/GET value if found, NULL if not

    +
    Return type:

    mixed

    +
    +

    This method works pretty much the same way as post() and get(), +only combined. It will search through both POST and GET streams for data, +looking in POST first, and then in GET:

    +
    $this->input->post_get('some_data', TRUE);
    +
    +
    +
    + +
    +
    +get_post($index[, $xss_clean = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (string) – GET/POST parameter name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    GET/POST value if found, NULL if not

    +
    Return type:

    mixed

    +
    +

    This method works the same way as post_get() only it looks for GET +data first.

    +
    +
    $this->input->get_post(‘some_data’, TRUE);
    +
    +

    Note

    +

    This method used to act EXACTLY like post_get(), but it’s +behavior has changed in CodeIgniter 3.0.

    +
    +
    + +
    +
    +cookie([$index = NULL[, $xss_clean = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (mixed) – COOKIE name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    $_COOKIE if no parameters supplied, otherwise the COOKIE value if found or NULL if not

    +
    Return type:

    mixed

    +
    +

    This method is identical to post() and get(), only it fetches cookie +data:

    +
    $this->input->cookie('some_cookie');
    +$this->input->cookie('some_cookie', TRUE); // with XSS filter
    +
    +
    +

    To return an array of multiple cookie values, pass all the required keys +as an array.

    +
    $this->input->cookie(array('some_cookie', 'some_cookie2'));
    +
    +
    +
    +

    Note

    +

    Unlike the Cookie Helper +function get_cookie(), this method does NOT prepend +your configured $config['cookie_prefix'] value.

    +
    +
    + +
    +
    +server($index[, $xss_clean = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (mixed) – Value name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    $_SERVER item value if found, NULL if not

    +
    Return type:

    mixed

    +
    +

    This method is identical to the post(), get() and cookie() +methods, only it fetches server data ($_SERVER):

    +
    $this->input->server('some_data');
    +
    +
    +

    To return an array of multiple $_SERVER values, pass all the required keys +as an array.

    +
    $this->input->server(array('SERVER_PROTOCOL', 'REQUEST_URI'));
    +
    +
    +
    + +
    +
    +input_stream([$index = NULL[, $xss_clean = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (mixed) – Key name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    Input stream array if no parameters supplied, otherwise the specified value if found or NULL if not

    +
    Return type:

    mixed

    +
    +

    This method is identical to get(), post() and cookie(), +only it fetches the php://input stream data.

    +
    + +
    + +
    +++ + + + + + +
    Parameters:
      +
    • $name (mixed) – Cookie name or an array of parameters
    • +
    • $value (string) – Cookie value
    • +
    • $expire (int) – Cookie expiration time in seconds
    • +
    • $domain (string) – Cookie domain
    • +
    • $path (string) – Cookie path
    • +
    • $prefix (string) – Cookie name prefix
    • +
    • $secure (bool) – Whether to only transfer the cookie through HTTPS
    • +
    • $httponly (bool) – Whether to only make the cookie accessible for HTTP requests (no JavaScript)
    • +
    +
    Return type:

    void

    +
    +

    Sets a cookie containing the values you specify. There are two ways to +pass information to this method so that a cookie can be set: Array +Method, and Discrete Parameters:

    +

    Array Method

    +

    Using this method, an associative array is passed to the first +parameter:

    +
    $cookie = array(
    +        'name'   => 'The Cookie Name',
    +        'value'  => 'The Value',
    +        'expire' => '86500',
    +        'domain' => '.some-domain.com',
    +        'path'   => '/',
    +        'prefix' => 'myprefix_',
    +        'secure' => TRUE
    +);
    +
    +$this->input->set_cookie($cookie);
    +
    +
    +

    Notes

    +

    Only the name and value are required. To delete a cookie set it with the +expiration blank.

    +

    The expiration is set in seconds, which will be added to the current +time. Do not include the time, but rather only the number of seconds +from now that you wish the cookie to be valid. If the expiration is +set to zero the cookie will only last as long as the browser is open.

    +

    For site-wide cookies regardless of how your site is requested, add your +URL to the domain starting with a period, like this: +.your-domain.com

    +

    The path is usually not needed since the method sets a root path.

    +

    The prefix is only needed if you need to avoid name collisions with +other identically named cookies for your server.

    +

    The httponly and secure flags, when omitted, will default to your +$config['cookie_httponly'] and $config['cookie_secure'] settings.

    +

    Discrete Parameters

    +

    If you prefer, you can set the cookie by passing data using individual +parameters:

    +
    $this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
    +
    +
    +
    + +
    +
    +ip_address()
    +
    +++ + + + + + +
    Returns:Visitor’s IP address or ‘0.0.0.0’ if not valid
    Return type:string
    +

    Returns the IP address for the current user. If the IP address is not +valid, the method will return ‘0.0.0.0’:

    +
    echo $this->input->ip_address();
    +
    +
    +
    +

    Important

    +

    This method takes into account the $config['proxy_ips'] +setting and will return the reported HTTP_X_FORWARDED_FOR, +HTTP_CLIENT_IP, HTTP_X_CLIENT_IP or HTTP_X_CLUSTER_CLIENT_IP +address for the allowed IP addresses.

    +
    +
    + +
    +
    +valid_ip($ip[, $which = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $ip (string) – IP address
    • +
    • $which (string) – IP protocol (‘ipv4’ or ‘ipv6’)
    • +
    +
    Returns:

    TRUE if the address is valid, FALSE if not

    +
    Return type:

    bool

    +
    +

    Takes an IP address as input and returns TRUE or FALSE (boolean) depending +on whether it is valid or not.

    +
    +

    Note

    +

    The $this->input->ip_address() method above automatically +validates the IP address.

    +
    +
    if ( ! $this->input->valid_ip($ip))
    +{
    +        echo 'Not Valid';
    +}
    +else
    +{
    +        echo 'Valid';
    +}
    +
    +
    +

    Accepts an optional second string parameter of ‘ipv4’ or ‘ipv6’ to specify +an IP format. The default checks for both formats.

    +
    + +
    +
    +user_agent([$xss_clean = NULL])
    +
    +++ + + + + + + + +
    Returns:

    User agent string or NULL if not set

    +
    Parameters:
      +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Return type:

    mixed

    +
    +

    Returns the user agent string (web browser) being used by the current user, +or NULL if it’s not available.

    +
    echo $this->input->user_agent();
    +
    +
    +

    See the User Agent Class for methods which extract +information from the user agent string.

    +
    + +
    +
    +request_headers([$xss_clean = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    An array of HTTP request headers

    +
    Return type:

    array

    +
    +

    Returns an array of HTTP request headers. +Useful if running in a non-Apache environment where +apache_request_headers() +will not be supported.

    +
    $headers = $this->input->request_headers();
    +
    +
    +
    + +
    +
    +get_request_header($index[, $xss_clean = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $index (string) – HTTP request header name
    • +
    • $xss_clean (bool) – Whether to apply XSS filtering
    • +
    +
    Returns:

    An HTTP request header or NULL if not found

    +
    Return type:

    string

    +
    +

    Returns a single member of the request headers array or NULL +if the searched header is not found.

    +
    $this->input->get_request_header('some-header', TRUE);
    +
    +
    +
    + +
    +
    +is_ajax_request()
    +
    +++ + + + + + +
    Returns:TRUE if it is an Ajax request, FALSE if not
    Return type:bool
    +

    Checks to see if the HTTP_X_REQUESTED_WITH server header has been +set, and returns boolean TRUE if it is or FALSE if not.

    +
    + +
    +
    +is_cli_request()
    +
    +++ + + + + + +
    Returns:TRUE if it is a CLI request, FALSE if not
    Return type:bool
    +

    Checks to see if the application was run from the command-line +interface.

    +
    +

    Note

    +

    This method checks both the PHP SAPI name currently in use +and if the STDIN constant is defined, which is usually a +failsafe way to see if PHP is being run via the command line.

    +
    +
    $this->input->is_cli_request()
    +
    +
    +
    +

    Note

    +

    This method is DEPRECATED and is now just an alias for the +is_cli() function.

    +
    +
    + +
    +
    +method([$upper = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $upper (bool) – Whether to return the request method name in upper or lower case
    • +
    +
    Returns:

    HTTP request method

    +
    Return type:

    string

    +
    +

    Returns the $_SERVER['REQUEST_METHOD'], with the option to set it +in uppercase or lowercase.

    +
    echo $this->input->method(TRUE); // Outputs: POST
    +echo $this->input->method(FALSE); // Outputs: post
    +echo $this->input->method(); // Outputs: post
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html new file mode 100755 index 0000000..eb675a8 --- /dev/null +++ b/user_guide/libraries/javascript.html @@ -0,0 +1,802 @@ + + + + + + + + + + Javascript Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Javascript Class

    +

    CodeIgniter provides a library to help you with certain common functions +that you may want to use with Javascript. Please note that CodeIgniter +does not require the jQuery library to run, and that any scripting +library will work equally well. The jQuery library is simply presented +as a convenience if you choose to use it.

    +
    +

    Important

    +

    This library is DEPRECATED and should not be used. It has always +been with an ‘experimental’ status and is now no longer supported. +Currently only kept for backwards compatibility.

    +
    + +
    +

    Using the Javascript Class

    +
    +

    Initializing the Class

    +

    To initialize the Javascript class manually in your controller +constructor, use the $this->load->library() method. Currently, +the only available library is jQuery, which will automatically be +loaded like this:

    +
    $this->load->library('javascript');
    +
    +
    +

    The Javascript class also accepts parameters:

    +
      +
    • js_library_driver (string) default: ‘jquery’
    • +
    • autoload (bool) default: TRUE
    • +
    +

    You may override the defaults by sending an associative array:

    +
    $this->load->library(
    +        'javascript',
    +        array(
    +                'js_library_driver' => 'scripto',
    +                'autoload' => FALSE
    +        )
    +);
    +
    +
    +

    Again, presently only ‘jquery’ is available. You may wish to set +autoload to FALSE, though, if you do not want the jQuery library to +automatically include a script tag for the main jQuery script file. This +is useful if you are loading it from a location outside of CodeIgniter, +or already have the script tag in your markup.

    +

    Once loaded, the jQuery library object will be available using:

    +
    +
    $this->javascript
    +
    +
    +

    Setup and Configuration

    +
    +

    Set these variables in your view

    +

    As a Javascript library, your files must be available to your +application.

    +

    As Javascript is a client side language, the library must be able to +write content into your final output. This generally means a view. +You’ll need to include the following variables in the <head> +sections of your output.

    +
    <?php echo $library_src;?>
    +<?php echo $script_head;?>
    +
    +
    +

    $library_src, is where the actual library file will be loaded, as +well as any subsequent plugin script calls; $script_head is where +specific events, functions and other commands will be rendered.

    +
    +
    +

    Set the path to the librarys with config items

    +

    There are some configuration items in Javascript library. These can +either be set in application/config.php, within its own +config/javascript.php file, or within any controller usings the +set_item() function.

    +

    An image to be used as an “ajax loader”, or progress indicator. Without +one, the simple text message of “loading” will appear when Ajax calls +need to be made.

    +
    $config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
    +$config['javascript_ajax_img'] = 'images/ajax-loader.gif';
    +
    +
    +

    If you keep your files in the same directories they were downloaded +from, then you need not set this configuration items.

    +
    +
    +
    +

    The jQuery Class

    +

    To initialize the jQuery class manually in your controller constructor, +use the $this->load->library() method:

    +
    $this->load->library('javascript/jquery');
    +
    +
    +

    You may send an optional parameter to determine whether or not a script +tag for the main jQuery file will be automatically included when loading +the library. It will be created by default. To prevent this, load the +library as follows:

    +
    $this->load->library('javascript/jquery', FALSE);
    +
    +
    +

    Once loaded, the jQuery library object will be available using:

    +
    +
    $this->jquery
    +
    +
    +

    jQuery Events

    +

    Events are set using the following syntax.

    +
    $this->jquery->event('element_path', code_to_run());
    +
    +
    +

    In the above example:

    +
      +
    • “event” is any of blur, change, click, dblclick, error, focus, hover, +keydown, keyup, load, mousedown, mouseup, mouseover, mouseup, resize, +scroll, or unload.
    • +
    • “element_path” is any valid jQuery selector. Due to jQuery’s unique +selector syntax, this is usually an element id, or CSS selector. For +example “#notice_area” would effect <div id="notice_area">, and +“#content a.notice” would effect all anchors with a class of “notice” +in the div with id “content”.
    • +
    • code_to_run()” is script your write yourself, or an action such as +an effect from the jQuery library below.
    • +
    +
    +
    +

    Effects

    +

    The query library supports a powerful +Effects repertoire. Before an effect +can be used, it must be loaded:

    +
    $this->jquery->effect([optional path] plugin name); // for example $this->jquery->effect('bounce');
    +
    +
    +
    +

    hide() / show()

    +

    Each of this functions will affect the visibility of an item on your +page. hide() will set an item invisible, show() will reveal it.

    +
    $this->jquery->hide(target, optional speed, optional extra information);
    +$this->jquery->show(target, optional speed, optional extra information);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “speed” is optional, and is set to either slow, normal, fast, or +alternatively a number of milliseconds.
    • +
    • “extra information” is optional, and could include a callback, or +other additional information.
    • +
    +
    +
    +

    toggle()

    +

    toggle() will change the visibility of an item to the opposite of its +current state, hiding visible elements, and revealing hidden ones.

    +
    $this->jquery->toggle(target);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    +
    +
    +

    animate()

    +
    $this->jquery->animate(target, parameters, optional speed, optional extra information);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “parameters” in jQuery would generally include a series of CSS +properties that you wish to change.
    • +
    • “speed” is optional, and is set to either slow, normal, fast, or +alternatively a number of milliseconds.
    • +
    • “extra information” is optional, and could include a callback, or +other additional information.
    • +
    +

    For a full summary, see +http://api.jquery.com/animate/

    +

    Here is an example of an animate() called on a div with an id of “note”, +and triggered by a click using the jQuery library’s click() event.

    +
    $params = array(
    +'height' => 80,
    +'width' => '50%',
    +'marginLeft' => 125
    +);
    +$this->jquery->click('#trigger', $this->jquery->animate('#note', $params, 'normal'));
    +
    +
    +
    +
    +

    fadeIn() / fadeOut()

    +
    $this->jquery->fadeIn(target,  optional speed, optional extra information);
    +$this->jquery->fadeOut(target,  optional speed, optional extra information);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “speed” is optional, and is set to either slow, normal, fast, or +alternatively a number of milliseconds.
    • +
    • “extra information” is optional, and could include a callback, or +other additional information.
    • +
    +
    +
    +

    toggleClass()

    +

    This function will add or remove a CSS class to its target.

    +
    $this->jquery->toggleClass(target, class)
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “class” is any CSS classname. Note that this class must be defined +and available in a CSS that is already loaded.
    • +
    +
    +
    +

    fadeIn() / fadeOut()

    +

    These effects cause an element(s) to disappear or reappear over time.

    +
    $this->jquery->fadeIn(target,  optional speed, optional extra information);
    +$this->jquery->fadeOut(target,  optional speed, optional extra information);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “speed” is optional, and is set to either slow, normal, fast, or +alternatively a number of milliseconds.
    • +
    • “extra information” is optional, and could include a callback, or +other additional information.
    • +
    +
    +
    +

    slideUp() / slideDown() / slideToggle()

    +

    These effects cause an element(s) to slide.

    +
    $this->jquery->slideUp(target,  optional speed, optional extra information);
    +$this->jquery->slideDown(target,  optional speed, optional extra information);
    +$this->jquery->slideToggle(target,  optional speed, optional extra information);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “speed” is optional, and is set to either slow, normal, fast, or +alternatively a number of milliseconds.
    • +
    • “extra information” is optional, and could include a callback, or +other additional information.
    • +
    +
    +
    +
    +

    Plugins

    +

    Some select jQuery plugins are made available using this library.

    +
    +

    corner()

    +

    Used to add distinct corners to page elements. For full details see +http://malsup.com/jquery/corner/

    +
    $this->jquery->corner(target, corner_style);
    +
    +
    +
      +
    • “target” will be any valid jQuery selector or selectors.
    • +
    • “corner_style” is optional, and can be set to any valid style such +as round, sharp, bevel, bite, dog, etc. Individual corners can be set +by following the style with a space and using “tl” (top left), “tr” +(top right), “bl” (bottom left), or “br” (bottom right).
    • +
    +
    $this->jquery->corner("#note", "cool tl br");
    +
    +
    +
    +
    +

    tablesorter()

    +

    description to come

    +
    + +
    +

    calendar()

    +

    description to come

    +
    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html new file mode 100755 index 0000000..d07caa3 --- /dev/null +++ b/user_guide/libraries/language.html @@ -0,0 +1,733 @@ + + + + + + + + + + Language Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Language Class

    +

    The Language Class provides functions to retrieve language files and +lines of text for purposes of internationalization.

    +

    In your CodeIgniter system folder, you will find a language sub-directory +containing a set of language files for the english idiom. +The files in this directory (system/language/english/) define the regular messages, +error messages, and other generally output terms or expressions, for the different parts +of the CodeIgniter framework.

    +

    You can create or incorporate your own language files, as needed, in order to provide +application-specific error and other messages, or to provide translations of the core +messages into other languages. These translations or additional messages would go inside +your application/language/ directory, with separate sub-directories for each idiom +(for instance, ‘french’ or ‘german’).

    +

    The CodeIgniter framework comes with a set of language files for the “english” idiom. +Additional approved translations for different idioms may be found in the +CodeIgniter 3 Translations repositories. +Each repository deals with a single idiom.

    +

    When CodeIgniter loads language files, it will load the one in system/language/ +first and will then look for an override in your application/language/ directory.

    +
    +

    Note

    +

    Each language should be stored in its own folder. For example, +the English files are located at: system/language/english

    +
    + +
    +

    Handling Multiple Languages

    +

    If you want to support multiple languages in your application, you would provide folders inside +your application/language/ directory for each of them, and you would specify the default +language in your application/config/config.php.

    +

    The application/language/english/ directory would contain any additional language files +needed by your application, for instance for error messages.

    +

    Each of the other idiom-specific directories would contain the core language files that you +obtained from the translations repositories, or that you translated yourself, as well as +any additional ones needed by your application.

    +

    You would store the language you are currently using, for instance in a session variable.

    +
    +

    Sample Language Files

    +
    system/
    +        language/
    +                english/
    +                        ...
    +                        email_lang.php
    +                        form_validation_lang.php
    +                        ...
    +
    +application/
    +        language/
    +                english/
    +                        error_messages_lang.php
    +                french/
    +                        ...
    +                        email_lang.php
    +                        error_messages_lang.php
    +                        form_validation_lang.php
    +                        ...
    +
    +
    +
    +
    +

    Example of switching languages

    +
    $idiom = $this->session->get_userdata('language');
    +$this->lang->load('error_messages', $idiom);
    +$oops = $this->lang->line('message_key');
    +
    +
    +
    +
    +
    +

    Internationalization

    +

    The Language class in CodeIgniter is meant to provide an easy and lightweight +way to support multiplelanguages in your application. It is not meant to be a +full implementation of what is commonly called internationalization and localization.

    +

    We use the term “idiom” to refer to a language using its common name, +rather than using any of the international standards, such as “en”, “en-US”, +or “en-CA-x-ca” for English and some of its variants.

    +
    +

    Note

    +

    There is nothing to prevent you from using those abbreviations in your application!

    +
    +
    +
    +

    Using the Language Class

    +
    +

    Creating Language Files

    +

    Language files must be named with _lang.php as the filename extension. +For example, let’s say you want to create a file containing error messages. +You might name it: error_lang.php

    +

    Within the file you will assign each line of text to an array called +$lang with this prototype:

    +
    $lang['language_key'] = 'The actual message to be shown';
    +
    +
    +
    +

    Note

    +

    It’s a good practice to use a common prefix for all messages +in a given file to avoid collisions with similarly named items in other +files. For example, if you are creating error messages you might prefix +them with error_

    +
    +
    $lang['error_email_missing'] = 'You must submit an email address';
    +$lang['error_url_missing'] = 'You must submit a URL';
    +$lang['error_username_missing'] = 'You must submit a username';
    +
    +
    +
    +
    +

    Loading A Language File

    +

    In order to fetch a line from a particular file you must load the file +first. Loading a language file is done with the following code:

    +
    $this->lang->load('filename', 'language');
    +
    +
    +

    Where filename is the name of the file you wish to load (without the +file extension), and language is the language set containing it (ie, +english). If the second parameter is missing, the default language set +in your application/config/config.php file will be used.

    +

    You can also load multiple language files at the same time by passing an array of language files as first parameter.

    +
    $this->lang->load(array('filename1', 'filename2'));
    +
    +
    +
    +

    Note

    +

    The language parameter can only consist of letters.

    +
    +
    +
    +

    Fetching a Line of Text

    +

    Once your desired language file is loaded you can access any line of +text using this function:

    +
    $this->lang->line('language_key');
    +
    +
    +

    Where language_key is the array key corresponding to the line you wish +to show.

    +

    You can optionally pass FALSE as the second argument of that method to +disable error logging, in case you’re not sure if the line exists:

    +
    $this->lang->line('misc_key', FALSE);
    +
    +
    +
    +

    Note

    +

    This method simply returns the line. It does not echo it.

    +
    +
    +

    Using language lines as form labels

    +

    This feature has been deprecated from the language library and moved to +the lang() function of the Language Helper.

    +
    +
    +
    +

    Auto-loading Languages

    +

    If you find that you need a particular language globally throughout your +application, you can tell CodeIgniter to auto-load it during system initialization. This is done +by opening the application/config/autoload.php file and adding the +language(s) to the autoload array.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Lang
    +
    +
    +load($langfile[, $idiom = ''[, $return = FALSE[, $add_suffix = TRUE[, $alt_path = '']]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $langfile (mixed) – Language file to load or array with multiple files
    • +
    • $idiom (string) – Language name (i.e. ‘english’)
    • +
    • $return (bool) – Whether to return the loaded array of translations
    • +
    • $add_suffix (bool) – Whether to add the ‘_lang’ suffix to the language file name
    • +
    • $alt_path (string) – An alternative path to look in for the language file
    • +
    +
    Returns:

    Array of language lines if $return is set to TRUE, otherwise void

    +
    Return type:

    mixed

    +
    +

    Loads a language file.

    +
    + +
    +
    +line($line[, $log_errors = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $line (string) – Language line key name
    • +
    • $log_errors (bool) – Whether to log an error if the line isn’t found
    • +
    +
    Returns:

    Language line string or FALSE on failure

    +
    Return type:

    string

    +
    +

    Fetches a single translation line from the already loaded language files, +based on the line’s name.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html new file mode 100755 index 0000000..0c21994 --- /dev/null +++ b/user_guide/libraries/loader.html @@ -0,0 +1,1213 @@ + + + + + + + + + + Loader Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Loader Class

    +

    Loader, as the name suggests, is used to load elements. These elements +can be libraries (classes) View files, +Drivers, +Helpers, +Models, or your own files.

    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    + +
    +

    Application “Packages”

    +

    An application package allows for the easy distribution of complete sets +of resources in a single directory, complete with its own libraries, +models, helpers, config, and language files. It is recommended that +these packages be placed in the application/third_party directory. Below +is a sample map of an package directory.

    +

    The following is an example of a directory for an application package +named “Foo Bar”.

    +
    /application/third_party/foo_bar
    +
    +config/
    +helpers/
    +language/
    +libraries/
    +models/
    +
    +
    +

    Whatever the purpose of the “Foo Bar” application package, it has its +own config files, helpers, language files, libraries, and models. To use +these resources in your controllers, you first need to tell the Loader +that you are going to be loading resources from a package, by adding the +package path via the add_package_path() method.

    +
    +

    Package view files

    +

    By Default, package view files paths are set when add_package_path() +is called. View paths are looped through, and once a match is +encountered that view is loaded.

    +

    In this instance, it is possible for view naming collisions within +packages to occur, and possibly the incorrect package being loaded. To +ensure against this, set an optional second parameter of FALSE when +calling add_package_path().

    +
    $this->load->add_package_path(APPPATH.'my_app', FALSE);
    +$this->load->view('my_app_index'); // Loads
    +$this->load->view('welcome_message'); // Will not load the default welcome_message b/c the second param to add_package_path is FALSE
    +
    +// Reset things
    +$this->load->remove_package_path(APPPATH.'my_app');
    +
    +// Again without the second parameter:
    +$this->load->add_package_path(APPPATH.'my_app');
    +$this->load->view('my_app_index'); // Loads
    +$this->load->view('welcome_message'); // Loads
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Loader
    +
    +
    +library($library[, $params = NULL[, $object_name = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $library (mixed) – Library name as a string or an array with multiple libraries
    • +
    • $params (array) – Optional array of parameters to pass to the loaded library’s constructor
    • +
    • $object_name (string) – Optional object name to assign the library to
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    This method is used to load core classes.

    +
    +

    Note

    +

    We use the terms “class” and “library” interchangeably.

    +
    +

    For example, if you would like to send email with CodeIgniter, the first +step is to load the email class within your controller:

    +
    $this->load->library('email');
    +
    +
    +

    Once loaded, the library will be ready for use, using $this->email.

    +

    Library files can be stored in subdirectories within the main +“libraries” directory, or within your personal application/libraries +directory. To load a file located in a subdirectory, simply include the +path, relative to the “libraries” directory. For example, if you have +file located at:

    +
    libraries/flavors/Chocolate.php
    +
    +
    +

    You will load it using:

    +
    $this->load->library('flavors/chocolate');
    +
    +
    +

    You may nest the file in as many subdirectories as you want.

    +

    Additionally, multiple libraries can be loaded at the same time by +passing an array of libraries to the load method.

    +
    $this->load->library(array('email', 'table'));
    +
    +
    +

    Setting options

    +

    The second (optional) parameter allows you to optionally pass +configuration setting. You will typically pass these as an array:

    +
    $config = array (
    +        'mailtype' => 'html',
    +        'charset'  => 'utf-8',
    +        'priority' => '1'
    +);
    +
    +$this->load->library('email', $config);
    +
    +
    +

    Config options can usually also be set via a config file. Each library +is explained in detail in its own page, so please read the information +regarding each one you would like to use.

    +

    Please take note, when multiple libraries are supplied in an array for +the first parameter, each will receive the same parameter information.

    +

    Assigning a Library to a different object name

    +

    If the third (optional) parameter is blank, the library will usually be +assigned to an object with the same name as the library. For example, if +the library is named Calendar, it will be assigned to a variable named +$this->calendar.

    +

    If you prefer to set your own class names you can pass its value to the +third parameter:

    +
    $this->load->library('calendar', NULL, 'my_calendar');
    +
    +// Calendar class is now accessed using:
    +$this->my_calendar
    +
    +
    +

    Please take note, when multiple libraries are supplied in an array for +the first parameter, this parameter is discarded.

    +
    + +
    +
    +driver($library[, $params = NULL[, $object_name]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $library (mixed) – Library name as a string or an array with multiple libraries
    • +
    • $params (array) – Optional array of parameters to pass to the loaded library’s constructor
    • +
    • $object_name (string) – Optional object name to assign the library to
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    This method is used to load driver libraries, acts very much like the +library() method.

    +

    As an example, if you would like to use sessions with CodeIgniter, the first +step is to load the session driver within your controller:

    +
    $this->load->driver('session');
    +
    +
    +

    Once loaded, the library will be ready for use, using $this->session.

    +

    Driver files must be stored in a subdirectory within the main +“libraries” directory, or within your personal application/libraries +directory. The subdirectory must match the parent class name. Read the +Drivers description for details.

    +

    Additionally, multiple driver libraries can be loaded at the same time by +passing an array of drivers to the load method.

    +
    $this->load->driver(array('session', 'cache'));
    +
    +
    +

    Setting options

    +

    The second (optional) parameter allows you to optionally pass +configuration settings. You will typically pass these as an array:

    +
    $config = array(
    +        'sess_driver' => 'cookie',
    +        'sess_encrypt_cookie'  => true,
    +        'encryption_key' => 'mysecretkey'
    +);
    +
    +$this->load->driver('session', $config);
    +
    +
    +

    Config options can usually also be set via a config file. Each library +is explained in detail in its own page, so please read the information +regarding each one you would like to use.

    +

    Assigning a Driver to a different object name

    +

    If the third (optional) parameter is blank, the library will be assigned +to an object with the same name as the parent class. For example, if +the library is named Session, it will be assigned to a variable named +$this->session.

    +

    If you prefer to set your own class names you can pass its value to the +third parameter:

    +
    $this->load->library('session', '', 'my_session');
    +
    +// Session class is now accessed using:
    +$this->my_session
    +
    +
    +
    + +
    +
    +view($view[, $vars = array()[, return = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $view (string) – View name
    • +
    • $vars (array) – An associative array of variables
    • +
    • $return (bool) – Whether to return the loaded view
    • +
    +
    Returns:

    View content string if $return is set to TRUE, otherwise CI_Loader instance (method chaining)

    +
    Return type:

    mixed

    +
    +

    This method is used to load your View files. If you haven’t read the +Views section of the user guide it is +recommended that you do since it shows you how this method is +typically used.

    +

    The first parameter is required. It is the name of the view file you +would like to load.

    +
    +

    Note

    +

    The .php file extension does not need to be specified unless +you use something other than .php.

    +
    +

    The second optional parameter can take an associative array or an +object as input, which it runs through the PHP +extract() function to convert to variables +that can be used in your view files. Again, read the +Views page to learn how this might be useful.

    +

    The third optional parameter lets you change the behavior of the +method so that it returns data as a string rather than sending it to +your browser. This can be useful if you want to process the data in some +way. If you set the parameter to TRUE (boolean) it will return data. The +default behavior is FALSE, which sends it to your browser. Remember to +assign it to a variable if you want the data returned:

    +
    $string = $this->load->view('myfile', '', TRUE);
    +
    +
    +
    + +
    +
    +vars($vars[, $val = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $vars (mixed) – An array of variables or a single variable name
    • +
    • $val (mixed) – Optional variable value
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    This method takes an associative array as input and generates +variables using the PHP extract() +function. This method produces the same result as using the second +parameter of the $this->load->view() method above. The reason you +might want to use this method independently is if you would like to +set some global variables in the constructor of your controller and have +them become available in any view file loaded from any method. You can +have multiple calls to this method. The data get cached and merged +into one array for conversion to variables.

    +
    + +
    +
    +get_var($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Variable name key
    • +
    +
    Returns:

    Value if key is found, NULL if not

    +
    Return type:

    mixed

    +
    +

    This method checks the associative array of variables available to +your views. This is useful if for any reason a var is set in a library +or another controller method using $this->load->vars().

    +
    + +
    +
    +get_vars()
    +
    +++ + + + + + +
    Returns:An array of all assigned view variables
    Return type:array
    +

    This method retrieves all variables available to your views.

    +
    + +
    +
    +clear_vars()
    +
    +++ + + + + + +
    Returns:CI_Loader instance (method chaining)
    Return type:CI_Loader
    +

    Clears cached view variables.

    +
    + +
    +
    +model($model[, $name = ''[, $db_conn = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $model (mixed) – Model name or an array containing multiple models
    • +
    • $name (string) – Optional object name to assign the model to
    • +
    • $db_conn (string) – Optional database configuration group to load
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +
    $this->load->model('model_name');
    +
    +
    +

    If your model is located in a subdirectory, include the relative path +from your models directory. For example, if you have a model located at +application/models/blog/Queries.php you’ll load it using:

    +
    $this->load->model('blog/queries');
    +
    +
    +

    If you would like your model assigned to a different object name you can +specify it via the second parameter of the loading method:

    +
    $this->load->model('model_name', 'fubar');
    +$this->fubar->method();
    +
    +
    +
    + +
    +
    +database([$params = ''[, $return = FALSE[, $query_builder = NULL]]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $params (mixed) – Database group name or configuration options
    • +
    • $return (bool) – Whether to return the loaded database object
    • +
    • $query_builder (bool) – Whether to load the Query Builder
    • +
    +
    Returns:

    Loaded CI_DB instance or FALSE on failure if $return is set to TRUE, otherwise CI_Loader instance (method chaining)

    +
    Return type:

    mixed

    +
    +

    This method lets you load the database class. The two parameters are +optional. Please see the database +section for more info.

    +
    + +
    +
    +dbforge([$db = NULL[, $return = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $db (object) – Database object
    • +
    • $return (bool) – Whether to return the Database Forge instance
    • +
    +
    Returns:

    Loaded CI_DB_forge instance if $return is set to TRUE, otherwise CI_Loader instance (method chaining)

    +
    Return type:

    mixed

    +
    +

    Loads the Database Forge class, please refer +to that manual for more info.

    +
    + +
    +
    +dbutil([$db = NULL[, $return = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $db (object) – Database object
    • +
    • $return (bool) – Whether to return the Database Utilities instance
    • +
    +
    Returns:

    Loaded CI_DB_utility instance if $return is set to TRUE, otherwise CI_Loader instance (method chaining)

    +
    Return type:

    mixed

    +
    +

    Loads the Database Utilities class, please +refer to that manual for more info.

    +
    + +
    +
    +helper($helpers)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $helpers (mixed) – Helper name as a string or an array containing multiple helpers
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    This method loads helper files, where file_name is the name of the +file, without the _helper.php extension.

    +
    + +
    +
    +file($path[, $return = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – File path
    • +
    • $return (bool) – Whether to return the loaded file
    • +
    +
    Returns:

    File contents if $return is set to TRUE, otherwise CI_Loader instance (method chaining)

    +
    Return type:

    mixed

    +
    +

    This is a generic file loading method. Supply the filepath and name in +the first parameter and it will open and read the file. By default the +data is sent to your browser, just like a View file, but if you set the +second parameter to boolean TRUE it will instead return the data as a +string.

    +
    + +
    +
    +language($files[, $lang = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $files (mixed) – Language file name or an array of multiple language files
    • +
    • $lang (string) – Language name
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    This method is an alias of the language loading +method: $this->lang->load().

    +
    + +
    +
    +config($file[, $use_sections = FALSE[, $fail_gracefully = FALSE]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $file (string) – Configuration file name
    • +
    • $use_sections (bool) – Whether configuration values should be loaded into their own section
    • +
    • $fail_gracefully (bool) – Whether to just return FALSE in case of failure
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    This method is an alias of the config file loading +method: $this->config->load()

    +
    + +
    +
    +is_loaded($class)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $class (string) – Class name
    • +
    +
    Returns:

    Singleton property name if found, FALSE if not

    +
    Return type:

    mixed

    +
    +

    Allows you to check if a class has already been loaded or not.

    +
    +

    Note

    +

    The word “class” here refers to libraries and drivers.

    +
    +

    If the requested class has been loaded, the method returns its assigned +name in the CI Super-object and FALSE if it’s not:

    +
    $this->load->library('form_validation');
    +$this->load->is_loaded('Form_validation');      // returns 'form_validation'
    +
    +$this->load->is_loaded('Nonexistent_library');  // returns FALSE
    +
    +
    +
    +

    Important

    +

    If you have more than one instance of a class (assigned to +different properties), then the first one will be returned.

    +
    +
    $this->load->library('form_validation', $config, 'fv');
    +$this->load->library('form_validation');
    +
    +$this->load->is_loaded('Form_validation');      // returns 'fv'
    +
    +
    +
    + +
    +
    +add_package_path($path[, $view_cascade = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to add
    • +
    • $view_cascade (bool) – Whether to use cascading views
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    Adding a package path instructs the Loader class to prepend a given path +for subsequent requests for resources. As an example, the “Foo Bar” +application package above has a library named Foo_bar.php. In our +controller, we’d do the following:

    +
    $this->load->add_package_path(APPPATH.'third_party/foo_bar/')
    +        ->library('foo_bar');
    +
    +
    +
    + +
    +
    +remove_package_path([$path = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to remove
    • +
    +
    Returns:

    CI_Loader instance (method chaining)

    +
    Return type:

    CI_Loader

    +
    +

    When your controller is finished using resources from an application +package, and particularly if you have other application packages you +want to work with, you may wish to remove the package path so the Loader +no longer looks in that directory for resources. To remove the last path +added, simply call the method with no parameters.

    +

    Or to remove a specific package path, specify the same path previously +given to add_package_path() for a package.:

    +
    $this->load->remove_package_path(APPPATH.'third_party/foo_bar/');
    +
    +
    +
    + +
    +
    +get_package_paths([$include_base = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $include_base (bool) – Whether to include BASEPATH
    • +
    +
    Returns:

    An array of package paths

    +
    Return type:

    array

    +
    +

    Returns all currently available package paths.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/migration.html b/user_guide/libraries/migration.html new file mode 100755 index 0000000..a621e2b --- /dev/null +++ b/user_guide/libraries/migration.html @@ -0,0 +1,758 @@ + + + + + + + + + + Migrations Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Migrations Class

    +

    Migrations are a convenient way for you to alter your database in a +structured and organized manner. You could edit fragments of SQL by hand +but you would then be responsible for telling other developers that they +need to go and run them. You would also have to keep track of which changes +need to be run against the production machines next time you deploy.

    +

    The database table migration tracks which migrations have already been +run so all you have to do is update your application files and +call $this->migration->current() to work out which migrations should be run. +The current version is found in application/config/migration.php.

    + +
    +

    Migration file names

    +

    Each Migration is run in numeric order forward or backwards depending on the +method taken. Two numbering styles are available:

    +
      +
    • Sequential: each migration is numbered in sequence, starting with 001. +Each number must be three digits, and there must not be any gaps in the +sequence. (This was the numbering scheme prior to CodeIgniter 3.0.)
    • +
    • Timestamp: each migration is numbered using the timestamp when the migration +was created, in YYYYMMDDHHIISS format (e.g. 20121031100537). This +helps prevent numbering conflicts when working in a team environment, and is +the preferred scheme in CodeIgniter 3.0 and later.
    • +
    +

    The desired style may be selected using the $config['migration_type'] +setting in your application/config/migration.php file.

    +

    Regardless of which numbering style you choose to use, prefix your migration +files with the migration number followed by an underscore and a descriptive +name for the migration. For example:

    +
      +
    • 001_add_blog.php (sequential numbering)
    • +
    • 20121031100537_add_blog.php (timestamp numbering)
    • +
    +
    +
    +

    Create a Migration

    +

    This will be the first migration for a new site which has a blog. All +migrations go in the application/migrations/ directory and have names such +as 20121031100537_add_blog.php.

    +
    <?php
    +
    +defined('BASEPATH') OR exit('No direct script access allowed');
    +
    +class Migration_Add_blog extends CI_Migration {
    +
    +        public function up()
    +        {
    +                $this->dbforge->add_field(array(
    +                        'blog_id' => array(
    +                                'type' => 'INT',
    +                                'constraint' => 5,
    +                                'unsigned' => TRUE,
    +                                'auto_increment' => TRUE
    +                        ),
    +                        'blog_title' => array(
    +                                'type' => 'VARCHAR',
    +                                'constraint' => '100',
    +                        ),
    +                        'blog_description' => array(
    +                                'type' => 'TEXT',
    +                                'null' => TRUE,
    +                        ),
    +                ));
    +                $this->dbforge->add_key('blog_id', TRUE);
    +                $this->dbforge->create_table('blog');
    +        }
    +
    +        public function down()
    +        {
    +                $this->dbforge->drop_table('blog');
    +        }
    +}
    +
    +
    +

    Then in application/config/migration.php set $config['migration_version'] = 20121031100537;.

    +
    +
    +

    Usage Example

    +

    In this example some simple code is placed in application/controllers/Migrate.php +to update the schema.:

    +
    <?php
    +
    +class Migrate extends CI_Controller
    +{
    +
    +        public function index()
    +        {
    +                $this->load->library('migration');
    +
    +                if ($this->migration->current() === FALSE)
    +                {
    +                        show_error($this->migration->error_string());
    +                }
    +        }
    +
    +}
    +
    +
    +
    +
    +

    Migration Preferences

    +

    The following is a table of all the config options for migrations.

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefaultOptionsDescription
    migration_enabledFALSETRUE / FALSEEnable or disable migrations.
    migration_pathAPPPATH.’migrations/’NoneThe path to your migrations folder.
    migration_version0NoneThe current version your database should use.
    migration_tablemigrationsNoneThe table name for storing the schema +version number.
    migration_auto_latestFALSETRUE / FALSEEnable or disable automatically +running migrations.
    migration_type‘timestamp’‘timestamp’ / ‘sequential’The type of numeric identifier used to name +migration files.
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Migration
    +
    +
    +current()
    +
    +++ + + + + + +
    Returns:TRUE if no migrations are found, current version string on success, FALSE on failure
    Return type:mixed
    +

    Migrates up to the current version (whatever is set for +$config['migration_version'] in application/config/migration.php).

    +
    + +
    +
    +error_string()
    +
    +++ + + + + + +
    Returns:Error messages
    Return type:string
    +

    This returns a string of errors that were detected while performing a migration.

    +
    + +
    +
    +find_migrations()
    +
    +++ + + + + + +
    Returns:An array of migration files
    Return type:array
    +

    An array of migration filenames are returned that are found in the migration_path property.

    +
    + +
    +
    +latest()
    +
    +++ + + + + + +
    Returns:Current version string on success, FALSE on failure
    Return type:mixed
    +

    This works much the same way as current() but instead of looking for +the $config['migration_version'] the Migration class will use the very +newest migration found in the filesystem.

    +
    + +
    +
    +version($target_version)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $target_version (mixed) – Migration version to process
    • +
    +
    Returns:

    TRUE if no migrations are found, current version string on success, FALSE on failure

    +
    Return type:

    mixed

    +
    +

    Version can be used to roll back changes or step forwards programmatically to +specific versions. It works just like current() but ignores $config['migration_version'].

    +
    $this->migration->version(5);
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html new file mode 100755 index 0000000..8c321ff --- /dev/null +++ b/user_guide/libraries/output.html @@ -0,0 +1,912 @@ + + + + + + + + + + Output Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Output Class

    +

    The Output class is a core class with one main function: To send the +finalized web page to the requesting browser. It is also responsible for +caching your web pages, if you use that +feature.

    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    +

    Under normal circumstances you won’t even notice the Output class since +it works transparently without your intervention. For example, when you +use the Loader class to load a view file, +it’s automatically passed to the Output class, which will be called +automatically by CodeIgniter at the end of system execution. It is +possible, however, for you to manually intervene with the output if you +need to.

    + +
    +

    Class Reference

    +
    +
    +class CI_Output
    +
    +
    +$parse_exec_vars = TRUE;
    +

    Enables/disables parsing of the {elapsed_time} and {memory_usage} pseudo-variables.

    +

    CodeIgniter will parse those tokens in your output by default. To disable this, set +this property to FALSE in your controller.

    +
    $this->output->parse_exec_vars = FALSE;
    +
    +
    +
    + +
    +
    +set_output($output)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $output (string) – String to set the output to
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to manually set the final output string. Usage example:

    +
    $this->output->set_output($data);
    +
    +
    +
    +

    Important

    +

    If you do set your output manually, it must be the last thing done +in the function you call it from. For example, if you build a page in one +of your controller methods, don’t set the output until the end.

    +
    +
    + +
    +
    +set_content_type($mime_type[, $charset = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $mime_type (string) – MIME Type idenitifer string
    • +
    • $charset (string) – Character set
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to set the mime-type of your page so you can serve JSON data, JPEG’s, XML, etc easily.

    +
    $this->output
    +        ->set_content_type('application/json')
    +        ->set_output(json_encode(array('foo' => 'bar')));
    +
    +$this->output
    +        ->set_content_type('jpeg') // You could also use ".jpeg" which will have the full stop removed before looking in config/mimes.php
    +        ->set_output(file_get_contents('files/something.jpg'));
    +
    +
    +
    +

    Important

    +

    Make sure any non-mime string you pass to this method +exists in application/config/mimes.php or it will have no effect.

    +
    +

    You can also set the character set of the document, by passing a second argument:

    +
    $this->output->set_content_type('css', 'utf-8');
    +
    +
    +
    + +
    +
    +get_content_type()
    +
    +++ + + + + + +
    Returns:Content-Type string
    Return type:string
    +

    Returns the Content-Type HTTP header that’s currently in use, excluding the character set value.

    +
    $mime = $this->output->get_content_type();
    +
    +
    +
    +

    Note

    +

    If not set, the default return value is ‘text/html’.

    +
    +
    + +
    +
    +get_header($header)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $header (string) – HTTP header name
    • +
    +
    Returns:

    HTTP response header or NULL if not found

    +
    Return type:

    mixed

    +
    +

    Returns the requested HTTP header value, or NULL if the requested header is not set. +Example:

    +
    $this->output->set_content_type('text/plain', 'UTF-8');
    +echo $this->output->get_header('content-type');
    +// Outputs: text/plain; charset=utf-8
    +
    +
    +
    +

    Note

    +

    The header name is compared in a case-insensitive manner.

    +
    +
    +

    Note

    +

    Raw headers sent via PHP’s native header() function are also detected.

    +
    +
    + +
    +
    +get_output()
    +
    +++ + + + + + +
    Returns:Output string
    Return type:string
    +

    Permits you to manually retrieve any output that has been sent for +storage in the output class. Usage example:

    +
    $string = $this->output->get_output();
    +
    +
    +

    Note that data will only be retrievable from this function if it has +been previously sent to the output class by one of the CodeIgniter +functions like $this->load->view().

    +
    + +
    +
    +append_output($output)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $output (string) – Additional output data to append
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Appends data onto the output string.

    +
    $this->output->append_output($data);
    +
    +
    +
    + +
    +
    +set_header($header[, $replace = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $header (string) – HTTP response header
    • +
    • $replace (bool) – Whether to replace the old header value, if it is already set
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to manually set server headers, which the output class will +send for you when outputting the final rendered display. Example:

    +
    $this->output->set_header('HTTP/1.0 200 OK');
    +$this->output->set_header('HTTP/1.1 200 OK');
    +$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
    +$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
    +$this->output->set_header('Cache-Control: post-check=0, pre-check=0');
    +$this->output->set_header('Pragma: no-cache');
    +
    +
    +
    + +
    +
    +set_status_header([$code = 200[, $text = '']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $code (int) – HTTP status code
    • +
    • $text (string) – Optional message
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to manually set a server status header. Example:

    +
    $this->output->set_status_header(401);
    +// Sets the header as:  Unauthorized
    +
    +
    +

    See here for a full list of headers.

    +
    +

    Note

    +

    This method is an alias for Common function +set_status_header().

    +
    +
    + +
    +
    +enable_profiler([$val = TRUE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $val (bool) – Whether to enable or disable the Profiler
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to enable/disable the Profiler, which will display benchmark +and other data at the bottom of your pages for debugging and optimization purposes.

    +

    To enable the profiler place the following line anywhere within your +Controller methods:

    +
    $this->output->enable_profiler(TRUE);
    +
    +
    +

    When enabled a report will be generated and inserted at the bottom of your pages.

    +

    To disable the profiler you would use:

    +
    $this->output->enable_profiler(FALSE);
    +
    +
    +
    + +
    +
    +set_profiler_sections($sections)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $sections (array) – Profiler sections
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Permits you to enable/disable specific sections of the Profiler when it is enabled. +Please refer to the Profiler documentation for further information.

    +
    + +
    +
    +cache($time)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $time (int) – Cache expiration time in minutes
    • +
    +
    Returns:

    CI_Output instance (method chaining)

    +
    Return type:

    CI_Output

    +
    +

    Caches the current page for the specified amount of minutes.

    +

    For more information, please see the caching documentation.

    +
    + +
    +
    +_display([$output = ''])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $output (string) – Output data override
    • +
    +
    Returns:

    void

    +
    Return type:

    void

    +
    +

    Sends finalized output data to the browser along with any server headers. It also stops benchmark +timers.

    +
    +

    Note

    +

    This method is called automatically at the end of script execution, you won’t need to +call it manually unless you are aborting script execution using exit() or die() in your code.

    +
    +

    Example:

    +
    $response = array('status' => 'OK');
    +
    +$this->output
    +        ->set_status_header(200)
    +        ->set_content_type('application/json', 'utf-8')
    +        ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES))
    +        ->_display();
    +exit;
    +
    +
    +
    +

    Note

    +

    Calling this method manually without aborting script execution will result in duplicated output.

    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html new file mode 100755 index 0000000..b87917f --- /dev/null +++ b/user_guide/libraries/pagination.html @@ -0,0 +1,784 @@ + + + + + + + + + + Pagination Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Pagination Class

    +

    CodeIgniter’s Pagination class is very easy to use, and it is 100% +customizable, either dynamically or via stored preferences.

    + +

    If you are not familiar with the term “pagination”, it refers to links +that allows you to navigate from page to page, like this:

    +
    « First  < 1 2 3 4 5 >  Last »
    +
    +
    +
    +

    Example

    +

    Here is a simple example showing how to create pagination in one of your +controller methods:

    +
    $this->load->library('pagination');
    +
    +$config['base_url'] = 'http://example.com/index.php/test/page/';
    +$config['total_rows'] = 200;
    +$config['per_page'] = 20;
    +
    +$this->pagination->initialize($config);
    +
    +echo $this->pagination->create_links();
    +
    +
    +
    +

    Notes

    +

    The $config array contains your configuration variables. It is passed to +the $this->pagination->initialize() method as shown above. Although +there are some twenty items you can configure, at minimum you need the +three shown. Here is a description of what those items represent:

    +
      +
    • base_url This is the full URL to the controller class/function +containing your pagination. In the example above, it is pointing to a +controller called “Test” and a function called “page”. Keep in mind +that you can re-route your URI if you +need a different structure.
    • +
    • total_rows This number represents the total rows in the result +set you are creating pagination for. Typically this number will be +the total rows that your database query returned.
    • +
    • per_page The number of items you intend to show per page. In the +above example, you would be showing 20 items per page.
    • +
    +

    The create_links() method returns an empty string when there is no +pagination to show.

    +
    +
    +

    Setting preferences in a config file

    +

    If you prefer not to set preferences using the above method, you can +instead put them into a config file. Simply create a new file called +pagination.php, add the $config array in that file. Then save the file +in application/config/pagination.php and it will be used automatically. +You will NOT need to use $this->pagination->initialize() if you save +your preferences in a config file.

    +
    +
    +
    +

    Customizing the Pagination

    +

    The following is a list of all the preferences you can pass to the +initialization function to tailor the display.

    +

    $config[‘uri_segment’] = 3;

    +

    The pagination function automatically determines which segment of your +URI contains the page number. If you need something different you can +specify it.

    +

    $config[‘num_links’] = 2;

    +

    The number of “digit” links you would like before and after the selected +page number. For example, the number 2 will place two digits on either +side, as in the example links at the very top of this page.

    +

    $config[‘use_page_numbers’] = TRUE;

    +

    By default, the URI segment will use the starting index for the items +you are paginating. If you prefer to show the the actual page number, +set this to TRUE.

    +

    $config[‘page_query_string’] = TRUE;

    +

    By default, the pagination library assume you are using URI +Segments, and constructs your links something +like:

    +
    http://example.com/index.php/test/page/20
    +
    +
    +

    If you have $config['enable_query_strings'] set to TRUE your links +will automatically be re-written using Query Strings. This option can +also be explicitly set. Using $config['page_query_string'] set to TRUE, +the pagination link will become:

    +
    http://example.com/index.php?c=test&m=page&per_page=20
    +
    +
    +

    Note that “per_page” is the default query string passed, however can be +configured using $config['query_string_segment'] = 'your_string'

    +

    $config[‘reuse_query_string’] = FALSE;

    +

    By default your Query String arguments (nothing to do with other +query string options) will be ignored. Setting this config to +TRUE will add existing query string arguments back into the +URL after the URI segment and before the suffix.:

    +
    http://example.com/index.php/test/page/20?query=search%term
    +
    +
    +

    This helps you mix together normal URI Segments +as well as query string arguments, which until 3.0 was not possible.

    +

    $config[‘prefix’] = ‘’;

    +

    A custom prefix added to the path. The prefix value will be right before +the offset segment.

    +

    $config[‘suffix’] = ‘’;

    +

    A custom suffix added to the path. The sufix value will be right after +the offset segment.

    +

    $config[‘use_global_url_suffix’] = FALSE;

    +

    When set to TRUE, it will override the $config['suffix'] value and +instead set it to the one that you have in $config['url_suffix'] in +your application/config/config.php file.

    +
    +
    +

    Adding Enclosing Markup

    +

    If you would like to surround the entire pagination with some markup you +can do it with these two preferences:

    +

    $config[‘full_tag_open’] = ‘<p>’;

    +

    The opening tag placed on the left side of the entire result.

    +

    $config[‘full_tag_close’] = ‘</p>’;

    +

    The closing tag placed on the right side of the entire result.

    +
    + + + + + + +
    +

    Hiding the Pages

    +

    If you wanted to not list the specific pages (for example, you only want +“next” and “previous” links), you can suppress their rendering by +adding:

    +
    $config['display_pages'] = FALSE;
    +
    +
    +
    +
    +

    Adding attributes to anchors

    +

    If you want to add an extra attribute to be added to every link rendered +by the pagination class, you can set them as key/value pairs in the +“attributes” config:

    +
    // Produces: class="myclass"
    +$config['attributes'] = array('class' => 'myclass');
    +
    +
    +
    +

    Note

    +

    Usage of the old method of setting classes via “anchor_class” +is deprecated.

    +
    +
    +
    +

    Disabling the “rel” attribute

    +

    By default the rel attribute is dynamically generated and appended to +the appropriate anchors. If for some reason you want to turn it off, +you can pass boolean FALSE as a regular attribute

    +
    $config['attributes']['rel'] = FALSE;
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Pagination
    +
    +
    +initialize([$params = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $params (array) – Configuration parameters
    • +
    +
    Returns:

    CI_Pagination instance (method chaining)

    +
    Return type:

    CI_Pagination

    +
    +

    Initializes the Pagination class with your preferred options.

    +
    + +
    + +
    +++ + + + + + +
    Returns:HTML-formatted pagination
    Return type:string
    +

    Returns a “pagination” bar, containing the generated links or an empty string if there’s just a single page.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html new file mode 100755 index 0000000..15bff00 --- /dev/null +++ b/user_guide/libraries/parser.html @@ -0,0 +1,850 @@ + + + + + + + + + + Template Parser Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Template Parser Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Template Parser Class

    +

    The Template Parser Class can perform simple text substitution for +pseudo-variables contained within your view files. +It can parse simple variables or variable tag pairs.

    +

    If you’ve never used a template engine, +pseudo-variable names are enclosed in braces, like this:

    +
    <html>
    +        <head>
    +                <title>{blog_title}</title>
    +        </head>
    +        <body>
    +                <h3>{blog_heading}</h3>
    +
    +        {blog_entries}
    +                <h5>{title}</h5>
    +                <p>{body}</p>
    +        {/blog_entries}
    +
    +        </body>
    +</html>
    +
    +
    +

    These variables are not actual PHP variables, but rather plain text +representations that allow you to eliminate PHP from your templates +(view files).

    +
    +

    Note

    +

    CodeIgniter does not require you to use this class since +using pure PHP in your view pages lets them run a little faster. +However, some developers prefer to use a template engine if +they work with designers who they feel would find some +confusion working with PHP.

    +
    +
    +

    Important

    +

    The Template Parser Class is not a full-blown +template parsing solution. We’ve kept it very lean on purpose in order +to maintain maximum performance.

    +
    + +
    +

    Using the Template Parser Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Parser class is initialized +in your controller using the $this->load->library() method:

    +
    $this->load->library('parser');
    +
    +
    +

    Once loaded, the Parser library object will be available using: +$this->parser

    +
    +
    +

    Parsing templates

    +

    You can use the parse() method to parse (or render) simple templates, +like this:

    +
    $data = array(
    +        'blog_title' => 'My Blog Title',
    +        'blog_heading' => 'My Blog Heading'
    +);
    +
    +$this->parser->parse('blog_template', $data);
    +
    +
    +

    The first parameter contains the name of the view +file (in this example the file would be called +blog_template.php), and the second parameter contains an associative +array of data to be replaced in the template. In the above example, the +template would contain two variables: {blog_title} and {blog_heading}

    +

    There is no need to “echo” or do something with the data returned by +$this->parser->parse(). It is automatically passed to the output class +to be sent to the browser. However, if you do want the data returned +instead of sent to the output class you can pass TRUE (boolean) as the +third parameter:

    +
    $string = $this->parser->parse('blog_template', $data, TRUE);
    +
    +
    +
    +
    +

    Variable Pairs

    +

    The above example code allows simple variables to be replaced. What if +you would like an entire block of variables to be repeated, with each +iteration containing new values? Consider the template example we showed +at the top of the page:

    +
    <html>
    +        <head>
    +                <title>{blog_title}</title>
    +        </head>
    +        <body>
    +                <h3>{blog_heading}</h3>
    +
    +        {blog_entries}
    +                <h5>{title}</h5>
    +                <p>{body}</p>
    +        {/blog_entries}
    +
    +        </body>
    +</html>
    +
    +
    +

    In the above code you’ll notice a pair of variables: {blog_entries} +data… {/blog_entries}. In a case like this, the entire chunk of data +between these pairs would be repeated multiple times, corresponding to +the number of rows in the “blog_entries” element of the parameters array.

    +

    Parsing variable pairs is done using the identical code shown above to +parse single variables, except, you will add a multi-dimensional array +corresponding to your variable pair data. Consider this example:

    +
    $this->load->library('parser');
    +
    +$data = array(
    +        'blog_title'   => 'My Blog Title',
    +        'blog_heading' => 'My Blog Heading',
    +        'blog_entries' => array(
    +                array('title' => 'Title 1', 'body' => 'Body 1'),
    +                array('title' => 'Title 2', 'body' => 'Body 2'),
    +                array('title' => 'Title 3', 'body' => 'Body 3'),
    +                array('title' => 'Title 4', 'body' => 'Body 4'),
    +                array('title' => 'Title 5', 'body' => 'Body 5')
    +        )
    +);
    +
    +$this->parser->parse('blog_template', $data);
    +
    +
    +

    If your “pair” data is coming from a database result, which is already a +multi-dimensional array, you can simply use the database result_array() +method:

    +
    $query = $this->db->query("SELECT * FROM blog");
    +
    +$this->load->library('parser');
    +
    +$data = array(
    +        'blog_title'   => 'My Blog Title',
    +        'blog_heading' => 'My Blog Heading',
    +        'blog_entries' => $query->result_array()
    +);
    +
    +$this->parser->parse('blog_template', $data);
    +
    +
    +
    +
    +

    Usage Notes

    +

    If you include substitution parameters that are not referenced in your +template, they are ignored:

    +
    $template = 'Hello, {firstname} {lastname}';
    +$data = array(
    +        'title' => 'Mr',
    +        'firstname' => 'John',
    +        'lastname' => 'Doe'
    +);
    +$this->parser->parse_string($template, $data);
    +
    +// Result: Hello, John Doe
    +
    +
    +

    If you do not include a substitution parameter that is referenced in your +template, the original pseudo-variable is shown in the result:

    +
    $template = 'Hello, {firstname} {initials} {lastname}';
    +$data = array(
    +        'title' => 'Mr',
    +        'firstname' => 'John',
    +        'lastname' => 'Doe'
    +);
    +$this->parser->parse_string($template, $data);
    +
    +// Result: Hello, John {initials} Doe
    +
    +
    +

    If you provide a string substitution parameter when an array is expected, +i.e. for a variable pair, the substitution is done for the opening variable +pair tag, but the closing variable pair tag is not rendered properly:

    +
    $template = 'Hello, {firstname} {lastname} ({degrees}{degree} {/degrees})';
    +$data = array(
    +        'degrees' => 'Mr',
    +        'firstname' => 'John',
    +        'lastname' => 'Doe',
    +        'titles' => array(
    +                array('degree' => 'BSc'),
    +                array('degree' => 'PhD')
    +        )
    +);
    +$this->parser->parse_string($template, $data);
    +
    +// Result: Hello, John Doe (Mr{degree} {/degrees})
    +
    +
    +

    If you name one of your individual substitution parameters the same as one +used inside a variable pair, the results may not be as expected:

    +
    $template = 'Hello, {firstname} {lastname} ({degrees}{degree} {/degrees})';
    +$data = array(
    +        'degree' => 'Mr',
    +        'firstname' => 'John',
    +        'lastname' => 'Doe',
    +        'degrees' => array(
    +                array('degree' => 'BSc'),
    +                array('degree' => 'PhD')
    +        )
    +);
    +$this->parser->parse_string($template, $data);
    +
    +// Result: Hello, John Doe (Mr Mr )
    +
    +
    +
    +
    +

    View Fragments

    +

    You do not have to use variable pairs to get the effect of iteration in +your views. It is possible to use a view fragment for what would be inside +a variable pair, and to control the iteration in your controller instead +of in the view.

    +

    An example with the iteration controlled in the view:

    +
    $template = '<ul>{menuitems}
    +        <li><a href="{link}">{title}</a></li>
    +{/menuitems}</ul>';
    +
    +$data = array(
    +        'menuitems' => array(
    +                array('title' => 'First Link', 'link' => '/first'),
    +                array('title' => 'Second Link', 'link' => '/second'),
    +        )
    +);
    +$this->parser->parse_string($template, $data);
    +
    +
    +

    Result:

    +
    <ul>
    +        <li><a href="/first">First Link</a></li>
    +        <li><a href="/second">Second Link</a></li>
    +</ul>
    +
    +
    +

    An example with the iteration controlled in the controller, +using a view fragment:

    +
    $temp = '';
    +$template1 = '<li><a href="{link}">{title}</a></li>';
    +$data1 = array(
    +        array('title' => 'First Link', 'link' => '/first'),
    +        array('title' => 'Second Link', 'link' => '/second'),
    +);
    +
    +foreach ($data1 as $menuitem)
    +{
    +        $temp .= $this->parser->parse_string($template1, $menuitem, TRUE);
    +}
    +
    +$template = '<ul>{menuitems}</ul>';
    +$data = array(
    +        'menuitems' => $temp
    +);
    +$this->parser->parse_string($template, $data);
    +
    +
    +

    Result:

    +
    <ul>
    +        <li><a href="/first">First Link</a></li>
    +        <li><a href="/second">Second Link</a></li>
    +</ul>
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Parser
    +
    +
    +parse($template, $data[, $return = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $template (string) – Path to view file
    • +
    • $data (array) – Variable data
    • +
    • $return (bool) – Whether to only return the parsed template
    • +
    +
    Returns:

    Parsed template string

    +
    Return type:

    string

    +
    +

    Parses a template from the provided path and variables.

    +
    + +
    +
    +parse_string($template, $data[, $return = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $template (string) – Path to view file
    • +
    • $data (array) – Variable data
    • +
    • $return (bool) – Whether to only return the parsed template
    • +
    +
    Returns:

    Parsed template string

    +
    Return type:

    string

    +
    +

    This method works exactly like parse(), only it accepts +the template as a string instead of loading a view file.

    +
    + +
    +
    +set_delimiters([$l = '{'[, $r = '}']])
    +
    +++ + + + + + +
    Parameters:
      +
    • $l (string) – Left delimiter
    • +
    • $r (string) – Right delimiter
    • +
    +
    Return type:

    void

    +
    +

    Sets the delimiters (opening and closing) for a +pseudo-variable “tag” in a template.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html new file mode 100755 index 0000000..0e5cf09 --- /dev/null +++ b/user_guide/libraries/security.html @@ -0,0 +1,739 @@ + + + + + + + + + + Security Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Security Class

    +

    The Security Class contains methods that help you create a secure +application, processing input data for security.

    + +
    +

    XSS Filtering

    +

    CodeIgniter comes with a Cross Site Scripting prevention filter, which +looks for commonly used techniques to trigger JavaScript or other types +of code that attempt to hijack cookies or do other malicious things. +If anything disallowed is encountered it is rendered safe by converting +the data to character entities.

    +

    To filter data through the XSS filter use the xss_clean() method:

    +
    $data = $this->security->xss_clean($data);
    +
    +
    +

    An optional second parameter, is_image, allows this function to be used +to test images for potential XSS attacks, useful for file upload +security. When this second parameter is set to TRUE, instead of +returning an altered string, the function returns TRUE if the image is +safe, and FALSE if it contained potentially malicious information that a +browser may attempt to execute.

    +
    if ($this->security->xss_clean($file, TRUE) === FALSE)
    +{
    +        // file failed the XSS test
    +}
    +
    +
    +
    +

    Important

    +

    If you want to filter HTML attribute values, use +html_escape() instead!

    +
    +
    +
    +

    Cross-site request forgery (CSRF)

    +

    You can enable CSRF protection by altering your application/config/config.php +file in the following way:

    +
    $config['csrf_protection'] = TRUE;
    +
    +
    +

    If you use the form helper, then +form_open() will automatically insert a hidden csrf field in +your forms. If not, then you can use get_csrf_token_name() +and get_csrf_hash()

    +
    $csrf = array(
    +        'name' => $this->security->get_csrf_token_name(),
    +        'hash' => $this->security->get_csrf_hash()
    +);
    +
    +...
    +
    +<input type="hidden" name="<?=$csrf['name'];?>" value="<?=$csrf['hash'];?>" />
    +
    +
    +

    Tokens may be either regenerated on every submission (default) or +kept the same throughout the life of the CSRF cookie. The default +regeneration of tokens provides stricter security, but may result +in usability concerns as other tokens become invalid (back/forward +navigation, multiple tabs/windows, asynchronous actions, etc). You +may alter this behavior by editing the following config parameter

    +
    $config['csrf_regenerate'] = TRUE;
    +
    +
    +

    Select URIs can be whitelisted from csrf protection (for example API +endpoints expecting externally POSTed content). You can add these URIs +by editing the ‘csrf_exclude_uris’ config parameter:

    +
    $config['csrf_exclude_uris'] = array('api/person/add');
    +
    +
    +

    Regular expressions are also supported (case-insensitive):

    +
    $config['csrf_exclude_uris'] = array(
    +        'api/record/[0-9]+',
    +        'api/title/[a-z]+'
    +);
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Security
    +
    +
    +xss_clean($str[, $is_image = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (mixed) – Input string or an array of strings
    • +
    +
    Returns:

    XSS-clean data

    +
    Return type:

    mixed

    +
    +

    Tries to remove XSS exploits from the input data and returns the cleaned string. +If the optional second parameter is set to true, it will return boolean TRUE if +the image is safe to use and FALSE if malicious data was detected in it.

    +
    +

    Important

    +

    This method is not suitable for filtering HTML attribute values! +Use html_escape() for that instead.

    +
    +
    + +
    +
    +sanitize_filename($str[, $relative_path = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – File name/path
    • +
    • $relative_path (bool) – Whether to preserve any directories in the file path
    • +
    +
    Returns:

    Sanitized file name/path

    +
    Return type:

    string

    +
    +

    Tries to sanitize filenames in order to prevent directory traversal attempts +and other security threats, which is particularly useful for files that were supplied via user input.

    +
    $filename = $this->security->sanitize_filename($this->input->post('filename'));
    +
    +
    +

    If it is acceptable for the user input to include relative paths, e.g. +file/in/some/approved/folder.txt, you can set the second optional parameter, $relative_path to TRUE.

    +
    $filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE);
    +
    +
    +
    + +
    +
    +get_csrf_token_name()
    +
    +++ + + + + + +
    Returns:CSRF token name
    Return type:string
    +

    Returns the CSRF token name (the $config['csrf_token_name'] value).

    +
    + +
    +
    +get_csrf_hash()
    +
    +++ + + + + + +
    Returns:CSRF hash
    Return type:string
    +

    Returns the CSRF hash value. Useful in combination with get_csrf_token_name() +for manually building forms or sending valid AJAX POST requests.

    +
    + +
    +
    +entity_decode($str[, $charset = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $charset (string) – Character set of the input string
    • +
    +
    Returns:

    Entity-decoded string

    +
    Return type:

    string

    +
    +

    This method acts a lot like PHP’s own native html_entity_decode() function in ENT_COMPAT mode, only +it tries to detect HTML entities that don’t end in a semicolon because some browsers allow that.

    +

    If the $charset parameter is left empty, then your configured $config['charset'] value will be used.

    +
    + +
    +
    +get_random_bytes($length)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $length (int) – Output length
    • +
    +
    Returns:

    A binary stream of random bytes or FALSE on failure

    +
    Return type:

    string

    +
    +

    A convenience method for getting proper random bytes via mcrypt_create_iv(), +/dev/urandom or openssl_random_pseudo_bytes() (in that order), if one +of them is available.

    +

    Used for generating CSRF and XSS tokens.

    +
    +

    Note

    +

    The output is NOT guaranteed to be cryptographically secure, +just the best attempt at that.

    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html new file mode 100755 index 0000000..838f7cc --- /dev/null +++ b/user_guide/libraries/sessions.html @@ -0,0 +1,1922 @@ + + + + + + + + + + Session Library — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Session Library

    +

    The Session class permits you maintain a user’s “state” and track their +activity while they browse your site.

    +

    CodeIgniter comes with a few session storage drivers:

    +
    +
      +
    • files (default; file-system based)
    • +
    • database
    • +
    • redis
    • +
    • memcached
    • +
    +
    +

    In addition, you may create your own, custom session drivers based on other +kinds of storage, while still taking advantage of the features of the +Session class.

    + +
    +

    Using the Session Class

    +
    +

    Initializing a Session

    +

    Sessions will typically run globally with each page load, so the Session +class should either be initialized in your controller constructors, or it can be auto-loaded by the system. +For the most part the session class will run unattended in the background, +so simply initializing the class will cause it to read, create, and update +sessions when necessary.

    +

    To initialize the Session class manually in your controller constructor, +use the $this->load->library() method:

    +
    $this->load->library('session');
    +
    +
    +

    Once loaded, the Sessions library object will be available using:

    +
    $this->session
    +
    +
    +
    +

    Important

    +

    Because the Loader Class is instantiated +by CodeIgniter’s base controller, make sure to call +parent::__construct() before trying to load a library from +inside a controller constructor.

    +
    +
    +
    +

    How do Sessions work?

    +

    When a page is loaded, the session class will check to see if valid +session cookie is sent by the user’s browser. If a sessions cookie does +not exist (or if it doesn’t match one stored on the server or has +expired) a new session will be created and saved.

    +

    If a valid session does exist, its information will be updated. With each +update, the session ID may be regenerated if configured to do so.

    +

    It’s important for you to understand that once initialized, the Session +class runs automatically. There is nothing you need to do to cause the +above behavior to happen. You can, as you’ll see below, work with session +data, but the process of reading, writing, and updating a session is +automatic.

    +
    +

    Note

    +

    Under CLI, the Session library will automatically halt itself, +as this is a concept based entirely on the HTTP protocol.

    +
    +
    +

    A note about concurrency

    +

    Unless you’re developing a website with heavy AJAX usage, you can skip this +section. If you are, however, and if you’re experiencing performance +issues, then this note is exactly what you’re looking for.

    +

    Sessions in previous versions of CodeIgniter didn’t implement locking, +which meant that two HTTP requests using the same session could run exactly +at the same time. To use a more appropriate technical term - requests were +non-blocking.

    +

    However, non-blocking requests in the context of sessions also means +unsafe, because modifications to session data (or session ID regeneration) +in one request can interfere with the execution of a second, concurrent +request. This detail was at the root of many issues and the main reason why +CodeIgniter 3.0 has a completely re-written Session library.

    +

    Why are we telling you this? Because it is likely that after trying to +find the reason for your performance issues, you may conclude that locking +is the issue and therefore look into how to remove the locks …

    +

    DO NOT DO THAT! Removing locks would be wrong and it will cause you +more problems!

    +

    Locking is not the issue, it is a solution. Your issue is that you still +have the session open, while you’ve already processed it and therefore no +longer need it. So, what you need is to close the session for the +current request after you no longer need it.

    +

    Long story short - call session_write_close() once you no longer need +anything to do with session variables.

    +
    +
    +
    +

    What is Session Data?

    +

    Session data is simply an array associated with a particular session ID +(cookie).

    +

    If you’ve used sessions in PHP before, you should be familiar with PHP’s +$_SESSION superglobal +(if not, please read the content on that link).

    +

    CodeIgniter gives access to its session data through the same means, as it +uses the session handlers’ mechanism provided by PHP. Using session data is +as simple as manipulating (read, set and unset values) the $_SESSION +array.

    +

    In addition, CodeIgniter also provides 2 special types of session data +that are further explained below: flashdata and tempdata.

    +
    +

    Note

    +

    In previous versions, regular session data in CodeIgniter was +referred to as ‘userdata’. Have this in mind if that term is used +elsewhere in the manual. Most of it is written to explain how +the custom ‘userdata’ methods work.

    +
    +
    +
    +

    Retrieving Session Data

    +

    Any piece of information from the session array is available through the +$_SESSION superglobal:

    +
    $_SESSION['item']
    +
    +
    +

    Or through the magic getter:

    +
    $this->session->item
    +
    +
    +

    And for backwards compatibility, through the userdata() method:

    +
    $this->session->userdata('item');
    +
    +
    +

    Where item is the array key corresponding to the item you wish to fetch. +For example, to assign a previously stored ‘name’ item to the $name +variable, you will do this:

    +
    $name = $_SESSION['name'];
    +
    +// or:
    +
    +$name = $this->session->name
    +
    +// or:
    +
    +$name = $this->session->userdata('name');
    +
    +
    +
    +

    Note

    +

    The userdata() method returns NULL if the item you are trying +to access does not exist.

    +
    +

    If you want to retrieve all of the existing userdata, you can simply +omit the item key (magic getter only works for properties):

    +
    $_SESSION
    +
    +// or:
    +
    +$this->session->userdata();
    +
    +
    +
    +
    +

    Adding Session Data

    +

    Let’s say a particular user logs into your site. Once authenticated, you +could add their username and e-mail address to the session, making that +data globally available to you without having to run a database query when +you need it.

    +

    You can simply assign data to the $_SESSION array, as with any other +variable. Or as a property of $this->session.

    +

    Alternatively, the old method of assigning it as “userdata” is also +available. That however passing an array containing your new data to the +set_userdata() method:

    +
    $this->session->set_userdata($array);
    +
    +
    +

    Where $array is an associative array containing your new data. Here’s +an example:

    +
    $newdata = array(
    +        'username'  => 'johndoe',
    +        'email'     => 'johndoe@some-site.com',
    +        'logged_in' => TRUE
    +);
    +
    +$this->session->set_userdata($newdata);
    +
    +
    +

    If you want to add userdata one value at a time, set_userdata() also +supports this syntax:

    +
    $this->session->set_userdata('some_name', 'some_value');
    +
    +
    +

    If you want to verify that a session value exists, simply check with +isset():

    +
    // returns FALSE if the 'some_name' item doesn't exist or is NULL,
    +// TRUE otherwise:
    +isset($_SESSION['some_name'])
    +
    +
    +

    Or you can call has_userdata():

    +
    $this->session->has_userdata('some_name');
    +
    +
    +
    +
    +

    Removing Session Data

    +

    Just as with any other variable, unsetting a value in $_SESSION can be +done through unset():

    +
    unset($_SESSION['some_name']);
    +
    +// or multiple values:
    +
    +unset(
    +        $_SESSION['some_name'],
    +        $_SESSION['another_name']
    +);
    +
    +
    +

    Also, just as set_userdata() can be used to add information to a +session, unset_userdata() can be used to remove it, by passing the +session key. For example, if you wanted to remove ‘some_name’ from your +session data array:

    +
    $this->session->unset_userdata('some_name');
    +
    +
    +

    This method also accepts an array of item keys to unset:

    +
    $array_items = array('username', 'email');
    +
    +$this->session->unset_userdata($array_items);
    +
    +
    +
    +

    Note

    +

    In previous versions, the unset_userdata() method used +to accept an associative array of key => 'dummy value' +pairs. This is no longer supported.

    +
    +
    +
    +

    Flashdata

    +

    CodeIgniter supports “flashdata”, or session data that will only be +available for the next request, and is then automatically cleared.

    +

    This can be very useful, especially for one-time informational, error or +status messages (for example: “Record 2 deleted”).

    +

    It should be noted that flashdata variables are regular session vars, +only marked in a specific way under the ‘__ci_vars’ key (please don’t touch +that one, you’ve been warned).

    +

    To mark an existing item as “flashdata”:

    +
    $this->session->mark_as_flash('item');
    +
    +
    +

    If you want to mark multiple items as flashdata, simply pass the keys as an +array:

    +
    $this->session->mark_as_flash(array('item', 'item2'));
    +
    +
    +

    To add flashdata:

    +
    $_SESSION['item'] = 'value';
    +$this->session->mark_as_flash('item');
    +
    +
    +

    Or alternatively, using the set_flashdata() method:

    +
    $this->session->set_flashdata('item', 'value');
    +
    +
    +

    You can also pass an array to set_flashdata(), in the same manner as +set_userdata().

    +

    Reading flashdata variables is the same as reading regular session data +through $_SESSION:

    +
    $_SESSION['item']
    +
    +
    +
    +

    Important

    +

    The userdata() method will NOT return flashdata items.

    +
    +

    However, if you want to be sure that you’re reading “flashdata” (and not +any other kind), you can also use the flashdata() method:

    +
    $this->session->flashdata('item');
    +
    +
    +

    Or to get an array with all flashdata, simply omit the key parameter:

    +
    $this->session->flashdata();
    +
    +
    +
    +

    Note

    +

    The flashdata() method returns NULL if the item cannot be +found.

    +
    +

    If you find that you need to preserve a flashdata variable through an +additional request, you can do so using the keep_flashdata() method. +You can either pass a single item or an array of flashdata items to keep.

    +
    $this->session->keep_flashdata('item');
    +$this->session->keep_flashdata(array('item1', 'item2', 'item3'));
    +
    +
    +
    +
    +

    Tempdata

    +

    CodeIgniter also supports “tempdata”, or session data with a specific +expiration time. After the value expires, or the session expires or is +deleted, the value is automatically removed.

    +

    Similarly to flashdata, tempdata variables are regular session vars that +are marked in a specific way under the ‘__ci_vars’ key (again, don’t touch +that one).

    +

    To mark an existing item as “tempdata”, simply pass its key and expiry time +(in seconds!) to the mark_as_temp() method:

    +
    // 'item' will be erased after 300 seconds
    +$this->session->mark_as_temp('item', 300);
    +
    +
    +

    You can mark multiple items as tempdata in two ways, depending on whether +you want them all to have the same expiry time or not:

    +
    // Both 'item' and 'item2' will expire after 300 seconds
    +$this->session->mark_as_temp(array('item', 'item2'), 300);
    +
    +// 'item' will be erased after 300 seconds, while 'item2'
    +// will do so after only 240 seconds
    +$this->session->mark_as_temp(array(
    +        'item'  => 300,
    +        'item2' => 240
    +));
    +
    +
    +

    To add tempdata:

    +
    $_SESSION['item'] = 'value';
    +$this->session->mark_as_temp('item', 300); // Expire in 5 minutes
    +
    +
    +

    Or alternatively, using the set_tempdata() method:

    +
    $this->session->set_tempdata('item', 'value', 300);
    +
    +
    +

    You can also pass an array to set_tempdata():

    +
    $tempdata = array('newuser' => TRUE, 'message' => 'Thanks for joining!');
    +
    +$this->session->set_tempdata($tempdata, NULL, $expire);
    +
    +
    +
    +

    Note

    +

    If the expiration is omitted or set to 0, the default +time-to-live value of 300 seconds (or 5 minutes) will be used.

    +
    +

    To read a tempdata variable, again you can just access it through the +$_SESSION superglobal array:

    +
    $_SESSION['item']
    +
    +
    +
    +

    Important

    +

    The userdata() method will NOT return tempdata items.

    +
    +

    Or if you want to be sure that you’re reading “tempdata” (and not any +other kind), you can also use the tempdata() method:

    +
    $this->session->tempdata('item');
    +
    +
    +

    And of course, if you want to retrieve all existing tempdata:

    +
    $this->session->tempdata();
    +
    +
    +
    +

    Note

    +

    The tempdata() method returns NULL if the item cannot be +found.

    +
    +

    If you need to remove a tempdata value before it expires, you can directly +unset it from the $_SESSION array:

    +
    unset($_SESSION['item']);
    +
    +
    +

    However, this won’t remove the marker that makes this specific item to be +tempdata (it will be invalidated on the next HTTP request), so if you +intend to reuse that same key in the same request, you’d want to use +unset_tempdata():

    +
    $this->session->unset_tempdata('item');
    +
    +
    +
    +
    +

    Destroying a Session

    +

    To clear the current session (for example, during a logout), you may +simply use either PHP’s session_destroy() +function, or the sess_destroy() method. Both will work in exactly the +same way:

    +
    session_destroy();
    +
    +// or
    +
    +$this->session->sess_destroy();
    +
    +
    +
    +

    Note

    +

    This must be the last session-related operation that you do +during the same request. All session data (including flashdata and +tempdata) will be destroyed permanently and functions will be +unusable during the same request after you destroy the session.

    +
    +
    +
    +

    Accessing session metadata

    +

    In previous CodeIgniter versions, the session data array included 4 items +by default: ‘session_id’, ‘ip_address’, ‘user_agent’, ‘last_activity’.

    +

    This was due to the specifics of how sessions worked, but is now no longer +necessary with our new implementation. However, it may happen that your +application relied on these values, so here are alternative methods of +accessing them:

    +
    +
      +
    • session_id: session_id()
    • +
    • ip_address: $_SERVER['REMOTE_ADDR']
    • +
    • user_agent: $this->input->user_agent() (unused by sessions)
    • +
    • last_activity: Depends on the storage, no straightforward way. Sorry!
    • +
    +
    +
    +
    +

    Session Preferences

    +

    CodeIgniter will usually make everything work out of the box. However, +Sessions are a very sensitive component of any application, so some +careful configuration must be done. Please take your time to consider +all of the options and their effects.

    +

    You’ll find the following Session related preferences in your +application/config/config.php file:

    + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefaultOptionsDescription
    sess_driverfilesfiles/database/redis/memcached/customThe session storage driver to use.
    sess_cookie_nameci_session[A-Za-z_-] characters onlyThe name used for the session cookie.
    sess_expiration7200 (2 hours)Time in seconds (integer)The number of seconds you would like the session to last. +If you would like a non-expiring session (until browser is closed) set the value to zero: 0
    sess_save_pathNULLNoneSpecifies the storage location, depends on the driver being used.
    sess_match_ipFALSETRUE/FALSE (boolean)Whether to validate the user’s IP address when reading the session cookie. +Note that some ISPs dynamically changes the IP, so if you want a non-expiring session you +will likely set this to FALSE.
    sess_time_to_update300Time in seconds (integer)This option controls how often the session class will regenerate itself and create a new +session ID. Setting it to 0 will disable session ID regeneration.
    sess_regenerate_destroyFALSETRUE/FALSE (boolean)Whether to destroy session data associated with the old session ID when auto-regenerating +the session ID. When set to FALSE, the data will be later deleted by the garbage collector.
    +
    +

    Note

    +

    As a last resort, the Session library will try to fetch PHP’s +session related INI settings, as well as legacy CI settings such as +‘sess_expire_on_close’ when any of the above is not configured. +However, you should never rely on this behavior as it can cause +unexpected results or be changed in the future. Please configure +everything properly.

    +
    +

    In addition to the values above, the cookie and native drivers apply the +following configuration values shared by the Input and +Security classes:

    + +++++ + + + + + + + + + + + + + + + + + + + + +
    PreferenceDefaultDescription
    cookie_domain‘’The domain for which the session is applicable
    cookie_path/The path to which the session is applicable
    cookie_secureFALSEWhether to create the session cookie only on encrypted (HTTPS) connections
    +
    +

    Note

    +

    The ‘cookie_httponly’ setting doesn’t have an effect on sessions. +Instead the HttpOnly parameter is always enabled, for security +reasons. Additionally, the ‘cookie_prefix’ setting is completely +ignored.

    +
    +
    +
    +

    Session Drivers

    +

    As already mentioned, the Session library comes with 4 drivers, or storage +engines, that you can use:

    +
    +
      +
    • files
    • +
    • database
    • +
    • redis
    • +
    • memcached
    • +
    +
    +

    By default, the Files Driver will be used when a session is initialized, +because it is the most safe choice and is expected to work everywhere +(virtually every environment has a file system).

    +

    However, any other driver may be selected via the $config['sess_driver'] +line in your application/config/config.php file, if you chose to do so. +Have it in mind though, every driver has different caveats, so be sure to +get yourself familiar with them (below) before you make that choice.

    +

    In addition, you may also create and use Custom Drivers, if the ones +provided by default don’t satisfy your use case.

    +
    +

    Note

    +

    In previous CodeIgniter versions, a different, “cookie driver” +was the only option and we have received negative feedback on not +providing that option. While we do listen to feedback from the +community, we want to warn you that it was dropped because it is +unsafe and we advise you NOT to try to replicate it via a +custom driver.

    +
    +
    +

    Files Driver

    +

    The ‘files’ driver uses your file system for storing session data.

    +

    It can safely be said that it works exactly like PHP’s own default session +implementation, but in case this is an important detail for you, have it +mind that it is in fact not the same code and it has some limitations +(and advantages).

    +

    To be more specific, it doesn’t support PHP’s directory level and mode +formats used in session.save_path, +and it has most of the options hard-coded for safety. Instead, only +absolute paths are supported for $config['sess_save_path'].

    +

    Another important thing that you should know, is to make sure that you +don’t use a publicly-readable or shared directory for storing your session +files. Make sure that only you have access to see the contents of your +chosen sess_save_path directory. Otherwise, anybody who can do that, can +also steal any of the current sessions (also known as “session fixation” +attack).

    +

    On UNIX-like operating systems, this is usually achieved by setting the +0700 mode permissions on that directory via the chmod command, which +allows only the directory’s owner to perform read and write operations on +it. But be careful because the system user running the script is usually +not your own, but something like ‘www-data’ instead, so only setting those +permissions will probable break your application.

    +

    Instead, you should do something like this, depending on your environment

    +
    mkdir /<path to your application directory>/sessions/
    +chmod 0700 /<path to your application directory>/sessions/
    +chown www-data /<path to your application directory>/sessions/
    +
    +
    +
    +
    Bonus Tip
    +

    Some of you will probably opt to choose another session driver because +file storage is usually slower. This is only half true.

    +

    A very basic test will probably trick you into believing that an SQL +database is faster, but in 99% of the cases, this is only true while you +only have a few current sessions. As the sessions count and server loads +increase - which is the time when it matters - the file system will +consistently outperform almost all relational database setups.

    +

    In addition, if performance is your only concern, you may want to look +into using tmpfs, +(warning: external resource), which can make your sessions blazing fast.

    +
    +
    +
    +

    Database Driver

    +

    The ‘database’ driver uses a relational database such as MySQL or +PostgreSQL to store sessions. This is a popular choice among many users, +because it allows the developer easy access to the session data within +an application - it is just another table in your database.

    +

    However, there are some conditions that must be met:

    +
    +
      +
    • Only your default database connection (or the one that you access +as $this->db from your controllers) can be used.
    • +
    • You must have the Query Builder +enabled.
    • +
    • You can NOT use a persistent connection.
    • +
    • You can NOT use a connection with the cache_on setting enabled.
    • +
    +
    +

    In order to use the ‘database’ session driver, you must also create this +table that we already mentioned and then set it as your +$config['sess_save_path'] value. +For example, if you would like to use ‘ci_sessions’ as your table name, +you would do this:

    +
    $config['sess_driver'] = 'database';
    +$config['sess_save_path'] = 'ci_sessions';
    +
    +
    +
    +

    Note

    +

    If you’ve upgraded from a previous version of CodeIgniter and +you don’t have ‘sess_save_path’ configured, then the Session +library will look for the old ‘sess_table_name’ setting and use +it instead. Please don’t rely on this behavior as it will get +removed in the future.

    +
    +

    And then of course, create the database table …

    +

    For MySQL:

    +
    CREATE TABLE IF NOT EXISTS `ci_sessions` (
    +        `id` varchar(128) NOT NULL,
    +        `ip_address` varchar(45) NOT NULL,
    +        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
    +        `data` blob NOT NULL,
    +        KEY `ci_sessions_timestamp` (`timestamp`)
    +);
    +
    +
    +

    For PostgreSQL:

    +
    CREATE TABLE "ci_sessions" (
    +        "id" varchar(128) NOT NULL,
    +        "ip_address" varchar(45) NOT NULL,
    +        "timestamp" bigint DEFAULT 0 NOT NULL,
    +        "data" text DEFAULT '' NOT NULL
    +);
    +
    +CREATE INDEX "ci_sessions_timestamp" ON "ci_sessions" ("timestamp");
    +
    +
    +

    You will also need to add a PRIMARY KEY depending on your ‘sess_match_ip’ +setting. The examples below work both on MySQL and PostgreSQL:

    +
    // When sess_match_ip = TRUE
    +ALTER TABLE ci_sessions ADD PRIMARY KEY (id, ip_address);
    +
    +// When sess_match_ip = FALSE
    +ALTER TABLE ci_sessions ADD PRIMARY KEY (id);
    +
    +// To drop a previously created primary key (use when changing the setting)
    +ALTER TABLE ci_sessions DROP PRIMARY KEY;
    +
    +
    +
    +

    Important

    +

    Only MySQL and PostgreSQL databases are officially +supported, due to lack of advisory locking mechanisms on other +platforms. Using sessions without locks can cause all sorts of +problems, especially with heavy usage of AJAX, and we will not +support such cases. Use session_write_close() after you’ve +done processing session data if you’re having performance +issues.

    +
    +
    +
    +

    Redis Driver

    +
    +

    Note

    +

    Since Redis doesn’t have a locking mechanism exposed, locks for +this driver are emulated by a separate value that is kept for up +to 300 seconds.

    +
    +

    Redis is a storage engine typically used for caching and popular because +of its high performance, which is also probably your reason to use the +‘redis’ session driver.

    +

    The downside is that it is not as ubiquitous as relational databases and +requires the phpredis PHP +extension to be installed on your system, and that one doesn’t come +bundled with PHP. +Chances are, you’re only be using the ‘redis’ driver only if you’re already +both familiar with Redis and using it for other purposes.

    +

    Just as with the ‘files’ and ‘database’ drivers, you must also configure +the storage location for your sessions via the +$config['sess_save_path'] setting. +The format here is a bit different and complicated at the same time. It is +best explained by the phpredis extension’s README file, so we’ll simply +link you to it:

    +
    +
    +
    +

    Warning

    +

    CodeIgniter’s Session library does NOT use the actual ‘redis’ +session.save_handler. Take note only of the path format in +the link above.

    +
    +

    For the most common case however, a simple host:port pair should be +sufficient:

    +
    $config['sess_driver'] = 'redis';
    +$config['sess_save_path'] = 'tcp://localhost:6379';
    +
    +
    +
    +
    +

    Memcached Driver

    +
    +

    Note

    +

    Since Memcache doesn’t have a locking mechanism exposed, locks +for this driver are emulated by a separate value that is kept for +up to 300 seconds.

    +
    +

    The ‘memcached’ driver is very similar to the ‘redis’ one in all of its +properties, except perhaps for availability, because PHP’s Memcached extension is distributed via PECL and some +Linux distrubutions make it available as an easy to install package.

    +

    Other than that, and without any intentional bias towards Redis, there’s +not much different to be said about Memcached - it is also a popular +product that is usually used for caching and famed for its speed.

    +

    However, it is worth noting that the only guarantee given by Memcached +is that setting value X to expire after Y seconds will result in it being +deleted after Y seconds have passed (but not necessarily that it won’t +expire earlier than that time). This happens very rarely, but should be +considered as it may result in loss of sessions.

    +

    The $config['sess_save_path'] format is fairly straightforward here, +being just a host:port pair:

    +
    $config['sess_driver'] = 'memcached';
    +$config['sess_save_path'] = 'localhost:11211';
    +
    +
    +
    +
    Bonus Tip
    +

    Multi-server configuration with an optional weight parameter as the +third colon-separated (:weight) value is also supported, but we have +to note that we haven’t tested if that is reliable.

    +

    If you want to experiment with this feature (on your own risk), simply +separate the multiple server paths with commas:

    +
    // localhost will be given higher priority (5) here,
    +// compared to 192.0.2.1 with a weight of 1.
    +$config['sess_save_path'] = 'localhost:11211:5,192.0.2.1:11211:1';
    +
    +
    +
    +
    +
    +

    Custom Drivers

    +

    You may also create your own, custom session drivers. However, have it in +mind that this is typically not an easy task, as it takes a lot of +knowledge to do it properly.

    +

    You need to know not only how sessions work in general, but also how they +work specifically in PHP, how the underlying storage mechanism works, how +to handle concurrency, avoid deadlocks (but NOT through lack of locks) and +last but not least - how to handle the potential security issues, which +is far from trivial.

    +

    Long story short - if you don’t know how to do that already in raw PHP, +you shouldn’t be trying to do it within CodeIgniter either. You’ve been +warned.

    +

    If you only want to add some extra functionality to your sessions, just +extend the base Session class, which is a lot more easier. Read the +Creating Libraries article to +learn how to do that.

    +

    Now, to the point - there are three general rules that you must follow +when creating a session driver for CodeIgniter:

    +
    +
      +
    • Put your driver’s file under application/libraries/Session/drivers/ +and follow the naming conventions used by the Session class.

      +

      For example, if you were to create a ‘dummy’ driver, you would have +a Session_dummy_driver class name, that is declared in +application/libraries/Session/drivers/Session_dummy_driver.php.

      +
    • +
    • Extend the CI_Session_driver class.

      +

      This is just a basic class with a few internal helper methods. It is +also extendable like any other library, if you really need to do that, +but we are not going to explain how … if you’re familiar with how +class extensions/overrides work in CI, then you already know how to do +it. If not, well, you shouldn’t be doing it in the first place.

      +
    • +
    • Implement the SessionHandlerInterface interface.

      +
      +

      Note

      +

      You may notice that SessionHandlerInterface is provided +by PHP since version 5.4.0. CodeIgniter will automatically declare +the same interface if you’re running an older PHP version.

      +
      +

      The link will explain why and how.

      +
    • +
    +
    +

    So, based on our ‘dummy’ driver example above, you’d end up with something +like this:

    +
    // application/libraries/Session/drivers/Session_dummy_driver.php:
    +
    +class CI_Session_dummy_driver extends CI_Session_driver implements SessionHandlerInterface
    +{
    +
    +        public function __construct(&$params)
    +        {
    +                // DO NOT forget this
    +                parent::__construct($params);
    +
    +                // Configuration & other initializations
    +        }
    +
    +        public function open($save_path, $name)
    +        {
    +                // Initialize storage mechanism (connection)
    +        }
    +
    +        public function read($session_id)
    +        {
    +                // Read session data (if exists), acquire locks
    +        }
    +
    +        public function write($session_id, $session_data)
    +        {
    +                // Create / update session data (it might not exist!)
    +        }
    +
    +        public function close()
    +        {
    +                // Free locks, close connections / streams / etc.
    +        }
    +
    +        public function destroy($session_id)
    +        {
    +                // Call close() method & destroy data for current session (order may differ)
    +        }
    +
    +        public function gc($maxlifetime)
    +        {
    +                // Erase data for expired sessions
    +        }
    +
    +}
    +
    +
    +

    If you’ve done everything properly, you can now set your sess_driver +configuration value to ‘dummy’ and use your own driver. Congratulations!

    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Session
    +
    +
    +userdata([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Session item key or NULL
    • +
    +
    Returns:

    Value of the specified item key, or an array of all userdata

    +
    Return type:

    mixed

    +
    +

    Gets the value for a specific $_SESSION item, or an +array of all “userdata” items if not key was specified.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. You should +directly access $_SESSION instead.

    +
    +
    + +
    +
    +all_userdata()
    +
    +++ + + + + + +
    Returns:An array of all userdata
    Return type:array
    +

    Returns an array containing all “userdata” items.

    +
    +

    Note

    +

    This method is DEPRECATED. Use userdata() +with no parameters instead.

    +
    +
    + +
    +
    +&get_userdata()
    +
    +++ + + + + + +
    Returns:A reference to $_SESSION
    Return type:array
    +

    Returns a reference to the $_SESSION array.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications.

    +
    +
    + +
    +
    +has_userdata($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Session item key
    • +
    +
    Returns:

    TRUE if the specified key exists, FALSE if not

    +
    Return type:

    bool

    +
    +

    Checks if an item exists in $_SESSION.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. It is just +an alias for isset($_SESSION[$key]) - please +use that instead.

    +
    +
    + +
    +
    +set_userdata($data[, $value = NULL])
    +
    +++ + + + + + +
    Parameters:
      +
    • $data (mixed) – An array of key/value pairs to set as session data, or the key for a single item
    • +
    • $value (mixed) – The value to set for a specific session item, if $data is a key
    • +
    +
    Return type:

    void

    +
    +

    Assigns data to the $_SESSION superglobal.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications.

    +
    +
    + +
    +
    +unset_userdata($key)
    +
    +++ + + + + + +
    Parameters:
      +
    • $key (mixed) – Key for the session data item to unset, or an array of multiple keys
    • +
    +
    Return type:

    void

    +
    +

    Unsets the specified key(s) from the $_SESSION +superglobal.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. It is just +an alias for unset($_SESSION[$key]) - please +use that instead.

    +
    +
    + +
    +
    +mark_as_flash($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Key to mark as flashdata, or an array of multiple keys
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Marks a $_SESSION item key (or multiple ones) as +“flashdata”.

    +
    + +
    +
    +get_flash_keys()
    +
    +++ + + + + + +
    Returns:Array containing the keys of all “flashdata” items.
    Return type:array
    +

    Gets a list of all $_SESSION that have been marked as +“flashdata”.

    +
    + +
    +
    +unmark_flash($key)
    +
    +++ + + + + + +
    Parameters:
      +
    • $key (mixed) – Key to be un-marked as flashdata, or an array of multiple keys
    • +
    +
    Return type:

    void

    +
    +

    Unmarks a $_SESSION item key (or multiple ones) as +“flashdata”.

    +
    + +
    +
    +flashdata([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Flashdata item key or NULL
    • +
    +
    Returns:

    Value of the specified item key, or an array of all flashdata

    +
    Return type:

    mixed

    +
    +

    Gets the value for a specific $_SESSION item that has +been marked as “flashdata”, or an array of all “flashdata” +items if no key was specified.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. You should +directly access $_SESSION instead.

    +
    +
    + +
    +
    +keep_flashdata($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Flashdata key to keep, or an array of multiple keys
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Retains the specified session data key(s) as “flashdata” +through the next request.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. It is just +an alias for the mark_as_flash() method.

    +
    +
    + +
    +
    +set_flashdata($data[, $value = NULL])
    +
    +++ + + + + + +
    Parameters:
      +
    • $data (mixed) – An array of key/value pairs to set as flashdata, or the key for a single item
    • +
    • $value (mixed) – The value to set for a specific session item, if $data is a key
    • +
    +
    Return type:

    void

    +
    +

    Assigns data to the $_SESSION superglobal and marks it +as “flashdata”.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications.

    +
    +
    + +
    +
    +mark_as_temp($key[, $ttl = 300])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Key to mark as tempdata, or an array of multiple keys
    • +
    • $ttl (int) – Time-to-live value for the tempdata, in seconds
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Marks a $_SESSION item key (or multiple ones) as +“tempdata”.

    +
    + +
    +
    +get_temp_keys()
    +
    +++ + + + + + +
    Returns:Array containing the keys of all “tempdata” items.
    Return type:array
    +

    Gets a list of all $_SESSION that have been marked as +“tempdata”.

    +
    + +
    +
    +unmark_temp($key)
    +
    +++ + + + + + +
    Parameters:
      +
    • $key (mixed) – Key to be un-marked as tempdata, or an array of multiple keys
    • +
    +
    Return type:

    void

    +
    +

    Unmarks a $_SESSION item key (or multiple ones) as +“tempdata”.

    +
    + +
    +
    +tempdata([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (mixed) – Tempdata item key or NULL
    • +
    +
    Returns:

    Value of the specified item key, or an array of all tempdata

    +
    Return type:

    mixed

    +
    +

    Gets the value for a specific $_SESSION item that has +been marked as “tempdata”, or an array of all “tempdata” +items if no key was specified.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications. You should +directly access $_SESSION instead.

    +
    +
    + +
    +
    +set_tempdata($data[, $value = NULL])
    +
    +++ + + + + + +
    Parameters:
      +
    • $data (mixed) – An array of key/value pairs to set as tempdata, or the key for a single item
    • +
    • $value (mixed) – The value to set for a specific session item, if $data is a key
    • +
    • $ttl (int) – Time-to-live value for the tempdata item(s), in seconds
    • +
    +
    Return type:

    void

    +
    +

    Assigns data to the $_SESSION superglobal and marks it +as “tempdata”.

    +
    +

    Note

    +

    This is a legacy method kept only for backwards +compatibility with older applications.

    +
    +
    + +
    +
    +sess_regenerate([$destroy = FALSE])
    +
    +++ + + + + + +
    Parameters:
      +
    • $destroy (bool) – Whether to destroy session data
    • +
    +
    Return type:

    void

    +
    +

    Regenerate session ID, optionally destroying the current +session’s data.

    +
    +

    Note

    +

    This method is just an alias for PHP’s native +session_regenerate_id() function.

    +
    +
    + +
    +
    +sess_destroy()
    +
    +++ + + + +
    Return type:void
    +

    Destroys the current session.

    +
    +

    Note

    +

    This must be the last session-related function +that you call. All session data will be lost after +you do that.

    +
    +
    +

    Note

    +

    This method is just an alias for PHP’s native +session_destroy() function.

    +
    +
    + +
    +
    +__get($key)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Session item key
    • +
    +
    Returns:

    The requested session data item, or NULL if it doesn’t exist

    +
    Return type:

    mixed

    +
    +

    A magic method that allows you to use +$this->session->item instead of $_SESSION['item'], +if that’s what you prefer.

    +

    It will also return the session ID by calling +session_id() if you try to access +$this->session->session_id.

    +
    + +
    +
    +__set($key, $value)
    +
    +++ + + + + + +
    Parameters:
      +
    • $key (string) – Session item key
    • +
    • $value (mixed) – Value to assign to the session item key
    • +
    +
    Returns:

    void

    +
    +

    A magic method that allows you to assign items to +$_SESSION by accessing them as $this->session +properties:

    +
    $this->session->foo = 'bar';
    +
    +// Results in:
    +// $_SESSION['foo'] = 'bar';
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html new file mode 100755 index 0000000..21f148c --- /dev/null +++ b/user_guide/libraries/table.html @@ -0,0 +1,911 @@ + + + + + + + + + + HTML Table Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    HTML Table Class

    +

    The Table Class provides functions that enable you to auto-generate HTML +tables from arrays or database result sets.

    + +
    +

    Using the Table Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Table class is initialized +in your controller using the $this->load->library() method:

    +
    $this->load->library('table');
    +
    +
    +

    Once loaded, the Table library object will be available using:

    +
    $this->table
    +
    +
    +
    +
    +

    Examples

    +

    Here is an example showing how you can create a table from a +multi-dimensional array. Note that the first array index will become the +table heading (or you can set your own headings using the set_heading() +method described in the function reference below).

    +
    $this->load->library('table');
    +
    +$data = array(
    +        array('Name', 'Color', 'Size'),
    +        array('Fred', 'Blue', 'Small'),
    +        array('Mary', 'Red', 'Large'),
    +        array('John', 'Green', 'Medium')
    +);
    +
    +echo $this->table->generate($data);
    +
    +
    +

    Here is an example of a table created from a database query result. The +table class will automatically generate the headings based on the table +names (or you can set your own headings using the set_heading() +method described in the class reference below).

    +
    $this->load->library('table');
    +
    +$query = $this->db->query('SELECT * FROM my_table');
    +
    +echo $this->table->generate($query);
    +
    +
    +

    Here is an example showing how you might create a table using discrete +parameters:

    +
    $this->load->library('table');
    +
    +$this->table->set_heading('Name', 'Color', 'Size');
    +
    +$this->table->add_row('Fred', 'Blue', 'Small');
    +$this->table->add_row('Mary', 'Red', 'Large');
    +$this->table->add_row('John', 'Green', 'Medium');
    +
    +echo $this->table->generate();
    +
    +
    +

    Here is the same example, except instead of individual parameters, +arrays are used:

    +
    $this->load->library('table');
    +
    +$this->table->set_heading(array('Name', 'Color', 'Size'));
    +
    +$this->table->add_row(array('Fred', 'Blue', 'Small'));
    +$this->table->add_row(array('Mary', 'Red', 'Large'));
    +$this->table->add_row(array('John', 'Green', 'Medium'));
    +
    +echo $this->table->generate();
    +
    +
    +
    +
    +

    Changing the Look of Your Table

    +

    The Table Class permits you to set a table template with which you can +specify the design of your layout. Here is the template prototype:

    +
    $template = array(
    +        'table_open'            => '<table border="0" cellpadding="4" cellspacing="0">',
    +
    +        'thead_open'            => '<thead>',
    +        'thead_close'           => '</thead>',
    +
    +        'heading_row_start'     => '<tr>',
    +        'heading_row_end'       => '</tr>',
    +        'heading_cell_start'    => '<th>',
    +        'heading_cell_end'      => '</th>',
    +
    +        'tbody_open'            => '<tbody>',
    +        'tbody_close'           => '</tbody>',
    +
    +        'row_start'             => '<tr>',
    +        'row_end'               => '</tr>',
    +        'cell_start'            => '<td>',
    +        'cell_end'              => '</td>',
    +
    +        'row_alt_start'         => '<tr>',
    +        'row_alt_end'           => '</tr>',
    +        'cell_alt_start'        => '<td>',
    +        'cell_alt_end'          => '</td>',
    +
    +        'table_close'           => '</table>'
    +);
    +
    +$this->table->set_template($template);
    +
    +
    +
    +

    Note

    +

    You’ll notice there are two sets of “row” blocks in the +template. These permit you to create alternating row colors or design +elements that alternate with each iteration of the row data.

    +
    +

    You are NOT required to submit a complete template. If you only need to +change parts of the layout you can simply submit those elements. In this +example, only the table opening tag is being changed:

    +
    $template = array(
    +        'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">'
    +);
    +
    +$this->table->set_template($template);
    +
    +
    +

    You can also set defaults for these in a config file.

    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Table
    +
    +
    +$function = NULL
    +

    Allows you to specify a native PHP function or a valid function array object to be applied to all cell data.

    +
    $this->load->library('table');
    +
    +$this->table->set_heading('Name', 'Color', 'Size');
    +$this->table->add_row('Fred', '<strong>Blue</strong>', 'Small');
    +
    +$this->table->function = 'htmlspecialchars';
    +echo $this->table->generate();
    +
    +
    +

    In the above example, all cell data would be ran through PHP’s htmlspecialchars() function, resulting in:

    +
    <td>Fred</td><td>&lt;strong&gt;Blue&lt;/strong&gt;</td><td>Small</td>
    +
    +
    +
    + +
    +
    +generate([$table_data = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $table_data (mixed) – Data to populate the table rows with
    • +
    +
    Returns:

    HTML table

    +
    Return type:

    string

    +
    +

    Returns a string containing the generated table. Accepts an optional parameter which can be an array or a database result object.

    +
    + +
    +
    +set_caption($caption)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $caption (string) – Table caption
    • +
    +
    Returns:

    CI_Table instance (method chaining)

    +
    Return type:

    CI_Table

    +
    +

    Permits you to add a caption to the table.

    +
    $this->table->set_caption('Colors');
    +
    +
    +
    + +
    +
    +set_heading([$args = array()[, ...]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $args (mixed) – An array or multiple strings containing the table column titles
    • +
    +
    Returns:

    CI_Table instance (method chaining)

    +
    Return type:

    CI_Table

    +
    +

    Permits you to set the table heading. You can submit an array or discrete params:

    +
    $this->table->set_heading('Name', 'Color', 'Size');
    +
    +$this->table->set_heading(array('Name', 'Color', 'Size'));
    +
    +
    +
    + +
    +
    +add_row([$args = array()[, ...]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $args (mixed) – An array or multiple strings containing the row values
    • +
    +
    Returns:

    CI_Table instance (method chaining)

    +
    Return type:

    CI_Table

    +
    +

    Permits you to add a row to your table. You can submit an array or discrete params:

    +
    $this->table->add_row('Blue', 'Red', 'Green');
    +
    +$this->table->add_row(array('Blue', 'Red', 'Green'));
    +
    +
    +

    If you would like to set an individual cell’s tag attributes, you can use an associative array for that cell. +The associative key data defines the cell’s data. Any other key => val pairs are added as key=’val’ attributes to the tag:

    +
    $cell = array('data' => 'Blue', 'class' => 'highlight', 'colspan' => 2);
    +$this->table->add_row($cell, 'Red', 'Green');
    +
    +// generates
    +// <td class='highlight' colspan='2'>Blue</td><td>Red</td><td>Green</td>
    +
    +
    +
    + +
    +
    +make_columns([$array = array()[, $col_limit = 0]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $array (array) – An array containing multiple rows’ data
    • +
    • $col_limit (int) – Count of columns in the table
    • +
    +
    Returns:

    An array of HTML table columns

    +
    Return type:

    array

    +
    +

    This method takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns desired. +This allows a single array with many elements to be displayed in a table that has a fixed column count. Consider this example:

    +
    $list = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve');
    +
    +$new_list = $this->table->make_columns($list, 3);
    +
    +$this->table->generate($new_list);
    +
    +// Generates a table with this prototype
    +
    +<table border="0" cellpadding="4" cellspacing="0">
    +<tr>
    +<td>one</td><td>two</td><td>three</td>
    +</tr><tr>
    +<td>four</td><td>five</td><td>six</td>
    +</tr><tr>
    +<td>seven</td><td>eight</td><td>nine</td>
    +</tr><tr>
    +<td>ten</td><td>eleven</td><td>twelve</td></tr>
    +</table>
    +
    +
    +
    + +
    +
    +set_template($template)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $template (array) – An associative array containing template values
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Permits you to set your template. You can submit a full or partial template.

    +
    $template = array(
    +        'table_open'  => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">'
    +);
    +
    +$this->table->set_template($template);
    +
    +
    +
    + +
    +
    +set_empty($value)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $value (mixed) – Value to put in empty cells
    • +
    +
    Returns:

    CI_Table instance (method chaining)

    +
    Return type:

    CI_Table

    +
    +

    Lets you set a default value for use in any table cells that are empty. +You might, for example, set a non-breaking space:

    +
    $this->table->set_empty("&nbsp;");
    +
    +
    +
    + +
    +
    +clear()
    +
    +++ + + + + + +
    Returns:CI_Table instance (method chaining)
    Return type:CI_Table
    +

    Lets you clear the table heading and row data. If you need to show multiple tables with different data you should to call this method +after each table has been generated to clear the previous table information. Example:

    +
    $this->load->library('table');
    +
    +$this->table->set_heading('Name', 'Color', 'Size');
    +$this->table->add_row('Fred', 'Blue', 'Small');
    +$this->table->add_row('Mary', 'Red', 'Large');
    +$this->table->add_row('John', 'Green', 'Medium');
    +
    +echo $this->table->generate();
    +
    +$this->table->clear();
    +
    +$this->table->set_heading('Name', 'Day', 'Delivery');
    +$this->table->add_row('Fred', 'Wednesday', 'Express');
    +$this->table->add_row('Mary', 'Monday', 'Air');
    +$this->table->add_row('John', 'Saturday', 'Overnight');
    +
    +echo $this->table->generate();
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html new file mode 100755 index 0000000..86c0972 --- /dev/null +++ b/user_guide/libraries/trackback.html @@ -0,0 +1,1035 @@ + + + + + + + + + + Trackback Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Trackback Class

    +

    The Trackback Class provides functions that enable you to send and +receive Trackback data.

    +

    If you are not familiar with Trackbacks you’ll find more information +here.

    + +
    +

    Using the Trackback Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Trackback class is +initialized in your controller using the $this->load->library() method:

    +
    $this->load->library('trackback');
    +
    +
    +

    Once loaded, the Trackback library object will be available using:

    +
    $this->trackback
    +
    +
    +
    +
    +

    Sending Trackbacks

    +

    A Trackback can be sent from any of your controller functions using code +similar to this example:

    +
    $this->load->library('trackback');
    +
    +$tb_data = array(
    +        'ping_url'  => 'http://example.com/trackback/456',
    +        'url'       => 'http://www.my-example.com/blog/entry/123',
    +        'title'     => 'The Title of My Entry',
    +        'excerpt'   => 'The entry content.',
    +        'blog_name' => 'My Blog Name',
    +        'charset'   => 'utf-8'
    +);
    +
    +if ( ! $this->trackback->send($tb_data))
    +{
    +        echo $this->trackback->display_errors();
    +}
    +else
    +{
    +        echo 'Trackback was sent!';
    +}
    +
    +
    +

    Description of array data:

    +
      +
    • ping_url - The URL of the site you are sending the Trackback to. +You can send Trackbacks to multiple URLs by separating each URL with a comma.
    • +
    • url - The URL to YOUR site where the weblog entry can be seen.
    • +
    • title - The title of your weblog entry.
    • +
    • excerpt - The content of your weblog entry.
    • +
    • blog_name - The name of your weblog.
    • +
    • charset - The character encoding your weblog is written in. If omitted, UTF-8 will be used.
    • +
    +
    +

    Note

    +

    The Trackback class will automatically send only the first 500 characters of your +entry. It will also strip all HTML.

    +
    +

    The Trackback sending method returns TRUE/FALSE (boolean) on success +or failure. If it fails, you can retrieve the error message using:

    +
    $this->trackback->display_errors();
    +
    +
    +
    +
    +

    Receiving Trackbacks

    +

    Before you can receive Trackbacks you must create a weblog. If you don’t +have a blog yet there’s no point in continuing.

    +

    Receiving Trackbacks is a little more complex than sending them, only +because you will need a database table in which to store them, and you +will need to validate the incoming trackback data. You are encouraged to +implement a thorough validation process to guard against spam and +duplicate data. You may also want to limit the number of Trackbacks you +allow from a particular IP within a given span of time to further +curtail spam. The process of receiving a Trackback is quite simple; the +validation is what takes most of the effort.

    +
    +
    +

    Your Ping URL

    +

    In order to accept Trackbacks you must display a Trackback URL next to +each one of your weblog entries. This will be the URL that people will +use to send you Trackbacks (we will refer to this as your “Ping URL”).

    +

    Your Ping URL must point to a controller function where your Trackback +receiving code is located, and the URL must contain the ID number for +each particular entry, so that when the Trackback is received you’ll be +able to associate it with a particular entry.

    +

    For example, if your controller class is called Trackback, and the +receiving function is called receive, your Ping URLs will look something +like this:

    +
    http://example.com/index.php/trackback/receive/entry_id
    +
    +
    +

    Where entry_id represents the individual ID number for each of your +entries.

    +
    +
    +

    Creating a Trackback Table

    +

    Before you can receive Trackbacks you must create a table in which to +store them. Here is a basic prototype for such a table:

    +
    CREATE TABLE trackbacks (
    +        tb_id int(10) unsigned NOT NULL auto_increment,
    +        entry_id int(10) unsigned NOT NULL default 0,
    +        url varchar(200) NOT NULL,
    +        title varchar(100) NOT NULL,
    +        excerpt text NOT NULL,
    +        blog_name varchar(100) NOT NULL,
    +        tb_date int(10) NOT NULL,
    +        ip_address varchar(45) NOT NULL,
    +        PRIMARY KEY `tb_id` (`tb_id`),
    +        KEY `entry_id` (`entry_id`)
    +);
    +
    +
    +

    The Trackback specification only requires four pieces of information to +be sent in a Trackback (url, title, excerpt, blog_name), but to make +the data more useful we’ve added a few more fields in the above table +schema (date, IP address, etc.).

    +
    +
    +

    Processing a Trackback

    +

    Here is an example showing how you will receive and process a Trackback. +The following code is intended for use within the controller function +where you expect to receive Trackbacks.:

    +
    $this->load->library('trackback');
    +$this->load->database();
    +
    +if ($this->uri->segment(3) == FALSE)
    +{
    +        $this->trackback->send_error('Unable to determine the entry ID');
    +}
    +
    +if ( ! $this->trackback->receive())
    +{
    +        $this->trackback->send_error('The Trackback did not contain valid data');
    +}
    +
    +$data = array(
    +        'tb_id'      => '',
    +        'entry_id'   => $this->uri->segment(3),
    +        'url'        => $this->trackback->data('url'),
    +        'title'      => $this->trackback->data('title'),
    +        'excerpt'    => $this->trackback->data('excerpt'),
    +        'blog_name'  => $this->trackback->data('blog_name'),
    +        'tb_date'    => time(),
    +        'ip_address' => $this->input->ip_address()
    +);
    +
    +$sql = $this->db->insert_string('trackbacks', $data);
    +$this->db->query($sql);
    +
    +$this->trackback->send_success();
    +
    +
    +
    +

    Notes:

    +

    The entry ID number is expected in the third segment of your URL. This +is based on the URI example we gave earlier:

    +
    http://example.com/index.php/trackback/receive/entry_id
    +
    +
    +

    Notice the entry_id is in the third URI segment, which you can retrieve +using:

    +
    $this->uri->segment(3);
    +
    +
    +

    In our Trackback receiving code above, if the third segment is missing, +we will issue an error. Without a valid entry ID, there’s no reason to +continue.

    +

    The $this->trackback->receive() function is simply a validation function +that looks at the incoming data and makes sure it contains the four +pieces of data that are required (url, title, excerpt, blog_name). It +returns TRUE on success and FALSE on failure. If it fails you will issue +an error message.

    +

    The incoming Trackback data can be retrieved using this function:

    +
    $this->trackback->data('item')
    +
    +
    +

    Where item represents one of these four pieces of info: url, title, +excerpt, or blog_name

    +

    If the Trackback data is successfully received, you will issue a success +message using:

    +
    $this->trackback->send_success();
    +
    +
    +
    +

    Note

    +

    The above code contains no data validation, which you are +encouraged to add.

    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Trackback
    +
    +
    +$data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => '')
    +

    Trackback data array.

    +
    + +
    +
    +$convert_ascii = TRUE
    +

    Whether to convert high ASCII and MS Word characters to HTML entities.

    +
    + +
    +
    +send($tb_data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $tb_data (array) – Trackback data
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Send trackback.

    +
    + +
    +
    +receive()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    This method simply validates the incoming TB data, returning TRUE on success and FALSE on failure. +If the data is valid it is set to the $this->data array so that it can be inserted into a database.

    +
    + +
    +
    +send_error([$message = 'Incomplete information'])
    +
    +++ + + + + + +
    Parameters:
      +
    • $message (string) – Error message
    • +
    +
    Return type:

    void

    +
    +

    Responses to a trackback request with an error message.

    +
    +

    Note

    +

    This method will terminate script execution.

    +
    +
    + +
    +
    +send_success()
    +
    +++ + + + +
    Return type:void
    +

    Responses to a trackback request with a success message.

    +
    +

    Note

    +

    This method will terminate script execution.

    +
    +
    + +
    +
    +data($item)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $item (string) – Data key
    • +
    +
    Returns:

    Data value or empty string if not found

    +
    Return type:

    string

    +
    +

    Returns a single item from the response data array.

    +
    + +
    +
    +process($url, $data)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $url (string) – Target url
    • +
    • $data (string) – Raw POST data
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Opens a socket connection and passes the data to the server, returning TRUE on success and FALSE on failure.

    +
    + +
    +
    +extract_urls($urls)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $urls (string) – Comma-separated URL list
    • +
    +
    Returns:

    Array of URLs

    +
    Return type:

    array

    +
    +

    This method lets multiple trackbacks to be sent. It takes a string of URLs (separated by comma or space) and puts each URL into an array.

    +
    + +
    +
    +validate_url(&$url)
    +
    +++ + + + + + +
    Parameters:
      +
    • $url (string) – Trackback URL
    • +
    +
    Return type:

    void

    +
    +

    Simply adds the http:// prefix it it’s not already present in the URL.

    +
    + +
    +
    +get_id($url)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $url (string) – Trackback URL
    • +
    +
    Returns:

    URL ID or FALSE on failure

    +
    Return type:

    string

    +
    +

    Find and return a trackback URL’s ID or FALSE on failure.

    +
    + +
    +
    +convert_xml($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Converted string

    +
    Return type:

    string

    +
    +

    Converts reserved XML characters to entities.

    +
    + +
    +
    +limit_characters($str[, $n = 500[, $end_char = '&#8230;']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $n (int) – Max characters number
    • +
    • $end_char (string) – Character to put at end of string
    • +
    +
    Returns:

    Shortened string

    +
    Return type:

    string

    +
    +

    Limits the string based on the character count. Will preserve complete words.

    +
    + +
    +
    +convert_ascii($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Converted string

    +
    Return type:

    string

    +
    +

    Converts high ASCII text and MS Word special characterss to HTML entities.

    +
    + +
    +
    +set_error($msg)
    +
    +++ + + + + + +
    Parameters:
      +
    • $msg (string) – Error message
    • +
    +
    Return type:

    void

    +
    +

    Set an log an error message.

    +
    + +
    +
    +display_errors([$open = '<p>'[, $close = '</p>']])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $open (string) – Open tag
    • +
    • $close (string) – Close tag
    • +
    +
    Returns:

    HTML formatted error messages

    +
    Return type:

    string

    +
    +

    Returns error messages formatted in HTML or an empty string if there are no errors.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html new file mode 100755 index 0000000..04cac75 --- /dev/null +++ b/user_guide/libraries/typography.html @@ -0,0 +1,657 @@ + + + + + + + + + + Typography Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Typography Class

    +

    The Typography Class provides methods that help you format text.

    + +
    +

    Using the Typography Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Typography class is +initialized in your controller using the $this->load->library() method:

    +
    $this->load->library('typography');
    +
    +
    +

    Once loaded, the Typography library object will be available using:

    +
    $this->typography
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Typography
    +
    +
    +$protect_braced_quotes = FALSE
    +

    When using the Typography library in conjunction with the Template Parser library +it can often be desirable to protect single and double quotes within curly braces. +To enable this, set the protect_braced_quotes class property to TRUE.

    +

    Usage example:

    +
    $this->load->library('typography');
    +$this->typography->protect_braced_quotes = TRUE;
    +
    +
    +
    + +
    +
    +auto_typography($str[, $reduce_linebreaks = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    • $reduce_linebreaks (bool) – Whether to reduce consequitive linebreaks
    • +
    +
    Returns:

    HTML typography-safe string

    +
    Return type:

    string

    +
    +

    Formats text so that it is semantically and typographically correct HTML. +Takes a string as input and returns it with the following formatting:

    +
    +
      +
    • Surrounds paragraphs within <p></p> (looks for double line breaks to identify paragraphs).
    • +
    • Single line breaks are converted to <br />, except those that appear within <pre> tags.
    • +
    • Block level elements, like <div> tags, are not wrapped within paragraphs, but their contained text is if it contains paragraphs.
    • +
    • Quotes are converted to correctly facing curly quote entities, except those that appear within tags.
    • +
    • Apostrophes are converted to curly apostrophe entities.
    • +
    • Double dashes (either like – this or like–this) are converted to em—dashes.
    • +
    • Three consecutive periods either preceding or following a word are converted to ellipsis (…).
    • +
    • Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.
    • +
    +
    +

    Usage example:

    +
    $string = $this->typography->auto_typography($string);
    +
    +
    +

    There is one optional parameter that determines whether the parser should reduce more than two consecutive line breaks down to two. +Pass boolean TRUE to enable reducing line breaks:

    +
    $string = $this->typography->auto_typography($string, TRUE);
    +
    +
    +
    +

    Note

    +

    Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted. +If you choose to use this method you may want to consider caching your pages.

    +
    +
    + +
    +
    +format_characters($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Formatted string

    +
    Return type:

    string

    +
    +

    This method is similar to auto_typography() above, except that it only does character conversion:

    +
    +
      +
    • Quotes are converted to correctly facing curly quote entities, except those that appear within tags.
    • +
    • Apostrophes are converted to curly apostrophe entities.
    • +
    • Double dashes (either like – this or like–this) are converted to em—dashes.
    • +
    • Three consecutive periods either preceding or following a word are converted to ellipsis (…).
    • +
    • Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.
    • +
    +
    +

    Usage example:

    +
    $string = $this->typography->format_characters($string);
    +
    +
    +
    + +
    +
    +nl2br_except_pre($str)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $str (string) – Input string
    • +
    +
    Returns:

    Formatted string

    +
    Return type:

    string

    +
    +

    Converts newlines to <br /> tags unless they appear within <pre> tags. +This method is identical to the native PHP nl2br() function, except that it ignores <pre> tags.

    +

    Usage example:

    +
    $string = $this->typography->nl2br_except_pre($string);
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html new file mode 100755 index 0000000..6bde795 --- /dev/null +++ b/user_guide/libraries/unit_testing.html @@ -0,0 +1,846 @@ + + + + + + + + + + Unit Testing Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Unit Testing Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Unit Testing Class

    +

    Unit testing is an approach to software development in which tests are +written for each function in your application. If you are not familiar +with the concept you might do a little googling on the subject.

    +

    CodeIgniter’s Unit Test class is quite simple, consisting of an +evaluation function and two result functions. It’s not intended to be a +full-blown test suite but rather a simple mechanism to evaluate your +code to determine if it is producing the correct data type and result.

    + +
    +

    Using the Unit Testing Library

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Unit Test class is +initialized in your controller using the $this->load->library function:

    +
    $this->load->library('unit_test');
    +
    +
    +

    Once loaded, the Unit Test object will be available using $this->unit

    +
    +
    +

    Running Tests

    +

    Running a test involves supplying a test and an expected result in the +following way:

    +
    +
    $this->unit->run(‘test’, ‘expected result’, ‘test name’, ‘notes’);
    +

    Where test is the result of the code you wish to test, expected result +is the data type you expect, test name is an optional name you can give +your test, and notes are optional notes. Example:

    +
    $test = 1 + 1;
    +
    +$expected_result = 2;
    +
    +$test_name = 'Adds one plus one';
    +
    +$this->unit->run($test, $expected_result, $test_name);
    +
    +
    +

    The expected result you supply can either be a literal match, or a data +type match. Here’s an example of a literal:

    +
    $this->unit->run('Foo', 'Foo');
    +
    +
    +

    Here is an example of a data type match:

    +
    $this->unit->run('Foo', 'is_string');
    +
    +
    +

    Notice the use of “is_string” in the second parameter? This tells the +function to evaluate whether your test is producing a string as the +result. Here is a list of allowed comparison types:

    +
      +
    • is_object
    • +
    • is_string
    • +
    • is_bool
    • +
    • is_true
    • +
    • is_false
    • +
    • is_int
    • +
    • is_numeric
    • +
    • is_float
    • +
    • is_double
    • +
    • is_array
    • +
    • is_null
    • +
    • is_resource
    • +
    +
    +
    +

    Generating Reports

    +

    You can either display results after each test, or your can run several +tests and generate a report at the end. To show a report directly simply +echo or return the run function:

    +
    echo $this->unit->run($test, $expected_result);
    +
    +
    +

    To run a full report of all tests, use this:

    +
    echo $this->unit->report();
    +
    +
    +

    The report will be formatted in an HTML table for viewing. If you prefer +the raw data you can retrieve an array using:

    +
    echo $this->unit->result();
    +
    +
    +
    +
    +

    Strict Mode

    +

    By default the unit test class evaluates literal matches loosely. +Consider this example:

    +
    $this->unit->run(1, TRUE);
    +
    +
    +

    The test is evaluating an integer, but the expected result is a boolean. +PHP, however, due to it’s loose data-typing will evaluate the above code +as TRUE using a normal equality test:

    +
    if (1 == TRUE) echo 'This evaluates as true';
    +
    +
    +

    If you prefer, you can put the unit test class in to strict mode, which +will compare the data type as well as the value:

    +
    if (1 === TRUE) echo 'This evaluates as FALSE';
    +
    +
    +

    To enable strict mode use this:

    +
    $this->unit->use_strict(TRUE);
    +
    +
    +
    +
    +

    Enabling/Disabling Unit Testing

    +

    If you would like to leave some testing in place in your scripts, but +not have it run unless you need it, you can disable unit testing using:

    +
    $this->unit->active(FALSE);
    +
    +
    +
    +
    +

    Unit Test Display

    +

    When your unit test results display, the following items show by +default:

    +
      +
    • Test Name (test_name)
    • +
    • Test Datatype (test_datatype)
    • +
    • Expected Datatype (res_datatype)
    • +
    • Result (result)
    • +
    • File Name (file)
    • +
    • Line Number (line)
    • +
    • Any notes you entered for the test (notes)
    • +
    +

    You can customize which of these items get displayed by using +$this->unit->set_test_items(). For example, if you only wanted the test name +and the result displayed:

    +
    +

    Customizing displayed tests

    +
    $this->unit->set_test_items(array('test_name', 'result'));
    +
    +
    +
    +
    +

    Creating a Template

    +

    If you would like your test results formatted differently then the +default you can set your own template. Here is an example of a simple +template. Note the required pseudo-variables:

    +
    $str = '
    +<table border="0" cellpadding="4" cellspacing="1">
    +{rows}
    +        <tr>
    +                <td>{item}</td>
    +                <td>{result}</td>
    +        </tr>
    +{/rows}
    +</table>';
    +
    +$this->unit->set_template($str);
    +
    +
    +
    +

    Note

    +

    Your template must be declared before running the unit +test process.

    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Unit_test
    +
    +
    +set_test_items($items)
    +
    +++ + + + + + +
    Parameters:
      +
    • $items (array) – List of visible test items
    • +
    +
    Returns:

    void

    +
    +

    Sets a list of items that should be visible in tests. +Valid options are:

    +
    +
      +
    • test_name
    • +
    • test_datatype
    • +
    • res_datatype
    • +
    • result
    • +
    • file
    • +
    • line
    • +
    • notes
    • +
    +
    +
    + +
    +
    +run($test[, $expected = TRUE[, $test_name = 'undefined'[, $notes = '']]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $test (mixed) – Test data
    • +
    • $expected (mixed) – Expected result
    • +
    • $test_name (string) – Test name
    • +
    • $notes (string) – Any notes to be attached to the test
    • +
    +
    Returns:

    Test report

    +
    Return type:

    string

    +
    +

    Runs unit tests.

    +
    + +
    +
    +report([$result = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $result (array) – Array containing tests results
    • +
    +
    Returns:

    Test report

    +
    Return type:

    string

    +
    +

    Generates a report about already complete tests.

    +
    + +
    +
    +use_strict([$state = TRUE])
    +
    +++ + + + + + +
    Parameters:
      +
    • $state (bool) – Strict state flag
    • +
    +
    Return type:

    void

    +
    +

    Enables/disables strict type comparison in tests.

    +
    + +
    +
    +active([$state = TRUE])
    +
    +++ + + + + + +
    Parameters:
      +
    • $state (bool) – Whether to enable testing
    • +
    +
    Return type:

    void

    +
    +

    Enables/disables unit testing.

    +
    + +
    +
    +result([$results = array()])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $results (array) – Tests results list
    • +
    +
    Returns:

    Array of raw result data

    +
    Return type:

    array

    +
    +

    Returns raw tests results data.

    +
    + +
    +
    +set_template($template)
    +
    +++ + + + + + +
    Parameters:
      +
    • $template (string) – Test result template
    • +
    +
    Return type:

    void

    +
    +

    Sets the template for displaying tests results.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html new file mode 100755 index 0000000..267334a --- /dev/null +++ b/user_guide/libraries/uri.html @@ -0,0 +1,890 @@ + + + + + + + + + + URI Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    URI Class

    +

    The URI Class provides methods that help you retrieve information from +your URI strings. If you use URI routing, you can also retrieve +information about the re-routed segments.

    +
    +

    Note

    +

    This class is initialized automatically by the system so there +is no need to do it manually.

    +
    + +
    +

    Class Reference

    +
    +
    +class CI_URI
    +
    +
    +segment($n[, $no_result = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $no_result (mixed) – What to return if the searched segment is not found
    • +
    +
    Returns:

    Segment value or $no_result value if not found

    +
    Return type:

    mixed

    +
    +

    Permits you to retrieve a specific segment. Where n is the segment +number you wish to retrieve. Segments are numbered from left to right. +For example, if your full URL is this:

    +
    http://example.com/index.php/news/local/metro/crime_is_up
    +
    +
    +

    The segment numbers would be this:

    +
      +
    1. news
    2. +
    3. local
    4. +
    5. metro
    6. +
    7. crime_is_up
    8. +
    +

    The optional second parameter defaults to NULL and allows you to set the return value +of this method when the requested URI segment is missing. +For example, this would tell the method to return the number zero in the event of failure:

    +
    $product_id = $this->uri->segment(3, 0);
    +
    +
    +

    It helps avoid having to write code like this:

    +
    if ($this->uri->segment(3) === FALSE)
    +{
    +        $product_id = 0;
    +}
    +else
    +{
    +        $product_id = $this->uri->segment(3);
    +}
    +
    +
    +
    + +
    +
    +rsegment($n[, $no_result = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $no_result (mixed) – What to return if the searched segment is not found
    • +
    +
    Returns:

    Routed segment value or $no_result value if not found

    +
    Return type:

    mixed

    +
    +

    This method is identical to segment(), except that it lets you retrieve +a specific segment from your re-routed URI in the event you are +using CodeIgniter’s URI Routing feature.

    +
    + +
    +
    +slash_segment($n[, $where = 'trailing'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $where (string) – Where to add the slash (‘trailing’ or ‘leading’)
    • +
    +
    Returns:

    Segment value, prepended/suffixed with a forward slash, or a slash if not found

    +
    Return type:

    string

    +
    +

    This method is almost identical to segment(), except it +adds a trailing and/or leading slash based on the second parameter. +If the parameter is not used, a trailing slash added. Examples:

    +
    $this->uri->slash_segment(3);
    +$this->uri->slash_segment(3, 'leading');
    +$this->uri->slash_segment(3, 'both');
    +
    +
    +

    Returns:

    +
      +
    1. segment/
    2. +
    3. /segment
    4. +
    5. /segment/
    6. +
    +
    + +
    +
    +slash_rsegment($n[, $where = 'trailing'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $where (string) – Where to add the slash (‘trailing’ or ‘leading’)
    • +
    +
    Returns:

    Routed segment value, prepended/suffixed with a forward slash, or a slash if not found

    +
    Return type:

    string

    +
    +

    This method is identical to slash_segment(), except that it lets you +add slashes a specific segment from your re-routed URI in the event you +are using CodeIgniter’s URI Routing +feature.

    +
    + +
    +
    +uri_to_assoc([$n = 3[, $default = array()]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $default (array) – Default values
    • +
    +
    Returns:

    Associative URI segments array

    +
    Return type:

    array

    +
    +

    This method lets you turn URI segments into an associative array of +key/value pairs. Consider this URI:

    +
    index.php/user/search/name/joe/location/UK/gender/male
    +
    +
    +

    Using this method you can turn the URI into an associative array with +this prototype:

    +
    [array]
    +(
    +        'name'          => 'joe'
    +        'location'      => 'UK'
    +        'gender'        => 'male'
    +)
    +
    +
    +

    The first parameter lets you set an offset, which defaults to 3 since your +URI will normally contain a controller/method pair in the first and second segments. +Example:

    +
    $array = $this->uri->uri_to_assoc(3);
    +echo $array['name'];
    +
    +
    +

    The second parameter lets you set default key names, so that the array +returned will always contain expected indexes, even if missing from the URI. +Example:

    +
    $default = array('name', 'gender', 'location', 'type', 'sort');
    +$array = $this->uri->uri_to_assoc(3, $default);
    +
    +
    +

    If the URI does not contain a value in your default, an array index will +be set to that name, with a value of NULL.

    +

    Lastly, if a corresponding value is not found for a given key (if there +is an odd number of URI segments) the value will be set to NULL.

    +
    + +
    +
    +ruri_to_assoc([$n = 3[, $default = array()]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $n (int) – Segment index number
    • +
    • $default (array) – Default values
    • +
    +
    Returns:

    Associative routed URI segments array

    +
    Return type:

    array

    +
    +

    This method is identical to uri_to_assoc(), except that it creates +an associative array using the re-routed URI in the event you are using +CodeIgniter’s URI Routing feature.

    +
    + +
    +
    +assoc_to_uri($array)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $array (array) – Input array of key/value pairs
    • +
    +
    Returns:

    URI string

    +
    Return type:

    string

    +
    +

    Takes an associative array as input and generates a URI string from it. +The array keys will be included in the string. Example:

    +
    $array = array('product' => 'shoes', 'size' => 'large', 'color' => 'red');
    +$str = $this->uri->assoc_to_uri($array);
    +
    +// Produces: product/shoes/size/large/color/red
    +
    +
    +
    + +
    +
    +uri_string()
    +
    +++ + + + + + +
    Returns:URI string
    Return type:string
    +

    Returns a string with the complete URI. For example, if this is your full URL:

    +
    http://example.com/index.php/news/local/345
    +
    +
    +

    The method would return this:

    +
    news/local/345
    +
    +
    +
    + +
    +
    +ruri_string()
    +
    +++ + + + + + +
    Returns:Routed URI string
    Return type:string
    +

    This method is identical to uri_string(), except that it returns +the re-routed URI in the event you are using CodeIgniter’s URI +Routing feature.

    +
    + +
    +
    +total_segments()
    +
    +++ + + + + + +
    Returns:Count of URI segments
    Return type:int
    +

    Returns the total number of segments.

    +
    + +
    +
    +total_rsegments()
    +
    +++ + + + + + +
    Returns:Count of routed URI segments
    Return type:int
    +

    This method is identical to total_segments(), except that it returns +the total number of segments in your re-routed URI in the event you are +using CodeIgniter’s URI Routing feature.

    +
    + +
    +
    +segment_array()
    +
    +++ + + + + + +
    Returns:URI segments array
    Return type:array
    +

    Returns an array containing the URI segments. For example:

    +
    $segs = $this->uri->segment_array();
    +
    +foreach ($segs as $segment)
    +{
    +        echo $segment;
    +        echo '<br />';
    +}
    +
    +
    +
    + +
    +
    +rsegment_array()
    +
    +++ + + + + + +
    Returns:Routed URI segments array
    Return type:array
    +

    This method is identical to segment_array(), except that it returns +the array of segments in your re-routed URI in the event you are using +CodeIgniter’s URI Routing feature.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html new file mode 100755 index 0000000..bdeb53c --- /dev/null +++ b/user_guide/libraries/user_agent.html @@ -0,0 +1,931 @@ + + + + + + + + + + User Agent Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    User Agent Class

    +

    The User Agent Class provides functions that help identify information +about the browser, mobile device, or robot visiting your site. In +addition you can get referrer information as well as language and +supported character-set information.

    + +
    +

    Using the User Agent Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the User Agent class is +initialized in your controller using the $this->load->library function:

    +
    $this->load->library('user_agent');
    +
    +
    +

    Once loaded, the object will be available using: $this->agent

    +
    +
    +

    User Agent Definitions

    +

    The user agent name definitions are located in a config file located at: +application/config/user_agents.php. You may add items to the various +user agent arrays if needed.

    +
    +
    +

    Example

    +

    When the User Agent class is initialized it will attempt to determine +whether the user agent browsing your site is a web browser, a mobile +device, or a robot. It will also gather the platform information if it +is available.

    +
    $this->load->library('user_agent');
    +
    +if ($this->agent->is_browser())
    +{
    +        $agent = $this->agent->browser().' '.$this->agent->version();
    +}
    +elseif ($this->agent->is_robot())
    +{
    +        $agent = $this->agent->robot();
    +}
    +elseif ($this->agent->is_mobile())
    +{
    +        $agent = $this->agent->mobile();
    +}
    +else
    +{
    +        $agent = 'Unidentified User Agent';
    +}
    +
    +echo $agent;
    +
    +echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.)
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_User_agent
    +
    +
    +is_browser([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Optional browser name
    • +
    +
    Returns:

    TRUE if the user agent is a (specified) browser, FALSE if not

    +
    Return type:

    bool

    +
    +

    Returns TRUE/FALSE (boolean) if the user agent is a known web browser.

    +
    if ($this->agent->is_browser('Safari'))
    +{
    +        echo 'You are using Safari.';
    +}
    +elseif ($this->agent->is_browser())
    +{
    +        echo 'You are using a browser.';
    +}
    +
    +
    +
    +

    Note

    +

    The string “Safari” in this example is an array key in the list of browser definitions. +You can find this list in application/config/user_agents.php if you want to add new +browsers or change the stings.

    +
    +
    + +
    +
    +is_mobile([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Optional mobile device name
    • +
    +
    Returns:

    TRUE if the user agent is a (specified) mobile device, FALSE if not

    +
    Return type:

    bool

    +
    +

    Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.

    +
    if ($this->agent->is_mobile('iphone'))
    +{
    +        $this->load->view('iphone/home');
    +}
    +elseif ($this->agent->is_mobile())
    +{
    +        $this->load->view('mobile/home');
    +}
    +else
    +{
    +        $this->load->view('web/home');
    +}
    +
    +
    +
    + +
    +
    +is_robot([$key = NULL])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $key (string) – Optional robot name
    • +
    +
    Returns:

    TRUE if the user agent is a (specified) robot, FALSE if not

    +
    Return type:

    bool

    +
    +

    Returns TRUE/FALSE (boolean) if the user agent is a known robot.

    +
    +

    Note

    +

    The user agent library only contains the most common robot definitions. It is not a complete list of bots. +There are hundreds of them so searching for each one would not be very efficient. If you find that some bots +that commonly visit your site are missing from the list you can add them to your +application/config/user_agents.php file.

    +
    +
    + +
    +
    +is_referral()
    +
    +++ + + + + + +
    Returns:TRUE if the user agent is a referral, FALSE if not
    Return type:bool
    +

    Returns TRUE/FALSE (boolean) if the user agent was referred from another site.

    +
    + +
    +
    +browser()
    +
    +++ + + + + + +
    Returns:Detected browser or an empty string
    Return type:string
    +

    Returns a string containing the name of the web browser viewing your site.

    +
    + +
    +
    +version()
    +
    +++ + + + + + +
    Returns:Detected browser version or an empty string
    Return type:string
    +

    Returns a string containing the version number of the web browser viewing your site.

    +
    + +
    +
    +mobile()
    +
    +++ + + + + + +
    Returns:Detected mobile device brand or an empty string
    Return type:string
    +

    Returns a string containing the name of the mobile device viewing your site.

    +
    + +
    +
    +robot()
    +
    +++ + + + + + +
    Returns:Detected robot name or an empty string
    Return type:string
    +

    Returns a string containing the name of the robot viewing your site.

    +
    + +
    +
    +platform()
    +
    +++ + + + + + +
    Returns:Detected operating system or an empty string
    Return type:string
    +

    Returns a string containing the platform viewing your site (Linux, Windows, OS X, etc.).

    +
    + +
    +
    +referrer()
    +
    +++ + + + + + +
    Returns:Detected referrer or an empty string
    Return type:string
    +

    The referrer, if the user agent was referred from another site. Typically you’ll test for this as follows:

    +
    if ($this->agent->is_referral())
    +{
    +        echo $this->agent->referrer();
    +}
    +
    +
    +
    + +
    +
    +agent_string()
    +
    +++ + + + + + +
    Returns:Full user agent string or an empty string
    Return type:string
    +

    Returns a string containing the full user agent string. Typically it will be something like this:

    +
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.4) Gecko/20060613 Camino/1.0.2
    +
    +
    +
    + +
    +
    +accept_lang([$lang = 'en'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $lang (string) – Language key
    • +
    +
    Returns:

    TRUE if provided language is accepted, FALSE if not

    +
    Return type:

    bool

    +
    +

    Lets you determine if the user agent accepts a particular language. Example:

    +
    if ($this->agent->accept_lang('en'))
    +{
    +        echo 'You accept English!';
    +}
    +
    +
    +
    +

    Note

    +

    This method is not typically very reliable since some browsers do not provide language info, +and even among those that do, it is not always accurate.

    +
    +
    + +
    +
    +languages()
    +
    +++ + + + + + +
    Returns:An array list of accepted languages
    Return type:array
    +

    Returns an array of languages supported by the user agent.

    +
    + +
    +
    +accept_charset([$charset = 'utf-8'])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $charset (string) – Character set
    • +
    +
    Returns:

    TRUE if the character set is accepted, FALSE if not

    +
    Return type:

    bool

    +
    +

    Lets you determine if the user agent accepts a particular character set. Example:

    +
    if ($this->agent->accept_charset('utf-8'))
    +{
    +        echo 'You browser supports UTF-8!';
    +}
    +
    +
    +
    +

    Note

    +

    This method is not typically very reliable since some browsers do not provide character-set info, +and even among those that do, it is not always accurate.

    +
    +
    + +
    +
    +charsets()
    +
    +++ + + + + + +
    Returns:An array list of accepted character sets
    Return type:array
    +

    Returns an array of character sets accepted by the user agent.

    +
    + +
    +
    +parse($string)
    +
    +++ + + + + + +
    Parameters:
      +
    • $string (string) – A custom user-agent string
    • +
    +
    Return type:

    void

    +
    +

    Parses a custom user-agent string, different from the one reported by the current visitor.

    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html new file mode 100755 index 0000000..122d317 --- /dev/null +++ b/user_guide/libraries/xmlrpc.html @@ -0,0 +1,1151 @@ + + + + + + + + + + XML-RPC and XML-RPC Server Classes — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • XML-RPC and XML-RPC Server Classes
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    XML-RPC and XML-RPC Server Classes

    +

    CodeIgniter’s XML-RPC classes permit you to send requests to another +server, or set up your own XML-RPC server to receive requests.

    + +
    +

    What is XML-RPC?

    +

    Quite simply it is a way for two computers to communicate over the +internet using XML. One computer, which we will call the client, sends +an XML-RPC request to another computer, which we will call the +server. Once the server receives and processes the request it will send +back a response to the client.

    +

    For example, using the MetaWeblog API, an XML-RPC Client (usually a +desktop publishing tool) will send a request to an XML-RPC Server +running on your site. This request might be a new weblog entry being +sent for publication, or it could be a request for an existing entry for +editing. When the XML-RPC Server receives this request it will examine +it to determine which class/method should be called to process the +request. Once processed, the server will then send back a response +message.

    +

    For detailed specifications, you can visit the XML-RPC site.

    +
    +
    +

    Using the XML-RPC Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the XML-RPC and XML-RPCS classes +are initialized in your controller using the $this->load->library +function:

    +

    To load the XML-RPC class you will use:

    +
    $this->load->library('xmlrpc');
    +
    +
    +

    Once loaded, the xml-rpc library object will be available using: +$this->xmlrpc

    +

    To load the XML-RPC Server class you will use:

    +
    $this->load->library('xmlrpc');
    +$this->load->library('xmlrpcs');
    +
    +
    +

    Once loaded, the xml-rpcs library object will be available using: +$this->xmlrpcs

    +
    +

    Note

    +

    When using the XML-RPC Server class you must load BOTH the +XML-RPC class and the XML-RPC Server class.

    +
    +
    +
    +

    Sending XML-RPC Requests

    +

    To send a request to an XML-RPC server you must specify the following +information:

    +
      +
    • The URL of the server
    • +
    • The method on the server you wish to call
    • +
    • The request data (explained below).
    • +
    +

    Here is a basic example that sends a simple Weblogs.com ping to the +Ping-o-Matic

    +
    $this->load->library('xmlrpc');
    +
    +$this->xmlrpc->server('http://rpc.pingomatic.com/', 80);
    +$this->xmlrpc->method('weblogUpdates.ping');
    +
    +$request = array('My Photoblog', 'http://www.my-site.com/photoblog/');
    +$this->xmlrpc->request($request);
    +
    +if ( ! $this->xmlrpc->send_request())
    +{
    +        echo $this->xmlrpc->display_error();
    +}
    +
    +
    +
    +

    Explanation

    +

    The above code initializes the XML-RPC class, sets the server URL and +method to be called (weblogUpdates.ping). The request (in this case, the +title and URL of your site) is placed into an array for transportation, +and compiled using the request() function. Lastly, the full request is +sent. If the send_request() method returns false we will display the +error message sent back from the XML-RPC Server.

    +
    +
    +
    +

    Anatomy of a Request

    +

    An XML-RPC request is simply the data you are sending to the XML-RPC +server. Each piece of data in a request is referred to as a request +parameter. The above example has two parameters: The URL and title of +your site. When the XML-RPC server receives your request, it will look +for parameters it requires.

    +

    Request parameters must be placed into an array for transportation, and +each parameter can be one of seven data types (strings, numbers, dates, +etc.). If your parameters are something other than strings you will have +to include the data type in the request array.

    +

    Here is an example of a simple array with three parameters:

    +
    $request = array('John', 'Doe', 'www.some-site.com');
    +$this->xmlrpc->request($request);
    +
    +
    +

    If you use data types other than strings, or if you have several +different data types, you will place each parameter into its own array, +with the data type in the second position:

    +
    $request = array(
    +        array('John', 'string'),
    +        array('Doe', 'string'),
    +        array(FALSE, 'boolean'),
    +        array(12345, 'int')
    +);
    +$this->xmlrpc->request($request);
    +
    +
    +

    The Data Types section below has a full list of data +types.

    +
    +
    +

    Creating an XML-RPC Server

    +

    An XML-RPC Server acts as a traffic cop of sorts, waiting for incoming +requests and redirecting them to the appropriate functions for +processing.

    +

    To create your own XML-RPC server involves initializing the XML-RPC +Server class in your controller where you expect the incoming request to +appear, then setting up an array with mapping instructions so that +incoming requests can be sent to the appropriate class and method for +processing.

    +

    Here is an example to illustrate:

    +
    $this->load->library('xmlrpc');
    +$this->load->library('xmlrpcs');
    +
    +$config['functions']['new_post'] = array('function' => 'My_blog.new_entry');
    +$config['functions']['update_post'] = array('function' => 'My_blog.update_entry');
    +$config['object'] = $this;
    +
    +$this->xmlrpcs->initialize($config);
    +$this->xmlrpcs->serve();
    +
    +
    +

    The above example contains an array specifying two method requests that +the Server allows. The allowed methods are on the left side of the +array. When either of those are received, they will be mapped to the +class and method on the right.

    +

    The ‘object’ key is a special key that you pass an instantiated class +object with, which is necessary when the method you are mapping to is +not part of the CodeIgniter super object.

    +

    In other words, if an XML-RPC Client sends a request for the new_post +method, your server will load the My_blog class and call the new_entry +function. If the request is for the update_post method, your server +will load the My_blog class and call the update_entry() method.

    +

    The function names in the above example are arbitrary. You’ll decide +what they should be called on your server, or if you are using +standardized APIs, like the Blogger or MetaWeblog API, you’ll use their +function names.

    +

    There are two additional configuration keys you may make use of when +initializing the server class: debug can be set to TRUE in order to +enable debugging, and xss_clean may be set to FALSE to prevent sending +data through the Security library’s xss_clean() method.

    +
    +
    +

    Processing Server Requests

    +

    When the XML-RPC Server receives a request and loads the class/method +for processing, it will pass an object to that method containing the +data sent by the client.

    +

    Using the above example, if the new_post method is requested, the +server will expect a class to exist with this prototype:

    +
    class My_blog extends CI_Controller {
    +
    +        public function new_post($request)
    +        {
    +
    +        }
    +}
    +
    +
    +

    The $request variable is an object compiled by the Server, which +contains the data sent by the XML-RPC Client. Using this object you will +have access to the request parameters enabling you to process the +request. When you are done you will send a Response back to the Client.

    +

    Below is a real-world example, using the Blogger API. One of the methods +in the Blogger API is getUserInfo(). Using this method, an XML-RPC +Client can send the Server a username and password, in return the Server +sends back information about that particular user (nickname, user ID, +email address, etc.). Here is how the processing function might look:

    +
    class My_blog extends CI_Controller {
    +
    +        public function getUserInfo($request)
    +        {
    +                $username = 'smitty';
    +                $password = 'secretsmittypass';
    +
    +                $this->load->library('xmlrpc');
    +
    +                $parameters = $request->output_parameters();
    +
    +                if ($parameters[1] != $username && $parameters[2] != $password)
    +                {
    +                        return $this->xmlrpc->send_error_message('100', 'Invalid Access');
    +                }
    +
    +                $response = array(
    +                        array(
    +                                'nickname'  => array('Smitty', 'string'),
    +                                'userid'    => array('99', 'string'),
    +                                'url'       => array('http://yoursite.com', 'string'),
    +                                'email'     => array('jsmith@yoursite.com', 'string'),
    +                                'lastname'  => array('Smith', 'string'),
    +                                'firstname' => array('John', 'string')
    +                        ),
    +                         'struct'
    +                );
    +
    +                return $this->xmlrpc->send_response($response);
    +        }
    +}
    +
    +
    +
    +

    Notes:

    +

    The output_parameters() method retrieves an indexed array +corresponding to the request parameters sent by the client. In the above +example, the output parameters will be the username and password.

    +

    If the username and password sent by the client were not valid, and +error message is returned using send_error_message().

    +

    If the operation was successful, the client will be sent back a response +array containing the user’s info.

    +
    +
    +
    +

    Formatting a Response

    +

    Similar to Requests, Responses must be formatted as an array. +However, unlike requests, a response is an array that contains a +single item. This item can be an array with several additional arrays, +but there can be only one primary array index. In other words, the basic +prototype is this:

    +
    $response = array('Response data', 'array');
    +
    +
    +

    Responses, however, usually contain multiple pieces of information. In +order to accomplish this we must put the response into its own array so +that the primary array continues to contain a single piece of data. +Here’s an example showing how this might be accomplished:

    +
    $response = array(
    +        array(
    +                'first_name' => array('John', 'string'),
    +                'last_name' => array('Doe', 'string'),
    +                'member_id' => array(123435, 'int'),
    +                'todo_list' => array(array('clean house', 'call mom', 'water plants'), 'array'),
    +        ),
    +        'struct'
    +);
    +
    +
    +

    Notice that the above array is formatted as a struct. This is the most +common data type for responses.

    +

    As with Requests, a response can be one of the seven data types listed +in the Data Types section.

    +
    +
    +

    Sending an Error Response

    +

    If you need to send the client an error response you will use the +following:

    +
    return $this->xmlrpc->send_error_message('123', 'Requested data not available');
    +
    +
    +

    The first parameter is the error number while the second parameter is +the error message.

    +
    +
    +

    Creating Your Own Client and Server

    +

    To help you understand everything we’ve covered thus far, let’s create a +couple controllers that act as XML-RPC Client and Server. You’ll use the +Client to send a request to the Server and receive a response.

    +
    +

    The Client

    +

    Using a text editor, create a controller called Xmlrpc_client.php. In +it, place this code and save it to your application/controllers/ +folder:

    +
    <?php
    +
    +class Xmlrpc_client extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->helper('url');
    +                $server_url = site_url('xmlrpc_server');
    +
    +                $this->load->library('xmlrpc');
    +
    +                $this->xmlrpc->server($server_url, 80);
    +                $this->xmlrpc->method('Greetings');
    +
    +                $request = array('How is it going?');
    +                $this->xmlrpc->request($request);
    +
    +                if ( ! $this->xmlrpc->send_request())
    +                {
    +                        echo $this->xmlrpc->display_error();
    +                }
    +                else
    +                {
    +                        echo '<pre>';
    +                        print_r($this->xmlrpc->display_response());
    +                        echo '</pre>';
    +                }
    +        }
    +}
    +?>
    +
    +
    +
    +

    Note

    +

    In the above code we are using a “url helper”. You can find more +information in the Helpers Functions page.

    +
    +
    +
    +

    The Server

    +

    Using a text editor, create a controller called Xmlrpc_server.php. In +it, place this code and save it to your application/controllers/ +folder:

    +
    <?php
    +
    +class Xmlrpc_server extends CI_Controller {
    +
    +        public function index()
    +        {
    +                $this->load->library('xmlrpc');
    +                $this->load->library('xmlrpcs');
    +
    +                $config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process');
    +
    +                $this->xmlrpcs->initialize($config);
    +                $this->xmlrpcs->serve();
    +        }
    +
    +
    +        public function process($request)
    +        {
    +                $parameters = $request->output_parameters();
    +
    +                $response = array(
    +                        array(
    +                                'you_said'  => $parameters[0],
    +                                'i_respond' => 'Not bad at all.'
    +                        ),
    +                        'struct'
    +                );
    +
    +                return $this->xmlrpc->send_response($response);
    +        }
    +}
    +
    +
    +
    +
    +

    Try it!

    +

    Now visit the your site using a URL similar to this:

    +
    example.com/index.php/xmlrpc_client/
    +
    +
    +

    You should now see the message you sent to the server, and its response +back to you.

    +

    The client you created sends a message (“How’s is going?”) to the +server, along with a request for the “Greetings” method. The Server +receives the request and maps it to the process() method, where a +response is sent back.

    +
    +
    +
    +

    Using Associative Arrays In a Request Parameter

    +

    If you wish to use an associative array in your method parameters you +will need to use a struct datatype:

    +
    $request = array(
    +        array(
    +                // Param 0
    +                array('name' => 'John'),
    +                'struct'
    +        ),
    +        array(
    +                // Param 1
    +                array(
    +                        'size' => 'large',
    +                        'shape'=>'round'
    +                ),
    +                'struct'
    +        )
    +);
    +
    +$this->xmlrpc->request($request);
    +
    +
    +

    You can retrieve the associative array when processing the request in +the Server.

    +
    $parameters = $request->output_parameters();
    +$name = $parameters[0]['name'];
    +$size = $parameters[1]['size'];
    +$shape = $parameters[1]['shape'];
    +
    +
    +
    +
    +

    Data Types

    +

    According to the XML-RPC spec there are +seven types of values that you can send via XML-RPC:

    +
      +
    • int or i4
    • +
    • boolean
    • +
    • string
    • +
    • double
    • +
    • dateTime.iso8601
    • +
    • base64
    • +
    • struct (contains array of values)
    • +
    • array (contains array of values)
    • +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Xmlrpc
    +
    +
    +initialize([$config = array()])
    +
    +++ + + + + + +
    Parameters:
      +
    • $config (array) – Configuration data
    • +
    +
    Return type:

    void

    +
    +

    Initializes the XML-RPC library. Accepts an associative array containing your settings.

    +
    + +
    +
    +server($url[, $port = 80[, $proxy = FALSE[, $proxy_port = 8080]]])
    +
    +++ + + + + + +
    Parameters:
      +
    • $url (string) – XML-RPC server URL
    • +
    • $port (int) – Server port
    • +
    • $proxy (string) – Optional proxy
    • +
    • $proxy_port (int) – Proxy listening port
    • +
    +
    Return type:

    void

    +
    +

    Sets the URL and port number of the server to which a request is to be sent:

    +
    $this->xmlrpc->server('http://www.sometimes.com/pings.php', 80);
    +
    +
    +

    Basic HTTP authentication is also supported, simply add it to the server URL:

    +
    $this->xmlrpc->server('http://user:pass@localhost/', 80);
    +
    +
    +
    + +
    +
    +timeout($seconds = 5)
    +
    +++ + + + + + +
    Parameters:
      +
    • $seconds (int) – Timeout in seconds
    • +
    +
    Return type:

    void

    +
    +

    Set a time out period (in seconds) after which the request will be canceled:

    +
    $this->xmlrpc->timeout(6);
    +
    +
    +

    This timeout period will be used both for an initial connection to +the remote server, as well as for getting a response from it. +Make sure you set the timeout before calling send_request().

    +
    + +
    +
    +method($function)
    +
    +++ + + + + + +
    Parameters:
      +
    • $function (string) – Method name
    • +
    +
    Return type:

    void

    +
    +

    Sets the method that will be requested from the XML-RPC server:

    +
    $this->xmlrpc->method('method');
    +
    +
    +

    Where method is the name of the method.

    +
    + +
    +
    +request($incoming)
    +
    +++ + + + + + +
    Parameters:
      +
    • $incoming (array) – Request data
    • +
    +
    Return type:

    void

    +
    +

    Takes an array of data and builds request to be sent to XML-RPC server:

    +
    $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/');
    +$this->xmlrpc->request($request);
    +
    +
    +
    + +
    +
    +send_request()
    +
    +++ + + + + + +
    Returns:TRUE on success, FALSE on failure
    Return type:bool
    +

    The request sending method. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally.

    +
    + +
    +
    +display_error()
    +
    +++ + + + + + +
    Returns:Error message string
    Return type:string
    +

    Returns an error message as a string if your request failed for some reason.

    +
    echo $this->xmlrpc->display_error();
    +
    +
    +
    + +
    +
    +display_response()
    +
    +++ + + + + + +
    Returns:Response
    Return type:mixed
    +

    Returns the response from the remote server once request is received. The response will typically be an associative array.

    +
    $this->xmlrpc->display_response();
    +
    +
    +
    + +
    +
    +send_error_message($number, $message)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $number (int) – Error number
    • +
    • $message (string) – Error message
    • +
    +
    Returns:

    XML_RPC_Response instance

    +
    Return type:

    XML_RPC_Response

    +
    +

    This method lets you send an error message from your server to the client. +First parameter is the error number while the second parameter is the error message.

    +
    return $this->xmlrpc->send_error_message(123, 'Requested data not available');
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html new file mode 100755 index 0000000..9278052 --- /dev/null +++ b/user_guide/libraries/zip.html @@ -0,0 +1,846 @@ + + + + + + + + + + Zip Encoding Class — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Libraries »
    • + +
    • Zip Encoding Class
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Zip Encoding Class

    +

    CodeIgniter’s Zip Encoding Class permits you to create Zip archives. +Archives can be downloaded to your desktop or saved to a directory.

    + +
    +

    Using the Zip Encoding Class

    +
    +

    Initializing the Class

    +

    Like most other classes in CodeIgniter, the Zip class is initialized in +your controller using the $this->load->library function:

    +
    $this->load->library('zip');
    +
    +
    +

    Once loaded, the Zip library object will be available using:

    +
    $this->zip
    +
    +
    +
    +
    +

    Usage Example

    +

    This example demonstrates how to compress a file, save it to a folder on +your server, and download it to your desktop.

    +
    $name = 'mydata1.txt';
    +$data = 'A Data String!';
    +
    +$this->zip->add_data($name, $data);
    +
    +// Write the zip file to a folder on your server. Name it "my_backup.zip"
    +$this->zip->archive('/path/to/directory/my_backup.zip');
    +
    +// Download the file to your desktop. Name it "my_backup.zip"
    +$this->zip->download('my_backup.zip');
    +
    +
    +
    +
    +
    +

    Class Reference

    +
    +
    +class CI_Zip
    +
    +
    +$compression_level = 2
    +

    The compression level to use.

    +

    It can range from 0 to 9, with 9 being the highest and 0 effectively disabling compression:

    +
    $this->zip->compression_level = 0;
    +
    +
    +
    + +
    +
    +add_data($filepath[, $data = NULL])
    +
    +++ + + + + + +
    Parameters:
      +
    • $filepath (mixed) – A single file path or an array of file => data pairs
    • +
    • $data (array) – File contents (ignored if $filepath is an array)
    • +
    +
    Return type:

    void

    +
    +

    Adds data to the Zip archive. Can work both in single and multiple files mode.

    +

    When adding a single file, the first parameter must contain the name you would +like given to the file and the second must contain the file contents:

    +
    $name = 'mydata1.txt';
    +$data = 'A Data String!';
    +$this->zip->add_data($name, $data);
    +
    +$name = 'mydata2.txt';
    +$data = 'Another Data String!';
    +$this->zip->add_data($name, $data);
    +
    +
    +

    When adding multiple files, the first parameter must contain file => contents pairs +and the second parameter is ignored:

    +
    $data = array(
    +        'mydata1.txt' => 'A Data String!',
    +        'mydata2.txt' => 'Another Data String!'
    +);
    +
    +$this->zip->add_data($data);
    +
    +
    +

    If you would like your compressed data organized into sub-directories, simply include +the path as part of the filename(s):

    +
    $name = 'personal/my_bio.txt';
    +$data = 'I was born in an elevator...';
    +
    +$this->zip->add_data($name, $data);
    +
    +
    +

    The above example will place my_bio.txt inside a folder called personal.

    +
    + +
    +
    +add_dir($directory)
    +
    +++ + + + + + +
    Parameters:
      +
    • $directory (mixed) – Directory name string or an array of multiple directories
    • +
    +
    Return type:

    void

    +
    +

    Permits you to add a directory. Usually this method is unnecessary since you can place +your data into directories when using $this->zip->add_data(), but if you would like +to create an empty directory you can do so:

    +
    $this->zip->add_dir('myfolder'); // Creates a directory called "myfolder"
    +
    +
    +
    + +
    +
    +read_file($path[, $archive_filepath = FALSE])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to file
    • +
    • $archive_filepath (mixed) – New file name/path (string) or (boolean) whether to maintain the original filepath
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Permits you to compress a file that already exists somewhere on your server. +Supply a file path and the zip class will read it and add it to the archive:

    +
    $path = '/path/to/photo.jpg';
    +
    +$this->zip->read_file($path);
    +
    +// Download the file to your desktop. Name it "my_backup.zip"
    +$this->zip->download('my_backup.zip');
    +
    +
    +

    If you would like the Zip archive to maintain the directory structure of +the file in it, pass TRUE (boolean) in the second parameter. Example:

    +
    $path = '/path/to/photo.jpg';
    +
    +$this->zip->read_file($path, TRUE);
    +
    +// Download the file to your desktop. Name it "my_backup.zip"
    +$this->zip->download('my_backup.zip');
    +
    +
    +

    In the above example, photo.jpg will be placed into the path/to/ directory.

    +

    You can also specify a new name (path included) for the added file on the fly:

    +
    $path = '/path/to/photo.jpg';
    +$new_path = '/new/path/some_photo.jpg';
    +
    +$this->zip->read_file($path, $new_path);
    +
    +// Download ZIP archive containing /new/path/some_photo.jpg
    +$this->zip->download('my_archive.zip');
    +
    +
    +
    + +
    +
    +read_dir($path[, $preserve_filepath = TRUE[, $root_path = NULL]])
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $path (string) – Path to directory
    • +
    • $preserve_filepath (bool) – Whether to maintain the original path
    • +
    • $root_path (string) – Part of the path to exclude from the archive directory
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Permits you to compress a directory (and its contents) that already exists somewhere on your server. +Supply a path to the directory and the zip class will recursively read and recreate it as a Zip archive. +All files contained within the supplied path will be encoded, as will any sub-directories contained within it. Example:

    +
    $path = '/path/to/your/directory/';
    +
    +$this->zip->read_dir($path);
    +
    +// Download the file to your desktop. Name it "my_backup.zip"
    +$this->zip->download('my_backup.zip');
    +
    +
    +

    By default the Zip archive will place all directories listed in the first parameter +inside the zip. If you want the tree preceding the target directory to be ignored, +you can pass FALSE (boolean) in the second parameter. Example:

    +
    $path = '/path/to/your/directory/';
    +
    +$this->zip->read_dir($path, FALSE);
    +
    +
    +

    This will create a ZIP with a directory named “directory” inside, then all sub-directories +stored correctly inside that, but will not include the /path/to/your part of the path.

    +
    + +
    +
    +archive($filepath)
    +
    +++ + + + + + + + +
    Parameters:
      +
    • $filepath (string) – Path to target zip archive
    • +
    +
    Returns:

    TRUE on success, FALSE on failure

    +
    Return type:

    bool

    +
    +

    Writes the Zip-encoded file to a directory on your server. Submit a valid server path +ending in the file name. Make sure the directory is writable (755 is usually OK). +Example:

    +
    $this->zip->archive('/path/to/folder/myarchive.zip'); // Creates a file named myarchive.zip
    +
    +
    +
    + +
    +
    +download($filename = 'backup.zip')
    +
    +++ + + + + + +
    Parameters:
      +
    • $filename (string) – Archive file name
    • +
    +
    Return type:

    void

    +
    +

    Causes the Zip file to be downloaded from your server. +You must pass the name you would like the zip file called. Example:

    +
    $this->zip->download('latest_stuff.zip'); // File will be named "latest_stuff.zip"
    +
    +
    +
    +

    Note

    +

    Do not display any data in the controller in which you call +this method since it sends various server headers that cause the +download to happen and the file to be treated as binary.

    +
    +
    + +
    +
    +get_zip()
    +
    +++ + + + + + +
    Returns:Zip file content
    Return type:string
    +

    Returns the Zip-compressed file data. Generally you will not need this method unless you +want to do something unique with the data. Example:

    +
    $name = 'my_bio.txt';
    +$data = 'I was born in an elevator...';
    +
    +$this->zip->add_data($name, $data);
    +
    +$zip_file = $this->zip->get_zip();
    +
    +
    +
    + +
    +
    +clear_data()
    +
    +++ + + + +
    Return type:void
    +

    The Zip class caches your zip data so that it doesn’t need to recompile the Zip archive +for each method you use above. If, however, you need to create multiple Zip archives, +each with different data, you can clear the cache between calls. Example:

    +
    $name = 'my_bio.txt';
    +$data = 'I was born in an elevator...';
    +
    +$this->zip->add_data($name, $data);
    +$zip_file = $this->zip->get_zip();
    +
    +$this->zip->clear_data();
    +
    +$name = 'photo.jpg';
    +$this->zip->read_file("/path/to/photo.jpg"); // Read the file's contents
    +
    +$this->zip->download('myphotos.zip');
    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/license.html b/user_guide/license.html new file mode 100755 index 0000000..50735aa --- /dev/null +++ b/user_guide/license.html @@ -0,0 +1,509 @@ + + + + + + + + + + The MIT License (MIT) — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • The MIT License (MIT)
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    The MIT License (MIT)

    +

    Copyright (c) 2014 - 2017, British Columbia Institute of Technology

    +

    Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

    +

    The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/objects.inv b/user_guide/objects.inv new file mode 100755 index 0000000000000000000000000000000000000000..36c940b71fe108eaa46ebcc43d64a10c2b8b1e35 GIT binary patch literal 7309 zcmV;89CG6$AX9K?X>NERX>N99Zgg*Qc_4OWa&u{KZXhxWBOp+6Z)#;@bUGkIZ)9aj zXKrb9WpWB5AXa5^b7^mGIv_JHF)lU=BOp|0Wgv28ZDDC{WMy(7Z)PBLXlZjGW@&6? zAZc?TV{dJ6a%FRKWn>_Ab7^j8AbM}t8lMA$d05gfD@P`8N2u;4^EaPcnHEXK`I`KG@71<`S0%`iTE@A&3=ug7WnB0LN%Gj8=0sA$mcXGB7e5UW!WVEPSz4SW%L0-jD}oq` z<607$(t-vt{oz`QJYbx-HVG?GU1G%`uP`SS zmKQWjZHq}$PFP_H%2^hbVd3~nVS2JLBVYtcrE|eZaoQHK%*RbeAC#p>dcxF7CK~eJ z-yZ^@#wEk+g+oV`1c$|05IMm3lv<8J118cHWR^TPkDBr^-u(^0aPhDm)`?JHL^ zAt)MML&*vjq}+#r$2#Lt#kb1nQBmgQ4?*$869%*anYAGsK)#RRz#xv zp($#vY^X?*7njk7vtc{NB|rONy}GoJjb+ISG$&H5!{X~XedMp!k{wo)(|0-R=#<)- z)#QqGW_>=3&T9=WmX*1GxU5D+(r7iVvB8fG+c|i`hZZ(OtErowU><@ZJg-3aJ)`Lg zG~jYrg(jhE2r119e_cfY#+525#`t^{E19vCD=7$9Q+UC(mb{q1etT-t^@_NbS*@u2 zRldub4Jx}5qxfeXv(HE#2O(L72^`R4ZU-B-)jDxS*SGFgRe z9myB|ijxVs_PcJ!3zXV_u^J`V#?>YSynq?@N@N8q({P}rGIm8HK{2e6{`Uuyc* z#NO;G(35^Mr8zVM@mPS&~XWqK%&;OUR-Im&{@w78f}r%I#*LqSkn_*mx1E2rThfAYbfH*PVe zd8(}AYjD#%(tK3;-Dx1yGNC^vmmMsa#(c5UG-3i1P_~fdC5fFI>z5>;F%ol0AZ?iY z{yr#*pg-c74TFezKcta0{1ArL7#B!P0%naGI=^Rt62iwegP^#aQ6a;K9Lm#)*q0S% z%@@DOtbu&sV4VemH6GY$;Z|9|pGgooRFszn%Rd8WC7Lv3mmG_RCo0v1kXvQ42p7m0 zR3t8gDuWS|QxIO9Xk@$|&CesvG6hfEs!%PkqtX@`5L~@zJXo`~B7r?lRhzppkaQ`- z`7t^!fKTrpK}gfJ&}l_T7sa2ZrCA)VZc)eQ^?W;MhAP_R!75* zG`1^Zls%_odku^rJ=2QuElx&QLWi-kQ;^ zhUM7JHO3&m?NLEmGnr;Ti}*~zPL71IV~Uj{T5Ut7T=2cNSWH^3!z10nBl|?H$y8ei z%K!_OgJ8}D#1rEzYd&aSr_y~$L@|7k7x}1Ym2O5&jKrtWEX$q2oec!snP$3|oum+7 z#UglCjO@Xigg*-~8{74cFr;~j4T&kF4Rb?>oIO&!s2FTy@AnwS&ok}@WaO`s@To}& zN+A=#2$LYO2j_keMM5XIJ(T;w_u!=}z6(B#sWV*XwS_sg5`cUcz34Wry^J|wPYx;} z=TdIkUy4`y;uB2mD=W>mPxJY}k3ov<&y7V=8T3L%AwLXAQ?y=Vu#r)m8I}e8u+$bp zCK~dq80I_(AHk3fw>ZwCkUf>?2XU1d12_Ag?SN({<~-=3i8QxGf+Nud*lY>51CC9b zMqtv$x0;nZay$jh9qIDYGl_F2K?w^jQzHj#^+mZrWu}V*5*$D-s-(_7So+aAHqR3! z&la#x^u)%dmPwUvM#1VeV=>O*F+Mh) z06U9~FE2b_Qh2_!@KwY4oP?tv+60fj+#rmL|PG27<3d^bGw7fd;{KvJnH8q7eW3<4aHz z9MV>BcJ$8yKQHAdvPY7R9;!8ii3MqtCH~=3;4Z5P8Xkb+{ZQWe1;u&cFkc=yLl41o zj(>ezrE(KQ^jBk3-YF<|g~Ikdn1qfwN5>hCa6pke9NJw{z@i>^=YWII7EpjIe3={` z3CaD1!T?vDFG?b5mQjE_+!!F$pE$W~1_L8g=lxBQ6ida)wO%Y^Sf&=s-e0D&Js0SM zW^h-BGF>hNC-k>Es%mITWyIAmxAF!Jg7s$LMi(nk)Rcy!z$ADidILDO2Fr1BkdH00 zjbi04WG5tyNJqv=qu8mFDh*&3gpUvji77#qZbnJh+!Jis2zW>-`rf%LFG=joF{b>} z;909#lQiT7vJ`L{pgV~?n=^8T%Ym{yC`^=uEU1i_YK0@qD3f?bLPGIqhDrQbEZr=y zKN@E+kAj!sA|ccZ+0G1l?RfNXON8W-XD1fqXKV&k)EN+*F!p7U`9+t=RDfwFSO^bh zDdsd+8t)FwCodt%!6iT}seb?R0g;H9Z}f8t8E~G3V)`Xo05x$&pqP=K#*V)p1&v3w zn4#k7#5^0viTcTkS|MF3=w3f{P^*(v71RZ(&a|pt${nyyP{*cpYDqDl_iL}S;iIV1 z`-i62K=F-)#fYt+!@vj}_P&f^7~F5kfX713fzKI(&FA68_?gmkm`d$<3mwGLLrA;xhoQp90D~VYiBG%?bCK~dO9tv%R7aeh)rFip= zP)u9e5%72f-3V|ZWN!r7%rmFLil<1HlwmBUZUhLYb!Vl`EB{9a!wuEy2hICAm8)=U z9DsxHZ4+h;3(q6tPa{T!q*)hlYRicc1U{V~cp#w>!$@E+2niaC2kW4|W(o0CTXuF) zXJH957P)l%6HO!XV!{Z`J7*;v*^v1>gLe&&wVKTYf1AGFQHCHc2up)PTdVrcgsrDS z#Q0BYjN+@GEnpg+aZt%(1mWjdt~ZU(#lbAMeGq92r+nM-PjCpKsNX^ER<3V;Xu0a8 zcNOM!a#6ZETiH;80?vRK6ajoV5N%*pZiC~;^ujvFfT45i%*?kQ&^CcA!|WH>G$tKO z7%nZ7gXkpt$S_Dq-OCtYG(EzBOPK*#Ik0>kl3>*qDwMUkY{sk&NtT+_pmw&4L3|3A zzVw`FvkRdDP+);WFkn!fJVdK-JKLs}K1>FC9Wj*5F@#;XPg8ZJm>p8>DQty}n<^<& zF>JF*&;XTFz5$RjsWuls2~a!HWE#M;CRD^^&2&VB0TU zzvXP4&Igz1RR)CpX& z>c?3a#8x9K7^3*(uQG_a^OQz%>8%NEV{j}Fn>lbJp-Z#!lxIe zNr~FBYcEj1!QC7t8#_ZZ+&>pZ&Yj*XFitqp1I6)0UUlZyGt_HFhPqZu27{`C+W|)J zR;nN^5~!=NP*&O+XQz%E)=)pSp4dR(xT+$v(V64`8X6OK8=@HUj4xs+57nK4P7L)4 zzjK8P7r|RKV{+kt#ZFcyJ#ecxr8FeIb%l&kM0QieRL8;2eWjSD3(Xdf5~{*+t@`>b zwvvk8cjGjKtA_Hv8sH4aQ?nJVW->W8>{(JmA~0s_ussn*j~92IxMcX)3GV=4x?}4< z`>V_f!sj@FkseZS{c&>pXslDu++C8GtLuy?FPV*q1g4Z8n^MkQAmqzlN{U0xf@24` z+;~mXC(0?50(a3)_qak!z)@?vxWR*?sDO39X5QCj<8V`pq4jyG2B=Il;0iZ~7k8a# z%43_Xy$2E{hEer)dIJ#Bj6erhj(MZ1l?v$t!%90h89!&w{>}Bx+(DGgZ}bDA2%)%T z958#^$!TG|tfV`+@3y@l%jt`o_E6&9GMfQYmYp#tt z2AW@q-sB37^g-E&M+$!}bBK#4k=LYon$Ht_p5)s|&+=7$YqD+WW#G@33az6Qu80`L zvMf~#z6hhrS`q!yLTHv!AMP`|#t#}+NmHMm1a!ir!QoozNd*FR8h4PYTe0V3H$oY4D|BbF7JrQ0wbu8~cy?OA0QrOzGfQ}h#LJ*%aF;X}u zd}D~f?35D;(DeQkcxlfXi|f5@XWlf0vh5XH7agenuU>1_5ux-+1`f3gieyoReWM=| z@ALc5-q(vL;)^FfSMLuv%525#^OjCHl6Aff<{qXU_ z26IaoiA=5wp)>Hb?!WkE!X=9^quyJ1L6c~Fj~F&&aojV)hUC^TLp^A5Ffyhh?ev~@ zJivtU>xDy@XkR}d}6zp0|l3T3~FDR8zo@8aGn4 zPL0$stYcw%RU3?9dvxt|#ra;0s$-!2qkTj}>)9+xcDrU2fQpswF26h-VUuzQtHxomBOyDqnBbDe^WSTRqyTo+{`E_;aI7 z!Bw}Hn?I}9#-kb5o7VW+wLsSZy*Ki#21U3rZxApM8MY934{ttydwBn5K-ONUF>(!7 za)ean(oc`6 z!0YO%n+$t2E&rp5rSG1UL*W5O4|c^|72#(R97Elei1;T|XNAM#P3skJz1;_0tl ziWxz1?sN2f$R-|>o4L091HSgsn~`m>Hs^hnj|NQb6&oYdU`a=GCeqK?V`};GO+0;9 zzxPc%7;yBXhKx+c&?2vOa#N4BS%NXq^%iKLqw5pAjDBXlRR!-~%||x)xH?YOR_6*Q zDX89A21biXuJjC4#*KG5OgXxSuQy=qvKmU&Pp!Vz=DGaANK%72Tt@9m8C zz1^eyyNVxc-`krR{5L57zT&?@`0r-O|Lz*)zft^msQm9{=+7OdKX;YX(e^$hvHzDD_V`@Tly|9Xb}Ut{urUCIA7D*x9rAK+Zp_3`AFJ|e~a<&X7KM&{%ysN%4a`=e~e|7HgN z4a#53AF=|4qezi}Byh;J-upZ!7*ggnx$p-y`;4 z(kgz`{_khl|NR!z&uyijsQus1u>bq*4&~og{Fr{uu>bq*9_8Ov{Fr{uu>bq*4a&c- z_%Z$5&d|^8Ey{mW@nibAouQxGJCy&n;z#uJFhhS1L;V>zIP~8}EgEyp)H#fA2)xgX zJkhM=RruwMNDA(0mh+H zD-!j~TohJd9IViO&~ujO5)7FK4C(?_Ge;8usv`pja1|YHM9ZZ1^27kEB7G3FO4N9r z6Jh8@I-=1$=1tmAr)zp{XzP^S)IFs_SbD`#h%D1LO|5 zW({gcqPIFBB(1xXyy^zJp>a?LD;O!7t9R7OrMh{kUyS-54}_$1&4<@q-ZS87){o3Y z-Fq?G>rH*C_WAH;vcU=R9vna~+D%~wgp49Q`dR`RVKP89hp3yu-II{jD%2a9zfYx( zwKdbUj=Y7nud6SgALJ&B>Tey5Q-$Ppj#V`?R_CpHaCGi3aH3sXD6oU6r!n%8ZkDsK ztslM#O;h>)L;U#9O#&2y_>uf_RVCDcOr=mU6-knbQbRn;PeGm^UAe{}czkhE(1C_o?toXPJ4tv6y(Tw+{gzXt(G7wZ_OBhIPIDrG7yKhm?DibZ!A)py{ zKtrQm$*9aLeL9SF3AJXZaL!Mfq~>k_SFDVk+4~jW$PEOs46ePBrygE4k$&^(zcnmE ze1b(s{uO1BF{+}O!?@(VUfqyfkMi~J7KJ)eHYLwo-&$g1>gQ?&5EBm`d-8F^JNP!b zDcVlzXAMlgL0=JVM7J~Oh#46MsGc-Lu>Br(L)SXfCu(P?LQ3F?C!cIe`EkjBI(`-K n1+AzeXJsHB_X6H&$!9nvqMC`${d)gwgMw6z + + + + + + + Application Flow Chart — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Application Flow Chart

    +

    The following graphic illustrates how data flows throughout the system:

    +

    CodeIgniter application flow

    +
      +
    1. The index.php serves as the front controller, initializing the base +resources needed to run CodeIgniter.
    2. +
    3. The Router examines the HTTP request to determine what should be done +with it.
    4. +
    5. If a cache file exists, it is sent directly to the browser, bypassing +the normal system execution.
    6. +
    7. Security. Before the application controller is loaded, the HTTP +request and any user submitted data is filtered for security.
    8. +
    9. The Controller loads the model, core libraries, helpers, and any +other resources needed to process the specific request.
    10. +
    11. The finalized View is rendered then sent to the web browser to be +seen. If caching is enabled, the view is cached first so that on +subsequent requests it can be served.
    12. +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html new file mode 100755 index 0000000..fe0b9f9 --- /dev/null +++ b/user_guide/overview/at_a_glance.html @@ -0,0 +1,599 @@ + + + + + + + + + + CodeIgniter at a Glance — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    CodeIgniter at a Glance

    +
    +

    CodeIgniter is an Application Framework

    +

    CodeIgniter is a toolkit for people who build web applications using +PHP. Its goal is to enable you to develop projects much faster than you +could if you were writing code from scratch, by providing a rich set of +libraries for commonly needed tasks, as well as a simple interface and +logical structure to access these libraries. CodeIgniter lets you +creatively focus on your project by minimizing the amount of code needed +for a given task.

    +
    +
    +

    CodeIgniter is Free

    +

    CodeIgniter is licensed under the MIT license so you can use it however +you please. For more information please read the +license agreement.

    +
    +
    +

    CodeIgniter is Light Weight

    +

    Truly light weight. The core system requires only a few very small +libraries. This is in stark contrast to many frameworks that require +significantly more resources. Additional libraries are loaded +dynamically upon request, based on your needs for a given process, so +the base system is very lean and quite fast.

    +
    +
    +

    CodeIgniter is Fast

    +

    Really fast. We challenge you to find a framework that has better +performance than CodeIgniter.

    +
    +
    +

    CodeIgniter Uses M-V-C

    +

    CodeIgniter uses the Model-View-Controller approach, which allows great +separation between logic and presentation. This is particularly good for +projects in which designers are working with your template files, as the +code these files contain will be minimized. We describe MVC in more +detail on its own page.

    +
    +
    +

    CodeIgniter Generates Clean URLs

    +

    The URLs generated by CodeIgniter are clean and search-engine friendly. +Rather than using the standard “query string” approach to URLs that is +synonymous with dynamic systems, CodeIgniter uses a segment-based +approach:

    +
    example.com/news/article/345
    +
    +
    +
    +

    Note

    +

    By default the index.php file is included in the URL but it can +be removed using a simple .htaccess file.

    +
    +
    +
    +

    CodeIgniter Packs a Punch

    +

    CodeIgniter comes with full-range of libraries that enable the most +commonly needed web development tasks, like accessing a database, +sending email, validating form data, maintaining sessions, manipulating +images, working with XML-RPC data and much more.

    +
    +
    +

    CodeIgniter is Extensible

    +

    The system can be easily extended through the use of your own libraries, +helpers, or through class extensions or system hooks.

    +
    +
    +

    CodeIgniter Does Not Require a Template Engine

    +

    Although CodeIgniter does come with a simple template parser that can +be optionally used, it does not force you to use one. Template engines +simply can not match the performance of native PHP, and the syntax that +must be learned to use a template engine is usually only marginally +easier than learning the basics of PHP. Consider this block of PHP code:

    +
    <ul>
    +<?php foreach ($addressbook as $name):?>
    +        <li><?=$name?></li>
    +<?php endforeach; ?>
    +</ul>
    +
    +
    +

    Contrast this with the pseudo-code used by a template engine:

    +
    <ul>
    +{foreach from=$addressbook item="name"}
    +        <li>{$name}</li>
    +{/foreach}
    +</ul>
    +
    +
    +

    Yes, the template engine example is a bit cleaner, but it comes at the +price of performance, as the pseudo-code must be converted back into PHP +to run. Since one of our goals is maximum performance, we opted to not +require the use of a template engine.

    +
    +
    +

    CodeIgniter is Thoroughly Documented

    +

    Programmers love to code and hate to write documentation. We’re no +different, of course, but since documentation is as important as the +code itself, we are committed to doing it. Our source code is extremely +clean and well commented as well.

    +
    +
    +

    CodeIgniter has a Friendly Community of Users

    +

    Our growing community of users can be seen actively participating in our +Community Forums.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/features.html b/user_guide/overview/features.html new file mode 100755 index 0000000..89163ad --- /dev/null +++ b/user_guide/overview/features.html @@ -0,0 +1,538 @@ + + + + + + + + + + CodeIgniter Features — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    CodeIgniter Features

    +

    Features in and of themselves are a very poor way to judge an +application since they tell you nothing about the user experience, or +how intuitively or intelligently it is designed. Features don’t reveal +anything about the quality of the code, or the performance, or the +attention to detail, or security practices. The only way to really judge +an app is to try it and get to know the code. +Installing CodeIgniter is child’s play so +we encourage you to do just that. In the mean time here’s a list of +CodeIgniter’s main features.

    +
      +
    • Model-View-Controller Based System
    • +
    • Extremely Light Weight
    • +
    • Full Featured database classes with support for several platforms.
    • +
    • Query Builder Database Support
    • +
    • Form and Data Validation
    • +
    • Security and XSS Filtering
    • +
    • Session Management
    • +
    • Email Sending Class. Supports Attachments, HTML/Text email, multiple +protocols (sendmail, SMTP, and Mail) and more.
    • +
    • Image Manipulation Library (cropping, resizing, rotating, etc.). +Supports GD, ImageMagick, and NetPBM
    • +
    • File Uploading Class
    • +
    • FTP Class
    • +
    • Localization
    • +
    • Pagination
    • +
    • Data Encryption
    • +
    • Benchmarking
    • +
    • Full Page Caching
    • +
    • Error Logging
    • +
    • Application Profiling
    • +
    • Calendaring Class
    • +
    • User Agent Class
    • +
    • Zip Encoding Class
    • +
    • Template Engine Class
    • +
    • Trackback Class
    • +
    • XML-RPC Library
    • +
    • Unit Testing Class
    • +
    • Search-engine Friendly URLs
    • +
    • Flexible URI Routing
    • +
    • Support for Hooks and Class Extensions
    • +
    • Large library of “helper” functions
    • +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/getting_started.html b/user_guide/overview/getting_started.html new file mode 100755 index 0000000..0ffb928 --- /dev/null +++ b/user_guide/overview/getting_started.html @@ -0,0 +1,512 @@ + + + + + + + + + + Getting Started With CodeIgniter — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Getting Started With CodeIgniter

    +

    Any software application requires some effort to learn. We’ve done our +best to minimize the learning curve while making the process as +enjoyable as possible.

    +

    The first step is to install +CodeIgniter, then read all the topics in the Introduction section of +the Table of Contents.

    +

    Next, read each of the General Topics pages in order. Each topic +builds on the previous one, and includes code examples that you are +encouraged to try.

    +

    Once you understand the basics you’ll be ready to explore the Class +Reference and Helper Reference pages to learn to utilize the +native libraries and helper files.

    +

    Feel free to take advantage of our Community +Forums if you have questions or +problems, and our Wiki to see code +examples posted by other users.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/goals.html b/user_guide/overview/goals.html new file mode 100755 index 0000000..53349e3 --- /dev/null +++ b/user_guide/overview/goals.html @@ -0,0 +1,522 @@ + + + + + + + + + + Design and Architectural Goals — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Design and Architectural Goals

    +

    Our goal for CodeIgniter is maximum performance, capability, and +flexibility in the smallest, lightest possible package.

    +

    To meet this goal we are committed to benchmarking, re-factoring, and +simplifying at every step of the development process, rejecting anything +that doesn’t further the stated objective.

    +

    From a technical and architectural standpoint, CodeIgniter was created +with the following objectives:

    +
      +
    • Dynamic Instantiation. In CodeIgniter, components are loaded and +routines executed only when requested, rather than globally. No +assumptions are made by the system regarding what may be needed +beyond the minimal core resources, so the system is very light-weight +by default. The events, as triggered by the HTTP request, and the +controllers and views you design will determine what is invoked.
    • +
    • Loose Coupling. Coupling is the degree to which components of a +system rely on each other. The less components depend on each other +the more reusable and flexible the system becomes. Our goal was a +very loosely coupled system.
    • +
    • Component Singularity. Singularity is the degree to which +components have a narrowly focused purpose. In CodeIgniter, each +class and its functions are highly autonomous in order to allow +maximum usefulness.
    • +
    +

    CodeIgniter is a dynamically instantiated, loosely coupled system with +high component singularity. It strives for simplicity, flexibility, and +high performance in a small footprint package.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/index.html b/user_guide/overview/index.html new file mode 100755 index 0000000..8e1318f --- /dev/null +++ b/user_guide/overview/index.html @@ -0,0 +1,504 @@ + + + + + + + + + + CodeIgniter Overview — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • CodeIgniter Overview
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    CodeIgniter Overview

    +

    The following pages describe the broad concepts behind CodeIgniter:

    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/overview/mvc.html b/user_guide/overview/mvc.html new file mode 100755 index 0000000..9c9988d --- /dev/null +++ b/user_guide/overview/mvc.html @@ -0,0 +1,519 @@ + + + + + + + + + + Model-View-Controller — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Model-View-Controller

    +

    CodeIgniter is based on the Model-View-Controller development pattern. +MVC is a software approach that separates application logic from +presentation. In practice, it permits your web pages to contain minimal +scripting since the presentation is separate from the PHP scripting.

    +
      +
    • The Model represents your data structures. Typically your model +classes will contain functions that help you retrieve, insert, and +update information in your database.
    • +
    • The View is the information that is being presented to a user. A +View will normally be a web page, but in CodeIgniter, a view can also +be a page fragment like a header or footer. It can also be an RSS +page, or any other type of “page”.
    • +
    • The Controller serves as an intermediary between the Model, the +View, and any other resources needed to process the HTTP request and +generate a web page.
    • +
    +

    CodeIgniter has a fairly loose approach to MVC since Models are not +required. If you don’t need the added separation, or find that +maintaining models requires more complexity than you want, you can +ignore them and build your application minimally using Controllers and +Views. CodeIgniter also enables you to incorporate your own existing +scripts, or even develop core libraries for the system, enabling you to +work in a way that makes the most sense to you.

    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/search.html b/user_guide/search.html new file mode 100755 index 0000000..213f5e6 --- /dev/null +++ b/user_guide/search.html @@ -0,0 +1,499 @@ + + + + + + + + + + Search — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + + + + +
    + +
    + +
    +
    + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/searchindex.js b/user_guide/searchindex.js new file mode 100755 index 0000000..d9b7720 --- /dev/null +++ b/user_guide/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({docnames:["DCO","changelog","contributing/index","database/caching","database/call_function","database/configuration","database/connecting","database/db_driver_reference","database/examples","database/forge","database/helpers","database/index","database/metadata","database/queries","database/query_builder","database/results","database/transactions","database/utilities","documentation/index","general/alternative_php","general/ancillary_classes","general/autoloader","general/caching","general/cli","general/common_functions","general/compatibility_functions","general/controllers","general/core_classes","general/creating_drivers","general/creating_libraries","general/credits","general/drivers","general/environments","general/errors","general/helpers","general/hooks","general/index","general/libraries","general/managing_apps","general/models","general/profiling","general/requirements","general/reserved_names","general/routing","general/security","general/styleguide","general/urls","general/views","general/welcome","helpers/array_helper","helpers/captcha_helper","helpers/cookie_helper","helpers/date_helper","helpers/directory_helper","helpers/download_helper","helpers/email_helper","helpers/file_helper","helpers/form_helper","helpers/html_helper","helpers/index","helpers/inflector_helper","helpers/language_helper","helpers/number_helper","helpers/path_helper","helpers/security_helper","helpers/smiley_helper","helpers/string_helper","helpers/text_helper","helpers/typography_helper","helpers/url_helper","helpers/xml_helper","index","installation/downloads","installation/index","installation/troubleshooting","installation/upgrade_120","installation/upgrade_130","installation/upgrade_131","installation/upgrade_132","installation/upgrade_133","installation/upgrade_140","installation/upgrade_141","installation/upgrade_150","installation/upgrade_152","installation/upgrade_153","installation/upgrade_154","installation/upgrade_160","installation/upgrade_161","installation/upgrade_162","installation/upgrade_163","installation/upgrade_170","installation/upgrade_171","installation/upgrade_172","installation/upgrade_200","installation/upgrade_201","installation/upgrade_202","installation/upgrade_203","installation/upgrade_210","installation/upgrade_211","installation/upgrade_212","installation/upgrade_213","installation/upgrade_214","installation/upgrade_220","installation/upgrade_221","installation/upgrade_222","installation/upgrade_223","installation/upgrade_300","installation/upgrade_301","installation/upgrade_302","installation/upgrade_303","installation/upgrade_304","installation/upgrade_305","installation/upgrade_306","installation/upgrade_310","installation/upgrade_311","installation/upgrade_312","installation/upgrade_313","installation/upgrade_314","installation/upgrade_315","installation/upgrade_316","installation/upgrade_b11","installation/upgrading","libraries/benchmark","libraries/caching","libraries/calendar","libraries/cart","libraries/config","libraries/email","libraries/encrypt","libraries/encryption","libraries/file_uploading","libraries/form_validation","libraries/ftp","libraries/image_lib","libraries/index","libraries/input","libraries/javascript","libraries/language","libraries/loader","libraries/migration","libraries/output","libraries/pagination","libraries/parser","libraries/security","libraries/sessions","libraries/table","libraries/trackback","libraries/typography","libraries/unit_testing","libraries/uri","libraries/user_agent","libraries/xmlrpc","libraries/zip","license","overview/appflow","overview/at_a_glance","overview/features","overview/getting_started","overview/goals","overview/index","overview/mvc","tutorial/conclusion","tutorial/create_news_items","tutorial/index","tutorial/news_section","tutorial/static_pages"],envversion:52,filenames:["DCO.rst","changelog.rst","contributing/index.rst","database/caching.rst","database/call_function.rst","database/configuration.rst","database/connecting.rst","database/db_driver_reference.rst","database/examples.rst","database/forge.rst","database/helpers.rst","database/index.rst","database/metadata.rst","database/queries.rst","database/query_builder.rst","database/results.rst","database/transactions.rst","database/utilities.rst","documentation/index.rst","general/alternative_php.rst","general/ancillary_classes.rst","general/autoloader.rst","general/caching.rst","general/cli.rst","general/common_functions.rst","general/compatibility_functions.rst","general/controllers.rst","general/core_classes.rst","general/creating_drivers.rst","general/creating_libraries.rst","general/credits.rst","general/drivers.rst","general/environments.rst","general/errors.rst","general/helpers.rst","general/hooks.rst","general/index.rst","general/libraries.rst","general/managing_apps.rst","general/models.rst","general/profiling.rst","general/requirements.rst","general/reserved_names.rst","general/routing.rst","general/security.rst","general/styleguide.rst","general/urls.rst","general/views.rst","general/welcome.rst","helpers/array_helper.rst","helpers/captcha_helper.rst","helpers/cookie_helper.rst","helpers/date_helper.rst","helpers/directory_helper.rst","helpers/download_helper.rst","helpers/email_helper.rst","helpers/file_helper.rst","helpers/form_helper.rst","helpers/html_helper.rst","helpers/index.rst","helpers/inflector_helper.rst","helpers/language_helper.rst","helpers/number_helper.rst","helpers/path_helper.rst","helpers/security_helper.rst","helpers/smiley_helper.rst","helpers/string_helper.rst","helpers/text_helper.rst","helpers/typography_helper.rst","helpers/url_helper.rst","helpers/xml_helper.rst","index.rst","installation/downloads.rst","installation/index.rst","installation/troubleshooting.rst","installation/upgrade_120.rst","installation/upgrade_130.rst","installation/upgrade_131.rst","installation/upgrade_132.rst","installation/upgrade_133.rst","installation/upgrade_140.rst","installation/upgrade_141.rst","installation/upgrade_150.rst","installation/upgrade_152.rst","installation/upgrade_153.rst","installation/upgrade_154.rst","installation/upgrade_160.rst","installation/upgrade_161.rst","installation/upgrade_162.rst","installation/upgrade_163.rst","installation/upgrade_170.rst","installation/upgrade_171.rst","installation/upgrade_172.rst","installation/upgrade_200.rst","installation/upgrade_201.rst","installation/upgrade_202.rst","installation/upgrade_203.rst","installation/upgrade_210.rst","installation/upgrade_211.rst","installation/upgrade_212.rst","installation/upgrade_213.rst","installation/upgrade_214.rst","installation/upgrade_220.rst","installation/upgrade_221.rst","installation/upgrade_222.rst","installation/upgrade_223.rst","installation/upgrade_300.rst","installation/upgrade_301.rst","installation/upgrade_302.rst","installation/upgrade_303.rst","installation/upgrade_304.rst","installation/upgrade_305.rst","installation/upgrade_306.rst","installation/upgrade_310.rst","installation/upgrade_311.rst","installation/upgrade_312.rst","installation/upgrade_313.rst","installation/upgrade_314.rst","installation/upgrade_315.rst","installation/upgrade_316.rst","installation/upgrade_b11.rst","installation/upgrading.rst","libraries/benchmark.rst","libraries/caching.rst","libraries/calendar.rst","libraries/cart.rst","libraries/config.rst","libraries/email.rst","libraries/encrypt.rst","libraries/encryption.rst","libraries/file_uploading.rst","libraries/form_validation.rst","libraries/ftp.rst","libraries/image_lib.rst","libraries/index.rst","libraries/input.rst","libraries/javascript.rst","libraries/language.rst","libraries/loader.rst","libraries/migration.rst","libraries/output.rst","libraries/pagination.rst","libraries/parser.rst","libraries/security.rst","libraries/sessions.rst","libraries/table.rst","libraries/trackback.rst","libraries/typography.rst","libraries/unit_testing.rst","libraries/uri.rst","libraries/user_agent.rst","libraries/xmlrpc.rst","libraries/zip.rst","license.rst","overview/appflow.rst","overview/at_a_glance.rst","overview/features.rst","overview/getting_started.rst","overview/goals.rst","overview/index.rst","overview/mvc.rst","tutorial/conclusion.rst","tutorial/create_news_items.rst","tutorial/index.rst","tutorial/news_section.rst","tutorial/static_pages.rst"],objects:{"":{"CI_Benchmark::elapsed_time":[122,1,1,""],"CI_Benchmark::mark":[122,1,1,""],"CI_Benchmark::memory_usage":[122,1,1,""],"CI_Cache::cache_info":[123,1,1,""],"CI_Cache::clean":[123,1,1,""],"CI_Cache::decrement":[123,1,1,""],"CI_Cache::delete":[123,1,1,""],"CI_Cache::get":[123,1,1,""],"CI_Cache::get_metadata":[123,1,1,""],"CI_Cache::increment":[123,1,1,""],"CI_Cache::is_supported":[123,1,1,""],"CI_Cache::save":[123,1,1,""],"CI_Calendar::adjust_date":[124,1,1,""],"CI_Calendar::default_template":[124,1,1,""],"CI_Calendar::generate":[124,1,1,""],"CI_Calendar::get_day_names":[124,1,1,""],"CI_Calendar::get_month_name":[124,1,1,""],"CI_Calendar::get_total_days":[124,1,1,""],"CI_Calendar::initialize":[124,1,1,""],"CI_Calendar::parse_template":[124,1,1,""],"CI_Cart::contents":[125,1,1,""],"CI_Cart::destroy":[125,1,1,""],"CI_Cart::get_item":[125,1,1,""],"CI_Cart::has_options":[125,1,1,""],"CI_Cart::insert":[125,1,1,""],"CI_Cart::product_options":[125,1,1,""],"CI_Cart::remove":[125,1,1,""],"CI_Cart::total":[125,1,1,""],"CI_Cart::total_items":[125,1,1,""],"CI_Cart::update":[125,1,1,""],"CI_Config::base_url":[126,1,1,""],"CI_Config::item":[126,1,1,""],"CI_Config::load":[126,1,1,""],"CI_Config::set_item":[126,1,1,""],"CI_Config::site_url":[126,1,1,""],"CI_Config::slash_item":[126,1,1,""],"CI_Config::system_url":[126,1,1,""],"CI_DB_driver::affected_rows":[7,1,1,""],"CI_DB_driver::cache_delete":[7,1,1,""],"CI_DB_driver::cache_delete_all":[7,1,1,""],"CI_DB_driver::cache_off":[7,1,1,""],"CI_DB_driver::cache_on":[7,1,1,""],"CI_DB_driver::cache_set_path":[7,1,1,""],"CI_DB_driver::call_function":[7,1,1,""],"CI_DB_driver::close":[7,1,1,""],"CI_DB_driver::compile_binds":[7,1,1,""],"CI_DB_driver::count_all":[7,1,1,""],"CI_DB_driver::db_connect":[7,1,1,""],"CI_DB_driver::db_pconnect":[7,1,1,""],"CI_DB_driver::db_select":[7,1,1,""],"CI_DB_driver::db_set_charset":[7,1,1,""],"CI_DB_driver::display_error":[7,1,1,""],"CI_DB_driver::elapsed_time":[7,1,1,""],"CI_DB_driver::escape":[7,1,1,""],"CI_DB_driver::escape_identifiers":[7,1,1,""],"CI_DB_driver::escape_like_str":[7,1,1,""],"CI_DB_driver::escape_str":[7,1,1,""],"CI_DB_driver::field_data":[7,1,1,""],"CI_DB_driver::field_exists":[7,1,1,""],"CI_DB_driver::initialize":[7,1,1,""],"CI_DB_driver::insert_string":[7,1,1,""],"CI_DB_driver::is_write_type":[7,1,1,""],"CI_DB_driver::last_query":[7,1,1,""],"CI_DB_driver::list_fields":[7,1,1,""],"CI_DB_driver::list_tables":[7,1,1,""],"CI_DB_driver::platform":[7,1,1,""],"CI_DB_driver::primary":[7,1,1,""],"CI_DB_driver::protect_identifiers":[7,1,1,""],"CI_DB_driver::query":[7,1,1,""],"CI_DB_driver::reconnect":[7,1,1,""],"CI_DB_driver::simple_query":[7,1,1,""],"CI_DB_driver::table_exists":[7,1,1,""],"CI_DB_driver::total_queries":[7,1,1,""],"CI_DB_driver::trans_complete":[7,1,1,""],"CI_DB_driver::trans_off":[7,1,1,""],"CI_DB_driver::trans_start":[7,1,1,""],"CI_DB_driver::trans_status":[7,1,1,""],"CI_DB_driver::trans_strict":[7,1,1,""],"CI_DB_driver::update_string":[7,1,1,""],"CI_DB_driver::version":[7,1,1,""],"CI_DB_forge::add_column":[9,1,1,""],"CI_DB_forge::add_field":[9,1,1,""],"CI_DB_forge::add_key":[9,1,1,""],"CI_DB_forge::create_database":[9,1,1,""],"CI_DB_forge::create_table":[9,1,1,""],"CI_DB_forge::drop_column":[9,1,1,""],"CI_DB_forge::drop_database":[9,1,1,""],"CI_DB_forge::drop_table":[9,1,1,""],"CI_DB_forge::modify_column":[9,1,1,""],"CI_DB_forge::rename_table":[9,1,1,""],"CI_DB_query_builder::count_all_results":[14,1,1,""],"CI_DB_query_builder::dbprefix":[14,1,1,""],"CI_DB_query_builder::delete":[14,1,1,""],"CI_DB_query_builder::distinct":[14,1,1,""],"CI_DB_query_builder::empty_table":[14,1,1,""],"CI_DB_query_builder::flush_cache":[14,1,1,""],"CI_DB_query_builder::from":[14,1,1,""],"CI_DB_query_builder::get":[14,1,1,""],"CI_DB_query_builder::get_compiled_delete":[14,1,1,""],"CI_DB_query_builder::get_compiled_insert":[14,1,1,""],"CI_DB_query_builder::get_compiled_select":[14,1,1,""],"CI_DB_query_builder::get_compiled_update":[14,1,1,""],"CI_DB_query_builder::get_where":[14,1,1,""],"CI_DB_query_builder::group_by":[14,1,1,""],"CI_DB_query_builder::group_end":[14,1,1,""],"CI_DB_query_builder::group_start":[14,1,1,""],"CI_DB_query_builder::having":[14,1,1,""],"CI_DB_query_builder::insert":[14,1,1,""],"CI_DB_query_builder::insert_batch":[14,1,1,""],"CI_DB_query_builder::join":[14,1,1,""],"CI_DB_query_builder::like":[14,1,1,""],"CI_DB_query_builder::limit":[14,1,1,""],"CI_DB_query_builder::not_group_start":[14,1,1,""],"CI_DB_query_builder::not_like":[14,1,1,""],"CI_DB_query_builder::offset":[14,1,1,""],"CI_DB_query_builder::or_group_start":[14,1,1,""],"CI_DB_query_builder::or_having":[14,1,1,""],"CI_DB_query_builder::or_like":[14,1,1,""],"CI_DB_query_builder::or_not_group_start":[14,1,1,""],"CI_DB_query_builder::or_not_like":[14,1,1,""],"CI_DB_query_builder::or_where":[14,1,1,""],"CI_DB_query_builder::or_where_in":[14,1,1,""],"CI_DB_query_builder::or_where_not_in":[14,1,1,""],"CI_DB_query_builder::order_by":[14,1,1,""],"CI_DB_query_builder::replace":[14,1,1,""],"CI_DB_query_builder::reset_query":[14,1,1,""],"CI_DB_query_builder::select":[14,1,1,""],"CI_DB_query_builder::select_avg":[14,1,1,""],"CI_DB_query_builder::select_max":[14,1,1,""],"CI_DB_query_builder::select_min":[14,1,1,""],"CI_DB_query_builder::select_sum":[14,1,1,""],"CI_DB_query_builder::set":[14,1,1,""],"CI_DB_query_builder::set_dbprefix":[14,1,1,""],"CI_DB_query_builder::set_insert_batch":[14,1,1,""],"CI_DB_query_builder::set_update_batch":[14,1,1,""],"CI_DB_query_builder::start_cache":[14,1,1,""],"CI_DB_query_builder::stop_cache":[14,1,1,""],"CI_DB_query_builder::truncate":[14,1,1,""],"CI_DB_query_builder::update":[14,1,1,""],"CI_DB_query_builder::update_batch":[14,1,1,""],"CI_DB_query_builder::where":[14,1,1,""],"CI_DB_query_builder::where_in":[14,1,1,""],"CI_DB_query_builder::where_not_in":[14,1,1,""],"CI_DB_result::custom_result_object":[15,1,1,""],"CI_DB_result::custom_row_object":[15,1,1,""],"CI_DB_result::data_seek":[15,1,1,""],"CI_DB_result::field_data":[15,1,1,""],"CI_DB_result::first_row":[15,1,1,""],"CI_DB_result::free_result":[15,1,1,""],"CI_DB_result::last_row":[15,1,1,""],"CI_DB_result::list_fields":[15,1,1,""],"CI_DB_result::next_row":[15,1,1,""],"CI_DB_result::num_fields":[15,1,1,""],"CI_DB_result::num_rows":[15,1,1,""],"CI_DB_result::previous_row":[15,1,1,""],"CI_DB_result::result":[15,1,1,""],"CI_DB_result::result_array":[15,1,1,""],"CI_DB_result::result_object":[15,1,1,""],"CI_DB_result::row":[15,1,1,""],"CI_DB_result::row_array":[15,1,1,""],"CI_DB_result::row_object":[15,1,1,""],"CI_DB_result::set_row":[15,1,1,""],"CI_DB_result::unbuffered_row":[15,1,1,""],"CI_DB_utility::backup":[17,1,1,""],"CI_DB_utility::csv_from_result":[17,1,1,""],"CI_DB_utility::database_exists":[17,1,1,""],"CI_DB_utility::list_databases":[17,1,1,""],"CI_DB_utility::optimize_database":[17,1,1,""],"CI_DB_utility::optimize_table":[17,1,1,""],"CI_DB_utility::repair_table":[17,1,1,""],"CI_DB_utility::xml_from_result":[17,1,1,""],"CI_Email::attach":[127,1,1,""],"CI_Email::attachment_cid":[127,1,1,""],"CI_Email::bcc":[127,1,1,""],"CI_Email::cc":[127,1,1,""],"CI_Email::clear":[127,1,1,""],"CI_Email::from":[127,1,1,""],"CI_Email::message":[127,1,1,""],"CI_Email::print_debugger":[127,1,1,""],"CI_Email::reply_to":[127,1,1,""],"CI_Email::send":[127,1,1,""],"CI_Email::set_alt_message":[127,1,1,""],"CI_Email::set_header":[127,1,1,""],"CI_Email::subject":[127,1,1,""],"CI_Email::to":[127,1,1,""],"CI_Encrypt::decode":[128,1,1,""],"CI_Encrypt::encode":[128,1,1,""],"CI_Encrypt::encode_from_legacy":[128,1,1,""],"CI_Encrypt::set_cipher":[128,1,1,""],"CI_Encrypt::set_mode":[128,1,1,""],"CI_Encryption::create_key":[129,1,1,""],"CI_Encryption::decrypt":[129,1,1,""],"CI_Encryption::encrypt":[129,1,1,""],"CI_Encryption::hkdf":[129,1,1,""],"CI_Encryption::initialize":[129,1,1,""],"CI_FTP::changedir":[132,1,1,""],"CI_FTP::chmod":[132,1,1,""],"CI_FTP::close":[132,1,1,""],"CI_FTP::connect":[132,1,1,""],"CI_FTP::delete_dir":[132,1,1,""],"CI_FTP::delete_file":[132,1,1,""],"CI_FTP::download":[132,1,1,""],"CI_FTP::list_files":[132,1,1,""],"CI_FTP::mirror":[132,1,1,""],"CI_FTP::mkdir":[132,1,1,""],"CI_FTP::move":[132,1,1,""],"CI_FTP::rename":[132,1,1,""],"CI_FTP::upload":[132,1,1,""],"CI_Form_validation::error":[131,1,1,""],"CI_Form_validation::error_array":[131,1,1,""],"CI_Form_validation::error_string":[131,1,1,""],"CI_Form_validation::has_rule":[131,1,1,""],"CI_Form_validation::reset_validation":[131,1,1,""],"CI_Form_validation::run":[131,1,1,""],"CI_Form_validation::set_data":[131,1,1,""],"CI_Form_validation::set_error_delimiters":[131,1,1,""],"CI_Form_validation::set_message":[131,1,1,""],"CI_Form_validation::set_rules":[131,1,1,""],"CI_Image_lib::clear":[133,1,1,""],"CI_Image_lib::crop":[133,1,1,""],"CI_Image_lib::display_errors":[133,1,1,""],"CI_Image_lib::initialize":[133,1,1,""],"CI_Image_lib::resize":[133,1,1,""],"CI_Image_lib::rotate":[133,1,1,""],"CI_Image_lib::watermark":[133,1,1,""],"CI_Input::cookie":[135,1,1,""],"CI_Input::get":[135,1,1,""],"CI_Input::get_post":[135,1,1,""],"CI_Input::get_request_header":[135,1,1,""],"CI_Input::input_stream":[135,1,1,""],"CI_Input::ip_address":[135,1,1,""],"CI_Input::is_ajax_request":[135,1,1,""],"CI_Input::is_cli_request":[135,1,1,""],"CI_Input::method":[135,1,1,""],"CI_Input::post":[135,1,1,""],"CI_Input::post_get":[135,1,1,""],"CI_Input::request_headers":[135,1,1,""],"CI_Input::server":[135,1,1,""],"CI_Input::set_cookie":[135,1,1,""],"CI_Input::user_agent":[135,1,1,""],"CI_Input::valid_ip":[135,1,1,""],"CI_Lang::line":[137,1,1,""],"CI_Lang::load":[137,1,1,""],"CI_Loader::add_package_path":[138,1,1,""],"CI_Loader::clear_vars":[138,1,1,""],"CI_Loader::config":[138,1,1,""],"CI_Loader::database":[138,1,1,""],"CI_Loader::dbforge":[138,1,1,""],"CI_Loader::dbutil":[138,1,1,""],"CI_Loader::driver":[138,1,1,""],"CI_Loader::file":[138,1,1,""],"CI_Loader::get_package_paths":[138,1,1,""],"CI_Loader::get_var":[138,1,1,""],"CI_Loader::get_vars":[138,1,1,""],"CI_Loader::helper":[138,1,1,""],"CI_Loader::is_loaded":[138,1,1,""],"CI_Loader::language":[138,1,1,""],"CI_Loader::library":[138,1,1,""],"CI_Loader::model":[138,1,1,""],"CI_Loader::remove_package_path":[138,1,1,""],"CI_Loader::vars":[138,1,1,""],"CI_Loader::view":[138,1,1,""],"CI_Migration::current":[139,1,1,""],"CI_Migration::error_string":[139,1,1,""],"CI_Migration::find_migrations":[139,1,1,""],"CI_Migration::latest":[139,1,1,""],"CI_Migration::version":[139,1,1,""],"CI_Output::_display":[140,1,1,""],"CI_Output::append_output":[140,1,1,""],"CI_Output::cache":[140,1,1,""],"CI_Output::enable_profiler":[140,1,1,""],"CI_Output::get_content_type":[140,1,1,""],"CI_Output::get_header":[140,1,1,""],"CI_Output::get_output":[140,1,1,""],"CI_Output::set_content_type":[140,1,1,""],"CI_Output::set_header":[140,1,1,""],"CI_Output::set_output":[140,1,1,""],"CI_Output::set_profiler_sections":[140,1,1,""],"CI_Output::set_status_header":[140,1,1,""],"CI_Pagination::create_links":[141,1,1,""],"CI_Pagination::initialize":[141,1,1,""],"CI_Parser::parse":[142,1,1,""],"CI_Parser::parse_string":[142,1,1,""],"CI_Parser::set_delimiters":[142,1,1,""],"CI_Security::entity_decode":[143,1,1,""],"CI_Security::get_csrf_hash":[143,1,1,""],"CI_Security::get_csrf_token_name":[143,1,1,""],"CI_Security::get_random_bytes":[143,1,1,""],"CI_Security::sanitize_filename":[143,1,1,""],"CI_Security::xss_clean":[143,1,1,""],"CI_Session::__get":[144,1,1,""],"CI_Session::__set":[144,1,1,""],"CI_Session::all_userdata":[144,1,1,""],"CI_Session::flashdata":[144,1,1,""],"CI_Session::get_flash_keys":[144,1,1,""],"CI_Session::get_temp_keys":[144,1,1,""],"CI_Session::has_userdata":[144,1,1,""],"CI_Session::keep_flashdata":[144,1,1,""],"CI_Session::mark_as_flash":[144,1,1,""],"CI_Session::mark_as_temp":[144,1,1,""],"CI_Session::sess_destroy":[144,1,1,""],"CI_Session::sess_regenerate":[144,1,1,""],"CI_Session::set_flashdata":[144,1,1,""],"CI_Session::set_tempdata":[144,1,1,""],"CI_Session::set_userdata":[144,1,1,""],"CI_Session::tempdata":[144,1,1,""],"CI_Session::unmark_flash":[144,1,1,""],"CI_Session::unmark_temp":[144,1,1,""],"CI_Session::unset_userdata":[144,1,1,""],"CI_Session::userdata":[144,1,1,""],"CI_Table::add_row":[145,1,1,""],"CI_Table::clear":[145,1,1,""],"CI_Table::generate":[145,1,1,""],"CI_Table::make_columns":[145,1,1,""],"CI_Table::set_caption":[145,1,1,""],"CI_Table::set_empty":[145,1,1,""],"CI_Table::set_heading":[145,1,1,""],"CI_Table::set_template":[145,1,1,""],"CI_Trackback::convert_ascii":[146,1,1,""],"CI_Trackback::convert_xml":[146,1,1,""],"CI_Trackback::data":[146,1,1,""],"CI_Trackback::display_errors":[146,1,1,""],"CI_Trackback::extract_urls":[146,1,1,""],"CI_Trackback::get_id":[146,1,1,""],"CI_Trackback::limit_characters":[146,1,1,""],"CI_Trackback::process":[146,1,1,""],"CI_Trackback::receive":[146,1,1,""],"CI_Trackback::send":[146,1,1,""],"CI_Trackback::send_error":[146,1,1,""],"CI_Trackback::send_success":[146,1,1,""],"CI_Trackback::set_error":[146,1,1,""],"CI_Trackback::validate_url":[146,1,1,""],"CI_Typography::auto_typography":[147,1,1,""],"CI_Typography::format_characters":[147,1,1,""],"CI_Typography::nl2br_except_pre":[147,1,1,""],"CI_URI::assoc_to_uri":[149,1,1,""],"CI_URI::rsegment":[149,1,1,""],"CI_URI::rsegment_array":[149,1,1,""],"CI_URI::ruri_string":[149,1,1,""],"CI_URI::ruri_to_assoc":[149,1,1,""],"CI_URI::segment":[149,1,1,""],"CI_URI::segment_array":[149,1,1,""],"CI_URI::slash_rsegment":[149,1,1,""],"CI_URI::slash_segment":[149,1,1,""],"CI_URI::total_rsegments":[149,1,1,""],"CI_URI::total_segments":[149,1,1,""],"CI_URI::uri_string":[149,1,1,""],"CI_URI::uri_to_assoc":[149,1,1,""],"CI_Unit_test::active":[148,1,1,""],"CI_Unit_test::report":[148,1,1,""],"CI_Unit_test::result":[148,1,1,""],"CI_Unit_test::run":[148,1,1,""],"CI_Unit_test::set_template":[148,1,1,""],"CI_Unit_test::set_test_items":[148,1,1,""],"CI_Unit_test::use_strict":[148,1,1,""],"CI_Upload::data":[130,1,1,""],"CI_Upload::display_errors":[130,1,1,""],"CI_Upload::do_upload":[130,1,1,""],"CI_Upload::initialize":[130,1,1,""],"CI_User_agent::accept_charset":[150,1,1,""],"CI_User_agent::accept_lang":[150,1,1,""],"CI_User_agent::agent_string":[150,1,1,""],"CI_User_agent::browser":[150,1,1,""],"CI_User_agent::charsets":[150,1,1,""],"CI_User_agent::is_browser":[150,1,1,""],"CI_User_agent::is_mobile":[150,1,1,""],"CI_User_agent::is_referral":[150,1,1,""],"CI_User_agent::is_robot":[150,1,1,""],"CI_User_agent::languages":[150,1,1,""],"CI_User_agent::mobile":[150,1,1,""],"CI_User_agent::parse":[150,1,1,""],"CI_User_agent::platform":[150,1,1,""],"CI_User_agent::referrer":[150,1,1,""],"CI_User_agent::robot":[150,1,1,""],"CI_User_agent::version":[150,1,1,""],"CI_Xmlrpc::display_error":[151,1,1,""],"CI_Xmlrpc::display_response":[151,1,1,""],"CI_Xmlrpc::initialize":[151,1,1,""],"CI_Xmlrpc::method":[151,1,1,""],"CI_Xmlrpc::request":[151,1,1,""],"CI_Xmlrpc::send_error_message":[151,1,1,""],"CI_Xmlrpc::send_request":[151,1,1,""],"CI_Xmlrpc::server":[151,1,1,""],"CI_Xmlrpc::timeout":[151,1,1,""],"CI_Zip::add_data":[152,1,1,""],"CI_Zip::add_dir":[152,1,1,""],"CI_Zip::archive":[152,1,1,""],"CI_Zip::clear_data":[152,1,1,""],"CI_Zip::download":[152,1,1,""],"CI_Zip::get_zip":[152,1,1,""],"CI_Zip::read_dir":[152,1,1,""],"CI_Zip::read_file":[152,1,1,""],"Some_class::should_do_something":[18,1,1,""],"Some_class::some_method":[18,1,1,""],CI_Benchmark:[122,0,1,""],CI_Cache:[123,0,1,""],CI_Calendar:[124,0,1,""],CI_Cart:[125,0,1,""],CI_Config:[126,0,1,""],CI_DB_driver:[7,0,1,""],CI_DB_forge:[9,0,1,""],CI_DB_query_builder:[14,0,1,""],CI_DB_result:[15,0,1,""],CI_DB_utility:[17,0,1,""],CI_Email:[127,0,1,""],CI_Encrypt:[128,0,1,""],CI_Encryption:[129,0,1,""],CI_FTP:[132,0,1,""],CI_Form_validation:[131,0,1,""],CI_Image_lib:[133,0,1,""],CI_Input:[135,0,1,""],CI_Lang:[137,0,1,""],CI_Loader:[138,0,1,""],CI_Migration:[139,0,1,""],CI_Output:[140,0,1,""],CI_Pagination:[141,0,1,""],CI_Parser:[142,0,1,""],CI_Security:[143,0,1,""],CI_Session:[144,0,1,""],CI_Table:[145,0,1,""],CI_Trackback:[146,0,1,""],CI_Typography:[147,0,1,""],CI_URI:[149,0,1,""],CI_Unit_test:[148,0,1,""],CI_Upload:[130,0,1,""],CI_User_agent:[150,0,1,""],CI_Xmlrpc:[151,0,1,""],CI_Zip:[152,0,1,""],Some_class:[18,0,1,""],alternator:[66,2,1,""],anchor:[69,2,1,""],anchor_popup:[69,2,1,""],array_column:[25,2,1,""],ascii_to_entities:[67,2,1,""],auto_link:[69,2,1,""],auto_typography:[68,2,1,""],base_url:[69,2,1,""],br:[58,2,1,""],byte_format:[62,2,1,""],camelize:[60,2,1,""],character_limiter:[67,2,1,""],config_item:[24,2,1,""],convert_accented_characters:[67,2,1,""],create_captcha:[50,2,1,""],current_url:[69,2,1,""],date_range:[52,2,1,""],days_in_month:[52,2,1,""],delete_cookie:[51,2,1,""],delete_files:[56,2,1,""],directory_map:[53,2,1,""],do_hash:[64,2,1,""],doctype:[58,2,1,""],element:[49,2,1,""],elements:[49,2,1,""],ellipsize:[67,2,1,""],encode_php_tags:[64,2,1,""],entity_decode:[68,2,1,""],force_download:[54,2,1,""],form_button:[57,2,1,""],form_checkbox:[57,2,1,""],form_close:[57,2,1,""],form_dropdown:[57,2,1,""],form_error:[57,2,1,""],form_fieldset:[57,2,1,""],form_fieldset_close:[57,2,1,""],form_hidden:[57,2,1,""],form_input:[57,2,1,""],form_label:[57,2,1,""],form_multiselect:[57,2,1,""],form_open:[57,2,1,""],form_open_multipart:[57,2,1,""],form_password:[57,2,1,""],form_prep:[57,2,1,""],form_radio:[57,2,1,""],form_reset:[57,2,1,""],form_submit:[57,2,1,""],form_textarea:[57,2,1,""],form_upload:[57,2,1,""],function_usable:[24,2,1,""],get_clickable_smileys:[65,2,1,""],get_cookie:[51,2,1,""],get_dir_file_info:[56,2,1,""],get_file_info:[56,2,1,""],get_filenames:[56,2,1,""],get_instance:[20,2,1,""],get_mime_by_extension:[56,2,1,""],get_mimes:[24,2,1,""],gmt_to_local:[52,2,1,""],hash_equals:[25,2,1,""],hash_pbkdf2:[25,2,1,""],heading:[58,2,1,""],hex2bin:[25,2,1,""],highlight_code:[67,2,1,""],highlight_phrase:[67,2,1,""],html_escape:[24,2,1,""],human_to_unix:[52,2,1,""],humanize:[60,2,1,""],img:[58,2,1,""],increment_string:[66,2,1,""],index_page:[69,2,1,""],is_cli:[24,2,1,""],is_countable:[60,2,1,""],is_https:[24,2,1,""],is_php:[24,2,1,""],is_really_writable:[24,2,1,""],lang:[61,2,1,""],link_tag:[58,2,1,""],local_to_gmt:[52,2,1,""],log_message:[33,2,1,""],mailto:[69,2,1,""],mb_strlen:[25,2,1,""],mb_strpos:[25,2,1,""],mb_substr:[25,2,1,""],mdate:[52,2,1,""],meta:[58,2,1,""],mysql_to_unix:[52,2,1,""],nbs:[58,2,1,""],nice_date:[52,2,1,""],nl2br_except_pre:[68,2,1,""],now:[52,2,1,""],octal_permissions:[56,2,1,""],ol:[58,2,1,""],parse_smileys:[65,2,1,""],password_get_info:[25,2,1,""],password_hash:[25,2,1,""],password_needs_rehash:[25,2,1,""],password_verify:[25,2,1,""],plural:[60,2,1,""],prep_url:[69,2,1,""],quotes_to_entities:[66,2,1,""],random_element:[49,2,1,""],random_string:[66,2,1,""],read_file:[56,2,1,""],redirect:[69,2,1,""],reduce_double_slashes:[66,2,1,""],reduce_multiples:[66,2,1,""],remove_invisible_characters:[24,2,1,""],repeater:[66,2,1,""],safe_mailto:[69,2,1,""],sanitize_filename:[64,2,1,""],send_email:[55,2,1,""],set_checkbox:[57,2,1,""],set_cookie:[51,2,1,""],set_radio:[57,2,1,""],set_realpath:[63,2,1,""],set_select:[57,2,1,""],set_status_header:[24,2,1,""],set_value:[57,2,1,""],show_404:[33,2,1,""],show_error:[33,2,1,""],singular:[60,2,1,""],site_url:[69,2,1,""],smiley_js:[65,2,1,""],standard_date:[52,2,1,""],strip_image_tags:[64,2,1,""],strip_quotes:[66,2,1,""],strip_slashes:[66,2,1,""],symbolic_permissions:[56,2,1,""],timespan:[52,2,1,""],timezone_menu:[52,2,1,""],timezones:[52,2,1,""],trim_slashes:[66,2,1,""],ul:[58,2,1,""],underscore:[60,2,1,""],unix_to_human:[52,2,1,""],uri_string:[69,2,1,""],url_title:[69,2,1,""],valid_email:[55,2,1,""],validation_errors:[57,2,1,""],word_censor:[67,2,1,""],word_limiter:[67,2,1,""],word_wrap:[67,2,1,""],write_file:[56,2,1,""],xml_convert:[70,2,1,""],xss_clean:[64,2,1,""]}},objnames:{"0":["php","class","PHP class"],"1":["php","method","PHP method"],"2":["php","function","PHP function"]},objtypes:{"0":"php:class","1":"php:method","2":"php:function"},terms:{"001_add_blog":139,"0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz":50,"0script":24,"0x7f":1,"10px":57,"12c":1,"14t16":52,"15t16":52,"20121031100537_add_blog":139,"24s":1,"2nd":1,"3g2":1,"3gp":1,"3rd":1,"404_overrid":[1,43],"404s":1,"50off":125,"7zip":1,"abstract":[1,11,16,41,45,164],"boolean":[1,5,6,7,12,13,17,24,39,43,45,47,52,53,54,56,57,58,69,76,80,82,106,124,125,127,129,130,131,132,133,135,138,141,142,143,144,146,147,148,150,151,152],"break":[1,14,57,58,68,90,102,106,112,131,144,145,147,165],"byte":[1,40,45,62,129,143],"case":[1,5,9,14,15,16,17,20,24,26,27,28,29,34,37,43,44,45,46,55,56,57,60,67,69,73,92,106,109,123,125,128,129,130,131,132,133,135,137,138,140,142,143,144,151,162],"catch":[1,43,45],"class":[1,2,5,6,7,10,11,16,18,21,23,30,31,32,33,34,35,36,37,39,42,43,46,47,52,55,57,58,61,65,71,81,82,90,95,102,116,120,134,155,156,157,158,160,161,162,164,165],"default":[1,2,5,6,9,10,14,15,16,17,27,33,34,38,40,42,43,46,47,49,50,52,53,56,57,58,64,67,69,73,74,76,80,82,85,86,92,93,98,106,112,120,123,124,125,126,127,128,130,131,132,133,135,136,137,138,139,140,141,143,144,145,146,148,149,152,155,158,162,165],"enum":1,"export":1,"final":[1,26,35,67,106,122,136,140,154,163],"float":[62,67],"function":[1,2,5,6,7,8,10,11,12,13,14,15,16,18,20,23,26,27,29,33,35,36,39,43,44,46,47,71,72,73,76,90,93,112,113,116,122,124,125,126,128,129,130,131,132,133,135,136,137,138,139,140,141,143,144,145,146,147,148,150,151,152,156,158,160,162,163,164,165],"import":[19,29,44,81,128,129,144,155,161],"int":[1,7,9,14,15,18,24,25,33,50,51,52,53,56,58,62,66,67,122,123,124,125,127,128,129,132,135,139,140,143,144,145,146,149,151,164],"long":[1,9,25,34,38,45,50,124,127,129,135,144],"new":[1,2,3,9,13,14,17,26,27,29,34,44,45,46,47,52,67,69,71,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,99,100,106,109,112,120,123,124,126,127,128,130,131,132,133,135,139,141,142,144,149,150,151,152,155,163,165],"null":[1,7,9,14,15,24,25,49,50,51,52,54,65,68,69,90,98,115,123,125,126,127,129,130,132,135,138,139,140,143,144,145,146,149,150,152,164],"public":[0,1,2,5,14,15,20,23,26,27,29,39,45,47,58,65,72,73,106,129,130,131,139,144,151,162,164,165],"return":[1,6,7,8,9,10,12,13,14,15,17,18,20,23,24,25,26,28,29,33,34,39,43,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,93,122,123,124,125,126,127,128,129,130,131,132,133,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,162,164],"ros\u00e9n":1,"short":[1,2,82,106,124,133,144],"static":[1,22,71,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,163,164],"super":[1,20,29,45,128,138,151,165],"switch":[1,5,6,7,45,106,119,129,131],"throw":1,"true":[1,5,6,7,9,12,13,14,15,16,17,18,21,24,25,33,34,35,39,40,46,47,50,52,53,54,55,56,57,58,60,63,65,66,69,76,80,82,86,106,109,116,123,124,125,126,127,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,162],"try":[1,5,13,14,34,43,44,45,47,54,56,74,120,126,132,135,144,156,157,165],"var":[1,24,45,123,138,144],"void":[1,7,15,24,33,51,54,69,122,125,126,133,135,137,140,142,144,146,148,150,151,152],"while":[1,5,6,14,15,18,19,32,33,43,45,53,56,67,72,106,113,125,127,129,131,133,135,139,144,151,157],AES:129,AND:[1,10,13,14,16,45,50,90,153],ANDs:14,ARE:3,Added:1,Adding:[57,138],And:[45,47,81,129,144],BUT:153,Being:25,But:[45,144,165],CMS:133,CVS:1,DES:129,DoS:[1,44],Doing:18,FOR:153,For:[1,2,3,4,5,6,7,8,9,14,17,18,23,25,26,27,29,31,32,33,34,35,37,38,39,43,44,45,46,47,52,55,57,64,65,66,67,68,69,73,76,81,82,98,102,106,109,112,123,124,125,126,127,128,129,131,133,135,136,137,138,139,140,141,144,146,148,149,151,155,165],Has:13,IDEs:[1,45],IDs:1,IIS:[1,69],INTO:[1,8,10,13,14],Its:[48,155],NOT:[1,3,7,9,13,14,16,17,27,29,33,34,39,40,41,43,44,50,56,66,79,80,90,98,106,115,125,127,129,130,133,135,141,143,144,145,146,153,164],NOTs:14,Not:[1,7,12,15,17,29,44,92,106,135,151],ORs:14,OSes:135,One:[2,57,73,106,109,151],Such:129,THAT:144,THE:[80,153],THEN:14,TLS:[1,127],TNS:1,That:[2,13,14,47,58,73,106,125,129,131,133,144],The:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,21,22,23,24,26,27,28,30,31,33,34,35,38,39,40,42,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,66,67,68,69,70,76,77,78,79,80,81,82,83,94,96,102,108,112,115,116,119,120,122,123,124,126,127,128,129,132,133,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,152,154,155,156,157,158,159,160,162,163,164,165],Then:[5,18,23,26,47,50,127,130,131,132,133,139,141],There:[2,6,9,14,15,23,32,33,34,35,43,45,47,58,67,79,106,120,124,126,127,129,131,133,135,136,137,142,144,147,150,151,162],These:[1,2,5,12,24,33,44,46,58,106,125,126,131,133,136,137,138,142,145],USE:[1,153],USING:1,Use:[1,2,13,15,45,52,56,57,58,64,66,106,123,125,127,133,143,144,161],Used:[5,9,136,143],Useful:[7,14,54,66,67,127,130,135,143],Uses:120,Using:[1,2,23,26,36,47,71,130,141,149,165],WILL:25,WITH:[17,153],Was:33,Will:[9,64,67,123,127,138,146],With:[1,14,19,43,45,106,135,144,164],XTS:129,Yes:[129,131,155],__ci_var:144,__construct:[1,20,26,27,29,39,45,93,130,144,164],__get:[1,15,144],__set:[1,15,144],_after:9,_applic:[98,123],_assign_to_config:1,_backup:1,_base_class:1,_blank:69,_call_hook:1,_ci:1,_ci_:1,_ci_autoload:1,_ci_class:1,_ci_load:1,_ci_view_fil:1,_clean_input_data:1,_clean_input_kei:1,_compile_queri:1,_convert_text:45,_cooki:[1,44,106,135],_create_databas:[1,93],_create_t:1,_csrf_set_hash:1,_data_seek:1,_detect_uri:1,_displai:[1,35,140],_display_cach:[1,35],_drop_databas:[1,93],_end:122,_env:1,_error_handl:[1,42],_error_messag:1,_error_numb:1,_escape_identifi:1,_exception_handl:[1,42],_execut:1,_explode_seg:1,_fetch_from_arrai:1,_fetch_uri_str:1,_file:1,_file_mime_typ:1,_filter_uri:1,_get:[1,44,106,135],_get_config:1,_get_ip:1,_get_mod_tim:1,_has_oper:1,_helper:138,_html_entity_decode_callback:1,_insert_batch:1,_is_ascii:1,_lang:137,_object_to_arrai:1,_output:[1,26],_parse_argv:1,_parse_cli_arg:1,_parse_query_str:1,_parse_request_uri:1,_pi:1,_plugin:1,_post:[1,39,40,44,45,49,50,57,106,135],_prep_filenam:1,_prep_q_encod:1,_prep_quoted_print:1,_protect_identifi:1,_reindex_seg:1,_remap:[23,26],_remove_evil_attribut:1,_remove_invisible_charact:1,_remove_url_suffix:1,_request:44,_sanitize_glob:1,_server:[1,32,106,109,135,144],_session:[1,106,144],_set_head:1,_set_overrid:1,_set_uri_str:1,_start:122,_stringify_attribut:42,_thumb:133,_trans_depth:1,_truncat:1,_unseri:1,_update_batch:1,_util:26,_version:1,_write_cach:26,a_filter_uri:1,a_long_link_that_should_not_be_wrap:127,aac:1,abbrevi:[124,133,137],abid:73,abil:[1,20,34,45,129,135],abl:[1,15,24,29,40,43,45,55,129,131,136,146,161],abort:[1,33,140],about:[1,2,7,14,16,23,25,26,33,43,44,47,50,52,67,106,124,129,130,131,148,149,150,151,156,161,162,165],abov:[1,2,5,6,8,9,10,13,14,15,17,19,20,22,26,27,29,34,35,39,40,41,43,46,47,49,52,56,57,58,65,66,67,69,73,86,106,122,123,124,125,126,127,128,129,130,131,133,135,136,138,141,142,144,145,146,147,148,151,152,153,162,164],abr:124,abridg:52,absent:[122,164],absolut:[1,5,57,63,129,130,132,133,144],abus:1,ac3:1,accent:[1,67],accept:[1,2,5,7,9,14,15,24,43,44,45,50,52,57,58,66,69,94,106,124,127,129,131,135,136,142,143,144,145,146,150,151,165],accept_charset:[1,150],accept_lang:[1,150],access:[1,3,4,5,8,9,14,15,17,20,24,26,29,31,39,40,43,44,45,46,48,56,65,69,72,73,95,106,123,126,128,129,137,138,139,151,155,165],accident:1,accompani:106,accomplish:[9,151],accord:[131,151],account:[1,26,48,52,135],accur:[1,19,26,56,122,150],accuraci:1,achiev:[15,22,26,106,144],acquir:[30,56,144],acronym:1,across:[32,106,129],act:[1,24,47,51,106,135,138,143,151,165],action:[1,12,14,18,23,26,35,43,57,94,125,130,131,133,136,143,153],activ:[1,10,14,46,52,93,106,122,125,144,148,155],active_group:[5,86,106],active_r:[1,76,86],active_record:[1,86,106],actual:[1,24,25,33,41,43,50,54,55,63,106,129,136,137,141,142,144,165],adapt:[7,14,123],add:[1,2,5,6,7,9,13,14,15,17,18,21,26,27,29,34,43,46,47,50,57,58,60,62,66,67,69,74,76,80,81,82,88,90,96,98,106,108,123,124,125,126,127,130,131,132,133,135,136,137,138,141,142,143,144,145,146,148,149,150,151,152,162,163,164,165],add_column:[1,9],add_data:152,add_dir:152,add_drop:17,add_field:[1,9,139],add_insert:17,add_kei:[1,9,139],add_package_path:138,add_row:145,add_suffix:137,added:[1,3,4,5,9,14,29,46,47,56,57,58,67,69,88,93,106,120,125,127,129,131,133,135,138,141,145,146,149,152,160],adding:[1,6,9,14,21,34,39,106,131,137,138,141,152,162,164],addit:[1,9,15,32,33,43,45,46,49,57,61,65,73,96,106,122,124,125,127,129,131,133,136,137,140,144,150,151,155],addition:[1,9,21,37,45,58,106,126,135,138,144],address:[1,2,32,55,57,58,69,106,109,127,131,135,137,144,146,151],address_info:57,addressbook:155,adher:[45,48],adjust:133,adjust_d:124,admin:[17,106],adodb:16,advanc:[1,45,106,163],advantag:[9,24,29,45,57,128,135,144,157,161],advertis:1,advic:44,advis:[13,41,69,129,144],advisori:[106,144],aes:129,affect:[1,7,10,14,16,22,32,43,45,106,115,136],affected_row:[1,7,8,10,14],afghanistan:52,africa:52,after:[1,3,9,14,15,19,20,26,35,40,43,57,66,73,74,129,131,141,144,145,148,151,162],afterward:[1,129,130],again:[2,131,136,138,144,165],against:[1,14,64,129,138,139,146],age:14,agent:[1,44,71,96,97,106,127,130,134,135,156],agent_str:150,aggreg:7,aging:106,agnost:7,agre:0,agreement:[71,155],ahead:15,aid:1,aim:[106,129],air:145,ajax:[1,135,136,143,144],ak_my_design:67,alaska:52,albeit:49,albert:49,aleutian:52,algo:25,algorithm:[1,25,44,64,93,128],alia:[1,2,7,14,15,24,51,52,57,64,65,66,68,69,106,124,135,138,140,144],alias:[1,7,43,66,106],align:[125,133],aliv:1,all:[0,1,2,4,5,7,8,12,14,15,16,17,19,20,23,26,27,29,31,32,33,34,35,37,38,40,43,45,46,51,55,56,57,58,67,69,70,76,80,81,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,123,125,126,127,128,129,130,131,132,133,135,136,137,138,139,141,144,145,146,148,151,152,153,157,161,162,164,165],all_userdata:[1,144],allman:[2,45],allow:[1,3,5,10,14,15,16,17,19,26,27,29,43,44,45,52,56,57,62,65,66,69,76,79,80,82,106,109,113,123,124,125,126,129,130,131,133,135,138,139,141,142,143,144,145,146,148,149,151,155,158],allow_get_arrai:[1,135],allowed_domain:[106,109],allowed_fil:1,allowed_typ:[1,130],almost:[53,129,144,149],alnum:66,along:[1,18,126,130,131,133,140,151],alpha:[1,44,66,125,131,135],alpha_dash:131,alpha_numer:131,alpha_numeric_spac:[1,131],alphabet:131,alphanumer:1,alreadi:[1,2,9,12,14,15,17,106,108,127,129,131,136,137,138,139,140,142,144,146,148,152],also:[1,2,3,5,7,9,13,14,15,16,17,18,19,23,24,25,26,29,31,32,33,35,40,43,44,45,46,47,51,52,56,57,65,66,69,72,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,97,99,100,106,109,112,123,125,127,129,130,131,132,135,136,137,138,139,140,141,143,144,145,146,149,150,151,152,160,164,165],alt:[1,58,127],alt_path:137,alter:[1,9,27,90,96,98,106,115,132,139,143,144],alter_t:1,altern:[1,25,26,32,36,45,47,57,58,66,71,74,106,112,122,126,127,130,131,132,136,137,141,144,145],although:[1,13,22,34,48,106,129,131,141,155],altogeth:106,alwai:[1,2,9,13,18,23,25,26,29,43,44,45,53,56,57,95,106,109,113,122,123,126,129,135,136,144,149,150],amend:1,among:[1,125,144,150],amount:[14,16,22,40,48,122,125,131,133,140,155],amount_paid:14,amp:70,ampersand:70,anchor:[1,34,69,106,130,131,136],anchor_class:[1,141],anchor_popup:[1,69],ancillari:[36,71],andretti:49,android:1,angl:133,angri:58,ani:[1,2,3,4,6,7,12,13,14,16,18,20,22,24,26,27,29,31,33,34,35,40,42,43,44,45,46,49,50,52,56,57,61,65,66,69,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,94,95,96,97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,122,124,125,127,129,130,131,133,135,136,137,138,139,140,143,144,145,146,148,152,153,154,157,160,162,164,165],annoi:58,announc:30,anonym:[1,131],anoth:[1,9,14,16,17,19,20,26,44,106,119,126,127,129,130,131,138,144,150,151,152],another_field:[9,106],another_mark_end:122,another_mark_start:122,another_method:31,another_nam:144,another_t:3,anoym:35,answer:[3,66],any_in_arrai:34,anybodi:144,anymor:1,anyth:[1,2,5,38,43,44,57,69,106,122,125,128,129,143,144,156,158,165],anywai:[1,106,112,115,129],anywher:[22,34,40,122,140],apach:[1,32,46,130,135],apache2:63,apache_request_head:135,apantbyigi1bpvxztjgcsag8gzl8pdwwa84:128,apart:20,apc:1,api:[1,32,129,136,143,151],apostroph:147,app:[122,156],appear:[1,22,43,46,50,52,67,68,76,124,129,131,133,136,147,151],append:[1,5,47,57,66,69,126,127,130,140,141],append_output:[1,140],appli:[1,2,7,43,44,45,51,106,131,133,135,144,145],applic:[1,3,5,6,7,14,21,22,23,24,26,27,28,29,32,33,34,35,36,39,41,42,43,44,45,46,47,48,51,58,65,67,69,71,73,74,76,79,80,81,82,85,86,88,90,92,94,95,96,97,106,107,109,116,119,120,123,125,126,127,128,129,130,131,132,135,136,137,139,140,141,143,144,148,150,151,156,157,159,160,162,163,164,165],application_config:45,application_fold:[38,73,112],applicationconfig:45,apppath:[1,42,56,138,139,165],approach:[2,33,39,44,46,131,148,155,160],appropri:[0,1,7,10,14,33,45,62,129,141,144,151,165],approv:[137,143],approxim:128,appver:1,april:1,ar_cach:1,arandom:25,arbitrari:[1,5,13,122,151],arbitrarili:131,arcfour:129,architectur:[28,71,159,163],archiv:[1,106,152,164],archive_filepath:152,area:[43,65,133],aren:[1,108,131],arg:[66,145],argentina:52,argument:[1,14,23,63,66,69,106,131,137,140,141,162,165],aris:153,around:[1,7,13,45,57,65,123,131],arr:45,arrai:[1,5,6,7,9,10,12,13,14,17,18,21,24,25,26,29,34,35,37,39,40,43,44,45,47,50,51,52,53,56,57,58,59,61,65,66,67,69,71,81,85,86,96,106,109,120,123,124,125,126,127,129,130,132,133,135,136,137,138,139,140,141,142,143,144,145,146,148,149,150,152,162,164,165],array_column:[1,25],array_item:144,array_pop:34,array_replac:1,array_replace_recurs:1,articl:[7,23,46,69,124,144,155,164],asc:14,ascii:[1,24,50,67,132,146],ascii_to_ent:[1,67],ask:[1,2],asp:69,aspect:[1,124,133],assembl:14,asset:[44,46],assign:[1,9,13,14,15,17,20,29,34,39,47,122,126,127,129,130,137,138,144,164,165],assist:[1,18,33,34,44,49,50,51,53,55,56,57,58,61,66,67,69,70],assoc_to_uri:149,associ:[1,3,7,9,10,12,14,15,17,24,26,35,50,51,57,58,69,106,124,125,129,135,136,138,142,144,145,146,149,153],assort:1,assum:[1,3,5,7,13,14,16,38,57,65,76,77,78,79,80,81,82,83,106,124,126,127,128,129,131,141,165],assumpt:158,asynchron:143,atlant:52,atom:[1,52,123],att:69,attach:[1,127,148,156],attachment_cid:[1,127],attack:[1,44,129,130,135,143,144,162],attempt:[1,24,26,27,44,69,123,135,143,150],attent:[1,156],attribut:[1,9,15,24,52,56,57,58,61,69,106,125,143,145],audio:1,aug:52,august:1,australia:52,australian:52,auth:[1,43],authent:[1,144,151],author:[1,5,13,45,125,153],author_id:10,auto:[1,6,16,36,69,71,81,86,106,109,120,129,130,132,133,144,145],auto_clear:127,auto_head:1,auto_incr:[1,9,50,139,146,164],auto_link:[1,69],auto_typographi:[1,68,147],autocommit:1,autoinit:1,autoload:[1,6,21,34,39,126,136,137],automat:[1,2,3,4,7,8,9,10,13,14,15,16,18,21,26,27,33,34,39,40,43,44,54,57,64,69,79,95,106,109,112,122,123,124,125,126,127,130,131,132,133,135,136,138,139,140,141,142,143,144,145,146,149],autonom:[7,158],avail:[1,3,12,14,15,17,20,24,25,26,29,32,33,34,35,37,39,40,45,48,72,93,106,112,116,119,122,123,124,125,127,128,129,130,131,132,133,135,136,138,139,142,143,144,145,146,147,148,150,151,152,164],averag:14,avg:[1,14],avoid:[1,45,57,106,115,123,126,127,130,131,135,137,144,149],awai:133,awar:[1,18],awesom:165,awhil:1,axi:133,azerbaijan:52,azor:52,b99ccdf16028f015540f341130b6d8ec:125,back:[1,3,7,16,17,25,43,106,109,123,129,131,139,141,143,151,155,162,164],backend:[1,120,123],background:[1,50,67,106,144],backport:25,backslash:43,backtick:[1,13],backtrac:1,backtrack:1,backtrack_limit:1,backup:[1,23,108,123,152],backward:[1,15,26,55,65,93,106,125,128,135,136,139,144],bad:[1,39,67,106,112,129,151],bad_dat:52,bad_filenam:1,bag:45,baker:52,balanc:14,bangladesh:52,banner:1,bar:[18,20,22,29,38,43,45,123,131,132,138,140,141,144],base64:[44,129,131,151],base:[0,1,2,3,4,7,8,9,14,16,17,23,27,30,32,35,39,46,52,54,56,57,58,62,66,69,72,73,76,106,109,124,125,126,127,129,130,131,132,133,135,137,144,145,146,149,151,154,155,156,160],base_url:[1,20,29,69,94,126,141],basepath:[1,29,42,76,124,138,139],basi:[1,22],basic11:58,basic:[1,14,16,29,32,39,44,58,66,127,144,146,151,155,157,161,163,164,165],basketbal:131,bat:[18,45],batch:[1,14,127],batch_siz:[1,14],baz:45,bcc:[1,127],bcc_batch_mod:[1,127],bcc_batch_siz:127,bcrypt:44,bdb:16,becaus:[1,7,13,14,16,22,24,25,26,41,42,43,57,69,106,113,125,126,128,129,131,135,143,144,146,161,164],becom:[34,45,46,69,124,127,129,133,138,141,143,145,158,165],bed:49,been:[1,2,3,7,9,14,15,24,33,35,47,52,64,76,93,94,95,96,97,98,106,108,115,128,131,135,136,137,138,139,140,144,145,164],beep:67,beer:35,befor:[1,2,6,12,13,14,22,26,27,34,35,45,47,50,65,69,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,122,125,128,129,131,133,136,140,141,144,146,148,151,154,162,164,165],beforehand:1,begin:[1,14,22,45,65,66,72,73,131,163],beginn:129,behavior:[1,26,33,47,53,69,94,106,135,138,143,144],behaviour:[1,106,127],behind:[133,159],beij:52,being:[1,3,4,7,14,22,23,24,26,29,31,33,35,43,44,45,57,68,69,79,106,122,123,125,129,131,132,135,138,144,145,147,151,152,160,165],believ:144,belong:106,below:[1,3,6,8,9,14,15,16,18,27,29,33,34,35,39,40,44,46,47,50,52,57,65,67,92,113,124,125,126,127,129,130,131,133,136,138,144,145,151,164],benchmark:[1,26,27,35,53,71,123,134,140,156,158],benefici:3,benefit:[13,14,16,31,45,52,57,131],best:[0,13,69,73,125,143,144,157],beta:121,better:[1,2,20,27,29,34,45,129,155],better_d:52,between:[1,4,5,14,16,22,24,29,32,43,44,45,60,66,122,127,131,133,142,152,155,160],bevel:136,beyond:[14,158],bhutan:52,bia:144,big:1,bigger:50,bigint:[1,50,144],bill:66,bin2hex:129,bin:133,binari:[1,25,129,132,143,152],bind:[1,7,50,53,113],bird:122,bit:[1,2,7,18,106,128,129,144,155],bitbucket:1,bite:136,black:50,blackberri:1,blank:[1,17,35,45,69,80,81,127,131,133,135,138],blaze:144,bleed:30,blindli:1,blob:[106,144],block:[1,2,18,19,40,45,46,142,144,145,147,155],blog:[3,14,26,34,39,43,47,65,69,132,138,139,142,146],blog_author:9,blog_config:126,blog_control:39,blog_descript:[9,139],blog_entri:142,blog_head:142,blog_id:[9,139],blog_id_site_id:9,blog_label:9,blog_model:39,blog_nam:[9,146],blog_name_blog_label:9,blog_set:126,blog_templ:142,blog_titl:[9,139,142],blogger:151,blogview:47,blowfish:129,blown:[142,148],blue:[35,58,131,132,145],blur:136,bodi:[1,14,15,47,55,65,127,130,131,142,165],boldlist:58,bom:45,bonu:29,bool:[7,9,14,15,17,18,24,25,33,49,51,52,53,54,55,56,57,58,60,63,64,65,66,68,69,70,123,125,126,127,130,131,132,133,135,136,137,138,140,142,143,144,145,146,147,148,150,151,152],boost:3,bootstrap:1,border:[1,50,124,125,145,148],born:152,borrow:30,bortoli:1,boss:14,bot:[69,150],both:[1,2,9,11,14,17,18,20,24,65,69,73,106,109,125,128,129,131,133,135,144,149,151,152],bottom:[1,40,52,76,133,136,140,165],bounc:136,bound:113,boundari:1,box:[44,57,129,144],brace:[19,45,142,147],bracket:[1,35,131],branch:72,brand:150,brazil:52,breach:1,brief:[129,130],bring:[30,93],british:[30,153],broad:[48,159],broke:[1,2],broken:[1,31,44,127],brows:[34,125,144,150],browser:[1,22,23,26,32,35,44,47,51,54,67,69,73,81,106,122,133,135,138,140,142,143,144,150,154,162,164,165],bsc:142,buffer:[1,45,81,127],bufferedtext:45,bug:[2,24,106],bui:125,build:[3,5,14,18,26,33,38,43,46,48,56,69,73,106,133,140,143,151,155,157,160],build_str:45,builder:[1,6,7,11,13,39,71,106,131,138,144,156,162,163,164],built:[57,69,130,135,165],bunch:106,bundl:[18,144],buonopan:1,burn:49,button:[1,57,131],bypass:[1,154],byte_format:[1,62],cach:[1,5,6,7,11,23,26,35,36,58,68,71,93,134,138,140,144,147,152,154,156],cache_delet:7,cache_delete_al:7,cache_expir:26,cache_info:123,cache_item_id:123,cache_off:7,cache_on:[5,6,7,82,144],cache_overrid:35,cache_query_str:1,cache_set_path:7,cachedir:[1,5,6,82],cal_cel_oth:124,cal_cell_blank:124,cal_cell_cont:124,cal_cell_content_todai:124,cal_cell_end:124,cal_cell_end_oth:124,cal_cell_end_todai:124,cal_cell_no_cont:124,cal_cell_no_content_todai:124,cal_cell_oth:124,cal_cell_start:124,cal_cell_start_oth:124,cal_cell_start_todai:124,cal_days_in_month:[1,52],cal_novemb:1,cal_row_end:124,cal_row_start:124,calcul:[1,7,122,133],calendar:[1,71,93,134,138,156],calendar_lang:120,call:[1,2,3,7,9,11,12,14,15,16,20,23,29,30,31,33,34,38,39,40,43,45,46,47,56,57,65,66,69,71,81,94,106,122,123,125,126,127,129,130,132,133,135,136,137,138,139,140,141,142,144,145,146,151,152,162,164,165],call_funct:7,call_hook:1,call_user_func_arrai:26,callabl:1,callback:[1,136],callback_:131,callback_foo:131,callback_username_check:131,cambodia:52,came:44,camel:60,camelcas:45,camellia:129,camin:1,camino:150,can:[1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,29,31,32,33,34,35,37,38,39,40,43,44,45,46,47,49,50,51,52,53,54,56,57,58,65,66,67,68,69,73,76,81,82,96,106,109,112,113,116,119,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,154,155,160,161,162,163,164,165],cancel:[14,151],cannot:[1,2,5,7,9,13,34,42,63,72,129,144],cap:[1,50],capabl:[1,46,158],cape:52,capit:[26,29,39,45,60,106,165],captal:1,captcha:[1,59,71,93],captcha_id:50,captcha_tim:50,caption:[1,145],card:[125,128,129],care:[6,7,26,29,42,123,129,132,135,144,162],carefulli:[3,90,128,129],caribbean:52,cart:[1,71,134],cascad:[1,138],cast5:129,cast:[1,45,129],cat:122,catalog:43,categori:[34,45],caus:[1,7,16,29,32,33,35,43,45,57,63,67,106,127,130,136,144,152],caution:[1,129],cautious:128,caveat:144,cbc:[1,129],cdr:1,cell:[1,145],cell_alt_end:145,cell_alt_start:145,cell_end:145,cell_start:145,cellpad:[124,125,145,148],cellspac:[124,125,145,148],censor:67,center:[133,165],central:52,ceo:30,cer:1,cert:1,certain:[1,2,3,5,14,18,21,25,26,44,46,76,106,136],certainli:[106,129],certif:[2,5,71],certifi:[0,2],certificat:5,cfb8:129,cfb:129,cfg:1,cgi:1,chain:[1,7,9,124,127,128,129,130,131,138,140,141,145],challeng:155,chanc:[49,106,144],chang:[2,3,6,7,9,13,22,33,34,45,46,47,57,60,65,69,71,73,74,76,80,81,86,93,94,95,98,102,109,112,115,120,125,126,128,129,132,135,136,138,139,144,150,165],changedir:132,changelog:[1,2],channel:1,char_set:[1,5,6,9,86],charact:[1,5,7,9,13,17,18,24,25,43,44,45,52,56,57,58,66,67,68,69,70,80,85,98,106,127,128,129,131,133,135,140,143,144,146,147,150,162],character_limit:[1,67],characterist:129,characterss:146,charcter:129,charg:153,charlim:67,charset:[1,7,25,57,58,68,94,127,138,140,143,146,150],chart:[71,159],chatham:52,chatroom:161,cheatsheet:1,check:[1,2,7,10,17,23,24,25,33,35,44,45,55,57,60,63,93,108,129,131,135,138,140,144,161,162,165],check_exist:63,checkbox:[1,2,57,131],checkout:125,checksum:1,child:[31,156],child_on:31,child_two:31,children:1,chmod:[1,132,144],chocol:138,choic:[58,66,106,126,129,131,144],choke:2,choos:[1,6,14,16,68,69,128,129,131,133,136,139,144,147],chose:[128,129,144],chosen:[16,73,96,106,123,129,144],chown:144,chrome:1,chunk:142,ci_:[1,27,29,34,93],ci_benchmark:122,ci_cach:123,ci_calendar:124,ci_cart:125,ci_config:[1,69,106,126],ci_control:[20,23,26,39,42,47,65,93,130,131,139,151,164,165],ci_cor:1,ci_db:138,ci_db_driv:[1,7],ci_db_forg:[9,138],ci_db_pdo_driv:1,ci_db_query_build:14,ci_db_result:[7,14,15],ci_db_util:[17,138],ci_email:[1,29,127],ci_encrypt:[128,129],ci_env:[1,32],ci_except:1,ci_form_valid:131,ci_ftp:132,ci_image_lib:[1,133],ci_input:[1,27,51,64,106,135],ci_lang:[61,137],ci_load:[1,138],ci_log:1,ci_migr:[1,139],ci_model:[1,39,93,164],ci_output:[1,140],ci_pagin:141,ci_pars:142,ci_rout:106,ci_secur:[1,64,68,143],ci_sess:[90,96,98,106,144],ci_session_driv:144,ci_session_dummy_driv:144,ci_sessions_timestamp:144,ci_sha:1,ci_tabl:145,ci_trackback:146,ci_typographi:[68,147],ci_unit_test:148,ci_upload:[1,130],ci_uri:[1,149],ci_user_ag:150,ci_vers:[1,42],ci_xmlrpc:[1,151],ci_zip:[1,152],cid:127,cilex:18,ciper:129,cipher:[5,128],ciphertext:129,circl:58,circumst:[1,140],claim:153,clariti:[1,45,52,81,164],class_nam:[15,31,37],classnam:[82,136],claus:[1,9,10,14,45],clean:[1,2,47,64,106,123,135,143,151,164],clean_email:1,clean_file_nam:1,clean_str:1,cleaner:[1,155],cleanup:1,clear:[1,3,11,48,106,127,129,133,138,144,145,152],clear_attach:127,clear_data:152,clear_var:[1,138],clearer:2,clearli:45,cli:[1,24,33,36,71,106,135,144],click:[34,45,57,65,69,136],clickabl:127,client:[1,5,7,106,109,127,130,136],client_nam:130,clipperton:52,clockwis:133,close:[1,2,7,14,19,57,67,130,132,133,141,142,144,146],closur:[1,35],cluster:[3,128],cmd:23,coco:52,code:[1,2,6,12,13,14,16,17,18,19,23,24,26,27,30,33,39,44,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,72,79,92,93,106,109,112,122,123,124,125,126,129,130,131,133,137,139,140,142,143,144,146,148,149,151,155,156,157,161,162,163,164,165],code_end:122,code_start:122,code_to_run:136,codeignit:[1,3,4,5,6,9,11,13,14,19,20,21,22,23,24,25,26,27,30,32,33,34,35,36,39,40,42,43,44,45,47,55,56,57,58,73,74,120,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,154,158,160,161,162,163,164,165],codeigniter_profil:1,codeignitor:1,coffe:125,col:[57,65],col_arrai:65,col_limit:145,collat:[1,5,9],collect:[3,34,164],collector:144,collis:[1,106,123,126,135,137,138],colon:[1,5,19,44,125,144],color:[1,29,49,50,57,58,67,106,125,131,133,145,149],colour:1,colspan:[124,125,145],columbia:[30,153],column:[1,7,12,13,14,15,25,90,98,115,124,133,145,162],column_kei:25,column_nam:9,column_to_drop:9,com:[1,2,3,10,23,26,43,45,46,47,50,51,55,57,58,65,66,69,76,82,94,106,124,127,130,131,132,135,136,141,144,146,149,151,155,165],combin:[1,14,15,26,44,45,52,57,58,106,135,143],come:[1,11,21,32,44,106,123,126,130,135,136,137,142,143,144,155,165],comma:[1,2,17,127,131,144,146],command:[1,6,14,17,24,48,106,132,135,136,144,164,165],comment:[1,3,14,26,34,65,69,155],comment_textarea_alia:65,commit:[1,2,16,155,158],common:[1,16,25,36,38,39,45,52,57,71,106,120,136,137,140,144,150,151],commonli:[44,48,131,137,143,150,155],commun:[1,2,5,30,144,151,157],compact:45,companion:67,compar:[1,14,140,144,148],comparison:[1,14,45,148],compat:[1,26,28,36,48,55,65,71,106,125,128,135,136,144],compens:1,compil:[1,7,13,14,40,133,151],compile_bind:[1,7],complet:[1,7,8,14,16,33,58,67,106,127,133,138,144,145,146,148,149,150,161],complex:[14,48,58,131,146,160,165],compli:127,complic:144,compliment:8,compon:[1,2,124,125,144,158],compos:[1,21],composer_autoload:[1,21],composit:1,compound:[1,14],comprehens:[131,161],compress:[1,5,17,81,152],compress_output:[1,81],compression_level:152,comput:[14,23,151],concept:[29,144,148,159,164],concern:[106,125,143,144],conclud:144,conclus:[71,163],concoct:128,concurr:106,cond:14,condit:[1,7,13,14,45,106,144,153,162],condition:[127,133,151],conf:[1,120],config:[1,2,3,5,6,13,14,16,17,19,20,21,24,25,26,27,29,32,33,34,35,38,39,40,42,43,46,51,52,53,56,57,58,65,67,69,71,73,74,88,115,123,124,125,128,129,132,134,135,137,138,139,140,143,144,145,150,151,162,164,165],config_item:[1,24,42,106],configur:[1,6,7,8,9,10,11,13,14,22,24,27,29,34,40,45,46,48,53,58,71,73,86,106,108,109,115,120,122,123,124,126,127,135,138,141,143,144,151,164],confirm:[1,129,131],conflict:[1,126,139],conform:44,confus:[1,142],congratul:[144,162],conjunct:147,conn_id:[1,3,4],connect:[1,4,5,7,8,11,12,13,14,17,24,53,71,79,123,127,132,144,146,151,153,164],connect_timeout:1,connor:66,conscious:30,consecut:147,consequ:93,consequit:147,consid:[1,6,7,13,14,18,21,26,57,68,106,122,124,129,131,142,144,145,147,148,149,155],consider:[1,133],consist:[0,1,67,76,93,137,144,148],consol:46,constant:[1,24,33,44,52,73,112,126,128,135],constrain:1,constrain_by_prefix:[1,7],constraint:[1,9,44,139],construct:[1,20,29,125,141,163],constructor:[1,6,20,27,29,34,39,125,136,138,144,164],consum:[1,40,122],consumpt:15,cont:127,contact:[44,69],contain:[1,2,3,5,6,7,8,9,12,13,14,15,17,18,25,26,31,33,34,35,39,43,44,45,46,49,50,51,52,53,56,57,58,60,61,62,63,64,65,66,67,68,69,70,76,94,96,97,98,124,125,126,127,130,131,132,133,135,137,138,141,142,143,144,145,146,147,148,149,150,151,152,155,160,162,165],content:[1,14,18,22,34,47,49,54,56,57,58,66,68,70,124,125,127,136,138,140,143,144,146,147,152,157,161,164],context:[129,144],continu:[1,43,45,47,115,122,128,131,146,151,162],contract:153,contrast:[16,155],contribut:[0,1,44,45],contributor:30,control:[1,2,3,14,20,22,23,27,29,31,33,34,35,36,37,38,39,40,43,45,46,47,49,53,56,57,58,69,71,72,76,93,106,122,124,125,126,127,128,129,132,133,135,136,138,139,140,141,142,144,145,146,147,148,149,150,151,152,154,155,156,158,159,161,162,163,164],controller_info:40,controller_trigg:[46,76],conveni:[21,56,106,109,135,136,139,143],convent:[1,93,144,165],convers:[1,32,138,147],convert:[1,52,57,64,66,67,68,69,70,106,130,131,138,143,146,147,155],convert_accented_charact:[1,67],convert_ascii:146,convert_text:45,convert_xml:146,cook:52,cooki:[1,34,44,52,59,71,106,120,128,129,138,143,144],cookie_domain:[120,144],cookie_httponli:[1,135,144],cookie_path:[120,144],cookie_prefix:[51,120,135,144],cookie_secur:[1,135,144],cool:136,coordin:133,cop:[47,151],copi:[1,2,29,66,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,126,129,133,153,165],copyright:[133,153],core:[1,14,33,34,36,71,81,95,125,137,138,140,154,155,158,160,165],core_class:82,corner_styl:136,correct:[1,7,10,14,44,45,68,129,130,131,132,147,148],correctli:[1,2,10,33,55,67,129,147,152,165],correl:[22,35],correspond:[3,21,37,40,43,45,47,65,66,120,121,124,126,130,131,133,137,142,144,149,151,162,164],corrupt:1,could:[1,2,4,9,23,24,33,38,45,48,69,81,106,129,131,136,139,140,144,151,155,164,165],couldn:1,count:[1,7,15,50,52,58,67,124,127,144,145,146,149],count_al:[1,7,10,14],count_all_result:[1,14],countabl:60,counter:133,coupl:[1,27,29,74,131,151,158],coupon:125,cours:[43,57,106,128,129,131,144,155],cover:[0,151,161],cpanel:1,crawl:1,crazi:14,creat:[0,1,2,3,6,7,13,14,17,18,23,26,30,34,36,38,44,50,56,57,58,61,64,65,66,69,71,93,96,106,109,125,126,127,129,132,133,136,141,143,144,145,149,152,158,163,164,165],create_captcha:50,create_databas:[1,9],create_kei:[1,129],create_link:[1,141],create_t:[1,9,139],create_thumb:133,createfromformat:[15,116],creating_librari:82,creation:[1,133],creativ:[48,155],credit:[2,71,125,128,129],crime_is_up:149,criteria:[43,131],critic:[2,44],crl:1,crlf:[1,127],cron:[14,23],crontab:1,crop:[1,133,156],cross:[1,24,44,58,64,108,135],crt:1,crypt:25,crypt_blowfish:25,crypto_strong:1,cryptograph:[106,128,129,143],cryptographi:129,csprng:25,csr:1,csrf:[1,162],csrf_exclude_uri:[1,143],csrf_hash:95,csrf_protect:[1,143],csrf_regener:[1,143],csrf_token_nam:[95,143],csrf_verifi:1,css:[44,52,58,67,69,106,136,140],csv:1,csv_from_result:[1,17],ctr:129,ctype_alpha:1,ctype_digit:[1,44],cubird:9,cubrid:[1,41,106],cubrid_affected_row:1,culprit:1,cumbersom:16,cumul:[9,14],cur_pag:1,cur_tag_clos:141,cur_tag_open:141,curl:23,curli:[1,147],current:[1,2,3,4,7,9,12,14,15,17,18,22,24,40,41,52,53,55,65,69,72,90,94,113,124,125,126,131,132,135,136,137,138,139,140,144,150],current_url:[1,69],current_us:3,cursor:1,curtail:146,curv:157,custom:[1,9,11,14,17,18,20,21,24,25,29,43,45,51,71,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,124,125,126,127,131,150,164,165],custom_result_object:15,custom_row_object:15,customiz:[5,141],cut:[1,15],cycl:[22,66,127],cypher:128,cyril:1,dai:[1,52,124,145,161],damag:[129,153],danger:[1,24],danijelb:1,darn:67,dash:[1,43,44,60,69,70,125,131,147,162],data1:142,data:[1,3,6,7,8,10,12,13,15,17,18,25,26,29,35,39,40,43,45,46,49,50,54,56,57,58,62,64,65,66,70,90,106,112,115,116,122,123,125,127,128,130,138,140,142,143,145,146,148,152,154,155,156,160,162,164,165],data_seek:[1,15],data_to_cach:123,databas:[1,4,7,14,15,16,29,40,41,47,53,66,67,73,79,83,84,85,87,88,89,90,91,92,93,123,125,128,131,138,139,141,142,145,146,155,156,160,162,163,164],database2_nam:6,database_exist:[1,17],database_nam:[5,17],datatyp:[9,148,151],date:[1,8,14,17,39,56,59,71,112,116,124,146,151],date_atom:[52,106],date_cooki:52,date_iso8601:[1,52],date_lang:52,date_rang:[1,52],date_rfc1036:52,date_rfc1123:52,date_rfc2822:52,date_rfc822:[52,106],date_rfc850:52,date_rss:52,date_w3c:52,datestr:52,datetim:[1,15,52,116,151],day_typ:124,daylight:52,daylight_sav:52,days_in_month:[1,52,124],db1:6,db2:6,db_active_rec:[1,83],db_backup:1,db_backup_filenam:17,db_conn:138,db_connect:[1,7],db_debug:[1,5,6,39],db_driver:1,db_forg:1,db_name:9,db_pconnect:[1,7],db_query_build:[1,14],db_result:1,db_select:[1,6,7],db_set_charset:[1,7],dbcollat:[1,5,6,9,86],dbdriver:[5,6,39],dbforg:[1,9,106,138,139],dblclick:136,dblib:1,dbname:[1,5,6],dbprefix:[1,5,6,7,13,14,39,76],dbs:17,dbutil:[17,138],dead:[1,119],deadlock:[1,144],deal:[1,7,34,64,129,131,137,153],debat:1,debug:[1,13,16,33,40,82,127,132,140,151],debugg:1,decept:58,decid:[1,129,135,151],decim:[1,7,122,131],decis:[1,127,128],declar:[1,9,15,25,26,27,29,35,45,56,58,112,126,144,148],declin:2,decod:[1,44,68,93,128,129,143],decrement:[1,123,124],decrypt:[44,128],default_control:[1,26,43,162,164,165],default_domain:[106,109],default_method:26,default_templ:124,defeat:58,defin:[1,9,15,24,29,32,33,34,39,43,57,67,108,125,126,131,135,136,137,139,145,164,165],definit:[1,9,18,20,29,57,106],degre:[133,142,158],deject:58,del_dir:56,deleg:165,delet:[1,3,7,9,10,13,15,43,50,51,56,106,123,132,135,144],delete_al:1,delete_cach:[1,22],delete_cooki:[1,51],delete_dir:[1,132],delete_fil:[1,56,132],deliber:128,delici:120,delim:17,delimit:[1,17,43,69,106,127,130,142],deliveri:[1,145],demand:[16,106],demonstr:[58,65,67,127,130,152,162],depend:[1,3,5,7,13,32,34,67,106,109,115,123,126,129,135,139,144,158],deploi:[1,139],deprec:[1,5,9,41,52,55,56,57,58,64,65,66,69,90,93,96,125,126,128,131,135,136,137,141,144],depress:58,depth:[1,53,129,145],der:1,deriv:[25,129,162],des:129,desc:14,describ:[1,2,3,8,14,19,29,32,33,39,40,44,45,46,65,73,79,126,127,129,130,131,133,145,155,159,164],descript:[2,5,40,45,51,52,58,124,125,127,128,129,130,131,132,133,136,138,139,141,144,146],design:[1,13,39,44,46,65,124,125,128,129,142,145,155,156,161],designfellow:1,desir:[1,6,14,15,32,38,44,45,48,61,65,130,132,137,139,145,147],desired_output_format:116,desktop:[17,54,151,152],destin:[43,130,132,133],destroi:[1,125,128,135],destructor:1,detail:[1,8,29,32,33,44,45,51,80,93,106,123,126,129,133,136,138,144,151,155,156],detect:[1,7,69,106,109,120,129,130,133,139,140,143,150],detect_mim:130,detectifi:1,determin:[1,3,7,10,13,14,16,24,26,33,56,57,69,79,85,106,120,124,133,136,141,146,147,148,150,151,154,158],detriment:3,dev:[1,25,45,106,129,143],develop:[1,2,5,18,20,30,32,33,40,42,44,45,48,71,72,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,125,128,133,139,142,144,148,155,158,160,162,165],devic:[1,45,150],devis:1,dhaka:1,diagram:35,diamet:49,did:[1,2,14,23,26,33,45,47,133,146,161,162,165],didn:[1,49,106,144],die:[45,140],dies:45,differ:[0,1,4,6,14,32,38,39,43,45,52,69,90,106,108,122,124,125,126,127,129,131,132,133,137,138,141,144,145,148,150,151,152,155,162,164],differenti:[1,32,44],difficult:133,digest:129,digit:[1,15,45,139],dimens:133,dimension:[1,5,35,47,58,125,142,145],dinner:66,dir:53,dir_read_mod:42,dir_write_mod:[1,42],direct:[1,14,18,29,44,69,73,139],directli:[0,1,7,9,14,17,20,22,26,29,31,39,44,47,66,73,106,135,144,148,154,164],directori:[1,3,5,7,21,22,27,29,31,33,34,35,37,39,43,44,46,50,56,59,63,64,65,71,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,123,126,132,136,137,138,139,143,144,152,164,165],directory_depth:53,directory_map:[1,53],directory_nam:47,directory_separ:[1,112],directory_trigg:1,disabl:[1,3,5,7,10,14,19,24,32,33,35,44,45,73,80,82,130,137,139,140,144,152],disagre:2,disallow:[1,67,80,143],disappear:136,disappoint:131,discard:[1,138],discern:[1,130],disclos:2,discourag:[45,106,113],discret:[1,31,34,51,131,135,145],discuss:[14,31,37,44,165],dishearten:58,disk:[123,129,133],disp:127,displai:[1,5,7,10,18,22,33,35,40,44,52,57,65,126,127,130,131,132,140,141,145,146,151,152,162,165],display_error:[1,7,45,130,133,146,151],display_overrid:35,display_pag:141,display_respons:151,disposit:[1,127],disregard:79,distanc:133,distinct:[1,14,136],distinguish:45,distribut:[1,5,72,138,144,153],distrubut:144,div:[1,18,57,124,131,136,141,147,164],dnt:1,do_hash:[1,64,93],do_upload:[1,130],do_xss_clean:[1,93],doc:1,docblock:[1,45],doctyp:[1,58],document:[1,14,24,26,32,44,45,48,58,64,68,69,71,93,102,106,125,129,131,135,140,153,161,164,165],docx:1,doe:[1,2,6,7,13,14,15,16,19,27,34,39,40,44,45,47,48,49,51,55,56,57,64,69,74,79,81,82,93,106,113,122,123,125,126,130,131,132,133,135,136,137,138,142,144,147,149,151,164,165],doesn:[1,14,15,19,24,25,29,44,55,57,73,74,106,122,129,144,152,158,165],dog:[60,122,136],dohash:[1,64,93],doing:[1,6,10,14,27,47,52,69,106,108,129,144,155,163],dollar:[1,43],domain1:[106,109],domain2:[106,109],domain:[1,18,51,106,109,135,144],don:[1,2,3,6,7,13,28,34,43,44,45,49,52,106,123,124,126,127,128,129,131,140,143,144,146,156,160,165],done:[1,2,18,26,34,35,39,40,73,106,109,129,137,140,142,144,151,154,157,164,165],dot:1,doubl:[1,14,17,43,45,57,66,68,70,147,151],double_encod:1,dowload:88,down:[15,31,44,45,52,57,133,139,147,162],download:[1,17,59,65,71,132,136,152,165],download_help:[1,83],downsid:144,draw:50,drawn:1,driven:2,driver:[1,3,4,5,6,9,10,11,13,15,17,36,41,71,75,76,77,78,79,80,81,82,83,84,93,115,120,134,138],driver_nam:[1,28],driver_name_subclass_1:28,driver_name_subclass_2:28,driver_name_subclass_3:28,drop:[1,17,52,57,106,133,144],drop_column:[1,9],drop_databas:[1,9],drop_tabl:[1,9,139],dropbox:2,dropdown:57,dsn:[1,5,6,127],dst:52,dtd:58,due:[1,14,17,93,106,113,129,136,144,148],dummi:[106,144],duplic:[1,66,140,146],dure:[1,7,25,34,35,39,40,44,131,137,144],dynam:[1,3,18,22,29,46,73,106,109,123,124,126,128,129,133,141,144,155,158,164],dynamic_output:133,e_notic:1,e_pars:1,e_strict:1,e_warn:1,each:[1,3,5,6,7,8,14,15,16,19,20,21,25,26,34,35,38,40,45,49,52,53,57,60,66,73,120,122,124,125,126,127,129,131,136,137,138,139,142,144,145,146,148,150,151,152,157,158,162,163,164,165],earli:35,earlier:[14,47,131,144,146,162,164,165],earth:1,eas:1,easi:[1,46,93,129,135,137,138,141,144],easier:[19,108,125,144,155],easiest:45,easili:[14,20,46,93,128,129,140,155,164],east:52,eastern:52,easy_instal:18,eat:58,ecb:129,eccentr:1,echo:[8,9,10,12,13,14,15,17,23,24,26,29,34,45,47,49,50,52,55,56,57,58,60,61,62,63,65,66,67,69,70,81,94,122,123,124,125,128,129,130,131,133,135,136,137,140,141,142,145,146,148,149,150,151,162,164,165],edg:[1,30,133],edit:[1,43,69,126,139,143,151],editor:[23,26,45,47,73,126,130,131,151],effect:[1,3,40,44,45,106,119,133,140,142,144,152],effici:[1,150],effort:[72,106,146,157],eight:145,einstein:49,either:[1,2,3,4,6,14,17,39,43,45,52,57,58,69,93,94,106,127,128,129,130,131,133,136,141,143,144,147,148,151],elaps:[7,40,52,122],elapsed_tim:[7,122,140],eldoc:18,eleg:31,element:[1,17,34,47,49,57,61,106,130,131,136,138,142,145,147,162,164,165],element_path:136,elev:152,eleven:[67,145],elimin:[1,19,142],elips:58,elli:30,ellips:[1,58,67],ellipsi:[67,147],ellislab:[1,30,106],els:[1,13,14,16,18,19,24,26,33,44,45,55,56,106,109,130,131,135,146,149,150,151,162],elseif:[19,45,150],elsewher:[125,144],email:[1,8,10,15,29,37,53,57,59,69,71,131,134,137,138,144,151,155,156],email_attachment_unred:1,email_filed_smtp_login:1,email_lang:137,emailaddress:131,emb:[44,127],embed:[1,47],emerg:2,emit:1,emoticon:65,empti:[1,9,14,15,17,26,45,52,57,58,61,69,94,122,127,131,141,143,145,146,150,152,164],empty_t:[1,14],emul:[1,26,144],enabl:[1,4,5,6,7,10,13,14,16,17,19,25,26,43,45,48,65,67,76,80,81,82,93,120,122,124,127,128,129,131,132,133,135,139,140,143,144,145,146,147,151,154,155,160],enable_hook:[35,80],enable_profil:[40,140],enable_query_str:[1,46,76,141],enclos:[1,14,142],enclosur:17,encod:[1,24,25,44,45,69,71,93,106,112,128,129,131,134,135,146,156],encode_from_legaci:[1,93,128],encode_php_tag:[64,131],encount:[1,19,33,106,135,138,143],encourag:[1,29,43,44,69,80,90,96,106,112,116,119,126,128,129,146,156,157],encrypt:[1,5,44,64,66,71,73,102,127,130,134,144,156],encrypt_nam:[1,130],encrypted_str:128,encryption_kei:[128,138],enctyp:130,encypt:129,end:[1,3,5,14,15,19,35,45,52,66,67,81,106,122,126,128,129,131,132,140,143,144,146,148,152],end_char:[67,146],endfor:19,endforeach:[19,47,125,130,155,164],endif:[19,125],endless:1,endpoint:143,endwhil:19,enforc:1,engin:[1,9,13,19,46,69,74,76,106,142,144,156],english:[1,60,67,83,120,131,137,150],enhanc:1,enjoi:[73,163],enjoy:157,enlarg:98,enough:[44,49,129,131],ensur:[1,5,44,45,49,123,128,129,138],ent_compat:143,enter:[1,49,148],entir:[1,3,15,17,27,29,32,34,45,73,122,123,131,132,141,142,144,163],entiti:[1,58,64,66,67,68,70,106,131,143,146,147],entitl:126,entity_decod:[1,68,143],entri:[1,39,43,58,69,106,123,146,151],entry_id:146,environ:[1,3,5,36,42,44,45,69,71,73,93,108,112,123,135,139,144,162,165],epallerol:1,epub:18,equal:[1,14,24,131,136,145,148],equip:60,equiv:58,equival:[45,65,67,165],eras:144,errand:47,errantli:1,errata:1,erron:1,error:[1,2,5,7,18,19,36,43,44,55,56,57,63,71,73,82,95,126,127,129,130,132,133,136,137,139,144,146,156,162,165],error_404:[1,33,43,76,92],error_:137,error_arrai:[1,131],error_db:[7,76],error_email_miss:137,error_gener:[33,76],error_lang:137,error_messag:137,error_messages_lang:137,error_php:76,error_prefix:[1,131],error_report:33,error_str:[131,139],error_suffix:[1,131],error_url_miss:137,error_username_miss:137,error_views_path:1,escap:[1,7,8,10,14,24,45,52,106,112,113,135],escape_identifi:[1,7],escape_like_str:[1,7,13],escape_str:[1,7,13],escapeshellarg:1,eschew:48,especi:144,essenti:2,establish:[6,7],etc:[1,2,3,4,5,6,7,9,10,12,14,16,18,20,23,29,34,44,45,47,53,60,63,67,124,127,129,131,136,140,143,144,146,150,151,156],euro:52,european:52,eval:[1,19,24],evalu:[1,45,148],even:[1,2,6,7,13,16,19,27,29,34,38,44,45,57,81,126,129,131,133,140,149,150,160],event:[1,3,57,69,126,130,131,135,149,153,158],ever:[44,57,106,109,125],everi:[2,6,14,20,21,27,44,72,112,124,129,133,135,141,143,144,158,161,165],everyth:[1,46,49,106,125,129,132,144,151,162],everywher:144,evid:43,evil:1,exact:[67,106,131],exact_length:[1,131],exactli:[1,9,14,15,29,43,128,131,133,135,142,144],examin:[14,125,151,154],exampl:[1,2,3,4,5,6,7,9,10,11,12,13,15,18,19,20,23,24,26,27,29,31,32,33,34,35,37,38,39,40,44,45,46,47,49,50,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,76,90,94,98,106,109,112,122,124,125,126,127,128,129,130,131,133,136,138,140,142,143,144,146,147,148,149,151,155,157,165],example_field:13,example_librari:29,example_t:13,exce:131,exceed:[6,7,127],except:[1,9,14,15,19,27,29,43,45,46,48,51,52,57,66,68,69,83,93,106,122,123,126,131,133,142,144,145,147,149],excerpt:146,exclam:[7,13],exclud:[46,56,127,140,152],exclus:[1,56],exe:1,exec:[1,24],exect:1,execut:[1,7,9,13,14,15,17,24,26,33,35,40,43,44,56,69,106,115,131,132,140,143,144,146,154,158],exist:[1,2,3,7,9,14,15,20,24,27,29,34,44,45,46,49,50,54,56,63,70,90,106,123,125,126,127,128,130,131,135,137,140,141,144,151,152,154,160,165],exit:[1,29,33,45,139,140],exit__auto_max:[33,42],exit__auto_min:[33,42],exit_config:42,exit_databas:42,exit_error:[33,42],exit_success:42,exit_unknown_class:42,exit_unknown_fil:[33,42],exit_unknown_method:42,exit_user_input:42,exot:135,exp_pre_email_address:45,expand:[1,161,162],expect:[1,2,17,29,33,44,45,94,130,142,143,144,146,148,149,151,161,163,165],expected_result:148,experi:[144,156],experienc:[45,129,133,144],experiment:[106,136],expert:129,expir:[1,3,22,50,51,135,140,144],expiri:[2,144],explain:[2,29,44,106,119,124,130,131,138,144,151,163],explanatori:130,explic:1,explicit:[1,45],explicitli:[1,6,56,69,141],explod:45,explode_nam:1,exploit:[1,143],explor:[1,106,157,161,163],expos:[1,144],express:[1,14,106,125,131,137,143,145,153,165],expressionengin:[30,106,133],ext:[1,76],extend:[1,7,23,26,28,36,39,42,47,65,71,82,93,95,128,130,131,139,144,151,155,164,165],extens:[1,5,7,18,21,24,25,29,34,47,50,54,56,82,102,113,119,123,126,128,129,130,132,133,137,138,144,156],extension_load:128,extern:[1,45,143,144],extra:[1,26,57,129,131,136,141,144,162,164],extract:[127,135,138],extract_url:146,extran:1,extrem:[93,155,156],eyes:129,f4v:1,face:147,facil:2,facilit:1,fact:[47,106,128,129,144],factor:[3,14,106,158],fail:[1,2,7,13,16,93,123,129,131,133,143,146,151],fail_gracefulli:[126,138],failov:[1,5],failsaf:135,failur:[1,7,9,13,14,15,16,17,18,25,45,49,52,56,123,125,126,127,129,130,131,132,133,137,138,139,143,144,145,146,149,151,152],faint:133,fair:16,fairli:[44,130,144,160],fall:[1,25,106,109,123],fallback:[1,2,45,106],fals:[1,5,6,7,9,12,13,14,15,16,17,18,24,25,33,34,39,40,43,46,47,52,53,54,55,56,57,58,60,63,64,66,68,69,70,76,80,81,82,93,123,124,125,126,127,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,162,164],falsi:57,fame:144,famili:129,familiar:[16,18,19,47,129,141,144,146,148],far:[7,131,144,151],fashion:[129,163],fast:[11,22,49,123,136,144],faster:[48,69,81,129,142,144,155],fatal:[1,43,45,123],favicon:58,favor:[1,48,49,64],favour:1,fcpath:42,featur:[1,2,3,6,11,14,15,17,19,21,26,29,35,41,44,45,46,71,79,80,90,106,123,124,127,129,131,133,137,140,144,149,159],februari:1,feed:[1,13,58],feedback:[1,144],feel:[93,142,157],fennec:1,fetch:[1,12,14,15,25,47,49,106,123,129,135,144],fetch_:106,fetch_class:1,fetch_directori:1,fetch_method:1,fetchabl:13,few:[1,2,24,25,43,45,80,106,109,124,129,135,144,146,155,161,162],fewer:[1,5,14],ff0:[67,106],fff:133,ffffff:133,ffield_nam:1,fh4kdkkkaoe30njgoe92rkdkkobec333:125,field1:[14,135],field2:[14,135],field3:14,field:[1,5,7,13,14,15,17,49,52,53,106,125,130,143,146,162],field_data:[1,3,7,12,15],field_exist:[7,12],field_id:65,field_nam:[1,3,7,12,15,130,131],fieldset:57,fifth:125,figur:7,fiji:52,file:[0,1,2,5,6,7,10,13,14,16,18,21,22,23,24,26,27,31,33,34,35,36,38,39,40,43,47,49,50,51,52,53,54,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,122,125,128,129,132,134,135,136,140,142,143,145,148,150,152,153,154,155,156,157,162,164,165],file_1:66,file_4:66,file_5:66,file_exceeds_form_limit:1,file_exceeds_limit:1,file_exist:165,file_ext:130,file_ext_tolow:[1,130],file_get_cont:[1,56,106,140],file_nam:[1,47,130,131,138],file_parti:1,file_path:130,file_permiss:[1,133],file_read_mod:42,file_s:130,file_typ:130,file_upload:53,file_writ:1,file_write_mod:[1,42],filectim:1,fileinfo:1,filemtim:1,filenam:[1,17,27,29,34,35,45,54,56,64,82,106,126,127,130,133,137,139,143,152],filename1:137,filename2:137,filename_bad_char:1,filename_help:93,filename_pi:93,filename_secur:1,filepath:[35,132,138,152],fileperm:56,fileproperti:45,files:56,filesystem:139,fill:[1,131],filter:[1,43,51,64,154,156],filter_uri:1,filter_validate_email:55,filter_var:[1,55,106],find:[1,2,3,16,19,21,26,33,34,39,43,49,74,81,90,126,129,130,137,142,144,146,150,151,155,160],find_migr:139,fine:[23,69],finish:[125,132,138],firebird:[1,17,41],firefox:1,first:[1,2,3,4,6,7,9,10,14,15,16,17,20,22,24,25,26,29,33,34,39,40,43,44,45,46,50,51,52,54,57,58,65,66,67,69,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,122,124,125,126,127,131,132,135,137,138,139,142,144,145,146,149,151,152,154,157,162,164,165],first_link:[1,141],first_nam:[131,151],first_row:15,first_tag_clos:141,first_tag_open:141,first_url:[1,141],firstnam:[142,151],fist:1,fit:153,five:[66,125,145],fix:[2,24,66,145],fixat:144,flac:1,flag:[1,2,7,9,14,44,135,148],flashdata:[1,106,128],flavor:[120,138],flaw:[1,44],fledg:161,flexibl:[1,46,47,79,106,156,158],flip:133,flock:1,flow:[2,35,45,71,159],flowgat:1,flush_cach:[1,14],fly:[1,19,82,93,127,152],fmt:52,focu:[18,48,136,155,163],focus:158,folder:[1,3,5,18,21,22,23,26,34,50,53,56,65,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,94,95,96,97,98,99,100,101,102,103,104,105,106,126,131,132,133,137,139,143,151,152],follow:[1,3,5,6,8,9,12,13,14,15,16,17,18,20,21,22,23,25,26,27,29,31,33,34,35,37,39,40,42,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,75,76,77,78,79,80,81,85,86,93,96,106,115,116,120,122,123,126,127,129,130,131,133,135,136,137,138,139,140,141,143,144,146,147,148,150,151,153,154,158,159,162,163,164,165],font:[1,50,133],font_path:50,font_siz:[1,50],foo:[1,18,20,22,29,38,43,45,57,70,93,123,132,138,140,144,148],foo_bar:138,foobar:[39,45,49],foobarbaz:123,foobaz:45,foofoo:45,footer:[47,160,162,164,165],footprint:[48,158],fopen:[1,56],fopen_read:42,fopen_read_writ:42,fopen_read_write_cr:42,fopen_read_write_create_destruct:42,fopen_read_write_create_strict:42,fopen_write_cr:42,fopen_write_create_destruct:42,fopen_write_create_strict:42,forc:[1,5,44,48,54,56,69,74,130,155],force_download:[1,17,54],fore:68,foreach:[8,12,14,15,17,19,34,45,47,52,125,127,130,142,149,155,164],foreign:[1,17],foreign_char:[67,93],foreign_charact:1,foreign_key_check:[1,17],forg:[1,11,71,138],forgeri:[1,44],forget:[131,144],forgotten:44,fork:2,form:[1,2,15,18,34,37,44,46,47,50,52,55,59,65,69,71,90,93,112,123,125,134,143,155,156,163],form_button:[1,57],form_checkbox:[1,57],form_clos:57,form_dropdown:[1,57],form_error:[57,131],form_fieldset:[1,57],form_fieldset_clos:[1,57],form_help:83,form_hidden:[1,57,125],form_input:[1,57,125],form_item:131,form_item_id:61,form_label:[1,57],form_multiselect:[1,57],form_open:[1,57,94,125,131,143,162],form_open_multipart:[1,57,130],form_password:57,form_prep:[1,57],form_radio:[1,57],form_reset:[1,57],form_submit:[57,125],form_textarea:[1,57],form_upload:57,form_valid:[1,37,131,138,162],form_validation_:[1,106],form_validation_lang:[1,131,137],form_validation_rul:106,format:[1,2,5,10,15,17,18,19,25,28,34,44,52,55,57,58,62,64,68,69,106,116,124,125,126,127,130,131,133,135,139,141,144,146,147,148],format_charact:[1,147],format_numb:125,former:1,formerli:[1,14,64],formsuccess:131,forth:67,forum:[2,155,157,161],forward:[1,15,57,106,112,126,139,143,149],found:[1,2,17,21,24,25,26,31,33,35,43,44,51,52,62,66,92,106,123,126,127,129,135,137,138,139,140,144,146,149,165],four:[7,14,45,66,73,125,133,145,146],fourth:[17,52,57,67,127],fragment:[47,139,160],frame:58,frameset:58,framework:[1,27,29,30,36,47,48,71,106,122,137,161,163,164,165],fran:1,frank:14,fred:[66,132,145],free:[15,45,144,153,157,165],free_result:[1,3,15],french:[52,137],fresh:[14,93,94,95,96,106],friendli:[1,18,46,69,74,76,129,156],friendlier:[1,51],from:[1,2,3,4,6,7,8,12,13,14,15,17,19,20,23,24,25,26,27,29,30,31,33,39,44,45,46,47,48,49,50,51,52,54,57,58,61,64,66,67,69,71,72,73,122,123,125,126,127,128,129,130,131,132,133,135,136,137,138,140,141,142,143,144,145,146,149,150,151,152,153,155,158,160,162,163,164,165],front:[1,56,154],front_control:76,fscommand:1,ftp:[1,45,71,134,156],ftp_unable_to_remam:1,fubar:138,full:[1,3,5,8,11,14,17,24,26,29,38,44,45,56,58,64,69,73,93,122,130,133,136,137,140,141,142,145,148,149,150,151,155,156,161],full_path:130,full_tag_clos:141,full_tag_open:141,fulli:[1,22,35,45,53,73,80],func:[1,131],func_overload:1,funcion:1,function_exist:[1,24],function_nam:24,function_trigg:[46,76],function_us:[1,24,42],furnish:153,further:[1,3,6,25,26,58,140,144,146,158,163],furthermor:[45,106,129],futur:[1,106,115,119,129,144],fwrite:1,gain:[3,96,123,128,129],galleri:133,gambier:52,game:49,gap:139,garbag:144,gather:[12,150],gave:[1,146,161],gd2:133,gd_load:1,gecko:150,gender:149,gener:[1,2,3,7,9,11,14,16,17,18,22,24,30,33,39,40,44,45,46,47,50,52,54,57,58,62,65,66,69,82,106,124,125,127,128,129,130,131,133,136,137,138,140,141,143,144,145,149,152,157,160,161,165],georg:49,georgia:52,german:137,get:[1,3,7,8,11,13,14,15,26,33,35,39,40,43,44,51,71,73,80,81,93,106,123,125,127,129,131,138,142,143,144,148,150,151,156,159,161,162,164,165],get_clickable_smilei:65,get_client_info:4,get_compiled_delet:[1,14],get_compiled_insert:[1,14],get_compiled_select:[1,14],get_compiled_upd:[1,14],get_config:[1,42],get_content_typ:[1,140],get_cooki:[1,51,106,135],get_csrf_hash:[95,143],get_csrf_token_nam:[95,143],get_day_nam:124,get_dir_file_info:[1,56],get_extens:1,get_file_info:[1,56],get_file_properti:45,get_filenam:[1,56],get_flash_kei:144,get_head:[1,140],get_id:146,get_image_properti:1,get_inst:[1,29,35,42],get_item:[1,125],get_last_ten_entri:39,get_magic_quotes_gpc:1,get_metadata:[1,123],get_mim:[1,24,42],get_mime_by_extens:[1,56],get_month_nam:124,get_new:164,get_output:[35,140],get_package_path:138,get_post:[1,135],get_random_byt:[1,143],get_request_head:[1,106,135],get_smiley_link:65,get_temp_kei:144,get_the_file_properties_from_the_fil:45,get_total_dai:[1,124],get_userdata:[137,144],get_var:[1,138],get_wher:[1,14,164],get_zip:152,getfileproperti:45,getimages:1,getter:144,gettyp:1,getuserinfo:151,getwher:[1,14,93],gif:[130,133,136],gilbert:52,git:[2,72],github:[2,144],give:[1,2,8,9,14,33,34,44,45,51,58,65,69,129,131,144,148,163],given:[1,16,25,48,52,56,60,106,124,125,131,133,137,138,144,146,149,152,155],glanc:[71,159],glass:125,global:[1,3,5,6,21,24,29,33,34,35,39,44,106,120,126,131,135,137,138,144,158],global_xss_filt:[1,135],glue:165,gmdate:140,gmt:[52,140],gmt_to_loc:52,goal:[48,71,155,159],goe:[1,30,106,128,129],going:[23,49,129,138,144,151,162,164,165],golli:67,good:[5,13,16,32,34,43,44,129,131,133,137,155],googl:[1,148],gost:129,got:1,gpg:1,grab:165,grace:1,gracefulli:6,grain:69,grammat:1,grant:153,graphic:[58,154],grasp:18,great:[1,2,58,155],greater:[24,45,52,70,79,131],greater_than:[1,131],greater_than_equal_to:131,greatli:16,greedi:[1,45],greek:1,green:[58,131,132,145],greenwich:52,greet:151,grid:[1,50],group:[1,5,6,7,16,30,138],group_bi:[1,14],group_end:14,group_id:45,group_nam:6,group_on:6,group_start:14,group_two:6,groupbi:[1,14,93],groupid:45,grow:155,guarante:[72,143,144],guard:[128,129,146],guess:[1,45],guiana:52,guid:[1,2,6,29,31,36,37,44,56,73,75,138],guidelin:45,guillermo:1,gzip:[1,17,81],hack:[1,10,35,64,135],hackeron:2,had:[1,93,106],half:144,halt:[1,144],hand:[26,57,131,139],handl:[1,14,18,26,36,47,66,71,81,92,124,126,144,165],handler:[1,43,54,106,144],handpick:30,hang:161,happen:[1,2,3,35,47,106,119,122,127,129,144,152],happi:[2,58],hard:[1,57,112,129,133,144],harden:[1,24],harder:49,harmoni:1,harvest:[1,69,124],has:[1,2,5,7,10,13,14,15,19,22,24,25,26,27,31,33,43,44,45,46,49,50,52,54,56,60,64,65,66,82,90,93,94,95,96,97,98,106,108,109,112,120,122,123,125,126,128,129,131,135,136,137,138,139,140,144,145,151,160,162,164,165],has_opt:125,has_rul:131,has_userdata:[1,144],hash:[1,44,64,66,106,129,143],hash_algo:64,hash_bits_per_charact:1,hash_equ:[1,25],hash_funct:115,hash_hmac:129,hash_pbkdf2:[1,25],hat:30,hate:155,have:[0,1,2,3,5,6,7,9,12,13,14,15,16,17,18,20,22,25,26,27,29,31,32,33,35,38,39,40,43,44,45,46,47,49,50,51,52,57,58,65,68,69,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,124,125,126,127,128,129,130,131,132,133,135,136,138,139,140,141,142,144,146,147,148,149,151,157,158,161,162,164,165],haven:[129,131,138,144,162],having_or:1,havingor:1,hawaii:52,haystack:[25,34],head:[1,33,47,58,65,124,130,131,136,142,145,165],header1:127,header2:127,header:[1,24,26,40,45,47,54,69,124,127,133,135,140,152,160,162,164,165],heading_cell_end:145,heading_cell_start:145,heading_next_cel:124,heading_previous_cel:124,heading_row_end:[124,145],heading_row_start:[124,145],heading_title_cel:124,health:33,heart:26,heavi:[3,6,144],height:[1,49,50,58,69,130,133,136],hellip:67,hello:[142,165],helo:1,help:[1,2,3,9,12,13,17,18,33,34,40,42,44,45,52,58,62,65,67,68,69,73,93,127,131,136,139,141,143,147,149,150,151,160,165],helper1:34,helper2:34,helper3:34,helper:[1,11,17,20,21,24,29,30,36,40,45,46,75,76,79,80,81,82,83,84,85,86,87,88,89,90,91,92,112,120,124,125,126,130,135,137,138,143,144,151,154,155,156,157,161,162,164],henc:106,here:[1,2,13,14,15,18,19,23,24,26,34,35,39,43,44,45,46,47,50,53,54,56,57,58,65,67,69,70,76,79,90,93,106,122,124,127,129,130,131,132,133,135,136,138,140,141,144,145,146,148,151,156,162,164,165],herebi:153,hesit:45,hex2bin:[1,25,129],hex:[1,64,129,133],hexadecim:[25,129],hidden:[1,26,40,45,53,57,125,136,143,162],hiddenemail:57,hide:[1,51,69,73,129],hierarch:26,hierarchi:[18,47],high:[1,44,67,128,129,144,146,158],higher:[25,33,43,129,133,144],highest:[127,152],highli:[3,24,158],highlight:[1,18,45,67,106,124,145],highlight_cod:[1,67],highlight_phras:[1,67],highlight_str:67,hijack:[44,143],histor:[66,106,129],hkdf:129,hkk:1,hmac:1,hmac_digest:129,hmac_kei:129,hold:[1,2,128,129],holder:153,home:[150,165],honor:1,hood:[34,129],hook:[1,18,27,36,71,80,106,155,156],hope:161,hor:133,horizont:133,host:[1,5,6,7,48,58,123,144],hostnam:[1,5,6,7,39,106,109,132],hotfix:2,hour:[50,52,144],hous:[47,151],housekeep:3,hover:136,how:[1,2,4,7,8,9,14,26,29,31,32,34,37,44,45,50,52,58,65,69,73,93,106,109,124,126,127,132,133,135,138,141,145,146,151,152,154,156,162,163,165],howev:[2,13,14,15,20,24,26,27,29,35,38,43,44,45,66,81,106,123,125,126,128,129,130,131,133,140,141,142,144,148,151,152,155],howland:52,href:[1,58,69,124,142,164],htaccess:[1,32,44,46,56,73,155],htdoc:[44,56],html4:58,html5:[1,58,67,106],html:[1,18,24,33,44,46,47,52,53,57,59,61,65,66,67,68,69,71,76,82,112,124,127,130,131,132,133,134,138,140,141,142,143,146,147,148,156,164,165],html_entity_decod:[1,143],html_escap:[1,24,42,57,106,143],htmlspecialchar:[1,24,131,145],http:[1,24,26,33,40,44,45,46,50,51,52,57,58,65,66,69,82,92,94,102,106,109,123,124,127,131,135,136,140,141,144,146,149,151,154,158,160,165],http_client_ip:[1,135],http_header:40,http_host:[106,109],http_raw_post_data:1,http_refer:1,http_x_client_ip:[1,135],http_x_cluster_client_ip:[1,135],http_x_forwarded_for:[1,135],http_x_requested_with:135,httponli:[1,51,135,144],human:[1,18,46,52,60,69,76,131],human_to_unix:[1,52],hundr:[1,150],hyperlink:69,hyphen:1,iOS:1,i_respond:151,iana:127,ibas:[1,41],ico:58,icon:[58,69],iconv:[1,25],iconv_en:42,ics:1,id_123:43,id_:43,ideal:131,idenitif:140,ident:[1,3,4,9,14,15,26,27,29,31,34,42,45,51,52,57,58,68,69,93,122,125,126,131,133,135,142,147,149],identif:1,identifi:[1,2,7,14,19,67,125,130,139,147,150,164],idiom:137,idl:[1,6,7],idn_to_ascii:1,ids:58,ietf:1,if_exist:9,if_not_exist:9,ignit:1,ignor:[1,14,16,17,68,70,106,129,139,141,142,144,147,152,160],illus:49,illustr:[14,151,154],imag:[1,6,44,50,58,64,65,69,71,90,91,92,93,126,127,130,131,134,136,143,155,156],image_arrai:65,image_height:130,image_lib:[1,53,83,133],image_librari:133,image_mirror_gd:1,image_properti:58,image_reproport:1,image_res:133,image_size_str:130,image_typ:130,image_url:65,image_width:130,imagecr:1,imagecreatetruecolor:1,imageid:50,imagejpeg:1,imagemagick:[1,133,156],imagepng:1,imagin:165,imap_8bit:1,img:[1,50,58,127],img_height:50,img_id:[1,50],img_path:50,img_url:50,img_width:50,immedi:[1,22,35],impact:[93,129],implement:[1,7,14,16,25,29,106,129,131,137,144,146],impli:153,implic:[27,106,109],implicit:1,imposs:[1,128,129],improperli:1,improv:[1,44,81,93,106,128],in_arrai:[34,106,109],in_list:[1,131],in_particular:45,inabl:45,inaccess:23,inadvert:1,inc:30,incident:106,includ:[0,1,2,4,7,9,14,17,18,21,24,29,34,39,40,44,45,46,47,52,53,56,67,69,73,90,91,92,93,106,125,127,129,130,131,132,135,136,138,142,143,144,149,151,152,153,155,157,162,164,165],include_bas:138,include_path:[1,56],inclus:1,incom:[146,151],incompat:1,incomplet:[1,146],inconsist:1,inconveni:[65,106],incorpor:[137,160],incorrect:[1,45,57,129,138],incorrectli:1,increas:[1,45,66,73,144],increment:[1,66,123,124,128,129,130],increment_str:[1,66],inde:[1,45],indefinit:0,indent:2,independ:[4,7,14,16,125,138],index:[1,3,8,15,18,23,26,27,32,33,35,38,42,43,44,47,49,51,53,56,57,58,65,66,69,73,74,77,78,79,80,81,83,84,85,86,87,88,89,90,91,92,93,94,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,113,114,115,116,117,118,119,124,125,126,130,131,135,139,141,144,145,146,149,151,154,155,162,164,165],index_kei:25,index_pag:[1,58,69,74],indian:52,indic:[0,1,6,33,37,43,45,49,52,125,126,130,131,133,136],individu:[1,3,8,9,17,123,135,136,142,145,146,164],ineffect:106,infinit:1,inflect:1,inflector:[1,59,71],influenc:129,info:[1,24,33,43,56,64,68,69,120,122,127,129,131,133,138,146,150,151],inform:[0,1,2,3,5,6,12,14,16,22,23,24,25,26,33,39,40,44,45,50,56,57,69,74,82,90,102,106,122,123,124,125,127,128,129,130,135,136,138,140,143,144,145,146,149,150,151,155,160,162,164,165],information_about_someth:45,ing:1,ingredi:129,inherit:[1,26,28,124],ini:[1,19,45,63,67,115,130,144],ini_get:[1,45],ini_set:45,init:[1,75,76,77,78,79,80,120],init_pagin:1,init_unit_test:77,initi:[1,3,5,7,21,27,31,33,34,37,39,44,66,122,126,127,131,135,137,138,140,141,149,154],inject:[1,130],inlin:[1,58,65,127],inner:[1,14,35],innodb:[9,16],input:[1,7,13,24,25,27,39,45,49,50,51,52,53,55,56,57,60,64,65,66,67,68,69,70,71,83,84,112,113,116,124,129,130,131,134,138,143,144,145,146,147,149,162],input_d:116,input_format:116,input_stream:[1,106,135],insan:80,insecur:[1,106,126],insensit:[1,43,140,143],insert:[1,3,7,10,13,17,18,24,39,40,43,45,65,67,125,131,133,140,143,146,160,162,164],insert_batch:[1,14],insert_entri:39,insert_id:[1,10],insert_str:[7,10,50,146],insid:[1,14,18,20,27,31,35,38,106,113,120,137,142,144,152,162],insight:161,inspect:125,inspir:30,instad:1,instal:[1,5,18,24,45,65,82,88,102,122,130,133,144,156,157,162,165],instanc:[1,3,6,7,9,14,15,20,29,35,43,45,66,67,68,93,124,127,128,129,130,131,137,138,140,141,145,151],instanti:[1,6,7,15,20,26,35,144,151,158],instead:[1,2,3,6,9,12,14,15,17,19,20,23,26,27,29,34,35,43,44,45,52,54,56,57,58,60,64,65,66,70,109,112,122,127,128,129,130,131,133,138,139,141,142,143,144,145,162,164,165],institut:[30,153],instruct:[1,21,45,71,76,77,78,79,80,81,82,83,138,151],integ:[1,9,10,14,15,45,53,131,133,144,148],integr:[23,67,129],intel:150,intellig:[1,6,47,69,126,156],intend:[1,7,14,26,34,38,52,66,73,106,125,127,128,131,133,141,144,146,148,163],intens:[3,56,68,147],intent:[45,106,144],interact:[23,129],interbas:[1,10,17,41],interchang:[129,138],interest:48,interf:1,interfac:[1,14,23,33,48,133,135,144,155],interfer:144,interior:45,intermedi:161,intermediari:160,intern:[1,15,44,45,69,82,96,106,125,129,137,144],internation:1,internet:[1,106,151],interpret:1,intersect:1,interv:52,interven:140,intervent:[128,140],intl:1,intrigu:58,introduc:[24,45,90,161,163,164],introduct:[116,157,161,163],intuit:156,invalid:[1,45,52,124,131,133,143,144,151],invalid_dimens:1,invalid_files:1,invalid_filetyp:1,invalid_select:45,invalu:45,invas:1,invent:44,invis:136,invoice_id:14,invok:[27,31,35,37,46,76,122,131,135,158],involv:[0,37,124,130,133,148,151],ip_address:[1,50,98,106,135,144,146],iphon:150,ipv4:[131,135],ipv6:[1,98,131,135],iran:52,irc:161,irkutsk:52,is_:1,is_ajax_request:[1,135],is_allowed_filetyp:1,is_allowed_typ:1,is_arrai:[34,45,148],is_ascii:1,is_bool:148,is_brows:[1,150],is_cal:[1,131],is_cli:[1,23,24,106,135],is_cli_request:[1,135],is_count:[1,60],is_dir:132,is_doubl:148,is_fals:148,is_float:148,is_http:[1,24,42],is_imag:[1,64,130,143],is_int:148,is_load:[1,42,126,138],is_mobil:[1,150],is_natur:131,is_natural_no_zero:131,is_nul:148,is_numer:[1,44,148],is_object:[1,148],is_php:[1,24,42],is_really_writ:[1,24,42],is_referr:[1,150],is_resourc:[1,148],is_robot:[1,150],is_str:148,is_support:[1,123],is_tru:148,is_uniqu:[1,131],is_unix:52,is_writ:24,is_write_typ:[1,7],island:52,isn:[1,9,14,17,33,43,49,129,131,135,137],iso8601:[1,151],iso:[52,127],isol:1,isp:144,isset:[1,15,32,45,135,144],issu:[1,6,32,41,45,93,115,144,146],item1:144,item2:[106,144],item3:144,item:[1,7,14,19,20,21,24,27,29,34,35,46,47,49,57,66,71,76,80,82,120,123,127,130,131,135,137,141,144,146,148,150,151,155,163,164,165],item_nam:126,item_valu:126,iter:[25,45,66,123,142,145],its:[1,3,13,14,15,18,24,26,38,42,43,44,45,51,52,53,54,57,69,106,112,113,116,119,120,124,126,129,130,131,133,135,136,137,138,141,144,151,152,155,158,161,164,165],itself:[1,2,14,15,33,45,92,106,112,129,131,144,155],jame:14,jan:[1,124],januari:[1,124],japan:52,jar:1,java:24,javascript:[1,18,24,44,51,57,65,69,71,93,133,134,135,143],javascript_ajax_img:136,javascript_loc:136,jefferson:49,jimmi:66,job:[23,165],joe:[14,19,43,57,66,132,149],john:[2,23,57,133,142,145,151],johndo:[57,131,144],join:[1,14,45,144],journal:43,jpeg:[1,130,140],jpg:[50,54,58,67,127,130,133,140,152],jqueri:1,js_insert_smilei:[1,106],js_library_driv:136,jsmith:151,json:140,json_encod:140,json_pretty_print:140,json_unescaped_slash:140,json_unescaped_unicod:140,jsref:69,judg:156,juli:1,jun:1,june:[1,124],just:[1,7,9,14,16,17,18,21,23,29,34,44,49,57,66,69,70,94,106,112,115,127,129,131,133,135,138,139,141,143,144,156,162,164],kaliningrad:52,kamchatka:52,kdb:1,keep:[1,3,7,14,16,17,18,33,45,72,73,106,123,126,128,129,136,139,141,144],keep_flashdata:[1,144],keepal:1,kei:[1,5,7,12,13,14,15,17,24,25,32,40,43,45,47,50,57,61,73,93,106,123,124,129,131,135,137,138,141,144,145,146,149,150,151,164,165],kept:[1,2,55,65,106,125,128,135,136,142,143,144],key_prefix:[1,123],keydown:136,keyup:136,keyword:[1,14,45,58],kill:1,kilobyt:130,kind:[1,33,66,67,106,144,153],king:9,kml:1,kmz:1,know:[2,9,12,17,23,26,27,41,43,44,106,128,129,135,144,156,162,165],knowledg:[0,144],known:[1,14,25,27,44,106,144,150],known_str:25,korea:52,krasnoyarsk:52,kudo:1,label:[1,9,57,61,131,162],label_text:57,lack:[106,144],lambda:35,lang:[1,42,45,61,106,126,131,137,138,150],langfil:137,languag:[1,21,23,27,45,48,52,53,59,62,71,75,76,77,80,82,83,86,87,88,89,90,91,92,126,129,131,134,136,138,141,150,164],language_kei:[61,137],lanka:52,lao:52,larg:[1,15,17,26,29,45,48,57,106,127,145,149,151,156],larger:[1,33,93,133],last:[1,7,10,13,15,19,124,135,138,140,144,162,164,165],last_act:[1,96,106,144],last_activity_idx:96,last_citi:45,last_link:[1,141],last_login:15,last_nam:151,last_queri:[1,7,10,40],last_row:15,last_tag_clos:141,last_tag_open:141,last_upd:140,last_visit:1,lastli:[3,18,120,149,151],lastnam:[142,151],later:[14,96,106,112,116,119,139,144,162,164,165],latest:[1,2,139,165],latest_stuff:152,latin:[1,44],latter:[45,162],layer:[1,25,41,164],layout:[17,28,145],lead:[1,43,45,66,149],lean:[142,155],leap:52,learn:[16,43,48,73,126,138,144,155,157],least:[1,24,113,129,131,144],leav:[1,35,44,45,64,69,80,94,127,129,131,133,148,162],left:[14,17,26,45,67,90,133,136,141,142,143,149,151,164,165],legaci:[1,26,106,128,144],legacy_mod:128,legend:[57,133],legend_text:57,legibl:45,len:66,length:[1,7,12,22,25,44,66,67,130,131,133,143],less:[1,33,45,67,69,70,131,158],less_than:[1,131],less_than_equal_to:131,let:[1,3,4,5,7,12,13,14,22,33,38,39,43,47,48,49,51,52,54,57,58,65,76,80,106,123,125,127,129,131,132,133,135,137,138,142,144,145,146,149,150,151,155,162,165],letter:[1,26,39,45,52,66,106,128,137,165],level:[1,33,45,53,58,106,133,144,147,152],lexer:18,liabil:153,liabl:153,lib:1,libari:1,librari:[1,2,6,14,18,20,21,24,26,27,28,30,31,34,35,36,38,39,40,44,45,46,48,50,51,53,55,57,64,65,68,69,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,96,112,115,116,119,120,124,125,130,131,132,133,137,138,139,141,142,145,146,147,150,151,152,154,155,156,157,160,162,164,165],library_path:133,library_src:136,licens:[0,1,71,155],life:143,lift:6,light:[128,156,158],lightbox:58,lightest:158,lightweight:137,like:[1,3,4,5,6,7,10,12,13,14,15,16,18,19,20,23,24,25,26,27,29,32,34,35,38,39,43,44,45,46,47,48,49,50,52,57,65,67,69,70,73,76,79,80,82,90,93,106,115,120,122,124,125,126,127,128,129,130,131,132,133,135,136,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,155,160,162,165],likewis:133,limit:[1,4,8,15,17,25,44,45,47,50,52,67,122,127,130,131,133,144,146,153],limit_charact:146,line:[1,2,5,6,14,16,17,19,24,26,40,48,52,58,61,68,81,85,92,96,109,127,135,140,144,147,148,162,164,165],linear:128,linebreak:147,link:[1,18,34,45,58,63,65,69,120,127,142,144],link_tag:[1,58],linkifi:69,linux:[23,144,150],list:[1,5,7,15,19,24,26,34,35,40,42,44,47,52,57,58,64,67,69,106,113,123,127,128,129,131,132,133,140,141,144,145,146,148,150,151,152,156],list_databas:[1,17],list_field:[1,7,12,15],list_fil:132,list_tabl:[1,7,12],listen:[144,151],liter:[1,43,44,57,148],littl:[3,90,142,146,148],live:[13,32,123,144],load:[1,3,6,8,9,15,17,18,20,22,23,24,26,27,31,32,35,36,37,40,43,71,74,79,81,86,96,106,123,124,125,127,128,129,130,131,132,133,136,138,139,140,141,142,144,145,146,147,148,150,151,152,154,155,158,162,163,164,165],load_class:[1,42],loader:[1,9,17,21,27,53,71,83,84,123,134,136,140,144],local:[1,7,18,26,27,29,42,52,69,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,97,99,100,132,137,149,156,162],local_tim:124,local_to_gmt:52,localdomain:1,localhost1:5,localhost2:5,localhost:[1,5,6,39,136,144,151],locat:[1,5,26,29,33,34,35,37,38,39,52,65,69,73,76,106,123,126,131,133,136,137,138,144,146,149,150,165],lock:[1,56,106,144],locpath:132,log:[2,16,27,33,43,71,82,93,132,137,144,146,156],log_date_format:1,log_error:[1,33,82,137],log_file_extens:1,log_file_permiss:1,log_messag:[1,16,33,42],log_path:1,log_threshold:1,logged_in:[69,144],logger:1,logic:[1,7,14,22,32,48,66,106,109,155,160],login:[43,69],logout:144,loki97:129,lombardi:49,longer:[1,2,15,22,45,93,106,113,116,128,129,131,136,138,144],longtext:1,look:[1,2,12,13,17,26,27,29,34,39,43,44,45,47,56,57,70,74,90,96,106,120,131,133,135,137,138,139,140,143,144,146,147,151,162,164,165],loop:[1,15,45,66,125,127,133,138,164],loos:[34,45,58,148,158,160],lord:52,lose:[45,49,129],loss:144,lost:[1,144],lot:[15,27,68,143,144,147,162],loui:49,love:[58,155],low:[1,45,67,106,129],lower:[1,5,24,29,43,66,69,129,130,135],lowercas:[1,39,45,69,106,128,135,162],lowest:[33,127],lru:123,luck:49,m4a:1,m4u:1,mac:[1,23,45,150],machin:139,macintosh:150,made:[1,2,14,47,72,81,94,95,96,106,108,112,136,158,162,164,165],magic:[1,144],magic_quotes_runtim:1,mai:[0,1,3,7,9,14,17,20,24,26,32,33,35,38,43,44,45,47,53,57,61,67,68,93,106,113,115,125,126,128,129,131,133,136,137,138,139,142,143,144,146,147,150,151,158,164,165],mail:[1,2,55,57,69,106,127,144,156],mailpath:127,mailto:69,mailtyp:[127,138],main:[1,2,5,20,26,28,33,38,42,53,56,57,73,76,106,120,126,135,136,138,140,144,156,164,165],maintain:[0,1,2,28,29,30,67,106,128,133,142,144,152,155,160],maintain_ratio:[1,133],mainten:1,major:[14,18,133],make:[0,1,2,6,9,14,15,16,19,23,26,27,29,35,39,45,46,49,57,65,66,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,108,110,111,112,113,114,115,116,117,118,119,123,124,125,127,128,130,131,132,135,140,144,146,151,152,157,160,162,164,165],make_column:[65,145],male:149,malform:1,malici:[44,143],malsup:136,man:1,manag:[1,9,17,32,36,39,65,71,125,126,156,161],mandatori:129,mani:[2,3,5,9,13,16,23,30,44,58,66,124,131,138,144,145,155],manipul:[1,11,45,71,134,144,155,156],manner:[1,2,4,45,106,129,139,140,144],manual:[1,3,5,7,14,15,22,24,25,26,39,102,106,109,119,122,127,128,131,132,135,136,138,140,143,144,149],map:[43,53,65,138,151,165],mar:1,march:1,marco:1,margin:[57,155],marginleft:136,mari:145,mario:49,mark:[1,7,13,24,40,57,67,74,96,106,122,144],mark_as_flash:144,mark_as_temp:[1,144],markdown:18,marker:[1,122,133,144],markup:[58,130,136],marquesa:52,mass:93,master:[2,52,126,133],master_dim:[1,133],match:[1,7,14,25,26,29,39,43,45,57,106,125,129,131,138,144,148,155,165],matching_nam:1,materi:[7,129],math:58,mathml1:58,mathml2:58,mathml:58,matic:151,matter:[74,122,144],max:[1,12,14,146],max_filenam:[1,130],max_filename_incr:[1,130],max_height:130,max_length:[12,67,131],max_siz:130,max_width:130,maximum:[1,12,14,22,25,67,127,128,129,130,131,133,142,155,158],maxlength:[1,57,125],maxlifetim:144,mb_convert_encod:1,mb_enabl:[1,25,42],mb_mime_encodehead:1,mb_strlen:[1,25],mb_strpo:25,mb_substr:25,mbstring:[1,25],mcrypt:[1,93,102,106,128,129],mcrypt_blowfish:128,mcrypt_create_iv:[1,25,143],mcrypt_dev_urandom:[1,25,129],mcrypt_mode_cbc:[1,128],mcrypt_mode_cfb:128,mcrypt_mode_ecb:[1,128],mcrypt_rijndael_256:128,md5:[1,44,64,66,106,129],mdate:52,mean:[2,7,8,16,35,45,52,81,94,106,125,126,128,129,136,144,156,162,165],meant:[137,144],measur:[73,80,133],mechan:[1,9,35,106,128,129,144,148],med:57,media:58,medium:[57,145],mediumint:1,meet:[2,45,129,131,158],member:[3,7,14,30,131,135],member_ag:14,member_id:[3,7,57,151],member_nam:7,membership:52,memcach:1,memori:[1,15,17,22,26,40,123,133],memory_usag:[40,122,140],mention:[1,129,144],menu:[1,47,52,57,131],menubar:1,menuitem:142,merchant:153,mere:[2,49],merg:[1,2,14,126,138,153],mess:27,messag:[1,2,7,13,16,17,19,23,24,26,33,47,55,57,80,82,106,126,127,130,132,133,136,137,139,140,144,146,151,162],message_kei:137,messagebodi:131,messi:131,met:[25,123,129,144],met_win_open:69,meta:[1,12,15,58],metadata:[1,11,71,106,123],metaweblog:151,meth:[18,127],method:[1,2,6,7,9,13,17,20,22,23,27,28,29,31,32,34,35,37,39,40,42,43,46,47,57,69,85,92,93,94,112,123,124,125,126,127,128,129,130,132,135,136,137,138,139,140,141,142,143,144,145,146,147,149,150,151,152,162,164,165],method_exist:26,methodolog:35,metro:149,micro:50,microsecond:[1,7],microsoft:1,microtim:50,middl:[1,67,133],might:[1,2,5,15,17,19,22,24,26,33,35,39,43,46,47,50,51,56,65,67,74,90,106,127,129,131,133,135,137,138,144,145,148,151,161,162,164,165],migrat:[1,71,90,134],migration_add_blog:139,migration_auto_latest:139,migration_en:139,migration_path:[1,139],migration_t:139,migration_typ:[1,139],migration_vers:139,millisecond:136,mime:[1,24,54,56,80,85,93,127,130,140],mime_content_typ:1,mime_typ:140,mimes_typ:1,mimic:147,min:[1,14],min_height:[1,130],min_length:131,min_width:[1,130],mind:[13,44,49,128,129,141,144],minim:[14,19,44,48,57,131,155,157,158,160],minimum:[14,130,131,141],minor:1,minut:[22,52,123,140,144],mirror:132,misc_kei:137,misc_model:106,mismatch:1,miss:[1,5,41,45,50,69,123,131,137,146,149,150],misspel:1,mistak:[1,106],mistaken:45,mistakenli:1,mit:[1,155],mitig:[1,44],mix:[7,14,15,18,24,25,33,43,49,51,52,54,57,58,62,66,67,69,123,126,127,130,131,135,137,138,139,140,141,143,144,145,148,149,151,152,164],mkdir:[132,144],mobil:[1,150],mod_mim:130,mod_mime_fix:[1,130],mod_rewrit:46,mode:[1,5,7,44,56,123,127,128,132,143,144,152],model:[1,2,20,21,23,29,36,38,46,49,56,71,76,93,106,122,131,138,154,155,156,159,161,163],model_nam:[39,138],models_info:56,modest:1,modif:[0,82,94,95,96,106,108,144],modifi:[0,1,7,35,44,45,56,88,96,106,140,153,164],modify_column:[1,9],modul:133,mom:[47,151],moment:122,mondai:[124,145],monei:49,monolith:48,month:[1,45,52],month_typ:124,mood:58,more:[1,3,5,6,14,15,16,23,24,25,26,32,33,34,35,39,43,44,45,46,47,49,52,55,57,58,61,64,66,67,68,69,73,82,90,93,94,96,97,98,106,109,122,123,124,125,127,129,131,133,138,140,144,146,147,151,155,156,158,160,161,162,163,165],moscow:52,most:[1,6,13,15,16,22,27,29,33,34,37,41,44,52,67,106,120,123,124,127,128,129,130,131,132,133,142,144,145,146,147,148,150,151,152,155,160],mostli:[17,112],mountain:52,mousedown:136,mouseov:136,mouseup:136,move:[1,15,38,73,120,131,132,133,137],mozilla:150,mp3:1,mp4:1,mpeg3:1,mpg:1,msdownload:1,msexcel:1,msg:[128,146],mssql:[1,7,41],mssql_get_last_messag:1,msssql:1,mt_rand:66,mtime:1,mua:1,much:[1,7,25,48,52,106,112,135,138,139,144,155],mug:125,multi:[1,5,35,47,58,125,142,144,145],multibyt:1,multical:1,multidimension:[57,58,131],multipart:[1,57,130],multipl:[1,2,5,7,9,14,16,36,37,43,45,57,60,66,68,71,109,120,122,123,126,127,130,131,135,138,142,143,144,145,146,151,152,156],multiplelanguag:137,multiselect:57,must:[1,2,4,5,6,9,14,15,17,18,22,25,26,27,28,29,33,35,39,40,42,43,44,45,47,50,52,56,57,65,69,73,80,82,90,93,102,106,113,120,122,123,124,125,127,128,129,130,131,132,133,136,137,138,139,140,144,146,148,151,152,155],mutat:1,mvc:[39,47,155,160,163,165],my_:[27,29,34,82,123],my_app:138,my_app_index:138,my_arch:152,my_arrai:57,my_array_help:34,my_articl:46,my_backup:152,my_bio:152,my_blog:151,my_cach:123,my_cached_item:123,my_calendar:138,my_const:45,my_control:[27,93],my_db:9,my_dog_spot:60,my_email:[29,106],my_foo:123,my_input:27,my_log:106,my_mark_end:122,my_mark_start:122,my_model:[1,86],my_sess:138,my_shap:49,my_tabl:[8,10,14,15,145],my_uri:1,my_view:1,myanmar:52,myarchiv:152,mybackup:17,mybutton:57,mycheck:57,myclass:[14,29,35,45,61,141],myconst:45,mycustomclass:57,mydata1:152,mydata2:152,mydatabas:[6,39],mydirectori:53,mydogspot:60,myfield:57,myfil:[47,132,138],myfold:[132,152],myforg:9,myform:[57,131],myfunct:35,myisam:16,mylibrari:106,mylist:58,mymethod:35,myotherclass:35,myothermethod:35,mypassword:[6,39,131],myphoto:152,mypic:[130,133],mypic_thumb:133,myprefix_:135,myradio:57,mysecretkei:138,myselect:57,mysql:[1,5,6,7,9,10,13,14,16,17,41,52,90,115,144,164],mysql_:4,mysql_escape_str:1,mysql_get_client_info:4,mysql_set_charset:1,mysql_to_unix:52,mysqli:[1,5,6,7,39,41,83,106],mysqli_client_ssl_dont_verify_server_cert:1,mysqli_driv:83,mystyl:58,mysubmit:57,mytabl:[3,8,14,17,145],mytext:54,myuser:73,myusernam:[6,39],myutil:17,name:[1,3,4,5,6,7,8,9,10,12,13,14,15,24,27,28,31,34,35,36,37,38,39,40,43,44,47,50,51,52,53,54,56,57,58,64,65,66,69,71,73,76,90,93,115,120,122,123,124,125,126,127,129,130,132,133,135,136,137,138,140,142,143,144,145,146,148,149,150,151,152,155,162,165],name_of_last_city_us:45,namepro:1,namespac:1,narrow:44,narrowli:158,nasti:162,nativ:[1,4,5,7,13,15,16,20,24,25,27,34,44,50,52,55,56,58,64,66,68,82,93,106,129,131,133,140,143,144,145,147,155,157,165],natur:[1,14,113,131],navig:[23,141,143],nba:131,nbs:[1,58],nbsp:[1,58,106,124,145],nearli:[27,29,48,69,125,133],nears:22,necessari:[1,7,14,26,45,57,88,106,112,128,129,131,144,151],necessarili:[115,144],need:[1,2,3,4,5,6,7,13,14,16,17,18,20,21,22,23,26,27,29,34,35,38,39,40,43,44,45,46,47,48,50,51,52,54,57,65,67,69,74,88,93,94,95,96,98,106,109,120,122,123,125,126,127,128,129,130,131,133,135,136,137,138,139,140,141,142,144,145,146,148,149,150,151,152,154,155,158,160,161,162,164,165],needl:[25,34],needless:1,needlessli:1,neg:[1,45,46,144],negat:[1,123],neither:[129,133],nepal:52,nest:[1,14,16,39,138],net:[1,24,102,113,123,128],netpbm:[1,133,156],network:1,never:[1,26,27,44,45,47,106,109,128,142,144],new_data:128,new_entri:151,new_field:106,new_fil:132,new_imag:[1,133],new_list:145,new_nam:9,new_path:152,new_post:151,new_table_nam:9,newdata:144,newer:[1,2,25,41,45],newest:[125,139],newest_first:125,newfoundland:52,newli:[1,128,131],newlin:[1,17,45,58,66,68,127,131,135,147],newnam:[1,127],newprefix_:13,newprefix_tablenam:13,news_item:164,news_model:[162,164],newslett:57,newspac:1,newus:144,next:[1,2,3,14,15,32,65,66,106,131,133,139,144,146,157,163,164],next_link:[1,141],next_prev_url:[1,124],next_row:[1,15],next_tag_clos:141,next_tag_open:141,next_url:124,nginx:32,nice:[67,131,162],nice_d:[1,52],nicknam:151,night:58,nine:145,niue:52,nl2br:[68,147],nl2br_except_pr:[68,147],no_file_select:1,no_file_typ:1,no_result:149,nomin:96,non:[1,9,15,24,25,43,44,45,58,63,67,93,106,135,140,144,145,147],non_existent_directori:63,non_existent_fil:63,none:[1,7,17,25,44,124,127,130,133,139,144],nonexist:1,nonexistent_librari:138,noninfring:153,nope:128,nor:[13,14,66,106,129],norfolk:52,normal:[1,14,15,19,20,22,23,26,27,29,43,52,66,67,73,126,127,131,133,135,136,140,141,148,149,154,160,165],not_group_start:14,not_lik:[1,14],notabl:[1,15,106],notat:[1,56,133],note:[1,2,6,8,9,13,14,15,18,19,26,27,29,33,34,35,39,52,55,58,66,72,82,106,120,121,124,125,127,129,130,131,133,135,136,138,140,145,148,165],noth:[67,81,112,127,131,137,141,144,156,164],notic:[1,14,19,29,33,35,45,47,65,122,124,129,130,131,133,136,140,142,144,145,146,148,151,153,162,164],notice_area:136,notif:1,notifi:127,novemb:1,now:[1,23,26,47,50,52,82,92,93,94,95,102,109,112,113,116,119,120,123,131,135,136,138,144,151,161,162,164,165],nowher:63,nozero:66,num:[43,58,62,66],num_field:[3,15],num_link:[1,141],num_row:[1,8,15],num_tag_clos:141,num_tag_open:141,number:[1,5,7,9,10,14,15,19,22,24,25,31,40,43,44,45,49,50,51,52,58,59,66,67,69,70,71,93,106,122,124,125,127,128,129,130,131,132,133,135,136,139,141,142,144,145,146,148,149,150,151],number_lang:62,numer:[1,14,25,43,44,52,53,56,62,66,106,124,125,131,135,139],nutshel:[23,26],obfusc:69,object:[1,3,4,6,7,9,12,13,14,17,20,29,34,39,47,57,124,125,128,129,130,131,132,133,136,138,142,144,145,146,147,148,150,151,152,158,164,165],object_nam:138,oblig:126,obscur:[129,133],observ:1,obtain:[137,153],obviou:[2,23],obvious:4,occur:[1,13,18,32,45,66,126,138],occurr:[66,116],oci8:[1,41],oci:1,oci_execut:1,oci_fetch:1,oct:1,octal:[56,132,133],octal_permiss:[1,56],octob:1,odbc:[1,5,41,106],odbc_field_:1,odbc_insert_id:1,odbc_num_row:1,odd:149,ofb8:129,ofb:129,off:[0,1,2,3,10,16,26,44,57,130,132,141],offer:[11,25,106,112,129,131],offici:[1,30,106,113,144],offlin:[76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119],offset:[1,14,15,25,52,123,133,141,149],often:[4,5,32,45,106,129,144,147,161,165],ogg:1,okai:45,old:[1,41,44,50,69,90,106,112,128,129,131,132,140,141,144],old_encrypted_str:128,old_fil:132,old_nam:9,old_table_nam:9,older:[1,67,106,115,128,144],oldest:125,omit:[1,14,17,45,106,124,125,135,144,146],ommit:25,omsk:52,onc:[1,3,8,9,14,17,20,22,29,33,34,37,39,43,44,50,124,125,128,129,130,132,133,135,136,137,138,142,144,145,146,147,148,150,151,152,157,164],onchang:57,onclick:57,one:[1,2,3,5,6,7,9,13,14,15,16,17,18,19,23,24,26,27,29,33,34,35,37,40,43,44,45,47,48,49,52,57,58,64,66,69,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,125,126,127,128,129,130,131,133,135,136,137,138,140,141,142,143,144,145,146,147,148,150,151,155,157,162,164,165],ones:[1,7,26,27,42,43,58,67,69,106,113,129,131,136,137,144],onli:[1,2,3,5,6,7,9,13,14,15,17,18,20,22,24,25,26,29,33,35,38,41,43,44,45,49,50,51,52,53,55,56,57,58,65,66,67,69,73,74,80,81,106,115,122,123,125,126,127,128,129,130,131,132,133,135,136,137,140,141,142,143,144,145,146,147,148,150,151,155,156,158,162,164],onlin:16,onto:140,oof:45,oop:[1,29,137],opac:133,open:[0,1,2,14,21,23,26,27,29,34,38,39,46,47,57,67,69,73,74,76,80,81,82,88,96,120,126,128,129,130,131,132,133,135,137,138,141,142,144,145,146,162,164,165],open_basedir:56,openssl:[106,129],openssl_random_pseudo_byt:[1,25,143],openxml:1,oper:[1,2,3,12,14,24,34,42,56,123,129,133,144,150,151,163,164],opera:1,oppos:[1,106,129],opposit:[52,136],opt:[106,144,155],optgroup:[1,57],optim:[1,3,40,140],optimize_databas:17,optimize_t:[1,17],option:[1,5,6,7,9,14,15,16,17,18,19,22,25,26,27,29,32,33,35,39,40,43,45,46,47,48,52,56,57,58,62,63,67,69,76,79,82,86,90,106,116,120,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,143,144,145,147,148,149,150,151,155],option_nam:125,option_valu:125,or_group_start:14,or_hav:[1,14],or_lik:[1,14],or_not_group_start:14,or_not_lik:[1,14],or_wher:[1,14],or_where_in:[1,14],or_where_not_in:[1,14],oracl:[1,5,14,41],order:[1,7,9,15,17,18,22,26,28,29,33,35,40,42,43,44,45,50,56,57,58,69,98,102,106,120,123,125,126,127,128,129,130,131,133,135,137,139,142,143,144,146,151,157,158,165],order_bi:[1,14],orderbi:[1,14,93],ordin:69,org:[1,58,127],organ:[1,3,39,47,131,139,152],orhav:[1,93],orient:34,orig_data:128,orig_nam:130,orig_path_info:1,origin:[1,2,29,30,67,71,93,120,128,129,130,131,132,133,142,152,165],orlik:[1,14,93],orwher:[1,14,93],other:[0,1,2,6,7,12,14,16,18,23,24,29,32,33,34,35,44,45,46,47,51,52,57,58,66,69,73,76,86,106,112,120,124,125,128,129,130,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,157,158,160,162,163,164,165],other_db:[9,17],otherwis:[1,2,17,24,25,26,32,42,43,44,51,55,57,106,122,125,127,129,133,135,137,138,144,153],our:[2,14,23,44,106,113,129,131,138,144,146,155,157,158,161,162,164,165],ourselv:106,out:[1,2,3,7,19,24,42,44,45,49,57,73,127,129,133,139,144,151,153,161,162],outcom:14,outdat:44,outer:14,outlin:128,outperform:144,output:[1,9,10,13,17,22,23,25,27,32,35,40,44,45,52,61,66,69,70,71,81,106,112,122,123,124,127,129,133,134,135,136,137,142,143,151,165],output_compress:1,output_paramet:151,outsid:[1,46,67,129,136],oval:58,over:[1,7,24,43,45,52,57,58,69,124,133,136,151,163,164],overal:1,overcom:43,overkil:[27,29,34],overlay_watermark:1,overli:[1,3,45],overlin:18,overnight:145,overrid:[1,6,26,27,34,35,40,42,43,53,95,131,136,137,140,141,144],overridden:[1,26,128],overriden:1,oversight:1,overview:[71,163,164],overwrit:[1,126,130],overwritten:[1,106,130],own:[1,2,3,13,14,16,20,25,26,32,35,38,39,44,45,46,50,52,56,57,69,81,106,120,122,124,126,127,128,129,130,133,136,137,138,143,144,145,148,155,160,161],owner:[44,144],p10:1,p12:1,p7a:1,p7c:1,p7m:1,p7r:1,p7s:1,pacif:52,packag:[1,45,73,96,144,158],pad:[1,129,133],page1:14,page2:14,page:[1,2,3,6,8,14,19,29,33,35,37,40,43,44,45,46,47,50,52,56,57,58,65,67,68,69,71,73,74,76,77,78,79,80,81,82,83,90,113,119,122,125,127,133,136,138,140,142,144,147,151,155,156,157,159,160,162,163,164],page_query_str:141,page_titl:47,pagin:[1,3,53,71,134,156],pai:1,pair:[1,7,14,15,106,122,124,141,144,145,149,152],pakistan:52,par:1,paragraph:[1,70,131,147],param1:4,param2:4,param:[1,17,18,26,29,35,45,106,129,131,136,138,141,144,145,151],paramat:1,paramet:[1,2,3,4,7,9,10,13,14,15,16,17,18,23,24,25,26,33,35,39,43,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,93,94,106,122,123,124,125,126,127,128,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,152,164,165],parent:[1,26,27,29,31,39,130,138,144,164],parenthes:[1,14],parenthesi:[1,14,45],pars:[1,45,65,69,140,150],parse_exec_var:[1,140],parse_smilei:65,parse_str:[1,142],parse_templ:124,parser:[1,2,45,48,71,134,147,155,164],parserequest:1,part:[0,1,2,14,25,27,34,43,45,56,67,70,127,128,133,137,144,145,151,152,163],parti:[18,164],partial:[1,7,13,145],particip:155,particular:[3,6,7,10,12,14,15,16,17,34,35,38,39,47,66,67,69,122,125,126,131,137,144,146,150,151,153],particularli:[1,16,43,68,138,143,147,155,165],pass:[1,2,6,7,13,14,15,17,23,33,35,37,39,40,43,44,45,46,47,52,57,58,65,69,106,123,125,127,128,129,130,131,132,135,137,138,140,141,142,144,146,147,151,152,162,164,165],passconf:131,passion:58,passiv:132,password:[1,5,6,39,43,57,64,66,123,127,129,131,132,151],password_bcrypt:25,password_default:25,password_get_info:25,password_hash:[1,25],password_needs_rehash:25,password_verifi:25,passwordconfirm:131,past:[52,106,129],pastebin:2,pasteur:49,patch:[1,2,43,135],path:[1,3,5,6,7,17,21,23,24,33,35,38,39,50,51,53,54,56,59,65,71,73,93,125,126,127,130,132,133,135,137,138,139,141,142,143,144,152],path_cach:45,path_info:120,pattern:[1,8,11,14,43,44,160,161,165],paul:1,payment:14,pconnect:[1,5,6,39],pcre:1,pdf:[1,18,127],pdo:[1,5,6,10,15,41],pdo_mysql:1,pdo_sqlit:1,pdostat:1,pear:[1,48],pecl:144,pem:[1,5],peopl:[6,43,48,90,125,127,146,155],per:[1,17,22,43,106,126,127,141],per_pag:141,percent:[44,52],perfect:[133,162],perfectli:26,perform:[1,10,12,14,17,18,22,25,30,34,41,44,48,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,128,129,130,132,133,135,139,142,144,155,156,158,163,164],perhap:[27,29,34,131,144],period:[1,44,52,125,130,135,147,151],perm:[56,132],perman:[45,93,128,144],permiss:[22,23,56,82,130,132,133,144,153],permit:[0,1,3,4,5,9,10,14,17,21,24,26,29,33,35,43,57,58,60,63,64,80,120,122,125,127,128,129,130,131,132,135,140,144,145,149,151,152,153,160],permitted_uri_char:[1,80,106],persist:[1,5,7,49,127,128,144],person:[0,1,127,130,138,143,152,153],pertain:3,pg_escape_liter:1,pg_escape_str:1,pg_exec:13,pg_version:1,pgp:1,pgsql:[1,5],phd:142,phoenix:52,phooei:67,photo1:127,photo2:127,photo3:127,photo:[54,133,152],photoblog:151,php4:26,php5:63,php:[1,3,4,5,6,7,15,16,17,18,21,23,24,25,26,27,28,29,30,32,33,34,35,36,38,39,40,41,43,44,47,48,51,52,53,55,56,57,58,62,63,64,65,66,67,68,69,71,73,74,77,78,79,83,84,87,88,89,90,91,92,93,95,99,100,101,102,103,104,105,107,109,110,111,114,115,116,117,118,119,120,122,124,125,126,127,128,129,130,131,132,133,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,154,155,160,161,162,164,165],php_eol:[23,116,135],php_error:1,php_sapi:24,php_sapi_nam:1,phpdoc:2,phpdocument:1,phpdomain:18,phpredi:[123,144],phrase:67,physic:127,pick:45,pictur:[58,127],piec:[123,128,129,144,146,151,164],ping:[6,151],ping_url:146,pingomat:151,pink:58,pipe:[1,130,131],pixel:[130,133],pizza:58,place:[1,2,3,5,7,9,14,22,26,27,29,32,35,40,43,44,45,65,67,73,90,106,112,122,123,124,126,127,130,131,133,138,139,140,141,144,148,151,152,164],placehold:43,placement:1,plai:156,plain:[1,25,44,64,65,106,128,129,140,142],plain_text:129,plaintext:127,plaintext_str:128,plan:2,plant:151,platform:[1,4,5,7,10,14,16,17,24,144,150,156],playstat:1,pleas:[1,2,3,6,8,14,19,25,26,27,29,31,34,37,39,40,44,52,56,57,64,65,66,67,68,69,72,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,125,126,128,129,131,133,135,136,138,140,144,155],plu:[57,58,69,126,148],plugin:[1,75,76,85,86],plural:[1,60],pmachin:1,png:[1,56,69,130,133],point1:122,point2:122,point:[1,2,3,14,24,43,44,52,57,62,65,106,123,124,126,141,144,146,162,164,165],pointer:[1,15,163],poison:1,polici:24,pollut:1,poof:1,pool:[1,50],poor:156,poorli:52,pop:69,popen:1,popul:[1,124,145],popular:[16,123,129,144],popup:69,port:[1,5,123,127,132,144,151],portabl:[4,57,69,131],portion:[14,25,33,153],pose:32,posit:[1,7,9,15,25,67,123,133,151],posix:1,possibl:[1,2,3,14,17,20,27,31,38,43,44,45,73,80,90,93,106,125,128,129,133,138,140,141,142,157,158,164,165],post1:18,post:[1,26,39,40,43,44,49,57,69,106,130,131,140,143,146,157,162,164],post_control:35,post_controller_constructor:[1,35],post_dat:52,post_get:[1,106,135],post_imag:58,post_model:49,post_system:35,postgr:[1,5,10,41],postgresql:[1,5,10,13,41,106,115,144],potenti:[1,31,41,44,70,115,143,144],pound:67,power:[136,162,165],powerpoint:1,practic:[13,16,32,34,39,106,112,126,129,133,137,156,160],pragma:[1,140],prais:161,pre:[1,68,125,131,135,140,147,151],pre_control:35,pre_system:35,preced:[1,43,45,52,147,152],precis:[1,3,62,122],predetermin:131,pref:[17,124],prefer:[1,3,6,9,14,24,35,43,45,46,47,57,69,73,122,125,126,131,132,135,138,142,148,164],prefetch:[1,15],prefix:[1,4,5,7,14,26,45,51,57,66,69,82,93,106,109,123,131,135,137,139,141,146],prefix_singl:7,prefix_tablenam:13,preg_match:1,preg_quot:1,preg_replace_ev:1,prematur:81,prep:[1,44,57],prep_for_form:[1,131],prep_url:[1,69,131],prepar:[49,130,162],prepend:[1,13,14,51,129,131,135,138,149],present:[1,5,26,131,136,146,155,160],preserv:[1,133,143,144,146],preserve_filepath:152,presum:[58,129],pretend:1,pretti:[106,112,135],prev_link:[1,141],prev_tag_clos:141,prev_tag_open:141,prevent:[1,14,24,26,33,43,44,45,49,50,69,73,129,135,136,137,139,143,151,162],previou:[0,1,15,71,106,133,144,145,157],previous:[1,102,125,129,138,140,144],previous_row:15,previous_url:124,price:[125,155],primari:[1,5,7,9,12,14,50,126,144,146,151,164],primarili:163,primary_kei:12,principl:[29,163],print:[1,14,19,23,58,60,63,67,69,127],print_debugg:[1,127],print_r:[17,45,124,132,151],printabl:1,printer:58,prior:[1,35,79,128,130,139],prioriti:[1,33,127,129,138,144],privat:[1,5,73],privileg:17,prng:1,probabl:[3,129,144,162],problem:[1,2,33,67,106,131,144,157],problemat:[1,106],procedur:[1,33,34,35,131],process:[1,6,10,15,16,22,33,35,43,44,47,122,125,128,129,131,135,138,139,143,144,148,154,155,157,158,160],process_:26,processor:[68,147],produc:[1,3,8,9,10,13,14,15,16,52,57,58,67,69,93,106,129,138,141,148,149],product:[1,5,26,32,43,44,46,73,76,106,125,126,129,139,144,149],product_edit:43,product_id:149,product_id_rul:125,product_lookup:43,product_lookup_by_id:43,product_name_rul:125,product_name_saf:[1,125],product_opt:125,product_typ:43,profil:[1,36,71,84,93,140,156],profiler_no_memori:1,profiler_no_memory_usag:1,program:[41,129],programat:13,programm:[45,155,161],programmat:[1,34,106,139],progress:136,project:[0,2,5,23,30,48,155],prolif:45,prop:133,proper:[1,7,14,33,45,106,112,129,130,131,143],properli:[1,13,14,18,26,44,92,106,129,142,144,164],properti:[1,15,20,28,29,45,95,106,125,133,135,136,138,139,140,144,147],proprietari:1,protect:[1,14,15,20,26,29,43,64,70,95,106,143,147,162],protect_al:70,protect_braced_quot:147,protect_identifi:[1,7,13],proto:1,protocol:[1,66,69,74,120,127,132,135,144,156],prototyp:[5,6,29,35,39,43,50,52,86,126,130,131,137,145,146,149,151],prove:[45,55],proven:[44,106,129],provid:[0,1,5,7,9,12,14,15,18,25,31,32,33,34,35,44,45,48,52,55,58,64,69,85,96,106,113,124,125,126,127,128,129,130,131,135,136,137,142,143,144,145,146,147,149,150,153,155,162],proxi:[1,151],proxy_ip:[1,135],proxy_port:151,prune:23,pseudo:[1,122,124,129,140,142,148,155],public_html:132,publicli:[1,2,65,106,126,129,144],publish:[151,153],pull:[1,2,47,52,58],purchas:125,pure:[15,19,29,106,109,122,142],purg:43,purifi:106,purpos:[1,33,45,52,56,69,106,129,133,135,137,138,140,142,144,153,158],put:[1,3,13,14,15,16,22,23,26,38,43,44,47,50,57,65,74,106,112,122,127,129,130,131,133,135,141,144,145,146,148,151,164],pygment:18,python:18,qty:[1,125],qualiti:[2,133,156],quantiti:[1,57,125],queri:[1,3,4,6,7,11,12,16,39,40,44,50,53,71,76,90,106,115,131,136,138,141,142,144,145,146,155,156,162,163,164],query2:15,query_build:[5,53,106,138],query_str:[1,120],query_string_seg:141,query_toggle_count:[1,40],question:[1,2,3,13,58,66,74,115,157,161],quick:[2,11,13,71],quick_refer:1,quickli:18,quietli:45,quit:[1,18,22,34,45,58,146,148,151,155],quizz:1,quot:[1,7,13,17,45,49,57,66,70,147],quote_identifi:1,quoted_printable_encod:[1,24],quotes_to_ent:[1,66],raboof:45,race:1,radio:[1,57,131],radiu:49,rail:30,rais:[1,13],ram:129,ran:[49,145,162],rand:[1,14],random:[1,14,23,49,50,66,106,128,129,130,143],random_byt:1,random_el:[34,49],random_str:[1,66],randomli:[44,50],rang:[1,52,67,129,133,152,155],rar:1,rare:[13,93,129,144],raspberri:1,rather:[1,2,5,6,7,9,13,16,29,43,46,47,57,96,106,112,116,119,131,135,137,138,142,148,155,158],ratio:133,raw:[1,9,17,18,25,123,127,129,131,133,140,144,146,148],raw_data:129,raw_input_stream:[1,135],raw_nam:[1,130],raw_output:25,rc2:129,rc4:129,rdbm:1,rdfa:58,reach:164,reactor:[1,30],read:[1,3,7,8,13,14,24,31,34,37,39,40,44,45,47,54,56,73,90,93,106,121,122,131,132,135,138,144,152,155,157,161,162,163,165],read_dir:[1,152],read_fil:[1,56,152],readabl:[1,2,18,45,52,54,56,144],readi:[1,8,65,133,138,157],readm:[18,144],real:[1,18,30,47,122,127,151],realiti:49,realli:[1,2,3,13,16,24,44,69,106,129,144,155,156],realpath:1,reappear:136,reason:[1,2,3,5,13,14,23,26,44,45,66,81,106,125,129,138,141,144,146,151],rebuild:1,rec:58,receiv:[1,26,127,131,138,144,151],reciev:55,recipi:[1,55,127],recogn:[1,25],recommend:[1,2,16,19,24,41,44,45,67,74,90,112,113,115,127,129,130,132,138,161],recompil:152,reconnect:[1,7,14],record:[0,1,14,93,106,143,144,162,164],recreat:[132,152],recurs:[1,53,93,132,152],red:[29,35,49,50,58,125,131,145,149],redesign:1,redi:1,redirect:[1,20,29,43,46,69,127,151],redisexcept:1,redisplai:131,redistribut:0,reduc:[1,3,44,66,68,123,147],reduce_double_slash:[1,66],reduce_linebreak:[68,147],reduce_multipl:[1,66],reduct:1,redud:106,redund:1,reestablish:[1,7],refactor:1,refer:[1,20,24,26,29,35,43,44,51,93,157,161,165],referenc:[1,52,142],referr:150,reflect:[1,122],refresh:[1,22,69],regard:[14,33,44,45,90,124,131,133,138,158],regardless:[1,13,26,67,127,129,133,135,139],regener:[1,143,144],regex:[1,43,131],regex_match:131,register_glob:[1,135],regress:1,regular:[1,7,9,106,125,129,131,137,141,143,144,165],rehash:25,reilli:66,reject:[1,158],rel:[1,35,39,44,53,56,58,63,127,130,133,138,143],relat:[1,9,45,58,64,66,106,112,120,130,144,162],relationship:43,relative_path:143,releas:[1,24,72],relev:[5,68],reli:[1,9,17,45,106,109,113,144,158],reliabl:[1,67,69,106,109,144,150],relicens:1,reload:131,reloc:1,remain:[1,3,22,50,162],remap:[1,43,46],rememb:[3,13,23,47,106,109,131,138],remot:[1,132,151],remote_addr:144,remov:[1,9,14,22,24,32,44,64,66,73,82,86,125,136,138,140,143,155,165],remove_invisible_charact:[1,24,42],remove_package_path:138,remove_spac:130,rempath:132,renam:[1,5,14,73,76,93,106,120,130,132],rename_t:[1,9],render:[1,10,18,22,26,32,35,40,44,65,106,136,140,141,142,143,154,162,164,165],reorgan:1,repair_t:17,repeat:[1,58,66,142],repeat_password:57,repeatedli:129,repercuss:80,repertoir:136,replac:[1,12,13,14,17,19,34,43,47,50,65,67,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,95,99,100,101,102,103,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,128,140,142,162],repli:127,replic:144,reply_to:[1,127],replyto:127,repopul:[1,131],report:[1,16,24,33,40,44,45,73,106,127,135,140,150,162],repositori:[2,18,137],repres:[1,15,25,46,106,133,141,146,160,164],represent:[25,65,129,142],reproduc:2,request:[1,2,14,15,22,24,26,40,43,44,46,106,109,127,135,138,140,144,146,149,154,155,158,160,164,165],request_filenam:46,request_head:[1,135],request_method:[1,135],request_uri:[1,74,135],requir:[1,2,5,6,8,9,10,14,15,16,20,24,25,31,38,43,45,48,50,65,71,85,93,102,106,123,124,125,128,129,130,131,133,135,136,138,142,144,145,146,148,151,157,160,162],require_onc:76,res_datatyp:[1,148],reserv:[1,36,70,71,93,125,131,146],reset:[1,57,127,130,131,133,138],reset_data:14,reset_queri:[1,14],reset_valid:[1,131],resid:120,resiz:[1,69,133,136,156],resolv:[1,2,63],resort:144,resourc:[1,3,5,7,13,14,15,16,20,22,36,44,45,71,138,144,154,155,158,160,163],respect:[1,5,17,25,43,57,66,93,106,131],respons:[1,3,24,33,47,69,139,140,146],rest:[5,18,39,43,161],restart:1,restrict:[24,44,48,56,80,130,153],restrictor:14,restructuredtext:18,result:[1,3,4,6,7,10,11,12,13,16,25,39,40,45,58,62,66,71,95,106,122,129,133,138,140,141,142,143,144,145,148],result_arrai:[1,8,14,15,142,164],result_id:[3,4],result_object:15,retain:[1,128,144],retriev:[1,3,7,8,13,14,22,24,39,44,120,125,126,130,131,132,133,135,137,138,140,146,148,149,151,160,164],return_object:7,return_path:[1,127],returned_email:127,returned_valu:56,reus:[14,144,164],reusabl:158,reuse_query_str:[1,141],revalid:140,reveal:[136,156],revers:1,reverse_nam:15,review:106,rewrit:[1,19,82],rewrite_short_tag:[1,82],rewritecond:46,rewriteengin:46,rewriterul:46,rfc2616:1,rfc5321:1,rfc:[1,52,127,129],rich:[48,155],rick:[10,13,30],rid:93,right:[0,1,2,14,23,26,35,48,67,113,122,125,133,136,141,142,149,151,153,164,165],rijndael:129,risk:[1,130,144],robot:[1,58,150],robust:[55,127],roll:[7,16,139],rollback:[1,16],romanian:1,root:[2,5,17,26,38,43,56,73,76,130,135,144,164],root_path:152,rotat:[1,133,156],rotation_angl:133,roughli:128,round:[49,58,136,151],rout:[1,23,26,35,36,46,58,71,93,141,149,156,161,163],router:[1,27,83,106,154],routin:[1,3,17,34,44,130,131,158],row:[1,7,8,10,14,45,47,50,57,65,141,142,145,148],row_alt_end:145,row_alt_start:145,row_arrai:[8,15,164],row_end:145,row_id:125,row_object:15,row_start:145,rowcount:1,rowid:125,rpc:[1,44,71,134,155,156],rsa:1,rsegment:[1,106,149],rsegment_arrai:149,rset:1,rss:[52,58,160],rtype:18,rubi:30,ruin:1,rule1:131,rule2:131,rule3:131,rule:[1,26,44,46,48,57,112,125,135,144,162,164,165],ruleset:1,run:[1,3,4,5,7,9,10,11,12,13,14,15,17,21,24,26,27,32,35,36,40,41,43,44,45,47,48,52,56,71,76,77,78,79,80,81,82,83,90,96,112,113,115,122,123,127,128,131,135,136,138,139,142,144,151,154,155,162,164],runnabl:113,runtim:45,ruri_str:[1,149],ruri_to_assoc:[1,149],s_c_ver:45,safari:[1,150],safe:[1,16,57,64,67,68,69,106,113,125,129,143,144,147],safe_mailto:69,safe_mod:1,safer:[10,13,14],saferplu:129,safeti:[1,144],sai:[1,3,4,26,38,39,43,44,45,69,125,128,129,131,133,137,144],said:[106,129,144],sake:[39,164],salli:19,salt:[1,25,129],samara:52,same:[0,1,2,4,6,9,14,15,23,26,29,34,37,39,43,44,45,52,69,82,106,122,123,125,126,129,130,131,133,135,136,137,138,139,142,143,144,145],samoa:52,sampl:[9,28,138],sandal:26,sandwich:52,sanit:[1,24,44,64,131,143,162,164],sanitize_filenam:[1,64,143],sapi:135,satisfi:[25,144],saturdai:[124,145],save:[1,3,14,22,23,26,33,43,45,47,52,123,125,126,127,128,129,130,132,133,141,144,151,152,165],save_handl:144,save_path:[1,144],save_queri:[1,10,40],sbin:127,scaffold:[1,75,76,77,80,82,93,120],scale:48,scan:1,scenario:131,schedul:[106,112,116],schema:[1,5,139,146,164],scheme:[1,139,165],scope:[1,33],scratch:[48,155],screeni:69,screensend:7,screenshot:2,screenx:69,script:[1,7,14,15,23,24,29,33,35,44,45,56,64,69,81,106,109,131,133,135,136,139,140,143,144,146,148,160],script_head:136,script_nam:1,scripto:136,scroll:136,scrollabl:1,scrollbar:69,seamless:128,search:[1,13,14,25,46,66,69,74,76,106,135,141,149,150,155,156],search_path:1,sec:18,second:[1,4,6,7,9,10,13,14,15,17,26,29,33,39,43,46,47,50,51,52,53,54,56,57,58,62,63,65,66,67,69,93,106,123,124,126,127,128,131,132,135,137,138,140,142,143,144,148,149,151,152,164,165],secondari:13,secret:[44,128,129],secretsmittypass:151,secrion:129,section:[1,26,31,32,37,44,71,73,113,124,126,129,131,133,136,138,140,144,151,157,161,162,163],secur:[1,13,24,27,32,35,36,41,51,56,59,66,68,71,73,80,93,109,128,129,130,131,134,144,151,154,156],see:[1,3,5,6,8,9,14,15,16,18,20,23,24,26,27,29,32,34,43,44,45,46,47,50,52,55,56,64,67,68,69,80,82,93,102,106,123,124,126,129,130,131,135,136,138,140,144,151,157,162,164,165],seed:[1,14,129,164],seeksegmenttim:1,seem:[1,22,45,49,120],seen:[106,146,154,155],seg:149,segment:[1,2,3,7,43,57,69,76,106,124,141,146,149,155],segment_arrai:149,segment_on:7,segment_two:7,select:[1,3,7,8,10,12,13,15,17,38,45,50,52,57,69,125,128,129,130,131,133,136,139,141,142,143,144,145],select_avg:[1,14],select_max:[1,14],select_min:[1,14],select_sum:[1,14],selector:136,self:[1,42,130],sell:153,semant:[1,45,68,147],semicolon:[1,19,143],send:[1,2,6,7,17,26,35,44,45,47,49,51,54,55,56,57,69,106,122,136,138,140,143,152,155,156],send_email:[1,55,106],send_error:146,send_error_messag:151,send_request:151,send_respons:151,send_success:146,sendmail:[1,127,156],sens:[1,34,106,160],sensit:[1,17,28,44,144],sent:[1,2,7,9,22,26,33,35,49,54,55,81,122,127,131,138,140,142,144,146,151,154],sentenc:147,sep:1,separ:[1,5,6,14,29,33,45,60,66,69,112,126,129,130,131,137,144,146,155,160,165],seppo:1,septemb:1,sequenc:[1,5,10,58,129,139],sequenti:[1,139],seri:[1,42,136],serial:[1,3],seriou:[44,93],serpent:129,serv:[1,3,26,33,39,45,74,129,135,140,151,154,160],server:[1,3,5,6,7,17,19,22,24,32,33,38,44,45,46,50,52,54,56,63,65,67,69,71,73,74,81,93,106,109,120,123,124,127,128,129,130,132,133,134,140,144,146,152],server_addr:1,server_info:1,server_path:56,server_protocol:135,server_url:151,sess_cookie_nam:144,sess_destroi:[1,144],sess_driv:[1,106,138,144],sess_encrypt_cooki:[1,106,138],sess_expir:[106,144],sess_expire_on_clos:[1,106,144],sess_match_ip:[1,144],sess_match_userag:[1,106],sess_regener:144,sess_regenerate_destroi:144,sess_save_path:[1,106,115,144],sess_table_nam:[1,106,144],sess_time_to_upd:[86,144],sess_upd:1,sess_use_databas:[1,106],session:[1,5,20,29,40,71,73,86,88,93,98,115,125,128,134,137,138,155,156],session_data:[40,144],session_destroi:144,session_dummy_driv:144,session_id:[1,106,144],session_regenerate_id:[1,144],session_write_clos:144,sessionhandlerinterfac:144,set:[1,2,3,5,6,7,8,9,10,13,14,15,16,21,22,23,24,25,26,32,33,35,38,39,44,45,46,47,48,49,50,51,52,53,54,56,57,62,65,66,67,68,69,73,74,76,80,82,85,88,92,93,109,115,116,120,122,123,125,132,135,137,138,139,140,142,143,144,145,146,147,148,149,150,151,155,162,165],set_:57,set_alt_messag:127,set_capt:[1,145],set_checkbox:[1,57,131],set_ciph:128,set_content_typ:[1,140],set_cooki:[1,51,135],set_data:[1,131],set_dbprefix:[1,13,14],set_delimit:142,set_empti:145,set_error:[1,146],set_error_delimit:[1,131],set_flashdata:144,set_hash:1,set_head:[1,69,127,140,145],set_insert_batch:14,set_item:[126,136],set_messag:[1,131],set_mim:54,set_mod:128,set_new:162,set_output:140,set_profiler_sect:[40,140],set_radio:[1,57,131],set_realpath:[1,63],set_row:15,set_rul:[1,106,112,131,162],set_select:[1,57,131],set_status_head:[1,24,42,140],set_tempdata:[1,144],set_templ:[145,148],set_test_item:[1,148],set_update_batch:[1,14],set_userdata:144,set_valu:[1,57,131],setenv:32,settabl:1,setup:[2,25,45,102,144],seven:[124,145,151],sever:[1,7,9,14,15,27,38,52,79,90,125,131,148,151,156,163],sftp:132,sha1:[1,44,64,66,129],sha224:129,sha256:129,sha384:129,sha512:[115,129],sha:129,shadow:133,shall:153,shape:[49,58,151],share:[1,3,5,38,120,124,144],sharp:136,shell:1,shift:[1,3],ship:125,shirt:[43,57,125],shirts_on_sal:57,shoe:[26,46,76,149],shop:[71,134],short_open_tag:45,shortcut:58,shorten:[45,146],shorter:[106,131],shortli:131,shortnam:1,shot:[125,135],should:[1,2,3,5,6,9,13,15,17,18,21,22,23,25,26,29,33,35,41,43,44,45,46,47,52,56,57,58,65,67,69,73,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,124,125,126,127,128,129,130,131,133,135,136,137,138,139,144,145,147,148,151,154,161,164,165],should_do_someth:18,shouldn:[106,126,144],show:[1,8,13,14,26,33,52,57,63,65,122,129,130,132,133,137,138,141,142,145,146,148,151,163],show_404:[1,26,33,42,43,92,164,165],show_debug_backtrac:42,show_error:[1,18,33,42,139],show_next_prev:124,show_other_dai:124,show_prev_next:1,shown:[1,14,19,34,40,50,67,69,92,106,113,122,124,125,129,130,131,133,137,141,142,165],shuck:67,shuffl:34,shutdown:1,sibl:31,side:[1,14,45,106,130,136,141,151,165],sidebar:47,sign:[0,1,14,44,52,67,131],signifi:50,signific:131,significantli:[27,155],signoff:2,signup:131,silent:[1,106],similar:[7,16,19,23,26,43,44,45,47,52,57,90,124,125,130,131,135,144,146,147,151,164],similarli:[51,57,106,137,144],simpl:[1,5,11,14,18,23,26,33,34,46,47,48,57,58,67,69,106,124,127,128,129,131,136,139,141,142,144,146,148,151,155],simple_queri:[1,7,13],simpler:[1,35],simpli:[1,2,3,13,14,16,17,20,26,27,29,33,34,35,38,47,55,66,69,76,82,96,106,122,125,126,127,129,130,131,132,133,135,136,137,138,141,142,144,145,146,148,151,152,155,165],simplic:[14,39,158],simplifi:[1,3,7,8,10,14,16,19,61,158],simultan:6,sinc:[1,3,7,9,14,16,17,22,25,26,29,34,42,57,69,81,106,116,125,128,131,133,135,138,140,142,144,149,150,152,155,156,160],singl:[1,2,3,5,7,13,14,15,20,24,25,38,45,66,70,125,127,129,131,133,135,137,138,141,142,144,145,146,147,151,152],singleton:138,singular:[1,60,158],site:[1,23,24,26,44,47,48,52,56,57,58,64,69,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,125,126,130,131,135,139,144,146,150,151,165],site_id:9,site_nam:126,site_url:[1,69,126,151,164],situat:[1,3,5,14,129],six:145,size:[1,44,49,50,56,57,58,62,125,129,130,131,133,145,149,151],skip:[1,9,14,15,17,33,56,57,93,112,144],sku:125,sku_123abc:125,sku_567zyx:125,sku_965qr:125,slash:[1,35,43,44,45,66,106,112,126,132,149,165],slash_item:[106,126],slash_rseg:149,slash_seg:149,slice:58,slide:136,slight:106,slightli:[14,45,67],slow:136,slower:144,slug:[66,162,164],small:[1,10,45,48,57,127,129,145,155,158,163],smallest:158,smart:16,smart_escape_str:1,smilei:[1,59,71,82],smiley_j:[1,65],smiley_t:65,smiley_view:65,smith:[23,151],smitti:151,smtp:[1,127,156],smtp_crypto:127,smtp_host:127,smtp_keepal:[1,127],smtp_pass:127,smtp_port:127,smtp_timeout:[1,127],smtp_user:127,snack:35,sock:123,socket:[1,123,146],socket_typ:123,softwar:[33,129,148,153,157,160],sole:135,solomon:52,solut:[25,48,55,106,129,142,144],some:[0,1,3,4,5,6,7,12,14,17,18,20,24,25,26,27,29,32,33,34,35,42,43,44,45,46,47,52,54,55,56,57,65,67,69,81,93,106,112,122,123,127,129,131,133,135,136,137,138,139,141,142,143,144,148,150,151,157,161,162,163,164,165],some_act:130,some_class:[18,27],some_cooki:135,some_cookie2:135,some_data:135,some_field_nam:130,some_funct:[4,57],some_librari:45,some_method:[9,17,18,26,29,31],some_nam:144,some_par:31,some_photo:152,some_t:[12,13,15],some_valu:144,some_var:33,someclass:[29,47],somefil:56,somelibrari:45,someon:[50,80,125,127,128,129,131],somesit:55,somet:10,someth:[2,5,14,18,26,29,32,35,43,47,50,52,69,73,76,81,115,125,130,131,132,135,138,140,141,142,144,146,150,151,152],something_els:18,sometim:[12,17,131,151],somewhat:129,somewher:152,soon:[90,106],sooner:[96,106,112,116,119],sorri:144,sort:[125,144,149,151],sought:14,sound:2,sourc:[0,1,2,6,25,53,58,129,132,133,155],source_dir:[1,53,56],source_imag:133,south:52,space:[1,44,58,60,130,131,136,145,146,147,162],spam:[69,146],span:[1,57,67,146],speak:9,spearhead:30,spec:151,special:[1,7,9,13,31,44,57,131,135,144,146,151],specif:[1,5,6,7,15,32,34,35,40,45,46,50,58,65,69,106,108,109,123,124,126,127,136,137,138,139,140,141,144,146,149,151,154,164],specifi:[1,5,6,7,9,10,13,14,15,17,24,25,26,34,35,39,43,46,47,49,50,52,56,57,58,66,67,69,80,123,124,125,126,127,128,129,130,131,132,133,135,137,138,140,141,144,145,150,151,152],speed:[1,22,136,144],spell:1,sphere:58,sphinx:18,sphinxcontrib:18,spirit:1,split:[7,43,67,163],spoof:1,sport:131,spot:60,sprintf:[106,131],sql:[1,5,7,8,10,13,14,16,17,41,50,113,115,139,144,146,164],sql_mode:1,sqlite3:[1,41,106],sqlite:[1,5,41],sqlsrv:[1,5,41,106],sqlsrv_cursor_client_buff:1,sqlsrv_cursor_stat:1,squar:[1,58,131],src:[1,50,58,127],srednekolymsk:52,sri:52,ssl:[1,24,127,132],ssl_ca:5,ssl_capath:5,ssl_cert:5,ssl_cipher:5,ssl_kei:5,ssl_verifi:5,sss:18,ssss:18,sssss:18,sst:1,stabl:[2,72],stacktrac:2,stage:35,stai:[49,125],stale:93,stand:44,standard:[1,14,16,29,34,39,43,46,48,52,56,57,67,69,76,125,129,131,132,135,137,151,155],standard_d:[1,52],standardize_newlin:1,standpoint:158,stanleyxu:1,stark:155,start:[1,7,9,11,14,16,25,26,43,45,52,66,71,73,106,109,122,124,135,139,141,159,162,163,164],start_cach:[1,14],start_dai:124,stat:[1,26],state:[1,14,22,26,52,57,127,136,144,148,158],statement:[1,7,9,13,14,17,19,47],statu:[1,7,10,13,14,17,24,33,69,92,106,136,140,144],status:1,status_cod:33,stdclass:15,stdin:[1,24,135],steal:144,step:[2,3,34,44,73,74,123,129,138,139,157,158,163],stick:[2,129],still:[1,5,25,43,45,74,106,109,112,116,119,129,131,144,161,164],sting:150,stock:[82,96],stop:[1,7,14,122,127,140],stop_cach:[1,14],stopped_by_extens:1,storag:[1,7,44,106,128,129,140,144],store:[1,5,13,14,22,29,34,39,40,44,45,67,90,98,123,125,126,127,128,129,131,132,137,138,139,140,141,144,146,152,162,164],stored_procedur:1,stori:144,str:[1,7,10,24,25,45,57,60,64,65,66,67,68,69,70,127,131,143,146,147,148,149],str_repeat:[1,58,66,106],str_replac:45,strai:1,straightforward:144,stream:[1,129,143,144],strength:93,strengthen:1,strict:[1,5,7,58],strict_trans_t:1,stricter:143,strictli:56,stricton:[1,5],string:[1,5,6,7,10,13,14,15,17,24,33,43,44,47,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,68,69,70,71,76,93,113,120,122,123,124,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,155,162,165],stringenc:45,strip:[1,44,64,66,67,127,131,146,162],strip_image_tag:[1,64,131],strip_quot:[1,66],strip_slash:66,stripslash:[1,66],strive:158,strong:[1,44,67,106,125,129,145],stronger:129,strongli:[41,80,106,112,113,116,119],strpo:45,strtolow:[1,43],struct:151,structur:[1,11,26,38,45,48,63,106,123,131,132,139,141,152,155,160],style:[1,36,52,57,58,67,71,124,125,136,139],stylesheet:[58,67,69,126],suar:58,sub:[1,3,18,27,30,31,38,39,53,56,125,131,132,137,152],subclass:[1,28],subclass_prefix:[27,29,34,82],subdirectori:[1,31,138],subdriv:1,subfold:1,subject:[1,2,55,127,148,153],sublicens:153,submiss:[44,45,50,52,131,143],submit:[0,1,2,3,6,10,13,14,15,17,29,44,50,51,52,57,58,66,80,94,124,125,130,131,133,137,145,152,154,162],subpackag:45,subqueri:1,subsect:18,subsequ:[1,7,22,136,138,154],substanti:[1,27,153],substitut:142,subsubsect:18,subsubsubsect:18,subsubsubsubsect:18,subtot:125,subvers:1,succeed:7,success:[1,7,9,13,14,15,16,17,18,56,123,125,126,127,132,133,138,139,144,145,146,151,152,162],successfulli:[1,33,55,106,125,130,131,132,146,162],suffici:144,suffix:[1,57,62,67,76,130,131,137,141,149],sufix:141,suggest:[1,34,106,138],suhosin:[1,24],suit:[133,148],suitabl:[45,64,66,106,143],sum:[1,14],summari:[29,136],sun:[52,124],sundai:[52,124],super_class:45,super_class_vers:45,superclass:45,superglob:[1,106,144],superobject:[1,35],suppli:[1,2,4,5,7,8,12,14,24,25,33,50,55,56,57,65,69,106,113,124,130,131,132,133,135,138,143,148,152],suppor:1,support:[1,4,7,9,11,12,14,15,16,17,25,41,46,52,64,67,71,74,81,82,93,98,106,113,119,123,127,128,131,132,133,135,136,137,143,144,150,151,156,159,164],suppress:[1,45,126,141],suppress_debug:132,sure:[2,14,15,16,26,27,29,39,44,45,46,81,95,123,124,125,127,130,131,132,137,140,144,146,151,152,162,164],surfac:1,surround:[141,147],svg10:58,svg11:58,svg:58,swap:[1,5,7,27,122],swap_pr:[1,5],sybas:[1,106],symbol:[1,56,63],symbolic_permiss:[1,56],sync:1,synonym:[46,155],syntax:[1,6,11,13,14,29,31,35,36,40,43,45,47,51,57,61,71,82,106,130,136,144,155],system:[1,2,3,5,13,14,16,21,28,30,31,32,33,34,35,36,37,39,44,46,56,58,71,72,73,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,126,129,131,133,135,137,138,140,144,149,150,154,155,156,158,160,161,164,165],system_path:[73,112],system_url:126,tab:[1,17,18,45,69,143],tabl:[1,5,7,8,10,13,14,16,18,34,37,40,49,50,52,65,71,83,84,106,124,125,129,130,131,133,134,138,139,144,148,157,162,164],table1:[14,17],table2:[14,17],table3:14,table_clos:[124,145],table_data:145,table_exist:[7,12],table_nam:[7,8,9,10,12,13,15,17,106],table_open:[124,145],tablenam:[1,13,14],tag:[1,22,50,52,57,58,61,64,67,68,69,82,106,127,130,131,133,136,141,142,145,146,147],tag_clos:67,tag_open:67,tahiti:52,tailor:[127,129,133,141],taint:44,take:[1,3,6,7,9,13,15,26,29,35,43,45,49,50,52,56,60,65,69,70,73,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,128,131,135,138,144,145,146,147,149,151,157,162],taken:[1,72,139],taller:133,tamper:1,tap:[1,35],target:[1,2,7,14,57,69,133,136,146,152],target_vers:139,task:[23,34,48,144,155],tax:3,tb_data:146,tb_date:146,tb_id:146,tbodi:145,tbody_clos:145,tbody_open:145,tcp:[123,144],teach:163,team:[1,30,139],technic:[18,44,131,144,158,165],techniqu:[44,129,143],technolog:[30,153],tediou:131,tell:[5,9,14,17,34,39,133,137,138,139,144,148,149,156],temp:142,tempdata:1,templat:[1,7,19,33,48,71,76,122,134,145,147,156,162,164,165],template1:142,ten:145,term:[4,29,34,129,137,138,141,144],termin:[1,23,24,69,146],terribl:[52,131],test:[1,2,5,7,49,71,81,127,128,129,131,134,135,141,143,144,150,156],test_datatyp:148,test_mod:7,test_nam:148,texb:[50,133],text:[1,3,9,14,18,23,24,25,26,33,34,44,47,50,52,54,57,58,59,61,62,64,65,66,68,69,70,71,73,90,125,126,127,128,129,130,131,136,139,140,141,142,144,146,147,151,156,162,164,165],text_watermark:1,textarea:[1,57,65,162],textil:18,textmat:18,textual:124,tge:1,tgz:1,thailand:52,than:[1,2,3,5,6,9,13,14,15,16,24,26,29,33,34,35,38,43,44,45,46,47,48,57,61,67,69,70,96,106,112,116,119,125,128,129,133,135,137,138,144,146,147,151,155,158,160],thank:[1,144],thead:145,thead_clos:145,thead_open:145,thei:[1,2,3,7,9,14,15,16,18,22,23,25,26,29,32,34,39,43,45,47,57,66,67,68,69,70,73,80,94,95,96,106,122,124,126,127,129,131,133,135,136,139,142,144,147,151,156,164,165],them:[1,2,3,5,7,9,14,15,16,20,21,25,26,27,29,31,34,40,42,43,44,45,52,60,65,73,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,125,127,129,130,131,132,133,135,137,138,139,141,142,143,144,146,150,151,160,164,165],theme:136,themselv:[31,45,156],theoret:129,theother:66,therefor:[1,3,28,106,109,112,125,131,144],thi:[0,1,2,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,29,31,32,33,34,35,37,38,39,40,42,43,44,45,46,47,72,73,74,76,77,78,79,80,81,82,83,85,90,93,94,95,96,97,98,102,106,108,109,112,113,115,116,120,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,155,158,161,162,163,164,165],thing:[1,2,9,14,18,23,32,44,45,69,106,123,124,131,138,140,143,144,161,162,164,165],think:[2,128,129],third:[1,10,14,17,18,39,46,47,49,53,54,56,57,58,66,67,69,106,124,126,127,131,138,142,144,146,162,164],third_parti:[1,138],thirdparamet:52,this_string_is_:67,this_string_is_entirely_too_long_and_might_break_my_design:67,thoma:49,thorough:[1,48,146],thoroughli:161,those:[1,2,3,9,27,39,43,44,45,46,66,95,106,125,126,129,131,133,137,140,141,144,145,147,150,151,165],though:[1,45,106,126,129,133,136,144],thousand:1,threat:143,three:[1,3,13,14,29,33,43,44,56,57,66,127,131,133,139,141,144,145,147,151,162],threshold:[1,33,82],through:[1,15,24,26,31,51,57,66,106,124,135,138,143,144,145,151,155,163,164],throughout:[1,6,21,33,34,39,129,137,143,154],thrown:[1,123],thu:[1,43,44,113,116,131,151],thumb:133,thumb_mark:133,thumbnail:133,tied:[65,129,164],tighten:1,tild:44,time:[1,2,3,7,13,17,21,22,24,27,29,37,39,40,44,49,50,52,57,58,66,69,106,123,124,127,128,129,131,133,135,136,137,138,139,140,142,144,146,151,156,164,165],time_refer:[1,52],timeout:[1,6,7,123,127,151],timer:[13,26,122,140],timespan:[1,52],timestamp:[1,50,52,106,124,139,144],timezon:1,timezone_menu:[1,52],tini:58,tinyint:1,tip:[27,30,44,112],titl:[1,8,13,14,15,18,39,47,49,58,65,66,69,130,131,142,143,145,146,151,162,164,165],tld:[106,109],tls:127,tmpf:144,todai:124,todd:14,todo:[19,47],todo_list:[47,151],togeth:[13,14,47,50,131,141,165],toggl:[1,124],token:[1,45,140,143],told:[26,131],toma:1,tonga:52,too:[1,5,44,45,106,127],took:2,tool:[1,23,127,151],toolkit:[48,155],top:[1,32,33,53,73,131,133,136,141,142,165],top_level_onli:[56,93],topic:[157,161],tort:153,total:[1,7,8,15,40,124,125,128,129,141,149],total_item:[1,125],total_queri:7,total_row:141,total_rseg:149,total_seg:[1,149],touch:144,tough:2,toward:[133,144],tower:2,town:9,trace:1,track:[1,16,33,139,144],trackback:[1,71,134,156],tradit:[11,34,39],tradition:16,traffic:[47,151],trail:[1,35,43,66,106,126,132,149],trale:1,tran:58,trans_begin:[1,16],trans_commit:[1,16],trans_complet:[1,7,16],trans_off:[7,16],trans_rollback:[1,16],trans_start:[1,7,16],trans_statu:[1,7,16],trans_strict:[7,16],transact:[1,7,11,71],transfer:[1,129,132,135],transform:[1,13,69],transit:[1,58,93],transitori:128,translat:[1,9,17,43,56,137,141],translate_uri_dash:[1,43],transliter:67,transmiss:129,transmit:1,transpar:[1,133,140],transport:151,travers:[53,64,143],treat:[1,7,16,46,58,152],tree:152,tri:[1,74,80,106,109,126,143],trick:[1,44,144],trig:1,trigger:[1,18,33,35,44,46,63,106,130,131,136,143,158],trim:[1,66,106,131],trim_slash:[1,66],tripled:129,trivial:[2,144],troubl:[2,106],troubleshoot:71,troublesom:1,truli:155,truncat:[1,14,67],truncate_t:1,trust:[1,5],ttf:[50,133],ttl:[1,123,144],tuesdai:124,turn:[1,3,10,14,16,24,44,47,57,65,69,106,130,132,135,141,149],tutori:[130,161,165],tweak:[1,112],twelv:145,twenti:141,twice:[1,14],two:[1,2,3,6,12,14,15,16,26,27,29,33,34,38,40,43,44,50,57,66,68,76,106,122,125,126,127,128,129,131,135,138,139,141,142,144,145,147,148,151,162,164,165],twofish:129,txt:[1,17,24,54,63,143,152],type:[1,3,5,7,9,10,12,13,14,15,16,17,18,20,21,24,25,29,31,33,39,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,76,88,94,96,97,98,115,122,123,124,125,126,127,128,129,130,131,132,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,152,160,162,165],typecast:1,typic:[3,13,15,26,34,39,43,44,47,52,53,125,128,133,138,141,144,150,151,160],typo:[1,120],typograph:[68,147],typographi:[1,59,71,134],ubiquit:144,ucfirst:[1,28,45,106,165],ugli:[45,50],um10:52,um11:52,um12:52,um1:52,um2:52,um35:52,um3:52,um45:52,um4:52,um5:52,um6:52,um7:52,um8:52,um95:52,um9:52,unabl:[56,146],unaffect:1,unattend:144,unauthor:[24,140],unavail:1,unavoid:93,unbuffered_row:[1,15],uncach:14,uncaught:1,uncheck:1,uncondit:1,undeclar:67,undefin:[1,148],undeliv:127,under:[0,1,3,5,14,24,26,34,44,49,106,107,113,123,128,129,135,140,144,155],undergo:1,undergon:1,underli:[5,7,18,144],underlin:18,underscor:[1,2,26,43,44,45,60,69,125,130,131,139],understand:[0,16,80,144,151,157],undesir:44,undocu:106,unescap:1,unexist:1,unexpect:144,unfamiliar:162,unfortun:[3,24,44,129],unfound:1,unicod:[1,45],unidentifi:150,unifi:1,uniqid:1,uniqu:[1,9,14,66,125,127,131,136,152],uniquid:1,unit:[1,2,52,71,134,156],unit_test:148,unit_test_lang:83,uniti:1,unix:[1,45,52,123,124,135,144],unix_start:52,unix_to_human:52,unix_to_tim:52,unknowingli:44,unknown:[19,106],unless:[0,1,9,14,15,25,45,47,49,51,68,80,106,125,128,129,130,133,138,140,144,147,148,152],unlik:[33,34,45,69,106,123,125,135,151],unlimit:9,unlink:1,unload:136,unmark:144,unmark_flash:144,unmark_temp:144,unnam:1,unnecessari:[44,152],unnecessarili:1,unneed:1,unord:[1,58],unreli:[1,24],unsaf:[1,106,144],unsanit:13,unset:[1,44,106,144],unset_tempdata:[1,144],unset_userdata:[1,106,144],unsign:[9,50,139,144,146],unsuccess:16,unsupport:1,until:[1,2,3,51,106,122,131,140,141,144],unus:[1,144],unwant:45,unwrap:127,unzip:73,up105:52,up10:52,up115:52,up11:52,up1275:52,up12:52,up13:52,up14:52,up1:52,up2:52,up35:52,up3:52,up45:52,up4:52,up55:52,up575:52,up5:52,up65:52,up6:52,up7:52,up875:52,up8:52,up95:52,up9:52,updat:[1,2,3,7,10,13,39,45,49,131,139,144,160,164],update_batch:[1,14],update_entri:[39,151],update_post:151,update_str:[1,7,10],upgrad:[1,71,144],upload:[1,57,71,73,93,132,134,143,156],upload_data:130,upload_form:130,upload_lang:1,upload_path:130,upload_success:130,upon:[0,1,7,131,133,135,155,161],upper:[133,135],uppercas:[1,26,45,66,128,135],upset:58,upstream:1,urandom:[1,25,106,129,143],uri:[1,3,7,22,27,33,34,36,40,53,57,58,69,71,74,120,124,134,141,143,146,156,162,164,165],uri_protocol:[1,120],uri_seg:[1,141],uri_str:[1,40,69,149],uri_to_assoc:[1,149],url:[1,10,20,23,24,26,29,34,36,43,47,50,57,59,64,65,66,67,71,73,74,76,80,94,109,124,126,127,130,131,133,135,137,141,149,151,156,162,164,165],url_encod:24,url_help:[34,164],url_suffix:[1,69,76,141],url_titl:[1,69,162],urldecod:131,uruguai:52,usabl:[24,106,129,143],usag:[1,3,9,11,12,14,15,26,49,50,57,66,68,69,71,122,126,129,140,141,144,147],use:[1,2,3,5,6,7,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,29,31,32,34,35,37,38,39,40,43,44,45,46,47,48,51,52,54,55,57,60,64,65,66,67,68,69,73,80,82,90,93,94,95,96,106,112,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,151,152,153,155,162,164],use_global_url_suffix:[1,141],use_page_numb:[1,141],use_sect:[126,138],use_strict:148,use_t:1,used:[1,2,3,4,5,6,7,8,9,13,14,16,17,18,24,25,26,27,29,32,34,35,39,40,42,43,44,45,50,52,56,57,58,65,66,67,69,79,85,94,106,109,112,113,120,122,123,124,125,127,128,129,130,131,132,133,135,136,137,138,139,141,142,143,144,145,146,149,151,155,162,164,165],useful:[1,3,4,5,14,15,24,25,26,32,33,40,43,45,47,49,52,58,69,106,116,123,125,127,130,132,133,136,138,143,144,146],usefulness:158,useless:[1,10,40,106,112],user:[1,3,5,9,13,15,17,18,19,22,25,27,29,31,33,37,43,44,45,49,50,52,56,65,69,73,75,96,98,106,113,125,127,129,130,131,134,135,138,143,144,149,151,154,156,157,160,164,165],user_ag:[1,82,83,93,106,135,144,150],user_data:[1,90,106],user_guid:82,user_id:14,user_model:39,user_str:25,userag:127,userdata:[1,106,144],userfil:130,userguid:1,userid:151,usernam:[5,6,14,15,19,39,57,127,131,132,137,144,151],username_cal:131,username_check:131,users_model:131,userspac:1,uses:[1,2,7,13,18,24,42,45,46,56,57,67,76,106,125,128,129,131,144,155],using:[1,2,3,4,5,6,7,9,10,13,14,15,16,17,18,19,20,23,24,26,29,31,32,33,34,37,38,39,40,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,79,88,90,92,93,96,102,106,115,119,122,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,144,145,146,147,148,149,150,151,152,155,160,162,163,164,165],usings:136,usr:[127,133],usual:[46,51,67,69,106,129,130,131,132,133,135,136,138,144,151,152,155],utc:52,utf8:[5,6,9,27,86],utf8_en:[1,42],utf8_general_ci:[5,6,9,86],utf:[1,45,57,58,85,94,127,138,140,146,150],util:[1,5,11,14,16,19,20,22,35,45,46,69,71,82,93,106,123,125,129,135,138,157],utliz:14,vagu:2,val:[14,45,50,131,138,140,145],valid:[1,5,16,25,26,37,43,45,49,52,55,56,57,71,93,112,124,125,127,128,129,130,133,134,135,136,143,144,145,146,148,151,152,155,156,162,163],valid_base64:[1,131],valid_email:[1,55,106,131],valid_ip:[1,131,135],valid_url:[1,131],valid_usernam:131,validate_url:[1,146],validation_error:[57,131,162],validation_lang:1,validli:55,valu:[1,2,6,7,8,9,10,13,14,15,17,23,24,25,26,32,33,34,40,43,44,49,50,51,52,58,67,69,81,95,116,120,122,123,124,125,126,127,129,130,131,132,133,135,138,140,141,142,143,144,145,146,148,149,151,162,164,165],value1:127,value2:127,values_pars:1,vanuatu:52,var_dump:[45,123],varchar:[9,50,96,98,115,139,144,146,164],vari:[1,45],variabl:[1,5,6,13,14,15,17,19,20,24,26,29,32,33,34,38,40,43,44,46,47,66,73,74,80,82,86,92,106,122,124,127,129,130,135,137,138,140,141,144,148,151,164,165],variant:137,variat:[1,15],varieti:[1,18,48],variou:[1,34,85,124,130,131,150,152],vector:[1,129],venezuelan:52,verb:[1,45],verbos:[32,45],verd:52,veri:[3,11,13,14,16,17,29,35,45,49,51,69,76,81,122,124,127,131,132,133,138,139,141,142,144,150,155,156,158,165],verifi:[1,5,50,88,131,132,144],versa:133,version:[2,3,7,10,13,24,25,27,34,41,48,60,69,71,72,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,96,97,99,100,106,115,119,120,124,131,133,139,144,150],versu:45,vertic:133,via:[1,2,9,13,14,17,26,29,36,39,41,49,52,56,57,67,69,71,72,73,106,123,124,125,126,127,128,129,131,132,133,135,138,140,141,143,144,151],vice:133,victim:44,victoria:52,video:1,vietnam:52,vietnames:1,view:[1,3,7,14,20,22,26,27,29,33,34,36,38,39,40,43,45,46,56,61,65,69,71,73,76,82,106,107,122,123,125,130,131,140,148,150,154,155,156,158,159,162,163,164,165],view_cascad:138,view_fil:1,view_fold:[1,73,112],viewpath:[1,42],vinc:49,violat:1,virtual:144,visibl:[1,136,148],visit:[14,23,26,47,65,106,128,130,131,150,151,161,165],visitor:[1,44,81,106,135,150],visual:[1,133],vladivostok:52,vlc:1,vnd:1,vrt:133,vulner:[1,2,106],w3c:[1,52,58],w3school:69,w43l:1,wai:[1,2,6,12,14,15,19,20,22,23,24,26,34,40,44,47,52,56,64,68,106,122,126,128,129,130,131,135,137,138,139,143,144,148,151,156,160,164],wait:151,walk:15,want:[1,2,3,4,5,9,14,15,16,17,20,21,24,26,31,33,35,37,38,39,43,47,48,54,56,57,66,68,69,85,106,112,122,126,127,128,129,131,132,133,135,136,137,138,141,142,143,144,146,147,148,150,152,160,165],warn:[1,45,80,133,144],warrant:93,warranti:153,wasn:[1,164],watch:[33,164],water:151,watermark:1,wav:1,weak:44,weaker:129,web:[3,26,30,35,38,41,43,44,47,48,65,67,73,106,127,131,135,140,150,154,155,160,165],weblog:[146,151],weblogupd:151,webroot:44,websit:[1,106,109,144],wednesdai:145,week:[52,124],week_dai:124,week_day_cel:124,week_row_end:124,week_row_start:124,weekdai:124,weight:[144,156,158],welcom:[27,43,47,58,106],welcome_messag:[1,27,138],well:[1,14,19,23,24,41,43,45,48,52,53,56,58,106,127,131,136,137,141,144,148,150,151,155],went:164,were:[1,7,26,44,48,57,58,81,94,95,96,102,106,129,136,139,143,144,151,155],weren:1,west:52,western:52,wget:23,what:[1,2,3,5,13,25,27,33,45,49,56,57,58,67,69,74,76,90,106,109,115,124,129,130,131,133,137,141,142,146,149,154,158,163,165],whatev:[1,7,13,45,49,69,116,132,138,139],whats_wrong_with_css:69,when:[1,2,3,5,6,7,9,10,13,14,15,16,18,21,22,24,25,26,32,35,39,40,43,44,45,47,49,50,52,57,65,66,67,69,79,80,81,82,94,106,109,112,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,146,147,148,149,150,151,152,158,161,165],whenev:[1,3,33,45,106],where:[1,2,3,5,6,7,10,13,14,15,22,24,25,26,29,31,32,34,35,37,39,45,47,50,52,67,76,122,123,124,125,126,129,130,131,133,135,136,137,138,144,146,148,149,151,162,163,164,165],where_in:[1,14],where_not_in:[1,14],wherev:22,whether:[0,1,2,3,5,6,7,12,14,16,17,18,24,25,32,33,44,45,49,51,52,53,54,56,57,58,63,64,65,66,68,69,70,81,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,140,142,143,144,146,147,148,150,152,153,162,165],which:[1,2,3,4,5,6,10,13,14,15,16,22,24,25,26,29,31,32,34,38,40,43,44,45,46,47,50,52,54,57,64,66,67,69,73,79,80,85,90,96,106,109,112,113,120,123,124,125,127,128,129,131,133,135,136,138,139,140,141,142,143,144,145,146,148,149,151,152,155,158,161,163,165],whichev:14,white:[1,50],whitelist:[1,143],whitespac:[1,81],who:[0,27,39,43,45,76,106,127,129,142,144,155],whoever:2,whole:[0,1,15,106,129],whom:153,whoop:165,whose:1,why:[45,106,109,128,129,144],wide:[40,129,135],wider:133,width:[1,45,50,57,58,69,125,130,133,136],wiki:[157,161],wikipedia:23,wild:1,wildcard:[1,7,13,14,106,164,165],wincach:1,window:[1,2,23,24,45,69,112,123,135,143,150],window_nam:69,wine:35,wish:[9,14,17,22,33,34,35,43,45,47,53,57,67,69,73,122,124,125,126,128,129,132,133,135,136,137,138,144,148,149,151],withhold:1,within:[1,4,9,18,20,22,26,31,34,37,39,40,45,52,53,56,57,67,68,80,106,122,124,126,127,130,131,132,133,136,137,138,140,142,144,146,147,152,161,165],without:[1,2,4,9,13,14,15,16,20,23,26,29,31,33,34,35,40,44,45,50,52,57,63,69,102,122,123,126,128,129,130,131,133,135,136,137,138,140,144,146,153,164],wm_font_color:[1,133],wm_font_path:133,wm_font_siz:133,wm_hor_align:133,wm_hor_offset:133,wm_opac:133,wm_overlay_path:133,wm_pad:133,wm_shadow_color:[1,133],wm_shadow_dist:133,wm_text:133,wm_type:133,wm_use_drop_shadow:1,wm_vrt_align:133,wm_vrt_offset:133,wm_x_transp:133,wm_y_transp:133,wma:1,wmv:1,won:[3,14,15,20,40,43,69,106,127,129,140,144],word:[1,5,6,15,43,45,46,50,60,67,69,76,106,122,125,129,131,135,138,146,147,151],word_censor:[1,67],word_length:[1,50],word_limit:[1,67],word_wrap:[1,67],wordi:45,wordwrap:[1,127],work:[0,1,2,7,8,14,16,19,20,23,26,29,35,39,41,44,45,46,49,51,52,53,55,56,57,58,61,62,63,65,66,67,69,70,74,81,90,106,109,115,120,127,130,131,133,135,136,138,139,140,142,152,155,160,164,165],world:[1,30,46,151,165],worri:[2,33,52,129],worth:[129,144],would:[1,5,7,13,14,16,19,20,23,25,26,27,29,31,32,34,37,38,39,43,44,45,52,57,58,66,67,69,73,79,80,82,116,122,124,126,127,130,131,133,136,137,138,139,140,141,142,144,145,148,149,150,152,165],wouldn:1,wrap:[1,7,13,65,67,130,147],wrapchar:127,wrapper:[1,7,15,123],writabl:[1,3,22,24,33,50,56,82,130,152],write:[1,2,3,7,10,13,14,17,24,33,48,56,69,71,106,131,132,133,136,144,149,152,155,161,162,163,164],write_fil:[17,56],writeabl:56,written:[1,5,19,22,26,30,33,34,56,69,106,133,141,144,146,148,162,164],wrong:[1,44,69,130,144],wrongli:1,wrote:[2,164],www:[1,24,58,65,69,73,127,144,146,151],x11r6:133,x_axi:133,xampp:1,xhtml11:58,xhtml1:58,xhtml:[1,58,127],xlarg:57,xls:1,xlsx:1,xma:125,xml:[1,44,45,58,59,71,134,140,146,155,156],xml_convert:70,xml_encod:45,xml_from_result:[1,17],xml_rpc_respons:151,xmlhttprequest:1,xmlrpc:[1,45,151],xmlrpc_client:151,xmlrpc_server:151,xor_encod:1,xsl:1,xspf:1,xss:[1,24,51,64,93,156],xss_clean:[1,51,64,93,135,143,151],xss_filter:106,xtea:129,xts:129,xw82g9q3r495893iajdh473990rikw23:125,y_axi:133,yakutsk:52,year:[1,30,52,124],yekaterinburg:52,yellow:[35,58],yes:69,yet:[16,24,131,146,162,164],you:[1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,29,31,32,33,34,35,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,60,62,63,64,65,66,67,68,69,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,155,156,157,158,160,161,162,163,164,165],you_said:151,your:[1,2,4,5,8,9,13,14,15,16,19,20,21,22,23,25,32,33,35,36,42,45,46,47,48,49,50,51,52,53,54,56,57,65,66,67,68,69,71,73,74,75,123,125,126,127,130,132,133,135,137,138,139,140,141,142,143,144,147,148,149,150,152,155,160,161,162,163,165],your_lang:[52,62],your_str:141,yourdomain:51,yourself:[2,7,13,26,45,125,136,137,144],yoursit:151,yup:128,yyyi:52,yyyymmdd:1,yyyymmddhhiiss:139,zab:45,zealand:52,zero:[1,3,33,48,66,82,125,129,130,131,135,144,149],zip:[1,17,71,134,156],zip_fil:152,zlib:1,zone:[1,52],zsh:1},titles:["Developer\u2019s Certificate of Origin 1.1","Change Log","Contributing to CodeIgniter","Database Caching Class","Custom Function Calls","Database Configuration","Connecting to your Database","DB Driver Reference","Database Quick Start: Example Code","Database Forge Class","Query Helper Methods","Database Reference","Database Metadata","Queries","Query Builder Class","Generating Query Results","Transactions","Database Utility Class","Writing CodeIgniter Documentation","Alternate PHP Syntax for View Files","Creating Ancillary Classes","Auto-loading Resources","Web Page Caching","Running via the CLI","Common Functions","Compatibility Functions","Controllers","Creating Core System Classes","Creating Drivers","Creating Libraries","Credits","Using CodeIgniter Drivers","Handling Multiple Environments","Error Handling","Helper Functions","Hooks - Extending the Framework Core","General Topics","Using CodeIgniter Libraries","Managing your Applications","Models","Profiling Your Application","Server Requirements","Reserved Names","URI Routing","Security","PHP Style Guide","CodeIgniter URLs","Views","Welcome to CodeIgniter","Array Helper","CAPTCHA Helper","Cookie Helper","Date Helper","Directory Helper","Download Helper","Email Helper","File Helper","Form Helper","HTML Helper","Helpers","Inflector Helper","Language Helper","Number Helper","Path Helper","Security Helper","Smiley Helper","String Helper","Text Helper","Typography Helper","URL Helper","XML Helper","CodeIgniter User Guide","Downloading CodeIgniter","Installation Instructions","Troubleshooting","Upgrading From Beta 1.0 to Final 1.2","Upgrading from 1.2 to 1.3","Upgrading from 1.3 to 1.3.1","Upgrading from 1.3.1 to 1.3.2","Upgrading from 1.3.2 to 1.3.3","Upgrading from 1.3.3 to 1.4.0","Upgrading from 1.4.0 to 1.4.1","Upgrading from 1.4.1 to 1.5.0","Upgrading from 1.5.0 to 1.5.2","Upgrading from 1.5.2 to 1.5.3","Upgrading from 1.5.3 to 1.5.4","Upgrading from 1.5.4 to 1.6.0","Upgrading from 1.6.0 to 1.6.1","Upgrading from 1.6.1 to 1.6.2","Upgrading from 1.6.2 to 1.6.3","Upgrading from 1.6.3 to 1.7.0","Upgrading from 1.7.0 to 1.7.1","Upgrading from 1.7.1 to 1.7.2","Upgrading from 1.7.2 to 2.0.0","Upgrading from 2.0.0 to 2.0.1","Upgrading from 2.0.1 to 2.0.2","Upgrading from 2.0.2 to 2.0.3","Upgrading from 2.0.3 to 2.1.0","Upgrading from 2.1.0 to 2.1.1","Upgrading from 2.1.1 to 2.1.2","Upgrading from 2.1.2 to 2.1.3","Upgrading from 2.1.3 to 2.1.4","Upgrading from 2.1.4 to 2.2.x","Upgrading from 2.2.0 to 2.2.1","Upgrading from 2.2.1 to 2.2.2","Upgrading from 2.2.2 to 2.2.3","Upgrading from 2.2.x to 3.0.x","Upgrading from 3.0.0 to 3.0.1","Upgrading from 3.0.1 to 3.0.2","Upgrading from 3.0.2 to 3.0.3","Upgrading from 3.0.3 to 3.0.4","Upgrading from 3.0.4 to 3.0.5","Upgrading from 3.0.5 to 3.0.6","Upgrading from 3.0.6 to 3.1.0","Upgrading from 3.1.0 to 3.1.1","Upgrading from 3.1.1 to 3.1.2","Upgrading from 3.1.2 to 3.1.3","Upgrading from 3.1.3 to 3.1.4","Upgrading from 3.1.4 to 3.1.5","Upgrading from 3.1.5 to 3.1.6","Upgrading From Beta 1.0 to Beta 1.1","Upgrading From a Previous Version","Benchmarking Class","Caching Driver","Calendaring Class","Shopping Cart Class","Config Class","Email Class","Encrypt Class","Encryption Library","File Uploading Class","Form Validation","FTP Class","Image Manipulation Class","Libraries","Input Class","Javascript Class","Language Class","Loader Class","Migrations Class","Output Class","Pagination Class","Template Parser Class","Security Class","Session Library","HTML Table Class","Trackback Class","Typography Class","Unit Testing Class","URI Class","User Agent Class","XML-RPC and XML-RPC Server Classes","Zip Encoding Class","The MIT License (MIT)","Application Flow Chart","CodeIgniter at a Glance","CodeIgniter Features","Getting Started With CodeIgniter","Design and Architectural Goals","CodeIgniter Overview","Model-View-Controller","Conclusion","Create news items","Tutorial","News section","Static pages"],titleterms:{"404_overrid":106,"break":45,"class":[3,8,9,14,15,17,20,26,27,29,40,45,93,106,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152],"default":[26,32,45,94,129],"export":17,"final":75,"function":[3,4,24,25,34,42,45,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,106],"new":[162,164],"null":[45,106],"return":[45,47,106],"short":[19,45],"static":165,"switch":137,"true":45,"try":[23,26,130,131,151],Adding:[9,46,47,50,125,141,144,165],For:48,Not:[3,155],One:45,That:[23,26],The:[29,32,65,93,106,125,130,131,136,151,153],Use:131,Uses:155,Using:[17,29,31,34,37,43,50,122,124,125,127,128,129,131,135,136,137,142,144,145,146,147,148,150,151,152],Will:3,With:[8,157],_post:131,about:[10,144],access:[135,144],add:[85,86,120],add_column:106,address:98,adjust:93,after:106,agent:150,algorithm:129,alias:65,aliv:6,all:[3,44],all_userdata:106,altern:[19,123],anatomi:[39,126,151],anchor:141,anchor_class:106,ancillari:20,ani:[93,106],anim:136,anyth:131,apc:[119,123],applic:[38,40,93,108,138,154,155],apppath:96,approach:16,architectur:158,argument:45,arrai:[8,15,49,131,151],associ:[131,151],attribut:141,authent:129,auto:[21,34,39,126,137],autoload:[81,85,86,96,106],automat:[6,19],avail:[6,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70],backup:17,base:123,base_url:[106,109],basic:[13,71],bbedit:45,befor:44,behavior:[32,129],benchmark:[40,122],best:44,beta:[1,75,120],bind:13,bonu:144,bracket:45,branch:2,bug:1,bugfix:1,builder:[5,8,14,113],cach:[3,14,22,119,123],cache_delet:3,cache_delete_al:3,cache_off:3,cache_on:3,calendar:[120,124,136],call:[4,26,35,93,95,131],call_funct:4,callabl:131,callback:[43,131],captcha:50,cart:[106,125],cascad:131,cell:124,certif:0,chain:14,chang:[1,96,106,131,145],charset:85,chart:154,check:[94,106,113],ci_sess:115,cipher:129,claus:106,clean:155,cli:[23,107],clickabl:65,client:151,close:[6,45],code:[8,45],codeignit:[2,16,18,29,31,37,38,46,48,71,72,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,155,156,157,159],column:9,command:23,comment:45,common:24,commun:155,compar:45,compat:[2,25,45,93],conclus:161,concurr:144,config:[76,80,81,82,85,86,93,94,96,97,98,106,108,109,116,120,126,127,130,131,133,136,141],configur:[5,32,129,136],confirm:92,connect:[6,39],constant:[25,32,42,45,88,96,106,108],constructor:[26,93],consumpt:122,contain:106,content:[9,23,26,39,45,131],contribut:[2,71],control:[19,26,42,65,94,130,131,160,165],convent:29,convert:93,cooki:[51,135],core:[27,35,93,106],corner:136,count:14,creat:[9,20,27,28,29,31,37,47,124,130,131,137,139,146,148,151,162],credit:30,cross:143,csrf:[44,143],csv:17,current:141,custom:[4,15,129,141,144,148],dash:106,data:[14,44,47,93,124,129,131,135,144,151],databas:[3,5,6,8,9,10,11,12,13,17,39,44,50,71,76,82,86,96,106,113,115,144],date:[52,106],dblib:106,debug:45,decrypt:129,default_control:106,defin:[26,35],definit:150,delet:[14,22],delimit:131,depend:25,deprec:[106,112,116,119],descript:17,design:158,destroi:144,determin:[12,17],develop:0,digest:25,digit:141,directori:[26,28,38,47,53,106,120,130],directory_map:106,disabl:[16,40,141,148],displai:[122,124,125,148,164],display_error:44,do_hash:106,document:[2,17,18,155],doe:[3,22,155],download:[54,72],driver:[7,28,31,106,113,119,123,129,144],drop:9,drop_tabl:106,dummi:123,dynam:47,easier:10,echo:19,edit:120,effect:[32,136],email:[55,106,127],empti:[106,109],enabl:[3,22,35,40,46,148],enclos:141,encod:152,encrypt:[88,93,106,128,129],encryption_kei:129,engin:155,environ:[32,126],error:[13,16,32,33,45,76,92,106,107,131,151],escap:[13,44,57],event:136,exampl:[8,14,17,43,123,132,137,139,141,145,150,152],execut:[10,122],exist:[12,17],explan:[5,131,151],express:43,ext:[96,106],extend:[27,29,34,35],extens:[93,106,155],fadein:136,fadeout:136,fals:[45,106],fast:155,featur:156,fetch:[126,137],fetch_class:106,fetch_directori:106,fetch_method:106,field:[9,12,57,65,131],file:[3,17,19,28,29,32,44,45,46,56,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,126,127,130,131,133,137,138,139,141,144],filter:[44,106,135,143],first:141,fix:1,flashdata:144,flow:154,folder:[93,120],forg:[9,106],forgeri:143,form:[57,94,106,130,131,135,137,162],form_prep:106,form_valid:106,format:[45,151],fragment:142,framework:[32,35,155],free:155,friendli:155,from:[9,10,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],ftp:132,gener:[15,36,71,148,155],get:[135,157],get_dir_file_info:93,get_inst:20,get_post:106,github:72,glanc:155,global_xss_filt:106,goal:158,good:2,group:[14,131],guid:[45,71,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,97,99,100,130],guidelin:2,handl:[13,32,33,44,137],has:155,hash:25,head:18,header:92,hello:[23,26],helper:[10,15,34,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,93,106,116,131],hide:[44,136,141],highlight_phras:106,hmac:129,hook:35,how:[3,22,129,131,144],html:[58,106,145],http:43,identifi:13,imag:133,improv:3,indent:45,index:[46,76,82,96,112,120],individu:131,inflector:60,info:71,inform:10,initi:[8,9,17,29,40,124,125,128,129,130,132,133,136,142,144,145,146,147,148,150,151,152],input:[44,106,135],insert:[8,14,44],instal:[38,71,73],instead:106,instruct:[73,93],internation:137,introduct:71,is_cli_request:106,issu:[2,106],item:[81,106,125,126,136,162],javascript:[106,136],jqueri:136,keep:6,kei:[9,88,128],label:137,languag:[61,85,106,120,137],last:141,length:[128,129],let:[23,26],librari:[29,37,71,95,106,127,128,129,134,136,144,148],licens:153,light:155,limit:14,line:[23,45,106,137],link:[124,141],list:[12,17,27],load:[21,29,34,39,47,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,93,95,126,137],loader:138,local:45,log:[1,106],logic:[45,165],look:[14,145],loop:47,magic_quotes_runtim:44,main:[82,96],make:[10,106,109],manag:[3,16,38],mani:106,manipul:133,manual:[6,13,16,126],markup:141,memcach:[123,144],memori:122,messag:[25,128,129,131],metadata:[12,144],method:[10,14,15,18,26,45,106,131,133],migrat:139,mime:[88,94,97,98,106],miss:106,mit:153,modal:136,mode:[16,129,148],model:[39,79,86,160,162,164],modifi:9,month:124,move:[93,95,106],mssql:106,multibyt:25,multipl:[6,8,32,34,35,38,47,106,125,137],my_secur:95,mysql:106,name:[17,26,29,42,45,106,131,139],nativ:29,nbs:106,necessari:93,next:[124,141],nice_d:116,note:[17,93,141,142,144,146,151],now:[34,106],number:62,object:[8,15],odbc:113,one:38,open:45,oper:45,optim:17,option:112,order:14,organ:26,origin:0,other:131,output:[26,140],overlai:133,overrid:[106,127],overview:[65,131,159],own:[27,29,31,34,37,43,131,151],pack:155,packag:138,page:[18,22,23,26,39,130,131,141,165],pagin:[106,141],pair:142,paramet:[6,29,129,151],parent:93,parenthet:45,pars:142,parser:142,pass:[9,26,29,124],password:[25,44],path:[63,136],pdo:106,per:45,perform:3,php:[2,19,45,46,76,80,81,82,85,86,94,96,97,98,106,108,112,113,123,135],ping:146,plugin:[93,136],point:[35,40,122],popul:131,portabl:129,post:[94,135],potenti:106,practic:44,prefer:[17,124,127,130,133,139,141,144],prefix:[13,27,29,34],prep:131,prep_for_form:[106,112],present:12,previou:[121,124,141],previous:106,privat:[26,45],process:[26,130,133,146,151],profil:[40,122],protect:[13,44],punch:155,queri:[5,8,10,13,14,15,17,45,46,113],quick:8,random_str:106,read_fil:106,receiv:146,reconnect:6,redi:[123,144],refer:[3,7,9,11,14,15,17,25,52,71,96,122,123,124,125,126,127,128,129,130,131,132,133,135,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152],register_glob:44,regular:[13,43],rel:141,reloc:[38,120],remap:26,remov:[46,92,93,95,96,106,112,116,119,144],renam:[9,38,81],repair:17,repeat:106,replac:[27,29,94,96,97,98,106,120],report:[2,32,148],request:[143,151],requir:[18,41,155],reserv:[26,42,43],reset:14,resourc:[21,29],respons:151,result:[8,14,15,17],retriev:[12,17,144],rout:[43,106,162,164,165],row:[15,125],rpc:151,rule:[43,106,131],run:[16,23,38,148],same:35,sampl:137,save:131,section:[18,40,164],secur:[2,44,64,95,106,135,143],segment:[26,46],select:14,send:[127,146,151],separ:106,server:[41,135,151],session:[90,96,106,144],set:[17,27,29,34,40,43,106,124,126,127,128,129,130,131,133,136,141,164],setup:136,sha1:106,shop:125,show:[124,131,136],sign:2,similar:14,simplifi:13,singl:8,site:[3,143],slidedown:136,slidetoggl:136,slideup:136,smilei:[65,106],space:45,specif:[14,129,131],sql:45,sqlite:106,standard:[8,25],standard_d:106,standardize_newlin:116,start:[8,157],statement:45,step:[76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120],storag:29,store:[3,47,93],stream:135,strict:[16,148],string:[9,25,45,46,66,106],structur:[19,28],style:[2,45],sub:[26,29,47],subhead:18,success:[130,131],suffix:46,support:[2,19,129],sure:[106,109],syntax:[19,90],system:27,system_path:92,system_url:106,tabl:[9,12,17,45,90,96,98,115,145,146],tablesort:136,tag:[19,45],tempdata:144,templat:[92,106,107,124,142,148,155],test:[16,148],text:[45,67,106,133,137],textmat:45,than:131,thi:[3,4,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70],third_parti:96,thoroughli:155,time:122,time_to_upd:86,timezon:52,tip:[2,144],toggl:136,toggleclass:136,tool:18,topic:[36,71],total:122,trackback:146,transact:16,translat:131,trim_slash:106,troubleshoot:74,tutori:[65,71,131,163],two:133,type:[106,133,151],typecast:45,typographi:[68,147],underscor:106,uniqu:106,unit:148,updat:[14,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,125],upgrad:[75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],upload:130,uri:[26,43,44,46,106,149],url:[46,69,106,146,155],url_titl:106,usag:[17,106,112,113,116,119,123,132,139,142,152],user:[71,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,97,99,100,150,155],user_ag:96,using:113,util:[17,29],valid:[44,90,106,131],valu:[5,45,57,106,109],variabl:[42,45,136,142],verb:43,version:[1,8,29,113,121],via:23,view:[19,47,136,138,142,160],watermark:133,web:22,weight:155,welcom:[48,71],what:[23,26,34,39,125,144,151],when:29,where:93,whitespac:45,who:48,why:23,wildcard:43,wincach:123,within:[29,47],word:127,work:[3,13,22,126,129,132,144],world:[23,26],wrap:127,write:18,xml:[17,70,151],xss:[44,106,135,143],xss_clean:106,you:113,your:[3,6,10,12,17,26,27,29,31,34,37,38,39,40,43,44,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,124,128,129,131,136,145,146,151,164],zip:152}}) \ No newline at end of file diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html new file mode 100755 index 0000000..4852158 --- /dev/null +++ b/user_guide/tutorial/conclusion.html @@ -0,0 +1,515 @@ + + + + + + + + + + Conclusion — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Conclusion

    +

    This tutorial did not cover all of the things you might expect of a +full-fledged content management system, but it introduced you to the +more important topics of routing, writing controllers, and models. We +hope this tutorial gave you an insight into some of CodeIgniter’s basic +design patterns, which you can expand upon.

    +

    Now that you’ve completed this tutorial, we recommend you check out the +rest of the documentation. CodeIgniter is often praised because of its +comprehensive documentation. Use this to your advantage and read the +“Introduction” and “General Topics” sections thoroughly. You should read +the class and helper references when needed.

    +

    Every intermediate PHP programmer should be able to get the hang of +CodeIgniter within a few days.

    +

    If you still have questions about the framework or your own CodeIgniter +code, you can:

    + +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html new file mode 100755 index 0000000..55a3de1 --- /dev/null +++ b/user_guide/tutorial/create_news_items.html @@ -0,0 +1,629 @@ + + + + + + + + + + Create news items — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Tutorial »
    • + +
    • Create news items
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Create news items

    +

    You now know how you can read data from a database using CodeIgniter, but +you haven’t written any information to the database yet. In this section +you’ll expand your news controller and model created earlier to include +this functionality.

    +
    +

    Create a form

    +

    To input data into the database you need to create a form where you can +input the information to be stored. This means you’ll be needing a form +with two fields, one for the title and one for the text. You’ll derive +the slug from our title in the model. Create the new view at +application/views/news/create.php.

    +
    <h2><?php echo $title; ?></h2>
    +
    +<?php echo validation_errors(); ?>
    +
    +<?php echo form_open('news/create'); ?>
    +
    +    <label for="title">Title</label>
    +    <input type="input" name="title" /><br />
    +
    +    <label for="text">Text</label>
    +    <textarea name="text"></textarea><br />
    +
    +    <input type="submit" name="submit" value="Create news item" />
    +
    +</form>
    +
    +
    +

    There are only two things here that probably look unfamiliar to you: the +form_open() function and the validation_errors() function.

    +

    The first function is provided by the form +helper and renders the form element and +adds extra functionality, like adding a hidden CSRF prevention +field. The latter is used to report +errors related to form validation.

    +

    Go back to your news controller. You’re going to do two things here, +check whether the form was submitted and whether the submitted data +passed the validation rules. You’ll use the form +validation library to do this.

    +
    public function create()
    +{
    +    $this->load->helper('form');
    +    $this->load->library('form_validation');
    +
    +    $data['title'] = 'Create a news item';
    +
    +    $this->form_validation->set_rules('title', 'Title', 'required');
    +    $this->form_validation->set_rules('text', 'Text', 'required');
    +
    +    if ($this->form_validation->run() === FALSE)
    +    {
    +        $this->load->view('templates/header', $data);
    +        $this->load->view('news/create');
    +        $this->load->view('templates/footer');
    +
    +    }
    +    else
    +    {
    +        $this->news_model->set_news();
    +        $this->load->view('news/success');
    +    }
    +}
    +
    +
    +

    The code above adds a lot of functionality. The first few lines load the +form helper and the form validation library. After that, rules for the +form validation are set. The set_rules() method takes three arguments; +the name of the input field, the name to be used in error messages, and +the rule. In this case the title and text fields are required.

    +

    CodeIgniter has a powerful form validation library as demonstrated +above. You can read more about this library +here.

    +

    Continuing down, you can see a condition that checks whether the form +validation ran successfully. If it did not, the form is displayed, if it +was submitted and passed all the rules, the model is called. After +this, a view is loaded to display a success message. Create a view at +application/views/news/success.php and write a success message.

    +
    +
    +

    Model

    +

    The only thing that remains is writing a method that writes the data to +the database. You’ll use the Query Builder class to insert the +information and use the input library to get the posted data. Open up +the model created earlier and add the following:

    +
    public function set_news()
    +{
    +    $this->load->helper('url');
    +
    +    $slug = url_title($this->input->post('title'), 'dash', TRUE);
    +
    +    $data = array(
    +        'title' => $this->input->post('title'),
    +        'slug' => $slug,
    +        'text' => $this->input->post('text')
    +    );
    +
    +    return $this->db->insert('news', $data);
    +}
    +
    +
    +

    This new method takes care of inserting the news item into the database. +The third line contains a new function, url_title(). This function - +provided by the URL helper - strips down +the string you pass it, replacing all spaces by dashes (-) and makes +sure everything is in lowercase characters. This leaves you with a nice +slug, perfect for creating URIs.

    +

    Let’s continue with preparing the record that is going to be inserted +later, inside the $data array. Each element corresponds with a column in +the database table created earlier. You might notice a new method here, +namely the post() method from the input +library. This method makes sure the data is +sanitized, protecting you from nasty attacks from others. The input +library is loaded by default. At last, you insert our $data array into +our database.

    +
    +
    +

    Routing

    +

    Before you can start adding news items into your CodeIgniter application +you have to add an extra rule to config/routes.php file. Make sure your +file contains the following. This makes sure CodeIgniter sees ‘create’ +as a method instead of a news item’s slug.

    +
    $route['news/create'] = 'news/create';
    +$route['news/(:any)'] = 'news/view/$1';
    +$route['news'] = 'news';
    +$route['(:any)'] = 'pages/view/$1';
    +$route['default_controller'] = 'pages/view';
    +
    +
    +

    Now point your browser to your local development environment where you +installed CodeIgniter and add index.php/news/create to the URL. +Congratulations, you just created your first CodeIgniter application! +Add some news and check out the different pages you made.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/index.html b/user_guide/tutorial/index.html new file mode 100755 index 0000000..ee3534c --- /dev/null +++ b/user_guide/tutorial/index.html @@ -0,0 +1,525 @@ + + + + + + + + + + Tutorial — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
      +
    • Docs »
    • + +
    • Tutorial
    • +
    • + +
    • +
      + classic layout +
      +
    +
    +
    +
    + +
    +

    Tutorial

    +

    This tutorial is intended to introduce you to the CodeIgniter framework +and the basic principles of MVC architecture. It will show you how a +basic CodeIgniter application is constructed in step-by-step fashion.

    +

    In this tutorial, you will be creating a basic news application. You +will begin by writing the code that can load static pages. Next, you +will create a news section that reads news items from a database. +Finally, you’ll add a form to create news items in the database.

    +

    This tutorial will primarily focus on:

    +
      +
    • Model-View-Controller basics
    • +
    • Routing basics
    • +
    • Form validation
    • +
    • Performing basic database queries using “Query Builder”
    • +
    +

    The entire tutorial is split up over several pages, each explaining a +small part of the functionality of the CodeIgniter framework. You’ll go +through the following pages:

    +
      +
    • Introduction, this page, which gives you an overview of what to +expect.
    • +
    • Static pages, which will teach you the basics +of controllers, views and routing.
    • +
    • News section, where you’ll start using models +and will be doing some basic database operations.
    • +
    • Create news items, which will introduce +more advanced database operations and form validation.
    • +
    • Conclusion, which will give you some pointers on +further reading and other resources.
    • +
    +

    Enjoy your exploration of the CodeIgniter framework.

    +
    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html new file mode 100755 index 0000000..31d8520 --- /dev/null +++ b/user_guide/tutorial/news_section.html @@ -0,0 +1,685 @@ + + + + + + + + + + News section — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    News section

    +

    In the last section, we went over some basic concepts of the framework +by writing a class that includes static pages. We cleaned up the URI by +adding custom routing rules. Now it’s time to introduce dynamic content +and start using a database.

    +
    +

    Setting up your model

    +

    Instead of writing database operations right in the controller, queries +should be placed in a model, so they can easily be reused later. Models +are the place where you retrieve, insert, and update information in your +database or other data stores. They represent your data.

    +

    Open up the application/models/ directory and create a new file called +News_model.php and add the following code. Make sure you’ve configured +your database properly as described here.

    +
    <?php
    +class News_model extends CI_Model {
    +
    +        public function __construct()
    +        {
    +                $this->load->database();
    +        }
    +}
    +
    +
    +

    This code looks similar to the controller code that was used earlier. It +creates a new model by extending CI_Model and loads the database +library. This will make the database class available through the +$this->db object.

    +

    Before querying the database, a database schema has to be created. +Connect to your database and run the SQL command below (MySQL). +Also add some seed records.

    +
    CREATE TABLE news (
    +        id int(11) NOT NULL AUTO_INCREMENT,
    +        title varchar(128) NOT NULL,
    +        slug varchar(128) NOT NULL,
    +        text text NOT NULL,
    +        PRIMARY KEY (id),
    +        KEY slug (slug)
    +);
    +
    +
    +

    Now that the database and a model have been set up, you’ll need a method +to get all of our posts from our database. To do this, the database +abstraction layer that is included with CodeIgniter — +Query Builder — is used. This makes it +possible to write your ‘queries’ once and make them work on all +supported database systems. Add the +following code to your model.

    +
    public function get_news($slug = FALSE)
    +{
    +        if ($slug === FALSE)
    +        {
    +                $query = $this->db->get('news');
    +                return $query->result_array();
    +        }
    +
    +        $query = $this->db->get_where('news', array('slug' => $slug));
    +        return $query->row_array();
    +}
    +
    +
    +

    With this code you can perform two different queries. You can get all +news records, or get a news item by its slug. You might have +noticed that the $slug variable wasn’t sanitized before running the +query; Query Builder does this for you.

    +
    +
    +

    Display the news

    +

    Now that the queries are written, the model should be tied to the views +that are going to display the news items to the user. This could be done +in our Pages controller created earlier, but for the sake of clarity, +a new News controller is defined. Create the new controller at +application/controllers/News.php.

    +
    <?php
    +class News extends CI_Controller {
    +
    +        public function __construct()
    +        {
    +                parent::__construct();
    +                $this->load->model('news_model');
    +                $this->load->helper('url_helper');
    +        }
    +
    +        public function index()
    +        {
    +                $data['news'] = $this->news_model->get_news();
    +        }
    +
    +        public function view($slug = NULL)
    +        {
    +                $data['news_item'] = $this->news_model->get_news($slug);
    +        }
    +}
    +
    +
    +

    Looking at the code, you may see some similarity with the files we +created earlier. First, the __construct() method: it calls the +constructor of its parent class (CI_Controller) and loads the model, +so it can be used in all other methods in this controller. +It also loads a collection of URL Helper +functions, because we’ll use one of them in a view later.

    +

    Next, there are two methods to view all news items and one for a specific +news item. You can see that the $slug variable is passed to the model’s +method in the second method. The model is using this slug to identify the +news item to be returned.

    +

    Now the data is retrieved by the controller through our model, but +nothing is displayed yet. The next thing to do is passing this data to +the views.

    +
    public function index()
    +{
    +        $data['news'] = $this->news_model->get_news();
    +        $data['title'] = 'News archive';
    +
    +        $this->load->view('templates/header', $data);
    +        $this->load->view('news/index', $data);
    +        $this->load->view('templates/footer');
    +}
    +
    +
    +

    The code above gets all news records from the model and assigns it to a +variable. The value for the title is also assigned to the $data['title'] +element and all data is passed to the views. You now need to create a +view to render the news items. Create application/views/news/index.php +and add the next piece of code.

    +
    <h2><?php echo $title; ?></h2>
    +
    +<?php foreach ($news as $news_item): ?>
    +
    +        <h3><?php echo $news_item['title']; ?></h3>
    +        <div class="main">
    +                <?php echo $news_item['text']; ?>
    +        </div>
    +        <p><a href="<?php echo site_url('news/'.$news_item['slug']); ?>">View article</a></p>
    +
    +<?php endforeach; ?>
    +
    +
    +

    Here, each news item is looped and displayed to the user. You can see we +wrote our template in PHP mixed with HTML. If you prefer to use a template +language, you can use CodeIgniter’s Template +Parser class or a third party parser.

    +

    The news overview page is now done, but a page to display individual +news items is still absent. The model created earlier is made in such +way that it can easily be used for this functionality. You only need to +add some code to the controller and create a new view. Go back to the +News controller and update view() with the following:

    +
    public function view($slug = NULL)
    +{
    +        $data['news_item'] = $this->news_model->get_news($slug);
    +
    +        if (empty($data['news_item']))
    +        {
    +                show_404();
    +        }
    +
    +        $data['title'] = $data['news_item']['title'];
    +
    +        $this->load->view('templates/header', $data);
    +        $this->load->view('news/view', $data);
    +        $this->load->view('templates/footer');
    +}
    +
    +
    +

    Instead of calling the get_news() method without a parameter, the +$slug variable is passed, so it will return the specific news item. +The only things left to do is create the corresponding view at +application/views/news/view.php. Put the following code in this file.

    +
    <?php
    +echo '<h2>'.$news_item['title'].'</h2>';
    +echo $news_item['text'];
    +
    +
    +
    +
    +

    Routing

    +

    Because of the wildcard routing rule created earlier, you need an extra +route to view the controller that you just made. Modify your routing file +(application/config/routes.php) so it looks as follows. +This makes sure the requests reaches the News controller instead of +going directly to the Pages controller. The first line routes URI’s +with a slug to the view() method in the News controller.

    +
    $route['news/(:any)'] = 'news/view/$1';
    +$route['news'] = 'news';
    +$route['(:any)'] = 'pages/view/$1';
    +$route['default_controller'] = 'pages/view';
    +
    +
    +

    Point your browser to your document root, followed by index.php/news and +watch your news page.

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html new file mode 100755 index 0000000..613b106 --- /dev/null +++ b/user_guide/tutorial/static_pages.html @@ -0,0 +1,633 @@ + + + + + + + + + + Static pages — CodeIgniter 3.1.6 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +

    Static pages

    +

    Note: This tutorial assumes you’ve downloaded CodeIgniter and +installed the framework in your +development environment.

    +

    The first thing you’re going to do is set up a controller to handle +static pages. A controller is simply a class that helps delegate work. +It is the glue of your web application.

    +

    For example, when a call is made to:

    +
    +
    +

    We might imagine that there is a controller named “news”. The method +being called on news would be “latest”. The news method’s job could be to +grab 10 news items, and render them on the page. Very often in MVC, +you’ll see URL patterns that match:

    +
    +
    +

    As URL schemes become more complex, this may change. But for now, this +is all we will need to know.

    +

    Create a file at application/controllers/Pages.php with the following +code.

    +
    <?php
    +class Pages extends CI_Controller {
    +
    +        public function view($page = 'home')
    +        {
    +        }
    +}
    +
    +
    +

    You have created a class named Pages, with a view method that accepts +one argument named $page. The Pages class is extending the +CI_Controller class. This means that the new pages class can access the +methods and variables defined in the CI_Controller class +(system/core/Controller.php).

    +

    The controller is what will become the center of every request to +your web application. In very technical CodeIgniter discussions, it may +be referred to as the super object. Like any php class, you refer to +it within your controllers as $this. Referring to $this is how +you will load libraries, views, and generally command the framework.

    +

    Now you’ve created your first method, it’s time to make some basic page +templates. We will be creating two “views” (page templates) that act as +our page footer and header.

    +

    Create the header at application/views/templates/header.php and add +the following code:

    +
    <html>
    +        <head>
    +                <title>CodeIgniter Tutorial</title>
    +        </head>
    +        <body>
    +
    +                <h1><?php echo $title; ?></h1>
    +
    +
    +

    The header contains the basic HTML code that you’ll want to display +before loading the main view, together with a heading. It will also +output the $title variable, which we’ll define later in the controller. +Now, create a footer at application/views/templates/footer.php that +includes the following code:

    +
                    <em>&copy; 2015</em>
    +        </body>
    +</html>
    +
    +
    +
    +

    Adding logic to the controller

    +

    Earlier you set up a controller with a view() method. The method +accepts one parameter, which is the name of the page to be loaded. The +static page templates will be located in the application/views/pages/ +directory.

    +

    In that directory, create two files named home.php and about.php. +Within those files, type some text − anything you’d like − and save them. +If you like to be particularly un-original, try “Hello World!”.

    +

    In order to load those pages, you’ll have to check whether the requested +page actually exists:

    +
    public function view($page = 'home')
    +{
    +        if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
    +        {
    +                // Whoops, we don't have a page for that!
    +                show_404();
    +        }
    +
    +        $data['title'] = ucfirst($page); // Capitalize the first letter
    +
    +        $this->load->view('templates/header', $data);
    +        $this->load->view('pages/'.$page, $data);
    +        $this->load->view('templates/footer', $data);
    +}
    +
    +
    +

    Now, when the page does exist, it is loaded, including the header and +footer, and displayed to the user. If the page doesn’t exist, a “404 +Page not found” error is shown.

    +

    The first line in this method checks whether the page actually exists. +PHP’s native file_exists() function is used to check whether the file +is where it’s expected to be. show_404() is a built-in CodeIgniter +function that renders the default error page.

    +

    In the header template, the $title variable was used to customize the +page title. The value of title is defined in this method, but instead of +assigning the value to a variable, it is assigned to the title element +in the $data array.

    +

    The last thing that has to be done is loading the views in the order +they should be displayed. The second parameter in the view() method is +used to pass values to the view. Each value in the $data array is +assigned to a variable with the name of its key. So the value of +$data['title'] in the controller is equivalent to $title in the +view.

    +
    +
    +

    Routing

    +

    The controller is now functioning! Point your browser to +[your-site-url]index.php/pages/view to see your page. When you visit +index.php/pages/view/about you’ll see the about page, again including +the header and footer.

    +

    Using custom routing rules, you have the power to map any URI to any +controller and method, and break free from the normal convention: +http://example.com/[controller-class]/[controller-method]/[arguments]

    +

    Let’s do that. Open the routing file located at +application/config/routes.php and add the following two lines. +Remove all other code that sets any element in the $route array.

    +
    $route['default_controller'] = 'pages/view';
    +$route['(:any)'] = 'pages/view/$1';
    +
    +
    +

    CodeIgniter reads its routing rules from top to bottom and routes the +request to the first matching rule. Each rule is a regular expression +(left-side) mapped to a controller and method name separated by slashes +(right-side). When a request comes in, CodeIgniter looks for the first +match, and calls the appropriate controller and method, possibly with +arguments.

    +

    More information about routing can be found in the URI Routing +documentation.

    +

    Here, the second rule in the $routes array matches any request +using the wildcard string (:any). and passes the parameter to the +view() method of the Pages class.

    +

    Now visit index.php/about. Did it get routed correctly to the view() +method in the pages controller? Awesome!

    +
    +
    + + +
    +
    + + + + +
    + +
    +

    + © Copyright 2014 - 2017, British Columbia Institute of Technology. + Last updated on Sep 25, 2017. +

    +
    + + Built with Sphinx using a theme provided by Read the Docs. + +
    +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index 8b9ea77..0000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; - if (isset($this->prefixDirsPsr4[$search])) { - foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index f27399a..0000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index 7a91153..0000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ - $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index 213236c..0000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,11 +0,0 @@ - array($vendorDir . '/twig/twig/lib'), - 'Pimple' => array($vendorDir . '/pimple/pimple/src'), -); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php deleted file mode 100644 index 1c0779c..0000000 --- a/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,21 +0,0 @@ - array($vendorDir . '/twig/twig/src'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), - 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), - 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), - 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), - 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), - 'Symfony\\Bridge\\Twig\\' => array($vendorDir . '/symfony/twig-bridge'), - 'Silex\\' => array($vendorDir . '/silex/silex/src/Silex'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), - 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index b752630..0000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,70 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit5896cbec2626ce770365d4aa10b80db6::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit5896cbec2626ce770365d4aa10b80db6::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire5896cbec2626ce770365d4aa10b80db6($fileIdentifier, $file); - } - - return $loader; - } -} - -function composerRequire5896cbec2626ce770365d4aa10b80db6($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php deleted file mode 100644 index 472fd23..0000000 --- a/vendor/composer/autoload_static.php +++ /dev/null @@ -1,117 +0,0 @@ - __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'T' => - array ( - 'Twig\\' => 5, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Component\\Routing\\' => 26, - 'Symfony\\Component\\HttpKernel\\' => 29, - 'Symfony\\Component\\HttpFoundation\\' => 33, - 'Symfony\\Component\\EventDispatcher\\' => 34, - 'Symfony\\Component\\Debug\\' => 24, - 'Symfony\\Bridge\\Twig\\' => 20, - 'Silex\\' => 6, - ), - 'P' => - array ( - 'Psr\\Log\\' => 8, - 'Psr\\Container\\' => 14, - ), - 'M' => - array ( - 'Monolog\\' => 8, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/src', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Component\\Routing\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/routing', - ), - 'Symfony\\Component\\HttpKernel\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/http-kernel', - ), - 'Symfony\\Component\\HttpFoundation\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/http-foundation', - ), - 'Symfony\\Component\\EventDispatcher\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', - ), - 'Symfony\\Component\\Debug\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/debug', - ), - 'Symfony\\Bridge\\Twig\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/twig-bridge', - ), - 'Silex\\' => - array ( - 0 => __DIR__ . '/..' . '/silex/silex/src/Silex', - ), - 'Psr\\Log\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', - ), - 'Psr\\Container\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/container/src', - ), - 'Monolog\\' => - array ( - 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', - ), - ); - - public static $prefixesPsr0 = array ( - 'T' => - array ( - 'Twig_' => - array ( - 0 => __DIR__ . '/..' . '/twig/twig/lib', - ), - ), - 'P' => - array ( - 'Pimple' => - array ( - 0 => __DIR__ . '/..' . '/pimple/pimple/src', - ), - ), - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5896cbec2626ce770365d4aa10b80db6::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5896cbec2626ce770365d4aa10b80db6::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit5896cbec2626ce770365d4aa10b80db6::$prefixesPsr0; - - }, null, ClassLoader::class); - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 98f659f..0000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,935 +0,0 @@ -[ - { - "name": "symfony/routing", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/dependency-injection": "For loading routes from a service", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, - "time": "2017-10-02T07:25:00+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Routing Component", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ] - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "version_normalized": "1.6.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2017-10-11T12:05:26+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ] - }, - { - "name": "symfony/http-foundation", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "symfony/expression-language": "~2.8|~3.0" - }, - "time": "2017-10-05T23:10:23+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/event-dispatcher", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "time": "2017-10-02T06:42:24+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com" - }, - { - "name": "psr/log", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-10-10T12:19:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "symfony/debug", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "time": "2017-10-02T06:42:24+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com" - }, - { - "name": "symfony/http-kernel", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "654f047a78756964bf91b619554f956517394018" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/654f047a78756964bf91b619554f956517394018", - "reference": "654f047a78756964bf91b619554f956517394018", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0", - "symfony/debug": "~2.8|~3.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/var-dumper": "<3.3", - "twig/twig": "<1.34|<2.4,>=2" - }, - "require-dev": { - "psr/cache": "~1.0", - "symfony/browser-kit": "~2.8|~3.0", - "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "time": "2017-10-05T23:40:19+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com" - }, - { - "name": "psr/container", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-02-14T16:28:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ] - }, - { - "name": "pimple/pimple", - "version": "v3.2.2", - "version_normalized": "3.2.2.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", - "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/container": "^1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^3.2" - }, - "time": "2017-07-23T07:32:15+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ] - }, - { - "name": "silex/silex", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Silex.git", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Silex/zipball/ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "reference": "ec7d5b5334465414952d4b2e935e73bd085dbbbb", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "pimple/pimple": "~3.0", - "symfony/event-dispatcher": "~2.8|^3.0", - "symfony/http-foundation": "~2.8|^3.0", - "symfony/http-kernel": "~2.8|^3.0", - "symfony/routing": "~2.8|^3.0" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35 || >= 5.0, <5.4.3" - }, - "replace": { - "silex/api": "self.version", - "silex/providers": "self.version" - }, - "require-dev": { - "doctrine/dbal": "~2.2", - "monolog/monolog": "^1.4.1", - "swiftmailer/swiftmailer": "~5", - "symfony/asset": "~2.8|^3.0", - "symfony/browser-kit": "~2.8|^3.0", - "symfony/config": "~2.8|^3.0", - "symfony/css-selector": "~2.8|^3.0", - "symfony/debug": "~2.8|^3.0", - "symfony/doctrine-bridge": "~2.8|^3.0", - "symfony/dom-crawler": "~2.8|^3.0", - "symfony/expression-language": "~2.8|^3.0", - "symfony/finder": "~2.8|^3.0", - "symfony/form": "~2.8|^3.0", - "symfony/intl": "~2.8|^3.0", - "symfony/monolog-bridge": "~2.8|^3.0", - "symfony/options-resolver": "~2.8|^3.0", - "symfony/phpunit-bridge": "^3.2", - "symfony/process": "~2.8|^3.0", - "symfony/security": "~2.8|^3.0", - "symfony/serializer": "~2.8|^3.0", - "symfony/translation": "~2.8|^3.0", - "symfony/twig-bridge": "~2.8|^3.0", - "symfony/validator": "~2.8|^3.0", - "symfony/var-dumper": "~2.8|^3.0", - "symfony/web-link": "^3.3", - "twig/twig": "~1.28|~2.0" - }, - "time": "2017-07-23T07:40:14+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Silex\\": "src/Silex" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "description": "The PHP micro-framework based on the Symfony Components", - "homepage": "http://silex.sensiolabs.org", - "keywords": [ - "microframework" - ] - }, - { - "name": "monolog/monolog", - "version": "1.23.0", - "version_normalized": "1.23.0.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "time": "2017-06-19T01:22:40+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ] - }, - { - "name": "twig/twig", - "version": "v2.4.4", - "version_normalized": "2.4.4.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/eddb97148ad779f27e670e1e3f19fb323aedafeb", - "reference": "eddb97148ad779f27e670e1e3f19fb323aedafeb", - "shasum": "" - }, - "require": { - "php": "^7.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.3@dev" - }, - "time": "2017-09-27T18:10:31+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ] - }, - { - "name": "symfony/twig-bridge", - "version": "v3.3.10", - "version_normalized": "3.3.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/twig-bridge.git", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/cc40b1ea0efd030d422c762328345883a0404de4", - "reference": "cc40b1ea0efd030d422c762328345883a0404de4", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" - }, - "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" - }, - "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", - "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/web-link": "~3.3", - "symfony/yaml": "~2.8|~3.0" - }, - "suggest": { - "symfony/asset": "For using the AssetExtension", - "symfony/expression-language": "For using the ExpressionExtension", - "symfony/finder": "", - "symfony/form": "For using the FormExtension", - "symfony/http-kernel": "For using the HttpKernelExtension", - "symfony/routing": "For using the RoutingExtension", - "symfony/security": "For using the SecurityExtension", - "symfony/stopwatch": "For using the StopwatchExtension", - "symfony/templating": "For using the TwigEngine", - "symfony/translation": "For using the TranslationExtension", - "symfony/var-dumper": "For using the DumpExtension", - "symfony/web-link": "For using the WebLinkExtension", - "symfony/yaml": "For using the YamlExtension" - }, - "time": "2017-10-02T06:42:24+00:00", - "type": "symfony-bridge", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Bridge\\Twig\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Twig Bridge", - "homepage": "https://symfony.com" - }, - { - "name": "heroku/heroku-buildpack-php", - "version": "v126", - "version_normalized": "126.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/heroku/heroku-buildpack-php.git", - "reference": "8288ddb4b717019f5e39db384e3a9a5b41d73e93" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/8288ddb4b717019f5e39db384e3a9a5b41d73e93", - "reference": "8288ddb4b717019f5e39db384e3a9a5b41d73e93", - "shasum": "" - }, - "time": "2017-10-28T00:17:41+00:00", - "bin": [ - "bin/heroku-hhvm-apache2", - "bin/heroku-hhvm-nginx", - "bin/heroku-php-apache2", - "bin/heroku-php-nginx" - ], - "type": "library", - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "David Zuelke", - "email": "dz@heroku.com" - } - ], - "description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP/HHVM and Apache2/Nginx as on Heroku", - "homepage": "https://github.com/heroku/heroku-buildpack-php", - "keywords": [ - "apache", - "apache2", - "foreman", - "heroku", - "hhvm", - "nginx", - "php" - ] - } -] diff --git a/vendor/heroku/heroku-buildpack-php/.gitignore b/vendor/heroku/heroku-buildpack-php/.gitignore deleted file mode 100644 index d40fd3e..0000000 --- a/vendor/heroku/heroku-buildpack-php/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -composer.lock -vendor \ No newline at end of file diff --git a/vendor/heroku/heroku-buildpack-php/.travis.yml b/vendor/heroku/heroku-buildpack-php/.travis.yml deleted file mode 100644 index 0a3316f..0000000 --- a/vendor/heroku/heroku-buildpack-php/.travis.yml +++ /dev/null @@ -1,2 +0,0 @@ -sudo: false -script: exit 0 diff --git a/vendor/heroku/heroku-buildpack-php/CHANGELOG.md b/vendor/heroku/heroku-buildpack-php/CHANGELOG.md deleted file mode 100644 index 8b0b57b..0000000 --- a/vendor/heroku/heroku-buildpack-php/CHANGELOG.md +++ /dev/null @@ -1,867 +0,0 @@ -# heroku-buildpack-php CHANGELOG - -## v126 (2017-10-29) - -### ADD - -- PHP/5.6.32 [David Zuelke] -- PHP/7.0.25 [David Zuelke] -- PHP/7.1.11 [David Zuelke] -- ext-newrelic/7.6.0.201 [David Zuelke] -- ext-mongodb/1.3.1 [David Zuelke] -- ext-amqp/1.9.3 [David Zuelke] -- ext-phalcon/3.2.4 [David Zuelke] -- Apache/2.4.29 [David Zuelke] - -### CHG - -- Ignore `require-dev` when building platform package dependency graph (#240) [David Zuelke] -- Rewrite `provide` sections with PHP extensions in package definitions to `replace` for known polyfill packages [David Zuelke] -- libcassandra/2.7.1 [David Zuelke] -- librdkafka/0.11.1 [David Zuelke] - -### FIX - -- gmp.h lookup patching broken since v125 / d024b14 [David Zuelke] - -## v125 (2017-10-04) - -### ADD - -- PHP/7.0.24 [David Zuelke] -- PHP/7.1.10 [David Zuelke] -- ext-redis/3.1.4 [David Zuelke] -- ext-mongodb/1.3.0 [David Zuelke] -- ext-blackfire/1.18.0 [David Zuelke] - -### CHG - -- Composer/1.5.2 [David Zuelke] - -## v124 (2017-09-07) - -### FIX - -- Use Composer/1.5.1 [David Zuelke] - -## v123 (2017-09-07) - -### ADD - -- ext-mongo/1.6.16 [David Zuelke] -- ext-newrelic/7.5.0.199 [David Zuelke] -- ext-cassandra/1.3.2 [David Zuelke] -- ext-rdkafka/3.0.4 [David Zuelke] -- ext-phalcon/3.2.2 [David Zuelke] -- PHP/7.1.9 [David Zuelke] -- PHP/7.0.23 [David Zuelke] -- ext-mongodb/1.2.10 [David Zuelke] - -### CHG - -- Support "heroku-sys-library" package type in platform installer [David Zuelke] -- Add new argument for "provide" platform package manifest entry to `manifest.py` [David Zuelke] -- Move libcassandra to its own package, installed as a dependency by platform installer [David Zuelke] -- Move libmemcached to its own package, installed as a dependency by platform installer (if the platform doesn't already provide it) [David Zuelke] -- Move librdkafka to its own package, installed as a dependency by platform installer [David Zuelke] -- libcassandra/2.7.0 [David Zuelke] -- librdkafka/0.11.0 [David Zuelke] -- Composer/1.5.1 [David Zuelke] - -## v122 (2017-08-03) - -### ADD - -- ext-mongodb/1.2.9 [David Zuelke] -- ext-amqp/1.9.1 [David Zuelke] -- ext-blackfire/1.17.3 [David Zuelke] -- ext-newrelic/7.4.0.198 [David Zuelke] -- ext-phalcon/3.2.1 [David Zuelke] -- ext-pq/2.1.2 [David Zuelke] -- ext-redis/3.1.3 [David Zuelke] -- ext-rdkafka/3.0.3 [David Zuelke] -- PHP/7.0.22 [David Zuelke] -- PHP/7.1.8 [David Zuelke] -- PHP/5.6.31 [David Zuelke] - -### CHG - -- Do not auto-enable ext-newrelic and ext-blackfire in Heroku CI runs [David Zuelke] -- Composer/1.4.2 [David Zuelke] -- Do not error if buildpack package is installed during Heroku CI runs [David Zuelke] - -## v121 (2017-03-28) - -### ADD - -- ext-blackfire/1.15.0 [David Zuelke] -- PHP/7.0.17 [David Zuelke] -- PHP/7.1.3 [David Zuelke] -- ext-cassandra/1.3.0 [David Zuelke] -- ext-mongodb/1.2.8 [David Zuelke] -- ext-amqp/1.9.0 (for heroku-16 only) [David Zuelke] -- ext-newrelic/7.1.0.187 [David Zuelke] -- ext-redis/3.1.2 [David Zuelke] -- ext-event/2.3.0 [David Zuelke] -- ext-phalcon/3.1.1 [David Zuelke] - -### CHG - -- Default to `web: heroku-php-apache2` process in case of empty `Procfile` [David Zuelke] -- libcassandra-2.6.0 [David Zuelke] -- librdkafka/0.9.4 [David Zuelke] -- Composer/1.4.1 [David Zuelke] -- Default to `web: heroku-php-apache2` (without explicit composer bin dir) process in case of missing `Procfile` [David Zuelke] - -### FIX - -- Failed download during bootstrap fails without meaningful error message [David Zuelke] - -## v120 (2017-02-20) - -### ADD - -- ext-blackfire/1.14.3 [David Zuelke] -- ext-mongodb/1.2.5 [David Zuelke] -- ext-redis/3.1.1 [David Zuelke] -- ext-imagick/3.4.3 [David Zuelke] -- ext-rdkafka/3.0.1 [David Zuelke] -- PHP/7.0.16 [David Zuelke] -- PHP/7.1.2 [David Zuelke] -- ext-memcached/3.0.3 [David Zuelke] - -### CHG - -- Allow overwriting of Apache access log format (now named `heroku`) in config include [David Zuelke] -- Composer/1.3.2 [David Zuelke] -- Use system libmcrypt and libmemcached on heroku-16 [David Zuelke] -- librdkafka/0.9.3 [David Zuelke] -- Enable `mod_proxy_wstunnel` in Apache config [David Zuelke] - -## v119 (2017-01-21) - -### FIX - -- Revert: ext-redis/3.1.0 [David Zuelke] -- Revert: Composer/1.3.1 [David Zuelke] - -## v118 (2017-01-20) - -### ADD - -- ext-redis/3.1.0 [David Zuelke] -- ext-rdkafka/3.0.0 [David Zuelke] -- ext-phalcon/3.0.3 [David Zuelke] -- ext-blackfire/1.14.2 [David Zuelke] -- ext-apcu/5.1.8 [David Zuelke] -- ext-mongodb/1.2.3 [David Zuelke] -- PHP/5.6.30 [David Zuelke] -- PHP/7.0.15 [David Zuelke] -- PHP/7.1.1 [David Zuelke] -- ext-newrelic/6.9.0 [David Zuelke] - -### CHG - -- Composer/1.3.1 [David Zuelke] -- Ignore `WEB_CONCURRENCY` values with leading zeroes [David Zuelke] -- Default `NEW_RELIC_APP_NAME` to `HEROKU_APP_NAME` [Christophe Coevoet] - -## v117 (2016-12-09) - -### ADD - -- ext-ev/1.0.4 [David Zuelke] -- ext-mongodb/1.2.1 [David Zuelke] -- PHP/7.0.14 [David Zuelke] -- PHP/5.6.29 [David Zuelke] - -### CHG - -- Composer/1.2.4 [David Zuelke] - -## v116 (2016-12-01) - -### ADD - -- PHP/7.1.0 [David Zuelke] -- ext-phalcon/3.0.2 [David Zuelke] -- ext-rdkafka/2.0.1 [David Zuelke] -- ext-mongodb/1.2.0 [David Zuelke] - -### FIX - -- Implicit and explicit stability flags for platform packages got ignored [David Zuelke] - -## v115 (2016-11-23) - -### ADD - -- ext-blackfire/1.14.1 [David Zuelke] - -### CHG - -- composer.json "require" or dependencies must now contain a runtime version requirement if "require-dev" or dependencies contain one [David Zuelke] - -## v114 (2016-11-10) - -### ADD - -- ext-apcu/5.1.7 [David Zuelke] -- ext-mongodb/1.1.9 [David Zuelke] -- ext-newrelic/6.8.0.177 [David Zuelke] -- PHP/7.0.13 [David Zuelke] -- PHP/5.6.28 [David Zuelke] -- ext-event/2.2.1 [David Zuelke] - -### CHG - -- Composer/1.2.2 [David Zuelke] -- Update to librdkafka-0.9.2 final for ext-rdkafka [David Zuelke] - -## v113 (2016-10-19) - -### ADD - -- ext-newrelic/6.7.0 [David Zuelke] -- ext-blackfire/1.13.0 [David Zuelke] -- ext-apcu/5.1.6 [David Zuelke] -- PHP/5.6.27 [David Zuelke] -- PHP/7.0.12 [David Zuelke] -- ext-rdkafka/1.0.0 [David Zuelke] -- ext-rdkafka/2.0.0 [David Zuelke] - -## v112 (2016-09-20) - -### FIX - -- Use Composer/1.2.1 [David Zuelke] - -## v111 (2016-09-20) - -### ADD - -- ext-newrelic/6.6.1.172 [David Zuelke] -- PHP/5.6.26 [David Zuelke] -- PHP/7.0.11 [David Zuelke] - -### CHG - -- Use Composer/1.2.1 [David Zuelke] - -## v110 (2016-08-26) - -### ADD - -- ext-ev/1.0.3 [David Zuelke] -- ext-phalcon/2.0.13 [David Zuelke] -- ext-cassandra/1.2.2 [David Zuelke] -- ext-blackfire/1.12.0 [David Zuelke] -- ext-newrelic/6.6.0 [David Zuelke] -- PHP/5.6.25 [David Zuelke] -- PHP/7.0.10 [David Zuelke] -- ext-phalcon/3.0.1 [David Zuelke] - -### CHG - -- Retry downloads up to three times during bootstrapping [David Zuelke] -- Composer/1.2.0 [David Zuelke] - -## v109 (2016-07-21) - -### ADD - -- PHP/7.0.9 [David Zuelke] -- PHP/5.6.24 [David Zuelke] -- PHP/5.5.38 [David Zuelke] - -## v108 (2016-07-08) - -### ADD - -- ext-oauth/2.0.2 [David Zuelke] -- ext-mongodb/1.1.8 [David Zuelke] -- ext-blackfire/1.11.1 [David Zuelke] -- PHP/5.5.37 [David Zuelke] -- PHP/5.6.23 [David Zuelke] -- PHP/7.0.8 [David Zuelke] - -### CHG - -- Composer/1.1.3 [David Zuelke] - -### FIX - -- Revert to ext-redis/2.2.7 due to reported segfaults/memleaks [David Zuelke] - -## v107 (2016-06-18) - -### ADD - -- ext-redis/2.2.8 [David Zuelke] -- ext-redis/3.0.0 [David Zuelke] -- ext-newrelic/6.4.0 [David Zuelke] -- ext-blackfire/1.10.6 [David Zuelke] - -### FIX - -- Custom `COMPOSER` env var breaks platform installs [David Zuelke] - -## v106 (2016-06-08) - -### ADD - -- ext-mongodb/1.1.7 [David Zuelke] -- ext-cassandra/1.1.0 [David Zuelke] -- ext-apcu/5.1.5 [David Zuelke] -- ext-event/2.1.0 [David Zuelke] - -### CHG - -- Use Composer/1.1.2 [David Zuelke] - -## v105 (2016-05-27) - -### ADD - -- PHP/5.5.36 [David Zuelke] -- PHP/5.6.22 [David Zuelke] -- PHP/7.0.7 [David Zuelke] - -## v104 (2016-05-20) - -### ADD - -- ext-pq/1.1.1 and 2.1.1 [David Zuelke] - -## v103 (2016-05-20) - -### ADD - -- ext-pq/1.0.1 and 2.0.1 [David Zuelke] -- ext-apcu/5.1.4 [David Zuelke] -- ext-newrelic/6.3.0.161 [David Zuelke] -- ext-ev/1.0.0 [David Zuelke] - -### CHG - -- Composer/1.1.1 [David Zuelke] - -## v102 (2016-04-29) - -### ADD - -- ext-newrelic/6.2.0 [David Zuelke] -- ext-blackfire/1.10.5 [David Zuelke] -- ext-apcu/4.0.11 [David Zuelke] -- ext-event/2.0.4 [David Zuelke] -- ext-imagick/3.4.2 [David Zuelke] -- ext-mongo/1.6.14 [David Zuelke] -- PHP/5.5.35 [David Zuelke] -- PHP/5.6.21 [David Zuelke] -- PHP/7.0.6 [David Zuelke] - -### CHG - -- Bundle `blackfire` CLI binary with ext-blackfire [David Zuelke] -- Build PHP with `php-cgi` executable [David Zuelke] -- Composer/1.0.3 [David Zuelke] - -## v101 (2016-04-12) - -### ADD - -- ext-event/2.0.2 [David Zuelke] -- ext-mongodb/1.1.6 [David Zuelke] -- Apache/2.4.20 [David Zuelke] -- ext-blackfire/1.10.3 [David Zuelke] - -### CHG - -- Use Composer/1.0.0 stable [David Zuelke] - -## v100 (2016-03-31) - -### ADD - -- ext-imap for all PHP versions [David Zuelke] -- ext-pq/1.0.0 and 2.0.0 [David Zuelke] -- PHP/7.0.5 [David Zuelke] -- PHP/5.6.20 [David Zuelke] -- PHP/5.5.34 [David Zuelke] - -### CHG - -- Return to using built-in default value for the `pcre.jit` PHP INI setting [David Zuelke] -- Use Composer/1.0.0beta2 [David Zuelke] -- Use first configured platform repository to load components for bootstrapping [David Zuelke] - -## v99 (2016-03-23) - -### FIX - -- Automatic extensions (blackfire, newrelic) may fail to get installed with many dependencies [David Zuelke] - -## v98 (2016-03-21) - -### ADD - -- ext-event/2.0.1 [David Zuelke] -- ext-mongo/1.6.13 [David Zuelke] -- ext-mongodb/1.1.5 [David Zuelke] -- ext-oauth/2.0.1 [David Zuelke] -- ext-newrelic/6.1.0.157 [David Zuelke] -- ext-blackfire/1.10.0 [David Zuelke] - -### CHG - -- Remove GitHub API rate limit checks during build time [David Zuelke] -- Change pcre.jit to 0 in php.ini [David Zuelke] - -## v97 (2016-03-10) - -### CHG - -- Temporarily downgrade to ext-newrelic/5.1.1.130 [David Zuelke] - -## v96 (2016-03-10) - -### ADD - -- ext-imagick/3.4.1 for all PHP versions, with platform imagemagick [David Zuelke] -- ext-mongodb/1.1.3 [David Zuelke] -- ext-ldap, with SASL, for PHP builds (#131) [David Zuelke] -- ext-gmp for PHP builds (#117) [David Zuelke] -- ext-event/2.0.0 [David Zuelke] -- apcu_bc for ext-apcu on PHP 7 (#137) [David Zuelke] -- ext-newrelic/6.0.1.156 (#153) [David Zuelke] - -### CHG - -- Use Composer/1.0.0beta1 [David Zuelke] -- Remove vendored ICU library and use platform ICU52 for PHP [David Zuelke] -- Remove vendored zlib and use platform version for PHP and Apache [David Zuelke] -- Remove vendored pcre library and use platform version for Apache [David Zuelke] -- Use platform pcre and zlib for Nginx [David Zuelke] -- Update vendored gettext to 0.19.7 and build only its runtime parts [David Zuelke] -- Use platform libsasl for libmemcached [David Zuelke] -- Strip platform packages on build install [David Zuelke] -- Ignore platform package replace/provide/conflict from root `composer.json` on platform package install [David Zuelke] - -### FIX - -- Platform installer is incompatible with PHP 5.5 [David Zuelke] - -## v95 (2016-03-03) - -### ADD - -- PHP/5.5.33 [David Zuelke] -- PHP/5.6.19 [David Zuelke] -- PHP/7.0.4 [David Zuelke] -- ext-blackfire/1.9.2 [David Zuelke] -- Nginx/1.8.1 [David Zuelke] -- Apache/2.4.18 [David Zuelke] - -## v94 (2016-02-26) - -### FIX - -- No web servers get selected when a `composer.lock` is missing [David Zuelke] - -## v93 (2016-02-26) - -### ADD - -- Support custom platform repositories via space separated `HEROKU_PHP_PLATFORM_REPOSITORIES` env var; leading "-" entry disables default repository [David Zuelke] - -### CHG - -- A `composer.phar` in the project root will no longer be aliased to `composer` on dyno startup [David Zuelke] -- Runtimes, extensions and web servers are now installed as fully self-contained Composer packages [David Zuelke] -- Perform boot script startup checks without loading unnecessary PHP configs or extensions [David Zuelke] -- ext-blackfire builds are now explicitly versioned (currently v1.9.1) [David Zuelke] -- Append `composer config bin-dir` to `$PATH` for runtime [David Zuelke] -- Check for lock file freshness using `composer validate` (#141) [David Zuelke] -- Change PHP `expose_php` to `off`, Apache `ServerTokens` to `Prod` and Nginx `server_tokens` to `off` for builds (#91, #92) [David Zuelke] -- Respect "provide", "replace" and "conflict" platform packages in dependencies and composer.json for platform package installs [David Zuelke] - -### FIX - -- Internal `php-min` symlink ends up in root of built apps [David Zuelke] -- Manifest for ext-apcu/4.0.10 does not declare ext-apc replacement [David Zuelke] -- Boot scripts exit with status 0 when given invalid flag as argument [David Zuelke] -- Manifest for ext-memcached/2.2.0 declares wrong PHP requirement for PHP 5.6 build [David Zuelke] -- Setting `NEW_RELIC_CONFIG_FILE` breaks HHVM builds (#149) [David Zuelke] - -## v92 (2016-02-09) - -### ADD - -- ext-apcu/5.1.3 [David Zuelke] -- PHP/5.5.32 [David Zuelke] -- PHP/5.6.18 [David Zuelke] -- PHP/7.0.3 [David Zuelke] -- ext-phalcon/2.0.10 [David Zuelke] -- ext-blackfire for PHP 7 [David Zuelke] - -### CHG - -- Refactor and improve build manifest helpers, add bucket sync tooling [David Zuelke] -- Use Bob 0.0.7 for builds [David Zuelke] - -### FIX - -- PHP 7 extension formulae use wrong API version in folder name [David Zuelke] -- Composer build formula depends on removed PHP formula [Stefan Siegl] - -## v91 (2016-01-08) - -### ADD - -- ext-phalcon/2.0.9 [David Zuelke] -- PHP/7.0.2 [David Zuelke] -- PHP/5.6.17 [David Zuelke] -- PHP/5.5.31 [David Zuelke] -- ext-apcu/5.1.2 [David Zuelke] -- ext-mongodb/1.1.2 [David Zuelke] -- ext-oauth/2.0.0 [David Zuelke] - -## v90 (2015-12-18) - -### ADD - -- PHP/7.0.1 [David Zuelke] - -### CHG - -- Double default INI setting values for `opcache.memory_consumption`, `opcache.interned_strings_buffer` and `opcache.max_accelerated_files` [David Zuelke] - -## v89 (2015-12-15) - -### FIX - -- HHVM builds failing when trying to install New Relic or Blackfire [David Zuelke] - -## v88 (2015-12-15) - -### CHG - -- Big loud warnings if `composer.lock` is outdated (or even broken) [David Zuelke] -- Auto-install `ext-blackfire` and `ext-newrelic` at the very end of the build to avoid them instrumenting build steps or cluttering output with startup messages [David Zuelke] - -### FIX - -- Buildpack does not export PATH for multi-buildpack usage [David Zuelke] -- Composer limitation leads to lower than possible PHP versions getting resolved [David Zuelke] -- `lib-` platform package requirements may prevent dependency resolution [David Zuelke] -- Invalid/broken `composer.lock` produces confusing error message [David Zuelke] - -## v87 (2015-12-11) - -### CHG - -- Further improve error information on failed system package install [David Zuelke] -- Notice if implicit version selection based on dependencies' requirements is made [David Zuelke] - -### FIX - -- "`|`" operators in `composer.lock` platform package requirements break system package dependency resolution [David Zuelke] -- Notice about missing runtime version selector does not show up in all cases [David Zuelke] - -## v86 (2015-12-10) - -### ADD - -- PHP/7.0.0 [David Zuelke] -- PHP/5.6.16 [David Zuelke] -- ext-apcu/4.0.10 [David Zuelke] -- ext-mongo/1.6.12 [David Zuelke] -- ext-imagick/3.3.0 [David Zuelke] -- ext-blackfire/1.7.0 [David Zuelke] - -### CHG - -- Rewrite most of the build process; system packages are now installed using a custom Composer installer and Composer repository [David Zuelke] - -## v83 (2015-11-16) - -### ADD - -- Composer/1.0.0-alpha11 [David Zuelke] -- PHP/7.0.0RC7 [David Zuelke] - -### CHG - -- Improve Composer vendor and bin dir detection in build sources [David Zuelke] -- Deprecate concurrent installs of HHVM and PHP [David Zuelke] -- Start New Relic daemon manually on Dyno boot to ensure correct behavior with non web PHP programs [David Zuelke] - -### FIX - -- Wrong Apache dist URL in support/build [David Zuelke] -- Build failure if `heroku-*-*` boot scripts are committed to Git in Composer bin dir [David Zuelke] -- Broken signal handling in boot scripts on Linux [David Zuelke] - -## v82 (2015-10-31) - -### CHG - -- Downgrade Apache 2.4.17 to Apache 2.4.16 due to `REDIRECT_URL` regression [David Zuelke] - -## v81 (2015-10-30) - -### ADD - -- PHP/7.0.0RC6 [David Zuelke] -- PHP/5.6.15 [David Zuelke] - -## v80 (2015-10-15) - -### ADD - -- Nginx/1.8.0 [David Zuelke] -- Apache/2.4.17 [David Zuelke] -- PHP/7.0.0RC5 [David Zuelke] - -### CHG - -- Use system default php.ini config instead of buildpacks' if no custom config given [David Zuelke] - -## v79 (2015-10-08) - -### CHG - -- Enable Apache modules `ssl_module` and `mod_proxy_html` (with `mod_xml2enc` dependency) by default [David Zuelke] - -## v78 (2015-10-01) - -### ADD - -- PHP/7.0.0RC4 [David Zuelke] -- PHP/5.5.30 [David Zuelke] -- PHP/5.6.14 [David Zuelke] - -## v77 (2015-09-17) - -### ADD - -- PHP/7.0.0RC3 [David Zuelke] - -## v76 (2015-09-08) - -### ADD - -- ext-mongo/1.6.11 [David Zuelke] -- PHP/7.0.0RC2 [David Zuelke] -- PHP/5.5.29 [David Zuelke] -- PHP/5.6.13 [David Zuelke] - -## v75 (2015-08-21) - -### FIX - -- Prevent potential (benign) Python notice during builds - -## v74 (2015-08-21) - -### FIX - -- Warning about missing composer.lock is thrown incorrectly for some composer.json files - -## v72 (2015-08-21) - -### ADD - -- PHP/5.6.12 [David Zuelke] -- PHP/5.5.28 [David Zuelke] -- ext-newrelic/4.23.4.113 [David Zuelke] -- PHP/7.0.0RC1 [David Zuelke] -- Support custom `composer.json`/`composer.lock` file names via `$COMPOSER` env var [David Zuelke] - -### CHG - -- A composer.lock is now required if there is any entry in the "require" section of composer.json [David Zuelke] - -## v71 (2015-07-14) - -### ADD - -- ext-newrelic/4.23.1.107 [David Zuelke] - -### FIX - -- Apache `mod_proxy_fgci`'s "disablereuse=off" config flag causes intermittent blank pages with HTTPD 2.4.11+ [David Zuelke] -- Applications on cedar-10 can select non-existing PHP 7.0.0beta1 package via composer.json [David Zuelke] - -## v70 (2015-07-10) - -### ADD - -- PHP/7.0.0beta1 [David Zuelke] -- PHP/5.6.11 [David Zuelke] -- PHP/5.5.27 [David Zuelke] -- ext-newrelic/4.23.0.102 [David Zuelke] -- ext-mongo/1.6.10 [David Zuelke] -- Support auto-tuning for IX dyno type [David Zuelke] - -### CHG - -- Warn about missing extensions for "blackfire" and "newrelic" add-ons during startup [David Zuelke] - -## v69 (2015-06-12) - -### ADD - -- PHP/5.5.26 [David Zuelke] -- PHP/5.6.10 [David Zuelke] -- ext-newrelic/4.22.0.99 [David Zuelke] -- ext-mongo/1.6.9 [David Zuelke] - -## v68 (2015-05-18) - -### ADD - -- PHP/5.6.9 [David Zuelke] -- PHP/5.5.25 [David Zuelke] -- ext-newrelic/4.21.0.97 [David Zuelke] -- ext-mongo/1.6.8 [David Zuelke] - -### CHG - -- Use Composer/1.0.0alpha10 [David Zuelke] -- Link only `.heroku/php/` subfolder and not all of `.heroku/` during compile to prevent potential collisions in multi BP scenarios [David Zuelke] - -### FIX - -- Typo in log messages [Christophe Coevoet] -- Newrelic 4.21 agent startup complaining about missing pidfile location config [David Zuelke] - -## v67 (2015-03-24) - -### ADD - -- ext-mongo/1.6.6 [David Zuelke] -- PHP/5.6.7 [David Zuelke] -- PHP/5.5.23 [David Zuelke] - -### CHG - -- Don't run composer install for empty composer.json [David Zuelke] -- Unset GIT_DIR at beginning of compile [David Zuelke] - -## v66 (2015-03-05) - -### ADD - -- ext-newrelic/4.19.0.90 [David Zuelke] - -## v65 (2015-03-03) - -### ADD - -- ext-redis/2.2.7 [David Zuelke] -- ext-mongo/1.6.4 [David Zuelke] -- HHVM/3.3.4 [David Zuelke] - -### CHG - -- Composer uses stderr now for most output, indent that accordingly [David Zuelke] - -## v64 (2015-02-19) - -### ADD - -- HHVM/3.5.1 [David Zuelke] -- PHP/5.6.6 [David Zuelke] -- PHP/5.5.22 [David Zuelke] -- ext-newrelic/4.18.0.89 [David Zuelke] -- ext-mongo/1.6.3 [David Zuelke] - -## v63 (2015-02-11) - -### ADD - -- ext-mongo/1.6.2 [David Zuelke] - -### CHG - -- Tweak auto-tuning messages (tag: v63) [David Zuelke] -- Move 'booting...' message to after startup has finished [David Zuelke] -- Ignore SIGINT when running under foreman etc to ensure clean shutdown [David Zuelke] -- Prevent redundant messages when loading HHVM configs [David Zuelke] -- Echo "running workers..." message to stderr on boot [David Zuelke] - -### FIX - -- Incorrect 'child 123 said into stderr' removal for lines that are deemed to long by FPM and cut off using a terminating '...' sequence instead of closing double quotes [David Zuelke] - -## v62 (2015-02-04) - -### FIX - -- Broken PHP memlimit check [David Zuelke] - -## v61 (2015-02-04) - -### CHG - -- Port autotuning to HHVM-Nginx [David Zuelke] - -### FIX - -- Workaround for Composer's complaining about outdated version warnings on stdout instead of stderr, breaking calls in a few places under certain circumstances [David Zuelke] - -## v60 (2015-02-04) - -### ADD - -- Auto-tune number of workers based on dyno size and configured memory limit [David Zuelke] - -## v59 (2015-01-29) - -### ADD - -- ext-mongo/1.6.0 (tag: v59) [David Zuelke] - -### CHG - -- Improvements to INI handling for HHVM, including new `-I` switch to allow passing additional INI files at boot [David Zuelke] -- Massively improved subprocess and signal handling in boot scripts [David Zuelke] - -## v58 (2015-01-26) - -### ADD - -- HHVM/3.5.0 [David Zuelke] -- PHP/5.6.5 [David Zuelke] -- PHP/5.5.21 [David Zuelke] - -## v57 (2015-01-19) - -### CHG - -- Update to Composer dev version for `^` selector support [David Zuelke] - -## v56 (2015-01-13) - -### ADD - -- ext/oauth 1.2.3 [David Zuelke] -- HHVM/3.3.3 [David Zuelke] -- Run 'composer compile' for custom scripts at the end of deploy [David Zuelke] - -## v55 (2015-01-07) - -### FIX - -- Standard logs have the wrong $PORT in the file name if the -p option is used in boot scripts [David Zuelke] - -## v54 (2015-01-05) - -### ADD - -- ext-newrelic/4.17.0.83 [David Zuelke] - -### CHG - -- Auto-set and follow (but not enable, for now) the FPM slowlog [David Zuelke] diff --git a/vendor/heroku/heroku-buildpack-php/README.md b/vendor/heroku/heroku-buildpack-php/README.md deleted file mode 100644 index 5ebd7f6..0000000 --- a/vendor/heroku/heroku-buildpack-php/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Heroku buildpack: PHP [![Build Status](https://travis-ci.org/heroku/heroku-buildpack-php.svg?branch=master)](https://travis-ci.org/heroku/heroku-buildpack-php) - -![php](https://cloud.githubusercontent.com/assets/51578/8882982/73ea501a-3219-11e5-8f87-311e6b8a86fc.jpg) - - -This is the official [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for PHP applications. - -It uses Composer for dependency management, supports PHP or HHVM (experimental) as runtimes, and offers a choice of Apache2 or Nginx web servers. - -## Usage - -You'll need to use at least an empty `composer.json` in your application. - - $ echo '{}' > composer.json - $ git add composer.json - $ git commit -m "add composer.json for PHP app detection" - -If you also have files from other frameworks or languages that could trigger another buildpack to detect your application as one of its own, e.g. a `package.json` which might cause your code to be detected as a Node.js application even if it is a PHP application, then you need to manually set your application to use this buildpack: - - $ heroku buildpacks:set heroku/php - -This will use the officially published version. To use the `master` branch from GitHub instead: - - $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php - -Please refer to [Dev Center](https://devcenter.heroku.com/categories/php) for further usage instructions. - -## Custom Platform Repositories - -The buildpack uses Composer repositories to resolve platform (`php`, `hhvm`, `ext-something`, ...) dependencies. - -To use a custom Composer repository with additional or different platform packages, add the URL to its `packages.json` to the `HEROKU_PHP_PLATFORM_REPOSITORIES` config var: - - $ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://mybucket.s3.amazonaws.com/cedar-14/packages.json" - -To allow the use of multiple custom repositories, the config var may hold a list of multiple repository URLs, separated by a space character, in ascending order of precedence. - -If the first entry in the list is "`-`" instead of a URL, the default platform repository is disabled entirely. This can be useful when testing development repositories, or to forcefully prevent the use of unwanted packages from the default platform repository. - -For instructions on how to build custom platform packages (and a repository to hold them), please refer to the instructions [further below](#custom-platform-packages-and-repositories). - -**Please note that Heroku cannot provide support for issues related to custom platform repositories and packages.** - -## Development - -The following information only applies if you're forking and hacking on this buildpack for your own purposes. - -### Pull Requests - -Please submit all pull requests against `develop` as the base branch. - -### Custom Platform Packages and Repositories - -Please refer to the [README in `support/build/`](support/build/README.md) for instructions. - diff --git a/vendor/heroku/heroku-buildpack-php/bin/compile b/vendor/heroku/heroku-buildpack-php/bin/compile deleted file mode 100755 index 5a40dc7..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/compile +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/env bash - -# bin/compile - -# fail hard -set -o pipefail -# fail harder -set -eu -# move hidden files too, just in case -shopt -s dotglob - -STACK=${STACK:-cedar-14} # Anvil has none -build_dir=$1 -cache_dir=$2/php -mkdir -p "$cache_dir" -env_dir=${3:-} # Anvil has none -bp_dir=$(cd $(dirname $0); cd ..; pwd) - -# convenience functions -source $bp_dir/bin/util/common.sh - -# for extensions that need special treatment -source $bp_dir/bin/util/newrelic.sh -source $bp_dir/bin/util/blackfire.sh - -# if this is set it prevents Git clones (e.g. for Composer installs from source) during the build in some circumstances, and it is set in SSH Git deploys to Heroku -unset GIT_DIR - -cd $build_dir - -export_env_dir "$env_dir" '^COMPOSER$' -if [[ -n ${COMPOSER:-} ]]; then - status "Using '$COMPOSER' (from "'$COMPOSER env var) for installation.' -else - export COMPOSER="composer.json" -fi -export COMPOSER_LOCK=$(basename "$COMPOSER" ".json")".lock" # replace .json with .lock if it exists, append .lock otherwise - -# a bunch of sanity checks first -if [[ -s "$COMPOSER" ]]; then - cat "$COMPOSER" | python -mjson.tool &> /dev/null || error "Could not parse '$COMPOSER'; make sure it's valid!" - if [[ ! -f "$COMPOSER_LOCK" ]]; then - cat "$COMPOSER" | python -c 'import sys, json; sys.exit(bool(json.load(sys.stdin).get("require", {})))' 2> /dev/null || error "Your '$COMPOSER' lists dependencies inside 'require', -but no '$COMPOSER_LOCK' was found. Please run 'composer update' to -re-generate '$COMPOSER_LOCK' if necessary, and commit it into your -repository. For more information, please refer to the docs at -https://devcenter.heroku.com/articles/php-support#activation" - else - cat "$COMPOSER_LOCK" | python -mjson.tool &> /dev/null || error "Could not parse '$COMPOSER_LOCK'; make sure it's valid!" - cat "$COMPOSER_LOCK" | python -c 'import sys, json; l = json.load(sys.stdin); sys.exit(not(l["minimum-stability"] == "stable"));' 2> /dev/null || warning "Your '$COMPOSER' contains a non-'stable' setting -for 'minimum-stability'. This may cause the installation of -unstable versions of runtimes and extensions during this deploy. -It is recommended that you always use stability flags instead, -even if you have 'prefer-stable' enabled. For more information, -see https://getcomposer.org/doc/01-basic-usage.md#stability" - fi -else - if [[ ! -f "$COMPOSER" ]]; then - warning "No '$COMPOSER' found. -Using 'index.php' to declare app type as PHP is considered legacy -functionality and may lead to unexpected behavior." - else - notice "Your '$COMPOSER' is completely empty. -Please change its contents to at least '{}' so it is valid JSON." - fi - echo "{}" > $COMPOSER -fi - -# PHP expects to be installed in /app/.heroku/php because of compiled paths, let's set that up! -mkdir -p /app/.heroku -# all system packages live in there -mkdir -p $build_dir/.heroku/php -# set up Composer -export COMPOSER_HOME=$cache_dir/.composer -mkdir -p $COMPOSER_HOME - -# if the build dir is not "/app", we symlink in the .heroku/php subdir (and only that, to avoid problems with other buildpacks) so that PHP correctly finds its INI files etc -[[ $build_dir == '/app' ]] || ln -s $build_dir/.heroku/php /app/.heroku/php - -status "Bootstrapping..." - -s3_url="https://lang-php.s3.amazonaws.com/dist-${STACK}-stable/" -# prepend the default repo to the list configured by the user -# list of repositories to use is in ascening order of precedence -export_env_dir "$env_dir" '^HEROKU_PHP_PLATFORM_REPOSITORIES$' -HEROKU_PHP_PLATFORM_REPOSITORIES="${s3_url} ${HEROKU_PHP_PLATFORM_REPOSITORIES:-}" -if [[ "${HEROKU_PHP_PLATFORM_REPOSITORIES}" == *" - "* ]]; then - # a single "-" in the user supplied string removes everything to the left of it; can be used to delete the default repo - notice_inline "Default platform repository disabled." - HEROKU_PHP_PLATFORM_REPOSITORIES=${HEROKU_PHP_PLATFORM_REPOSITORIES#*" - "} - s3_url=$(echo "$HEROKU_PHP_PLATFORM_REPOSITORIES" | cut -f1 -d" " | sed 's/[^/]*$//') - notice_inline "Bootstrapping using ${s3_url}..." -fi - - -# minimal PHP needed for installs, and make "composer" invocations use that for now -mkdir -p $build_dir/.heroku/php-min -ln -s $build_dir/.heroku/php-min /app/.heroku/php-min - -curl_retry_on_18 --fail --silent --location -o $build_dir/.heroku/php-min.tar.gz "${s3_url}php-min-7.0.25.tar.gz" || error "Failed to download minimal PHP for bootstrapping. -Please try again, or contact support if this problem persists." -tar xzf $build_dir/.heroku/php-min.tar.gz -C $build_dir/.heroku/php-min -rm $build_dir/.heroku/php-min.tar.gz - -curl_retry_on_18 --fail --silent --location -o $build_dir/.heroku/composer.tar.gz "${s3_url}composer-1.5.2.tar.gz" || error "Failed to download Composer. Please try again, or contact support if this problem persists." -tar xzf $build_dir/.heroku/composer.tar.gz -C $build_dir/.heroku/php -rm $build_dir/.heroku/composer.tar.gz - -# this alias is just for now while we install platform packages -composer() { - /app/.heroku/php-min/bin/php /app/.heroku/php/bin/composer "$@" -} -export -f composer - -composer_vendordir=$(composer config vendor-dir) -composer_bindir=$(composer config bin-dir) - -# packages that get installed will add to this file, it's both for us and for buildpacks that follow -# composer bin-dir goes last to avoid any conflicts -echo "export PATH=/app/.heroku/php/bin:\$PATH:/app/$composer_bindir" > $bp_dir/export -# make sure Composer and binaries for it are on the path at runtime -# composer bin-dir goes last to avoid any conflicts -mkdir -p $build_dir/.profile.d -echo "export PATH=\$HOME/.heroku/php/bin:\$PATH:\$HOME/$composer_bindir" > $build_dir/.profile.d/100-composer.sh - -status "Installing platform packages..." - -# extract requirements from composer.lock -/app/.heroku/php-min/bin/php $bp_dir/bin/util/platform.php "$bp_dir/support/installer/" $HEROKU_PHP_PLATFORM_REPOSITORIES 2>&1 >$build_dir/.heroku/php/composer.json | indent || error "Couldn't load '$COMPOSER_LOCK'; it must be a valid lock -file generated by Composer and be in a consistent state. -Check above for any parse errors and address them if necessary. -Run 'composer update', add/commit the change, then push again." - -# reset COMPOSER for the platform install step -COMPOSER_bak="$COMPOSER" -export COMPOSER=composer.json - -# pass export_file_path and profile_dir_path to composer install; they will be used by the installer plugin -# they are also used in later install attempts for add-on extensions (blackfire, newrelic, ...) -export export_file_path=$bp_dir/export -export profile_dir_path=$build_dir/.profile.d -if composer install -d "$build_dir/.heroku/php" ${HEROKU_PHP_INSTALL_DEV-"--no-dev"} 2>&1 | tee $build_dir/.heroku/php/install.log | grep --line-buffered -E '^ - (Instal|Enab)ling heroku-sys/' | sed -u -E -e 's/^ - (Instal|Enab)ling /- /' -e 's/heroku-sys\///g' | indent; then - : -else - error "Failed to install system packages. - -Your platform requirements (for runtimes and extensions) could -not be resolved to an installable set of dependencies, or a -repository was unreachable. - -Full error information from installation attempt: - -$(cat $build_dir/.heroku/php/install.log | sed -e 's/heroku-sys\///g' -e 's/^Loading composer repositories with package information/Loading repositories with available runtimes and extensions/' -e 's/^Installing dependencies.*//' -e '/^Potential causes:/,$d' -e 's/^/> /') - -Please verify that all requirements for runtime versions in -'$COMPOSER_LOCK' are compatible with the list below, and ensure -all required extensions are available for the desired runtimes. - -For reference, the following runtimes are currently available: - -PHP: $(composer show -d "$build_dir/.heroku/php" --available heroku-sys/php 2>&1 | sed -n 's/^versions : //p' | fold -s -w 58 || true) -HHVM: $(composer show -d "$build_dir/.heroku/php" --available heroku-sys/hhvm 2>&1 | sed -n 's/^versions : //p' | fold -s -w 58 || true) - -For a list of supported runtimes & extensions on Heroku, please -refer to: https://devcenter.heroku.com/articles/php-support" -fi - -if composer show -d "$build_dir/.heroku/php" --installed --quiet heroku-sys/php 2>/dev/null; then - engine="php" - engine_r="php -r" -elif composer show -d "$build_dir/.heroku/php" --installed --quiet heroku-sys/hhvm 2>/dev/null; then - engine="hhvm" - engine_r="hhvm --php -r" -fi - -# done with platform installs; restore COMPOSER from previous value -export COMPOSER="$COMPOSER_bak" -unset COMPOSER_bak - -composer validate --no-check-publish --no-check-all --quiet "$COMPOSER" 2>/dev/null || warning "Your '$COMPOSER_LOCK' is not up to date with the latest -changes in '$COMPOSER'. To ensure you are not getting stale -dependencies, run 'composer update' on your machine and commit -any changes to Git before pushing again." - -# clean up -rm -rf /app/.heroku/php-min $build_dir/.heroku/php-min -unset -f composer - -# earlier we wrote at least one $PATH entry that we'll need now, and installed packages will likely have added to it too -source $bp_dir/export - -composer() { - $engine $(which composer) "$@" -} -export -f composer - -status "Installing dependencies..." - -# check if we should use a composer.phar version bundled with the project -if [[ -f "composer.phar" ]]; then - [[ -x "composer.phar" ]] || error "File '/composer.phar' isn't executable; please 'chmod +x'!" - $engine_r 'new Phar("composer.phar");' &> /dev/null || error "File '/composer.phar' is not a valid PHAR archive!" - composer() { - $engine composer.phar "$@" - } - export -f composer - composer --version 2>&1 | grep "^Composer version" > /dev/null || error "File '/composer.phar' is not a Composer executable!" - notice_inline "Using '/composer.phar' to install dependencies." -fi -# echo composer version for info purposes -# tail to get rid of outdated version warnings (Composer sends those to STDOUT instead of STDERR) -composer --version 2> /dev/null | tail -n 1 | indent - -# throw a notice if people have added their vendor dir to Git; that's bad practice and makes everything slow and cluttered -if [[ -f "$composer_vendordir/autoload.php" && -d "$composer_vendordir/composer" ]]; then - # we should not do this check separately; there is no reliable way of telling whether or not it really is the real Composer bin dir or if it comes from somewhere else - composer_warn_bindir="" - if [[ ! "$composer_bindir/" == "$composer_vendordir"/* && -d "$composer_bindir" ]]; then - composer_warn_bindir=" -Your Composer bin dir is configured to reside outside of vendor -dir, so please repeat the two steps above for '$composer_bindir/'." - fi - warning "Your Composer vendor dir is part of your Git repository. -This directory should not be under version control; only your -'$COMPOSER' and '$COMPOSER_LOCK' files should be added, which -will let Composer handle installation of dependencies on deploy. -To suppress this notice, first remove the folder from your index -by running 'git rm -r --cached $composer_vendordir/'. -Next, edit your project's '.gitignore' file and add the folder -'/$composer_vendordir/' to the list.$composer_warn_bindir -For more info, refer to the Composer FAQ: http://bit.ly/1rlCSZU" -fi - -# handle custom oauth keys -export_env_dir "$env_dir" '^COMPOSER_GITHUB_OAUTH_TOKEN$' -COMPOSER_GITHUB_OAUTH_TOKEN=${COMPOSER_GITHUB_OAUTH_TOKEN:-} -if [[ -n "$COMPOSER_GITHUB_OAUTH_TOKEN" ]]; then - if curl --fail --silent -H "Authorization: token $COMPOSER_GITHUB_OAUTH_TOKEN" https://api.github.com/rate_limit > /dev/null; then - composer config -g github-oauth.github.com "$COMPOSER_GITHUB_OAUTH_TOKEN" &> /dev/null # redirect outdated version warnings (Composer sends those to STDOUT instead of STDERR) - notice_inline 'Using $COMPOSER_GITHUB_OAUTH_TOKEN for GitHub OAuth.' - else - error 'Invalid $COMPOSER_GITHUB_OAUTH_TOKEN for GitHub OAuth!' - fi -else - # don't forget to remove any stored key if it's gone from the env - composer config -g --unset github-oauth.github.com &> /dev/null # redirect outdated version warnings (Composer sends those to STDOUT instead of STDERR) -fi -# no need for the token to stay around in the env -unset COMPOSER_GITHUB_OAUTH_TOKEN - -# install dependencies unless composer.json is completely empty (in which case it'd talk to packagist.org which may be slow and is unnecessary) -export_env_dir "$env_dir" '^[A-Z_][A-Z0-9_]*$' '^(HOME|PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|LD_LIBRARY_PATH|STACK|REQUEST_ID|IFS|HEROKU_PHP_INSTALL_DEV)$' -cat "$COMPOSER" | python -c 'import sys,json; sys.exit(not json.load(sys.stdin));' && composer install ${HEROKU_PHP_INSTALL_DEV-"--no-dev"} --prefer-dist --optimize-autoloader --no-interaction 2>&1 | indent - -# only perform the check for buildpack package if we're not running in Heroku CI -if [[ -z "${HEROKU_PHP_INSTALL_DEV+are-we-running-in-ci}" ]]; then - composer show --installed heroku/heroku-buildpack-php &> /dev/null && error "Your '$COMPOSER' requires 'heroku/heroku-buildpack-php'. -This package may only be used as a dependency in 'require-dev'!" -fi - -if cat "$COMPOSER" | python -c 'import sys,json; sys.exit("compile" not in json.load(sys.stdin).get("scripts", {}));'; then - status "Running 'composer compile'..." - composer run-script ${HEROKU_PHP_INSTALL_DEV-"--no-dev"} --no-interaction compile 2>&1 | indent -fi - -status "Preparing runtime environment..." - -# install this buildpack like a composer package -# it will contain the apache/nginx/php configs and the boot script -# TODO: warn if require-dev has the package using a different branch -shopt -u dotglob # we don't want .git, .gitignore et al -# figure out the package dir name to write to and copy to it -hbpdir="$composer_vendordir/$(cat $bp_dir/composer.json | python -c 'import sys, json; print(json.load(sys.stdin)["name"])')" -mkdir -p "$build_dir/$hbpdir" -cp -r "$bp_dir"/* "$build_dir/$hbpdir/" -# make bin dir, just in case -mkdir -p "$build_dir/$composer_bindir" -# figure out shortest relative path from vendor/heroku/heroku-buildpack-php to vendor/bin (or whatever the bin dir is) -relbin=$(python -c "import os.path; print(os.path.relpath('$hbpdir', '$composer_bindir'))") -# collect bin names from composer.json -relbins=$(cat $bp_dir/composer.json | python -c 'from __future__ import print_function; import sys, json; { print(sys.argv[1]+"/"+bin) for bin in json.load(sys.stdin)["bin"] }' $relbin) -# link to bins -cd $build_dir/$composer_bindir -ln -fs $relbins . -cd $build_dir - -if [[ ! -f "Procfile" ]]; then - echo "web: heroku-$engine-apache2" > Procfile - notice_inline "No Procfile, using 'web: heroku-$engine-apache2'." -fi - -# write empty WEB_CONCURRENCY.sh to overwrite the defaults logic from a prior buildpack, e.g. Node (all buildpacks use the same filename to allow this) -> $build_dir/.profile.d/WEB_CONCURRENCY.sh - -# reset COMPOSER for the platform install step -COMPOSER_bak="$COMPOSER" -export COMPOSER=composer.json - -# unless we're running a CI build... -if [[ "${HEROKU_PHP_INSTALL_DEV+CI}" != "CI" ]]; then - status "Checking for additional extensions to install..." - # special treatment for Blackfire; we enable it if we detect a server id and a server token for it - install_blackfire_ext - # special treatment for New Relic; we enable it if we detect a license key for it - install_newrelic_ext - install_newrelic_userini -fi - -# done with platform installs; restore COMPOSER from previous value -export COMPOSER="$COMPOSER_bak" -unset COMPOSER_bak diff --git a/vendor/heroku/heroku-buildpack-php/bin/detect b/vendor/heroku/heroku-buildpack-php/bin/detect deleted file mode 100755 index 8cecf66..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/detect +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -if [[ -f "$1/composer.json" || -f "$1/index.php" ]]; then - echo "PHP" && exit 0 -else - exit 1 -fi - diff --git a/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-apache2 b/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-apache2 deleted file mode 100755 index e8dae1e..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-apache2 +++ /dev/null @@ -1,373 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu -# for ${DOCUMENT_ROOT%%*(/)} pattern further down -shopt -s extglob -# for detecting when -l 'logs/*.log' matches nothing -shopt -s nullglob - -verbose= - -php_passthrough() { - local dir=$(dirname "$1") - local file=$(basename "$1") - local out=$(basename "$file" .php) - if [[ "$out" != "$file" ]]; then - [[ $verbose ]] && echo "Interpreting ${1#$HEROKU_APP_DIR/} to $out" >&2 - out="$dir/$out" - hhvm "$1" > "$out" - echo "$out" - else - echo "$1" - fi -} - -check_exists() { - if [[ ! -f "$HEROKU_APP_DIR/$1" ]]; then - echo "Cannot read -$2 '$1' (relative to '$HEROKU_APP_DIR')" >&2 - exit 1 - else - echo "$HEROKU_APP_DIR/$1" - fi -} - -touch_log() { - mkdir -p $(dirname "$1") && touch "$1" -} - -print_help() { -echo "\ -${1:-Boots HHVM together with Apache2 on Heroku and for local development.} - -Usage: - heroku-hhvm-apache2 [options] [] - -Options: - -C The path to the configuration file to include inside - the Apache2 VHost config (see option -c below). Will - be included inside the '' section just - after the '' & 'ProxyPassMatch' directives. - Recommended approach when customizing Apache2's config - in most cases, unless you need to set fundamental - server level options. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/default_include.conf] - -c The path to the full VHost configuration file that is - included after Heroku's (or your local) Apache2 config - is loaded. Must contain a 'Listen \${PORT}' directive - and should have a '' and likely also a - '' section (see option -C above). - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/heroku.conf] - -h, --help Display this help screen and exit. - -I The path to an extra php.ini to use in addition to the - default HHVM php.ini (see option -i below). - -i The path to the php.ini file to use. It is highly - recommended to use the -I option (see above) instead. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php] - -l Path to additional log file to tail to STDERR so its - contents appear in 'heroku logs'. If the file does not - exist, it will be created. Wildcards are allowed, but - must be quoted and must match already existing files. - Note: this option can be repeated multiple times. - -p Port to listen on for HTTP traffic. If this argument - is not given, then the port number to use is read from - the \$PORT environment variable, or a random port is - chosen if that variable does not exist. - -v, --verbose Be more verbose during startup. - -All file paths must be relative to '$HEROKU_APP_DIR'. - -Any file name that ends in '.php' will be run through the PHP interpreter first. -You may use this for templating although this is less useful than e.g. for Nginx -where unlike in Apache2, you cannot reference environment variables in config -files using a '\${VARNAME}' syntax. - -If you would like to use the -C and -c options together, make sure you retain -the appropriate include mechanisms (see default configs for details). -" >&2 -} - -# we need this in configs -export HEROKU_APP_DIR=$(pwd) -export DOCUMENT_ROOT="$HEROKU_APP_DIR" -# set a default port if none is given -export PORT=${PORT:-$(( $RANDOM+1024 ))} - -# init logs array here as empty before parsing options; -l could append to it, but the default list gets added later since we use $PORT in there and that can be set using -p -declare -a logs - -optstring=":-:C:c:I:i:l:p:vh" - -# process flags first -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - verbose) - verbose=1 - ;; - help) - print_help 2>&1 - exit 2 - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit - ;; - esac - ;; - v) - verbose=1 - ;; - h) - print_help 2>&1 - exit - ;; - esac -done - -OPTIND=1 # start over with options parsing -while getopts "$optstring" opt; do - case $opt in - C) - httpd_config_include=$(check_exists "$OPTARG" "C") - ;; - c) - httpd_config=$(check_exists "$OPTARG" "c") - ;; - I) - hhvm_config_extra=$(check_exists "$OPTARG" "I") - ;; - i) - php_config=$(check_exists "$OPTARG" "i") - ;; - l) - logarg=( $OPTARG ) # must not quote this or wildcards won't get expanded into individual values - if [[ ${#logarg[@]} -eq 0 ]]; then # we set nullglob to detect if a pattern matched nothing (then the array is empty) - echo "Pattern '$OPTARG' passed to option -l matched no files" >&2 - exit 1 - fi - for logfile in "${logarg[@]}"; do - if [[ -d "$logfile" ]]; then - echo "-l '$logfile': is a directory" >&2 - exit 1 - fi - touch_log "$logfile" || { echo "Could not touch '$logfile'; permissions problem?" >&2; exit 1; } - [[ $verbose ]] && echo "Tailing '$logfile' to stderr" >&2 - logs+=("$logfile") # must quote here in case a wildcard matched a file with a space in the name - done - ;; - p) - PORT="$OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 2 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 2 - ;; - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ "$#" -gt "1" ]]; then - print_help "$0: too many arguments. If you're using options, -make sure to list them before any document root argument you're providing." - exit 2 -fi - -# our standard logs -logs+=( "/tmp/heroku.apache2_error.$PORT.log" "/tmp/heroku.apache2_access.$PORT.log" ) - -hhvm --php -r 'exit((int)version_compare(HHVM_VERSION, "3.0.1", "<"));' || { echo "This program requires HHVM 3.0.1 or newer" >&2; exit 1; } -{ { httpd -v | hhvm --php -r 'exit((int)version_compare(preg_replace("#^Server version: Apache/(\S+).+$#sm", "\\1", file_get_contents("php://stdin")), "2.4.10", "<"));'; } && { httpd -t -D DUMP_MODULES | grep 'proxy_fcgi_module' > /dev/null; }; } || { echo "This program requires Apache 2.4.10 or newer with mod_proxy and mod_proxy_fcgi enabled; check your 'httpd' command." >&2; exit 1; } - -# make sure we run a local composer.phar if present, or global composer if not -composer() { - local composer_bin=$(which ./composer.phar composer | head -n1) - # check if we the composer binary is executable by PHP - if file --brief --dereference $composer_bin | grep -e "shell" -e "bash" > /dev/null ; then # newer versions of file return "data" for .phar - # run it directly; it's probably a bash script or similar (homebrew-php does this) - $composer_bin "$@" - else - hhvm $composer_bin "$@" - fi -} -COMPOSER_VENDOR_DIR=$(composer config vendor-dir 2> /dev/null | tail -n 1) && export COMPOSER_VENDOR_DIR || { echo "Unable to determine Composer vendor-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export -COMPOSER_BIN_DIR=$(composer config bin-dir 2> /dev/null | tail -n 1) && export COMPOSER_BIN_DIR || { echo "Unable to determine Composer bin-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export - -if [[ "$#" == "1" ]]; then - DOCUMENT_ROOT="$HEROKU_APP_DIR/$1" - if [[ ! -d "$DOCUMENT_ROOT" ]]; then - echo "DOCUMENT_ROOT '$1' does not exist" >&2 - exit 1 - else - # strip trailing slashes if present - DOCUMENT_ROOT=${DOCUMENT_ROOT%%*(/)} # powered by extglob - if [[ $verbose ]]; then - echo "DOCUMENT_ROOT changed to '$DOCUMENT_ROOT'" >&2 - else - echo "DOCUMENT_ROOT changed to '${1%%*(/)}/'" >&2 - fi - fi -fi - -function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support; if a value for $1 is passed then it won't echo messages upon second invocation -if [[ ( -n ${php_config:-} && ! ${1:-} ) || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose && ! ${1:-} ) ]]; then - echo "Using HHVM configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 -fi -php_configs=( "-c" "$(php_passthrough "$php_config")" ) - -if [[ -n ${hhvm_config_extra:-} ]]; then - [[ ${1:-} ]] || echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 - php_configs+=( "-c" "$(php_passthrough "$hhvm_config_extra")" ) -fi -} -prepare_hhvm_ini - -if [[ -n ${httpd_config_include:-} || ( ${httpd_config_include:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/default_include.conf"} && $verbose ) ]]; then - echo "Using Apache2 VirtualHost-level configuration include '${httpd_config_include#$HEROKU_APP_DIR/}'" >&2 -fi -httpd_config_include=$(php_passthrough "$httpd_config_include") -export HEROKU_PHP_HTTPD_CONFIG_INCLUDE="$httpd_config_include" - -if [[ -n ${httpd_config:-} || ( ${httpd_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/heroku.conf"} && $verbose) ]]; then - echo "Using Apache2 configuration file '${httpd_config#$HEROKU_APP_DIR/}'" >&2 -fi -httpd_config=$(php_passthrough "$httpd_config") - -if [[ -z ${WEB_CONCURRENCY:-} ]]; then - maxprocs=$(ulimit -u) - ram="512M" - if [[ -n ${DYNO:-} && "$maxprocs" == "32768" ]]; then - echo "Optimizing defaults for PX dyno...." >&2 - ram="6G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "16384" ]]; then - echo "Optimizing defaults for IX dyno...." >&2 - ram="2560M" - elif [[ -n ${DYNO:-} && "$maxprocs" == "512" ]]; then - echo "Optimizing defaults for 2X dyno..." >&2 - ram="1G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "256" ]]; then - echo "Optimizing defaults for 1X dyno..." >&2 - elif [[ -n ${DYNO:-} || $verbose ]]; then - echo "No dyno detected; using defaults for 1X..." >&2 - fi - - # determine number of HHVM threads to run - read WEB_CONCURRENCY php_memory_limit <<<$(hhvm "${php_configs[@]}" $(composer config vendor-dir 2> /dev/null | tail -n 1)/heroku/heroku-buildpack-php/bin/util/autotune.php "$ram") # tail, as composer echos outdated version warnings to STDOUT - [[ $WEB_CONCURRENCY -lt 1 ]] && WEB_CONCURRENCY=1 - export WEB_CONCURRENCY - - echo "${WEB_CONCURRENCY} threads at ${php_memory_limit}B memory limit." >&2 -else - echo "Using WEB_CONCURRENCY=${WEB_CONCURRENCY} threads." >&2 -fi - -# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated; we pass an argument to it to avoid it echoing "using HHVM config ..." messages again because that already happened -prepare_hhvm_ini no_messages - -# make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below -# this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter). -wait_pipe=$(mktemp -t "heroku.waitpipe-$PORT.XXXXXX" -u) -rm -f $wait_pipe -mkfifo $wait_pipe -exec 3<> $wait_pipe - -pids=() - -# trap SIGQUIT (ctrl+\ on the console), SIGTERM (when we get killed) and EXIT (upon failure of any command due to set -e, or because of the exit 1 at the very end), we then -# 1) restore the trap for the signal in question so it doesn't fire again due to the kill at the end of the trap, as well as for EXIT, because that would fire too -# 2) call cleanup() to -# 2a) remove our FIFO from above -# 2b) kill all the subshells we've spawned - they in turn have their own traps to kill their respective subprocesses, and because we use SIGUSR1, they know it's the parent's cleanup and can handle it differently from an external SIGKILL -# 2c) send STDERR to /dev/null so we don't see "no such process" errors - after all, one of the subshells may be gone -# 2d) || true so that set -e doesn't cause a mess if the kill returns 1 on "no such process" cases (which is likely on Heroku where all processes get killed and not just this top level one) -# 2e) do that in the background and 'wait' on those processes, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 3) kill ourselves with the correct signal in case we're handling SIGQUIT or SIGTERM (http://www.cons.org/cracauer/sigint.html and http://mywiki.wooledge.org/SignalTrap#Special_Note_On_SIGINT1) -cleanup() { echo "Going down, terminating child processes..." >&2; rm -f ${wait_pipe} || true; kill -USR1 "${pids[@]}" 2> /dev/null || true; } -trap 'trap - QUIT EXIT; cleanup; kill -QUIT $$' QUIT -trap 'trap - TERM EXIT; cleanup; kill -TERM $$' TERM -trap 'trap - EXIT; cleanup' EXIT -# if FD 1 is a TTY (that's the -t 1 check), trap SIGINT/Ctrl+C, then same procedure as for QUIT and TERM above -if [[ -t 1 ]]; then - trap 'trap - INT EXIT; cleanup; kill -INT $$' INT; -# if FD 1 is not a TTY (e.g. when we're run through 'foreman start'), do nothing on SIGINT; the assumption is that the parent will send us a SIGTERM or something when this happens. With the trap above, Ctrl+C-ing out of a 'foreman start' run would trigger the INT trap both in Foreman and here (because Ctrl+C sends SIGINT to the entire process group, but there is no way to tell the two cases apart), and while the trap is still doing its shutdown work triggered by the SIGTERM from the Ctrl+C, Foreman would then send a SIGTERM because that's what it does when it receives a SIGINT itself. -else - trap '' INT; -fi - -# we are now launching a subshell for each of the tasks (log tail, app server, web server) -# 1) each subshell has a trap on EXIT that echos the command name to FD 3 (see the FIFO set up above) -# 1a) a 'read' at the end of the script will block on reading from that FD and then trigger the exit trap further above, which does the cleanup -# 2) each subshell also has a trap on TERM that -# 2a) kills $! (the last process executed) -# 2b) ... which in turn will hit the EXIT trap and that unblocks the 'wait' in 5) which will cause the parent to clean up when the exit at the end of the script is hit -# 2c) the 'kill' is done in the background and we immediately 'wait' on $!, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 2d) finally, if $BASHPID exists, the subshell kills itself using the right signal for maximum compliance ($$ doesn't work in subshells, and $BASHPID is not available in Bash 3, but unlike with the parent, it's not that critical to have this) -# 3) each subshell has another trap on USR1 which gets sent when the parent is cleaning up; it works like 2a) but doesn't trigger the EXIT trap to avoid multiple cleanup runs by the parent -# 4) execute the command in the background -# 5) 'wait' on the command (wait is interrupted by an incoming TERM to the subshell, whereas running 4) in the foreground would wait for that process to finish before triggering the trap) -# 6) add the PID of the subshell to the array that the EXIT trap further above uses to clean everything up - -[[ $verbose ]] && echo "Starting log redirection..." >&2 -( - trap '' INT; - trap 'echo "tail" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - touch "${logs[@]}" - - tail -qF -n 0 "${logs[@]}" 1>&2 & pid=$! - - wait -) & pids+=($!) -disown $! - -echo "Starting hhvm..." >&2 -( - trap '' INT; - trap 'echo "hhvm" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - hhvm --mode server "${php_configs[@]}" & pid=$! - - wait -) & pids+=($!) -disown $! - -# wait a few seconds for HHVM to finish initializing; otherwise an early request might break Apache with the FastCGI pipe not being ready -sleep 2 - -echo "Starting httpd..." >&2 -( - trap '' INT; - trap 'echo "httpd" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - httpd -D NO_DETACH -c "Include $httpd_config" & pid=$! - - wait -) & pids+=($!) -disown $! - -# on Heroku, there is a "state changed from starting to up", but for local execution, we want a "ready" message -[[ -z ${DYNO:-} || $verbose ]] && echo "Application ready for connections on port $PORT." >&2 - -# wait for something to come from the FIFO attached to FD 3, which means that the given process was killed or has failed -# this will be interrupted by a SIGTERM or SIGINT in the traps further up -# if the pipe unblocks and this executes, then we won't read it again, so if the traps further up kill the remaining subshells above, their writing to FD 3 will have no effect -read exitproc <&3 -# we'll only reach this if one of the processes above has terminated -echo "Process exited unexpectedly: $exitproc" >&2 - -# this will trigger the EXIT trap further up and kill all remaining children -exit 1 diff --git a/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-nginx b/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-nginx deleted file mode 100755 index be9a4d3..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/heroku-hhvm-nginx +++ /dev/null @@ -1,373 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu -# for ${DOCUMENT_ROOT%%*(/)} pattern further down -shopt -s extglob -# for detecting when -l 'logs/*.log' matches nothing -shopt -s nullglob - -verbose= - -php_passthrough() { - local dir=$(dirname "$1") - local file=$(basename "$1") - local out=$(basename "$file" .php) - if [[ "$out" != "$file" ]]; then - [[ $verbose ]] && echo "Interpreting ${1#$HEROKU_APP_DIR/} to $out" >&2 - out="$dir/$out" - hhvm "$1" > "$out" - echo "$out" - else - echo "$1" - fi -} - -check_exists() { - if [[ ! -f "$HEROKU_APP_DIR/$1" ]]; then - echo "Cannot read -$2 '$1' (relative to '$HEROKU_APP_DIR')" >&2 - exit 1 - else - echo "$HEROKU_APP_DIR/$1" - fi -} - -touch_log() { - mkdir -p $(dirname "$1") && touch "$1" -} - -print_help() { -echo "\ -${1:-Boots HHVM together with Nginx on Heroku and for local development.} - -Usage: - heroku-hhvm-nginx [options] [] - -Options: - -C The path to the configuration file to include inside - the Nginx server config (see option -c below). Will - be included inside the 'server { ... }' block just - after the 'listen', 'root' etc directives. - Recommended approach when customizing Nginx's config - in most cases, unless you need to set http or - fundamental server level options. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php] - -c The path to the full configuration file that is - included after Heroku's (or your local) Nginx config - is loaded. It must contain an 'http { ... }' block - with a 'server { ... }' inside that contains 'listen' - and 'root' (see option -C above), but no global, - directives (globals are read from the system's default - Nginx configuration files). - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php] - -h, --help Display this help screen and exit. - -I The path to an extra php.ini to use in addition to the - default HHVM php.ini (see option -i below). - -i The path to the php.ini file to use. It is highly - recommended to use the -I option (see above) instead. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php] - -l Path to additional log file to tail to STDERR so its - contents appear in 'heroku logs'. If the file does not - exist, it will be created. Wildcards are allowed, but - must be quoted and must match already existing files. - Note: this option can be repeated multiple times. - -p Port to listen on for HTTP traffic. If this argument - is not given, then the port number to use is read from - the \$PORT environment variable, or a random port is - chosen if that variable does not exist. - -v, --verbose Be more verbose during startup. - -All file paths must be relative to '$HEROKU_APP_DIR'. - -Any file name that ends in '.php' will be run through the PHP interpreter first. -You may use this for templating; this is, for instance, necessary for Nginx, -where environment variables cannot be referenced in configuration files. - -If you would like to use the -C and -c options together, make sure you retain -the appropriate include mechanisms (see default configs for details). -" >&2 -} - -# we need this in configs -export HEROKU_APP_DIR=$(pwd) -export DOCUMENT_ROOT="$HEROKU_APP_DIR" -# set a default port if none is given -export PORT=${PORT:-$(( $RANDOM+1024 ))} - -# init logs array here as empty before parsing options; -l could append to it, but the default list gets added later since we use $PORT in there and that can be set using -p -declare -a logs - -optstring=":-:C:c:I:i:l:p:vh" - -# process flags first -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - verbose) - verbose=1 - ;; - help) - print_help 2>&1 - exit - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - ;; - v) - verbose=1 - ;; - h) - print_help 2>&1 - exit - ;; - esac -done - -OPTIND=1 # start over with options parsing -while getopts "$optstring" opt; do - case $opt in - C) - nginx_config_include=$(check_exists "$OPTARG" "C") - ;; - c) - nginx_config=$(check_exists "$OPTARG" "c") - ;; - I) - hhvm_config_extra=$(check_exists "$OPTARG" "I") - ;; - i) - php_config=$(check_exists "$OPTARG" "i") - ;; - l) - logarg=( $OPTARG ) # must not quote this or wildcards won't get expanded into individual values - if [[ ${#logarg[@]} -eq 0 ]]; then # we set nullglob to detect if a pattern matched nothing (then the array is empty) - echo "Pattern '$OPTARG' passed to option -l matched no files" >&2 - exit 1 - fi - for logfile in "${logarg[@]}"; do - if [[ -d "$logfile" ]]; then - echo "-l '$logfile': is a directory" >&2 - exit 1 - fi - touch_log "$logfile" || { echo "Could not touch '$logfile'; permissions problem?" >&2; exit 1; } - [[ $verbose ]] && echo "Tailing '$logfile' to stderr" >&2 - logs+=("$logfile") # must quote here in case a wildcard matched a file with a space in the name - done - ;; - p) - PORT="$OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 2 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 2 - ;; - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ "$#" -gt "1" ]]; then - print_help "$0: too many arguments. If you're using options, -make sure to list them before any document root argument you're providing." - exit 2 -fi - -# our standard logs -logs+=( "/tmp/heroku.nginx_access.$PORT.log" ) - -hhvm --php -r 'exit((int)version_compare(HHVM_VERSION, "3.0.1", "<"));' || { echo "This program requires HHVM 3.0.1 or newer" >&2; exit 1; } - -# make sure we run a local composer.phar if present, or global composer if not -composer() { - local composer_bin=$(which ./composer.phar composer | head -n1) - # check if we the composer binary is executable by HHVM - if file --brief --dereference $composer_bin | grep -e "shell" -e "bash" > /dev/null ; then # newer versions of file return "data" for .phar - # run it directly; it's probably a bash script or similar (homebrew-php does this) - $composer_bin "$@" - else - hhvm $composer_bin "$@" - fi -} -COMPOSER_VENDOR_DIR=$(composer config vendor-dir 2> /dev/null | tail -n 1) && export COMPOSER_VENDOR_DIR || { echo "Unable to determine Composer vendor-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export -COMPOSER_BIN_DIR=$(composer config bin-dir 2> /dev/null | tail -n 1) && export COMPOSER_BIN_DIR || { echo "Unable to determine Composer bin-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export - -if [[ "$#" == "1" ]]; then - DOCUMENT_ROOT="$HEROKU_APP_DIR/$1" - if [[ ! -d "$DOCUMENT_ROOT" ]]; then - echo "DOCUMENT_ROOT '$1' does not exist" >&2 - exit 1 - else - # strip trailing slashes if present - DOCUMENT_ROOT=${DOCUMENT_ROOT%%*(/)} # powered by extglob - if [[ $verbose ]]; then - echo "DOCUMENT_ROOT changed to '$DOCUMENT_ROOT'" >&2 - else - echo "DOCUMENT_ROOT changed to '${1%%*(/)}/'" >&2 - fi - fi -fi - -function prepare_hhvm_ini() { # we have to do this twice, as the WEB_CONCURRENCY setting is evaluated using PHP code, not ${...} syntax which HHVM does not support; if a value for $1 is passed then it won't echo messages upon second invocation -if [[ ( -n ${php_config:-} && ! ${1:-} ) || ( ${php_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php"} && $verbose && ! ${1:-} ) ]]; then - echo "Using HHVM configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 -fi -php_configs=( "-c" "$(php_passthrough "$php_config")" ) - -if [[ -n ${hhvm_config_extra:-} ]]; then - [[ ${1:-} ]] || echo "Using additional HHVM configuration (php.ini) file '${hhvm_config_extra#$HEROKU_APP_DIR/}'" >&2 - php_configs+=( "-c" "$(php_passthrough "$hhvm_config_extra")" ) -fi -} -prepare_hhvm_ini - -if [[ -n ${nginx_config_include:-} || ( ${nginx_config_include:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php"} && $verbose ) ]]; then - echo "Using Nginx server-level configuration include '${nginx_config_include#$HEROKU_APP_DIR/}'" >&2 -fi -nginx_config_include=$(php_passthrough "$nginx_config_include") -export HEROKU_PHP_NGINX_CONFIG_INCLUDE="$nginx_config_include" - -if [[ -n ${nginx_config:-} || ( ${nginx_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php"} && $verbose) ]]; then - echo "Using Nginx configuration file '${nginx_config#$HEROKU_APP_DIR/}'" >&2 -fi -nginx_config=$(php_passthrough "$nginx_config") - -if [[ -z ${WEB_CONCURRENCY:-} ]]; then - maxprocs=$(ulimit -u) - ram="512M" - if [[ -n ${DYNO:-} && "$maxprocs" == "32768" ]]; then - echo "Optimizing defaults for PX dyno...." >&2 - ram="6G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "16384" ]]; then - echo "Optimizing defaults for IX dyno...." >&2 - ram="2560M" - elif [[ -n ${DYNO:-} && "$maxprocs" == "512" ]]; then - echo "Optimizing defaults for 2X dyno..." >&2 - ram="1G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "256" ]]; then - echo "Optimizing defaults for 1X dyno..." >&2 - elif [[ -n ${DYNO:-} || $verbose ]]; then - echo "No dyno detected; using defaults for 1X..." >&2 - fi - - # determine number of HHVM threads to run - read WEB_CONCURRENCY php_memory_limit <<<$(hhvm "${php_configs[@]}" $(composer config vendor-dir 2> /dev/null | tail -n 1)/heroku/heroku-buildpack-php/bin/util/autotune.php "$ram") # tail, as composer echos outdated version warnings to STDOUT - [[ $WEB_CONCURRENCY -lt 1 ]] && WEB_CONCURRENCY=1 - export WEB_CONCURRENCY - - echo "${WEB_CONCURRENCY} threads at ${php_memory_limit}B memory limit." >&2 -else - echo "Using WEB_CONCURRENCY=${WEB_CONCURRENCY} threads." >&2 -fi - -# we changed WEB_CONCURRENCY; now we need to re-evaluate the configs as HHVM doesn't support ${...} syntax, so the configs contain PHP getenv() calls and are templated; we pass an argument to it to avoid it echoing "using HHVM config ..." messages again because that already happened -prepare_hhvm_ini no_messages - -# make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below -# this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter). -wait_pipe=$(mktemp -t "heroku.waitpipe-$PORT.XXXXXX" -u) -rm -f $wait_pipe -mkfifo $wait_pipe -exec 3<> $wait_pipe - -pids=() - -# trap SIGQUIT (ctrl+\ on the console), SIGTERM (when we get killed) and EXIT (upon failure of any command due to set -e, or because of the exit 1 at the very end), we then -# 1) restore the trap for the signal in question so it doesn't fire again due to the kill at the end of the trap, as well as for EXIT, because that would fire too -# 2) call cleanup() to -# 2a) remove our FIFO from above -# 2b) kill all the subshells we've spawned - they in turn have their own traps to kill their respective subprocesses, and because we use SIGUSR1, they know it's the parent's cleanup and can handle it differently from an external SIGKILL -# 2c) send STDERR to /dev/null so we don't see "no such process" errors - after all, one of the subshells may be gone -# 2d) || true so that set -e doesn't cause a mess if the kill returns 1 on "no such process" cases (which is likely on Heroku where all processes get killed and not just this top level one) -# 2e) do that in the background and 'wait' on those processes, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 3) kill ourselves with the correct signal in case we're handling SIGQUIT or SIGTERM (http://www.cons.org/cracauer/sigint.html and http://mywiki.wooledge.org/SignalTrap#Special_Note_On_SIGINT1) -cleanup() { echo "Going down, terminating child processes..." >&2; rm -f ${wait_pipe} || true; kill -USR1 "${pids[@]}" 2> /dev/null || true; } -trap 'trap - QUIT EXIT; cleanup; kill -QUIT $$' QUIT -trap 'trap - TERM EXIT; cleanup; kill -TERM $$' TERM -trap 'trap - EXIT; cleanup' EXIT -# if FD 1 is a TTY (that's the -t 1 check), trap SIGINT/Ctrl+C, then same procedure as for QUIT and TERM above -if [[ -t 1 ]]; then - trap 'trap - INT EXIT; cleanup; kill -INT $$' INT; -# if FD 1 is not a TTY (e.g. when we're run through 'foreman start'), do nothing on SIGINT; the assumption is that the parent will send us a SIGTERM or something when this happens. With the trap above, Ctrl+C-ing out of a 'foreman start' run would trigger the INT trap both in Foreman and here (because Ctrl+C sends SIGINT to the entire process group, but there is no way to tell the two cases apart), and while the trap is still doing its shutdown work triggered by the SIGTERM from the Ctrl+C, Foreman would then send a SIGTERM because that's what it does when it receives a SIGINT itself. -else - trap '' INT; -fi - -# we are now launching a subshell for each of the tasks (log tail, app server, web server) -# 1) each subshell has a trap on EXIT that echos the command name to FD 3 (see the FIFO set up above) -# 1a) a 'read' at the end of the script will block on reading from that FD and then trigger the exit trap further above, which does the cleanup -# 2) each subshell also has a trap on TERM that -# 2a) kills $! (the last process executed) -# 2b) ... which in turn will hit the EXIT trap and that unblocks the 'wait' in 5) which will cause the parent to clean up when the exit at the end of the script is hit -# 2c) the 'kill' is done in the background and we immediately 'wait' on $!, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 2d) finally, if $BASHPID exists, the subshell kills itself using the right signal for maximum compliance ($$ doesn't work in subshells, and $BASHPID is not available in Bash 3, but unlike with the parent, it's not that critical to have this) -# 3) each subshell has another trap on USR1 which gets sent when the parent is cleaning up; it works like 2a) but doesn't trigger the EXIT trap to avoid multiple cleanup runs by the parent -# 4) execute the command in the background -# 5) 'wait' on the command (wait is interrupted by an incoming TERM to the subshell, whereas running 4) in the foreground would wait for that process to finish before triggering the trap) -# 6) add the PID of the subshell to the array that the EXIT trap further above uses to clean everything up - -[[ $verbose ]] && echo "Starting log redirection..." >&2 -( - trap '' INT; - trap 'echo "tail" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - touch "${logs[@]}" - - tail -qF -n 0 "${logs[@]}" 1>&2 & pid=$! - - wait -) & pids+=($!) -disown $! - -echo "Starting hhvm..." >&2 -( - trap '' INT; - trap 'echo "hhvm" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - hhvm --mode server "${php_configs[@]}" & pid=$! - - wait -) & pids+=($!) -disown $! - -# wait a few seconds for HHVM to finish initializing; otherwise an early request might break Apache with the FastCGI pipe not being ready -sleep 2 - -echo "Starting nginx..." >&2 -( - trap '' INT; - trap 'echo "nginx" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - nginx -g "daemon off; include $nginx_config;" & pid=$! - - wait -) & pids+=($!) -disown $! - -# on Heroku, there is a "state changed from starting to up", but for local execution, we want a "ready" message -[[ -z ${DYNO:-} || $verbose ]] && echo "Application ready for connections on port $PORT." >&2 - -# wait for something to come from the FIFO attached to FD 3, which means that the given process was killed or has failed -# this will be interrupted by a SIGTERM or SIGINT in the traps further up -# if the pipe unblocks and this executes, then we won't read it again, so if the traps further up kill the remaining subshells above, their writing to FD 3 will have no effect -read exitproc <&3 -# we'll only reach this if one of the processes above has terminated -echo "Process exited unexpectedly: $exitproc" >&2 - -# this will trigger the EXIT trap further up and kill all remaining children -exit 1 diff --git a/vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 b/vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 deleted file mode 100755 index c3d8de8..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/heroku-php-apache2 +++ /dev/null @@ -1,404 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu -# for ${DOCUMENT_ROOT%%*(/)} pattern further down -shopt -s extglob -# for detecting when -l 'logs/*.log' matches nothing -shopt -s nullglob - -verbose= - -php_passthrough() { - local dir=$(dirname "$1") - local file=$(basename "$1") - local out=$(basename "$file" .php) - if [[ "$out" != "$file" ]]; then - [[ $verbose ]] && echo "Interpreting ${1#$HEROKU_APP_DIR/} to $out" >&2 - out="$dir/$out" - php -n "$1" > "$out" - echo "$out" - else - echo "$1" - fi -} - -check_exists() { - if [[ ! -f "$HEROKU_APP_DIR/$1" ]]; then - echo "Cannot read -$2 '$1' (relative to '$HEROKU_APP_DIR')" >&2 - exit 1 - else - echo "$HEROKU_APP_DIR/$1" - fi -} - -touch_log() { - mkdir -p $(dirname "$1") && touch "$1" -} - -print_help() { -echo "\ -${1:-Boots PHP-FPM together with Apache2 on Heroku and for local development.} - -Usage: - heroku-php-apache2 [options] [] - -Options: - -C The path to the configuration file to include inside - the Apache2 VHost config (see option -c below). Will - be included inside the '' section just - after the '' & 'ProxyPassMatch' directives. - Recommended approach when customizing Apache2's config - in most cases, unless you need to set fundamental - server level options. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/default_include.conf] - -c The path to the full VHost configuration file that is - included after Heroku's (or your local) Apache2 config - is loaded. Must contain a 'Listen \${PORT}' directive - and should have a '' and likely also a - '' section (see option -C above). - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/heroku.conf] - -F The path to the configuration file to include at the - end of php-fpm.conf (see option -f below), in the - '[www]' pool section. Recommended approach when - customizing PHP-FPM's configuration in most cases, - unless you need to set global options. - -f The path to the full PHP-FPM configuration file. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php-fpm.conf] - -h, --help Display this help screen and exit. - -i The path to the php.ini file to use. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php.ini] - -l Path to additional log file to tail to STDERR so its - contents appear in 'heroku logs'. If the file does not - exist, it will be created. Wildcards are allowed, but - must be quoted and must match already existing files. - Note: this option can be repeated multiple times. - -p Port to listen on for HTTP traffic. If this argument - is not given, then the port number to use is read from - the \$PORT environment variable, or a random port is - chosen if that variable does not exist. - -v, --verbose Be more verbose during startup. - -All file paths must be relative to '$HEROKU_APP_DIR'. - -Any file name that ends in '.php' will be run through the PHP interpreter first. -You may use this for templating although this is less useful than e.g. for Nginx -where unlike in Apache2, you cannot reference environment variables in config -files using a '\${VARNAME}' syntax. - -If you would like to use the -C and -c or -F and -f options together, make sure -you retain the appropriate include mechanisms (see default configs for details). -" >&2 -} - -# we need this in configs -export HEROKU_APP_DIR=$(pwd) -export DOCUMENT_ROOT="$HEROKU_APP_DIR" -# set a default port if none is given -export PORT=${PORT:-$(( $RANDOM+1024 ))} - -# init logs array here as empty before parsing options; -l could append to it, but the default list gets added later since we use $PORT in there and that can be set using -p -declare -a logs - -optstring=":-:C:c:F:f:i:l:p:vh" - -# process flags first -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - verbose) - verbose=1 - ;; - help) - print_help 2>&1 - exit - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - ;; - v) - verbose=1 - ;; - h) - print_help 2>&1 - exit - ;; - esac -done - -OPTIND=1 # start over with options parsing -while getopts "$optstring" opt; do - case $opt in - C) - httpd_config_include=$(check_exists "$OPTARG" "C") - ;; - c) - httpd_config=$(check_exists "$OPTARG" "c") - ;; - F) - fpm_config_include=$(check_exists "$OPTARG" "F") - ;; - f) - fpm_config=$(check_exists "$OPTARG" "f") - ;; - i) - php_config=$(check_exists "$OPTARG" "i") - ;; - l) - logarg=( $OPTARG ) # must not quote this or wildcards won't get expanded into individual values - if [[ ${#logarg[@]} -eq 0 ]]; then # we set nullglob to detect if a pattern matched nothing (then the array is empty) - echo "Pattern '$OPTARG' passed to option -l matched no files" >&2 - exit 1 - fi - for logfile in "${logarg[@]}"; do - if [[ -d "$logfile" ]]; then - echo "-l '$logfile': is a directory" >&2 - exit 1 - fi - touch_log "$logfile" || { echo "Could not touch '$logfile'; permissions problem?" >&2; exit 1; } - [[ $verbose ]] && echo "Tailing '$logfile' to stderr" >&2 - logs+=("$logfile") # must quote here in case a wildcard matched a file with a space in the name - done - ;; - p) - PORT="$OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 2 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 2 - ;; - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ "$#" -gt "1" ]]; then - print_help "$0: too many arguments. If you're using options, -make sure to list them before any document root argument you're providing." - exit 2 -fi - -# our standard logs -logs+=( "/tmp/heroku.php-fpm.$PORT.log" "/tmp/heroku.php-fpm.www.$PORT.log" "/tmp/heroku.php-fpm.$PORT.www.slowlog" "/tmp/heroku.apache2_error.$PORT.log" "/tmp/heroku.apache2_access.$PORT.log" ) - -# a bunch of checks; don't load any INIs to prevent newrelic etc from loading, we don't need all that stuff -php -n -r 'exit((int)version_compare(PHP_VERSION, "5.5.11", "<"));' || { echo "This program requires PHP 5.5.11 or newer; check your 'php' command." >&2; exit 1; } -{ php-fpm -n -v | php -n -r 'exit((int)version_compare(preg_replace("#PHP (\S+) \(fpm-fcgi\).+$#sm", "\\1", file_get_contents("php://stdin")), "5.5.11", "<"));'; } || { echo "This program requires PHP 5.5.11 or newer; check your 'php-fpm' command." >&2; exit 1; } -{ { httpd -v | php -n -r 'exit((int)version_compare(preg_replace("#^Server version: Apache/(\S+).+$#sm", "\\1", file_get_contents("php://stdin")), "2.4.10", "<"));'; } && { httpd -t -D DUMP_MODULES | grep 'proxy_fcgi_module' > /dev/null; }; } || { echo "This program requires Apache 2.4.10 or newer with mod_proxy and mod_proxy_fcgi enabled; check your 'httpd' command." >&2; exit 1; } - -# make sure we run a local composer.phar if present, or global composer if not -composer() { - local composer_bin=$(which ./composer.phar composer | head -n1) - # check if we the composer binary is executable by PHP - if file --brief --dereference $composer_bin | grep -e "shell" -e "bash" > /dev/null ; then # newer versions of file return "data" for .phar - # run it directly; it's probably a bash script or similar (homebrew-php does this) - $composer_bin "$@" - else - php -n $composer_bin "$@" - fi -} -COMPOSER_VENDOR_DIR=$(composer config vendor-dir 2> /dev/null | tail -n 1) && export COMPOSER_VENDOR_DIR || { echo "Unable to determine Composer vendor-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export -COMPOSER_BIN_DIR=$(composer config bin-dir 2> /dev/null | tail -n 1) && export COMPOSER_BIN_DIR || { echo "Unable to determine Composer bin-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export - -if [[ "$#" == "1" ]]; then - DOCUMENT_ROOT="$HEROKU_APP_DIR/$1" - if [[ ! -d "$DOCUMENT_ROOT" ]]; then - echo "DOCUMENT_ROOT '$1' does not exist" >&2 - exit 1 - else - # strip trailing slashes if present - DOCUMENT_ROOT=${DOCUMENT_ROOT%%*(/)} # powered by extglob - if [[ $verbose ]]; then - echo "DOCUMENT_ROOT changed to '$DOCUMENT_ROOT'" >&2 - else - echo "DOCUMENT_ROOT changed to '${1%%*(/)}/'" >&2 - fi - fi -fi - -if [[ -n ${fpm_config_include:-} ]]; then - echo "Using PHP-FPM configuration include '${fpm_config_include#$HEROKU_APP_DIR/}'" >&2 - fpm_config_include=$(php_passthrough "$fpm_config_include") - export HEROKU_PHP_FPM_CONFIG_INCLUDE="$fpm_config_include" -fi - -if [[ -n ${fpm_config:-} || ( ${fpm_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php-fpm.conf"} && $verbose ) ]]; then - echo "Using PHP-FPM configuration file '${fpm_config#$HEROKU_APP_DIR/}'" >&2 -fi -fpm_config=$(php_passthrough "$fpm_config") - -if [[ -n ${php_config:-} ]]; then - echo "Using PHP configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 - php_config=$(php_passthrough "$php_config") -fi - -if [[ -n ${httpd_config_include:-} || ( ${httpd_config_include:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/default_include.conf"} && $verbose ) ]]; then - echo "Using Apache2 VirtualHost-level configuration include '${httpd_config_include#$HEROKU_APP_DIR/}'" >&2 -fi -httpd_config_include=$(php_passthrough "$httpd_config_include") -export HEROKU_PHP_HTTPD_CONFIG_INCLUDE="$httpd_config_include" - -if [[ -n ${httpd_config:-} || ( ${httpd_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/apache2/heroku.conf"} && $verbose) ]]; then - echo "Using Apache2 configuration file '${httpd_config#$HEROKU_APP_DIR/}'" >&2 -fi -httpd_config=$(php_passthrough "$httpd_config") - -if [[ -z ${WEB_CONCURRENCY:-} ]]; then - maxprocs=$(ulimit -u) - ram="512M" - if [[ -n ${DYNO:-} && "$maxprocs" == "32768" ]]; then - echo "Optimizing defaults for PX dyno...." >&2 - ram="6G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "16384" ]]; then - echo "Optimizing defaults for IX dyno...." >&2 - ram="2560M" - elif [[ -n ${DYNO:-} && "$maxprocs" == "512" ]]; then - echo "Optimizing defaults for 2X dyno..." >&2 - ram="1G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "256" ]]; then - echo "Optimizing defaults for 1X dyno..." >&2 - elif [[ -n ${DYNO:-} || $verbose ]]; then - echo "No dyno detected; using defaults for 1X..." >&2 - fi - - # determine number of FPM processes to run - # prevent loading of extension INIs (and thus e.g. newrelic) using empty PHP_INI_SCAN_DIR - read WEB_CONCURRENCY php_memory_limit <<<$(PHP_INI_SCAN_DIR= php ${php_config:+-c "$php_config"} $(composer config vendor-dir 2> /dev/null | tail -n 1)/heroku/heroku-buildpack-php/bin/util/autotune.php -y "$fpm_config" -t "$DOCUMENT_ROOT" "$ram") # tail, as composer echos outdated version warnings to STDOUT - [[ $WEB_CONCURRENCY -lt 1 ]] && WEB_CONCURRENCY=1 - export WEB_CONCURRENCY - - echo "${WEB_CONCURRENCY} processes at ${php_memory_limit}B memory limit." >&2 -else - echo "Using WEB_CONCURRENCY=${WEB_CONCURRENCY} processes." >&2 -fi - -# make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below -# this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter). -wait_pipe=$(mktemp -t "heroku.waitpipe-$PORT.XXXXXX" -u) -rm -f $wait_pipe -mkfifo $wait_pipe -exec 3<> $wait_pipe - -pids=() - -# trap SIGQUIT (ctrl+\ on the console), SIGTERM (when we get killed) and EXIT (upon failure of any command due to set -e, or because of the exit 1 at the very end), we then -# 1) restore the trap for the signal in question so it doesn't fire again due to the kill at the end of the trap, as well as for EXIT, because that would fire too -# 2) call cleanup() to -# 2a) remove our FIFO from above -# 2b) kill all the subshells we've spawned - they in turn have their own traps to kill their respective subprocesses, and because we use SIGUSR1, they know it's the parent's cleanup and can handle it differently from an external SIGKILL -# 2c) send STDERR to /dev/null so we don't see "no such process" errors - after all, one of the subshells may be gone -# 2d) || true so that set -e doesn't cause a mess if the kill returns 1 on "no such process" cases (which is likely on Heroku where all processes get killed and not just this top level one) -# 2e) do that in the background and 'wait' on those processes, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 3) kill ourselves with the correct signal in case we're handling SIGQUIT or SIGTERM (http://www.cons.org/cracauer/sigint.html and http://mywiki.wooledge.org/SignalTrap#Special_Note_On_SIGINT1) -cleanup() { echo "Going down, terminating child processes..." >&2; rm -f ${wait_pipe} || true; kill -USR1 "${pids[@]}" 2> /dev/null || true; } -trap 'trap - QUIT EXIT; cleanup; kill -QUIT $$' QUIT -trap 'trap - TERM EXIT; cleanup; kill -TERM $$' TERM -trap 'trap - EXIT; cleanup' EXIT -# if FD 1 is a TTY (that's the -t 1 check), trap SIGINT/Ctrl+C, then same procedure as for QUIT and TERM above -if [[ -t 1 ]]; then - trap 'trap - INT EXIT; cleanup; kill -INT $$' INT; -# if FD 1 is not a TTY (e.g. when we're run through 'foreman start'), do nothing on SIGINT; the assumption is that the parent will send us a SIGTERM or something when this happens. With the trap above, Ctrl+C-ing out of a 'foreman start' run would trigger the INT trap both in Foreman and here (because Ctrl+C sends SIGINT to the entire process group, but there is no way to tell the two cases apart), and while the trap is still doing its shutdown work triggered by the SIGTERM from the Ctrl+C, Foreman would then send a SIGTERM because that's what it does when it receives a SIGINT itself. -else - trap '' INT; -fi - -# we are now launching a subshell for each of the tasks (log tail, app server, web server) -# 1) each subshell has a trap on EXIT that echos the command name to FD 3 (see the FIFO set up above) -# 1a) a 'read' at the end of the script will block on reading from that FD and then trigger the exit trap further above, which does the cleanup -# 2) each subshell also has a trap on TERM that -# 2a) kills $! (the last process executed) -# 2b) ... which in turn will hit the EXIT trap and that unblocks the 'wait' in 5) which will cause the parent to clean up when the exit at the end of the script is hit -# 2c) the 'kill' is done in the background and we immediately 'wait' on $!, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 2d) finally, if $BASHPID exists, the subshell kills itself using the right signal for maximum compliance ($$ doesn't work in subshells, and $BASHPID is not available in Bash 3, but unlike with the parent, it's not that critical to have this) -# 3) each subshell has another trap on USR1 which gets sent when the parent is cleaning up; it works like 2a) but doesn't trigger the EXIT trap to avoid multiple cleanup runs by the parent -# 4) execute the command in the background -# 5) 'wait' on the command (wait is interrupted by an incoming TERM to the subshell, whereas running 4) in the foreground would wait for that process to finish before triggering the trap) -# 6) add the PID of the subshell to the array that the EXIT trap further above uses to clean everything up - -[[ $verbose ]] && echo "Starting log redirection..." >&2 -( - # the TERM trap here is special, because - # 1) there is a pipeline from tail to sed - # 2) we thus need to kill several children - # 3) kill $! will no longer do the job in that case - # 4) job control (set -m, where we could then kill %% instead) has weird side effects e.g. on ctrl+c (kills the parent terminal after that too) - # 5) so we try to kill all currently running jobs - # 5a) gracefully, by redirecting STDERR to /dev/null - one of the children will already be gone - # 6) the sed with the Darwin/GNU sed arg case used to be a function, but that was even worse with an extra wrapping subshell for sed - # FIXME: fires when the subshell or the tail is killed, but not when the sed is killed, because... pipes :( maybe we can do http://mywiki.wooledge.org/ProcessManagement#My_script_runs_a_pipeline.__When_the_script_is_killed.2C_I_want_the_pipeline_to_die_too. - logs_pipe=$(mktemp -t "heroku.logspipe-$$.XXXXXX" -u) - rm -f $logs_pipe - mkfifo $logs_pipe - unset logs_procs - - trap '' INT; - trap 'echo "tail" >&3;' EXIT - trap 'trap - TERM; kill -TERM "${logs_procs[@]}" 2> /dev/null || true & wait "${logs_procs[@]}" 2> /dev/null || true; rm -f $logs_pipe; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM "${logs_procs[@]}" 2> /dev/null || true & wait "${logs_procs[@]}" 2> /dev/null || true; rm -f $logs_pipe; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - touch "${logs[@]}" - - if [[ $(uname) == "Darwin" ]]; then - sedbufarg="-l" # mac/bsd sed: -l buffers on line boundaries - else - sedbufarg="-u" # unix/gnu sed: -u unbuffered (arbitrary) chunks of data - fi - - tail -qF -n 0 "${logs[@]}" > "$logs_pipe" & logs_procs+=($!) - sed $sedbufarg -E -e 's/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|...)$/\2\3/' -e 's/"$//' < "$logs_pipe" 1>&2 & logs_procs+=($!) # messages that are too long are cut off using "..." by FPM instead of closing double quotation marks; we want to preserve those three dots but not the closing double quotes - - wait -) & pids+=($!) -disown $! - -echo "Starting php-fpm..." >&2 -( - trap '' INT; - trap 'echo "php-fpm" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - php-fpm --nodaemonize -y "$fpm_config" ${php_config:+-c "$php_config"} & pid=$! - - wait -) & pids+=($!) -disown $! - -# wait a few seconds for FPM to finish initializing; otherwise an early request might break Apache with the FastCGI pipe not being ready -sleep 2 - -echo "Starting httpd..." >&2 -( - trap '' INT; - trap 'echo "httpd" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - httpd -D NO_DETACH -c "Include $httpd_config" & pid=$! - - wait -) & pids+=($!) -disown $! - -# on Heroku, there is a "state changed from starting to up", but for local execution, we want a "ready" message -[[ -z ${DYNO:-} || $verbose ]] && echo "Application ready for connections on port $PORT." >&2 - -# wait for something to come from the FIFO attached to FD 3, which means that the given process was killed or has failed -# this will be interrupted by a SIGTERM or SIGINT in the traps further up -# if the pipe unblocks and this executes, then we won't read it again, so if the traps further up kill the remaining subshells above, their writing to FD 3 will have no effect -read exitproc <&3 -# we'll only reach this if one of the processes above has terminated -echo "Process exited unexpectedly: $exitproc" >&2 - -# this will trigger the EXIT trap further up and kill all remaining children -exit 1 diff --git a/vendor/heroku/heroku-buildpack-php/bin/heroku-php-nginx b/vendor/heroku/heroku-buildpack-php/bin/heroku-php-nginx deleted file mode 100755 index 2a43215..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/heroku-php-nginx +++ /dev/null @@ -1,405 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu -# for ${DOCUMENT_ROOT%%*(/)} pattern further down -shopt -s extglob -# for detecting when -l 'logs/*.log' matches nothing -shopt -s nullglob - -verbose= - -php_passthrough() { - local dir=$(dirname "$1") - local file=$(basename "$1") - local out=$(basename "$file" .php) - if [[ "$out" != "$file" ]]; then - [[ $verbose ]] && echo "Interpreting ${1#$HEROKU_APP_DIR/} to $out" >&2 - out="$dir/$out" - php -n "$1" > "$out" - echo "$out" - else - echo "$1" - fi -} - -check_exists() { - if [[ ! -f "$HEROKU_APP_DIR/$1" ]]; then - echo "Cannot read -$2 '$1' (relative to '$HEROKU_APP_DIR')" >&2 - exit 1 - else - echo "$HEROKU_APP_DIR/$1" - fi -} - -touch_log() { - mkdir -p $(dirname "$1") && touch "$1" -} - -print_help() { -echo "\ -${1:-Boots PHP-FPM together with Nginx on Heroku and for local development.} - -Usage: - heroku-php-nginx [options] [] - -Options: - -C The path to the configuration file to include inside - the Nginx server config (see option -c below). Will - be included inside the 'server { ... }' block just - after the 'listen', 'root' etc directives. - Recommended approach when customizing Nginx's config - in most cases, unless you need to set http or - fundamental server level options. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php] - -c The path to the full configuration file that is - included after Heroku's (or your local) Nginx config - is loaded. It must contain an 'http { ... }' block - with a 'server { ... }' inside that contains 'listen' - and 'root' (see option -C above), but no global, - directives (globals are read from the system's default - Nginx configuration files). - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php] - -F The path to the configuration file to include at the - end of php-fpm.conf (see option -f below), in the - '[www]' pool section. Recommended approach when - customizing PHP-FPM's configuration in most cases, - unless you need to set global options. - -f The path to the full PHP-FPM configuration file. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php-fpm.conf] - -h, --help Display this help screen and exit. - -i The path to the php.ini file to use. - [default: \$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php.ini] - -l Path to additional log file to tail to STDERR so its - contents appear in 'heroku logs'. If the file does not - exist, it will be created. Wildcards are allowed, but - must be quoted and must match already existing files. - Note: this option can be repeated multiple times. - -p Port to listen on for HTTP traffic. If this argument - is not given, then the port number to use is read from - the \$PORT environment variable, or a random port is - chosen if that variable does not exist. - -v, --verbose Be more verbose during startup. - -All file paths must be relative to '$HEROKU_APP_DIR'. - -Any file name that ends in '.php' will be run through the PHP interpreter first. -You may use this for templating; this is, for instance, necessary for Nginx, -where environment variables cannot be referenced in configuration files. - -If you would like to use the -C and -c or -F and -f options together, make sure -you retain the appropriate include mechanisms (see default configs for details). -" >&2 -} - -# we need this in configs -export HEROKU_APP_DIR=$(pwd) -export DOCUMENT_ROOT="$HEROKU_APP_DIR" -# set a default port if none is given -export PORT=${PORT:-$(( $RANDOM+1024 ))} - -# init logs array here as empty before parsing options; -l could append to it, but the default list gets added later since we use $PORT in there and that can be set using -p -declare -a logs - -optstring=":-:C:c:F:f:i:l:p:vh" - -# process flags first -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - verbose) - verbose=1 - ;; - help) - print_help 2>&1 - exit - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - ;; - v) - verbose=1 - ;; - h) - print_help 2>&1 - exit - ;; - esac -done - -OPTIND=1 # start over with options parsing -while getopts "$optstring" opt; do - case $opt in - C) - nginx_config_include=$(check_exists "$OPTARG" "C") - ;; - c) - nginx_config=$(check_exists "$OPTARG" "c") - ;; - F) - fpm_config_include=$(check_exists "$OPTARG" "F") - ;; - f) - fpm_config=$(check_exists "$OPTARG" "f") - ;; - i) - php_config=$(check_exists "$OPTARG" "i") - ;; - l) - logarg=( $OPTARG ) # must not quote this or wildcards won't get expanded into individual values - if [[ ${#logarg[@]} -eq 0 ]]; then # we set nullglob to detect if a pattern matched nothing (then the array is empty) - echo "Pattern '$OPTARG' passed to option -l matched no files" >&2 - exit 1 - fi - for logfile in "${logarg[@]}"; do - if [[ -d "$logfile" ]]; then - echo "-l '$logfile': is a directory" >&2 - exit 1 - fi - touch_log "$logfile" || { echo "Could not touch '$logfile'; permissions problem?" >&2; exit 1; } - [[ $verbose ]] && echo "Tailing '$logfile' to stderr" >&2 - logs+=("$logfile") # must quote here in case a wildcard matched a file with a space in the name - done - ;; - p) - PORT="$OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 2 - ;; - :) - echo "Option -$OPTARG requires an argument" >&2 - exit 2 - ;; - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ "$#" -gt "1" ]]; then - print_help "$0: too many arguments. If you're using options, -make sure to list them before any document root argument you're providing." - exit 2 -fi - -# our standard logs -logs+=( "/tmp/heroku.php-fpm.$PORT.log" "/tmp/heroku.php-fpm.www.$PORT.log" "/tmp/heroku.php-fpm.$PORT.www.slowlog" "/tmp/heroku.nginx_access.$PORT.log" ) - -# a bunch of checks; don't load any INIs to prevent newrelic etc from loading, we don't need all that stuff -php -n -r 'exit((int)version_compare(PHP_VERSION, "5.5.11", "<"));' || { echo "This program requires PHP 5.5.11 or newer; check your 'php' command." >&2; exit 1; } -{ php-fpm -n -v | php -n -r 'exit((int)version_compare(preg_replace("#PHP (\S+) \(fpm-fcgi\).+$#sm", "\\1", file_get_contents("php://stdin")), "5.5.11", "<"));'; } || { echo "This program requires PHP 5.5.11 or newer; check your 'php-fpm' command." >&2; exit 1; } -unset -f php-fpm # remove the alias we made earlier that would prevent newrelic from starting on php-fpm -v - -# make sure we run a local composer.phar if present, or global composer if not -composer() { - local composer_bin=$(which ./composer.phar composer | head -n1) - # check if we the composer binary is executable by PHP - if file --brief --dereference $composer_bin | grep -e "shell" -e "bash" > /dev/null ; then # newer versions of file return "data" for .phar - # run it directly; it's probably a bash script or similar (homebrew-php does this) - $composer_bin "$@" - else - php -n $composer_bin "$@" - fi -} -COMPOSER_VENDOR_DIR=$(composer config vendor-dir 2> /dev/null | tail -n 1) && export COMPOSER_VENDOR_DIR || { echo "Unable to determine Composer vendor-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export -COMPOSER_BIN_DIR=$(composer config bin-dir 2> /dev/null | tail -n 1) && export COMPOSER_BIN_DIR || { echo "Unable to determine Composer bin-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory?" >&2; exit 1; } # tail, as composer echos outdated version warnings to STDOUT; export after the assignment or exit status will that be of 'export - -if [[ "$#" == "1" ]]; then - DOCUMENT_ROOT="$HEROKU_APP_DIR/$1" - if [[ ! -d "$DOCUMENT_ROOT" ]]; then - echo "DOCUMENT_ROOT '$1' does not exist" >&2 - exit 1 - else - # strip trailing slashes if present - DOCUMENT_ROOT=${DOCUMENT_ROOT%%*(/)} # powered by extglob - if [[ $verbose ]]; then - echo "DOCUMENT_ROOT changed to '$DOCUMENT_ROOT'" >&2 - else - echo "DOCUMENT_ROOT changed to '${1%%*(/)}/'" >&2 - fi - fi -fi - -if [[ -n ${fpm_config_include:-} ]]; then - echo "Using PHP-FPM configuration include '${fpm_config_include#$HEROKU_APP_DIR/}'" >&2 - fpm_config_include=$(php_passthrough "$fpm_config_include") - export HEROKU_PHP_FPM_CONFIG_INCLUDE="$fpm_config_include" -fi - -if [[ -n ${fpm_config:-} || ( ${fpm_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/php/php-fpm.conf"} && $verbose ) ]]; then - echo "Using PHP-FPM configuration file '${fpm_config#$HEROKU_APP_DIR/}'" >&2 -fi -fpm_config=$(php_passthrough "$fpm_config") - -if [[ -n ${php_config:-} ]]; then - echo "Using PHP configuration (php.ini) file '${php_config#$HEROKU_APP_DIR/}'" >&2 - php_config=$(php_passthrough "$php_config") -fi - -if [[ -n ${nginx_config_include:-} || ( ${nginx_config_include:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php"} && $verbose ) ]]; then - echo "Using Nginx server-level configuration include '${nginx_config_include#$HEROKU_APP_DIR/}'" >&2 -fi -nginx_config_include=$(php_passthrough "$nginx_config_include") -export HEROKU_PHP_NGINX_CONFIG_INCLUDE="$nginx_config_include" - -if [[ -n ${nginx_config:-} || ( ${nginx_config:="$HEROKU_APP_DIR/$COMPOSER_VENDOR_DIR/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php"} && $verbose) ]]; then - echo "Using Nginx configuration file '${nginx_config#$HEROKU_APP_DIR/}'" >&2 -fi -nginx_config=$(php_passthrough "$nginx_config") - -if [[ -z ${WEB_CONCURRENCY:-} ]]; then - maxprocs=$(ulimit -u) - ram="512M" - if [[ -n ${DYNO:-} && "$maxprocs" == "32768" ]]; then - echo "Optimizing defaults for PX dyno...." >&2 - ram="6G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "16384" ]]; then - echo "Optimizing defaults for IX dyno...." >&2 - ram="2560M" - elif [[ -n ${DYNO:-} && "$maxprocs" == "512" ]]; then - echo "Optimizing defaults for 2X dyno..." >&2 - ram="1G" - elif [[ -n ${DYNO:-} && "$maxprocs" == "256" ]]; then - echo "Optimizing defaults for 1X dyno..." >&2 - elif [[ -n ${DYNO:-} || $verbose ]]; then - echo "No dyno detected; using defaults for 1X..." >&2 - fi - - # determine number of FPM processes to run - # prevent loading of extension INIs (and thus e.g. newrelic) using empty PHP_INI_SCAN_DIR - read WEB_CONCURRENCY php_memory_limit <<<$(PHP_INI_SCAN_DIR= php ${php_config:+-c "$php_config"} $(composer config vendor-dir 2> /dev/null | tail -n 1)/heroku/heroku-buildpack-php/bin/util/autotune.php -y "$fpm_config" -t "$DOCUMENT_ROOT" "$ram") # tail, as composer echos outdated version warnings to STDOUT - [[ $WEB_CONCURRENCY -lt 1 ]] && WEB_CONCURRENCY=1 - export WEB_CONCURRENCY - - echo "${WEB_CONCURRENCY} processes at ${php_memory_limit}B memory limit." >&2 -else - echo "Using WEB_CONCURRENCY=${WEB_CONCURRENCY} processes." >&2 -fi - -# make a shared pipe; we'll write the name of the process that exits to it once that happens, and wait for that event below -# this particular call works on Linux and Mac OS (will create a literal ".XXXXXX" on Mac, but that doesn't matter). -wait_pipe=$(mktemp -t "heroku.waitpipe-$PORT.XXXXXX" -u) -rm -f $wait_pipe -mkfifo $wait_pipe -exec 3<> $wait_pipe - -pids=() - -# trap SIGQUIT (ctrl+\ on the console), SIGTERM (when we get killed) and EXIT (upon failure of any command due to set -e, or because of the exit 1 at the very end), we then -# 1) restore the trap for the signal in question so it doesn't fire again due to the kill at the end of the trap, as well as for EXIT, because that would fire too -# 2) call cleanup() to -# 2a) remove our FIFO from above -# 2b) kill all the subshells we've spawned - they in turn have their own traps to kill their respective subprocesses, and because we use SIGUSR1, they know it's the parent's cleanup and can handle it differently from an external SIGKILL -# 2c) send STDERR to /dev/null so we don't see "no such process" errors - after all, one of the subshells may be gone -# 2d) || true so that set -e doesn't cause a mess if the kill returns 1 on "no such process" cases (which is likely on Heroku where all processes get killed and not just this top level one) -# 2e) do that in the background and 'wait' on those processes, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 3) kill ourselves with the correct signal in case we're handling SIGQUIT or SIGTERM (http://www.cons.org/cracauer/sigint.html and http://mywiki.wooledge.org/SignalTrap#Special_Note_On_SIGINT1) -cleanup() { echo "Going down, terminating child processes..." >&2; rm -f ${wait_pipe} || true; kill -USR1 "${pids[@]}" 2> /dev/null || true; } -trap 'trap - QUIT EXIT; cleanup; kill -QUIT $$' QUIT -trap 'trap - TERM EXIT; cleanup; kill -TERM $$' TERM -trap 'trap - EXIT; cleanup' EXIT -# if FD 1 is a TTY (that's the -t 1 check), trap SIGINT/Ctrl+C, then same procedure as for QUIT and TERM above -if [[ -t 1 ]]; then - trap 'trap - INT EXIT; cleanup; kill -INT $$' INT; -# if FD 1 is not a TTY (e.g. when we're run through 'foreman start'), do nothing on SIGINT; the assumption is that the parent will send us a SIGTERM or something when this happens. With the trap above, Ctrl+C-ing out of a 'foreman start' run would trigger the INT trap both in Foreman and here (because Ctrl+C sends SIGINT to the entire process group, but there is no way to tell the two cases apart), and while the trap is still doing its shutdown work triggered by the SIGTERM from the Ctrl+C, Foreman would then send a SIGTERM because that's what it does when it receives a SIGINT itself. -else - trap '' INT; -fi - -# we are now launching a subshell for each of the tasks (log tail, app server, web server) -# 1) each subshell has a trap on EXIT that echos the command name to FD 3 (see the FIFO set up above) -# 1a) a 'read' at the end of the script will block on reading from that FD and then trigger the exit trap further above, which does the cleanup -# 2) each subshell also has a trap on TERM that -# 2a) kills $! (the last process executed) -# 2b) ... which in turn will hit the EXIT trap and that unblocks the 'wait' in 5) which will cause the parent to clean up when the exit at the end of the script is hit -# 2c) the 'kill' is done in the background and we immediately 'wait' on $!, sending wait's output to /dev/null - this prevents the logs getting cluttered with "vendor/bin/heroku-...: line 309: 96 Terminated" messages (we can't use 'disown' after launching programs for that purpose because that removes the jobs from the shell's jobs table and the we can no longer 'wait' on the program) -# 2d) finally, if $BASHPID exists, the subshell kills itself using the right signal for maximum compliance ($$ doesn't work in subshells, and $BASHPID is not available in Bash 3, but unlike with the parent, it's not that critical to have this) -# 3) each subshell has another trap on USR1 which gets sent when the parent is cleaning up; it works like 2a) but doesn't trigger the EXIT trap to avoid multiple cleanup runs by the parent -# 4) execute the command in the background -# 5) 'wait' on the command (wait is interrupted by an incoming TERM to the subshell, whereas running 4) in the foreground would wait for that process to finish before triggering the trap) -# 6) add the PID of the subshell to the array that the EXIT trap further above uses to clean everything up - -[[ $verbose ]] && echo "Starting log redirection..." >&2 -( - # the TERM trap here is special, because - # 1) there is a pipeline from tail to sed - # 2) we thus need to kill several children - # 3) kill $! will no longer do the job in that case - # 4) job control (set -m, where we could then kill %% instead) has weird side effects e.g. on ctrl+c (kills the parent terminal after that too) - # 5) so we try to kill all currently running jobs - # 5a) gracefully, by redirecting STDERR to /dev/null - one of the children will already be gone - # 6) the sed with the Darwin/GNU sed arg case used to be a function, but that was even worse with an extra wrapping subshell for sed - # FIXME: fires when the subshell or the tail is killed, but not when the sed is killed, because... pipes :( maybe we can do http://mywiki.wooledge.org/ProcessManagement#My_script_runs_a_pipeline.__When_the_script_is_killed.2C_I_want_the_pipeline_to_die_too. - logs_pipe=$(mktemp -t "heroku.logspipe-$$.XXXXXX" -u) - rm -f $logs_pipe - mkfifo $logs_pipe - unset logs_procs - - trap '' INT; - trap 'echo "tail" >&3;' EXIT - trap 'trap - TERM; kill -TERM "${logs_procs[@]}" 2> /dev/null || true & wait "${logs_procs[@]}" 2> /dev/null || true; rm -f $logs_pipe; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM "${logs_procs[@]}" 2> /dev/null || true & wait "${logs_procs[@]}" 2> /dev/null || true; rm -f $logs_pipe; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - touch "${logs[@]}" - - if [[ $(uname) == "Darwin" ]]; then - sedbufarg="-l" # mac/bsd sed: -l buffers on line boundaries - else - sedbufarg="-u" # unix/gnu sed: -u unbuffered (arbitrary) chunks of data - fi - - tail -qF -n 0 "${logs[@]}" > "$logs_pipe" & logs_procs+=($!) - sed $sedbufarg -E -e 's/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|...)$/\2\3/' -e 's/"$//' < "$logs_pipe" 1>&2 & logs_procs+=($!) # messages that are too long are cut off using "..." by FPM instead of closing double quotation marks; we want to preserve those three dots but not the closing double quotes - - wait -) & pids+=($!) -disown $! - -echo "Starting php-fpm..." >&2 -( - trap '' INT; - trap 'echo "php-fpm" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - php-fpm --nodaemonize -y "$fpm_config" ${php_config:+-c "$php_config"} & pid=$! - - wait -) & pids+=($!) -disown $! - -# wait a few seconds for FPM to finish initializing; otherwise an early request might break Apache with the FastCGI pipe not being ready -sleep 2 - -echo "Starting nginx..." >&2 -( - trap '' INT; - trap 'echo "nginx" >&3;' EXIT - trap 'trap - TERM; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -TERM $BASHPID' TERM - trap 'trap - USR1 EXIT; kill -TERM $pid 2> /dev/null || true & wait $pid 2> /dev/null || true; [[ ${BASHPID:-} ]] && kill -USR1 $BASHPID' USR1 - - nginx -g "daemon off; include $nginx_config;" & pid=$! - - wait -) & pids+=($!) -disown $! - -# on Heroku, there is a "state changed from starting to up", but for local execution, we want a "ready" message -[[ -z ${DYNO:-} || $verbose ]] && echo "Application ready for connections on port $PORT." >&2 - -# wait for something to come from the FIFO attached to FD 3, which means that the given process was killed or has failed -# this will be interrupted by a SIGTERM or SIGINT in the traps further up -# if the pipe unblocks and this executes, then we won't read it again, so if the traps further up kill the remaining subshells above, their writing to FD 3 will have no effect -read exitproc <&3 -# we'll only reach this if one of the processes above has terminated -echo "Process exited unexpectedly: $exitproc" >&2 - -# this will trigger the EXIT trap further up and kill all remaining children -exit 1 diff --git a/vendor/heroku/heroku-buildpack-php/bin/release b/vendor/heroku/heroku-buildpack-php/bin/release deleted file mode 100755 index 70cd710..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/release +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# bin/release - -cat < - -# fail hard -set -o pipefail -# fail harder -set -eu - -# this will cause bin/compile to install dev platform and user dependencies -export HEROKU_PHP_INSTALL_DEV="" # empty string is correct; it will be inserted into command strings, and Composer throws a deprecation warning if the explicit "--dev" is used - -bp_dir=$(cd $(dirname $0); cd ..; pwd) -source $bp_dir/bin/compile diff --git a/vendor/heroku/heroku-buildpack-php/bin/util/autotune.php b/vendor/heroku/heroku-buildpack-php/bin/util/autotune.php deleted file mode 100755 index 1d5bfad..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/util/autotune.php +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env php - $directives) { - foreach($directives as $key => $value) { - if($section == "www" && $key == "php_admin_value" && isset($value['memory_limit'])) { - $retval['php_admin_value'] = $value['memory_limit']; - } elseif($section == "www" && $key == "php_value" && isset($value['memory_limit']) && !isset($retval['php_value'])) { - // an existing value takes precedence - // we can only emulate that for includes; within the same file, the INI parser overwrites earlier values :( - $retval['php_value'] = $value['memory_limit']; - } elseif($key == "include") { - // values from the include don't overwrite existing values - $retval = array_merge(get_fpm_memory_limit($value, $section), $retval); - } - - if(isset($retval['php_admin_value'])) { - // done for good as nothing can change this anymore, bubble upwards - return $retval; - } - } - } - - return $retval; -} - -$opts = getopt("y:t:"); - -$limits = get_fpm_memory_limit(isset($opts["y"]) ? $opts["y"] : null); - -if( - !$limits /* .user.ini memory limit is ignored if one is set via FPM */ && - isset($opts['t']) && - is_readable($opts['t'].'/.user.ini') -) { - // we only read the topmost .user.ini inside document root - $userini = parse_ini_file($opts['t'].'/.user.ini'); - if(isset($userini['memory_limit'])) { - $limits['php_value'] = $userini['memory_limit']; - } -} - -if(isset($limits['php_admin_value'])) { - ini_set('memory_limit', $limits['php_admin_value']); -} elseif(isset($limits['php_value'])) { - ini_set('memory_limit', $limits['php_value']); -} - -$limit = ini_get('memory_limit'); -$ram = stringtobytes($argv[$argc-1]); // last arg is the available memory - -// assume 64 MB base overhead for web server and FPM, and 1 MB overhead for each worker -// echo floor(($ram-stringtobytes('64M'))/(stringtobytes($limit)+stringtobytes('1M'))) . " " . $limit; -echo floor($ram / (stringtobytes($limit)?:-1)) . " " . $limit; diff --git a/vendor/heroku/heroku-buildpack-php/bin/util/blackfire.sh b/vendor/heroku/heroku-buildpack-php/bin/util/blackfire.sh deleted file mode 100755 index 10deb01..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/util/blackfire.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -install_blackfire_ext() { - # special treatment for Blackfire; we enable it if we detect a server id and a server token for it - # otherwise users would have to have it in their require section, which is annoying in development environments - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID:-} - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN:-} - if [[ "$engine" == "php" && -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]] && ! $engine -n $(which composer) show -d "$build_dir/.heroku/php" --installed --quiet heroku-sys/ext-blackfire 2>/dev/null; then - if $engine -n $(which composer) require --update-no-dev -d "$build_dir/.heroku/php" -- "heroku-sys/ext-blackfire:*" >> $build_dir/.heroku/php/install.log 2>&1; then - echo "- Blackfire detected, installed ext-blackfire" | indent - else - warning_inline "Blackfire detected, but no suitable extension available" - fi - fi -} diff --git a/vendor/heroku/heroku-buildpack-php/bin/util/common.sh b/vendor/heroku/heroku-buildpack-php/bin/util/common.sh deleted file mode 100755 index c4507f9..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/util/common.sh +++ /dev/null @@ -1,66 +0,0 @@ -error() { - echo - echo " ! ERROR: $*" | indent no_first_line_indent - echo - exit 1 -} - -warning() { - echo - echo " ! WARNING: $*" | indent no_first_line_indent - echo -} - -warning_inline() { - echo " ! WARNING: $*" | indent no_first_line_indent -} - -status() { - echo "-----> $*" -} - -notice() { - echo - echo "NOTICE: $*" | indent - echo -} - -notice_inline() { - echo "NOTICE: $*" | indent -} - -# sed -l basically makes sed replace and buffer through stdin to stdout -# so you get updates while the command runs and dont wait for the end -# e.g. npm install | indent -indent() { - # if an arg is given it's a flag indicating we shouldn't indent the first line, so use :+ to tell SED accordingly if that parameter is set, otherwise null string for no range selector prefix (it selects from line 2 onwards and then every 1st line, meaning all lines) - local c="${1:+"2,999"} s/^/ /" - case $(uname) in - Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries - *) sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data - esac -} - -export_env_dir() { - local env_dir=$1 - local whitelist_regex=${2:-''} - local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH|IFS)$'} - if [ -d "$env_dir" ]; then - for e in $(ls $env_dir); do - echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" && - export "$e=$(cat $env_dir/$e)" - : - done - fi -} - -curl_retry_on_18() { - local ec=18; - local attempts=0; - while [[ $ec -eq 18 && $attempts -lt 3 ]]; do - ((attempts++)) - curl "$@" # -C - would return code 33 if unsupported by server - ec=$? - done - return $ec -} diff --git a/vendor/heroku/heroku-buildpack-php/bin/util/newrelic.sh b/vendor/heroku/heroku-buildpack-php/bin/util/newrelic.sh deleted file mode 100755 index 9e38cf7..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/util/newrelic.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -install_newrelic_ext() { - # special treatment for New Relic; we enable it if we detect a license key for it - # otherwise users would have to have it in their require section, which is annoying in development environments - NEW_RELIC_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY:-} - if [[ "$engine" == "php" && -n "$NEW_RELIC_LICENSE_KEY" ]] && ! $engine -n $(which composer) show -d "$build_dir/.heroku/php" --installed --quiet heroku-sys/ext-newrelic 2>/dev/null; then - if $engine -n $(which composer) require --update-no-dev -d "$build_dir/.heroku/php" -- "heroku-sys/ext-newrelic:*" >> $build_dir/.heroku/php/install.log 2>&1; then - echo "- New Relic detected, installed ext-newrelic" | indent - else - warning_inline "New Relic detected, but no suitable extension available" - fi - fi -} - -install_newrelic_userini() { - if [[ "$engine" == "php" && -n "${NEW_RELIC_CONFIG_FILE:-}" ]]; then - if [[ ! -f "${NEW_RELIC_CONFIG_FILE}" ]]; then - error "Config var 'NEW_RELIC_CONFIG_FILE' points to non existing file -'${NEW_RELIC_CONFIG_FILE}'" - fi - notice_inline "Using custom New Relic config '${NEW_RELIC_CONFIG_FILE}'" - ( cd $build_dir/.heroku/php/etc/php/conf.d; ln -s "../../../../../${NEW_RELIC_CONFIG_FILE}" "ext-newrelic.user.ini" ) - fi -} diff --git a/vendor/heroku/heroku-buildpack-php/bin/util/platform.php b/vendor/heroku/heroku-buildpack-php/bin/util/platform.php deleted file mode 100755 index edde269..0000000 --- a/vendor/heroku/heroku-buildpack-php/bin/util/platform.php +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env php - "stable", - 5 => "RC", - 10 => "beta", - 15 => "alpha", - 20 => "dev", - ]; - if(!isset($stabilityFlags[$number])) { - file_put_contents("php://stderr", "ERROR: invalid stability flag '$number' in $COMPOSER_LOCK"); - exit(1); - } - return "@".$stabilityFlags[$number]; -} - -function mkmetas($package, array &$metapaks, &$have_runtime_req = false) { - // filter platform reqs - $platfilter = function($v) { return preg_match("#^(hhvm$|php(-64bit)?$|ext-)#", $v); }; - - // extract only platform requires, replaces and provides - $preq = array_filter(isset($package["require"]) ? $package["require"] : [], $platfilter, ARRAY_FILTER_USE_KEY); - $prep = array_filter(isset($package["replace"]) ? $package["replace"] : [], $platfilter, ARRAY_FILTER_USE_KEY); - $ppro = array_filter(isset($package["provide"]) ? $package["provide"] : [], $platfilter, ARRAY_FILTER_USE_KEY); - $pcon = array_filter(isset($package["conflict"]) ? $package["conflict"] : [], $platfilter, ARRAY_FILTER_USE_KEY); - if(!$preq && !$prep && !$ppro && !$pcon) return false; - // for known "polyfill" packages, rewrite any extensions they declare as "provide"d to "replace" - // using "provide" will otherwise cause the solver to get stuck on that package from the repository, if it exists, even if it conflicts with other rules (e.g. PHP versions) and could fall back onto that polyfill packge - // example: alcaeus/mongo-php-adapter provides "ext-mongo", but installing it together with a PHP 7 requirement will fail, as ext-mongo is only available for PHP 5, and the solver never uses "alcaeus/mongo-php-adapter" as the solution for "ext-mongo" unless it specifies "ext-mongo" in "replace", which it shouldn't, as it's a polyfill (that will quietly let the real extension take over if it's present, e.g. on PHP 5 environments), and not a replacement for the extension - // we do not want to do this for all packages that so declare their "provide"s, because many polyfills are just an incomplete or slower fallback (e.g. Symfony mbstring with only UTF-8 support, or intl which is slower than native C ICU bindings), and it's rare that extensions are only available for certain versions of a runtime - // see https://github.com/composer/composer/issues/6753 - if(in_array($package["name"], ["alcaeus/mongo-php-adapter"])) { - $prep = $prep + array_filter($ppro, function($k) { return strpos($k, "ext-") === 0; }, ARRAY_FILTER_USE_KEY); - $ppro = array_diff_key($ppro, $prep); - } - $have_runtime_req |= hasreq($preq); - $metapaks[] = [ - "type" => "metapackage", - // we re-use the dep name and version, makes for nice error messages if dependencies cannot be fulfilled :) - "name" => $package["name"], - "version" => $package["version"], - "require" => mkdep($preq), - "replace" => mkdep($prep), - "provide" => mkdep($ppro), - "conflict" => mkdep($pcon), - ]; - return true; -} - -// remove first arg (0) -array_shift($argv); -// base repos we need - no packagist, and the installer plugin path (first arg) -$repositories = [ - ["packagist" => false], - ["type" => "path", "url" => array_shift($argv), "options" => ["symlink" => false]], -]; -// all other args are repo URLs; they get passed in ascending order of precedence, so we reverse -foreach(array_reverse($argv) as $repo) $repositories[] = ["type" => "composer", "url" => $repo]; - -$json = json_decode(file_get_contents($COMPOSER), true); -if(!is_array($json)) exit(1); - -$have_runtime_req = false; -$have_dev_runtime_req = false; -$require = []; -$requireDev = []; -if(file_exists($COMPOSER_LOCK)) { - $lock = json_decode(file_get_contents($COMPOSER_LOCK), true); - // basic lock file validity check - if(!$lock || !isset($lock["platform"], $lock["platform-dev"], $lock["packages"], $lock["packages-dev"])) exit(1); - if(!isset($lock["content-hash"]) && !isset($lock["hash"])) exit(1); - $have_runtime_req |= hasreq($lock["platform"]); - $have_dev_runtime_req |= hasreq($lock["platform-dev"]); - // for each package that has platform requirements we build a meta-package that we then depend on - // we cannot simply join all those requirements together with " " or "," because of the precedence of the "|" operator: requirements "5.*," and "^5.3.9|^7.0", which should lead to a PHP 5 install, would combine into "5.*,^5.3.9|^7.0" (there is no way to group requirements), and that would give PHP 7 - $metapaks = []; - // whatever is in the lock "platform" key will be turned into a meta-package too, named "composer.json/composer.lock"; same for "platform-dev" - // this will result in an installer event for that meta-package, from which we can extract what extensions that are bundled (and hence "replace"d) with the runtime need to be enabled - // if we do not do this, then a require for e.g. ext-curl or ext-mbstring in the main composer.json cannot be found by the installer plugin - $root = [ - "name" => "$COMPOSER/$COMPOSER_LOCK", - "version" => "dev-".($lock["content-hash"] ?? $lock['hash']), - "require" => $lock["platform"], - ]; - $rootDev = [ - "name" => "$COMPOSER/$COMPOSER_LOCK-require-dev", - "version" => "dev-".($lock["content-hash"] ?? $lock['hash']), - "require" => $lock["platform-dev"], - ]; - // inject the root meta-packages into the read lock file so later code picks them up too - if($root["require"]) { - $lock["packages"][] = $root; - $require = [ - $root["name"] => $root["version"], - ]; - $sfr = []; - // for any root platform require with implicit or explicit stability flags we must create a dummy require for that flag in the new root - // the reason is that the actual requiring of the package version happens in the "composer.json/composer.lock" metapackage, but stability flags that allow e.g. an RC install are ignored there - they only take effect in the root "require" section so that dependencies don't push unstable stuff onto users - foreach($lock["platform"] as $name => $version) { - if(isset($lock["stability-flags"][$name])) { - $sfr[$name] = getflag($lock["stability-flags"][$name]); - } - } - $require = array_merge($require, mkdep($sfr)); - } - // same for platform-dev requirements, but they go into a require-dev section later, so only installs with --dev pull those in - if($rootDev["require"]) { - $lock["packages-dev"][] = $rootDev; - $requireDev = [ - $rootDev["name"] => $rootDev["version"], - ]; - $sfr = []; - // for any root platform require-dev with implicit or explicit stability flags we must create a dummy require-dev for that flag in the new root - // the reason is that the actual requiring of the package version happens in the "composer.json/composer.lock" metapackage, but stability flags that allow e.g. an RC install are ignored there - they only take effect in the root "require-dev" section so that dependencies don't push unstable stuff onto users - foreach($lock["platform-dev"] as $name => $version) { - if(isset($lock["stability-flags"][$name])) { - $sfr[$name] = getflag($lock["stability-flags"][$name]); - } - } - $requireDev = array_merge($requireDev, mkdep($sfr)); - } - - // collect platform requirements from regular packages in lock file - foreach($lock["packages"] as $package) { - if(mkmetas($package, $metapaks, $have_runtime_req)) { - $require[$package["name"]] = $package["version"]; - } - } - // collect platform requirements from dev packages in lock file - foreach($lock["packages-dev"] as $package) { - if(mkmetas($package, $metapaks, $have_dev_runtime_req)) { - $requireDev[$package["name"]] = $package["version"]; - } - } - - // add all meta-packages to one local package repo - if($metapaks) $repositories[] = ["type" => "package", "package" => $metapaks]; -} - -// if no PHP or HHVM is required anywhere, we need to add something -if(!$have_runtime_req) { - if($have_dev_runtime_req) { - // there is no requirement for a PHP or HHVM version in "require", nor in any dependencies therein, but there is one in "require-dev" - // that's problematic, because requirements in there may effectively result in a rule like "7.0.*", but we'd next write "^5.5.17" into our "require" to have a sane default, and that'd blow up in CI where dev dependenies are installed - // we can't compute a resulting version rule (that's the whole point of the custom installer that uses Composer's solver), so throwing an error is the best thing we can do here - file_put_contents("php://stderr", "ERROR: neither your $COMPOSER 'require' section nor any\ndependency therein requires a runtime version, but 'require-dev'\nor a dependency therein does. Heroku cannot automatically select\na default runtime version in this case.\nPlease add a version requirement for 'php' to section 'require'\nin $COMPOSER, 'composer update', commit, and deploy again."); - exit(3); - } - file_put_contents("php://stderr", "NOTICE: No runtime required in $COMPOSER_LOCK; using PHP ". ($require["heroku-sys/php"] = "^5.5.17") . "\n"); -} elseif(!isset($root["require"]["php"]) && !isset($root["require"]["hhvm"])) { - file_put_contents("php://stderr", "NOTICE: No runtime required in $COMPOSER; requirements\nfrom dependencies in $COMPOSER_LOCK will be used for selection\n"); -} - -$require["heroku-sys/apache"] = "^2.4.10"; -$require["heroku-sys/nginx"] = "~1.8.0"; - -preg_match("#^([^-]+)(?:-([0-9]+))?\$#", $STACK, $stack); -$provide = ["heroku-sys/".$stack[1] => (isset($stack[2])?$stack[2]:"1").gmdate(".Y.m.d")]; # cedar: 14.2016.02.16 etc -$json = [ - "config" => ["cache-files-ttl" => 0, "discard-changes" => true], - "minimum-stability" => isset($lock["minimum-stability"]) ? $lock["minimum-stability"] : "stable", - "prefer-stable" => isset($lock["prefer-stable"]) ? $lock["prefer-stable"] : false, - "provide" => $provide, - "require" => $require, - // only write out require-dev if we're installing in CI, as indicated by the HEROKU_PHP_INSTALL_DEV set (to an empty string) - "require-dev" => getenv("HEROKU_PHP_INSTALL_DEV") === false ? (object)[] : (object)$requireDev, - // put require before repositories, or a large number of metapackages from above will cause Composer's regexes to hit PCRE limits for backtracking or JIT stack size - "repositories" => $repositories, -]; -echo json_encode($json, JSON_PRETTY_PRINT); diff --git a/vendor/heroku/heroku-buildpack-php/composer.json b/vendor/heroku/heroku-buildpack-php/composer.json deleted file mode 100644 index 81ea470..0000000 --- a/vendor/heroku/heroku-buildpack-php/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "heroku/heroku-buildpack-php", - "description": "Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP/HHVM and Apache2/Nginx as on Heroku", - "keywords": ["heroku", "foreman", "php", "hhvm", "apache", "apache2", "nginx"], - "homepage": "https://github.com/heroku/heroku-buildpack-php", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "David Zuelke", - "email": "dz@heroku.com" - } - ], - "bin": [ - "bin/heroku-hhvm-apache2", - "bin/heroku-hhvm-nginx", - "bin/heroku-php-apache2", - "bin/heroku-php-nginx" - ] -} diff --git a/vendor/heroku/heroku-buildpack-php/conf/apache2/default_include.conf b/vendor/heroku/heroku-buildpack-php/conf/apache2/default_include.conf deleted file mode 100644 index e2d575a..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/apache2/default_include.conf +++ /dev/null @@ -1 +0,0 @@ -DirectoryIndex index.php index.html index.htm diff --git a/vendor/heroku/heroku-buildpack-php/conf/apache2/heroku.conf b/vendor/heroku/heroku-buildpack-php/conf/apache2/heroku.conf deleted file mode 100644 index 3e9f5e5..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/apache2/heroku.conf +++ /dev/null @@ -1,70 +0,0 @@ -# define a short-hand to our fcgi proxy, for convenience -# Define heroku-fcgi fcgi://127.0.0.1:4999 -Define heroku-fcgi unix:/tmp/heroku.fcgi.${PORT}.sock|fcgi://heroku-fcgi - -# make sure the proxy is registered with the unix socket; we can then use just "fcgi://heroku-fcgi" in proxy and rewrites directives -# we have to do this because we can't rewrite to a UDS location and because PHP doesn't support the unix:...|fcgi://... syntax -# this is also a lot more convenient for users -# http://thread.gmane.org/gmane.comp.apache.devel/52892 - - # we must declare a parameter in here or it'll not register the proxy ahead of time - # min=0 is an obvious candidate since that's the default value already and sensible - ProxySet min=0 - - -Listen ${PORT} - - - - ServerName localhost - - ErrorLog /tmp/heroku.apache2_error.${PORT}.log - # redefine "combined" log format so includes can overwrite it - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" heroku - CustomLog /tmp/heroku.apache2_access.${PORT}.log heroku - - TraceEnable off - - - # lock it down fully by default - # if it's also the docroot, it'll be opened up again further below - Require all denied - - # explicitly deny these again, merged with the docroot later - Require all denied - - - # handle these separately; who knows where they are and whether they're accessible - - Require all denied - - - Require all denied - - - DocumentRoot "${DOCUMENT_ROOT}" - - - Options FollowSymLinks - - # allow .htaccess to do everything - AllowOverride All - - # no limits - Require all granted - - - # mod_proxy doesn't forward the Authorization header, must fix that ourselves - SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1 - - # pass requests to .php files to mod_proxy_fcgi - # this requires Apache 2.4.10+ and PHP 5.5.15+ to work properly - - # make sure the file exists so that if not, Apache will show its 404 page and not FPM - SetHandler proxy:fcgi://heroku-fcgi - - - - Include "${HEROKU_PHP_HTTPD_CONFIG_INCLUDE}" - - diff --git a/vendor/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php b/vendor/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php deleted file mode 100644 index ad789f5..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/hhvm/php.ini.php +++ /dev/null @@ -1,16 +0,0 @@ -; php options -date.timezone = UTC -expose_php = off - -; hhvm specific -hhvm.log.level = Warning -hhvm.log.always_log_unhandled_exceptions = true -hhvm.log.runtime_error_reporting_level = 8191 -hhvm.mysql.typed_results = false - -memory_limit = 128M - -; hhvm fcgi -hhvm.server.type = fastcgi -hhvm.server.file_socket = /tmp/heroku.fcgi..sock -hhvm.server.thread_count = diff --git a/vendor/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php b/vendor/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php deleted file mode 100644 index 23135a5..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/nginx/default_include.conf.php +++ /dev/null @@ -1,8 +0,0 @@ -location / { - index index.php index.html index.htm; -} - -# for people with app root as doc root, restrict access to a few things -location ~ ^/(composer\.|Procfile$|/|/) { - deny all; -} diff --git a/vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php b/vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php deleted file mode 100644 index 4a044ba..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/nginx/heroku.conf.php +++ /dev/null @@ -1,72 +0,0 @@ -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - - #gzip on; - - server_tokens off; - - fastcgi_buffers 256 4k; - - # define an easy to reference name that can be used in fastgi_pass - upstream heroku-fcgi { - #server 127.0.0.1:4999 max_fails=3 fail_timeout=3s; - server unix:/tmp/heroku.fcgi..sock max_fails=3 fail_timeout=3s; - keepalive 16; - } - - server { - # define an easy to reference name that can be used in try_files - location @heroku-fcgi { - include fastcgi_params; - - fastcgi_split_path_info ^(.+\.php)(/.*)$; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - # try_files resets $fastcgi_path_info, see http://trac.nginx.org/nginx/ticket/321, so we use the if instead - fastcgi_param PATH_INFO $fastcgi_path_info if_not_empty; - - if (!-f $document_root$fastcgi_script_name) { - # check if the script exists - # otherwise, /foo.jpg/bar.php would get passed to FPM, which wouldn't run it as it's not in the list of allowed extensions, but this check is a good idea anyway, just in case - return 404; - } - - fastcgi_pass heroku-fcgi; - } - - # TODO: use X-Forwarded-Host? http://comments.gmane.org/gmane.comp.web.nginx.english/2170 - server_name localhost; - listen ; - # FIXME: breaks redirects with foreman - port_in_redirect off; - - root ""; - - error_log stderr; - access_log /tmp/heroku.nginx_access..log; - - include ""; - - # restrict access to hidden files, just in case - location ~ /\. { - deny all; - } - - # default handling of .php - location ~ \.php { - try_files @heroku-fcgi @heroku-fcgi; - } - } -} diff --git a/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf b/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf deleted file mode 100644 index e08cc34..0000000 --- a/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf +++ /dev/null @@ -1,533 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;; -; FPM Configuration ; -;;;;;;;;;;;;;;;;;;;;; - -; All relative paths in this configuration file are relative to PHP's install -; prefix (/app/.heroku/php). This prefix can be dynamically changed by using the -; '-p' argument from the command line. - -; Include one or more files. If glob(3) exists, it is used to include a bunch of -; files from a glob(3) pattern. This directive can be used everywhere in the -; file. -; Relative path can also be used. They will be prefixed by: -; - the global prefix if it's been set (-p argument) -; - /app/.heroku/php otherwise -;include=etc/fpm.d/*.conf - -;;;;;;;;;;;;;;;;;; -; Global Options ; -;;;;;;;;;;;;;;;;;; - -[global] -; Pid file -; Note: the default prefix is /app/.heroku/php/var -; Default Value: none -;pid = run/php-fpm.pid - -; Error log file -; If it's set to "syslog", log is sent to syslogd instead of being written -; in a local file. -; Note: the default prefix is /app/.heroku/php/var -; Default Value: log/php-fpm.log -error_log = /tmp/heroku.php-fpm.${PORT}.log - -; syslog_facility is used to specify what type of program is logging the -; message. This lets syslogd specify that messages from different facilities -; will be handled differently. -; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) -; Default Value: daemon -;syslog.facility = daemon - -; syslog_ident is prepended to every message. If you have multiple FPM -; instances running on the same server, you can change the default value -; which must suit common needs. -; Default Value: php-fpm -;syslog.ident = php-fpm - -; Log level -; Possible Values: alert, error, warning, notice, debug -; Default Value: notice -log_level = warning - -; If this number of child processes exit with SIGSEGV or SIGBUS within the time -; interval set by emergency_restart_interval then FPM will restart. A value -; of '0' means 'Off'. -; Default Value: 0 -;emergency_restart_threshold = 0 - -; Interval of time used by emergency_restart_interval to determine when -; a graceful restart will be initiated. This can be useful to work around -; accidental corruptions in an accelerator's shared memory. -; Available Units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -;emergency_restart_interval = 0 - -; Time limit for child processes to wait for a reaction on signals from master. -; Available units: s(econds), m(inutes), h(ours), or d(ays) -; Default Unit: seconds -; Default Value: 0 -;process_control_timeout = 0 - -; The maximum number of processes FPM will fork. This has been design to control -; the global number of processes when using dynamic PM within a lot of pools. -; Use it with caution. -; Note: A value of 0 indicates no limit -; Default Value: 0 -; process.max = 128 - -; Specify the nice(2) priority to apply to the master process (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool process will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. -; Default Value: yes -daemonize = no - -; Set open file descriptor rlimit for the master process. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit for the master process. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Specify the event mechanism FPM will use. The following is available: -; - select (any POSIX os) -; - poll (any POSIX os) -; - epoll (linux >= 2.5.44) -; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) -; - /dev/poll (Solaris >= 7) -; - port (Solaris >= 10) -; Default Value: not set (auto detection) -;events.mechanism = epoll - -; When FPM is build with systemd integration, specify the interval, -; in second, between health report notification to systemd. -; Set to 0 to disable. -; Available Units: s(econds), m(inutes), h(ours) -; Default Unit: seconds -; Default value: 10 -;systemd_interval = 10 - -;;;;;;;;;;;;;;;;;;;; -; Pool Definitions ; -;;;;;;;;;;;;;;;;;;;; - -; Multiple pools of child processes may be started with different listening -; ports and different management options. The name of the pool will be -; used in logs and stats. There is no limitation on the number of pools which -; FPM can handle. Your system will tell you anyway :) - -; Start a new pool named 'www'. -; the variable $pool can we used in any directive and will be replaced by the -; pool name ('www' here) -[www] - -; Per pool prefix -; It only applies on the following directives: -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /app/.heroku/php) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = nobody -;group = nobody - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses on a -; specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -; listen = 127.0.0.1:4999 -listen = /tmp/heroku.fcgi.${PORT}.sock - -; Set listen(2) backlog. -; Default Value: 65535 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 65535 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0666 -;listen.owner = nobody -;listen.group = nobody -;listen.mode = 0666 - -; List of ipv4 addresses of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; priority = -19 - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = static - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = ${WEB_CONCURRENCY} - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -;pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: ${prefix}/share/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -slowlog = /tmp/heroku.php-fpm.${PORT}.www.slowlog - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_terminate_timeout = 0 - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -;chdir = /var/www - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /app/.heroku/php) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M - -; log PHP errors to a file, otherwise they're bubbled up through FPM via stderr -php_value[error_log] = /tmp/heroku.php-fpm.www.${PORT}.log - -include=${HEROKU_PHP_FPM_CONFIG_INCLUDE} diff --git a/vendor/heroku/heroku-buildpack-php/requirements.txt b/vendor/heroku/heroku-buildpack-php/requirements.txt deleted file mode 100644 index 3e3754e..0000000 --- a/vendor/heroku/heroku-buildpack-php/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -bob-builder>=0.0.10 -s3cmd>=1.6.0 diff --git a/vendor/heroku/heroku-buildpack-php/support/build/README.md b/vendor/heroku/heroku-buildpack-php/support/build/README.md deleted file mode 100644 index 10b0785..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/README.md +++ /dev/null @@ -1,215 +0,0 @@ -# Building Custom Platform Packages and Repositories - -## Introduction - -**Please note that Heroku cannot provide support for issues related to custom platform repositories and packages.** - -### How it all works - -When an application is deployed, `bin/compile` extracts all platform dependencies from the application's `composer.lock` and constructs a new `composer.json` (with all package names prefixed with `heroku-sys/`, so `php` becomes `heroku-sys/php`), which gets `composer install`ed using a custom Composer repository. - -This `composer.json` gets written to `.heroku/php/` and is distinct from the application's `composer.json`. It only holds information on required platform packages. - -The custom Composer repository, running off an S3 bucket, provides all of these packages; the Composer installer plugin in `support/installer/` handles extraction, activation, configuration etc. - -### Custom platform packages and repositories - -To use custom platform packages (either new ones, or modifications of existing ones), a new Composer repository has to be created (see [the instructions in the main README](../../README.md#custom-platform-repositories) for usage info). All the tooling in here is designed to work with S3, since it is reliable and cheap. The bucket permissions should be set up so that a public listing is allowed. - -The folder `support/build` contains [Bob](http://github.com/kennethreitz/bob-builder) build formulae for all packages and their dependencies. - -These build formulae can have dependencies (e.g. an extension formula depends on the correct version of PHP needed to build it, and maybe on a vendored library); Bob handles downloading of dependencies prior to a build, and it's the responsibility of a build formula to remove these dependencies again if they're not needed e.g. in between running `make` and `make install`. - -The build formulae are also expected to generate a [manifest](#about-manifests), which is a `composer.json` containing all relevant information about a package. - -In `support/build/_util`, three scripts (`deploy.sh` to deploy a package with its [manifest](#about-manifests), `mkrepo.sh` to (re-)generate a [repository](#about-repositories) from all existing manifests, and `sync.sh` to [sync between repos](#syncing-repositories)) take care of most of the heavy lifting. - -## Preparations - -You may either build packages on a Heroku dyno, or locally using a Docker container. The instructions below use `heroku run`; simply replace them with the appropriate `docker run` call if you are using Docker. - -The following environment variables are required: - -- `WORKSPACE_DIR`, must be "`/app/support/build`" -- `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` with credentials for the S3 bucket -- `S3_BUCKET` with the name of the S3 bucket to use for builds -- `S3_PREFIX` (just a slash, or a prefix directory name **with a trailing, but no leading, slash**) -- `STACK` (currently, only "`cedar-14`" makes any sense) - -The following environment variables are highly recommended (see section *Understanding Upstream Buckets*): - -- `UPSTREAM_S3_BUCKET` where dependencies are pulled from if they can't be found in `S3_BUCKET+S3_PREFIX`, should probably be set to "`lang-php`", the official Heroku bucket -- `UPSTREAM_S3_PREFIX`, where dependencies are pulled from if they can't be found in `S3_BUCKET+S3_PREFIX` should probably be set to "`dist-cedar-14-stable/`", the official Heroku stable repository prefix for the [cedar-14 stack](https://devcenter.heroku.com/articles/stack#cedar). - -The following environment variables are optional: - -- `S3_REGION`, to be set to the AWS region name (e.g. "`s3-eu-west-1`") for any non-standard region, otherwise "`s3`" (for region "us-east-1") - -### Understanding Prefixes - -It is recommended to use a prefix like "`dist-cedar-14-develop/`" for `$S3_PREFIX`. The contents of this prefix will act as a development repository, where all building happens. The `support/build/_util/sync.sh` helper can later be used to synchronize to another prefix, e.g. "`dist-cedar-14-stable/`" that is used for production. For more info, see the [section on syncing repositories](#syncing-repositories) further below. - -### Understanding Upstream Buckets - -If you want to, for example, host only a few PECL extensions in a custom repository, your bucket would still have to contain the build-time dependencies for those extensions - that's PHP in its various versions. - -Due to the order in which Composer looks up packages from repositories, including PHP builds in your custom repositories may lead to those builds getting used on deploy, which is not what you want - you want to use Heroku's official PHP builds, but still have access to your custom-built extensions. - -That's where the `UPSTREAM_S3_BUCKET` and `UPSTREAM_S3_PREFIX` env vars come into play; you'll usually set them to "`lang-php`" and "`dist-cedar-14-stable/`", respectively. - -That way, if your Bob formula for an extension contains e.g. this dependency declaration at the top: - - # Build Path: /app/.heroku/php/ - # Build Deps: php-7.0.4 - -then on build, Bob will first look for "`php-7.0.4`" in your S3 bucket, and then fall back to pulling it from the upstream bucket. This frees you of the burden of hosting and maintaining unnecessary packages yourself. - -### Build Environment Setup - -#### Using Heroku - -To get started, create a Python app (*Bob* is a Python application) on Heroku inside a clone of this repository, and set your S3 config vars: - - $ heroku create --buildpack heroku/python - $ heroku config:set WORKSPACE_DIR=/app/support/build - $ heroku config:set AWS_ACCESS_KEY_ID= - $ heroku config:set AWS_SECRET_ACCESS_KEY= - $ heroku config:set S3_BUCKET= - $ heroku config:set S3_PREFIX= - $ heroku config:set UPSTREAM_S3_BUCKET=lang-php - $ heroku config:set UPSTREAM_S3_PREFIX=dist-cedar-14-stable/ - $ heroku config:set STACK=cedar-14 - $ git push heroku master - $ heroku ps:scale web=0 - -#### Using Docker - -Refer to the [README in `support/build/_docker/`](_docker/README.md) for setup instructions. - -## Building a Package - -To verify a formula, `bob build` can be used to build it: - - $ heroku run bash - Running `bash` attached to terminal... up, run.6880 - ~ $ bob build extensions/no-debug-non-zts-20121212/yourextension-1.2.3 - - Fetching dependencies... found 1: - - php-5.5.31 - Building formula extensions/no-debug-non-zts-20121212/yourextension-1.2.3 - ... - -If that works, a `bob deploy` would build it first, and then upload it to your bucket (you can specify `--overwrite` to overwrite existing packages). - -However, that alone is not enough - the *manifest* needs to be in place as well, and using that manifest, you can then generate a Composer repository metadata file. - -The next two sections contain important info about manifests and repositories; the *tl;dr* is: **do not use `bob deploy`, but `support/build/_util/deploy.sh`, to deploy a package**, because it will take care of manifest uploading: - - $ support/build/_util/deploy.sh extensions/no-debug-non-zts-20121212/yourextension-1.2.3 - -In addition to an `--overwrite` option, the `deploy.sh` script also accepts a `--publish` option that will cause the package to immediately be published into the repository by [re-generating that repo](#re-generating-repositories). **This should be used with caution**, as several parallel `deploy.sh` invocations could result in a race condition when re-generating the repository. - -## About Manifests - -After a `bob build` or `bob deploy`, you'll be prompted to upload a manifest. It obviously only makes sense to perform this upload after a `bob deploy`. - -To perform the deploy and the manifest upload in one step, **the `deploy.sh` utility in `support/build/_util/` should be used instead of `bob deploy`**: - - $ support/build/_util/deploy.sh extensions/no-debug-non-zts-20121212/yourextension-1.2.3 - -This will upload the manifest to the S3 bucket if the package build and deploy succeeded. Like `bob deploy`, this script accepts a `--overwrite` flag. - -The manifest is a `composer.json` specific to your built package, and it is **unrelated to Bob**, the utility that performs the builds. All manifests of your bucket together need to be combined into a [repository](#about-repositories). - -All packages in the official Heroku S3 bucket use manifests, even for packages that are not exposed as part of the repository, such as library dependencies, the minimal PHP used for bootstrapping a build, or Composer. - -### Manifest Contents - -A manifest looks roughly like this (example is for `ext-apcu/5.1.3` for PHP 7): - - { - "conflict": { - "heroku-sys/hhvm": "*" - }, - "dist": { - "type": "heroku-sys-tar", - "url": "https://lang-php.s3.amazonaws.com/dist-cedar-14-stable/extensions/no-debug-non-zts-20151012/apcu-5.1.3.tar.gz" - }, - "name": "heroku-sys/ext-apcu", - "require": { - "heroku-sys/cedar": "^14.0.0", - "heroku-sys/php": "7.0.*", - "heroku/installer-plugin": "^1.2.0" - }, - "time": "2016-02-16 01:18:50", - "type": "heroku-sys-php-extension", - "version": "5.1.3" - } - -Package `name`s must be prefixed with "`heroku-sys/`". Possible `type`s are `heroku-sys-php`, `heroku-sys-hhvm`, `heroku-sys-php-extension` or `heroku-sys-webserver`. The `dist` type must be "`heroku-sys-tar`". If the package is a `heroku-sys-php-extension`, it's important to specify a `conflict` with "`heroku-sys/hhvm`". - -The special package type `heroku-sys-php-package` is used for generic packages that should not be available to applications during app deploys (such as vendored libraries used to build PHP or an extension). - -The `require`d package `heroku/installer-plugin` will be available during install. Package `heroku-sys/cedar` is a virtual package `provide`d by the platform `composer.json` generated in `bin/compile` and has the right stack version; the selector for `heroku-sys/php` ensures that the package only applies to PHP 7.0.x. - -### Manifest Helpers - -All formulae use the `manifest.py` helper to generate the information above. **Use it for maximum reliability!** You can take a look at the existing formulae and the script to get a feeling for how it works. - -## About Repositories - -The repository is a `packages.json` of all manifests, which can be used by Composer as a `packagist` repository type. See [Usage in Applications](#usage-in-applications) for instructions on how to use such a repository with an application. - -**Important: due to a limitation of Composer, extensions of identical version but for different PHP versions must be ordered within the repository in descending PHP version order, i.e. `ext-mongodb:1.1.2` for `php:7.0.*` must appear before `ext-mongodb:1.1.2` for `php:5.6.*`. Otherwise, deploys may select a lower PHP version than possible. The `mkrepo.sh` script takes care of this ordering.** - -### (Re-)generating Repositories - -The normal flow is to run `support/build/_util/deploy.sh` first to deploy one or more packages, and then to use `support/build/_util/mkrepo.sh` to re-generate the repo: - - $ support/build/_util/mkrepo.sh --upload - -This will generate `packages.json` and upload it right away, or, if the `--upload` is not given, print upload instructions for `s3cmd`. - -Alternatively, `deploy.sh` can be called with `--publish` as the first argument, in which case `mkrepo.sh --upload` will be called after the package deploy and manifest upload was successful: - - $ support/build/_util/deploy.sh --publish php-6.0.0 - -**This should be used with caution, as several parallel `deploy.sh` invocations could result in a race condition when re-generating the repository.** - -### Syncing Repositories - -It is often desirable to have a bucket with two repositories under different prefixes, e.g. `dist-cedar-14-develop/` and `dist-cedar-14-stable/`, with the latter usually used by apps for deploys. The "develop" bucket prefix would be set via `S3_PREFIX` on the Heroku package builder app or Docker container, so all builds would always end up there. - -After testing builds, the contents of that "develop" repository can then be synced to "stable" using `support/build/_util/sync.sh`: - - $ support/build/_util/sync.sh my-bucket dist-cedar-14-stable/ my-bucket dist-cedar-14-develop/ - -*The `sync.sh` script takes destination bucket info as arguments first, then source bucket info*. - -The `sync.sh` script automatically detects additions, updates and removals based on manifests. It will also warn if the source `packages.json` is not up to date with its manifests, and prompt for confirmation before syncing. - -#### Syncing from Upstream - -You will usually use an [Upstream Bucket](#understanding-upstream-buckets) to ensure that Bob will pull dependencies from Heroku's official bucket without having to worry about maintaining packages up the dependency tree, such as library or PHP prerequsites for an extension. - -However, in rare circumstances, such as when you want to fully host all platform packages including PHP yourself and have the official repository disabled for your app, you either need to build all packages from scratch, or sync the Heroku builds from the official repository: - - $ heroku run "support/build/_util/sync.sh $S3_BUCKET $S3_PREFIX $UPSTREAM_S3_BUCKET $UPSTREAM_S3_PREFIX" - -### Removing Packages - -The `support/build/_util/remove.sh` helper removes a package manifest and its tarball from a bucket, and re-generates the repository. It accepts one or more names of a JSON manifest file from the bucket (optionally without "`.composer.json`" suffix) as arguments: - - $ support/build/_util/remove.sh ext-imagick-3.3.0_php-5.5.composer.json ext-imagick-3.3.0_php-5.6.composer.json - -Unless the `--no-publish` option is given, the repository will be re-generated immediately after removal. Otherwise, the manifests and tarballs would be removed, but the main repository would remain in place, pointing to non-existing packages, so usage of this flag is only recommended for debugging purposes or similar. - -## Usage in Applications - -Please refer to [the instructions in the main README](../../README.md#custom-platform-repositories) for details on how to use a custom repository during application builds. - -## Tips & Tricks - -- To speed things up drastically during compilation, it'll usually be a good idea to `heroku run bash --size Performance-L`. -- All manifests generated by Bob formulas, by `support/build/_util/mkrepo.sh` and by `support/build/_util/sync.sh` use an S3 region of "s3" by default, so resulting URLs look like "`https://your-bucket.s3.amazonaws.com/your-prefix/...`". You can `heroku config:set S3_REGION` to change "s3" to another region such as "s3-eu-west-1". -- If any dependencies are not yet deployed, you need to deploy them first, or use `UPSTREAM_S3_BUCKET` and `UPSTREAM_S3_PREFIX` (recommended). diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_conf/apache2/httpd.conf b/vendor/heroku/heroku-buildpack-php/support/build/_conf/apache2/httpd.conf deleted file mode 100644 index 64819de..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_conf/apache2/httpd.conf +++ /dev/null @@ -1,527 +0,0 @@ -# -# This is the main Apache HTTP server configuration file. It contains the -# configuration directives that give the server its instructions. -# See for detailed information. -# In particular, see -# -# for a discussion of each configuration directive. -# -# Do NOT simply read the instructions in here without understanding -# what they do. They're here only as hints or reminders. If you are unsure -# consult the online docs. You have been warned. -# -# Configuration and logfile names: If the filenames you specify for many -# of the server's control files begin with "/" (or "drive:/" for Win32), the -# server will use that explicit path. If the filenames do *not* begin -# with "/", the value of ServerRoot is prepended -- so "logs/access_log" -# with ServerRoot set to "/usr/local/apache2" will be interpreted by the -# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" -# will be interpreted as '/logs/access_log'. - -# -# ServerRoot: The top of the directory tree under which the server's -# configuration, error, and log files are kept. -# -# Do not add a slash at the end of the directory path. If you point -# ServerRoot at a non-local disk, be sure to specify a local disk on the -# Mutex directive, if file-based mutexes are used. If you wish to share the -# same ServerRoot for multiple httpd daemons, you will need to change at -# least PidFile. -# -ServerRoot "/app/.heroku/php/" - -# -# Mutex: Allows you to set the mutex mechanism and mutex file directory -# for individual mutexes, or change the global defaults -# -# Uncomment and change the directory if mutexes are file-based and the default -# mutex file directory is not on a local disk or is not appropriate for some -# other reason. -# -# Mutex default:var/apache2/run - -# -# Listen: Allows you to bind Apache to specific IP addresses and/or -# ports, instead of the default. See also the -# directive. -# -# Change this to Listen on specific IP addresses as shown below to -# prevent Apache from glomming onto all bound IP addresses. -# -#Listen 12.34.56.78:80 -#Listen ${PORT} - -# -# Dynamic Shared Object (DSO) Support -# -# To be able to use the functionality of a module which was built as a DSO you -# have to place corresponding `LoadModule' lines at this location so the -# directives contained in it are actually available _before_ they are used. -# Statically compiled modules (those listed by `httpd -l') do not need -# to be loaded here. -# -# Example: -# LoadModule foo_module modules/mod_foo.so -# -LoadModule authn_file_module libexec/mod_authn_file.so -#LoadModule authn_dbm_module libexec/mod_authn_dbm.so -#LoadModule authn_anon_module libexec/mod_authn_anon.so -#LoadModule authn_dbd_module libexec/mod_authn_dbd.so -#LoadModule authn_socache_module libexec/mod_authn_socache.so -LoadModule authn_core_module libexec/mod_authn_core.so -LoadModule authz_host_module libexec/mod_authz_host.so -LoadModule authz_groupfile_module libexec/mod_authz_groupfile.so -LoadModule authz_user_module libexec/mod_authz_user.so -#LoadModule authz_dbm_module libexec/mod_authz_dbm.so -#LoadModule authz_owner_module libexec/mod_authz_owner.so -#LoadModule authz_dbd_module libexec/mod_authz_dbd.so -LoadModule authz_core_module libexec/mod_authz_core.so -LoadModule access_compat_module libexec/mod_access_compat.so -LoadModule auth_basic_module libexec/mod_auth_basic.so -#LoadModule auth_form_module libexec/mod_auth_form.so -#LoadModule auth_digest_module libexec/mod_auth_digest.so -#LoadModule allowmethods_module libexec/mod_allowmethods.so -#LoadModule file_cache_module libexec/mod_file_cache.so -#LoadModule cache_module libexec/mod_cache.so -#LoadModule cache_disk_module libexec/mod_cache_disk.so -#LoadModule cache_socache_module libexec/mod_cache_socache.so -#LoadModule socache_shmcb_module libexec/mod_socache_shmcb.so -#LoadModule socache_dbm_module libexec/mod_socache_dbm.so -#LoadModule socache_memcache_module libexec/mod_socache_memcache.so -#LoadModule watchdog_module libexec/mod_watchdog.so -#LoadModule macro_module libexec/mod_macro.so -#LoadModule dbd_module libexec/mod_dbd.so -#LoadModule dumpio_module libexec/mod_dumpio.so -#LoadModule echo_module libexec/mod_echo.so -#LoadModule buffer_module libexec/mod_buffer.so -#LoadModule data_module libexec/mod_data.so -#LoadModule ratelimit_module libexec/mod_ratelimit.so -LoadModule reqtimeout_module libexec/mod_reqtimeout.so -#LoadModule ext_filter_module libexec/mod_ext_filter.so -#LoadModule request_module libexec/mod_request.so -#LoadModule include_module libexec/mod_include.so -LoadModule filter_module libexec/mod_filter.so -#LoadModule reflector_module libexec/mod_reflector.so -#LoadModule substitute_module libexec/mod_substitute.so -#LoadModule sed_module libexec/mod_sed.so -#LoadModule charset_lite_module libexec/mod_charset_lite.so -LoadModule deflate_module libexec/mod_deflate.so -LoadModule xml2enc_module libexec/mod_xml2enc.so -LoadModule proxy_html_module libexec/mod_proxy_html.so -LoadModule mime_module libexec/mod_mime.so -LoadModule log_config_module libexec/mod_log_config.so -#LoadModule log_debug_module libexec/mod_log_debug.so -#LoadModule log_forensic_module libexec/mod_log_forensic.so -#LoadModule logio_module libexec/mod_logio.so -LoadModule env_module libexec/mod_env.so -#LoadModule mime_magic_module libexec/mod_mime_magic.so -LoadModule expires_module libexec/mod_expires.so -LoadModule headers_module libexec/mod_headers.so -#LoadModule usertrack_module libexec/mod_usertrack.so -#LoadModule unique_id_module libexec/mod_unique_id.so -LoadModule setenvif_module libexec/mod_setenvif.so -LoadModule version_module libexec/mod_version.so -LoadModule remoteip_module libexec/mod_remoteip.so -LoadModule proxy_module libexec/mod_proxy.so -#LoadModule proxy_connect_module libexec/mod_proxy_connect.so -#LoadModule proxy_ftp_module libexec/mod_proxy_ftp.so -LoadModule proxy_http_module libexec/mod_proxy_http.so -LoadModule proxy_fcgi_module libexec/mod_proxy_fcgi.so -#LoadModule proxy_scgi_module libexec/mod_proxy_scgi.so -#LoadModule proxy_fdpass_module libexec/mod_proxy_fdpass.so -LoadModule proxy_wstunnel_module libexec/mod_proxy_wstunnel.so -#LoadModule proxy_ajp_module libexec/mod_proxy_ajp.so -#LoadModule proxy_balancer_module libexec/mod_proxy_balancer.so -#LoadModule proxy_express_module libexec/mod_proxy_express.so -#LoadModule session_module libexec/mod_session.so -#LoadModule session_cookie_module libexec/mod_session_cookie.so -#LoadModule session_dbd_module libexec/mod_session_dbd.so -#LoadModule slotmem_shm_module libexec/mod_slotmem_shm.so -#LoadModule slotmem_plain_module libexec/mod_slotmem_plain.so -LoadModule ssl_module libexec/mod_ssl.so -#LoadModule dialup_module libexec/mod_dialup.so -LoadModule lbmethod_byrequests_module libexec/mod_lbmethod_byrequests.so -LoadModule lbmethod_bytraffic_module libexec/mod_lbmethod_bytraffic.so -LoadModule lbmethod_bybusyness_module libexec/mod_lbmethod_bybusyness.so -LoadModule lbmethod_heartbeat_module libexec/mod_lbmethod_heartbeat.so -LoadModule unixd_module libexec/mod_unixd.so -#LoadModule heartbeat_module libexec/mod_heartbeat.so -#LoadModule heartmonitor_module libexec/mod_heartmonitor.so -#LoadModule dav_module libexec/mod_dav.so -LoadModule status_module libexec/mod_status.so -LoadModule autoindex_module libexec/mod_autoindex.so -#LoadModule asis_module libexec/mod_asis.so -#LoadModule info_module libexec/mod_info.so -#LoadModule cgid_module libexec/mod_cgid.so -#LoadModule dav_fs_module libexec/mod_dav_fs.so -#LoadModule dav_lock_module libexec/mod_dav_lock.so -#LoadModule vhost_alias_module libexec/mod_vhost_alias.so -#LoadModule negotiation_module libexec/mod_negotiation.so -LoadModule dir_module libexec/mod_dir.so -#LoadModule actions_module libexec/mod_actions.so -#LoadModule speling_module libexec/mod_speling.so -#LoadModule userdir_module libexec/mod_userdir.so -LoadModule alias_module libexec/mod_alias.so -LoadModule rewrite_module libexec/mod_rewrite.so - - - # special treatment for Apache < 2.4.10 so we can SetHandler to mod_proxy_fcgi - # taken from https://gist.github.com/progandy/6ed4eeea60f6277c3e39 - # the functionality is included in Apache 2.4.10+ - LoadModule proxy_handler_module libexec/mod_proxy_handler.so - - - -# -# If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. -# -# User/Group: The name (or #number) of the user/group to run httpd as. -# It is usually good practice to create a dedicated user and group for -# running httpd, as with most system services. -# -User daemon -Group daemon - - - -# 'Main' server configuration -# -# The directives in this section set up the values used by the 'main' -# server, which responds to any requests that aren't handled by a -# definition. These values also provide defaults for -# any containers you may define later in the file. -# -# All of these directives may appear inside containers, -# in which case these default settings will be overridden for the -# virtual host being defined. -# - -# -# ServerAdmin: Your address, where problems with the server should be -# e-mailed. This address appears on some server-generated pages, such -# as error documents. e.g. admin@your-domain.com -# -ServerAdmin you@example.com - -# -# ServerName gives the name and port that the server uses to identify itself. -# This can often be determined automatically, but we recommend you specify -# it explicitly to prevent problems during startup. -# -# If your host doesn't have a registered DNS name, enter its IP address here. -# -ServerName localhost - -# -# Deny access to the entirety of your server's filesystem. You must -# explicitly permit access to web content directories in other -# blocks below. -# - - AllowOverride none - Require all denied - - -# -# Note that from this point forward you must specifically allow -# particular features to be enabled - so if something's not working as -# you might expect, make sure that you have specifically enabled it -# below. -# - -# -# DocumentRoot: The directory out of which you will serve your -# documents. By default, all requests are taken from this directory, but -# symbolic links and aliases may be used to point to other locations. -# -DocumentRoot "/app/.heroku/php//share/apache2/htdocs" - - # - # Possible values for the Options directive are "None", "All", - # or any combination of: - # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews - # - # Note that "MultiViews" must be named *explicitly* --- "Options All" - # doesn't give it to you. - # - # The Options directive is both complicated and important. Please see - # http://httpd.apache.org/docs/2.4/mod/core.html#options - # for more information. - # - Options Indexes FollowSymLinks - - # - # AllowOverride controls what directives may be placed in .htaccess files. - # It can be "All", "None", or any combination of the keywords: - # AllowOverride FileInfo AuthConfig Limit - # - AllowOverride None - - # - # Controls who can get stuff from this server. - # - Require all denied - - -# -# DirectoryIndex: sets the file that Apache will serve if a directory -# is requested. -# - - DirectoryIndex index.html - - -# -# The following lines prevent .htaccess and .htpasswd files from being -# viewed by Web clients. -# - - Require all denied - - -# -# ErrorLog: The location of the error log file. -# If you do not specify an ErrorLog directive within a -# container, error messages relating to that virtual host will be -# logged here. If you *do* define an error logfile for a -# container, that host's errors will be logged there and not here. -# -ErrorLog "var/apache2/log/error_log" - -# -# LogLevel: Control the number of messages logged to the error_log. -# Possible values include: debug, info, notice, warn, error, crit, -# alert, emerg. -# -LogLevel warn - - - # - # The following directives define some format nicknames for use with - # a CustomLog directive (see below). - # - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%h %l %u %t \"%r\" %>s %b" common - - - # You need to enable mod_logio.c to use %I and %O - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio - - - # - # The location and format of the access logfile (Common Logfile Format). - # If you do not define any access logfiles within a - # container, they will be logged here. Contrariwise, if you *do* - # define per- access logfiles, transactions will be - # logged therein and *not* in this file. - # - CustomLog "var/apache2/log/access_log" common - - # - # If you prefer a logfile with access, agent, and referer information - # (Combined Logfile Format) you can use the following directive. - # - #CustomLog "var/apache2/log/access_log" combined - - - - # - # Redirect: Allows you to tell clients about documents that used to - # exist in your server's namespace, but do not anymore. The client - # will make a new request for the document at its new location. - # Example: - # Redirect permanent /foo http://www.example.com/bar - - # - # Alias: Maps web paths into filesystem paths and is used to - # access content that does not live under the DocumentRoot. - # Example: - # Alias /webpath /full/filesystem/path - # - # If you include a trailing / on /webpath then the server will - # require it to be present in the URL. You will also likely - # need to provide a section to allow access to - # the filesystem path. - - # - # ScriptAlias: This controls which directories contain server scripts. - # ScriptAliases are essentially the same as Aliases, except that - # documents in the target directory are treated as applications and - # run by the server when requested rather than as documents sent to the - # client. The same rules about trailing "/" apply to ScriptAlias - # directives as to Alias. - # - # ScriptAlias /cgi-bin/ "/app/.heroku/php//share/apache2/cgi-bin/" - - - - - # - # ScriptSock: On threaded servers, designate the path to the UNIX - # socket used to communicate with the CGI daemon of mod_cgid. - # - #Scriptsock cgisock - - -# -# "/app/.heroku/php//share/apache2/cgi-bin" should be changed to whatever your ScriptAliased -# CGI directory exists, if you have that configured. -# -# -# AllowOverride None -# Options None -# Require all granted -# - - - # - # TypesConfig points to the file containing the list of mappings from - # filename extension to MIME-type. - # - TypesConfig etc/apache2/mime.types - - # - # AddType allows you to add to or override the MIME configuration - # file specified in TypesConfig for specific file types. - # - #AddType application/x-gzip .tgz - # - # AddEncoding allows you to have certain browsers uncompress - # information on the fly. Note: Not all browsers support this. - # - #AddEncoding x-compress .Z - #AddEncoding x-gzip .gz .tgz - # - # If the AddEncoding directives above are commented-out, then you - # probably should define those extensions to indicate media types: - # - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz - - # - # AddHandler allows you to map certain file extensions to "handlers": - # actions unrelated to filetype. These can be either built into the server - # or added with the Action directive (see below) - # - # To use CGI scripts outside of ScriptAliased directories: - # (You will also need to add "ExecCGI" to the "Options" directive.) - # - #AddHandler cgi-script .cgi - - # For type maps (negotiated resources): - #AddHandler type-map var - - # - # Filters allow you to process content before it is sent to the client. - # - # To parse .shtml files for server-side includes (SSI): - # (You will also need to add "Includes" to the "Options" directive.) - # - #AddType text/html .shtml - #AddOutputFilter INCLUDES .shtml - - -# -# The mod_mime_magic module allows the server to use various hints from the -# contents of the file itself to determine its type. The MIMEMagicFile -# directive tells the module where the hint definitions are located. -# -#MIMEMagicFile etc/apache2/magic - -# -# Customizable error responses come in three flavors: -# 1) plain text 2) local redirects 3) external redirects -# -# Some examples: -#ErrorDocument 500 "The server made a boo boo." -#ErrorDocument 404 /missing.html -#ErrorDocument 404 "/cgi-bin/missing_handler.pl" -#ErrorDocument 402 http://www.example.com/subscription_info.html -# - -# -# MaxRanges: Maximum number of Ranges in a request before -# returning the entire resource, or one of the special -# values 'default', 'none' or 'unlimited'. -# Default setting is to accept 200 Ranges. -#MaxRanges unlimited - -# -# EnableMMAP and EnableSendfile: On systems that support it, -# memory-mapping or the sendfile syscall may be used to deliver -# files. This usually improves server performance, but must -# be turned off when serving from networked-mounted -# filesystems or if support for these functions is otherwise -# broken on your system. -# Defaults: EnableMMAP On, EnableSendfile Off -# -#EnableMMAP off -#EnableSendfile on - -# Supplemental configuration -# -# The configuration files in the etc/apache2/extra/ directory can be -# included to add extra features or to modify the default configuration of -# the server, or you may simply copy their contents here and change as -# necessary. - -# Server-pool management (MPM specific) -#Include etc/apache2/extra/httpd-mpm.conf - -# Multi-language error messages -#Include etc/apache2/extra/httpd-multilang-errordoc.conf - -# Fancy directory listings -#Include etc/apache2/extra/httpd-autoindex.conf - -# Language settings -#Include etc/apache2/extra/httpd-languages.conf - -# User home directories -#Include etc/apache2/extra/httpd-userdir.conf - -# Real-time info on requests and configuration -#Include etc/apache2/extra/httpd-info.conf - -# Virtual hosts -#Include etc/apache2/extra/httpd-vhosts.conf - -# Local access to the Apache HTTP Server Manual -#Include etc/apache2/extra/httpd-manual.conf - -# Distributed authoring and versioning (WebDAV) -#Include etc/apache2/extra/httpd-dav.conf - -# Various default settings -#Include etc/apache2/extra/httpd-default.conf - -# Configure mod_proxy_html to understand HTML4/XHTML1 - -Include etc/apache2/extra/proxy-html.conf - - -# Secure (SSL/TLS) connections -#Include etc/apache2/extra/httpd-ssl.conf -# -# Note: The following must must be present to support -# starting without SSL on platforms with no /dev/random equivalent -# but a statically compiled-in mod_ssl. -# - -SSLRandomSeed startup builtin -SSLRandomSeed connect builtin - -# -# uncomment out the below to deal with user agents that deliberately -# violate open standards by misusing DNT (DNT *must* be a specific -# end-user choice) -# -# -#BrowserMatch "MSIE 10.0;" bad_DNT -# -# -#RequestHeader unset DNT env=bad_DNT -# - -ServerTokens Prod diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_conf/nginx/nginx.conf b/vendor/heroku/heroku-buildpack-php/support/build/_conf/nginx/nginx.conf deleted file mode 100644 index 49589ef..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_conf/nginx/nginx.conf +++ /dev/null @@ -1,36 +0,0 @@ - -#user nobody; -worker_processes auto; - -error_log stderr; -#error_log logs/error.log notice; -#error_log logs/error.log info; - -#pid logs/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - - #gzip on; - - server_tokens off; -} diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/conf.d/010-ext-zend_opcache.ini b/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/conf.d/010-ext-zend_opcache.ini deleted file mode 100644 index bf8db54..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/conf.d/010-ext-zend_opcache.ini +++ /dev/null @@ -1,7 +0,0 @@ -zend_extension=opcache.so -opcache.enable_cli=1 -opcache.validate_timestamps=0 -opcache.fast_shutdown=0 -opcache.memory_consumption=128 -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=4000 diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/php.ini b/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/php.ini deleted file mode 100644 index e0a2591..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_conf/php/php.ini +++ /dev/null @@ -1,1900 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (C:\windows or C:\winnt) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and Lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it's -; much more verbose when it comes to errors. We recommending using the -; development version only in development environments as errors shown to -; application users can inadvertently leak otherwise secure information. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; allow_call_time_pass_reference -; Default Value: On -; Development Value: Off -; Production Value: Off - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE -; Development Value: E_ALL | E_STRICT -; Production Value: E_ALL & ~E_DEPRECATED - -; html_errors -; Default Value: On -; Development Value: On -; Production value: Off - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; magic_quotes_gpc -; Default Value: On -; Development Value: Off -; Production Value: Off - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; register_long_arrays -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.bug_compat_42 -; Default Value: On -; Development Value: On -; Production Value: Off - -; session.bug_compat_warn -; Default Value: On -; Development Value: On -; Production Value: Off - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.hash_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; track_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; url_rewriter.tags -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -user_ini.cache_ttl = 86400 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It's been -; recommended for several years that you not use the short tag "short cut" and -; instead to use the full tag combination. With the wide spread use -; of XML and use of these tags by other languages, the server can become easily -; confused and end up parsing the wrong code in the wrong context. But because -; this short cut has been a feature for such a long time, it's currently still -; supported for backwards compatibility, but we recommend you don't use them. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/short-open-tag -short_open_tag = On - -; Allow ASP-style <% %> tags. -; http://php.net/asp-tags -asp_tags = Off - -; The number of significant digits displayed in floating point numbers. -; http://php.net/precision -precision = 14 - -; Enforce year 2000 compliance (will cause problems with non-compliant browsers) -; http://php.net/y2k-compliance -y2k_compliance = On - -; Output buffering is a mechanism for controlling how much output data -; (excluding headers and cookies) PHP should keep internally before pushing that -; data to the client. If your application's output exceeds this setting, PHP -; will send that data in chunks of roughly the size you specify. -; Turning on this setting and managing its maximum buffer size can yield some -; interesting side-effects depending on your application and web server. -; You may be able to send headers and cookies after you've already sent output -; through print or echo. You also may see performance benefits if your server is -; emitting less packets due to buffered output versus PHP streaming the output -; as it gets it. On production servers, 4096 bytes is a good setting for performance -; reasons. -; Note: Output buffering can also be controlled via Output Buffering Control -; functions. -; Possible Values: -; On = Enabled and buffer is unlimited. (Use with caution) -; Off = Disabled -; Integer = Enables the buffer and sets its maximum size in bytes. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 -; http://php.net/output-buffering -output_buffering = 4096 - -; You can redirect all of the output of your scripts to a function. For -; example, if you set output_handler to "mb_output_handler", character -; encoding will be transparently converted to the specified encoding. -; Setting any output handler automatically turns on output buffering. -; Note: People who wrote portable scripts should not depend on this ini -; directive. Instead, explicitly set the output handler using ob_start(). -; Using this ini directive may cause problems unless you know what script -; is doing. -; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" -; and you cannot use both "ob_gzhandler" and "zlib.output_compression". -; Note: output_handler must be empty if this is set 'On' !!!! -; Instead you must use zlib.output_handler. -; http://php.net/output-handler -;output_handler = - -; Transparent output compression using the zlib library -; Valid values for this option are 'off', 'on', or a specific buffer size -; to be used for compression (default is 4KB) -; Note: Resulting chunk size may vary due to nature of compression. PHP -; outputs chunks that are few hundreds bytes each as a result of -; compression. If you prefer a larger chunk size for better -; performance, enable output_buffering in addition. -; Note: You need to use zlib.output_handler instead of the standard -; output_handler, or otherwise the output will be corrupted. -; http://php.net/zlib.output-compression -zlib.output_compression = Off - -; http://php.net/zlib.output-compression-level -;zlib.output_compression_level = -1 - -; You cannot specify additional output handlers if zlib.output_compression -; is activated here. This setting does the same as output_handler but in -; a different order. -; http://php.net/zlib.output-handler -;zlib.output_handler = - -; Implicit flush tells PHP to tell the output layer to flush itself -; automatically after every output block. This is equivalent to calling the -; PHP function flush() after each and every call to print() or echo() and each -; and every HTML block. Turning this option on has serious performance -; implications and is generally recommended for debugging purposes only. -; http://php.net/implicit-flush -; Note: This directive is hardcoded to On for the CLI SAPI -implicit_flush = Off - -; The unserialize callback function will be called (with the undefined class' -; name as parameter), if the unserializer finds an undefined class -; which should be instantiated. A warning appears if the specified function is -; not defined, or if the function doesn't include/implement the missing class. -; So only set this entry, if you really want to implement such a -; callback-function. -unserialize_callback_func = - -; When floats & doubles are serialized store serialize_precision significant -; digits after the floating point. The default value ensures that when floats -; are decoded with unserialize, the data will remain the same. -serialize_precision = 17 - -; This directive allows you to enable and disable warnings which PHP will issue -; if you pass a value by reference at function call time. Passing values by -; reference at function call time is a deprecated feature which will be removed -; from PHP at some point in the near future. The acceptable method for passing a -; value by reference to a function is by declaring the reference in the functions -; definition, not at call time. This directive does not disable this feature, it -; only determines whether PHP will warn you about it or not. These warnings -; should enabled in development environments only. -; Default Value: On (Suppress warnings) -; Development Value: Off (Issue warnings) -; Production Value: Off (Issue warnings) -; http://php.net/allow-call-time-pass-reference -allow_call_time_pass_reference = Off - -; Safe Mode -; http://php.net/safe-mode -safe_mode = Off - -; By default, Safe Mode does a UID compare check when -; opening files. If you want to relax this to a GID compare, -; then turn on safe_mode_gid. -; http://php.net/safe-mode-gid -safe_mode_gid = Off - -; When safe_mode is on, UID/GID checks are bypassed when -; including files from this directory and its subdirectories. -; (directory must also be in include_path or full path must -; be used when including) -; http://php.net/safe-mode-include-dir -safe_mode_include_dir = - -; When safe_mode is on, only executables located in the safe_mode_exec_dir -; will be allowed to be executed via the exec family of functions. -; http://php.net/safe-mode-exec-dir -safe_mode_exec_dir = - -; Setting certain environment variables may be a potential security breach. -; This directive contains a comma-delimited list of prefixes. In Safe Mode, -; the user may only alter environment variables whose names begin with the -; prefixes supplied here. By default, users will only be able to set -; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). -; Note: If this directive is empty, PHP will let the user modify ANY -; environment variable! -; http://php.net/safe-mode-allowed-env-vars -safe_mode_allowed_env_vars = PHP_ - -; This directive contains a comma-delimited list of environment variables that -; the end user won't be able to change using putenv(). These variables will be -; protected even if safe_mode_allowed_env_vars is set to allow to change them. -; http://php.net/safe-mode-protected-env-vars -safe_mode_protected_env_vars = LD_LIBRARY_PATH - -; open_basedir, if set, limits all file operations to the defined directory -; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/open-basedir -;open_basedir = - -; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/disable-functions -disable_functions = - -; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/disable-classes -disable_classes = - -; Colors for Syntax Highlighting mode. Anything that's acceptable in -; would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.bg = #FFFFFF -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; http://php.net/realpath-cache-size -;realpath_cache_size = 16k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = Off - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 30 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 60 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; Maximum amount of memory a script may consume (128MB) -; http://php.net/memory-limit -memory_limit = 128M - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it's automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) -; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) -; Default Value: E_ALL & ~E_NOTICE -; Development Value: E_ALL | E_STRICT -; Production Value: E_ALL & ~E_DEPRECATED -; http://php.net/error-reporting -error_reporting = E_ALL & ~E_NOTICE - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; It's recommended that errors be logged on production servers rather than -; having the errors sent to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = Off - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. But, it's strongly recommended that you -; leave this setting off on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = Off - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This has only effect in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/track-errors -track_errors = Off - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of inserting html -; links to documentation related to that error. This directive controls whether -; those HTML links appear in error messages or not. For performance and security -; reasons, it's recommended you disable this on production servers. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: On -; Development Value: On -; Production value: Off -; http://php.net/html-errors -html_errors = Off - -; If html_errors is set On PHP produces clickable error messages that direct -; to a page describing the error or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -;error_log = php_errors.log -; Log errors to syslog (Event Log on NT, not valid in Windows 95). -;error_log = syslog - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. If the register_globals directive is enabled, it also determines -; what order variables are populated into the global space. G,P,C,E & S are -; abbreviations for the following respective super globals: GET, POST, COOKIE, -; ENV and SERVER. There is a performance penalty paid for the registration of -; these arrays and because ENV is not as commonly used as the others, ENV is -; is not recommended on productions servers. You can still get access to -; the environment variables through getenv() should you need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "EGPCS" - -; This directive determines which super global data (G,P,C,E & S) should -; be registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive are -; specified in the same manner as the variables_order directive, EXCEPT one. -; Leaving this value empty will cause PHP to use the value set in the -; variables_order directive. It does not mean it will leave the super globals -; array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; Whether or not to register the EGPCS variables as global variables. You may -; want to turn this off if you don't want to clutter your scripts' global scope -; with user data. -; You should do your best to write your scripts so that they do not require -; register_globals to be on; Using form variables as globals can easily lead -; to possible security problems, if the code is not very well thought of. -; http://php.net/register-globals -register_globals = Off - -; Determines whether the deprecated long $HTTP_*_VARS type predefined variables -; are registered by PHP or not. As they are deprecated, we obviously don't -; recommend you use them. They are on by default for compatibility reasons but -; they are not recommended on production servers. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-long-arrays -register_long_arrays = Off - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the SERVER and ENV variables are created when they're first -; used (Just In Time) instead of when the script starts. If these variables -; are not used within a script, having this directive on will result in a -; performance gain. The PHP directives register_globals, register_long_arrays, -; and register_argc_argv must be disabled for this directive to have any affect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Maximum size of POST data that PHP will accept. -; http://php.net/post-max-size -post_max_size = 8M - -; Magic quotes are a preprocessing feature of PHP where PHP will attempt to -; escape any character sequences in GET, POST, COOKIE and ENV data which might -; otherwise corrupt data being placed in resources such as databases before -; making that data available to you. Because of character encoding issues and -; non-standard SQL implementations across many databases, it's not currently -; possible for this feature to be 100% accurate. PHP's default behavior is to -; enable the feature. We strongly recommend you use the escaping mechanisms -; designed specifically for the database your using instead of relying on this -; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is -; scheduled for removal in PHP 6. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/magic-quotes-gpc -magic_quotes_gpc = Off - -; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. -; http://php.net/magic-quotes-runtime -magic_quotes_runtime = Off - -; Use Sybase-style magic quotes (escape ' with '' instead of \'). -; http://php.net/magic-quotes-sybase -magic_quotes_sybase = Off - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a character encoding using -; the Content-type: header. To disable sending of the charset, simply -; set it to be empty. -; -; PHP's built-in default is text/html -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to empty. -; http://php.net/default-charset -;default_charset = "iso-8859-1" - -; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is -; to disable this feature. -; http://php.net/always-populate-raw-post-data -;always_populate_raw_post_data = On - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/php/includes" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -; extension_dir = "./" -; On windows: -; extension_dir = "ext" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = ; - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -;cgi.fix_pathinfo=1 - -; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1; - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If it's set 0 PHP sends Status: header that -; is supported by Apache. When this option is set to 1 PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 2M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename.extension -; -; For example, on Windows: -; -; extension=msql.dll -; -; ... or under UNIX: -; -; extension=msql.so -; -; ... or with a path: -; -; extension=/path/to/extension/msql.so -; -; If you only provide the name of the extension, PHP will look for it in its -; default extension directory. -; -; Windows Extensions -; Note that ODBC support is built in, so no dll is needed for it. -; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) -; extension folders as well as the separate PECL DLL download (PHP 5). -; Be sure to appropriately set the extension_dir directive. -; -;extension=php_bz2.dll -;extension=php_curl.dll -;extension=php_fileinfo.dll -;extension=php_gd2.dll -;extension=php_gettext.dll -;extension=php_gmp.dll -;extension=php_intl.dll -;extension=php_imap.dll -;extension=php_interbase.dll -;extension=php_ldap.dll -;extension=php_mbstring.dll -;extension=php_exif.dll ; Must be after mbstring as it depends on it -;extension=php_mysql.dll -;extension=php_mysqli.dll -;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client -;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client -;extension=php_openssl.dll -;extension=php_pdo_firebird.dll -;extension=php_pdo_mssql.dll -;extension=php_pdo_mysql.dll -;extension=php_pdo_oci.dll -;extension=php_pdo_odbc.dll -;extension=php_pdo_pgsql.dll -;extension=php_pdo_sqlite.dll -;extension=php_pgsql.dll -;extension=php_pspell.dll -;extension=php_shmop.dll - -; The MIBS data available in the PHP distribution must be installed. -; See http://www.php.net/manual/en/snmp.installation.php -;extension=php_snmp.dll - -;extension=php_soap.dll -;extension=php_sockets.dll -;extension=php_sqlite.dll -;extension=php_sqlite3.dll -;extension=php_sybase_ct.dll -;extension=php_tidy.dll -;extension=php_xmlrpc.dll -;extension=php_xsl.dll -;extension=php_zip.dll - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -date.timezone = UTC - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -;iconv.input_encoding = ISO-8859-1 -;iconv.internal_encoding = ISO-8859-1 -;iconv.output_encoding = ISO-8859-1 - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING - -[sqlite] -; http://php.net/sqlite.assoc-case -;sqlite.assoc_case = 0 - -[sqlite3] -;sqlite3.extension_dir = - -[Pcre] -;PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -;PCRE library recursion limit. -;Please note that if you set this value to a high number you may consume all -;the available process stack and eventually crash PHP (due to reaching the -;stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/pdo_mysql.cache_size -pdo_mysql.cache_size = 2000 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/pdo_mysql.default-socket -pdo_mysql.default_socket= - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[Syslog] -; Whether or not to define the various syslog variables (e.g. $LOG_PID, -; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In -; runtime, you can define these variables by calling define_syslog_variables(). -; http://php.net/define-syslog-variables -define_syslog_variables = Off - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(), even in safe mode. -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = On - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = - -[SQL] -; http://php.net/sql.safe-mode -sql.safe_mode = Off - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -;birdstep.max_links = -1 - -[Interbase] -; Allow or prevent persistent links. -ibase.allow_persistent = 1 - -; Maximum number of persistent links. -1 means no limit. -ibase.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -ibase.max_links = -1 - -; Default database name for ibase_connect(). -;ibase.default_db = - -; Default username for ibase_connect(). -;ibase.default_user = - -; Default password for ibase_connect(). -;ibase.default_password = - -; Default charset for ibase_connect(). -;ibase.default_charset = - -; Default timestamp format. -ibase.timestampformat = "%Y-%m-%d %H:%M:%S" - -; Default date format. -ibase.dateformat = "%Y-%m-%d" - -; Default time format. -ibase.timeformat = "%H:%M:%S" - -[MySQL] -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysql.allow_local_infile -mysql.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysql.allow-persistent -mysql.allow_persistent = On - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysql.cache_size -mysql.cache_size = 2000 - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysql.max-persistent -mysql.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/mysql.max-links -mysql.max_links = -1 - -; Default port number for mysql_connect(). If unset, mysql_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysql.default-port -mysql.default_port = - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysql.default-socket -mysql.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-host -mysql.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-user -mysql.default_user = - -; Default password for mysql_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysql.default-password -mysql.default_password = - -; Maximum time (in seconds) for connect timeout. -1 means no limit -; http://php.net/mysql.connect-timeout -mysql.connect_timeout = 60 - -; Trace mode. When trace_mode is active (=On), warnings for table/index scans and -; SQL-Errors will be displayed. -; http://php.net/mysql.trace-mode -mysql.trace_mode = Off - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysqli.cache_size -mysqli.cache_size = 2000 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statstics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_statistics -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statstics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_memory_statistics -mysqlnd.collect_memory_statistics = Off - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -; http://php.net/mysqlnd.net_cmd_buffer_size -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -; http://php.net/mysqlnd.net_read_buffer_size -;mysqlnd.net_read_buffer_size = 32768 - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgresSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[Sybase-CT] -; Allow or prevent persistent links. -; http://php.net/sybct.allow-persistent -sybct.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/sybct.max-persistent -sybct.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/sybct.max-links -sybct.max_links = -1 - -; Minimum server message severity to display. -; http://php.net/sybct.min-server-severity -sybct.min_server_severity = 10 - -; Minimum client message severity to display. -; http://php.net/sybct.min-client-severity -sybct.min_client_severity = 10 - -; Set per-context timeout -; http://php.net/sybct.timeout -;sybct.timeout= - -;sybct.packet_size - -; The maximum time in seconds to wait for a connection attempt to succeed before returning failure. -; Default: one minute -;sybct.login_timeout= - -; The name of the host you claim to be connecting from, for display by sp_who. -; Default: none -;sybct.hostname= - -; Allows you to define how often deadlocks are to be retried. -1 means "forever". -; Default: 0 -;sybct.deadlock_retry_count= - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if you -; or your OS have problems with lots of files in one directory, and is -; a more efficient layout for servers that handle lots of sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/tmp" - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combatting -; session hijacking when not specifying and managing your own session id. It is -; not the end all be all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started -; on every session initialization. The probability is calculated by using -; gc_probability/gc_divisor. Where session.gc_probability is the numerator -; and gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 1 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using the following equation: -; gc_probability/gc_divisor. Where session.gc_probability is the numerator and -; session.gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. Increasing this value to 1000 will give you -; a 0.1% chance the gc will run on any give request. For high volume production servers, -; this is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script would is the equivalent of -; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 | xargs rm - -; PHP 4.2 and less have an undocumented feature/bug that allows you to -; to initialize a session variable in the global scope, even when register_globals -; is disabled. PHP 4.3 and later will warn you, if this feature is used. -; You can disable the feature and the warning separately. At this time, -; the warning is only displayed, if bug_compat_42 is enabled. This feature -; introduces some serious security problems if not handled correctly. It's -; recommended that you do not use this feature on production servers. But you -; should enable this on development servers and enable the warning as well. If you -; do not enable the feature on development servers, you won't be warned when it's -; used and debugging errors caused by this can be difficult to track down. -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/session.bug-compat-42 -session.bug_compat_42 = Off - -; This setting controls whether or not you are warned by PHP when initializing a -; session value into the global space. session.bug_compat_42 must be enabled before -; these warnings can be issued by PHP. See the directive above for more information. -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/session.bug-compat-warn -session.bug_compat_warn = Off - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; How many bytes to read from the file. -; http://php.net/session.entropy-length -session.entropy_length = 0 - -; Specified here to create the session id. -; http://php.net/session.entropy-file -; On systems that don't have /dev/urandom /dev/arandom can be used -; On windows, setting the entropy_length setting will activate the -; Windows random source (using the CryptoAPI) -;session.entropy_file = /dev/urandom - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publically accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Select a hash function for use in generating session ids. -; Possible Values -; 0 (MD5 128 bits) -; 1 (SHA-1 160 bits) -; This option may also be set to the name of any hash function supported by -; the hash extension. A list of available hashes is returned by the hash_algos() -; function. -; http://php.net/session.hash-function -session.hash_function = 0 - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.hash_bits_per_character = 5 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -; form/fieldset are special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. If you want XHTML conformity, remove the form entry. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; http://php.net/url-rewriter.tags -url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" - -[MSSQL] -; Allow or prevent persistent links. -mssql.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -mssql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -mssql.max_links = -1 - -; Minimum error severity to display. -mssql.min_error_severity = 10 - -; Minimum message severity to display. -mssql.min_message_severity = 10 - -; Compatibility mode with old versions of PHP 3.0. -mssql.compatability_mode = Off - -; Connect timeout -;mssql.connect_timeout = 5 - -; Query timeout -;mssql.timeout = 60 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textlimit = 4096 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textsize = 4096 - -; Limits the number of records in each batch. 0 = all records in one batch. -;mssql.batchsize = 0 - -; Specify how datetime and datetim4 columns are returned -; On => Returns data converted to SQL server settings -; Off => Returns values as YYYY-MM-DD hh:mm:ss -;mssql.datetimeconvert = On - -; Use NT authentication when connecting to the server -mssql.secure_connection = Off - -; Specify max number of processes. -1 = library default -; msdlib defaults to 25 -; FreeTDS defaults to 4096 -;mssql.max_procs = -1 - -; Specify client character set. -; If empty or not set the client charset from freetds.comf is used -; This is only used when compiled with FreeTDS -;mssql.charset = "ISO-8859-1" - -[Assertion] -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Issue a PHP warning for each failed assertion. -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a components typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; internal/script encoding. -; Some encoding cannot work as internal encoding. -; (e.g. SJIS, BIG5, ISO-2022-*) -; http://php.net/mbstring.internal-encoding -;mbstring.internal_encoding = EUC-JP - -; http input encoding. -; http://php.net/mbstring.http-input -;mbstring.http_input = auto - -; http output encoding. mb_output_handler must be -; registered as output buffer to function -; http://php.net/mbstring.http-output -;mbstring.http_output = SJIS - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; auto means -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none; - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -;mbstring.strict_detection = Off - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -; Allows to set script encoding. Only affects if PHP is compiled with --enable-zend-multibyte -; Default: "" -;mbstring.script_encoding= - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 0 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[mcrypt] -; For more information about mcrypt settings see http://php.net/mcrypt-module-open - -; Directory where to load mcrypt algorithms -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.algorithms_dir= - -; Directory where to load mcrypt modes -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.modes_dir= - -[dba] -;dba.default_handler= - -; Local Variables: -; tab-width: 4 -; End: diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_docker/README.md b/vendor/heroku/heroku-buildpack-php/support/build/_docker/README.md deleted file mode 100644 index 7394447..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_docker/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Building Platform Packages using Docker - -## Building the Image - -**After every change to your formulae, perform the following** from the root of the Git repository (not from `support/build/_docker/`): - - $ docker build --tag heroku-php-build-cedar-14 --file $(pwd)/support/build/_docker/cedar-14.Dockerfile . - -## Configuration - -File `env.default` contains a list of required env vars, some with default values. You can modify it with the values you desire, or pass them to `docker run` using `--env`. - -Out of the box, you'll likely want to change `S3_BUCKET` and `S3_PREFIX` to match your info. Instead of setting `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` in that file, it is recommended to pass them to `docker run` through the environment, or explicitly using `--env`, in order to prevent accidental commits of credentials. - -## Using the Image - -From the root of the Git repository (not from `support/build/_docker/`): - - docker run --rm --tty --interactive --env-file=support/build/_docker/env.default heroku-php-build-cedar-14 /bin/bash - -That runs with values from `env.default`; if you need to pass e.g. `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` because they are not already in your environment, do either: - - AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... docker run --rm --tty --interactive --env-file=support/build/_docker/env.default heroku-php-build-cedar-14 /bin/bash - -or - - docker run --rm --tty --interactive --env-file=support/build/_docker/env.default -e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=... heroku-php-build-cedar-14 /bin/bash - -You then have a shell where you can run `bob build`, `deploy.sh` and so forth. - -The `support/build/_util/` directory is on `$PATH` in the image. diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_docker/cedar-14.Dockerfile b/vendor/heroku/heroku-buildpack-php/support/build/_docker/cedar-14.Dockerfile deleted file mode 100644 index 9ea9e44..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_docker/cedar-14.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM heroku/cedar:14 - -WORKDIR /app -ENV WORKSPACE_DIR=/app/support/build -ENV PATH=/app/support/build/_util:$PATH - -RUN apt-get update && apt-get install -y python-pip - -COPY requirements.txt /app/requirements.txt - -RUN pip install -r /app/requirements.txt - -COPY . /app diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_docker/env.default b/vendor/heroku/heroku-buildpack-php/support/build/_docker/env.default deleted file mode 100644 index f796351..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_docker/env.default +++ /dev/null @@ -1,8 +0,0 @@ -AWS_ACCESS_KEY_ID -AWS_SECRET_ACCESS_KEY - -S3_BUCKET=lang-php -S3_PREFIX=dist-cedar-14-develop/ -S3_REGION=s3 - -STACK=cedar-14 diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_docker/heroku-16.Dockerfile b/vendor/heroku/heroku-buildpack-php/support/build/_docker/heroku-16.Dockerfile deleted file mode 100644 index 806bbd0..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_docker/heroku-16.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM heroku/heroku:16-build - -WORKDIR /app -ENV WORKSPACE_DIR=/app/support/build -ENV PATH=/app/support/build/_util:$PATH - -RUN apt-get update && apt-get install -y python-pip - -COPY requirements.txt /app/requirements.txt - -RUN pip install -r /app/requirements.txt - -COPY . /app diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/deploy.sh b/vendor/heroku/heroku-buildpack-php/support/build/_util/deploy.sh deleted file mode 100755 index 0acbd18..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/deploy.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -publish=false - -# process flags -optstring=":-:" -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - publish) - publish=true - break - ;; - *) - OPTIND=1 - break - ;; - esac - esac -done -# clear processed "publish" argument -shift $((OPTIND-1)) - -if [[ $# -lt 1 ]]; then - echo "Usage: $(basename $0) [--publish] FORMULA-VERSION [--overwrite]" >&2 - echo " If --publish is given, mkrepo.sh will be invoked after a successful deploy to" >&2 - echo " re-generate the repo. CAUTION: this will cause all manifests in the bucket to" >&2 - echo " be included in the repo, including potentially currently unpublished ones." >&2 - echo " All additional arguments, including --overwrite, are passed through to 'bob'." >&2 - exit 2 -fi - -if [[ -z "${AWS_ACCESS_KEY_ID:-}" || -z "${AWS_SECRET_ACCESS_KEY:-}" ]]; then - echo '$AWS_ACCESS_KEY_ID or $AWS_SECRET_ACCESS_KEY not set!' >&2 - exit 2 -fi - -# a helper (print_or_export_manifest_cmd) called in the script invoked by Bob will write to this if set -export MANIFEST_CMD=$(mktemp -t "manifest.XXXXX") -trap 'rm -rf $MANIFEST_CMD;' EXIT - -# make sure we start cleanly -rm -rf /app/.heroku/php - -# pass through args (so users can pass --overwrite etc) -# but modify any path by stripping $WORKSPACE_DIR from the front, if it's there -# so that one can also pass in the full path to the formula relative to the root, and not just relative to $WORKSPACE_DIR -# that allows for simpler mass build loops using wildcards without having to worry about the relative location of other references such as an --env-file, like: -# for f in support/build/php-{5,7}.* support/build/extensions/no-debug-non-zts-201*/{redis,blackfire,imagick}-*; do docker run --rm --tty --interactive --env-file=../dockerenv.cedar-14 heroku-php-builder-cedar-14 deploy.sh $f; done -args=() -for var in "$@"; do - expanded="$(pwd)/$var" - if [[ -f $expanded ]]; then - var="${expanded#$WORKSPACE_DIR/}" - fi - args+=("$var") -done - -bob deploy "${args[@]}" - -# invoke manifest upload -echo "" -echo "Uploading manifest..." -. $MANIFEST_CMD - -if $publish; then - echo "Updating repository..." - $(dirname $BASH_SOURCE)/mkrepo.sh --upload "$S3_BUCKET" "${S3_PREFIX}" -fi diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.py b/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.py deleted file mode 100644 index c449225..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.py +++ /dev/null @@ -1,27 +0,0 @@ -import os, sys, json, re, datetime - -require = json.loads(sys.argv[5]) if len(sys.argv) > 5 else {} -stack=re.match("^([^-]+)(?:-([0-9]+))?$", os.getenv("STACK", "cedar-14")) -require["heroku-sys/"+stack.group(1)] = "^{}.0.0".format(stack.group(2) or "1") - -require["heroku/installer-plugin"] = "^1.2.0" -if sys.argv[1] == 'heroku-sys-library': - require["heroku/installer-plugin"] = "^1.3.0" - -manifest = { - "type": sys.argv[1], - "name": sys.argv[2], - "version": sys.argv[3], - "dist": { - "type": "heroku-sys-tar", - "url": "https://"+os.getenv("S3_BUCKET")+"."+os.getenv("S3_REGION", "s3")+".amazonaws.com/"+os.getenv("S3_PREFIX")+sys.argv[4] - }, - "require": require, - "conflict": json.loads(sys.argv[6]) if len(sys.argv) > 6 else {}, - "replace": json.loads(sys.argv[7]) if len(sys.argv) > 7 else {}, - "provide": json.loads(sys.argv[8]) if len(sys.argv) > 8 else {}, - "extra": json.loads(sys.argv[9]) if len(sys.argv) > 9 else {}, - "time": datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") -} - -json.dump(manifest, sys.stdout, sort_keys=True) diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.sh b/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.sh deleted file mode 100755 index b2d56c6..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/include/manifest.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -print_or_export_manifest_cmd() { - if [[ "${MANIFEST_CMD:-}" ]]; then - echo "$1" > $MANIFEST_CMD - else - echo "-----> Done. Run '$1' to upload manifest." - fi -} - -generate_manifest_cmd() { - echo "s3cmd --ssl${AWS_ACCESS_KEY_ID+" --access_key=\$AWS_ACCESS_KEY_ID"}${AWS_SECRET_ACCESS_KEY+" --secret_key=\$AWS_SECRET_ACCESS_KEY"} --acl-public -m application/json put $(pwd)/${1} s3://${S3_BUCKET}/${S3_PREFIX}${1}" -} - -soname_version() { - soname=$(objdump -p $1 | grep SONAME | awk '{ printf $2; }') - file=$(basename $1) - echo "${soname#${file}.}" -} \ No newline at end of file diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/mkrepo.sh b/vendor/heroku/heroku-buildpack-php/support/build/_util/mkrepo.sh deleted file mode 100755 index 1fae7b4..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/mkrepo.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -function s3cmd_get_progress() { - len=0 - while read line; do - if [[ "$len" -gt 0 ]]; then - # repeat a backspace $len times - # need to use seq; {1..$len} doesn't work - printf '%0.s\b' $(seq 1 $len) - fi - echo -n "$line" - len=${#line} - done < <(grep --line-buffered -o -E '\[[0-9]+ of [0-9]+\]') # filter only the "[1 of 99]" bits from 's3cmd get' output -} - -upload=false - -# process flags -optstring=":-:" -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - upload) - upload=true - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ $# == "1" ]]; then - echo "Usage: $(basename $0) [--upload] [S3_BUCKET S3_PREFIX [MANIFEST...]]" >&2 - echo " S3_BUCKET: S3 bucket name for packages.json upload; default: '\$S3_BUCKET'." >&2 - echo " S3_PREFIX: S3 prefix, e.g. '' or 'dist-stable/'; default: '\${S3_PREFIX}'." >&2 - echo " If MANIFEST arguments are given, those are used to build the repo; otherwise," >&2 - echo " all manifests from given or default S3_BUCKET+S3_PREFIX are downloaded." >&2 - echo " A --upload flag triggers immediate upload, otherwise instructions are printed." >&2 - echo " If --upload, or if stdout is a terminal, packages.json will be written to cwd." >&2 - echo " If no --upload, and if stdout is a pipe, repo JSON will be echo'd to stdout." >&2 - exit 2 -fi - -here=$(cd $(dirname $0); pwd) - -if [[ $# != "0" ]]; then - S3_BUCKET=$1; shift - S3_PREFIX=$1; shift -fi - -if [[ $# == "0" ]]; then - manifests_tmp=$(mktemp -d -t "dst-repo.XXXXX") - trap 'rm -rf $manifests_tmp;' EXIT - echo -n "-----> Fetching manifests... " >&2 - ( - cd $manifests_tmp - s3cmd --ssl --progress get s3://${S3_BUCKET}/${S3_PREFIX}*.composer.json 2>&1 | tee download.log | s3cmd_get_progress >&2 || { echo -e "failed! Error:\n$(cat download.log)" >&2; exit 1; } - rm download.log - ) - echo "" >&2 - manifests=$manifests_tmp/*.composer.json -else - manifests="$@" -fi - -echo "-----> Generating packages.json..." >&2 -redir=false -if $upload || [[ -t 1 ]]; then - redir=true - # if stdout is a terminal or if we're uploading; we write a "packages.json" instead of echoing - # this is so other programs can pipe our output and capture the generated repo from stdout - # also back up stdout so we restore it to the right thing (tty or pipe) later - exec 3>&1 1>packages.json -fi - -# sort so that packages with the same name and version (e.g. ext-memcached 2.2.0) show up with their hhvm or php requirement in descending order - otherwise a Composer limitation means that a simple "ext-memcached: * + php: ^5.5.17" request would install 5.5.latest and not 5.6.latest, as it finds the 5.5.* requirement extension first and sticks to that instead of 5.6. For packages with identical names and versions (but different e.g. requirements), Composer basically treats them as equal and picks as a winner whatever it finds first. The requirements have to be written like "x.y.*" for this to work of course. -python -c 'import sys, json; from distutils import version; json.dump({"packages": [ sorted([json.load(open(item)) for item in sys.argv[1:] if json.load(open(item)).get("type", "") != "heroku-sys-package"], key=lambda package: version.LooseVersion(package.get("require", {}).get("heroku-sys/hhvm", package.get("require", {}).get("heroku-sys/php", "0.0.0"))), reverse=True) ] }, sys.stdout, sort_keys=True)' $manifests - -# restore stdout -# note that 'exec >$(tty)' does not work as FD 1 may have been a pipe originally and not a tty -if $redir; then - exec 1>&3 3>&- -fi - -cmd="s3cmd --ssl${AWS_ACCESS_KEY_ID+" --access_key=\$AWS_ACCESS_KEY_ID"}${AWS_SECRET_ACCESS_KEY+" --secret_key=\$AWS_SECRET_ACCESS_KEY"} --acl-public -m application/json put packages.json s3://${S3_BUCKET}/${S3_PREFIX}packages.json" -if $upload; then - echo "-----> Uploading packages.json..." >&2 - eval "$cmd 1>&2" - echo "-----> Done." >&2 -elif [[ -t 1 ]]; then - echo "-----> Done. Run '$cmd' to upload repository." >&2 -fi diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/remove.sh b/vendor/heroku/heroku-buildpack-php/support/build/_util/remove.sh deleted file mode 100755 index 004e291..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/remove.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -publish=true - -# process flags -optstring=":-:" -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - no-publish) - publish=false - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ $# -lt "1" ]]; then - echo "Usage: $(basename $0) [--no-publish] MANIFEST..." >&2 - echo " MANIFEST: name of manifest file, e.g. 'ext-event-2.0.0_php-5.6.composer.json'" >&2 - echo " If --no-publish is given, mkrepo.sh will NOT be invoked after removal to" >&2 - echo " re-generate the repo." >&2 - echo " CAUTION: re-generating the repo will cause all manifests in the bucket" >&2 - echo " to be included in the repo, including potentially currently unpublished ones." >&2 - echo " CAUTION: using --no-publish means the repo will point to non-existing packages" >&2 - echo " until 'mkrepo.sh --upload' is run!" >&2 - echo " Bucket name and prefix will be read from '\$S3_BUCKET' and '\$S3_PREFIX'." >&2 - exit 2 -fi - -S3_PREFIX=${S3_PREFIX:-} - -here=$(cd $(dirname $0); pwd) - -manifests=("$@") - -indices="${!manifests[@]}" -for index in $indices; do - manifests[$index]="s3://${S3_BUCKET}/${S3_PREFIX}${manifests[$index]%.composer.json}.composer.json" -done - -manifests_tmp=$(mktemp -d -t "dst-repo.XXXXX") -trap 'rm -rf $manifests_tmp;' EXIT -echo "-----> Fetching manifests..." >&2 -( - cd $manifests_tmp - s3cmd --ssl get "${manifests[@]}" 1>&2 -) - -echo " -WARNING: POTENTIALLY DESTRUCTIVE ACTION! - -The following packages will be REMOVED - from s3://${S3_BUCKET}/${S3_PREFIX}: -$(IFS=$'\n'; echo "${manifests[*]:-(none)}" | xargs -n1 basename | sed -e 's/^/ - /' -e 's/.composer.json$//') -" >&2 - -if $publish; then - echo "NOTICE: You have selected to publish the repo after removal of packages." >&2 - echo "This means the repo will be re-generated based on the current bucket contents!" >&2 - regenmsg="& regenerate packages.json" -else - regenmsg="without updating the repo" - echo "WARNING: You have selected to NOT publish the repo after removal of packages." >&2 - echo "This means the repo will point to non-existing packages until mkrepo.sh is run!" >&2 -fi -echo "" >&2 - -read -p "Are you sure you want to remove the packages $regenmsg? [yN] " proceed - -[[ ! $proceed =~ [yY](es)* ]] && exit - -echo "" >&2 - -remove_files=() -for manifest in "${manifests[@]}"; do - echo "Removing $(basename $manifest ".composer.json"):" >&2 - if filename=$(cat $manifests_tmp/$(basename $manifest) | python <(cat <<-'PYTHON' # beware of single quotes in body - import sys, json, re; - manifest=json.load(sys.stdin) - url=manifest.get("dist",{}).get("url","").partition("https://"+sys.argv[1]+"."+sys.argv[2]+".amazonaws.com/"+sys.argv[3]) - if url[0]: - # dist URL does not match https://${dst_bucket}.${dst_region}.amazonaws.com/${dst_prefix} - print(url[0]) - sys.exit(1) - else: - print(url[2]) - PYTHON - ) $S3_BUCKET ${S3_REGION:-s3} ${S3_PREFIX}) - then - echo " - queued '$filename' for removal." >&2 - remove_files+=("$filename") - else - # the dist URL points somewhere else, so we are not touching that - echo " - WARNING: not removing '$filename' (in manifest 'dist.url')!" >&2 - fi - echo -n " - removing manifest file '$(basename $manifest)'... " >&2 - out=$(s3cmd rm ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl "$manifest" 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } - rm $manifests_tmp/$(basename $manifest) - echo "done." >&2 -done - -echo "" >&2 - -if $publish; then - echo -n "Generating and uploading packages.json... " >&2 - out=$(cd $manifests_tmp; $here/mkrepo.sh --upload 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } - cat >&2 <<-EOF - done! - $(echo "$out" | grep -E '^Public URL' | sed 's/^Public URL of the object is: http:/Public URL of the repository is: https:/') - - EOF -fi - -if [[ "${#remove_files[@]}" != "0" ]]; then - echo "Removing files queued for deletion from bucket:" >&2 - for filename in "${remove_files[@]}"; do - echo -n " - removing '$filename'... " >&2 - out=$(s3cmd rm ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl s3://${S3_BUCKET}/${S3_PREFIX}${filename} 2>&1) && echo "done." >&2 || echo -e "failed! Error:\n$out" >&2 - done - echo "" >&2 -fi - -echo "Removal complete. -" >&2 - -if ! $publish; then - cat >&2 <<-EOF - WARNING: repo has not been re-generated. It may currently be in a broken state. - There may be packages still listed in the repo that have just been removed. - Run 'mkrepo.sh --upload' at once to return repository into a consistent state. - - EOF -fi diff --git a/vendor/heroku/heroku-buildpack-php/support/build/_util/sync.sh b/vendor/heroku/heroku-buildpack-php/support/build/_util/sync.sh deleted file mode 100755 index fad745b..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/_util/sync.sh +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/env bash - -set -eu -set -o pipefail - -function s3cmd_get_progress() { - len=0 - while read line; do - if [[ "$len" -gt 0 ]]; then - # repeat a backspace $len times - # need to use seq; {1..$len} doesn't work - printf '%0.s\b' $(seq 1 $len) - fi - echo -n "$line" - len=${#line} - done < <(grep --line-buffered -o -E '\[[0-9]+ of [0-9]+\]') # filter only the "[1 of 99]" bits from 's3cmd get' output -} - -remove=true - -# process flags -optstring=":-:" -while getopts "$optstring" opt; do - case $opt in - -) - case "$OPTARG" in - no-remove) - remove=false - ;; - *) - echo "Invalid option: --$OPTARG" >&2 - exit 2 - ;; - esac - esac -done -# clear processed arguments -shift $((OPTIND-1)) - -if [[ $# -lt "2" || $# -gt "6" ]]; then - echo "Usage: $(basename $0) [--no-remove] DEST_BUCKET DEST_PREFIX [DEST_REGION [SOURCE_BUCKET SOURCE_PREFIX [SOURCE_REGION]]]" >&2 - echo " DEST_BUCKET: destination S3 bucket name." >&2 - echo " DEST_REGION: destination bucket region, e.g. us-west-1; default: 's3'." >&2 - echo " DEST_PREFIX: destination prefix, e.g. '' or 'dist-stable/'." >&2 - echo " SOURCE_BUCKET: source S3 bucket name; default: '\$S3_BUCKET'." >&2 - echo " SOURCE_REGION: source bucket region; default: '\$S3_REGION' or 's3'." >&2 - echo " SOURCE_PREFIX: source prefix; default: '\${S3_PREFIX}'." >&2 - echo " --no-remove: no removal of destination packages that are not in source bucket." >&2 - exit 2 -fi - -dst_bucket=$1; shift -dst_prefix=$1; shift -if [[ $# -gt 2 ]]; then - # region name given - dst_region=$1; shift -else - dst_region="s3" -fi - -src_bucket=${1:-$S3_BUCKET}; shift || true -src_prefix=${1:-$S3_PREFIX}; shift || true -if [[ $# == "1" ]]; then - # region name given - src_region=$1; shift -else - src_region=${S3_REGION:-"s3"} -fi - -src_tmp=$(mktemp -d -t "src-repo.XXXXX") -dst_tmp=$(mktemp -d -t "dst-repo.XXXXX") -here=$(cd $(dirname $0); pwd) - -# clean up at the end -trap 'rm -rf $src_tmp $dst_tmp;' EXIT - -echo -n "Fetching source's manifests from s3://${src_bucket}/${src_prefix}... " >&2 -( - cd $src_tmp - out=$(s3cmd --ssl get s3://${src_bucket}/${src_prefix}packages.json 2>&1) || { echo -e "No packages.json in source repo:\n$out" >&2; exit 1; } - s3cmd --ssl --progress get s3://${src_bucket}/${src_prefix}*.composer.json 2>&1 | tee download.log | s3cmd_get_progress >&2 || { echo -e "failed! Error:\n$(cat download.log)" >&2; exit 1; } - ls *.composer.json 2>/dev/null 1>&2 || { echo "failed; no manifests found!" >&2; exit 1; } - rm download.log -) -echo "" >&2 - -# this mkrepo.sh call won't actually download, but use the given *.composer.json, and echo a generated packages.json -# we use this to compare to the downloaded packages.json -$here/mkrepo.sh $src_bucket $src_prefix ${src_tmp}/*.composer.json 2>/dev/null | python -c 'import sys, json; sys.exit(abs(cmp(json.load(open(sys.argv[1])), json.load(sys.stdin))))' ${src_tmp}/packages.json || { - echo "WARNING: packages.json from source does not match its list of manifests!" >&2 - echo " You should run 'mkrepo.sh' to update, or ask the bucket maintainers to do so." >&2 - read -p "Would you like to abort this operation? [Yn] " proceed - [[ ! $proceed =~ [nN]o* ]] && exit 1 # yes is the default so doing yes | sync.sh won't do something stupid -} - -echo -n "Fetching destination's manifests from s3://${dst_bucket}/${dst_prefix}... " >&2 -( - cd $dst_tmp - s3cmd --ssl --progress get s3://${dst_bucket}/${dst_prefix}*.composer.json 2>&1 | tee download.log | s3cmd_get_progress >&2 || { echo -e "failed! Error:\n$(cat download.log)" >&2; exit 1; } - rm download.log -) -echo "" >&2 - -comm=$(comm <(cd $src_tmp; ls -1 *.composer.json) <(cd $dst_tmp; ls -1 *.composer.json 2> /dev/null)) # comm produces three columns of output: entries only in left file, entries only in right file, entries in both -add_manifests=$(echo "$comm" | grep '^\S' || true) # no tabs means output in col 1 = files only in src -remove_manifests=$(echo "$comm" | grep '^\s\S' | cut -c2- || true) # one tab means output in col 2 = files only in dst -common=$(echo "$comm" | grep '^\s\s' | cut -c3- || true) # two tabs means output in col 3 = files in both -update_manifests=() -ignore_manifests=() -for filename in $common; do - result=0 - python <(cat <<-'PYTHON' # beware of single quotes in body - from __future__ import print_function - import sys, json, os, datetime - # for python 2+3 compat - def stderrprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - src_manifest = json.load(open(sys.argv[1])) - dst_manifest = json.load(open(sys.argv[2])) - # remove URLs so they don't interfere with comparison - src_manifest.get("dist", {}).pop("url", None) - dst_manifest.get("dist", {}).pop("url", None) - # same for times, but we'll look at them - try: - src_time = datetime.datetime.strptime(src_manifest.pop("time"), "%Y-%m-%d %H:%M:%S") # UTC - except KeyError, ValueError: - src_time = datetime.datetime.utcfromtimestamp(os.path.getmtime(sys.argv[1])) - stderrprint("WARNING: source manifest {} has invalid time entry, using mtime: {}".format(os.path.basename(sys.argv[1]), src_time.isoformat())) - try: - dst_time = datetime.datetime.strptime(dst_manifest.pop("time"), "%Y-%m-%d %H:%M:%S") # UTC - except KeyError, ValueError: - dst_time = datetime.datetime.utcfromtimestamp(os.path.getmtime(sys.argv[2])) - stderrprint("WARNING: destination manifest {} has invalid time entry, using mtime: {}".format(os.path.basename(sys.argv[2]), dst_time.isoformat())) - # a newer source time means we will copy - if src_time > dst_time: - sys.exit(0) - else: - # 1 = content identical, src_time = dst_time (up to date) - # 3 = content different, src_time = dst_time (weird) - # 5 = content identical, src_time < dst_time (probably needs sync the other way) - # 7 = content different, src_time < dst_time (probably needs sync the other way) - ret = 1 - ret = ret | abs(cmp(src_manifest, dst_manifest))<<1 - ret = ret | (src_time < dst_time)<<2 - sys.exit(ret) - PYTHON - ) $src_tmp/$filename $dst_tmp/$filename || result=$? - if [[ $result -eq 0 ]]; then - update_manifests+=($filename) - elif [[ $result != "1" ]]; then - case $result in - 3) - ignore_manifests+=("$filename (contents differ, time fields identical!?)") - ;; - 5) - ignore_manifests+=("$filename (contents match, destination manifest newer)") - ;; - 7) - ignore_manifests+=("$filename (contents differ, destination manifest newer)") - ;; - esac - fi -done - -echo " -WARNING: POTENTIALLY DESTRUCTIVE ACTION! - -The following packages will be IGNORED: -$(IFS=$'\n'; echo "${ignore_manifests[*]:-(none)}" | sed -e 's/^/ - /' -e 's/.composer.json//') - -The following packages will be ADDED - from s3://${src_bucket}/${src_prefix} - to s3://${dst_bucket}/${dst_prefix}: -$(echo "${add_manifests:-(none)}" | sed -e 's/^/ - /' -e 's/.composer.json$//') - -The following packages will be UPDATED (source manifest is newer) - from s3://${src_bucket}/${src_prefix} - to s3://${dst_bucket}/${dst_prefix}: -$(IFS=$'\n'; echo "${update_manifests[*]:-(none)}" | sed -e 's/^/ - /' -e 's/.composer.json$//') - -The following packages will $($remove || echo -n "NOT ")be REMOVED - from s3://${dst_bucket}/${dst_prefix}$($remove && echo -n ":")$($remove || echo -ne "\n because '--no-remove' was given:") -$(echo "${remove_manifests:-(none)}" | sed -e 's/^/ - /' -e 's/.composer.json$//') -" >&2 - -# clear remove_manifests if --no-remove given -$remove || remove_manifests= - -if [[ ! "$add_manifests" && ! "$remove_manifests" && "${#update_manifests[@]}" -eq 0 ]]; then - echo "Nothing to do. Aborting." >&2 - exit -fi - -read -p "Are you sure you want to sync to destination & regenerate packages.json? [yN] " proceed - -[[ ! $proceed =~ [yY](es)* ]] && exit - -echo "" >&2 - -copied_files=() -for manifest in $add_manifests ${update_manifests[@]:-}; do - echo "Copying ${manifest%.composer.json}:" >&2 - if filename=$(cat ${src_tmp}/${manifest} | python <(cat <<-'PYTHON' # beware of single quotes in body - import sys, json; - manifest=json.load(sys.stdin) - url=manifest.get("dist",{}).get("url","").partition("https://"+sys.argv[1]+"."+sys.argv[2]+".amazonaws.com/"+sys.argv[3]) - if url[0]: - # dist URL does not match https://${src_bucket}.${src_region}.amazonaws.com/${src_prefix} - print(url[0]) - sys.exit(1) - else: - # rewrite dist URL in manifest to destination bucket - manifest["dist"]["url"] = "https://"+sys.argv[4]+"."+sys.argv[5]+".amazonaws.com/"+sys.argv[6]+url[2] - json.dump(manifest, open(sys.argv[7], "w"), sort_keys=True) - print(url[2]) - PYTHON - ) $src_bucket $src_region $src_prefix $dst_bucket $dst_region $dst_prefix ${dst_tmp}/${manifest}) - then - # the dist URL in the source's manifest points to the source bucket, so we copy the file to the dest bucket - echo -n " - copying '$filename'... " >&2 - out=$(s3cmd ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl --acl-public cp s3://${src_bucket}/${src_prefix}${filename} s3://${dst_bucket}/${dst_prefix}${filename} 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } - copied_files+=("$filename") - echo "done." >&2 - else - # the dist URL points somewhere else, so we are not touching that - echo " - WARNING: not copying '$filename' (in manifest 'dist.url')!" >&2 - # just copy over the manifest (in the above branch, the Python script in the if expression already took care of that) - cp ${src_tmp}/${manifest} ${dst_tmp}/${manifest} - fi - echo -n " - copying manifest file '$manifest'... " >&2 - out=$(s3cmd ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl --acl-public -m application/json put ${dst_tmp}/${manifest} s3://${dst_bucket}/${dst_prefix}${manifest} 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } - echo "done." >&2 -done - -remove_files=() -for manifest in $remove_manifests; do - echo "Removing ${manifest%.composer.json}:" >&2 - if filename=$(cat ${dst_tmp}/${manifest} | python <(cat <<-'PYTHON' # beware of single quotes in body - import sys, json; - manifest=json.load(sys.stdin) - url=manifest.get("dist",{}).get("url","").partition("https://"+sys.argv[1]+"."+sys.argv[2]+".amazonaws.com/"+sys.argv[3]) - if url[0]: - # dist URL does not match https://${dst_bucket}.${dst_region}.amazonaws.com/${dst_prefix} - print(url[0]) - sys.exit(1) - else: - print(url[2]) - PYTHON - ) $dst_bucket $dst_region $dst_prefix) - then - # the dist URL in the destination manifest points to the destination bucket, so we remove that file at the end of the script... - if [[ " ${copied_files[@]:-} " =~ " $filename " ]]; then - # ...unless it was copied earlier (may happen if a new/updated manifest points to the same file name that this to-be-removed one is using) - echo " - NOTICE: keeping newly copied '$filename'!" >&2 - else - echo " - queued '$filename' for removal." >&2 - remove_files+=("$filename") - fi - else - # the dist URL points somewhere else, so we are not touching that - echo " - WARNING: not removing '$filename' (in manifest 'dist.url')!" >&2 - fi - echo -n " - removing manifest file '$manifest'... " >&2 - out=$(s3cmd rm ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl s3://${dst_bucket}/${dst_prefix}${manifest} 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } - rm ${dst_tmp}/${manifest} - echo "done." >&2 -done - -echo "" >&2 - -echo -n "Generating and uploading packages.json... " >&2 -out=$(cd $dst_tmp; $here/mkrepo.sh --upload $dst_bucket $dst_prefix *.composer.json 2>&1) || { echo -e "failed! Error:\n$out" >&2; exit 1; } -echo "done! -$(echo "$out" | grep -E '^Public URL' | sed 's/^Public URL of the object is: http:/Public URL of the repository is: https:/') -" >&2 - -if [[ "${#remove_files[@]}" != "0" ]]; then - echo "Removing files queued for deletion from destination:" >&2 - for filename in "${remove_files[@]}"; do - echo -n " - removing '$filename'... " >&2 - out=$(s3cmd rm ${AWS_ACCESS_KEY_ID+"--access_key=$AWS_ACCESS_KEY_ID"} ${AWS_SECRET_ACCESS_KEY+"--secret_key=$AWS_SECRET_ACCESS_KEY"} --ssl s3://${dst_bucket}/${dst_prefix}${filename} 2>&1) && echo "done." >&2 || echo -e "failed! Error:\n$out" >&2 - done - echo "" >&2 -fi - -echo "Sync complete. -" >&2 diff --git a/vendor/heroku/heroku-buildpack-php/support/build/apache b/vendor/heroku/heroku-buildpack-php/support/build/apache deleted file mode 100755 index a55b3ee..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/apache +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -OUT_PREFIX=$1 - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=httpd-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://archive.apache.org/dist/httpd/${dep_archive_name} -apr_url=https://archive.apache.org/dist/apr/apr-1.6.3.tar.gz -aprutil_url=https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz -dep_manifest=${dep_package}.composer.json - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz - -mkdir -p ${dep_dirname}/srclib/apr -curl -L ${apr_url} | tar xz --strip-components=1 -C ${dep_dirname}/srclib/apr - -mkdir -p ${dep_dirname}/srclib/apr-util -curl -L ${aprutil_url} | tar xz --strip-components=1 -C ${dep_dirname}/srclib/apr-util - -pushd ${dep_dirname} -./configure \ - --enable-layout=GNU \ - --prefix=${OUT_PREFIX} \ - --disable-static \ - --with-included-apr \ - --with-pcre \ - --with-z \ - --with-ssl \ - --with-mpm=event \ - --enable-mods-shared=all \ - --enable-proxy \ - --enable-proxy-fcgi \ - --enable-rewrite \ - --enable-deflate -make -s -j 9 -make install -s -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded -popd - -rm -rf ${OUT_PREFIX}/man ${OUT_PREFIX}/share/apache2/manual - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{}"}" -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"export\":\"bin/export.apache2.sh\",\"profile\":\"bin/profile.apache2.sh\"}"}" - -mkdir -p ${OUT_PREFIX}/etc/apache2 -cp $(dirname $BASH_SOURCE)/_conf/apache2/httpd.conf ${OUT_PREFIX}/etc/apache2/httpd.conf - -mkdir -p ${OUT_PREFIX}/bin -# this gets sourced after package install, so that the buildpack and following buildpacks can invoke -cat > ${OUT_PREFIX}/bin/export.apache2.sh <<'EOF' -export PATH="/app/.heroku/php/bin:/app/.heroku/php/sbin:$PATH" -EOF -# this gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.apache2.sh <<'EOF' -export PATH="$HOME/.heroku/php/bin:$HOME/.heroku/php/sbin:$PATH" -EOF - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-webserver" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/apache-2.4.29 b/vendor/heroku/heroku-buildpack-php/support/build/apache-2.4.29 deleted file mode 100755 index bb636ea..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/apache-2.4.29 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/apache diff --git a/vendor/heroku/heroku-buildpack-php/support/build/composer b/vendor/heroku/heroku-buildpack-php/support/build/composer deleted file mode 100755 index bf7faa8..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/composer +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=pkg-${dep_name}-${dep_version} -dep_manifest=${dep_package}.composer.json - -echo "-----> Bundling Composer (${dep_version})..." - -export PATH=${OUT_PREFIX}/bin:$PATH - -EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") -if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then - >&2 echo 'ERROR: Invalid installer signature' - rm composer-setup.php - exit 1 -fi - -php composer-setup.php --version=${dep_version} - -# php is in there, so clear it first -rm -rf ${OUT_PREFIX}/* -mkdir -p ${OUT_PREFIX}/bin - -mv composer.phar ${OUT_PREFIX}/bin/composer - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-package" "heroku-sys/pkg-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/composer-1.5.2 b/vendor/heroku/heroku-buildpack-php/support/build/composer-1.5.2 deleted file mode 100755 index 6c76347..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/composer-1.5.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-min-7.0.25 - -source $(dirname $0)/composer diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu deleted file mode 100755 index 6f9d58f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -ZEND_MODULE_API_VERSION=$(basename $(dirname $0)) -ZEND_MODULE_API_VERSION=${ZEND_MODULE_API_VERSION#no-debug-non-zts-} - -case ${ZEND_MODULE_API_VERSION} in - 20121212 | 20131226) - MANIFEST_REPLACE='{"heroku-sys/ext-apc":"self.version"}' - ;; -esac - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu-4.0.11 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu-4.0.11 deleted file mode 100755 index 6ca0887..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/apcu-4.0.11 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/apcu diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire deleted file mode 100755 index bbb3e6a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php - -OUT_PREFIX=$1 - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../../_util/include/manifest.sh - -ZEND_MODULE_API_VERSION=$(basename $(dirname $0)) -ZEND_MODULE_API_VERSION=${ZEND_MODULE_API_VERSION#no-debug-non-zts-} - -case ${ZEND_MODULE_API_VERSION} in - 20121212) - series=5.5 - ;; - 20131226) - series=5.6 - ;; - 20151012) - series=7.0 - ;; - 20160303) - series=7.1 - ;; - *) - echo "Unsupported PHP/Zend Module API version: ${ZEND_MODULE_API_VERSION}" - exit 1 - ;; -esac - -ext_dir=${OUT_PREFIX}/lib/php/extensions/no-debug-non-zts-${ZEND_MODULE_API_VERSION} -bin_dir=${OUT_PREFIX}/bin - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -if [[ "$dep_formula" != "$dep_name" ]]; then - probe_version=${dep_formula##*"/${dep_name}-"} - - echo "Using explicit version ${probe_version}" -else - probe_version=`curl -I -A "Heroku" -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/${series/\./} | grep 'X-Blackfire-Release-Version: ' | sed "s%X-Blackfire-Release-Version: %%" | sed s%.$%%` - cat <<-EOF - - !!! WARNING !!! - You're building the generic version of this extension. - API returned version ${probe_version}; it will be built in five seconds. - If you used --overwrite (and no deploy.sh --publish), then this will replace - the existing version of the package under a wrong version number IMMEDIATELY, - even without re-generating the repository, since the archive name is identical: - the repo and new manifest both point to ${dep_name}.tar.gz, but the new manifest - information will not be exposed in the repo until you run mkrepo.sh. - - EOF - sleep 5 -fi -dep_version=${probe_version} -dep_package=ext-${dep_name}-${dep_version} -if [[ "$dep_formula" != "$dep_name" ]]; then - dep_manifest=${dep_package}_php-$series.composer.json -else - dep_manifest=ext-${dep_name}_php-$series.composer.json -fi - -echo "-----> Packaging ${dep_package}..." - -curl -L -o probe.tar.gz "https://packages.blackfire.io/binaries/blackfire-php/${probe_version}/blackfire-php-linux_amd64-php-${series/\./}.tar.gz" - -mkdir -p ${ext_dir} -tar -zxf probe.tar.gz -cp blackfire-${ZEND_MODULE_API_VERSION}.so ${ext_dir}/blackfire.so -rm probe.tar.gz blackfire-${ZEND_MODULE_API_VERSION}.so blackfire-${ZEND_MODULE_API_VERSION}.sha - -agent_version=`curl -A "Heroku" -o agent.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/agent/linux/amd64 | grep 'X-Blackfire-Release-Version: ' | sed "s%X-Blackfire-Release-Version: %%" | sed s%.$%%` -echo "-----> Packaging bin/blackfire-agent ${agent_version}..." - -mkdir -p ${OUT_PREFIX}/var/blackfire/run -mkdir -p ${OUT_PREFIX}/etc/blackfire -echo -e "[blackfire]\nserver-id=f1abf3a8-3f85-4743-99b2-97f066c099b9\nserver-token=5ecbc6486e9db6b780a0c0a9ef1e244709e632996fe9105cb9075ab2826944d5" > ${OUT_PREFIX}/etc/blackfire/agent.ini -mkdir -p ${bin_dir} -tar -zxf agent.tar.gz -chmod +x agent -cp agent ${bin_dir}/blackfire-agent -rm agent.tar.gz agent agent.sha1 - -echo "-----> Packaging bin/blackfire ${agent_version}..." -curl https://packages.blackfire.io/binaries/blackfire-agent/${agent_version}/blackfire-cli-linux_amd64 > ${bin_dir}/blackfire -chmod +x ${bin_dir}/blackfire - -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded - -# gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.blackfire.sh <<'EOF' -if [[ -n "$BLACKFIRE_SERVER_TOKEN" && -n "$BLACKFIRE_SERVER_ID" ]]; then - if [[ -f "/app/.heroku/php/bin/blackfire-agent" ]]; then - touch /app/.heroku/php/var/blackfire/run/agent.sock - /app/.heroku/php/bin/blackfire-agent -config=/app/.heroku/php/etc/blackfire/agent.ini -socket="unix:///app/.heroku/php/var/blackfire/run/agent.sock" & - else - echo >&2 "WARNING: Add-on 'blackfire' detected, but PHP extension not yet installed. Push an update to the application to finish installation of the add-on; an empty change ('git commit --allow-empty') is sufficient." - fi -fi -EOF -mkdir -p ${OUT_PREFIX}/etc/php/conf.d -cat > ${OUT_PREFIX}/etc/php/conf.d/blackfire.ini-dist <<'EOF' -extension = blackfire.so - -blackfire.server_token = ${BLACKFIRE_SERVER_TOKEN} -blackfire.server_id = ${BLACKFIRE_SERVER_ID} -blackfire.agent_socket = "unix:///app/.heroku/php/var/blackfire/run/agent.sock" -EOF - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\"}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{}"}" -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"config\":\"etc/php/conf.d/blackfire.ini-dist\",\"profile\":\"bin/profile.blackfire.sh\"}"}" - -python $(dirname $BASH_SOURCE)/../../_util/include/manifest.py "heroku-sys-php-extension" "heroku-sys/ext-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" - -if [[ "$dep_formula" == "$dep_name" ]]; then - cat <<-EOF - - !!! WARNING !!! If you just deployed using --overwrite and without --publish: - the new manifest points to the updated tarball ${dep_name}.tar.gz; - this tarball will now already be picked up by the existing repository under a - wrong version number. Regenerate repository with 'mkrepo.sh --upload' at once! - - EOF -fi diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire-1.18.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire-1.18.0 deleted file mode 100755 index e093375..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/blackfire-1.18.0 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra deleted file mode 100755 index c6bf2bc..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# we need libgmp-dev -needed=( libgmp-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -dep_name=$(basename $BASH_SOURCE) - -OUT_PREFIX=$1 -export PATH=${OUT_PREFIX}/bin:${PATH} - -# we need to declare the required version of libcassandra -dep_formula=${0#$WORKSPACE_DIR/} -dep_version=${dep_formula##*"/${dep_name}-"} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -case "$dep_version" in - *) - MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\",\"heroku-sys/libcassandra\":\"^2.7.0\",\"heroku-sys/libcassandra-abi\":\"^2\"}"}" - ;; -esac - -CONFIGURE_EXTRA="--with-cassandra=${OUT_PREFIX}" - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra-1.2.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra-1.2.2 deleted file mode 100755 index 07c547b..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/cassandra-1.2.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38, libraries/libcassandra-2.7.1 - -source $(dirname $0)/cassandra diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev-1.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev-1.0.4 deleted file mode 100755 index 723183a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/ev-1.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/ev diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event-2.3.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event-2.3.0 deleted file mode 100755 index 8d00bf4..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/event-2.3.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/event diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick-3.4.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick-3.4.3 deleted file mode 100755 index 41d19e8..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/imagick-3.4.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/imagick diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached deleted file mode 100755 index 3cc5727..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -OUT_PREFIX=$1 -export PATH=${OUT_PREFIX}/bin:${PATH} - -# can't build without this -needed=( libsasl2-2 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Error! Missing libraries: $missing" - exit 1 -fi - -# let's see if libmemcached is there, if not then we have to use the vendored one -needed=( libmemcached11 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Using vendored libmemcached..." - # use vendored libmcrypt - CONFIGURE_EXTRA="--with-libmemcached-dir=${OUT_PREFIX}" - - # we need to declare the required version of libmemcached - dep_formula=${0#$WORKSPACE_DIR/} - dep_version=${dep_formula##*"/${dep_name}-"} - series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest - case "$dep_version" in - *) - MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\",\"heroku-sys/libmemcached\":\"^1.0.18\",\"heroku-sys/libmemcached-abi\":\"^11\"}"}" - ;; - esac - -else - echo "Using system libmemcached..." - # use system libmemcached - CONFIGURE_EXTRA= - # but do we need headers? - needed=( libmemcached-dev ) - missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) - if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing - fi -fi - -# we need libsasl2-dev for ext-memcached -needed=( libsasl2-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"config\":\"etc/php/conf.d/memcached.ini-dist\"}"}" - -source $(dirname $BASH_SOURCE)/../pecl - -mkdir -p ${OUT_PREFIX}/etc/php/conf.d -cat > ${OUT_PREFIX}/etc/php/conf.d/memcached.ini-dist <<'EOF' -extension = memcached.so -EOF -if [[ $dep_version == 2.* ]]; then - # this setting is gone in v3; SASL gets initialized on demand - cat >> ${OUT_PREFIX}/etc/php/conf.d/memcached.ini-dist <<'EOF' -memcached.use_sasl = 1 -EOF -fi diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached-2.2.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached-2.2.0 deleted file mode 100755 index 153ff32..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/memcached-2.2.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38, libraries/libmemcached-1.0.18 - -source $(dirname $0)/memcached diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo-1.6.16 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo-1.6.16 deleted file mode 100755 index 9316497..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongo-1.6.16 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/mongo diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb-1.3.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb-1.3.1 deleted file mode 100755 index 6d7e8f6..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/mongodb-1.3.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/mongodb diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic deleted file mode 100755 index caf0125..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../../_util/include/manifest.sh - -OUT_PREFIX=$1 - -ZEND_MODULE_API_VERSION=$(basename $(dirname $0)) -ZEND_MODULE_API_VERSION=${ZEND_MODULE_API_VERSION#no-debug-non-zts-} - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=ext-${dep_name}-${dep_version} -dep_dirname=newrelic-php5-${dep_version}-linux -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://download.newrelic.com/php_agent/archive/${dep_version}/${dep_archive_name} -case ${ZEND_MODULE_API_VERSION} in - 20121212) - series=5.5 - ;; - 20131226) - series=5.6 - ;; - 20151012) - series=7.0 - ;; - 20160303) - series=7.1 - ;; -esac -dep_manifest=${dep_package}_php-$series.composer.json - -echo "-----> Packaging ${dep_package}..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} -ext_dir=${OUT_PREFIX}/lib/php/extensions/no-debug-non-zts-${ZEND_MODULE_API_VERSION} -bin_dir=${OUT_PREFIX}/bin -mkdir -p ${ext_dir} -mkdir -p ${bin_dir} -cp agent/x64/newrelic-${ZEND_MODULE_API_VERSION}.so ${ext_dir}/newrelic.so -cp daemon/newrelic-daemon.x64 ${bin_dir}/newrelic-daemon -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded -popd - -mkdir -p ${OUT_PREFIX}/bin -# gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.newrelic.sh <<'EOF' -if [[ -n "$NEW_RELIC_LICENSE_KEY" ]]; then - if [[ -f "/app/.heroku/php/bin/newrelic-daemon" ]]; then - export NEW_RELIC_APP_NAME=${NEW_RELIC_APP_NAME:-${HEROKU_APP_NAME:-"PHP Application on Heroku"}} - export NEW_RELIC_LOG_LEVEL=${NEW_RELIC_LOG_LEVEL:-"warning"} - - # The daemon is a started in foreground mode so it will not daemonize - # (i.e. disassociate from the controlling TTY and disappear into the - # background). - # - # Perpetually tail and redirect the daemon log file to stderr so that it - # may be observed via 'heroku logs'. - touch /tmp/heroku.ext-newrelic.newrelic-daemon.${PORT}.log - tail -qF -n 0 /tmp/heroku.ext-newrelic.newrelic-daemon.${PORT}.log 1>&2 & - - # daemon start - /app/.heroku/php/bin/newrelic-daemon --foreground --logfile "/tmp/heroku.ext-newrelic.newrelic-daemon.${PORT}.log" --loglevel "${NEW_RELIC_LOG_LEVEL}" --pidfile "/tmp/newrelic-daemon.pid" & - - # give it a moment to connect - sleep 2 - else - echo >&2 "WARNING: Add-on 'newrelic' detected, but PHP extension not yet installed. Push an update to the application to finish installation of the add-on; an empty change ('git commit --allow-empty') is sufficient." - fi -fi -EOF -mkdir -p ${OUT_PREFIX}/etc/php/conf.d -cat > ${OUT_PREFIX}/etc/php/conf.d/newrelic.ini-dist <<'EOF' -extension = newrelic.so - -newrelic.daemon.location = /app/.heroku/php/bin/newrelic-daemon - -newrelic.loglevel = ${NEW_RELIC_LOG_LEVEL} -newrelic.daemon.loglevel = ${NEW_RELIC_LOG_LEVEL} - -newrelic.license = ${NEW_RELIC_LICENSE_KEY} -newrelic.appname = ${NEW_RELIC_APP_NAME} -newrelic.logfile = stderr ; the stdout default messes up boots as we capture output for crash detection - -; The daemon gets spawned by the PHP agent and is configured with the same values -; -; There is code in bin/compile to create .profile.d/newrelic.sh. That script -; starts the daemon and runs a perpetual tail command which will redirect daemon -; logs to stderr so that it may be observed via 'heroku logs'. -newrelic.daemon.logfile = /tmp/heroku.ext-newrelic.newrelic-daemon.${PORT}.log - -; or else: -; 2015-05-18 13:00:43.144 (28 28) warning: unable to find suitable pidfile location, using none -newrelic.daemon.pidfile = /tmp/newrelic-daemon.pid -EOF - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\"}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{}"}" -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"config\":\"etc/php/conf.d/newrelic.ini-dist\",\"profile\":\"bin/profile.newrelic.sh\"}"}" - -python $(dirname $BASH_SOURCE)/../../_util/include/manifest.py "heroku-sys-php-extension" "heroku-sys/ext-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic-7.6.0.201 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic-7.6.0.201 deleted file mode 100755 index 04e8b30..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/newrelic-7.6.0.201 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/newrelic diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth-1.2.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth-1.2.3 deleted file mode 100755 index 58ec38f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/oauth-1.2.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/oauth diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon deleted file mode 100755 index c468473..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../../_util/include/manifest.sh - -OUT_PREFIX=$1 - -export PATH=${OUT_PREFIX}/bin:${PATH} - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=ext-${dep_name}-${dep_version} -if [[ "$dep_version" == 2.* ]]; then - dep_dirname=cphalcon-${dep_name}-v${dep_version} - dep_archive_name=${dep_name}-v${dep_version}.tar.gz -else - dep_dirname=cphalcon-${dep_version} - dep_archive_name=v${dep_version}.tar.gz -fi -dep_url=https://github.com/phalcon/cphalcon/archive/${dep_archive_name} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -dep_manifest=${dep_package}_php-$series.composer.json - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz - -if [[ "$dep_version" == 2.* ]]; then - workdir=64bits -else - workdir=php${series:0:1}/64bits -fi -pushd ${dep_dirname} -pushd build -pushd ${workdir} -export CC="gcc" -export CFLAGS="-O2 -fvisibility=hidden" -export CPPFLAGS="-DPHALCON_RELEASE" -phpize -./configure --prefix=${OUT_PREFIX} --enable-phalcon -make -s -j9 -# php was a build dep, and it's in $OUT_PREFIX. nuke that, then make install so all we're left with is the extension -rm -rf ${OUT_PREFIX}/* -make install -s -popd -popd -strip --strip-unneeded ${OUT_PREFIX}/lib/php/extensions/*/*.so -popd - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\"}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" - -python $(dirname $BASH_SOURCE)/../../_util/include/manifest.py "heroku-sys-php-extension" "heroku-sys/ext-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-2.0.13 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-2.0.13 deleted file mode 100755 index 397c478..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-2.0.13 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-3.2.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-3.2.4 deleted file mode 100755 index 397c478..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/phalcon-3.2.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq deleted file mode 100755 index c804b2c..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -OUT_PREFIX=$1 -export PATH=${OUT_PREFIX}/bin:${PATH} - -# raphf needs to be loaded at build time -echo 'extension=raphf.so' > ${OUT_PREFIX}/etc/php/conf.d/raphf.ini - -# we need to declare the right version of raphf as required -dep_formula=${0#$WORKSPACE_DIR/} -dep_version=${dep_formula##*"/${dep_name}-"} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -case "$dep_version" in - 1.*) - MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\",\"heroku-sys/ext-raphf\":\"^1.1.0\",\"heroku-sys/ext-json\":\"*\",\"heroku-sys/ext-spl\":\"*\"}"}" - ;; - *) - MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\",\"heroku-sys/ext-raphf\":\">=2.0.0\",\"heroku-sys/ext-json\":\"*\",\"heroku-sys/ext-spl\":\"*\"}"}" - ;; -esac - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq-1.1.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq-1.1.1 deleted file mode 100755 index 5cf133f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/pq-1.1.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38, extensions/no-debug-non-zts-20121212/raphf-1.1.2 - -source $(dirname $0)/pq diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf-1.1.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf-1.1.2 deleted file mode 100755 index 35c4aba..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/raphf-1.1.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/raphf diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka deleted file mode 100755 index d6bd528..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -OUT_PREFIX=$1 -export PATH=${OUT_PREFIX}/bin:${PATH} - -# we need to declare the required version of librdkafka -dep_formula=${0#$WORKSPACE_DIR/} -dep_version=${dep_formula##*"/${dep_name}-"} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -case "$dep_version" in - *) - MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\",\"heroku-sys/librdkafka\":\"~0.9\",\"heroku-sys/librdkafka-abi\":\"^1\"}"}" - ;; -esac - -CONFIGURE_EXTRA="--with-rdkafka=${OUT_PREFIX}" - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka-3.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka-3.0.4 deleted file mode 100755 index 65ed348..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/rdkafka-3.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38, libraries/librdkafka-0.11.1 - -source $(dirname $0)/rdkafka diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis deleted file mode 100755 index 58fb390..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis-3.1.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis-3.1.4 deleted file mode 100755 index 5148c25..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20121212/redis-3.1.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.5.38 - -source $(dirname $0)/redis diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp deleted file mode 100755 index ce331ed..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# let's see if librabbitmq is there -needed=( librabbitmq4 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Need $missing"; exit 1; -fi - -# but do we need headers? -needed=( librabbitmq-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -dep_name=$(basename $BASH_SOURCE) - -source $(dirname $BASH_SOURCE)/../pecl diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp-1.9.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp-1.9.3 deleted file mode 100755 index 018ee36..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/amqp-1.9.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/amqp diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/apcu-4.0.11 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/apcu-4.0.11 deleted file mode 100755 index 522cf72..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/apcu-4.0.11 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/apcu diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire deleted file mode 100755 index 153289a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire-1.18.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire-1.18.0 deleted file mode 100755 index e093375..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/blackfire-1.18.0 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/cassandra-1.3.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/cassandra-1.3.2 deleted file mode 100755 index 18ef87f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/cassandra-1.3.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32, libraries/libcassandra-2.7.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/cassandra diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/ev-1.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/ev-1.0.4 deleted file mode 100755 index 985f982..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/ev-1.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/ev diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/event-2.3.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/event-2.3.0 deleted file mode 100755 index 8ca6704..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/event-2.3.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/event diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/imagick-3.4.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/imagick-3.4.3 deleted file mode 100755 index e5c8dfe..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/imagick-3.4.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/imagick diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/memcached-2.2.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/memcached-2.2.0 deleted file mode 100755 index 8f9dee1..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/memcached-2.2.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32, libraries/libmemcached-1.0.18 - -source $(dirname $0)/../no-debug-non-zts-20121212/memcached diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongo-1.6.16 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongo-1.6.16 deleted file mode 100755 index b1f735f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongo-1.6.16 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/mongo diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongodb-1.3.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongodb-1.3.1 deleted file mode 100755 index 3f9e878..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/mongodb-1.3.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/mongodb diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/newrelic-7.6.0.201 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/newrelic-7.6.0.201 deleted file mode 100755 index 42faa75..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/newrelic-7.6.0.201 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/newrelic diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/oauth-1.2.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/oauth-1.2.3 deleted file mode 100755 index 23dcfbd..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/oauth-1.2.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/oauth diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-2.0.13 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-2.0.13 deleted file mode 100755 index f332da3..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-2.0.13 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-3.2.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-3.2.4 deleted file mode 100755 index f332da3..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/phalcon-3.2.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/pq-1.1.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/pq-1.1.1 deleted file mode 100755 index 9970626..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/pq-1.1.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32, extensions/no-debug-non-zts-20131226/raphf-1.1.2 - -source $(dirname $0)/../no-debug-non-zts-20121212/pq diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/raphf-1.1.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/raphf-1.1.2 deleted file mode 100755 index 377e0f0..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/raphf-1.1.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/raphf diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/rdkafka-3.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/rdkafka-3.0.4 deleted file mode 100755 index 1ceab1b..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/rdkafka-3.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32, libraries/librdkafka-0.11.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/rdkafka diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/redis-3.1.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/redis-3.1.4 deleted file mode 100755 index 3a6c1a9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20131226/redis-3.1.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-5.6.32 - -source $(dirname $0)/../no-debug-non-zts-20121212/redis diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/amqp-1.9.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/amqp-1.9.3 deleted file mode 100755 index 7821f37..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/amqp-1.9.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20131226/amqp diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu deleted file mode 100755 index 3bec956..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../../_util/include/manifest.sh - -OUT_PREFIX=$1 - -export PATH=${OUT_PREFIX}/bin:${PATH} - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=ext-${dep_name}-${dep_version} -dep_dirname=${dep_name}-${dep_version} -dep_archive_name=${dep_dirname}.tgz -dep_url=https://pecl.php.net/get/${dep_archive_name} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -dep_manifest=${dep_package}_php-$series.composer.json - -echo "-----> Building ${dep_package} (from PECL)..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} -phpize -./configure \ - --prefix=${OUT_PREFIX} \ - ${CONFIGURE_EXTRA:-} -make -s -j 9 -make install -s -popd - -dep2_name=apcu_bc -dep2_version=1.0.3 -dep2_dirname=${dep2_name}-${dep2_version} -dep2_archive_name=${dep2_dirname}.tgz -dep2_url=https://pecl.php.net/get/${dep2_archive_name} - -echo "-----> Building ${dep2_name}-${dep2_version} (from PECL)..." - -curl -L ${dep2_url} | tar xz - -pushd ${dep2_dirname} -phpize -./configure \ - --prefix=${OUT_PREFIX} -make -s -j 9 -# php was a build dep, and it's in $OUT_PREFIX. nuke that, then make install so all we're left with is the extension -rm -rf ${OUT_PREFIX}/* -make install -s -popd - -pushd ${dep_dirname} -# install again, we removed it earlier -make install -s -popd - -# cleanup -strip --strip-unneeded ${OUT_PREFIX}/lib/php/extensions/*/*.so - -mkdir -p ${OUT_PREFIX}/etc/php/conf.d -cat > ${OUT_PREFIX}/etc/php/conf.d/apcu-apc.ini-dist <<'EOF' -extension=apcu.so -extension=apc.so -EOF - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\"}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{\"heroku-sys/ext-apc\":\"self.version\"}"}" # despite version 1.0.3 or whatever, apcu_bc identifies itself using the apcu version number -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"config\":\"etc/php/conf.d/apcu-apc.ini-dist\"}"}" - -python $(dirname $BASH_SOURCE)/../../_util/include/manifest.py "heroku-sys-php-extension" "heroku-sys/ext-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu-5.1.8 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu-5.1.8 deleted file mode 100755 index 200831c..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/apcu-5.1.8 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/apcu diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire deleted file mode 100755 index 153289a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire-1.18.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire-1.18.0 deleted file mode 100755 index e093375..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/blackfire-1.18.0 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/cassandra-1.3.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/cassandra-1.3.2 deleted file mode 100755 index 4f1d64b..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/cassandra-1.3.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25, libraries/libcassandra-2.7.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/cassandra diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/ev-1.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/ev-1.0.4 deleted file mode 100755 index de4254d..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/ev-1.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/ev diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/event-2.3.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/event-2.3.0 deleted file mode 100755 index 31d4816..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/event-2.3.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/event diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/imagick-3.4.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/imagick-3.4.3 deleted file mode 100755 index 789f586..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/imagick-3.4.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/imagick diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/memcached-3.0.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/memcached-3.0.3 deleted file mode 100755 index 8ebdb29..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/memcached-3.0.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25, libraries/libmemcached-1.0.18 - -source $(dirname $0)/../no-debug-non-zts-20121212/memcached diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/mongodb-1.3.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/mongodb-1.3.1 deleted file mode 100755 index 7e3958d..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/mongodb-1.3.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/mongodb diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/newrelic-7.6.0.201 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/newrelic-7.6.0.201 deleted file mode 100755 index 42faa75..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/newrelic-7.6.0.201 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/newrelic diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/oauth-2.0.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/oauth-2.0.2 deleted file mode 100755 index f28c466..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/oauth-2.0.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/oauth diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/phalcon-3.2.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/phalcon-3.2.4 deleted file mode 100755 index 2c55c5d..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/phalcon-3.2.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/pq-2.1.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/pq-2.1.2 deleted file mode 100755 index fc1c52c..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/pq-2.1.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25, extensions/no-debug-non-zts-20151012/raphf-2.0.0 - -source $(dirname $0)/../no-debug-non-zts-20121212/pq diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/raphf-2.0.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/raphf-2.0.0 deleted file mode 100755 index 7374a13..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/raphf-2.0.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/raphf diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/rdkafka-3.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/rdkafka-3.0.4 deleted file mode 100755 index ff7ac27..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/rdkafka-3.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25, libraries/librdkafka-0.11.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/rdkafka diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/redis-3.1.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/redis-3.1.4 deleted file mode 100755 index e0e81c4..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20151012/redis-3.1.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.0.25 - -source $(dirname $0)/../no-debug-non-zts-20121212/redis diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/amqp-1.9.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/amqp-1.9.3 deleted file mode 100755 index b0d7bd3..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/amqp-1.9.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20131226/amqp diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/apcu-5.1.8 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/apcu-5.1.8 deleted file mode 100755 index a3ea591..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/apcu-5.1.8 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20151012/apcu diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire deleted file mode 100755 index 153289a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire-1.18.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire-1.18.0 deleted file mode 100755 index e093375..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/blackfire-1.18.0 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/blackfire diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/cassandra-1.3.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/cassandra-1.3.2 deleted file mode 100755 index d9a5c86..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/cassandra-1.3.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11, libraries/libcassandra-2.7.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/cassandra diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/ev-1.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/ev-1.0.4 deleted file mode 100755 index 2f369e5..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/ev-1.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/ev diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/event-2.3.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/event-2.3.0 deleted file mode 100755 index ad614b1..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/event-2.3.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/event diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/imagick-3.4.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/imagick-3.4.3 deleted file mode 100755 index ee431b9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/imagick-3.4.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/imagick diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/memcached-3.0.3 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/memcached-3.0.3 deleted file mode 100755 index 65c12f9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/memcached-3.0.3 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11, libraries/libmemcached-1.0.18 - -source $(dirname $0)/../no-debug-non-zts-20121212/memcached diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/mongodb-1.3.1 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/mongodb-1.3.1 deleted file mode 100755 index 46edc81..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/mongodb-1.3.1 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/mongodb diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/newrelic-7.6.0.201 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/newrelic-7.6.0.201 deleted file mode 100755 index 42faa75..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/newrelic-7.6.0.201 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/../no-debug-non-zts-20121212/newrelic diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/oauth-2.0.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/oauth-2.0.2 deleted file mode 100755 index a525633..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/oauth-2.0.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/oauth diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/phalcon-3.2.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/phalcon-3.2.4 deleted file mode 100755 index d82dcf2..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/phalcon-3.2.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/phalcon diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/pq-2.1.2 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/pq-2.1.2 deleted file mode 100755 index 5d6323e..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/pq-2.1.2 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11, extensions/no-debug-non-zts-20160303/raphf-2.0.0 - -source $(dirname $0)/../no-debug-non-zts-20121212/pq diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/raphf-2.0.0 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/raphf-2.0.0 deleted file mode 100755 index 6dd2ec7..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/raphf-2.0.0 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/raphf diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/rdkafka-3.0.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/rdkafka-3.0.4 deleted file mode 100755 index 56ec51c..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/rdkafka-3.0.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11, libraries/librdkafka-0.11.1 - -source $(dirname $0)/../no-debug-non-zts-20121212/rdkafka diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/redis-3.1.4 b/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/redis-3.1.4 deleted file mode 100755 index 786dc9c..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/no-debug-non-zts-20160303/redis-3.1.4 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: php-7.1.11 - -source $(dirname $0)/../no-debug-non-zts-20121212/redis diff --git a/vendor/heroku/heroku-buildpack-php/support/build/extensions/pecl b/vendor/heroku/heroku-buildpack-php/support/build/extensions/pecl deleted file mode 100755 index 30f3d6d..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/extensions/pecl +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -export PATH=${OUT_PREFIX}/bin:${PATH} - -dep_formula=${0#$WORKSPACE_DIR/} -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=ext-${dep_name}-${dep_version} -dep_dirname=${dep_name}-${dep_version} -dep_archive_name=${dep_dirname}.tgz -dep_url=https://pecl.php.net/get/${dep_archive_name} -series=$(php-config --version | cut -d. -f1,2) # get "5.5", "5.6", "7.0" etc for the php requirement in the manifest -dep_manifest=${dep_package}_php-$series.composer.json - -echo "-----> Building ${dep_package} (from PECL)..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} -phpize -./configure \ - --prefix=${OUT_PREFIX} \ - ${CONFIGURE_EXTRA:-} -make -s -j 9 -# php was a build dep, and it's in $OUT_PREFIX. nuke that, then make install so all we're left with is the extension -rm -rf ${OUT_PREFIX}/* -make install -s -strip --strip-unneeded ${OUT_PREFIX}/lib/php/extensions/*/*.so -popd - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{\"heroku-sys/php\":\"${series}.*\"}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{}"}" -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{}"}" - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "heroku-sys-php-extension" "heroku-sys/ext-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/hhvm b/vendor/heroku/heroku-buildpack-php/support/build/hhvm deleted file mode 100755 index bd74455..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/hhvm +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -OUT_PREFIX=$1 - -STACK=${STACK:-"cedar"} - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=hhvm_${dep_version} -if [[ $STACK == "cedar" ]]; then - dep_archive_name=${dep_dirname}~lucid_amd64.deb -else - dep_archive_name=${dep_dirname}~trusty_amd64.deb -fi -dep_url=http://dl.hhvm.com/ubuntu/pool/main/h/hhvm/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -echo "-----> Building ${dep_package}..." - -mkdir -p $OUT_PREFIX - -if [[ $STACK == "cedar" ]]; then - deps="${dep_url} -http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/pool/main/b/binutils/binutils_2.22-4ubuntu1~10.04.1_amd64.deb -http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/pool/main/g/gcc-4.8/libstdc++6_4.8.1-2ubuntu1~10.04.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/t/tbb/libtbb2_2.2+r009-1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/libo/libonig/libonig2_5.9.1-1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/libm/libmcrypt/libmcrypt4_2.5.8-3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/u/uw-imap/libc-client2007e_2007e~dfsg-3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/e/elfutils/libelf1_0.143-1_amd64.deb" -else - deps="${dep_url} -http://mirrors.kernel.org/ubuntu/pool/main/b/boost1.54/libboost-filesystem1.54.0_1.54.0-4ubuntu3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/b/boost1.54/libboost-program-options1.54.0_1.54.0-4ubuntu3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/b/boost1.54/libboost-regex1.54.0_1.54.0-4ubuntu3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/b/boost1.54/libboost-system1.54.0_1.54.0-4ubuntu3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/b/boost1.54/libboost-thread1.54.0_1.54.0-4ubuntu3.1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/u/uw-imap/libc-client2007e_2007f~dfsg-4_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/e/elfutils/libelf1_0.160-0ubuntu3_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/g/gflags/libgflags2_2.0-2.1build1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/g/google-glog/libgoogle-glog0_0.3.3-2build1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu52_52.1-8_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/j/jemalloc/libjemalloc1_3.6.0-9ubuntu1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/libm/libmcrypt/libmcrypt4_2.5.8-3.3_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/libm/libmemcached/libmemcached10_1.0.8-1ubuntu2_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/libo/libonig/libonig2_5.9.6-1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-4.9/libstdc%2b%2b6_4.9.2-10ubuntu13_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/universe/t/tbb/libtbb2_4.3~20150316-0ubuntu1_amd64.deb -http://mirrors.kernel.org/ubuntu/pool/main/libu/libunwind/libunwind8_1.1-3.2_amd64.deb" -fi - -for dep in $deps; do - depb=$(basename $dep) - echo " - $depb" - curl -LO $dep - dpkg -x $depb ${OUT_PREFIX} -done -strip --strip-unneeded ${OUT_PREFIX}/usr/bin/* - -export LD_LIBRARY_PATH=/app/.heroku/php/usr/lib/x86_64-linux-gnu:/app/.heroku/php/usr/lib/hhvm:/app/.heroku/php/usr/lib -export PATH=/app/.heroku/php/usr/bin:$PATH -echo "-----> Generating manifest..." -curl -sS https://getcomposer.org/installer | hhvm --php - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/php\":\"*\"}"}" -MANIFEST_REPLACE=$(hhvm --php composer.phar show --platform | grep -E '^(ext-\S+|php-64bit\b|php\b)' | tr -s " " | cut -d " " -f1,2 | sed -e "s/ $dep_version\$/ self.version/" -e 's/^/heroku-sys\//' | python -c 'import sys, json; json.dump(dict(item.split() for item in sys.stdin), sys.stdout)') -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"export\":\"bin/export.hhvm.sh\",\"profile\":\"bin/profile.hhvm.sh\"}"}" - -# remove temporary composer download -rm composer.phar - -mkdir -p ${OUT_PREFIX}/bin -# this gets sourced after package install, so that the buildpack and following buildpacks can invoke -cat > ${OUT_PREFIX}/bin/export.hhvm.sh <<'EOF' -export LD_LIBRARY_PATH=$HOME/.heroku/php/usr/lib/x86_64-linux-gnu:$HOME/.heroku/php/usr/lib/hhvm:$HOME/.heroku/php/usr/lib -export PATH="$PATH:/app/.heroku/php/usr/bin" -EOF -# this gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.hhvm.sh <<'EOF' -export PATH="$PATH:$HOME/.heroku/php/usr/bin" -hhvm() { LD_LIBRARY_PATH=$HOME/.heroku/php/usr/lib/x86_64-linux-gnu:$HOME/.heroku/php/usr/lib/hhvm:$HOME/.heroku/php/usr/lib $(which hhvm) "$@"; } -export -f hhvm -composer() { hhvm $(which composer) "$@"; } -export -f composer -EOF - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-hhvm" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/hhvm-3.5.1 b/vendor/heroku/heroku-buildpack-php/support/build/hhvm-3.5.1 deleted file mode 100755 index 3a74791..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/hhvm-3.5.1 +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# Depends: -# binutils -# libasn1-8-heimdal -# libboost-filesystem1.54.0 -# libboost-program-options1.54.0 -# libboost-regex1.54.0 -# libboost-system1.54.0 -# libboost-system1.54.0 -# libboost-thread1.54.0 -# libbz2-1.0 -# libc-client2007e -# libc6 -# libcap2 -# libcomerr2 -# libcurl3 (>= 7.28.0) -# libedit2 -# libelf1 -# libevent-2.0-5 -# libexpat1 -# libfontconfig1 -# libfreetype6 -# libgcc1 -# libgcrypt11 -# libgd3 -# libgmp10 -# libgnutls26 -# libgoogle-glog0 (>= 0.3.1) -# libgpg-error0 -# libgssapi-krb5-2 -# libgssapi3-heimdal -# libhcrypto4-heimdal -# libheimbase1-heimdal -# libheimntlm0-heimdal -# libhx509-5-heimdal -# libicu52 -# libidn11 -# libjemalloc1 (>= 3.0.0) -# libjpeg-turbo8 -# libk5crypto3 -# libkeyutils1 -# libkrb5-26-heimdal -# libkrb5-3 -# libkrb5support0 -# libldap-2.4-2 -# libmagickwand5 -# libmcrypt4 -# libmemcached10 -# libmysqlclient18 -# libonig2 -# libp11-kit0 -# libpam0g -# libpcre3 -# libpng12-0 -# libroken18-heimdal -# librtmp0 -# libsasl2-2 -# libsqlite3-0 -# libssl1.0.0 -# libstdc++6 -# libtasn1-6 -# libtbb2 -# libtinfo5 -# libwind0-heimdal -# libx11-6 -# libxau6 -# libxcb1 -# libxdmcp6 -# libxml2 -# libxpm4 -# libxslt1.1 -# zlib1g - -source $(dirname $0)/hhvm diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client deleted file mode 100755 index 3b874c1..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=pkg-${dep_name}-${dep_version} -dep_dirname=imap-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=ftp://ftp.cac.washington.edu/imap/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -echo "-----> Building ${dep_package}..." - -# we need that for IMAP -needed=( libpam0g-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} -touch ip6 # so we do not get prompted -make ldb EXTRACFLAGS=-fPIC # need PIC so relocations work in the shared imap.so ext later -mkdir -p ${OUT_PREFIX}/opt/${dep_dirname}/include ${OUT_PREFIX}/opt/${dep_dirname}/lib -cp c-client/*.h ${OUT_PREFIX}/opt/${dep_dirname}/include -cp c-client/*.c ${OUT_PREFIX}/opt/${dep_dirname}/lib -cp c-client/*.a ${OUT_PREFIX}/opt/${dep_dirname}/lib -strip --strip-unneeded ${OUT_PREFIX}/opt/${dep_dirname}/lib/*.a -popd - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "heroku-sys-package" "heroku-sys/pkg-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client-2007f b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client-2007f deleted file mode 100755 index e81fadd..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libc-client-2007f +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/libc-client diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra deleted file mode 100755 index 7f6b993..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=cpp-driver-${dep_version} -dep_archive_name=${dep_version}.tar.gz -dep_url=https://github.com/datastax/cpp-driver/archive/${dep_version}.tar.gz -dep_manifest=${dep_package}.composer.json - -# we need libgmp-dev and cmake -needed=( libgmp-dev cmake ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz -pushd ${dep_dirname} -cmake -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_INSTALL_PREFIX:PATH=${OUT_PREFIX} -DCMAKE_BUILD_TYPE=RELEASE -DCASS_USE_ZLIB=ON -DCMAKE_INSTALL_LIBDIR:PATH=lib . -make -s -j9 -make install -s -rm ${OUT_PREFIX}/lib/libcassandra_static.a -strip --strip-unneeded ${OUT_PREFIX}/lib/libcassandra*.so* -popd - -ABI_VERSION=$(soname_version ${OUT_PREFIX}/lib/libcassandra.so) -echo -echo "ABI version is: ${ABI_VERSION}" -echo - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "heroku-sys-library" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "{}" "{}" "{}" "{\"heroku-sys/libcassandra-abi\":\"${ABI_VERSION}\"}" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra-2.7.1 b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra-2.7.1 deleted file mode 100755 index 78a8d18..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libcassandra-2.7.1 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/libcassandra diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt deleted file mode 100755 index 4c35f18..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=pkg-${dep_name}-${dep_version} -dep_dirname=${dep_name}-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/${dep_version}/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -# skip build if already present -needed=( libmcrypt4 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) - -if [[ "$missing" ]]; then - echo "-----> Building ${dep_package}..." - - curl -L ${dep_url} | tar xz - - pushd ${dep_dirname} - ./configure --disable-posix-threads --prefix=${OUT_PREFIX} - make -s -j 9 - make install-strip -s - popd - - rm -rf ${OUT_PREFIX}/man -else - echo "-----> System ${dep_name} available, creating empty package..." -fi - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "heroku-sys-package" "heroku-sys/pkg-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt-2.5.8 b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt-2.5.8 deleted file mode 100755 index 4f23e8f..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmcrypt-2.5.8 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/libmcrypt diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached deleted file mode 100755 index 90622c3..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=${dep_name}-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://launchpad.net/libmemcached/1.0/${dep_version}/+download/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -# can't build without this -needed=( libsasl2-2 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Error! Missing libraries: $missing" - exit 1 -fi - -# skip build if already present -needed=( libmemcached11 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - # we need libsasl2-dev - needed=( libsasl2-dev ) - missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) - if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing - fi - echo "-----> Building ${dep_package}..." - - curl -L ${dep_url} | tar xz - pushd ${dep_dirname} - ./configure --prefix=${OUT_PREFIX} --without-memcached --disable-static - make -s -j 9 - make install-strip -s - popd - - rm -rf ${OUT_PREFIX}/share/man - - ABI_VERSION=$(soname_version ${OUT_PREFIX}/lib/libmemcached.so) - type="heroku-sys-library" -else - echo "-----> System ${dep_name} available, creating empty package..." - ABI_VERSION=$(soname_version /usr/lib/x86_64-linux-gnu/libmemcached.so) - # we don't want this dummy package to end up in the Composer repository - type="heroku-sys-package" -fi - -echo -echo "ABI version is: ${ABI_VERSION}" -echo - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "$type" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "{}" "{}" "{}" "{\"heroku-sys/libmemcached-abi\":\"${ABI_VERSION}\"}" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached-1.0.18 b/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached-1.0.18 deleted file mode 100755 index 4495a90..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/libmemcached-1.0.18 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/libmemcached diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka b/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka deleted file mode 100755 index 26af40e..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/../_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula##*"/${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=librdkafka-${dep_version} -dep_archive_name=v${dep_version}.tar.gz -dep_url=https://github.com/edenhill/librdkafka/archive/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -# we need libsasl2-dev -needed=( libsasl2-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz -pushd ${dep_dirname} -./configure --prefix=${OUT_PREFIX} -make -s -j9 -make install -s -rm ${OUT_PREFIX}/lib/*.a -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded -popd - -ABI_VERSION=$(soname_version ${OUT_PREFIX}/lib/librdkafka.so) -echo -echo "ABI version is: ${ABI_VERSION}" -echo - -python $(dirname $BASH_SOURCE)/../_util/include/manifest.py "heroku-sys-library" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "{}" "{}" "{}" "{\"heroku-sys/librdkafka-abi\":\"${ABI_VERSION}\"}" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka-0.11.1 b/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka-0.11.1 deleted file mode 100755 index 89ee181..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/libraries/librdkafka-0.11.1 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/librdkafka diff --git a/vendor/heroku/heroku-buildpack-php/support/build/nginx b/vendor/heroku/heroku-buildpack-php/support/build/nginx deleted file mode 100755 index 35051d7..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/nginx +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -OUT_PREFIX=$1 - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=nginx-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://nginx.org/download/${dep_archive_name} -dep_manifest=${dep_package}.composer.json - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} -ETC=${OUT_PREFIX}/etc -VAR=${OUT_PREFIX}/var -./configure \ - --prefix=${OUT_PREFIX} \ - --conf-path=${ETC}/nginx/nginx.conf \ - --pid-path=${VAR}/run/nginx.pid \ - --lock-path=${VAR}/run/nginx.lock \ - --http-client-body-temp-path=${VAR}/run/nginx/client_body_temp \ - --http-proxy-temp-path=${VAR}/run/nginx/proxy_temp \ - --http-fastcgi-temp-path=${VAR}/run/nginx/fastcgi_temp \ - --http-uwsgi-temp-path=${VAR}/run/nginx/uwsgi_temp \ - --http-scgi-temp-path=${VAR}/run/nginx/scgi_temp \ - --http-log-path=${VAR}/log/nginx/access.log \ - --error-log-path=${VAR}/log/nginx/error.log \ - --with-http_realip_module -make -s -j 9 -make install -s -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded -popd - -# this doesn't get created -mkdir -p ${VAR}/run/nginx - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{}"}" -MANIFEST_REPLACE="${MANIFEST_REPLACE:-"{}"}" -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"{\"export\":\"bin/export.nginx.sh\",\"profile\":\"bin/profile.nginx.sh\"}"}" - -mkdir -p ${OUT_PREFIX}/etc/nginx -cp $(dirname $BASH_SOURCE)/_conf/nginx/nginx.conf ${OUT_PREFIX}/etc/nginx/nginx.conf - -mkdir -p ${OUT_PREFIX}/bin -# this gets sourced after package install, so that the buildpack and following buildpacks can invoke -cat > ${OUT_PREFIX}/bin/export.nginx.sh <<'EOF' -export PATH="/app/.heroku/php/bin:/app/.heroku/php/sbin:$PATH" -EOF -# this gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.nginx.sh <<'EOF' -export PATH="$HOME/.heroku/php/bin:$HOME/.heroku/php/sbin:$PATH" -EOF - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-webserver" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/nginx-1.8.1 b/vendor/heroku/heroku-buildpack-php/support/build/nginx-1.8.1 deleted file mode 100755 index b696276..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/nginx-1.8.1 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/nginx diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php b/vendor/heroku/heroku-buildpack-php/support/build/php deleted file mode 100755 index 907bed7..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=${dep_name}-${dep_version} -dep_dirname=php-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -if [[ $dep_version == *alpha* ]] || [[ $dep_version == *beta* ]] || [[ $dep_version == *RC* ]]; then - if [[ $dep_version == 5.5.* ]]; then - dep_url=https://downloads.php.net/~jpauli/${dep_archive_name} - elif [[ $dep_version == 5.6.* ]]; then - dep_url=https://downloads.php.net/~tyrael/${dep_archive_name} - elif [[ $dep_version == 7.0.* ]]; then - dep_url=https://downloads.php.net/~ab/${dep_archive_name} - elif [[ $dep_version == 7.1.* ]]; then - dep_url=https://downloads.php.net/~krakjoe/${dep_archive_name} - fi -else - dep_url=https://php.net/get/${dep_archive_name}/from/this/mirror -fi -dep_manifest=${dep_package}.composer.json - -echo "-----> Building ${dep_package}..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} - -libicu="libicu55" -if [[ $STACK == "cedar-14" ]]; then - libicu="libicu52" -fi -# we need libgmp for GMP, libpam0g for IMAP, libicu for intl, libsasl2/krb/ldap for LDAP -needed=( libgmp10 libpam0g $libicu libsasl2-2 libkrb5-3 libldap-2.4-2 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Error! Missing libraries: $missing" - exit 1 -fi -# we need libgmp-dev for GMP, libpam0g-dev for IMAP, libicu-dev for intl, libsasl2/krb5/ldap2-dev for LDAP -needed=( libgmp-dev libpam0g-dev libicu-dev libsasl2-dev libkrb5-dev libldap2-dev ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing -fi - -if dpkg --compare-versions "$dep_version" "lt" 7.0.16 || dpkg --compare-versions "$dep_version" "eq" 7.1.0 || dpkg --compare-versions "$dep_version" "eq" 7.1.1; then - # look for GMP libs in /usr/lib/x86_64-linux-gnu and not /usr/lib - sed -i 's/$GMP_DIR\/$PHP_LIBDIR/$GMP_DIR\/$PHP_LIBDIR\/x86_64-linux-gnu/' configure - # symlink in gmp.h - ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h -fi - -# look for LDAP and SASL libs in /usr/lib/x86_64-linux-gnu and not /usr/lib -sed -i 's/LDAP_LIBDIR=$i\/$PHP_LIBDIR/LDAP_LIBDIR=$i\/$PHP_LIBDIR\/x86_64-linux-gnu/' configure -sed -i 's/LDAP_SASL_LIBDIR=$LDAP_SASL_DIR\/$PHP_LIBDIR/LDAP_SASL_LIBDIR=$LDAP_SASL_DIR\/$PHP_LIBDIR\/x86_64-linux-gnu/' configure - -# let's see if mcrypt is there, if not then we have to use the vendored one -needed=( libmcrypt4 ) -missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) -if [[ "$missing" ]]; then - echo "Using vendored libmcrypt..." - # use vendored libmcrypt - mcrypt_prefix="${OUT_PREFIX}" -else - echo "Using system libmcrypt..." - # use system libmcrypt - mcrypt_prefix= - # but do we need headers? - needed=( libmcrypt-dev ) - missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort)) - if [[ "$missing" ]]; then - apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; } - apt-get install -q -y $missing - fi -fi - -configureopts= -if [[ $dep_version == 7.* ]]; then - configureopts="\ ---with-mcrypt=shared${mcrypt_prefix:+","}${mcrypt_prefix} \ ---enable-opcache-file\ -" -else - configureopts="\ ---with-mcrypt${mcrypt_prefix:+"="}${mcrypt_prefix} \ ---with-mysql=shared \ -" -fi - -export PATH=${OUT_PREFIX}/bin:$PATH -# cannot be built shared: date, ereg, opcache (always), pcre, reflection, sockets (?), spl, standard, -# sqlite3 and pdo_sqlite are on by default but we're building them shared on purpose -./configure \ - --prefix=${OUT_PREFIX} \ - --with-config-file-path=/app/.heroku/php/etc/php \ - --with-config-file-scan-dir=/app/.heroku/php/etc/php/conf.d \ - --disable-phpdbg \ - --enable-fpm \ - --with-bz2 \ - --with-curl \ - --with-pdo-mysql \ - --with-mysqli \ - --with-openssl \ - --with-kerberos \ - --with-pgsql \ - --with-pdo-pgsql \ - --with-readline \ - --enable-sockets \ - --enable-zip \ - --with-zlib \ - --enable-bcmath=shared \ - --enable-calendar=shared \ - --enable-exif=shared \ - --enable-ftp=shared \ - --with-gd=shared \ - --enable-gd-native-ttf \ - --with-freetype-dir=/usr \ - --with-jpeg-dir=/usr \ - --with-png-dir=/usr \ - --with-gettext=shared \ - --with-gmp=shared \ - --with-imap=shared,${OUT_PREFIX}/opt/imap-2007f \ - --with-imap-ssl \ - --enable-intl=shared \ - --with-ldap=shared \ - --with-ldap-sasl \ - --enable-mbstring=shared \ - --enable-pcntl=shared \ - --enable-shmop=shared \ - --enable-soap=shared \ - --with-sqlite3=shared \ - --with-pdo-sqlite=shared \ - --with-xmlrpc=shared \ - --with-xsl=shared \ - $configureopts -make -s -j 9 -make install -s -rm -rf ${OUT_PREFIX}/opt/imap-2007f # c-client.a got linked statically -find ${OUT_PREFIX} -type f \( -executable -o -name '*.a' \) -exec sh -c "file -i '{}' | grep -Eq 'application/x-(archive|executable|sharedlib); charset=binary'" \; -print | xargs strip --strip-unneeded -popd - -rm -rf ${OUT_PREFIX}/php/man ${OUT_PREFIX}/lib/php/extensions/*/*.a - -echo "-----> Preparing PECL..." -${OUT_PREFIX}/bin/pecl channel-update pecl.php.net - -echo "-----> Generating manifest..." -curl -sS https://getcomposer.org/installer | php -# enable all extensions -mkdir -p ${OUT_PREFIX}/etc/php/conf.d -shared=() -for f in ${OUT_PREFIX}/lib/php/extensions/*/*.so; do - if [[ $(basename $f) == "opcache.so" ]]; then - # opcache needs to be loaded using zend_extension - echo -n "zend_" >> ${OUT_PREFIX}/etc/php/php.ini - else - # do not record opcache.so as shared; always on via php.ini - shared+=("heroku-sys/ext-$(basename $f .so)") - fi - echo "extension=$(basename $f)" >> ${OUT_PREFIX}/etc/php/php.ini -done - -extra=$(echo "${shared[@]}" | python -c 'import sys, json; json.dump({"shared": dict([item.split(":") if ":" in item else (item, True) for item in sys.stdin.read().split()]), "export": "bin/export.php.sh", "profile": "bin/profile.php.sh"}, sys.stdout)') - -MANIFEST_REQUIRE="${MANIFEST_REQUIRE:-"{}"}" -MANIFEST_CONFLICT="${MANIFEST_CONFLICT:-"{\"heroku-sys/hhvm\":\"*\"}"}" -MANIFEST_REPLACE=$(php composer.phar show --platform | grep -E '^(ext-\S+|php-64bit\b|hhvm\b)' | tr -s " " | cut -d " " -f1,2 | sed -e "s/ $dep_version\$/ self.version/" -e 's/^/heroku-sys\//' | python -c 'import sys, json; json.dump(dict(item.split() for item in sys.stdin), sys.stdout)') -MANIFEST_PROVIDE="${MANIFEST_PROVIDE:-"{}"}" -MANIFEST_EXTRA="${MANIFEST_EXTRA:-"$extra"}" - -# remove temporary ini file that enables all extensions, and the composer download -rm ${OUT_PREFIX}/etc/php/php.ini composer.phar - -cp $(dirname $BASH_SOURCE)/_conf/php/php.ini ${OUT_PREFIX}/etc/php/ -cp $(dirname $BASH_SOURCE)/_conf/php/conf.d/*.ini ${OUT_PREFIX}/etc/php/conf.d/ -cp $(dirname $BASH_SOURCE)/../../conf/php/php-fpm.conf ${OUT_PREFIX}/etc/php/ - -# this gets sourced after package install, so that the buildpack and following buildpacks can invoke -cat > ${OUT_PREFIX}/bin/export.php.sh <<'EOF' -export PATH="/app/.heroku/php/bin:/app/.heroku/php/sbin:$PATH" -EOF -# this gets sourced on dyno boot -cat > ${OUT_PREFIX}/bin/profile.php.sh <<'EOF' -export PATH="$HOME/.heroku/php/bin:$HOME/.heroku/php/sbin:$PATH" -EOF - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-php" "heroku-sys/${dep_name}" "$dep_version" "${dep_formula}.tar.gz" "$MANIFEST_REQUIRE" "$MANIFEST_CONFLICT" "$MANIFEST_REPLACE" "$MANIFEST_PROVIDE" "$MANIFEST_EXTRA" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-5.5.38 b/vendor/heroku/heroku-buildpack-php/support/build/php-5.5.38 deleted file mode 100755 index 919e4a9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-5.5.38 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: libraries/libmcrypt-2.5.8, libraries/libc-client-2007f - -source $(dirname $0)/php diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-5.6.32 b/vendor/heroku/heroku-buildpack-php/support/build/php-5.6.32 deleted file mode 100755 index 919e4a9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-5.6.32 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: libraries/libmcrypt-2.5.8, libraries/libc-client-2007f - -source $(dirname $0)/php diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-7.0.25 b/vendor/heroku/heroku-buildpack-php/support/build/php-7.0.25 deleted file mode 100755 index 919e4a9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-7.0.25 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: libraries/libmcrypt-2.5.8, libraries/libc-client-2007f - -source $(dirname $0)/php diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-7.1.11 b/vendor/heroku/heroku-buildpack-php/support/build/php-7.1.11 deleted file mode 100755 index 919e4a9..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-7.1.11 +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ -# Build Deps: libraries/libmcrypt-2.5.8, libraries/libc-client-2007f - -source $(dirname $0)/php diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-min b/vendor/heroku/heroku-buildpack-php/support/build/php-min deleted file mode 100755 index b31456d..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-min +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php-min/ - -# fail hard -set -o pipefail -# fail harder -set -eu - -source $(dirname $BASH_SOURCE)/_util/include/manifest.sh - -OUT_PREFIX=$1 - -dep_formula=${0#$WORKSPACE_DIR/} -dep_name=$(basename $BASH_SOURCE) -dep_version=${dep_formula#"${dep_name}-"} -dep_package=pkg-${dep_name}-${dep_version} -dep_dirname=php-${dep_version} -dep_archive_name=${dep_dirname}.tar.gz -dep_url=https://php.net/get/${dep_archive_name}/from/this/mirror -dep_manifest=${dep_package}.composer.json - -echo "-----> Building minimal PHP ${dep_version}..." - -curl -L ${dep_url} | tar xz - -pushd ${dep_dirname} - -export PATH=${OUT_PREFIX}/bin:$PATH -# cannot be built shared: date, ereg, opcache (always), pcre, reflection, sockets (?), spl, standard, -# sqlite3 and pdo_sqlite are on by default but we're building them shared on purpose -./configure \ - --prefix=${OUT_PREFIX} \ - --with-config-file-path=/app/.heroku/php-min/etc/php \ - --with-config-file-scan-dir=/app/.heroku/php-min/etc/php/conf.d \ - --enable-static \ - --disable-phpdbg \ - --disable-cgi \ - --enable-cli\ - --with-bz2 \ - --disable-dom \ - --disable-libxml \ - --with-openssl \ - --without-pear \ - --disable-pdo \ - --without-pdo-sqlite \ - --with-readline \ - --disable-session \ - --disable-simplexml \ - --without-sqlite3 \ - --enable-sockets \ - --disable-xml \ - --disable-xmlreader \ - --disable-xmlwriter \ - --enable-zip \ - --with-zlib -make -s -j 9 - -mkdir -p ${OUT_PREFIX}/bin -cp sapi/cli/php ${OUT_PREFIX}/bin/php -popd - -echo "-----> Stripping..." -strip ${OUT_PREFIX}/bin/php - -python $(dirname $BASH_SOURCE)/_util/include/manifest.py "heroku-sys-package" "heroku-sys/pkg-${dep_name}" "$dep_version" "${dep_formula}.tar.gz" > $dep_manifest - -print_or_export_manifest_cmd "$(generate_manifest_cmd "$dep_manifest")" diff --git a/vendor/heroku/heroku-buildpack-php/support/build/php-min-7.0.25 b/vendor/heroku/heroku-buildpack-php/support/build/php-min-7.0.25 deleted file mode 100755 index ae248ca..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/build/php-min-7.0.25 +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Build Path: /app/.heroku/php/ - -source $(dirname $0)/php-min diff --git a/vendor/heroku/heroku-buildpack-php/support/installer/composer.json b/vendor/heroku/heroku-buildpack-php/support/installer/composer.json deleted file mode 100644 index 6467136..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/installer/composer.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "composer-plugin", - "name": "heroku/installer-plugin", - "version": "1.3.0", - "autoload": { - "psr-4": { - "Heroku\\Buildpack\\PHP\\": "src/" - } - }, - "extra": { - "class": "Heroku\\Buildpack\\PHP\\ComposerInstallerPlugin" - }, - "require": { - "composer-plugin-api": "^1.0.0" - } -} diff --git a/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstaller.php b/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstaller.php deleted file mode 100644 index e668abf..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstaller.php +++ /dev/null @@ -1,34 +0,0 @@ -getInstallPath($package); - $this->downloadManager->download($package, $downloadPath); - } -} diff --git a/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstallerPlugin.php b/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstallerPlugin.php deleted file mode 100644 index c94faeb..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/installer/src/ComposerInstallerPlugin.php +++ /dev/null @@ -1,201 +0,0 @@ -composer = $composer; - $this->io = $io; - - // check if there already are scripts in .profile.d, or INI files (because we got invoked before), then calculate new starting point for file names - foreach([ - 'profileCounter' => (getenv('profile_dir_path')?:'/dev/null').'/[0-9][0-9][0-9]-*.sh', - 'configCounter' => self::CONF_D_PATHNAME.'/[0-9][0-9][0-9]-*.ini' - ] as $var => $glob) { - if($matches = glob($glob)) { - $this->$var = ceil(max(array_merge([$this->$var], array_map(function($e) { return explode('-', pathinfo($e, PATHINFO_FILENAME), 2)[0]; }, $matches)))/10)+1; - } - } - - $composer->getDownloadManager()->setDownloader( - 'heroku-sys-tar', - new Downloader( - $io, - $composer->getConfig(), - $composer->getEventDispatcher() - // $cache - ) - ); - $composer->getInstallationManager()->addInstaller(new ComposerInstaller($io, $composer)); - } - - public static function getSubscribedEvents() - { - return [PackageEvents::POST_PACKAGE_INSTALL => 'onPostPackageInstall']; - } - - public function onPostPackageInstall(PackageEvent $event) - { - if(!in_array($event->getOperation()->getPackage()->getType(), ['heroku-sys-php', 'heroku-sys-hhvm', 'heroku-sys-php-extension', 'heroku-sys-hhvm-extension', 'heroku-sys-webserver', 'heroku-sys-library'])) return; - - $this->initAllPlatformRequirements($event->getOperations()); - - try { - $this->configurePackage($event->getOperation()->getPackage()); - $this->enableReplaces($event->getOperation()->getPackage()); - $this->writeProfile($event->getOperation()->getPackage()); - $this->writeExport($event->getOperation()->getPackage()); - } catch(\Exception $e) { - $this->io->writeError(sprintf('Failed to activate package %s', $event->getOperation()->getPackage()->getName())); - $this->io->writeError(''); - throw $e; - } - } - - protected function initAllPlatformRequirements(array $operations) - { - if($this->allPlatformRequirements !== null) return; - - $this->allPlatformRequirements = []; - foreach($operations as $operation) { - foreach($operation->getPackage()->getRequires() as $require) { - if(strpos($require->getTarget(), 'heroku-sys/') === 0) { - $this->allPlatformRequirements[$require->getTarget()] = $require->getSource(); - } - } - } - } - - protected function configurePackage(PackageInterface $package) - { - if(in_array($package->getType(), ['heroku-sys-php-extension', 'heroku-sys-hhvm-extension'])) { - $this->enableExtension($package->getPrettyName(), $package); - } - } - - protected function enableReplaces(PackageInterface $package) - { - // we may "replace" any of the packages (e.g. ext-mbstring is bundled with PHP) that have been required - // figure out which those are so we can decide if they need enabling (because they're built shared) - $enable = array_intersect_key($package->getReplaces(), $this->allPlatformRequirements); - - foreach(array_keys($enable) as $extension) { - $this->enableExtension($extension, $package); - } - } - - protected function enableExtension($prettyName, PackageInterface $parent) - { - // for comparison etc - $packageName = strtolower($prettyName); - // strip "heroku-sys/ext-" - $extName = substr($packageName, 15); - - // check if it's an extension - if(strpos($packageName, 'heroku-sys/ext-') !== 0) return; - - $extra = $parent->getExtra(); - - if($parent->getName() == $packageName) { - // we're enabling the parent package itself - $config = isset($extra['config']) ? $extra['config'] : true; - } else { - // we're enabling another extension that this package provides - $shared = isset($extra['shared']) ? array_change_key_case($extra['shared'], CASE_LOWER) : []; - if(!isset($shared[$packageName])) { - // that ext is on by default or whatever - return; - } - - $this->io->writeError(sprintf(' - Enabling %s (bundled with %s)', $prettyName, $parent->getPrettyName())); - $this->io->writeError(''); - - $config = $shared[$packageName]; - } - - $ini = sprintf('%s/%03u-%%s.ini', self::CONF_D_PATHNAME, $this->configCounter++*10); - @mkdir(dirname($ini), 0777, true); - - if($config === true || (is_string($config) && substr($config, -3) === '.so' && is_readable($config))) { - // just enable that ext (arg is true, or the .so filename) - file_put_contents(sprintf($ini, "ext-$extName"), sprintf("extension=%s\n", $config === true ? "$extName.so" : $config)); - } elseif(is_string($config) && is_readable($config)) { - // ini file, maybe with special contents like extra config or different .so name (think "zend-opcache" vs "opcache.so") - // FIXME: consider ignoring/overriding the numeric prefix and re-using the original file name for "replace"d extensions, which may deliberately be different to ensure a certain loading order? - // example: some rare extensions (e.g. recode: http://php.net/manual/en/recode.installation.php) need to be loaded in a specific order (https://www.pingle.org/2006/10/18/php-crashes-extensions) - // this can only happen if several extensions, built as shared, are included in a package and will be activated (so typically just PHP with its shared exts); for real dependencies (ext-apc needs ext-apcu, ext-foobar needs ext-mysql), Composer already does that ordering for us - rename($config, sprintf($ini, "ext-$extName")); - } elseif (!$config) { - return; - } else { - throw new \RuntimeException('Package declares invalid or missing "config" in "extra"'); - } - } - - protected function writeExport(PackageInterface $package) - { - if(!($fn = getenv('export_file_path'))) return; - - $extra = $package->getExtra(); - if(!isset($extra['export']) || !$extra['export']) return; - - if(is_string($extra['export']) && is_readable($extra['export'])) { - // a file from the package used to export vars for the next buildpack, e.g. $PATH - $export = file_get_contents($extra['export']); - @unlink($extra['export']); - } elseif(is_array($extra['export'])) { - // a hash of vars for the next buildpack, e.g. "PATH": "$HOME/.heroku/php/bin:$PATH" - $export = implode("\n", array_map(function($v, $k) { return sprintf('export %s="%s"', $k, $v); }, $extra['export'], array_keys($extra['export']))); - } else { - throw new \RuntimeException('Package declares invalid or missing "export" in "extra"'); - } - - file_put_contents($fn, "\n$export\n", FILE_APPEND); - } - - protected function writeProfile(PackageInterface $package) - { - if(!getenv('profile_dir_path')) return; - - $profile = $package->getExtra(); - if(!isset($profile['profile']) || !$profile['profile']) return; - $profile = $profile['profile']; - - $fn = sprintf("%s/%03u-%s.sh", getenv('profile_dir_path'), $this->profileCounter++*10, str_replace('heroku-sys/', '', $package->getName())); - @mkdir(dirname($fn), 0777, true); - - if(is_string($profile) && is_readable($profile)) { - // move profile file to ~/.profile.d/ - rename($profile, $fn); - } elseif(is_array($profile)) { - // a hash of vars for startup, e.g. "PATH": "$HOME/.heroku/php/bin:$PATH" - file_put_contents( - $fn, - implode("\n", array_map(function($v, $k) { return sprintf('export %s="%s"', $k, $v); }, $profile, array_keys($profile))) - ); - } else { - throw new \RuntimeException('Package declares invalid or missing "profile" in "extra"'); - } - } -} diff --git a/vendor/heroku/heroku-buildpack-php/support/installer/src/Downloader.php b/vendor/heroku/heroku-buildpack-php/support/installer/src/Downloader.php deleted file mode 100644 index 210008a..0000000 --- a/vendor/heroku/heroku-buildpack-php/support/installer/src/Downloader.php +++ /dev/null @@ -1,98 +0,0 @@ -process = $process ?: new ProcessExecutor($io); - - parent::__construct($io, $config, $eventDispatcher, $cache); - } - - // extract using cmdline tar, which merges with existing files and folders - protected function extract($file, $path) - { - // we must use cmdline tar, as PharData::extract() messes up symlinks - $command = 'tar -xzf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path); - - if (0 === $this->process->execute($command, $ignoredOutput)) { - return; - } - - throw new \RuntimeException("Failed to execute '$command'\n\n" . $this->process->getErrorOutput()); - } - - // ArchiveDownloader unpacks to a temp dir, then replaces the destination - // we can't do that, since we need our contents to be merged into the probably existing folder structure - public function download(PackageInterface $package, $path) - { - $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8); - $this->filesystem->ensureDirectoryExists($temporaryDir); - - // START: from FileDownloader::download() - - if (!$package->getDistUrl()) { - throw new \InvalidArgumentException('The given package is missing url information'); - } - - $this->io->writeError(" - Installing " . $package->getName() . " (" . $package->getFullPrettyVersion() . ")"); - - $urls = $package->getDistUrls(); - while ($url = array_shift($urls)) { - try { - $fileName = $this->doDownload($package, $temporaryDir, $url); - } catch (\Exception $e) { - if ($this->io->isDebug()) { - $this->io->writeError(''); - $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage()); - } elseif (count($urls)) { - $this->io->writeError(''); - $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')'); - } - - if (!count($urls)) { - throw $e; - } - } - } - - // END: from FileDownloader::download() - - // START: from ArchiveDownloader::download() - - $this->io->writeError(' Extracting archive', true, IOInterface::VERBOSE); - - try { - $this->extract($fileName, $path); - } catch (\Exception $e) { - // remove cache if the file was corrupted - parent::clearLastCacheWrite($package); - throw $e; - } - - $this->filesystem->unlink($fileName); - - if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) { - $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/'); - } - if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) { - $this->filesystem->removeDirectory($this->config->get('vendor-dir')); - } - - $this->io->writeError(''); - - // END: from ArchiveDownloader::download() - } -} diff --git a/vendor/monolog/monolog/.php_cs b/vendor/monolog/monolog/.php_cs deleted file mode 100644 index 366ccd0..0000000 --- a/vendor/monolog/monolog/.php_cs +++ /dev/null @@ -1,59 +0,0 @@ - - -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. -EOF; - -$finder = Symfony\CS\Finder::create() - ->files() - ->name('*.php') - ->exclude('Fixtures') - ->in(__DIR__.'/src') - ->in(__DIR__.'/tests') -; - -return Symfony\CS\Config::create() - ->setUsingCache(true) - //->setUsingLinter(false) - ->setRiskyAllowed(true) - ->setRules(array( - '@PSR2' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_return' => true, - 'header_comment' => array('header' => $header), - 'include' => true, - 'long_array_syntax' => true, - 'method_separation' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_between_uses' => true, - 'no_duplicate_semicolons' => true, - 'no_extra_consecutive_blank_lines' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_unused_imports' => true, - 'object_operator_without_whitespace' => true, - 'phpdoc_align' => true, - 'phpdoc_indent' => true, - 'phpdoc_no_access' => true, - 'phpdoc_no_package' => true, - 'phpdoc_order' => true, - 'phpdoc_scalar' => true, - 'phpdoc_trim' => true, - 'phpdoc_type_to_var' => true, - 'psr0' => true, - 'single_blank_line_before_namespace' => true, - 'spaces_cast' => true, - 'standardize_not_equals' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline_array' => true, - 'whitespacy_lines' => true, - )) - ->finder($finder) -; diff --git a/vendor/monolog/monolog/CHANGELOG.md b/vendor/monolog/monolog/CHANGELOG.md deleted file mode 100644 index cd1142d..0000000 --- a/vendor/monolog/monolog/CHANGELOG.md +++ /dev/null @@ -1,342 +0,0 @@ -### 1.23.0 (2017-06-19) - - * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument - * Fixed GelfHandler truncation to be per field and not per message - * Fixed compatibility issue with PHP <5.3.6 - * Fixed support for headless Chrome in ChromePHPHandler - * Fixed support for latest Aws SDK in DynamoDbHandler - * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler - -### 1.22.1 (2017-03-13) - - * Fixed lots of minor issues in the new Slack integrations - * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces - -### 1.22.0 (2016-11-26) - - * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily - * Added MercurialProcessor to add mercurial revision and branch names to log records - * Added support for AWS SDK v3 in DynamoDbHandler - * Fixed fatal errors occuring when normalizing generators that have been fully consumed - * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix) - * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore - * Fixed SyslogUdpHandler to avoid sending empty frames - * Fixed a few PHP 7.0 and 7.1 compatibility issues - -### 1.21.0 (2016-07-29) - - * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues - * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order - * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler - * Added information about SoapFault instances in NormalizerFormatter - * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level - -### 1.20.0 (2016-07-02) - - * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy - * Added StreamHandler::getUrl to retrieve the stream's URL - * Added ability to override addRow/addTitle in HtmlFormatter - * Added the $context to context information when the ErrorHandler handles a regular php error - * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d - * Fixed WhatFailureGroupHandler to work with PHP7 throwables - * Fixed a few minor bugs - -### 1.19.0 (2016-04-12) - - * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed - * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors - * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler - * Fixed HipChatHandler handling of long messages - -### 1.18.2 (2016-04-02) - - * Fixed ElasticaFormatter to use more precise dates - * Fixed GelfMessageFormatter sending too long messages - -### 1.18.1 (2016-03-13) - - * Fixed SlackHandler bug where slack dropped messages randomly - * Fixed RedisHandler issue when using with the PHPRedis extension - * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension - * Fixed BrowserConsoleHandler regression - -### 1.18.0 (2016-03-01) - - * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond - * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames - * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name - * Added FluentdFormatter for the Fluentd unix socket protocol - * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed - * Added support for replacing context sub-keys using `%context.*%` in LineFormatter - * Added support for `payload` context value in RollbarHandler - * Added setRelease to RavenHandler to describe the application version, sent with every log - * Added support for `fingerprint` context value in RavenHandler - * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed - * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()` - * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places - -### 1.17.2 (2015-10-14) - - * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers - * Fixed SlackHandler handling to use slack functionalities better - * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id - * Fixed 5.3 compatibility regression - -### 1.17.1 (2015-08-31) - - * Fixed RollbarHandler triggering PHP notices - -### 1.17.0 (2015-08-30) - - * Added support for `checksum` and `release` context/extra values in RavenHandler - * Added better support for exceptions in RollbarHandler - * Added UidProcessor::getUid - * Added support for showing the resource type in NormalizedFormatter - * Fixed IntrospectionProcessor triggering PHP notices - -### 1.16.0 (2015-08-09) - - * Added IFTTTHandler to notify ifttt.com triggers - * Added Logger::setHandlers() to allow setting/replacing all handlers - * Added $capSize in RedisHandler to cap the log size - * Fixed StreamHandler creation of directory to only trigger when the first log write happens - * Fixed bug in the handling of curl failures - * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler - * Fixed missing fatal errors records with handlers that need to be closed to flush log records - * Fixed TagProcessor::addTags support for associative arrays - -### 1.15.0 (2015-07-12) - - * Added addTags and setTags methods to change a TagProcessor - * Added automatic creation of directories if they are missing for a StreamHandler to open a log file - * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure - * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used - * Fixed HTML/JS escaping in BrowserConsoleHandler - * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only) - -### 1.14.0 (2015-06-19) - - * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library - * Added support for objects implementing __toString in the NormalizerFormatter - * Added support for HipChat's v2 API in HipChatHandler - * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app - * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true) - * Fixed curl errors being silently suppressed - -### 1.13.1 (2015-03-09) - - * Fixed regression in HipChat requiring a new token to be created - -### 1.13.0 (2015-03-05) - - * Added Registry::hasLogger to check for the presence of a logger instance - * Added context.user support to RavenHandler - * Added HipChat API v2 support in the HipChatHandler - * Added NativeMailerHandler::addParameter to pass params to the mail() process - * Added context data to SlackHandler when $includeContextAndExtra is true - * Added ability to customize the Swift_Message per-email in SwiftMailerHandler - * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided - * Fixed serialization of INF and NaN values in Normalizer and LineFormatter - -### 1.12.0 (2014-12-29) - - * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers. - * Added PsrHandler to forward records to another PSR-3 logger - * Added SamplingHandler to wrap around a handler and include only every Nth record - * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now) - * Added exception codes in the output of most formatters - * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line) - * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data - * Added $host to HipChatHandler for users of private instances - * Added $transactionName to NewRelicHandler and support for a transaction_name context value - * Fixed MandrillHandler to avoid outputing API call responses - * Fixed some non-standard behaviors in SyslogUdpHandler - -### 1.11.0 (2014-09-30) - - * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names - * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails - * Added MandrillHandler to send emails via the Mandrillapp.com API - * Added SlackHandler to log records to a Slack.com account - * Added FleepHookHandler to log records to a Fleep.io account - * Added LogglyHandler::addTag to allow adding tags to an existing handler - * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end - * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing - * Added support for PhpAmqpLib in the AmqpHandler - * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs - * Added support for adding extra fields from $_SERVER in the WebProcessor - * Fixed support for non-string values in PrsLogMessageProcessor - * Fixed SwiftMailer messages being sent with the wrong date in long running scripts - * Fixed minor PHP 5.6 compatibility issues - * Fixed BufferHandler::close being called twice - -### 1.10.0 (2014-06-04) - - * Added Logger::getHandlers() and Logger::getProcessors() methods - * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached - * Added support for extra data in NewRelicHandler - * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines - -### 1.9.1 (2014-04-24) - - * Fixed regression in RotatingFileHandler file permissions - * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records - * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative - -### 1.9.0 (2014-04-20) - - * Added LogEntriesHandler to send logs to a LogEntries account - * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler - * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes - * Added support for table formatting in FirePHPHandler via the table context key - * Added a TagProcessor to add tags to records, and support for tags in RavenHandler - * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files - * Added sound support to the PushoverHandler - * Fixed multi-threading support in StreamHandler - * Fixed empty headers issue when ChromePHPHandler received no records - * Fixed default format of the ErrorLogHandler - -### 1.8.0 (2014-03-23) - - * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them - * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output - * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler - * Added FlowdockHandler to send logs to a Flowdock account - * Added RollbarHandler to send logs to a Rollbar account - * Added HtmlFormatter to send prettier log emails with colors for each log level - * Added GitProcessor to add the current branch/commit to extra record data - * Added a Monolog\Registry class to allow easier global access to pre-configured loggers - * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement - * Added support for HHVM - * Added support for Loggly batch uploads - * Added support for tweaking the content type and encoding in NativeMailerHandler - * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor - * Fixed batch request support in GelfHandler - -### 1.7.0 (2013-11-14) - - * Added ElasticSearchHandler to send logs to an Elastic Search server - * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB - * Added SyslogUdpHandler to send logs to a remote syslogd server - * Added LogglyHandler to send logs to a Loggly account - * Added $level to IntrospectionProcessor so it only adds backtraces when needed - * Added $version to LogstashFormatter to allow using the new v1 Logstash format - * Added $appName to NewRelicHandler - * Added configuration of Pushover notification retries/expiry - * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default - * Added chainability to most setters for all handlers - * Fixed RavenHandler batch processing so it takes the message from the record with highest priority - * Fixed HipChatHandler batch processing so it sends all messages at once - * Fixed issues with eAccelerator - * Fixed and improved many small things - -### 1.6.0 (2013-07-29) - - * Added HipChatHandler to send logs to a HipChat chat room - * Added ErrorLogHandler to send logs to PHP's error_log function - * Added NewRelicHandler to send logs to NewRelic's service - * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler - * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel - * Added stack traces output when normalizing exceptions (json output & co) - * Added Monolog\Logger::API constant (currently 1) - * Added support for ChromePHP's v4.0 extension - * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel - * Added support for sending messages to multiple users at once with the PushoverHandler - * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler) - * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now - * Fixed issue in RotatingFileHandler when an open_basedir restriction is active - * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0 - * Fixed SyslogHandler issue when many were used concurrently with different facilities - -### 1.5.0 (2013-04-23) - - * Added ProcessIdProcessor to inject the PID in log records - * Added UidProcessor to inject a unique identifier to all log records of one request/run - * Added support for previous exceptions in the LineFormatter exception serialization - * Added Monolog\Logger::getLevels() to get all available levels - * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle - -### 1.4.1 (2013-04-01) - - * Fixed exception formatting in the LineFormatter to be more minimalistic - * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0 - * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days - * Fixed WebProcessor array access so it checks for data presence - * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors - -### 1.4.0 (2013-02-13) - - * Added RedisHandler to log to Redis via the Predis library or the phpredis extension - * Added ZendMonitorHandler to log to the Zend Server monitor - * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor - * Added `$useSSL` option to the PushoverHandler which is enabled by default - * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously - * Fixed header injection capability in the NativeMailHandler - -### 1.3.1 (2013-01-11) - - * Fixed LogstashFormatter to be usable with stream handlers - * Fixed GelfMessageFormatter levels on Windows - -### 1.3.0 (2013-01-08) - - * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface` - * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance - * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash) - * Added PushoverHandler to send mobile notifications - * Added CouchDBHandler and DoctrineCouchDBHandler - * Added RavenHandler to send data to Sentry servers - * Added support for the new MongoClient class in MongoDBHandler - * Added microsecond precision to log records' timestamps - * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing - the oldest entries - * Fixed normalization of objects with cyclic references - -### 1.2.1 (2012-08-29) - - * Added new $logopts arg to SyslogHandler to provide custom openlog options - * Fixed fatal error in SyslogHandler - -### 1.2.0 (2012-08-18) - - * Added AmqpHandler (for use with AMQP servers) - * Added CubeHandler - * Added NativeMailerHandler::addHeader() to send custom headers in mails - * Added the possibility to specify more than one recipient in NativeMailerHandler - * Added the possibility to specify float timeouts in SocketHandler - * Added NOTICE and EMERGENCY levels to conform with RFC 5424 - * Fixed the log records to use the php default timezone instead of UTC - * Fixed BufferHandler not being flushed properly on PHP fatal errors - * Fixed normalization of exotic resource types - * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog - -### 1.1.0 (2012-04-23) - - * Added Monolog\Logger::isHandling() to check if a handler will - handle the given log level - * Added ChromePHPHandler - * Added MongoDBHandler - * Added GelfHandler (for use with Graylog2 servers) - * Added SocketHandler (for use with syslog-ng for example) - * Added NormalizerFormatter - * Added the possibility to change the activation strategy of the FingersCrossedHandler - * Added possibility to show microseconds in logs - * Added `server` and `referer` to WebProcessor output - -### 1.0.2 (2011-10-24) - - * Fixed bug in IE with large response headers and FirePHPHandler - -### 1.0.1 (2011-08-25) - - * Added MemoryPeakUsageProcessor and MemoryUsageProcessor - * Added Monolog\Logger::getName() to get a logger's channel name - -### 1.0.0 (2011-07-06) - - * Added IntrospectionProcessor to get info from where the logger was called - * Fixed WebProcessor in CLI - -### 1.0.0-RC1 (2011-07-01) - - * Initial release diff --git a/vendor/monolog/monolog/LICENSE b/vendor/monolog/monolog/LICENSE deleted file mode 100644 index 1647321..0000000 --- a/vendor/monolog/monolog/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011-2016 Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/monolog/monolog/README.md b/vendor/monolog/monolog/README.md deleted file mode 100644 index 7d8ade5..0000000 --- a/vendor/monolog/monolog/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog) - -[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) -[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) -[![Reference Status](https://www.versioneye.com/php/monolog:monolog/reference_badge.svg)](https://www.versioneye.com/php/monolog:monolog/references) - - -Monolog sends your logs to files, sockets, inboxes, databases and various -web services. See the complete list of handlers below. Special handlers -allow you to build advanced logging strategies. - -This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -interface that you can type-hint against in your own libraries to keep -a maximum of interoperability. You can also use it in your applications to -make sure you can always use another compatible logger at a later time. -As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. -Internally Monolog still uses its own level scheme since it predates PSR-3. - -## Installation - -Install the latest version with - -```bash -$ composer require monolog/monolog -``` - -## Basic Usage - -```php -pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); - -// add records to the log -$log->addWarning('Foo'); -$log->addError('Bar'); -``` - -## Documentation - -- [Usage Instructions](doc/01-usage.md) -- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) -- [Utility classes](doc/03-utilities.md) -- [Extending Monolog](doc/04-extending.md) - -## Third Party Packages - -Third party handlers, formatters and processors are -[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You -can also add your own there if you publish one. - -## About - -### Requirements - -- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM. - -### Submitting bugs and feature requests - -Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) - -### Framework Integrations - -- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) - can be used very easily with Monolog since it implements the interface. -- [Symfony2](http://symfony.com) comes out of the box with Monolog. -- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog. -- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog. -- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. -- [PPI](http://www.ppi.io/) comes out of the box with Monolog. -- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. -- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. -- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. -- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. -- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension. -- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. - -### Author - -Jordi Boggiano - -
    -See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project. - -### License - -Monolog is licensed under the MIT License - see the `LICENSE` file for details - -### Acknowledgements - -This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/) -library, although most concepts have been adjusted to fit to the PHP world. diff --git a/vendor/monolog/monolog/composer.json b/vendor/monolog/monolog/composer.json deleted file mode 100644 index 3b0c880..0000000 --- a/vendor/monolog/monolog/composer.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "monolog/monolog", - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "keywords": ["log", "logging", "psr-3"], - "homepage": "http://github.com/Seldaek/monolog", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.5", - "graylog2/gelf-php": "~1.0", - "sentry/sentry": "^0.13", - "ruflin/elastica": ">=0.90 <3.0", - "doctrine/couchdb": "~1.0@dev", - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "php-amqplib/php-amqplib": "~2.4", - "swiftmailer/swiftmailer": "^5.3|^6.0", - "php-console/php-console": "^3.1.3", - "phpunit/phpunit-mock-objects": "2.3.0", - "jakub-onderka/php-parallel-lint": "0.9" - }, - "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis", - "suggest": { - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "sentry/sentry": "Allow sending log messages to a Sentry server", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "php-console/php-console": "Allow sending log messages to Google Chrome" - }, - "autoload": { - "psr-4": {"Monolog\\": "src/Monolog"} - }, - "autoload-dev": { - "psr-4": {"Monolog\\": "tests/Monolog"} - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "scripts": { - "test": [ - "parallel-lint . --exclude vendor", - "phpunit" - ] - } -} diff --git a/vendor/monolog/monolog/doc/01-usage.md b/vendor/monolog/monolog/doc/01-usage.md deleted file mode 100644 index 8e2551f..0000000 --- a/vendor/monolog/monolog/doc/01-usage.md +++ /dev/null @@ -1,231 +0,0 @@ -# Using Monolog - -- [Installation](#installation) -- [Core Concepts](#core-concepts) -- [Log Levels](#log-levels) -- [Configuring a logger](#configuring-a-logger) -- [Adding extra data in the records](#adding-extra-data-in-the-records) -- [Leveraging channels](#leveraging-channels) -- [Customizing the log format](#customizing-the-log-format) - -## Installation - -Monolog is available on Packagist ([monolog/monolog](http://packagist.org/packages/monolog/monolog)) -and as such installable via [Composer](http://getcomposer.org/). - -```bash -composer require monolog/monolog -``` - -If you do not use Composer, you can grab the code from GitHub, and use any -PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader)) -to load Monolog classes. - -## Core Concepts - -Every `Logger` instance has a channel (name) and a stack of handlers. Whenever -you add a record to the logger, it traverses the handler stack. Each handler -decides whether it fully handled the record, and if so, the propagation of the -record ends there. - -This allows for flexible logging setups, for example having a `StreamHandler` at -the bottom of the stack that will log anything to disk, and on top of that add -a `MailHandler` that will send emails only when an error message is logged. -Handlers also have a `$bubble` property which defines whether they block the -record or not if they handled it. In this example, setting the `MailHandler`'s -`$bubble` argument to false means that records handled by the `MailHandler` will -not propagate to the `StreamHandler` anymore. - -You can create many `Logger`s, each defining a channel (e.g.: db, request, -router, ..) and each of them combining various handlers, which can be shared -or not. The channel is reflected in the logs and allows you to easily see or -filter records. - -Each Handler also has a Formatter, a default one with settings that make sense -will be created if you don't set one. The formatters normalize and format -incoming records so that they can be used by the handlers to output useful -information. - -Custom severity levels are not available. Only the eight -[RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice, -warning, error, critical, alert, emergency) are present for basic filtering -purposes, but for sorting and other use cases that would require -flexibility, you should add Processors to the Logger that can add extra -information (tags, user ip, ..) to the records before they are handled. - -## Log Levels - -Monolog supports the logging levels described by [RFC 5424](http://tools.ietf.org/html/rfc5424). - -- **DEBUG** (100): Detailed debug information. - -- **INFO** (200): Interesting events. Examples: User logs in, SQL logs. - -- **NOTICE** (250): Normal but significant events. - -- **WARNING** (300): Exceptional occurrences that are not errors. Examples: - Use of deprecated APIs, poor use of an API, undesirable things that are not - necessarily wrong. - -- **ERROR** (400): Runtime errors that do not require immediate action but - should typically be logged and monitored. - -- **CRITICAL** (500): Critical conditions. Example: Application component - unavailable, unexpected exception. - -- **ALERT** (550): Action must be taken immediately. Example: Entire website - down, database unavailable, etc. This should trigger the SMS alerts and wake - you up. - -- **EMERGENCY** (600): Emergency: system is unusable. - -## Configuring a logger - -Here is a basic setup to log to a file and to firephp on the DEBUG level: - -```php -pushHandler(new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG)); -$logger->pushHandler(new FirePHPHandler()); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); -``` - -Let's explain it. The first step is to create the logger instance which will -be used in your code. The argument is a channel name, which is useful when -you use several loggers (see below for more details about it). - -The logger itself does not know how to handle a record. It delegates it to -some handlers. The code above registers two handlers in the stack to allow -handling records in two different ways. - -Note that the FirePHPHandler is called first as it is added on top of the -stack. This allows you to temporarily add a logger with bubbling disabled if -you want to override other configured loggers. - -> If you use Monolog standalone and are looking for an easy way to -> configure many handlers, the [theorchard/monolog-cascade](https://github.com/theorchard/monolog-cascade) -> can help you build complex logging configs via PHP arrays, yaml or json configs. - -## Adding extra data in the records - -Monolog provides two different ways to add extra informations along the simple -textual message. - -### Using the logging context - -The first way is the context, allowing to pass an array of data along the -record: - -```php -addInfo('Adding a new user', array('username' => 'Seldaek')); -``` - -Simple handlers (like the StreamHandler for instance) will simply format -the array to a string but richer handlers can take advantage of the context -(FirePHP is able to display arrays in pretty way for instance). - -### Using processors - -The second way is to add extra data for all records by using a processor. -Processors can be any callable. They will get the record as parameter and -must return it after having eventually changed the `extra` part of it. Let's -write a processor adding some dummy data in the record: - -```php -pushProcessor(function ($record) { - $record['extra']['dummy'] = 'Hello world!'; - - return $record; -}); -``` - -Monolog provides some built-in processors that can be used in your project. -Look at the [dedicated chapter](https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#processors) for the list. - -> Tip: processors can also be registered on a specific handler instead of - the logger to apply only for this handler. - -## Leveraging channels - -Channels are a great way to identify to which part of the application a record -is related. This is useful in big applications (and is leveraged by -MonologBundle in Symfony2). - -Picture two loggers sharing a handler that writes to a single log file. -Channels would allow you to identify the logger that issued every record. -You can easily grep through the log files filtering this or that channel. - -```php -pushHandler($stream); -$logger->pushHandler($firephp); - -// Create a logger for the security-related stuff with a different channel -$securityLogger = new Logger('security'); -$securityLogger->pushHandler($stream); -$securityLogger->pushHandler($firephp); - -// Or clone the first one to only change the channel -$securityLogger = $logger->withName('security'); -``` - -## Customizing the log format - -In Monolog it's easy to customize the format of the logs written into files, -sockets, mails, databases and other handlers. Most of the handlers use the - -```php -$record['formatted'] -``` - -value to be automatically put into the log device. This value depends on the -formatter settings. You can choose between predefined formatter classes or -write your own (e.g. a multiline text file for human-readable output). - -To configure a predefined formatter class, just set it as the handler's field: - -```php -// the default date format is "Y-m-d H:i:s" -$dateFormat = "Y n j, g:i a"; -// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n" -$output = "%datetime% > %level_name% > %message% %context% %extra%\n"; -// finally, create a formatter -$formatter = new LineFormatter($output, $dateFormat); - -// Create a handler -$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG); -$stream->setFormatter($formatter); -// bind it to a logger object -$securityLogger = new Logger('security'); -$securityLogger->pushHandler($stream); -``` - -You may also reuse the same formatter between multiple handlers and share those -handlers between multiple loggers. - -[Handlers, Formatters and Processors](02-handlers-formatters-processors.md) → diff --git a/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md b/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md deleted file mode 100644 index bea968a..0000000 --- a/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md +++ /dev/null @@ -1,157 +0,0 @@ -# Handlers, Formatters and Processors - -- [Handlers](#handlers) - - [Log to files and syslog](#log-to-files-and-syslog) - - [Send alerts and emails](#send-alerts-and-emails) - - [Log specific servers and networked logging](#log-specific-servers-and-networked-logging) - - [Logging in development](#logging-in-development) - - [Log to databases](#log-to-databases) - - [Wrappers / Special Handlers](#wrappers--special-handlers) -- [Formatters](#formatters) -- [Processors](#processors) -- [Third Party Packages](#third-party-packages) - -## Handlers - -### Log to files and syslog - -- _StreamHandler_: Logs records into any PHP stream, use this for log files. -- _RotatingFileHandler_: Logs records to a file and creates one logfile per day. - It will also delete files older than `$maxFiles`. You should use - [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile - setups though, this is just meant as a quick and dirty solution. -- _SyslogHandler_: Logs records to the syslog. -- _ErrorLogHandler_: Logs records to PHP's - [`error_log()`](http://docs.php.net/manual/en/function.error-log.php) function. - -### Send alerts and emails - -- _NativeMailerHandler_: Sends emails using PHP's - [`mail()`](http://php.net/manual/en/function.mail.php) function. -- _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance. -- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API. -- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API. -- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account. -- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slack API. -- _SlackbotHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slackbot incoming hook. -- _SlackWebhookHandler_: Logs records to a [Slack](https://www.slack.com/) account using Slack Webhooks. -- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance. -- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks. -- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message. - -### Log specific servers and networked logging - -- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this - for UNIX and TCP sockets. See an [example](sockets.md). -- _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible - server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+). -- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server. -- _CubeHandler_: Logs records to a [Cube](http://square.github.com/cube/) server. -- _RavenHandler_: Logs records to a [Sentry](http://getsentry.com/) server using - [raven](https://packagist.org/packages/raven/raven). -- _ZendMonitorHandler_: Logs records to the Zend Monitor present in Zend Server. -- _NewRelicHandler_: Logs records to a [NewRelic](http://newrelic.com/) application. -- _LogglyHandler_: Logs records to a [Loggly](http://www.loggly.com/) account. -- _RollbarHandler_: Logs records to a [Rollbar](https://rollbar.com/) account. -- _SyslogUdpHandler_: Logs records to a remote [Syslogd](http://www.rsyslog.com/) server. -- _LogEntriesHandler_: Logs records to a [LogEntries](http://logentries.com/) account. - -### Logging in development - -- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing - inline `console` messages within [FireBug](http://getfirebug.com/). -- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing - inline `console` messages within Chrome. -- _BrowserConsoleHandler_: Handler to send logs to browser's Javascript `console` with - no browser extension required. Most browsers supporting `console` API are supported. -- _PHPConsoleHandler_: Handler for [PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef), providing - inline `console` and notification popup messages within Chrome. - -### Log to databases - -- _RedisHandler_: Logs records to a [redis](http://redis.io) server. -- _MongoDBHandler_: Handler to write records in MongoDB via a - [Mongo](http://pecl.php.net/package/mongo) extension connection. -- _CouchDBHandler_: Logs records to a CouchDB server. -- _DoctrineCouchDBHandler_: Logs records to a CouchDB server via the Doctrine CouchDB ODM. -- _ElasticSearchHandler_: Logs records to an Elastic Search server. -- _DynamoDbHandler_: Logs records to a DynamoDB table with the [AWS SDK](https://github.com/aws/aws-sdk-php). - -### Wrappers / Special Handlers - -- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as - parameter and will accumulate log records of all levels until a record - exceeds the defined severity level. At which point it delivers all records, - including those of lower severity, to the handler it wraps. This means that - until an error actually happens you will not see anything in your logs, but - when it happens you will have the full information, including debug and info - records. This provides you with all the information you need, but only when - you need it. -- _DeduplicationHandler_: Useful if you are sending notifications or emails - when critical errors occur. It takes a logger as parameter and will - accumulate log records of all levels until the end of the request (or - `flush()` is called). At that point it delivers all records to the handler - it wraps, but only if the records are unique over a given time period - (60seconds by default). If the records are duplicates they are simply - discarded. The main use of this is in case of critical failure like if your - database is unreachable for example all your requests will fail and that - can result in a lot of notifications being sent. Adding this handler reduces - the amount of notifications to a manageable level. -- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring - exceptions raised by each child handler. This allows you to ignore issues - where a remote tcp connection may have died but you do not want your entire - application to crash and may wish to continue to log to other handlers. -- _BufferHandler_: This handler will buffer all the log records it receives - until `close()` is called at which point it will call `handleBatch()` on the - handler it wraps with all the log messages at once. This is very useful to - send an email with all records at once for example instead of having one mail - for every log record. -- _GroupHandler_: This handler groups other handlers. Every record received is - sent to all the handlers it is configured with. -- _FilterHandler_: This handler only lets records of the given levels through - to the wrapped handler. -- _SamplingHandler_: Wraps around another handler and lets you sample records - if you only want to store some of them. -- _NullHandler_: Any record it can handle will be thrown away. This can be used - to put on top of an existing handler stack to disable it temporarily. -- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger -- _TestHandler_: Used for testing, it records everything that is sent to it and - has accessors to read out the information. -- _HandlerWrapper_: A simple handler wrapper you can inherit from to create - your own wrappers easily. - -## Formatters - -- _LineFormatter_: Formats a log record into a one-line string. -- _HtmlFormatter_: Used to format log records into a human readable html table, mainly suitable for emails. -- _NormalizerFormatter_: Normalizes objects/resources down to strings so a record can easily be serialized/encoded. -- _ScalarFormatter_: Used to format log records into an associative array of scalar values. -- _JsonFormatter_: Encodes a log record into json. -- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler. -- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler. -- _GelfMessageFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler. -- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/latest). -- _ElasticaFormatter_: Used to format log records into an Elastica\Document object, only useful for the ElasticSearchHandler. -- _LogglyFormatter_: Used to format log records into Loggly messages, only useful for the LogglyHandler. -- _FlowdockFormatter_: Used to format log records into Flowdock messages, only useful for the FlowdockHandler. -- _MongoDBFormatter_: Converts \DateTime instances to \MongoDate and objects recursively to arrays, only useful with the MongoDBHandler. - -## Processors - -- _PsrLogMessageProcessor_: Processes a log record's message according to PSR-3 rules, replacing `{foo}` with the value from `$context['foo']`. -- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated. -- _WebProcessor_: Adds the current request URI, request method and client IP to a log record. -- _MemoryUsageProcessor_: Adds the current memory usage to a log record. -- _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record. -- _ProcessIdProcessor_: Adds the process id to a log record. -- _UidProcessor_: Adds a unique identifier to a log record. -- _GitProcessor_: Adds the current git branch and commit to a log record. -- _TagProcessor_: Adds an array of predefined tags to a log record. - -## Third Party Packages - -Third party handlers, formatters and processors are -[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You -can also add your own there if you publish one. - -← [Usage](01-usage.md) | [Utility classes](03-utilities.md) → diff --git a/vendor/monolog/monolog/doc/03-utilities.md b/vendor/monolog/monolog/doc/03-utilities.md deleted file mode 100644 index c62aa41..0000000 --- a/vendor/monolog/monolog/doc/03-utilities.md +++ /dev/null @@ -1,13 +0,0 @@ -# Utilities - -- _Registry_: The `Monolog\Registry` class lets you configure global loggers that you - can then statically access from anywhere. It is not really a best practice but can - help in some older codebases or for ease of use. -- _ErrorHandler_: The `Monolog\ErrorHandler` class allows you to easily register - a Logger instance as an exception handler, error handler or fatal error handler. -- _ErrorLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain log - level is reached. -- _ChannelLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain - log level is reached, depending on which channel received the log record. - -← [Handlers, Formatters and Processors](02-handlers-formatters-processors.md) | [Extending Monolog](04-extending.md) → diff --git a/vendor/monolog/monolog/doc/04-extending.md b/vendor/monolog/monolog/doc/04-extending.md deleted file mode 100644 index ebd9104..0000000 --- a/vendor/monolog/monolog/doc/04-extending.md +++ /dev/null @@ -1,76 +0,0 @@ -# Extending Monolog - -Monolog is fully extensible, allowing you to adapt your logger to your needs. - -## Writing your own handler - -Monolog provides many built-in handlers. But if the one you need does not -exist, you can write it and use it in your logger. The only requirement is -to implement `Monolog\Handler\HandlerInterface`. - -Let's write a PDOHandler to log records to a database. We will extend the -abstract class provided by Monolog to keep things DRY. - -```php -pdo = $pdo; - parent::__construct($level, $bubble); - } - - protected function write(array $record) - { - if (!$this->initialized) { - $this->initialize(); - } - - $this->statement->execute(array( - 'channel' => $record['channel'], - 'level' => $record['level'], - 'message' => $record['formatted'], - 'time' => $record['datetime']->format('U'), - )); - } - - private function initialize() - { - $this->pdo->exec( - 'CREATE TABLE IF NOT EXISTS monolog ' - .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)' - ); - $this->statement = $this->pdo->prepare( - 'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)' - ); - - $this->initialized = true; - } -} -``` - -You can now use this handler in your logger: - -```php -pushHandler(new PDOHandler(new PDO('sqlite:logs.sqlite'))); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); -``` - -The `Monolog\Handler\AbstractProcessingHandler` class provides most of the -logic needed for the handler, including the use of processors and the formatting -of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``). - -← [Utility classes](03-utilities.md) diff --git a/vendor/monolog/monolog/doc/sockets.md b/vendor/monolog/monolog/doc/sockets.md deleted file mode 100644 index ea9cf0e..0000000 --- a/vendor/monolog/monolog/doc/sockets.md +++ /dev/null @@ -1,39 +0,0 @@ -Sockets Handler -=============== - -This handler allows you to write your logs to sockets using [fsockopen](http://php.net/fsockopen) -or [pfsockopen](http://php.net/pfsockopen). - -Persistent sockets are mainly useful in web environments where you gain some performance not closing/opening -the connections between requests. - -You can use a `unix://` prefix to access unix sockets and `udp://` to open UDP sockets instead of the default TCP. - -Basic Example -------------- - -```php -setPersistent(true); - -// Now add the handler -$logger->pushHandler($handler, Logger::DEBUG); - -// You can now use your logger -$logger->addInfo('My logger is now ready'); - -``` - -In this example, using syslog-ng, you should see the log on the log server: - - cweb1 [2012-02-26 00:12:03] my_logger.INFO: My logger is now ready [] [] - diff --git a/vendor/monolog/monolog/phpunit.xml.dist b/vendor/monolog/monolog/phpunit.xml.dist deleted file mode 100644 index 20d82b6..0000000 --- a/vendor/monolog/monolog/phpunit.xml.dist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - tests/Monolog/ - - - - - - src/Monolog/ - - - - - - - diff --git a/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php deleted file mode 100644 index 7bfcd83..0000000 --- a/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +++ /dev/null @@ -1,230 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Psr\Log\LoggerInterface; -use Psr\Log\LogLevel; -use Monolog\Handler\AbstractHandler; - -/** - * Monolog error handler - * - * A facility to enable logging of runtime errors, exceptions and fatal errors. - * - * Quick setup: ErrorHandler::register($logger); - * - * @author Jordi Boggiano - */ -class ErrorHandler -{ - private $logger; - - private $previousExceptionHandler; - private $uncaughtExceptionLevel; - - private $previousErrorHandler; - private $errorLevelMap; - private $handleOnlyReportedErrors; - - private $hasFatalErrorHandler; - private $fatalLevel; - private $reservedMemory; - private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR); - - public function __construct(LoggerInterface $logger) - { - $this->logger = $logger; - } - - /** - * Registers a new ErrorHandler for a given Logger - * - * By default it will handle errors, exceptions and fatal errors - * - * @param LoggerInterface $logger - * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling - * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling - * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling - * @return ErrorHandler - */ - public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null) - { - //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929 - class_exists('\\Psr\\Log\\LogLevel', true); - - $handler = new static($logger); - if ($errorLevelMap !== false) { - $handler->registerErrorHandler($errorLevelMap); - } - if ($exceptionLevel !== false) { - $handler->registerExceptionHandler($exceptionLevel); - } - if ($fatalLevel !== false) { - $handler->registerFatalHandler($fatalLevel); - } - - return $handler; - } - - public function registerExceptionHandler($level = null, $callPrevious = true) - { - $prev = set_exception_handler(array($this, 'handleException')); - $this->uncaughtExceptionLevel = $level; - if ($callPrevious && $prev) { - $this->previousExceptionHandler = $prev; - } - } - - public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true) - { - $prev = set_error_handler(array($this, 'handleError'), $errorTypes); - $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); - if ($callPrevious) { - $this->previousErrorHandler = $prev ?: true; - } - - $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; - } - - public function registerFatalHandler($level = null, $reservedMemorySize = 20) - { - register_shutdown_function(array($this, 'handleFatalError')); - - $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize); - $this->fatalLevel = $level; - $this->hasFatalErrorHandler = true; - } - - protected function defaultErrorLevelMap() - { - return array( - E_ERROR => LogLevel::CRITICAL, - E_WARNING => LogLevel::WARNING, - E_PARSE => LogLevel::ALERT, - E_NOTICE => LogLevel::NOTICE, - E_CORE_ERROR => LogLevel::CRITICAL, - E_CORE_WARNING => LogLevel::WARNING, - E_COMPILE_ERROR => LogLevel::ALERT, - E_COMPILE_WARNING => LogLevel::WARNING, - E_USER_ERROR => LogLevel::ERROR, - E_USER_WARNING => LogLevel::WARNING, - E_USER_NOTICE => LogLevel::NOTICE, - E_STRICT => LogLevel::NOTICE, - E_RECOVERABLE_ERROR => LogLevel::ERROR, - E_DEPRECATED => LogLevel::NOTICE, - E_USER_DEPRECATED => LogLevel::NOTICE, - ); - } - - /** - * @private - */ - public function handleException($e) - { - $this->logger->log( - $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel, - sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), - array('exception' => $e) - ); - - if ($this->previousExceptionHandler) { - call_user_func($this->previousExceptionHandler, $e); - } - - exit(255); - } - - /** - * @private - */ - public function handleError($code, $message, $file = '', $line = 0, $context = array()) - { - if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { - return; - } - - // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries - if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { - $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; - $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); - } - - if ($this->previousErrorHandler === true) { - return false; - } elseif ($this->previousErrorHandler) { - return call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context); - } - } - - /** - * @private - */ - public function handleFatalError() - { - $this->reservedMemory = null; - - $lastError = error_get_last(); - if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { - $this->logger->log( - $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, - 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], - array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line']) - ); - - if ($this->logger instanceof Logger) { - foreach ($this->logger->getHandlers() as $handler) { - if ($handler instanceof AbstractHandler) { - $handler->close(); - } - } - } - } - } - - private static function codeToString($code) - { - switch ($code) { - case E_ERROR: - return 'E_ERROR'; - case E_WARNING: - return 'E_WARNING'; - case E_PARSE: - return 'E_PARSE'; - case E_NOTICE: - return 'E_NOTICE'; - case E_CORE_ERROR: - return 'E_CORE_ERROR'; - case E_CORE_WARNING: - return 'E_CORE_WARNING'; - case E_COMPILE_ERROR: - return 'E_COMPILE_ERROR'; - case E_COMPILE_WARNING: - return 'E_COMPILE_WARNING'; - case E_USER_ERROR: - return 'E_USER_ERROR'; - case E_USER_WARNING: - return 'E_USER_WARNING'; - case E_USER_NOTICE: - return 'E_USER_NOTICE'; - case E_STRICT: - return 'E_STRICT'; - case E_RECOVERABLE_ERROR: - return 'E_RECOVERABLE_ERROR'; - case E_DEPRECATED: - return 'E_DEPRECATED'; - case E_USER_DEPRECATED: - return 'E_USER_DEPRECATED'; - } - - return 'Unknown PHP error'; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php deleted file mode 100644 index 9beda1e..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -/** - * Formats a log message according to the ChromePHP array format - * - * @author Christophe Coevoet - */ -class ChromePHPFormatter implements FormatterInterface -{ - /** - * Translates Monolog log levels to Wildfire levels. - */ - private $logLevels = array( - Logger::DEBUG => 'log', - Logger::INFO => 'info', - Logger::NOTICE => 'info', - Logger::WARNING => 'warn', - Logger::ERROR => 'error', - Logger::CRITICAL => 'error', - Logger::ALERT => 'error', - Logger::EMERGENCY => 'error', - ); - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - // Retrieve the line and file if set and remove them from the formatted extra - $backtrace = 'unknown'; - if (isset($record['extra']['file'], $record['extra']['line'])) { - $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; - unset($record['extra']['file'], $record['extra']['line']); - } - - $message = array('message' => $record['message']); - if ($record['context']) { - $message['context'] = $record['context']; - } - if ($record['extra']) { - $message['extra'] = $record['extra']; - } - if (count($message) === 1) { - $message = reset($message); - } - - return array( - $record['channel'], - $message, - $backtrace, - $this->logLevels[$record['level']], - ); - } - - public function formatBatch(array $records) - { - $formatted = array(); - - foreach ($records as $record) { - $formatted[] = $this->format($record); - } - - return $formatted; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php deleted file mode 100644 index 4c556cf..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Elastica\Document; - -/** - * Format a log message into an Elastica Document - * - * @author Jelle Vink - */ -class ElasticaFormatter extends NormalizerFormatter -{ - /** - * @var string Elastic search index name - */ - protected $index; - - /** - * @var string Elastic search document type - */ - protected $type; - - /** - * @param string $index Elastic Search index name - * @param string $type Elastic Search document type - */ - public function __construct($index, $type) - { - // elasticsearch requires a ISO 8601 format date with optional millisecond precision. - parent::__construct('Y-m-d\TH:i:s.uP'); - - $this->index = $index; - $this->type = $type; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - $record = parent::format($record); - - return $this->getDocument($record); - } - - /** - * Getter index - * @return string - */ - public function getIndex() - { - return $this->index; - } - - /** - * Getter type - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Convert a log message into an Elastica Document - * - * @param array $record Log message - * @return Document - */ - protected function getDocument($record) - { - $document = new Document(); - $document->setData($record); - $document->setType($this->type); - $document->setIndex($this->index); - - return $document; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php deleted file mode 100644 index 5094af3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * formats the record to be used in the FlowdockHandler - * - * @author Dominik Liebler - */ -class FlowdockFormatter implements FormatterInterface -{ - /** - * @var string - */ - private $source; - - /** - * @var string - */ - private $sourceEmail; - - /** - * @param string $source - * @param string $sourceEmail - */ - public function __construct($source, $sourceEmail) - { - $this->source = $source; - $this->sourceEmail = $sourceEmail; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - $tags = array( - '#logs', - '#' . strtolower($record['level_name']), - '#' . $record['channel'], - ); - - foreach ($record['extra'] as $value) { - $tags[] = '#' . $value; - } - - $subject = sprintf( - 'in %s: %s - %s', - $this->source, - $record['level_name'], - $this->getShortMessage($record['message']) - ); - - $record['flowdock'] = array( - 'source' => $this->source, - 'from_address' => $this->sourceEmail, - 'subject' => $subject, - 'content' => $record['message'], - 'tags' => $tags, - 'project' => $this->source, - ); - - return $record; - } - - /** - * {@inheritdoc} - */ - public function formatBatch(array $records) - { - $formatted = array(); - - foreach ($records as $record) { - $formatted[] = $this->format($record); - } - - return $formatted; - } - - /** - * @param string $message - * - * @return string - */ - public function getShortMessage($message) - { - static $hasMbString; - - if (null === $hasMbString) { - $hasMbString = function_exists('mb_strlen'); - } - - $maxLength = 45; - - if ($hasMbString) { - if (mb_strlen($message, 'UTF-8') > $maxLength) { - $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . ' ...'; - } - } else { - if (strlen($message) > $maxLength) { - $message = substr($message, 0, $maxLength - 4) . ' ...'; - } - } - - return $message; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php deleted file mode 100644 index 02632bb..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Class FluentdFormatter - * - * Serializes a log message to Fluentd unix socket protocol - * - * Fluentd config: - * - * - * type unix - * path /var/run/td-agent/td-agent.sock - * - * - * Monolog setup: - * - * $logger = new Monolog\Logger('fluent.tag'); - * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); - * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); - * $logger->pushHandler($fluentHandler); - * - * @author Andrius Putna - */ -class FluentdFormatter implements FormatterInterface -{ - /** - * @var bool $levelTag should message level be a part of the fluentd tag - */ - protected $levelTag = false; - - public function __construct($levelTag = false) - { - if (!function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); - } - - $this->levelTag = (bool) $levelTag; - } - - public function isUsingLevelsInTag() - { - return $this->levelTag; - } - - public function format(array $record) - { - $tag = $record['channel']; - if ($this->levelTag) { - $tag .= '.' . strtolower($record['level_name']); - } - - $message = array( - 'message' => $record['message'], - 'extra' => $record['extra'], - ); - - if (!$this->levelTag) { - $message['level'] = $record['level']; - $message['level_name'] = $record['level_name']; - } - - return json_encode(array($tag, $record['datetime']->getTimestamp(), $message)); - } - - public function formatBatch(array $records) - { - $message = ''; - foreach ($records as $record) { - $message .= $this->format($record); - } - - return $message; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php deleted file mode 100644 index b5de751..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Interface for formatters - * - * @author Jordi Boggiano - */ -interface FormatterInterface -{ - /** - * Formats a log record. - * - * @param array $record A record to format - * @return mixed The formatted record - */ - public function format(array $record); - - /** - * Formats a set of log records. - * - * @param array $records A set of records to format - * @return mixed The formatted set of records - */ - public function formatBatch(array $records); -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php deleted file mode 100644 index 2c1b0e8..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Gelf\Message; - -/** - * Serializes a log message to GELF - * @see http://www.graylog2.org/about/gelf - * - * @author Matt Lehner - */ -class GelfMessageFormatter extends NormalizerFormatter -{ - const DEFAULT_MAX_LENGTH = 32766; - - /** - * @var string the name of the system for the Gelf log message - */ - protected $systemName; - - /** - * @var string a prefix for 'extra' fields from the Monolog record (optional) - */ - protected $extraPrefix; - - /** - * @var string a prefix for 'context' fields from the Monolog record (optional) - */ - protected $contextPrefix; - - /** - * @var int max length per field - */ - protected $maxLength; - - /** - * Translates Monolog log levels to Graylog2 log priorities. - */ - private $logLevels = array( - Logger::DEBUG => 7, - Logger::INFO => 6, - Logger::NOTICE => 5, - Logger::WARNING => 4, - Logger::ERROR => 3, - Logger::CRITICAL => 2, - Logger::ALERT => 1, - Logger::EMERGENCY => 0, - ); - - public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null) - { - parent::__construct('U.u'); - - $this->systemName = $systemName ?: gethostname(); - - $this->extraPrefix = $extraPrefix; - $this->contextPrefix = $contextPrefix; - $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - $record = parent::format($record); - - if (!isset($record['datetime'], $record['message'], $record['level'])) { - throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); - } - - $message = new Message(); - $message - ->setTimestamp($record['datetime']) - ->setShortMessage((string) $record['message']) - ->setHost($this->systemName) - ->setLevel($this->logLevels[$record['level']]); - - // message length + system name length + 200 for padding / metadata - $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); - - if ($len > $this->maxLength) { - $message->setShortMessage(substr($record['message'], 0, $this->maxLength)); - } - - if (isset($record['channel'])) { - $message->setFacility($record['channel']); - } - if (isset($record['extra']['line'])) { - $message->setLine($record['extra']['line']); - unset($record['extra']['line']); - } - if (isset($record['extra']['file'])) { - $message->setFile($record['extra']['file']); - unset($record['extra']['file']); - } - - foreach ($record['extra'] as $key => $val) { - $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); - $len = strlen($this->extraPrefix . $key . $val); - if ($len > $this->maxLength) { - $message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength)); - break; - } - $message->setAdditional($this->extraPrefix . $key, $val); - } - - foreach ($record['context'] as $key => $val) { - $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); - $len = strlen($this->contextPrefix . $key . $val); - if ($len > $this->maxLength) { - $message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength)); - break; - } - $message->setAdditional($this->contextPrefix . $key, $val); - } - - if (null === $message->getFile() && isset($record['context']['exception']['file'])) { - if (preg_match("/^(.+):([0-9]+)$/", $record['context']['exception']['file'], $matches)) { - $message->setFile($matches[1]); - $message->setLine($matches[2]); - } - } - - return $message; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php deleted file mode 100644 index 3eec95f..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -/** - * Formats incoming records into an HTML table - * - * This is especially useful for html email logging - * - * @author Tiago Brito - */ -class HtmlFormatter extends NormalizerFormatter -{ - /** - * Translates Monolog log levels to html color priorities. - */ - protected $logLevels = array( - Logger::DEBUG => '#cccccc', - Logger::INFO => '#468847', - Logger::NOTICE => '#3a87ad', - Logger::WARNING => '#c09853', - Logger::ERROR => '#f0ad4e', - Logger::CRITICAL => '#FF7708', - Logger::ALERT => '#C12A19', - Logger::EMERGENCY => '#000000', - ); - - /** - * @param string $dateFormat The format of the timestamp: one supported by DateTime::format - */ - public function __construct($dateFormat = null) - { - parent::__construct($dateFormat); - } - - /** - * Creates an HTML table row - * - * @param string $th Row header content - * @param string $td Row standard cell content - * @param bool $escapeTd false if td content must not be html escaped - * @return string - */ - protected function addRow($th, $td = ' ', $escapeTd = true) - { - $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); - if ($escapeTd) { - $td = '
    '.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'
    '; - } - - return "\n$th:\n".$td."\n"; - } - - /** - * Create a HTML h1 tag - * - * @param string $title Text to be in the h1 - * @param int $level Error level - * @return string - */ - protected function addTitle($title, $level) - { - $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); - - return '

    '.$title.'

    '; - } - - /** - * Formats a log record. - * - * @param array $record A record to format - * @return mixed The formatted record - */ - public function format(array $record) - { - $output = $this->addTitle($record['level_name'], $record['level']); - $output .= ''; - - $output .= $this->addRow('Message', (string) $record['message']); - $output .= $this->addRow('Time', $record['datetime']->format($this->dateFormat)); - $output .= $this->addRow('Channel', $record['channel']); - if ($record['context']) { - $embeddedTable = '
    '; - foreach ($record['context'] as $key => $value) { - $embeddedTable .= $this->addRow($key, $this->convertToString($value)); - } - $embeddedTable .= '
    '; - $output .= $this->addRow('Context', $embeddedTable, false); - } - if ($record['extra']) { - $embeddedTable = ''; - foreach ($record['extra'] as $key => $value) { - $embeddedTable .= $this->addRow($key, $this->convertToString($value)); - } - $embeddedTable .= '
    '; - $output .= $this->addRow('Extra', $embeddedTable, false); - } - - return $output.''; - } - - /** - * Formats a set of log records. - * - * @param array $records A set of records to format - * @return mixed The formatted set of records - */ - public function formatBatch(array $records) - { - $message = ''; - foreach ($records as $record) { - $message .= $this->format($record); - } - - return $message; - } - - protected function convertToString($data) - { - if (null === $data || is_scalar($data)) { - return (string) $data; - } - - $data = $this->normalize($data); - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - return str_replace('\\/', '/', json_encode($data)); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php deleted file mode 100644 index 0782f14..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Exception; -use Throwable; - -/** - * Encodes whatever record data is passed to it as json - * - * This can be useful to log to databases or remote APIs - * - * @author Jordi Boggiano - */ -class JsonFormatter extends NormalizerFormatter -{ - const BATCH_MODE_JSON = 1; - const BATCH_MODE_NEWLINES = 2; - - protected $batchMode; - protected $appendNewline; - - /** - * @var bool - */ - protected $includeStacktraces = false; - - /** - * @param int $batchMode - * @param bool $appendNewline - */ - public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true) - { - $this->batchMode = $batchMode; - $this->appendNewline = $appendNewline; - } - - /** - * The batch mode option configures the formatting style for - * multiple records. By default, multiple records will be - * formatted as a JSON-encoded array. However, for - * compatibility with some API endpoints, alternative styles - * are available. - * - * @return int - */ - public function getBatchMode() - { - return $this->batchMode; - } - - /** - * True if newlines are appended to every formatted record - * - * @return bool - */ - public function isAppendingNewlines() - { - return $this->appendNewline; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : ''); - } - - /** - * {@inheritdoc} - */ - public function formatBatch(array $records) - { - switch ($this->batchMode) { - case static::BATCH_MODE_NEWLINES: - return $this->formatBatchNewlines($records); - - case static::BATCH_MODE_JSON: - default: - return $this->formatBatchJson($records); - } - } - - /** - * @param bool $include - */ - public function includeStacktraces($include = true) - { - $this->includeStacktraces = $include; - } - - /** - * Return a JSON-encoded array of records. - * - * @param array $records - * @return string - */ - protected function formatBatchJson(array $records) - { - return $this->toJson($this->normalize($records), true); - } - - /** - * Use new lines to separate records instead of a - * JSON-encoded array. - * - * @param array $records - * @return string - */ - protected function formatBatchNewlines(array $records) - { - $instance = $this; - - $oldNewline = $this->appendNewline; - $this->appendNewline = false; - array_walk($records, function (&$value, $key) use ($instance) { - $value = $instance->format($value); - }); - $this->appendNewline = $oldNewline; - - return implode("\n", $records); - } - - /** - * Normalizes given $data. - * - * @param mixed $data - * - * @return mixed - */ - protected function normalize($data) - { - if (is_array($data) || $data instanceof \Traversable) { - $normalized = array(); - - $count = 1; - foreach ($data as $key => $value) { - if ($count++ >= 1000) { - $normalized['...'] = 'Over 1000 items, aborting normalization'; - break; - } - $normalized[$key] = $this->normalize($value); - } - - return $normalized; - } - - if ($data instanceof Exception || $data instanceof Throwable) { - return $this->normalizeException($data); - } - - return $data; - } - - /** - * Normalizes given exception with or without its own stack trace based on - * `includeStacktraces` property. - * - * @param Exception|Throwable $e - * - * @return array - */ - protected function normalizeException($e) - { - // TODO 2.0 only check for Throwable - if (!$e instanceof Exception && !$e instanceof Throwable) { - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); - } - - $data = array( - 'class' => get_class($e), - 'message' => $e->getMessage(), - 'code' => $e->getCode(), - 'file' => $e->getFile().':'.$e->getLine(), - ); - - if ($this->includeStacktraces) { - $trace = $e->getTrace(); - foreach ($trace as $frame) { - if (isset($frame['file'])) { - $data['trace'][] = $frame['file'].':'.$frame['line']; - } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { - // We should again normalize the frames, because it might contain invalid items - $data['trace'][] = $frame['function']; - } else { - // We should again normalize the frames, because it might contain invalid items - $data['trace'][] = $this->normalize($frame); - } - } - } - - if ($previous = $e->getPrevious()) { - $data['previous'] = $this->normalizeException($previous); - } - - return $data; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php deleted file mode 100644 index d3e209e..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Formats incoming records into a one-line string - * - * This is especially useful for logging to files - * - * @author Jordi Boggiano - * @author Christophe Coevoet - */ -class LineFormatter extends NormalizerFormatter -{ - const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; - - protected $format; - protected $allowInlineLineBreaks; - protected $ignoreEmptyContextAndExtra; - protected $includeStacktraces; - - /** - * @param string $format The format of the message - * @param string $dateFormat The format of the timestamp: one supported by DateTime::format - * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries - * @param bool $ignoreEmptyContextAndExtra - */ - public function __construct($format = null, $dateFormat = null, $allowInlineLineBreaks = false, $ignoreEmptyContextAndExtra = false) - { - $this->format = $format ?: static::SIMPLE_FORMAT; - $this->allowInlineLineBreaks = $allowInlineLineBreaks; - $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra; - parent::__construct($dateFormat); - } - - public function includeStacktraces($include = true) - { - $this->includeStacktraces = $include; - if ($this->includeStacktraces) { - $this->allowInlineLineBreaks = true; - } - } - - public function allowInlineLineBreaks($allow = true) - { - $this->allowInlineLineBreaks = $allow; - } - - public function ignoreEmptyContextAndExtra($ignore = true) - { - $this->ignoreEmptyContextAndExtra = $ignore; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - $vars = parent::format($record); - - $output = $this->format; - - foreach ($vars['extra'] as $var => $val) { - if (false !== strpos($output, '%extra.'.$var.'%')) { - $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); - unset($vars['extra'][$var]); - } - } - - - foreach ($vars['context'] as $var => $val) { - if (false !== strpos($output, '%context.'.$var.'%')) { - $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); - unset($vars['context'][$var]); - } - } - - if ($this->ignoreEmptyContextAndExtra) { - if (empty($vars['context'])) { - unset($vars['context']); - $output = str_replace('%context%', '', $output); - } - - if (empty($vars['extra'])) { - unset($vars['extra']); - $output = str_replace('%extra%', '', $output); - } - } - - foreach ($vars as $var => $val) { - if (false !== strpos($output, '%'.$var.'%')) { - $output = str_replace('%'.$var.'%', $this->stringify($val), $output); - } - } - - // remove leftover %extra.xxx% and %context.xxx% if any - if (false !== strpos($output, '%')) { - $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); - } - - return $output; - } - - public function formatBatch(array $records) - { - $message = ''; - foreach ($records as $record) { - $message .= $this->format($record); - } - - return $message; - } - - public function stringify($value) - { - return $this->replaceNewlines($this->convertToString($value)); - } - - protected function normalizeException($e) - { - // TODO 2.0 only check for Throwable - if (!$e instanceof \Exception && !$e instanceof \Throwable) { - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); - } - - $previousText = ''; - if ($previous = $e->getPrevious()) { - do { - $previousText .= ', '.get_class($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); - } while ($previous = $previous->getPrevious()); - } - - $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; - if ($this->includeStacktraces) { - $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; - } - - return $str; - } - - protected function convertToString($data) - { - if (null === $data || is_bool($data)) { - return var_export($data, true); - } - - if (is_scalar($data)) { - return (string) $data; - } - - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return $this->toJson($data, true); - } - - return str_replace('\\/', '/', @json_encode($data)); - } - - protected function replaceNewlines($str) - { - if ($this->allowInlineLineBreaks) { - if (0 === strpos($str, '{')) { - return str_replace(array('\r', '\n'), array("\r", "\n"), $str); - } - - return $str; - } - - return str_replace(array("\r\n", "\r", "\n"), ' ', $str); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php deleted file mode 100644 index 401859b..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Encodes message information into JSON in a format compatible with Loggly. - * - * @author Adam Pancutt - */ -class LogglyFormatter extends JsonFormatter -{ - /** - * Overrides the default batch mode to new lines for compatibility with the - * Loggly bulk API. - * - * @param int $batchMode - */ - public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) - { - parent::__construct($batchMode, $appendNewline); - } - - /** - * Appends the 'timestamp' parameter for indexing by Loggly. - * - * @see https://www.loggly.com/docs/automated-parsing/#json - * @see \Monolog\Formatter\JsonFormatter::format() - */ - public function format(array $record) - { - if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) { - $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); - // TODO 2.0 unset the 'datetime' parameter, retained for BC - } - - return parent::format($record); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php deleted file mode 100644 index 8f83bec..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Serializes a log message to Logstash Event Format - * - * @see http://logstash.net/ - * @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb - * - * @author Tim Mower - */ -class LogstashFormatter extends NormalizerFormatter -{ - const V0 = 0; - const V1 = 1; - - /** - * @var string the name of the system for the Logstash log message, used to fill the @source field - */ - protected $systemName; - - /** - * @var string an application name for the Logstash log message, used to fill the @type field - */ - protected $applicationName; - - /** - * @var string a prefix for 'extra' fields from the Monolog record (optional) - */ - protected $extraPrefix; - - /** - * @var string a prefix for 'context' fields from the Monolog record (optional) - */ - protected $contextPrefix; - - /** - * @var int logstash format version to use - */ - protected $version; - - /** - * @param string $applicationName the application that sends the data, used as the "type" field of logstash - * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine - * @param string $extraPrefix prefix for extra keys inside logstash "fields" - * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ - * @param int $version the logstash format version to use, defaults to 0 - */ - public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) - { - // logstash requires a ISO 8601 format date with optional millisecond precision. - parent::__construct('Y-m-d\TH:i:s.uP'); - - $this->systemName = $systemName ?: gethostname(); - $this->applicationName = $applicationName; - $this->extraPrefix = $extraPrefix; - $this->contextPrefix = $contextPrefix; - $this->version = $version; - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - $record = parent::format($record); - - if ($this->version === self::V1) { - $message = $this->formatV1($record); - } else { - $message = $this->formatV0($record); - } - - return $this->toJson($message) . "\n"; - } - - protected function formatV0(array $record) - { - if (empty($record['datetime'])) { - $record['datetime'] = gmdate('c'); - } - $message = array( - '@timestamp' => $record['datetime'], - '@source' => $this->systemName, - '@fields' => array(), - ); - if (isset($record['message'])) { - $message['@message'] = $record['message']; - } - if (isset($record['channel'])) { - $message['@tags'] = array($record['channel']); - $message['@fields']['channel'] = $record['channel']; - } - if (isset($record['level'])) { - $message['@fields']['level'] = $record['level']; - } - if ($this->applicationName) { - $message['@type'] = $this->applicationName; - } - if (isset($record['extra']['server'])) { - $message['@source_host'] = $record['extra']['server']; - } - if (isset($record['extra']['url'])) { - $message['@source_path'] = $record['extra']['url']; - } - if (!empty($record['extra'])) { - foreach ($record['extra'] as $key => $val) { - $message['@fields'][$this->extraPrefix . $key] = $val; - } - } - if (!empty($record['context'])) { - foreach ($record['context'] as $key => $val) { - $message['@fields'][$this->contextPrefix . $key] = $val; - } - } - - return $message; - } - - protected function formatV1(array $record) - { - if (empty($record['datetime'])) { - $record['datetime'] = gmdate('c'); - } - $message = array( - '@timestamp' => $record['datetime'], - '@version' => 1, - 'host' => $this->systemName, - ); - if (isset($record['message'])) { - $message['message'] = $record['message']; - } - if (isset($record['channel'])) { - $message['type'] = $record['channel']; - $message['channel'] = $record['channel']; - } - if (isset($record['level_name'])) { - $message['level'] = $record['level_name']; - } - if ($this->applicationName) { - $message['type'] = $this->applicationName; - } - if (!empty($record['extra'])) { - foreach ($record['extra'] as $key => $val) { - $message[$this->extraPrefix . $key] = $val; - } - } - if (!empty($record['context'])) { - foreach ($record['context'] as $key => $val) { - $message[$this->contextPrefix . $key] = $val; - } - } - - return $message; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php deleted file mode 100644 index eb067bb..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Formats a record for use with the MongoDBHandler. - * - * @author Florian Plattner - */ -class MongoDBFormatter implements FormatterInterface -{ - private $exceptionTraceAsString; - private $maxNestingLevel; - - /** - * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 - * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings - */ - public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = true) - { - $this->maxNestingLevel = max($maxNestingLevel, 0); - $this->exceptionTraceAsString = (bool) $exceptionTraceAsString; - } - - /** - * {@inheritDoc} - */ - public function format(array $record) - { - return $this->formatArray($record); - } - - /** - * {@inheritDoc} - */ - public function formatBatch(array $records) - { - foreach ($records as $key => $record) { - $records[$key] = $this->format($record); - } - - return $records; - } - - protected function formatArray(array $record, $nestingLevel = 0) - { - if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) { - foreach ($record as $name => $value) { - if ($value instanceof \DateTime) { - $record[$name] = $this->formatDate($value, $nestingLevel + 1); - } elseif ($value instanceof \Exception) { - $record[$name] = $this->formatException($value, $nestingLevel + 1); - } elseif (is_array($value)) { - $record[$name] = $this->formatArray($value, $nestingLevel + 1); - } elseif (is_object($value)) { - $record[$name] = $this->formatObject($value, $nestingLevel + 1); - } - } - } else { - $record = '[...]'; - } - - return $record; - } - - protected function formatObject($value, $nestingLevel) - { - $objectVars = get_object_vars($value); - $objectVars['class'] = get_class($value); - - return $this->formatArray($objectVars, $nestingLevel); - } - - protected function formatException(\Exception $exception, $nestingLevel) - { - $formattedException = array( - 'class' => get_class($exception), - 'message' => $exception->getMessage(), - 'code' => $exception->getCode(), - 'file' => $exception->getFile() . ':' . $exception->getLine(), - ); - - if ($this->exceptionTraceAsString === true) { - $formattedException['trace'] = $exception->getTraceAsString(); - } else { - $formattedException['trace'] = $exception->getTrace(); - } - - return $this->formatArray($formattedException, $nestingLevel); - } - - protected function formatDate(\DateTime $value, $nestingLevel) - { - return new \MongoDate($value->getTimestamp()); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php deleted file mode 100644 index d441488..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +++ /dev/null @@ -1,297 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Exception; - -/** - * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets - * - * @author Jordi Boggiano - */ -class NormalizerFormatter implements FormatterInterface -{ - const SIMPLE_DATE = "Y-m-d H:i:s"; - - protected $dateFormat; - - /** - * @param string $dateFormat The format of the timestamp: one supported by DateTime::format - */ - public function __construct($dateFormat = null) - { - $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE; - if (!function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter'); - } - } - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - return $this->normalize($record); - } - - /** - * {@inheritdoc} - */ - public function formatBatch(array $records) - { - foreach ($records as $key => $record) { - $records[$key] = $this->format($record); - } - - return $records; - } - - protected function normalize($data) - { - if (null === $data || is_scalar($data)) { - if (is_float($data)) { - if (is_infinite($data)) { - return ($data > 0 ? '' : '-') . 'INF'; - } - if (is_nan($data)) { - return 'NaN'; - } - } - - return $data; - } - - if (is_array($data)) { - $normalized = array(); - - $count = 1; - foreach ($data as $key => $value) { - if ($count++ >= 1000) { - $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; - break; - } - $normalized[$key] = $this->normalize($value); - } - - return $normalized; - } - - if ($data instanceof \DateTime) { - return $data->format($this->dateFormat); - } - - if (is_object($data)) { - // TODO 2.0 only check for Throwable - if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) { - return $this->normalizeException($data); - } - - // non-serializable objects that implement __toString stringified - if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) { - $value = $data->__toString(); - } else { - // the rest is json-serialized in some way - $value = $this->toJson($data, true); - } - - return sprintf("[object] (%s: %s)", get_class($data), $value); - } - - if (is_resource($data)) { - return sprintf('[resource] (%s)', get_resource_type($data)); - } - - return '[unknown('.gettype($data).')]'; - } - - protected function normalizeException($e) - { - // TODO 2.0 only check for Throwable - if (!$e instanceof Exception && !$e instanceof \Throwable) { - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); - } - - $data = array( - 'class' => get_class($e), - 'message' => $e->getMessage(), - 'code' => $e->getCode(), - 'file' => $e->getFile().':'.$e->getLine(), - ); - - if ($e instanceof \SoapFault) { - if (isset($e->faultcode)) { - $data['faultcode'] = $e->faultcode; - } - - if (isset($e->faultactor)) { - $data['faultactor'] = $e->faultactor; - } - - if (isset($e->detail)) { - $data['detail'] = $e->detail; - } - } - - $trace = $e->getTrace(); - foreach ($trace as $frame) { - if (isset($frame['file'])) { - $data['trace'][] = $frame['file'].':'.$frame['line']; - } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { - // We should again normalize the frames, because it might contain invalid items - $data['trace'][] = $frame['function']; - } else { - // We should again normalize the frames, because it might contain invalid items - $data['trace'][] = $this->toJson($this->normalize($frame), true); - } - } - - if ($previous = $e->getPrevious()) { - $data['previous'] = $this->normalizeException($previous); - } - - return $data; - } - - /** - * Return the JSON representation of a value - * - * @param mixed $data - * @param bool $ignoreErrors - * @throws \RuntimeException if encoding fails and errors are not ignored - * @return string - */ - protected function toJson($data, $ignoreErrors = false) - { - // suppress json_encode errors since it's twitchy with some inputs - if ($ignoreErrors) { - return @$this->jsonEncode($data); - } - - $json = $this->jsonEncode($data); - - if ($json === false) { - $json = $this->handleJsonError(json_last_error(), $data); - } - - return $json; - } - - /** - * @param mixed $data - * @return string JSON encoded data or null on failure - */ - private function jsonEncode($data) - { - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - return json_encode($data); - } - - /** - * Handle a json_encode failure. - * - * If the failure is due to invalid string encoding, try to clean the - * input and encode again. If the second encoding attempt fails, the - * inital error is not encoding related or the input can't be cleaned then - * raise a descriptive exception. - * - * @param int $code return code of json_last_error function - * @param mixed $data data that was meant to be encoded - * @throws \RuntimeException if failure can't be corrected - * @return string JSON encoded data after error correction - */ - private function handleJsonError($code, $data) - { - if ($code !== JSON_ERROR_UTF8) { - $this->throwEncodeError($code, $data); - } - - if (is_string($data)) { - $this->detectAndCleanUtf8($data); - } elseif (is_array($data)) { - array_walk_recursive($data, array($this, 'detectAndCleanUtf8')); - } else { - $this->throwEncodeError($code, $data); - } - - $json = $this->jsonEncode($data); - - if ($json === false) { - $this->throwEncodeError(json_last_error(), $data); - } - - return $json; - } - - /** - * Throws an exception according to a given code with a customized message - * - * @param int $code return code of json_last_error function - * @param mixed $data data that was meant to be encoded - * @throws \RuntimeException - */ - private function throwEncodeError($code, $data) - { - switch ($code) { - case JSON_ERROR_DEPTH: - $msg = 'Maximum stack depth exceeded'; - break; - case JSON_ERROR_STATE_MISMATCH: - $msg = 'Underflow or the modes mismatch'; - break; - case JSON_ERROR_CTRL_CHAR: - $msg = 'Unexpected control character found'; - break; - case JSON_ERROR_UTF8: - $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; - break; - default: - $msg = 'Unknown error'; - } - - throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); - } - - /** - * Detect invalid UTF-8 string characters and convert to valid UTF-8. - * - * Valid UTF-8 input will be left unmodified, but strings containing - * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed - * original encoding of ISO-8859-15. This conversion may result in - * incorrect output if the actual encoding was not ISO-8859-15, but it - * will be clean UTF-8 output and will not rely on expensive and fragile - * detection algorithms. - * - * Function converts the input in place in the passed variable so that it - * can be used as a callback for array_walk_recursive. - * - * @param mixed &$data Input to check and convert if needed - * @private - */ - public function detectAndCleanUtf8(&$data) - { - if (is_string($data) && !preg_match('//u', $data)) { - $data = preg_replace_callback( - '/[\x80-\xFF]+/', - function ($m) { return utf8_encode($m[0]); }, - $data - ); - $data = str_replace( - array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'), - array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'), - $data - ); - } - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php deleted file mode 100644 index 5d345d5..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * Formats data into an associative array of scalar values. - * Objects and arrays will be JSON encoded. - * - * @author Andrew Lawson - */ -class ScalarFormatter extends NormalizerFormatter -{ - /** - * {@inheritdoc} - */ - public function format(array $record) - { - foreach ($record as $key => $value) { - $record[$key] = $this->normalizeValue($value); - } - - return $record; - } - - /** - * @param mixed $value - * @return mixed - */ - protected function normalizeValue($value) - { - $normalized = $this->normalize($value); - - if (is_array($normalized) || is_object($normalized)) { - return $this->toJson($normalized, true); - } - - return $normalized; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php deleted file mode 100644 index 654710a..0000000 --- a/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -/** - * Serializes a log message according to Wildfire's header requirements - * - * @author Eric Clemmons (@ericclemmons) - * @author Christophe Coevoet - * @author Kirill chEbba Chebunin - */ -class WildfireFormatter extends NormalizerFormatter -{ - const TABLE = 'table'; - - /** - * Translates Monolog log levels to Wildfire levels. - */ - private $logLevels = array( - Logger::DEBUG => 'LOG', - Logger::INFO => 'INFO', - Logger::NOTICE => 'INFO', - Logger::WARNING => 'WARN', - Logger::ERROR => 'ERROR', - Logger::CRITICAL => 'ERROR', - Logger::ALERT => 'ERROR', - Logger::EMERGENCY => 'ERROR', - ); - - /** - * {@inheritdoc} - */ - public function format(array $record) - { - // Retrieve the line and file if set and remove them from the formatted extra - $file = $line = ''; - if (isset($record['extra']['file'])) { - $file = $record['extra']['file']; - unset($record['extra']['file']); - } - if (isset($record['extra']['line'])) { - $line = $record['extra']['line']; - unset($record['extra']['line']); - } - - $record = $this->normalize($record); - $message = array('message' => $record['message']); - $handleError = false; - if ($record['context']) { - $message['context'] = $record['context']; - $handleError = true; - } - if ($record['extra']) { - $message['extra'] = $record['extra']; - $handleError = true; - } - if (count($message) === 1) { - $message = reset($message); - } - - if (isset($record['context'][self::TABLE])) { - $type = 'TABLE'; - $label = $record['channel'] .': '. $record['message']; - $message = $record['context'][self::TABLE]; - } else { - $type = $this->logLevels[$record['level']]; - $label = $record['channel']; - } - - // Create JSON object describing the appearance of the message in the console - $json = $this->toJson(array( - array( - 'Type' => $type, - 'File' => $file, - 'Line' => $line, - 'Label' => $label, - ), - $message, - ), $handleError); - - // The message itself is a serialization of the above JSON object + it's length - return sprintf( - '%s|%s|', - strlen($json), - $json - ); - } - - public function formatBatch(array $records) - { - throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); - } - - protected function normalize($data) - { - if (is_object($data) && !$data instanceof \DateTime) { - return $data; - } - - return parent::normalize($data); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php deleted file mode 100644 index 758a425..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\FormatterInterface; -use Monolog\Formatter\LineFormatter; - -/** - * Base Handler class providing the Handler structure - * - * @author Jordi Boggiano - */ -abstract class AbstractHandler implements HandlerInterface -{ - protected $level = Logger::DEBUG; - protected $bubble = true; - - /** - * @var FormatterInterface - */ - protected $formatter; - protected $processors = array(); - - /** - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($level = Logger::DEBUG, $bubble = true) - { - $this->setLevel($level); - $this->bubble = $bubble; - } - - /** - * {@inheritdoc} - */ - public function isHandling(array $record) - { - return $record['level'] >= $this->level; - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - foreach ($records as $record) { - $this->handle($record); - } - } - - /** - * Closes the handler. - * - * This will be called automatically when the object is destroyed - */ - public function close() - { - } - - /** - * {@inheritdoc} - */ - public function pushProcessor($callback) - { - if (!is_callable($callback)) { - throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); - } - array_unshift($this->processors, $callback); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function popProcessor() - { - if (!$this->processors) { - throw new \LogicException('You tried to pop from an empty processor stack.'); - } - - return array_shift($this->processors); - } - - /** - * {@inheritdoc} - */ - public function setFormatter(FormatterInterface $formatter) - { - $this->formatter = $formatter; - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getFormatter() - { - if (!$this->formatter) { - $this->formatter = $this->getDefaultFormatter(); - } - - return $this->formatter; - } - - /** - * Sets minimum logging level at which this handler will be triggered. - * - * @param int|string $level Level or level name - * @return self - */ - public function setLevel($level) - { - $this->level = Logger::toMonologLevel($level); - - return $this; - } - - /** - * Gets minimum logging level at which this handler will be triggered. - * - * @return int - */ - public function getLevel() - { - return $this->level; - } - - /** - * Sets the bubbling behavior. - * - * @param Boolean $bubble true means that this handler allows bubbling. - * false means that bubbling is not permitted. - * @return self - */ - public function setBubble($bubble) - { - $this->bubble = $bubble; - - return $this; - } - - /** - * Gets the bubbling behavior. - * - * @return Boolean true means that this handler allows bubbling. - * false means that bubbling is not permitted. - */ - public function getBubble() - { - return $this->bubble; - } - - public function __destruct() - { - try { - $this->close(); - } catch (\Exception $e) { - // do nothing - } catch (\Throwable $e) { - // do nothing - } - } - - /** - * Gets the default formatter. - * - * @return FormatterInterface - */ - protected function getDefaultFormatter() - { - return new LineFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php deleted file mode 100644 index 6f18f72..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Base Handler class providing the Handler structure - * - * Classes extending it should (in most cases) only implement write($record) - * - * @author Jordi Boggiano - * @author Christophe Coevoet - */ -abstract class AbstractProcessingHandler extends AbstractHandler -{ - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if (!$this->isHandling($record)) { - return false; - } - - $record = $this->processRecord($record); - - $record['formatted'] = $this->getFormatter()->format($record); - - $this->write($record); - - return false === $this->bubble; - } - - /** - * Writes the record down to the log of the implementing handler - * - * @param array $record - * @return void - */ - abstract protected function write(array $record); - - /** - * Processes a record. - * - * @param array $record - * @return array - */ - protected function processRecord(array $record) - { - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php deleted file mode 100644 index e2b2832..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -/** - * Common syslog functionality - */ -abstract class AbstractSyslogHandler extends AbstractProcessingHandler -{ - protected $facility; - - /** - * Translates Monolog log levels to syslog log priorities. - */ - protected $logLevels = array( - Logger::DEBUG => LOG_DEBUG, - Logger::INFO => LOG_INFO, - Logger::NOTICE => LOG_NOTICE, - Logger::WARNING => LOG_WARNING, - Logger::ERROR => LOG_ERR, - Logger::CRITICAL => LOG_CRIT, - Logger::ALERT => LOG_ALERT, - Logger::EMERGENCY => LOG_EMERG, - ); - - /** - * List of valid log facility names. - */ - protected $facilities = array( - 'auth' => LOG_AUTH, - 'authpriv' => LOG_AUTHPRIV, - 'cron' => LOG_CRON, - 'daemon' => LOG_DAEMON, - 'kern' => LOG_KERN, - 'lpr' => LOG_LPR, - 'mail' => LOG_MAIL, - 'news' => LOG_NEWS, - 'syslog' => LOG_SYSLOG, - 'user' => LOG_USER, - 'uucp' => LOG_UUCP, - ); - - /** - * @param mixed $facility - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - - if (!defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->facilities['local0'] = LOG_LOCAL0; - $this->facilities['local1'] = LOG_LOCAL1; - $this->facilities['local2'] = LOG_LOCAL2; - $this->facilities['local3'] = LOG_LOCAL3; - $this->facilities['local4'] = LOG_LOCAL4; - $this->facilities['local5'] = LOG_LOCAL5; - $this->facilities['local6'] = LOG_LOCAL6; - $this->facilities['local7'] = LOG_LOCAL7; - } else { - $this->facilities['local0'] = 128; // LOG_LOCAL0 - $this->facilities['local1'] = 136; // LOG_LOCAL1 - $this->facilities['local2'] = 144; // LOG_LOCAL2 - $this->facilities['local3'] = 152; // LOG_LOCAL3 - $this->facilities['local4'] = 160; // LOG_LOCAL4 - $this->facilities['local5'] = 168; // LOG_LOCAL5 - $this->facilities['local6'] = 176; // LOG_LOCAL6 - $this->facilities['local7'] = 184; // LOG_LOCAL7 - } - - // convert textual description of facility to syslog constant - if (array_key_exists(strtolower($facility), $this->facilities)) { - $facility = $this->facilities[strtolower($facility)]; - } elseif (!in_array($facility, array_values($this->facilities), true)) { - throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); - } - - $this->facility = $facility; - } - - /** - * {@inheritdoc} - */ - protected function getDefaultFormatter() - { - return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%'); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php deleted file mode 100644 index e5a46bc..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\JsonFormatter; -use PhpAmqpLib\Message\AMQPMessage; -use PhpAmqpLib\Channel\AMQPChannel; -use AMQPExchange; - -class AmqpHandler extends AbstractProcessingHandler -{ - /** - * @var AMQPExchange|AMQPChannel $exchange - */ - protected $exchange; - - /** - * @var string - */ - protected $exchangeName; - - /** - * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use - * @param string $exchangeName - * @param int $level - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true) - { - if ($exchange instanceof AMQPExchange) { - $exchange->setName($exchangeName); - } elseif ($exchange instanceof AMQPChannel) { - $this->exchangeName = $exchangeName; - } else { - throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required'); - } - $this->exchange = $exchange; - - parent::__construct($level, $bubble); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - $data = $record["formatted"]; - $routingKey = $this->getRoutingKey($record); - - if ($this->exchange instanceof AMQPExchange) { - $this->exchange->publish( - $data, - $routingKey, - 0, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ) - ); - } else { - $this->exchange->basic_publish( - $this->createAmqpMessage($data), - $this->exchangeName, - $routingKey - ); - } - } - - /** - * {@inheritDoc} - */ - public function handleBatch(array $records) - { - if ($this->exchange instanceof AMQPExchange) { - parent::handleBatch($records); - - return; - } - - foreach ($records as $record) { - if (!$this->isHandling($record)) { - continue; - } - - $record = $this->processRecord($record); - $data = $this->getFormatter()->format($record); - - $this->exchange->batch_basic_publish( - $this->createAmqpMessage($data), - $this->exchangeName, - $this->getRoutingKey($record) - ); - } - - $this->exchange->publish_batch(); - } - - /** - * Gets the routing key for the AMQP exchange - * - * @param array $record - * @return string - */ - protected function getRoutingKey(array $record) - { - $routingKey = sprintf( - '%s.%s', - // TODO 2.0 remove substr call - substr($record['level_name'], 0, 4), - $record['channel'] - ); - - return strtolower($routingKey); - } - - /** - * @param string $data - * @return AMQPMessage - */ - private function createAmqpMessage($data) - { - return new AMQPMessage( - (string) $data, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ) - ); - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php deleted file mode 100644 index b3a21bd..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +++ /dev/null @@ -1,230 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; - -/** - * Handler sending logs to browser's javascript console with no browser extension required - * - * @author Olivier Poitrey - */ -class BrowserConsoleHandler extends AbstractProcessingHandler -{ - protected static $initialized = false; - protected static $records = array(); - - /** - * {@inheritDoc} - * - * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. - * - * Example of formatted string: - * - * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} - */ - protected function getDefaultFormatter() - { - return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%'); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - // Accumulate records - self::$records[] = $record; - - // Register shutdown handler if not already done - if (!self::$initialized) { - self::$initialized = true; - $this->registerShutdownFunction(); - } - } - - /** - * Convert records to javascript console commands and send it to the browser. - * This method is automatically called on PHP shutdown if output is HTML or Javascript. - */ - public static function send() - { - $format = self::getResponseFormat(); - if ($format === 'unknown') { - return; - } - - if (count(self::$records)) { - if ($format === 'html') { - self::writeOutput(''); - } elseif ($format === 'js') { - self::writeOutput(self::generateScript()); - } - self::reset(); - } - } - - /** - * Forget all logged records - */ - public static function reset() - { - self::$records = array(); - } - - /** - * Wrapper for register_shutdown_function to allow overriding - */ - protected function registerShutdownFunction() - { - if (PHP_SAPI !== 'cli') { - register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send')); - } - } - - /** - * Wrapper for echo to allow overriding - * - * @param string $str - */ - protected static function writeOutput($str) - { - echo $str; - } - - /** - * Checks the format of the response - * - * If Content-Type is set to application/javascript or text/javascript -> js - * If Content-Type is set to text/html, or is unset -> html - * If Content-Type is anything else -> unknown - * - * @return string One of 'js', 'html' or 'unknown' - */ - protected static function getResponseFormat() - { - // Check content type - foreach (headers_list() as $header) { - if (stripos($header, 'content-type:') === 0) { - // This handler only works with HTML and javascript outputs - // text/javascript is obsolete in favour of application/javascript, but still used - if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { - return 'js'; - } - if (stripos($header, 'text/html') === false) { - return 'unknown'; - } - break; - } - } - - return 'html'; - } - - private static function generateScript() - { - $script = array(); - foreach (self::$records as $record) { - $context = self::dump('Context', $record['context']); - $extra = self::dump('Extra', $record['extra']); - - if (empty($context) && empty($extra)) { - $script[] = self::call_array('log', self::handleStyles($record['formatted'])); - } else { - $script = array_merge($script, - array(self::call_array('groupCollapsed', self::handleStyles($record['formatted']))), - $context, - $extra, - array(self::call('groupEnd')) - ); - } - } - - return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; - } - - private static function handleStyles($formatted) - { - $args = array(self::quote('font-weight: normal')); - $format = '%c' . $formatted; - preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); - - foreach (array_reverse($matches) as $match) { - $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0])); - $args[] = '"font-weight: normal"'; - - $pos = $match[0][1]; - $format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0])); - } - - array_unshift($args, self::quote($format)); - - return $args; - } - - private static function handleCustomStyles($style, $string) - { - static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey'); - static $labels = array(); - - return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function ($m) use ($string, &$colors, &$labels) { - if (trim($m[1]) === 'autolabel') { - // Format the string as a label with consistent auto assigned background color - if (!isset($labels[$string])) { - $labels[$string] = $colors[count($labels) % count($colors)]; - } - $color = $labels[$string]; - - return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px"; - } - - return $m[1]; - }, $style); - } - - private static function dump($title, array $dict) - { - $script = array(); - $dict = array_filter($dict); - if (empty($dict)) { - return $script; - } - $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title)); - foreach ($dict as $key => $value) { - $value = json_encode($value); - if (empty($value)) { - $value = self::quote(''); - } - $script[] = self::call('log', self::quote('%s: %o'), self::quote($key), $value); - } - - return $script; - } - - private static function quote($arg) - { - return '"' . addcslashes($arg, "\"\n\\") . '"'; - } - - private static function call() - { - $args = func_get_args(); - $method = array_shift($args); - - return self::call_array($method, $args); - } - - private static function call_array($method, array $args) - { - return 'c.' . $method . '(' . implode(', ', $args) . ');'; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php deleted file mode 100644 index 72f8953..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Buffers all records until closing the handler and then pass them as batch. - * - * This is useful for a MailHandler to send only one mail per request instead of - * sending one per log message. - * - * @author Christophe Coevoet - */ -class BufferHandler extends AbstractHandler -{ - protected $handler; - protected $bufferSize = 0; - protected $bufferLimit; - protected $flushOnOverflow; - protected $buffer = array(); - protected $initialized = false; - - /** - * @param HandlerInterface $handler Handler. - * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded - */ - public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false) - { - parent::__construct($level, $bubble); - $this->handler = $handler; - $this->bufferLimit = (int) $bufferLimit; - $this->flushOnOverflow = $flushOnOverflow; - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if ($record['level'] < $this->level) { - return false; - } - - if (!$this->initialized) { - // __destructor() doesn't get called on Fatal errors - register_shutdown_function(array($this, 'close')); - $this->initialized = true; - } - - if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) { - if ($this->flushOnOverflow) { - $this->flush(); - } else { - array_shift($this->buffer); - $this->bufferSize--; - } - } - - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - $this->buffer[] = $record; - $this->bufferSize++; - - return false === $this->bubble; - } - - public function flush() - { - if ($this->bufferSize === 0) { - return; - } - - $this->handler->handleBatch($this->buffer); - $this->clear(); - } - - public function __destruct() - { - // suppress the parent behavior since we already have register_shutdown_function() - // to call close(), and the reference contained there will prevent this from being - // GC'd until the end of the request - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->flush(); - } - - /** - * Clears the buffer without flushing any messages down to the wrapped handler. - */ - public function clear() - { - $this->bufferSize = 0; - $this->buffer = array(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php deleted file mode 100644 index 785cb0c..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\ChromePHPFormatter; -use Monolog\Logger; - -/** - * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) - * - * This also works out of the box with Firefox 43+ - * - * @author Christophe Coevoet - */ -class ChromePHPHandler extends AbstractProcessingHandler -{ - /** - * Version of the extension - */ - const VERSION = '4.0'; - - /** - * Header name - */ - const HEADER_NAME = 'X-ChromeLogger-Data'; - - /** - * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) - */ - const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; - - protected static $initialized = false; - - /** - * Tracks whether we sent too much data - * - * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending - * - * @var Boolean - */ - protected static $overflowed = false; - - protected static $json = array( - 'version' => self::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array(), - ); - - protected static $sendHeaders = true; - - /** - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - if (!function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler'); - } - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - $messages = array(); - - foreach ($records as $record) { - if ($record['level'] < $this->level) { - continue; - } - $messages[] = $this->processRecord($record); - } - - if (!empty($messages)) { - $messages = $this->getFormatter()->formatBatch($messages); - self::$json['rows'] = array_merge(self::$json['rows'], $messages); - $this->send(); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new ChromePHPFormatter(); - } - - /** - * Creates & sends header for a record - * - * @see sendHeader() - * @see send() - * @param array $record - */ - protected function write(array $record) - { - self::$json['rows'][] = $record['formatted']; - - $this->send(); - } - - /** - * Sends the log header - * - * @see sendHeader() - */ - protected function send() - { - if (self::$overflowed || !self::$sendHeaders) { - return; - } - - if (!self::$initialized) { - self::$initialized = true; - - self::$sendHeaders = $this->headersAccepted(); - if (!self::$sendHeaders) { - return; - } - - self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; - } - - $json = @json_encode(self::$json); - $data = base64_encode(utf8_encode($json)); - if (strlen($data) > 240 * 1024) { - self::$overflowed = true; - - $record = array( - 'message' => 'Incomplete logs, chrome header size limit reached', - 'context' => array(), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'monolog', - 'datetime' => new \DateTime(), - 'extra' => array(), - ); - self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); - $json = @json_encode(self::$json); - $data = base64_encode(utf8_encode($json)); - } - - if (trim($data) !== '') { - $this->sendHeader(self::HEADER_NAME, $data); - } - } - - /** - * Send header string to the client - * - * @param string $header - * @param string $content - */ - protected function sendHeader($header, $content) - { - if (!headers_sent() && self::$sendHeaders) { - header(sprintf('%s: %s', $header, $content)); - } - } - - /** - * Verifies if the headers are accepted by the current user agent - * - * @return Boolean - */ - protected function headersAccepted() - { - if (empty($_SERVER['HTTP_USER_AGENT'])) { - return false; - } - - return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']); - } - - /** - * BC getter for the sendHeaders property that has been made static - */ - public function __get($property) - { - if ('sendHeaders' !== $property) { - throw new \InvalidArgumentException('Undefined property '.$property); - } - - return static::$sendHeaders; - } - - /** - * BC setter for the sendHeaders property that has been made static - */ - public function __set($property, $value) - { - if ('sendHeaders' !== $property) { - throw new \InvalidArgumentException('Undefined property '.$property); - } - - static::$sendHeaders = $value; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php deleted file mode 100644 index cc98697..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\JsonFormatter; -use Monolog\Logger; - -/** - * CouchDB handler - * - * @author Markus Bachmann - */ -class CouchDBHandler extends AbstractProcessingHandler -{ - private $options; - - public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true) - { - $this->options = array_merge(array( - 'host' => 'localhost', - 'port' => 5984, - 'dbname' => 'logger', - 'username' => null, - 'password' => null, - ), $options); - - parent::__construct($level, $bubble); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - $basicAuth = null; - if ($this->options['username']) { - $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); - } - - $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname']; - $context = stream_context_create(array( - 'http' => array( - 'method' => 'POST', - 'content' => $record['formatted'], - 'ignore_errors' => true, - 'max_redirects' => 0, - 'header' => 'Content-type: application/json', - ), - )); - - if (false === @file_get_contents($url, null, $context)) { - throw new \RuntimeException(sprintf('Could not connect to %s', $url)); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php deleted file mode 100644 index 96b3ca0..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Logs to Cube. - * - * @link http://square.github.com/cube/ - * @author Wan Chen - */ -class CubeHandler extends AbstractProcessingHandler -{ - private $udpConnection; - private $httpConnection; - private $scheme; - private $host; - private $port; - private $acceptedSchemes = array('http', 'udp'); - - /** - * Create a Cube handler - * - * @throws \UnexpectedValueException when given url is not a valid url. - * A valid url must consist of three parts : protocol://host:port - * Only valid protocols used by Cube are http and udp - */ - public function __construct($url, $level = Logger::DEBUG, $bubble = true) - { - $urlInfo = parse_url($url); - - if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) { - throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); - } - - if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { - throw new \UnexpectedValueException( - 'Invalid protocol (' . $urlInfo['scheme'] . ').' - . ' Valid options are ' . implode(', ', $this->acceptedSchemes)); - } - - $this->scheme = $urlInfo['scheme']; - $this->host = $urlInfo['host']; - $this->port = $urlInfo['port']; - - parent::__construct($level, $bubble); - } - - /** - * Establish a connection to an UDP socket - * - * @throws \LogicException when unable to connect to the socket - * @throws MissingExtensionException when there is no socket extension - */ - protected function connectUdp() - { - if (!extension_loaded('sockets')) { - throw new MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler'); - } - - $this->udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0); - if (!$this->udpConnection) { - throw new \LogicException('Unable to create a socket'); - } - - if (!socket_connect($this->udpConnection, $this->host, $this->port)) { - throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port); - } - } - - /** - * Establish a connection to a http server - * @throws \LogicException when no curl extension - */ - protected function connectHttp() - { - if (!extension_loaded('curl')) { - throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler'); - } - - $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put'); - - if (!$this->httpConnection) { - throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port); - } - - curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST"); - curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $date = $record['datetime']; - - $data = array('time' => $date->format('Y-m-d\TH:i:s.uO')); - unset($record['datetime']); - - if (isset($record['context']['type'])) { - $data['type'] = $record['context']['type']; - unset($record['context']['type']); - } else { - $data['type'] = $record['channel']; - } - - $data['data'] = $record['context']; - $data['data']['level'] = $record['level']; - - if ($this->scheme === 'http') { - $this->writeHttp(json_encode($data)); - } else { - $this->writeUdp(json_encode($data)); - } - } - - private function writeUdp($data) - { - if (!$this->udpConnection) { - $this->connectUdp(); - } - - socket_send($this->udpConnection, $data, strlen($data), 0); - } - - private function writeHttp($data) - { - if (!$this->httpConnection) { - $this->connectHttp(); - } - - curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); - curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen('['.$data.']'), - )); - - Curl\Util::execute($this->httpConnection, 5, false); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php deleted file mode 100644 index 48d30b3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\Curl; - -class Util -{ - private static $retriableErrorCodes = array( - CURLE_COULDNT_RESOLVE_HOST, - CURLE_COULDNT_CONNECT, - CURLE_HTTP_NOT_FOUND, - CURLE_READ_ERROR, - CURLE_OPERATION_TIMEOUTED, - CURLE_HTTP_POST_ERROR, - CURLE_SSL_CONNECT_ERROR, - ); - - /** - * Executes a CURL request with optional retries and exception on failure - * - * @param resource $ch curl handler - * @throws \RuntimeException - */ - public static function execute($ch, $retries = 5, $closeAfterDone = true) - { - while ($retries--) { - if (curl_exec($ch) === false) { - $curlErrno = curl_errno($ch); - - if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { - $curlError = curl_error($ch); - - if ($closeAfterDone) { - curl_close($ch); - } - - throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError)); - } - - continue; - } - - if ($closeAfterDone) { - curl_close($ch); - } - break; - } - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php deleted file mode 100644 index 7778c22..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Simple handler wrapper that deduplicates log records across multiple requests - * - * It also includes the BufferHandler functionality and will buffer - * all messages until the end of the request or flush() is called. - * - * This works by storing all log records' messages above $deduplicationLevel - * to the file specified by $deduplicationStore. When further logs come in at the end of the - * request (or when flush() is called), all those above $deduplicationLevel are checked - * against the existing stored logs. If they match and the timestamps in the stored log is - * not older than $time seconds, the new log record is discarded. If no log record is new, the - * whole data set is discarded. - * - * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers - * that send messages to people, to avoid spamming with the same message over and over in case of - * a major component failure like a database server being down which makes all requests fail in the - * same way. - * - * @author Jordi Boggiano - */ -class DeduplicationHandler extends BufferHandler -{ - /** - * @var string - */ - protected $deduplicationStore; - - /** - * @var int - */ - protected $deduplicationLevel; - - /** - * @var int - */ - protected $time; - - /** - * @var bool - */ - private $gc = false; - - /** - * @param HandlerInterface $handler Handler. - * @param string $deduplicationStore The file/path where the deduplication log should be kept - * @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes - * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true) - { - parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); - - $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; - $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); - $this->time = $time; - } - - public function flush() - { - if ($this->bufferSize === 0) { - return; - } - - $passthru = null; - - foreach ($this->buffer as $record) { - if ($record['level'] >= $this->deduplicationLevel) { - - $passthru = $passthru || !$this->isDuplicate($record); - if ($passthru) { - $this->appendRecord($record); - } - } - } - - // default of null is valid as well as if no record matches duplicationLevel we just pass through - if ($passthru === true || $passthru === null) { - $this->handler->handleBatch($this->buffer); - } - - $this->clear(); - - if ($this->gc) { - $this->collectLogs(); - } - } - - private function isDuplicate(array $record) - { - if (!file_exists($this->deduplicationStore)) { - return false; - } - - $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - if (!is_array($store)) { - return false; - } - - $yesterday = time() - 86400; - $timestampValidity = $record['datetime']->getTimestamp() - $this->time; - $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); - - for ($i = count($store) - 1; $i >= 0; $i--) { - list($timestamp, $level, $message) = explode(':', $store[$i], 3); - - if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { - return true; - } - - if ($timestamp < $yesterday) { - $this->gc = true; - } - } - - return false; - } - - private function collectLogs() - { - if (!file_exists($this->deduplicationStore)) { - return false; - } - - $handle = fopen($this->deduplicationStore, 'rw+'); - flock($handle, LOCK_EX); - $validLogs = array(); - - $timestampValidity = time() - $this->time; - - while (!feof($handle)) { - $log = fgets($handle); - if (substr($log, 0, 10) >= $timestampValidity) { - $validLogs[] = $log; - } - } - - ftruncate($handle, 0); - rewind($handle); - foreach ($validLogs as $log) { - fwrite($handle, $log); - } - - flock($handle, LOCK_UN); - fclose($handle); - - $this->gc = false; - } - - private function appendRecord(array $record) - { - file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php deleted file mode 100644 index b91ffec..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\NormalizerFormatter; -use Doctrine\CouchDB\CouchDBClient; - -/** - * CouchDB handler for Doctrine CouchDB ODM - * - * @author Markus Bachmann - */ -class DoctrineCouchDBHandler extends AbstractProcessingHandler -{ - private $client; - - public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true) - { - $this->client = $client; - parent::__construct($level, $bubble); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - $this->client->postDocument($record['formatted']); - } - - protected function getDefaultFormatter() - { - return new NormalizerFormatter; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php deleted file mode 100644 index 237b71f..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Aws\Sdk; -use Aws\DynamoDb\DynamoDbClient; -use Aws\DynamoDb\Marshaler; -use Monolog\Formatter\ScalarFormatter; -use Monolog\Logger; - -/** - * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) - * - * @link https://github.com/aws/aws-sdk-php/ - * @author Andrew Lawson - */ -class DynamoDbHandler extends AbstractProcessingHandler -{ - const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; - - /** - * @var DynamoDbClient - */ - protected $client; - - /** - * @var string - */ - protected $table; - - /** - * @var int - */ - protected $version; - - /** - * @var Marshaler - */ - protected $marshaler; - - /** - * @param DynamoDbClient $client - * @param string $table - * @param int $level - * @param bool $bubble - */ - public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) - { - if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { - $this->version = 3; - $this->marshaler = new Marshaler; - } else { - $this->version = 2; - } - - $this->client = $client; - $this->table = $table; - - parent::__construct($level, $bubble); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $filtered = $this->filterEmptyFields($record['formatted']); - if ($this->version === 3) { - $formatted = $this->marshaler->marshalItem($filtered); - } else { - $formatted = $this->client->formatAttributes($filtered); - } - - $this->client->putItem(array( - 'TableName' => $this->table, - 'Item' => $formatted, - )); - } - - /** - * @param array $record - * @return array - */ - protected function filterEmptyFields(array $record) - { - return array_filter($record, function ($value) { - return !empty($value) || false === $value || 0 === $value; - }); - } - - /** - * {@inheritdoc} - */ - protected function getDefaultFormatter() - { - return new ScalarFormatter(self::DATE_FORMAT); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php deleted file mode 100644 index 8196740..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; -use Monolog\Formatter\ElasticaFormatter; -use Monolog\Logger; -use Elastica\Client; -use Elastica\Exception\ExceptionInterface; - -/** - * Elastic Search handler - * - * Usage example: - * - * $client = new \Elastica\Client(); - * $options = array( - * 'index' => 'elastic_index_name', - * 'type' => 'elastic_doc_type', - * ); - * $handler = new ElasticSearchHandler($client, $options); - * $log = new Logger('application'); - * $log->pushHandler($handler); - * - * @author Jelle Vink - */ -class ElasticSearchHandler extends AbstractProcessingHandler -{ - /** - * @var Client - */ - protected $client; - - /** - * @var array Handler config options - */ - protected $options = array(); - - /** - * @param Client $client Elastica Client object - * @param array $options Handler configuration - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - $this->client = $client; - $this->options = array_merge( - array( - 'index' => 'monolog', // Elastic index name - 'type' => 'record', // Elastic document type - 'ignore_error' => false, // Suppress Elastica exceptions - ), - $options - ); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - $this->bulkSend(array($record['formatted'])); - } - - /** - * {@inheritdoc} - */ - public function setFormatter(FormatterInterface $formatter) - { - if ($formatter instanceof ElasticaFormatter) { - return parent::setFormatter($formatter); - } - throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter'); - } - - /** - * Getter options - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new ElasticaFormatter($this->options['index'], $this->options['type']); - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - $documents = $this->getFormatter()->formatBatch($records); - $this->bulkSend($documents); - } - - /** - * Use Elasticsearch bulk API to send list of documents - * @param array $documents - * @throws \RuntimeException - */ - protected function bulkSend(array $documents) - { - try { - $this->client->addDocuments($documents); - } catch (ExceptionInterface $e) { - if (!$this->options['ignore_error']) { - throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e); - } - } - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php deleted file mode 100644 index 1447a58..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; - -/** - * Stores to PHP error_log() handler. - * - * @author Elan Ruusamäe - */ -class ErrorLogHandler extends AbstractProcessingHandler -{ - const OPERATING_SYSTEM = 0; - const SAPI = 4; - - protected $messageType; - protected $expandNewlines; - - /** - * @param int $messageType Says where the error should go. - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries - */ - public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false) - { - parent::__construct($level, $bubble); - - if (false === in_array($messageType, self::getAvailableTypes())) { - $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true)); - throw new \InvalidArgumentException($message); - } - - $this->messageType = $messageType; - $this->expandNewlines = $expandNewlines; - } - - /** - * @return array With all available types - */ - public static function getAvailableTypes() - { - return array( - self::OPERATING_SYSTEM, - self::SAPI, - ); - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%'); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - if ($this->expandNewlines) { - $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); - foreach ($lines as $line) { - error_log($line, $this->messageType); - } - } else { - error_log((string) $record['formatted'], $this->messageType); - } - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php deleted file mode 100644 index 2a0f7fd..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Simple handler wrapper that filters records based on a list of levels - * - * It can be configured with an exact list of levels to allow, or a min/max level. - * - * @author Hennadiy Verkh - * @author Jordi Boggiano - */ -class FilterHandler extends AbstractHandler -{ - /** - * Handler or factory callable($record, $this) - * - * @var callable|\Monolog\Handler\HandlerInterface - */ - protected $handler; - - /** - * Minimum level for logs that are passed to handler - * - * @var int[] - */ - protected $acceptedLevels; - - /** - * Whether the messages that are handled can bubble up the stack or not - * - * @var Boolean - */ - protected $bubble; - - /** - * @param callable|HandlerInterface $handler Handler or factory callable($record, $this). - * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided - * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true) - { - $this->handler = $handler; - $this->bubble = $bubble; - $this->setAcceptedLevels($minLevelOrList, $maxLevel); - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } - } - - /** - * @return array - */ - public function getAcceptedLevels() - { - return array_flip($this->acceptedLevels); - } - - /** - * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided - * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array - */ - public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY) - { - if (is_array($minLevelOrList)) { - $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); - } else { - $minLevelOrList = Logger::toMonologLevel($minLevelOrList); - $maxLevel = Logger::toMonologLevel($maxLevel); - $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { - return $level >= $minLevelOrList && $level <= $maxLevel; - })); - } - $this->acceptedLevels = array_flip($acceptedLevels); - } - - /** - * {@inheritdoc} - */ - public function isHandling(array $record) - { - return isset($this->acceptedLevels[$record['level']]); - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if (!$this->isHandling($record)) { - return false; - } - - // The same logic as in FingersCrossedHandler - if (!$this->handler instanceof HandlerInterface) { - $this->handler = call_user_func($this->handler, $record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); - } - } - - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - $this->handler->handle($record); - - return false === $this->bubble; - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - $filtered = array(); - foreach ($records as $record) { - if ($this->isHandling($record)) { - $filtered[] = $record; - } - } - - $this->handler->handleBatch($filtered); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php deleted file mode 100644 index c3e42ef..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\FingersCrossed; - -/** - * Interface for activation strategies for the FingersCrossedHandler. - * - * @author Johannes M. Schmitt - */ -interface ActivationStrategyInterface -{ - /** - * Returns whether the given record activates the handler. - * - * @param array $record - * @return Boolean - */ - public function isHandlerActivated(array $record); -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php deleted file mode 100644 index 2a2a64d..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\FingersCrossed; - -use Monolog\Logger; - -/** - * Channel and Error level based monolog activation strategy. Allows to trigger activation - * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except - * for records of the 'sql' channel; those should trigger activation on level 'WARN'. - * - * Example: - * - * - * $activationStrategy = new ChannelLevelActivationStrategy( - * Logger::CRITICAL, - * array( - * 'request' => Logger::ALERT, - * 'sensitive' => Logger::ERROR, - * ) - * ); - * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); - * - * - * @author Mike Meessen - */ -class ChannelLevelActivationStrategy implements ActivationStrategyInterface -{ - private $defaultActionLevel; - private $channelToActionLevel; - - /** - * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any - * @param array $channelToActionLevel An array that maps channel names to action levels. - */ - public function __construct($defaultActionLevel, $channelToActionLevel = array()) - { - $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); - $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); - } - - public function isHandlerActivated(array $record) - { - if (isset($this->channelToActionLevel[$record['channel']])) { - return $record['level'] >= $this->channelToActionLevel[$record['channel']]; - } - - return $record['level'] >= $this->defaultActionLevel; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php deleted file mode 100644 index 6e63085..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\FingersCrossed; - -use Monolog\Logger; - -/** - * Error level based activation strategy. - * - * @author Johannes M. Schmitt - */ -class ErrorLevelActivationStrategy implements ActivationStrategyInterface -{ - private $actionLevel; - - public function __construct($actionLevel) - { - $this->actionLevel = Logger::toMonologLevel($actionLevel); - } - - public function isHandlerActivated(array $record) - { - return $record['level'] >= $this->actionLevel; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php deleted file mode 100644 index d1dcaac..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; -use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; -use Monolog\Logger; - -/** - * Buffers all records until a certain level is reached - * - * The advantage of this approach is that you don't get any clutter in your log files. - * Only requests which actually trigger an error (or whatever your actionLevel is) will be - * in the logs, but they will contain all records, not only those above the level threshold. - * - * You can find the various activation strategies in the - * Monolog\Handler\FingersCrossed\ namespace. - * - * @author Jordi Boggiano - */ -class FingersCrossedHandler extends AbstractHandler -{ - protected $handler; - protected $activationStrategy; - protected $buffering = true; - protected $bufferSize; - protected $buffer = array(); - protected $stopBuffering; - protected $passthruLevel; - - /** - * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). - * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action - * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true) - * @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered - */ - public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null) - { - if (null === $activationStrategy) { - $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); - } - - // convert simple int activationStrategy to an object - if (!$activationStrategy instanceof ActivationStrategyInterface) { - $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy); - } - - $this->handler = $handler; - $this->activationStrategy = $activationStrategy; - $this->bufferSize = $bufferSize; - $this->bubble = $bubble; - $this->stopBuffering = $stopBuffering; - - if ($passthruLevel !== null) { - $this->passthruLevel = Logger::toMonologLevel($passthruLevel); - } - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } - } - - /** - * {@inheritdoc} - */ - public function isHandling(array $record) - { - return true; - } - - /** - * Manually activate this logger regardless of the activation strategy - */ - public function activate() - { - if ($this->stopBuffering) { - $this->buffering = false; - } - if (!$this->handler instanceof HandlerInterface) { - $record = end($this->buffer) ?: null; - - $this->handler = call_user_func($this->handler, $record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); - } - } - $this->handler->handleBatch($this->buffer); - $this->buffer = array(); - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - if ($this->buffering) { - $this->buffer[] = $record; - if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) { - array_shift($this->buffer); - } - if ($this->activationStrategy->isHandlerActivated($record)) { - $this->activate(); - } - } else { - $this->handler->handle($record); - } - - return false === $this->bubble; - } - - /** - * {@inheritdoc} - */ - public function close() - { - if (null !== $this->passthruLevel) { - $level = $this->passthruLevel; - $this->buffer = array_filter($this->buffer, function ($record) use ($level) { - return $record['level'] >= $level; - }); - if (count($this->buffer) > 0) { - $this->handler->handleBatch($this->buffer); - $this->buffer = array(); - } - } - } - - /** - * Resets the state of the handler. Stops forwarding records to the wrapped handler. - */ - public function reset() - { - $this->buffering = true; - } - - /** - * Clears the buffer without flushing any messages down to the wrapped handler. - * - * It also resets the handler to its initial buffering state. - */ - public function clear() - { - $this->buffer = array(); - $this->reset(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php deleted file mode 100644 index fee4795..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +++ /dev/null @@ -1,195 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\WildfireFormatter; - -/** - * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. - * - * @author Eric Clemmons (@ericclemmons) - */ -class FirePHPHandler extends AbstractProcessingHandler -{ - /** - * WildFire JSON header message format - */ - const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'; - - /** - * FirePHP structure for parsing messages & their presentation - */ - const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'; - - /** - * Must reference a "known" plugin, otherwise headers won't display in FirePHP - */ - const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'; - - /** - * Header prefix for Wildfire to recognize & parse headers - */ - const HEADER_PREFIX = 'X-Wf'; - - /** - * Whether or not Wildfire vendor-specific headers have been generated & sent yet - */ - protected static $initialized = false; - - /** - * Shared static message index between potentially multiple handlers - * @var int - */ - protected static $messageIndex = 1; - - protected static $sendHeaders = true; - - /** - * Base header creation function used by init headers & record headers - * - * @param array $meta Wildfire Plugin, Protocol & Structure Indexes - * @param string $message Log message - * @return array Complete header string ready for the client as key and message as value - */ - protected function createHeader(array $meta, $message) - { - $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta)); - - return array($header => $message); - } - - /** - * Creates message header from record - * - * @see createHeader() - * @param array $record - * @return string - */ - protected function createRecordHeader(array $record) - { - // Wildfire is extensible to support multiple protocols & plugins in a single request, - // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. - return $this->createHeader( - array(1, 1, 1, self::$messageIndex++), - $record['formatted'] - ); - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new WildfireFormatter(); - } - - /** - * Wildfire initialization headers to enable message parsing - * - * @see createHeader() - * @see sendHeader() - * @return array - */ - protected function getInitHeaders() - { - // Initial payload consists of required headers for Wildfire - return array_merge( - $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI), - $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI), - $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI) - ); - } - - /** - * Send header string to the client - * - * @param string $header - * @param string $content - */ - protected function sendHeader($header, $content) - { - if (!headers_sent() && self::$sendHeaders) { - header(sprintf('%s: %s', $header, $content)); - } - } - - /** - * Creates & sends header for a record, ensuring init headers have been sent prior - * - * @see sendHeader() - * @see sendInitHeaders() - * @param array $record - */ - protected function write(array $record) - { - if (!self::$sendHeaders) { - return; - } - - // WildFire-specific headers must be sent prior to any messages - if (!self::$initialized) { - self::$initialized = true; - - self::$sendHeaders = $this->headersAccepted(); - if (!self::$sendHeaders) { - return; - } - - foreach ($this->getInitHeaders() as $header => $content) { - $this->sendHeader($header, $content); - } - } - - $header = $this->createRecordHeader($record); - if (trim(current($header)) !== '') { - $this->sendHeader(key($header), current($header)); - } - } - - /** - * Verifies if the headers are accepted by the current user agent - * - * @return Boolean - */ - protected function headersAccepted() - { - if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { - return true; - } - - return isset($_SERVER['HTTP_X_FIREPHP_VERSION']); - } - - /** - * BC getter for the sendHeaders property that has been made static - */ - public function __get($property) - { - if ('sendHeaders' !== $property) { - throw new \InvalidArgumentException('Undefined property '.$property); - } - - return static::$sendHeaders; - } - - /** - * BC setter for the sendHeaders property that has been made static - */ - public function __set($property, $value) - { - if ('sendHeaders' !== $property) { - throw new \InvalidArgumentException('Undefined property '.$property); - } - - static::$sendHeaders = $value; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php deleted file mode 100644 index c43c013..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; - -/** - * Sends logs to Fleep.io using Webhook integrations - * - * You'll need a Fleep.io account to use this handler. - * - * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation - * @author Ando Roots - */ -class FleepHookHandler extends SocketHandler -{ - const FLEEP_HOST = 'fleep.io'; - - const FLEEP_HOOK_URI = '/hook/'; - - /** - * @var string Webhook token (specifies the conversation where logs are sent) - */ - protected $token; - - /** - * Construct a new Fleep.io Handler. - * - * For instructions on how to create a new web hook in your conversations - * see https://fleep.io/integrations/webhooks/ - * - * @param string $token Webhook token - * @param bool|int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @throws MissingExtensionException - */ - public function __construct($token, $level = Logger::DEBUG, $bubble = true) - { - if (!extension_loaded('openssl')) { - throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler'); - } - - $this->token = $token; - - $connectionString = 'ssl://' . self::FLEEP_HOST . ':443'; - parent::__construct($connectionString, $level, $bubble); - } - - /** - * Returns the default formatter to use with this handler - * - * Overloaded to remove empty context and extra arrays from the end of the log message. - * - * @return LineFormatter - */ - protected function getDefaultFormatter() - { - return new LineFormatter(null, null, true, true); - } - - /** - * Handles a log record - * - * @param array $record - */ - public function write(array $record) - { - parent::write($record); - $this->closeSocket(); - } - - /** - * {@inheritdoc} - * - * @param array $record - * @return string - */ - protected function generateDataStream($record) - { - $content = $this->buildContent($record); - - return $this->buildHeader($content) . $content; - } - - /** - * Builds the header of the API Call - * - * @param string $content - * @return string - */ - private function buildHeader($content) - { - $header = "POST " . self::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n"; - $header .= "Host: " . self::FLEEP_HOST . "\r\n"; - $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($content) . "\r\n"; - $header .= "\r\n"; - - return $header; - } - - /** - * Builds the body of API call - * - * @param array $record - * @return string - */ - private function buildContent($record) - { - $dataArray = array( - 'message' => $record['formatted'], - ); - - return http_build_query($dataArray); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php deleted file mode 100644 index dd9a361..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\FlowdockFormatter; -use Monolog\Formatter\FormatterInterface; - -/** - * Sends notifications through the Flowdock push API - * - * This must be configured with a FlowdockFormatter instance via setFormatter() - * - * Notes: - * API token - Flowdock API token - * - * @author Dominik Liebler - * @see https://www.flowdock.com/api/push - */ -class FlowdockHandler extends SocketHandler -{ - /** - * @var string - */ - protected $apiToken; - - /** - * @param string $apiToken - * @param bool|int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * - * @throws MissingExtensionException if OpenSSL is missing - */ - public function __construct($apiToken, $level = Logger::DEBUG, $bubble = true) - { - if (!extension_loaded('openssl')) { - throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler'); - } - - parent::__construct('ssl://api.flowdock.com:443', $level, $bubble); - $this->apiToken = $apiToken; - } - - /** - * {@inheritdoc} - */ - public function setFormatter(FormatterInterface $formatter) - { - if (!$formatter instanceof FlowdockFormatter) { - throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); - } - - return parent::setFormatter($formatter); - } - - /** - * Gets the default formatter. - * - * @return FormatterInterface - */ - protected function getDefaultFormatter() - { - throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); - } - - /** - * {@inheritdoc} - * - * @param array $record - */ - protected function write(array $record) - { - parent::write($record); - - $this->closeSocket(); - } - - /** - * {@inheritdoc} - * - * @param array $record - * @return string - */ - protected function generateDataStream($record) - { - $content = $this->buildContent($record); - - return $this->buildHeader($content) . $content; - } - - /** - * Builds the body of API call - * - * @param array $record - * @return string - */ - private function buildContent($record) - { - return json_encode($record['formatted']['flowdock']); - } - - /** - * Builds the header of the API Call - * - * @param string $content - * @return string - */ - private function buildHeader($content) - { - $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n"; - $header .= "Host: api.flowdock.com\r\n"; - $header .= "Content-Type: application/json\r\n"; - $header .= "Content-Length: " . strlen($content) . "\r\n"; - $header .= "\r\n"; - - return $header; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php deleted file mode 100644 index d3847d8..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\IMessagePublisher; -use Gelf\PublisherInterface; -use Gelf\Publisher; -use InvalidArgumentException; -use Monolog\Logger; -use Monolog\Formatter\GelfMessageFormatter; - -/** - * Handler to send messages to a Graylog2 (http://www.graylog2.org) server - * - * @author Matt Lehner - * @author Benjamin Zikarsky - */ -class GelfHandler extends AbstractProcessingHandler -{ - /** - * @var Publisher the publisher object that sends the message to the server - */ - protected $publisher; - - /** - * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - - if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) { - throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance'); - } - - $this->publisher = $publisher; - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->publisher = null; - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $this->publisher->publish($record['formatted']); - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new GelfMessageFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php deleted file mode 100644 index 663f5a9..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; - -/** - * Forwards records to multiple handlers - * - * @author Lenar Lõhmus - */ -class GroupHandler extends AbstractHandler -{ - protected $handlers; - - /** - * @param array $handlers Array of Handlers. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(array $handlers, $bubble = true) - { - foreach ($handlers as $handler) { - if (!$handler instanceof HandlerInterface) { - throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); - } - } - - $this->handlers = $handlers; - $this->bubble = $bubble; - } - - /** - * {@inheritdoc} - */ - public function isHandling(array $record) - { - foreach ($this->handlers as $handler) { - if ($handler->isHandling($record)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - foreach ($this->handlers as $handler) { - $handler->handle($record); - } - - return false === $this->bubble; - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - if ($this->processors) { - $processed = array(); - foreach ($records as $record) { - foreach ($this->processors as $processor) { - $processed[] = call_user_func($processor, $record); - } - } - $records = $processed; - } - - foreach ($this->handlers as $handler) { - $handler->handleBatch($records); - } - } - - /** - * {@inheritdoc} - */ - public function setFormatter(FormatterInterface $formatter) - { - foreach ($this->handlers as $handler) { - $handler->setFormatter($formatter); - } - - return $this; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php deleted file mode 100644 index d920c4b..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; - -/** - * Interface that all Monolog Handlers must implement - * - * @author Jordi Boggiano - */ -interface HandlerInterface -{ - /** - * Checks whether the given record will be handled by this handler. - * - * This is mostly done for performance reasons, to avoid calling processors for nothing. - * - * Handlers should still check the record levels within handle(), returning false in isHandling() - * is no guarantee that handle() will not be called, and isHandling() might not be called - * for a given record. - * - * @param array $record Partial log record containing only a level key - * - * @return Boolean - */ - public function isHandling(array $record); - - /** - * Handles a record. - * - * All records may be passed to this method, and the handler should discard - * those that it does not want to handle. - * - * The return value of this function controls the bubbling process of the handler stack. - * Unless the bubbling is interrupted (by returning true), the Logger class will keep on - * calling further handlers in the stack with a given log record. - * - * @param array $record The record to handle - * @return Boolean true means that this handler handled the record, and that bubbling is not permitted. - * false means the record was either not processed or that this handler allows bubbling. - */ - public function handle(array $record); - - /** - * Handles a set of records at once. - * - * @param array $records The records to handle (an array of record arrays) - */ - public function handleBatch(array $records); - - /** - * Adds a processor in the stack. - * - * @param callable $callback - * @return self - */ - public function pushProcessor($callback); - - /** - * Removes the processor on top of the stack and returns it. - * - * @return callable - */ - public function popProcessor(); - - /** - * Sets the formatter. - * - * @param FormatterInterface $formatter - * @return self - */ - public function setFormatter(FormatterInterface $formatter); - - /** - * Gets the formatter. - * - * @return FormatterInterface - */ - public function getFormatter(); -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php deleted file mode 100644 index e540d80..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; - -/** - * This simple wrapper class can be used to extend handlers functionality. - * - * Example: A custom filtering that can be applied to any handler. - * - * Inherit from this class and override handle() like this: - * - * public function handle(array $record) - * { - * if ($record meets certain conditions) { - * return false; - * } - * return $this->handler->handle($record); - * } - * - * @author Alexey Karapetov - */ -class HandlerWrapper implements HandlerInterface -{ - /** - * @var HandlerInterface - */ - protected $handler; - - /** - * HandlerWrapper constructor. - * @param HandlerInterface $handler - */ - public function __construct(HandlerInterface $handler) - { - $this->handler = $handler; - } - - /** - * {@inheritdoc} - */ - public function isHandling(array $record) - { - return $this->handler->isHandling($record); - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - return $this->handler->handle($record); - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - return $this->handler->handleBatch($records); - } - - /** - * {@inheritdoc} - */ - public function pushProcessor($callback) - { - $this->handler->pushProcessor($callback); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function popProcessor() - { - return $this->handler->popProcessor(); - } - - /** - * {@inheritdoc} - */ - public function setFormatter(FormatterInterface $formatter) - { - $this->handler->setFormatter($formatter); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getFormatter() - { - return $this->handler->getFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php deleted file mode 100644 index 73049f3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +++ /dev/null @@ -1,350 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Sends notifications through the hipchat api to a hipchat room - * - * Notes: - * API token - HipChat API token - * Room - HipChat Room Id or name, where messages are sent - * Name - Name used to send the message (from) - * notify - Should the message trigger a notification in the clients - * version - The API version to use (HipChatHandler::API_V1 | HipChatHandler::API_V2) - * - * @author Rafael Dohms - * @see https://www.hipchat.com/docs/api - */ -class HipChatHandler extends SocketHandler -{ - /** - * Use API version 1 - */ - const API_V1 = 'v1'; - - /** - * Use API version v2 - */ - const API_V2 = 'v2'; - - /** - * The maximum allowed length for the name used in the "from" field. - */ - const MAXIMUM_NAME_LENGTH = 15; - - /** - * The maximum allowed length for the message. - */ - const MAXIMUM_MESSAGE_LENGTH = 9500; - - /** - * @var string - */ - private $token; - - /** - * @var string - */ - private $room; - - /** - * @var string - */ - private $name; - - /** - * @var bool - */ - private $notify; - - /** - * @var string - */ - private $format; - - /** - * @var string - */ - private $host; - - /** - * @var string - */ - private $version; - - /** - * @param string $token HipChat API Token - * @param string $room The room that should be alerted of the message (Id or Name) - * @param string $name Name used in the "from" field. - * @param bool $notify Trigger a notification in clients or not - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useSSL Whether to connect via SSL. - * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) - * @param string $host The HipChat server hostname. - * @param string $version The HipChat API version (default HipChatHandler::API_V1) - */ - public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) - { - if ($version == self::API_V1 && !$this->validateStringLength($name, static::MAXIMUM_NAME_LENGTH)) { - throw new \InvalidArgumentException('The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.'); - } - - $connectionString = $useSSL ? 'ssl://'.$host.':443' : $host.':80'; - parent::__construct($connectionString, $level, $bubble); - - $this->token = $token; - $this->name = $name; - $this->notify = $notify; - $this->room = $room; - $this->format = $format; - $this->host = $host; - $this->version = $version; - } - - /** - * {@inheritdoc} - * - * @param array $record - * @return string - */ - protected function generateDataStream($record) - { - $content = $this->buildContent($record); - - return $this->buildHeader($content) . $content; - } - - /** - * Builds the body of API call - * - * @param array $record - * @return string - */ - private function buildContent($record) - { - $dataArray = array( - 'notify' => $this->version == self::API_V1 ? - ($this->notify ? 1 : 0) : - ($this->notify ? 'true' : 'false'), - 'message' => $record['formatted'], - 'message_format' => $this->format, - 'color' => $this->getAlertColor($record['level']), - ); - - if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) { - if (function_exists('mb_substr')) { - $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; - } else { - $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; - } - } - - // if we are using the legacy API then we need to send some additional information - if ($this->version == self::API_V1) { - $dataArray['room_id'] = $this->room; - } - - // append the sender name if it is set - // always append it if we use the v1 api (it is required in v1) - if ($this->version == self::API_V1 || $this->name !== null) { - $dataArray['from'] = (string) $this->name; - } - - return http_build_query($dataArray); - } - - /** - * Builds the header of the API Call - * - * @param string $content - * @return string - */ - private function buildHeader($content) - { - if ($this->version == self::API_V1) { - $header = "POST /v1/rooms/message?format=json&auth_token={$this->token} HTTP/1.1\r\n"; - } else { - // needed for rooms with special (spaces, etc) characters in the name - $room = rawurlencode($this->room); - $header = "POST /v2/room/{$room}/notification?auth_token={$this->token} HTTP/1.1\r\n"; - } - - $header .= "Host: {$this->host}\r\n"; - $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($content) . "\r\n"; - $header .= "\r\n"; - - return $header; - } - - /** - * Assigns a color to each level of log records. - * - * @param int $level - * @return string - */ - protected function getAlertColor($level) - { - switch (true) { - case $level >= Logger::ERROR: - return 'red'; - case $level >= Logger::WARNING: - return 'yellow'; - case $level >= Logger::INFO: - return 'green'; - case $level == Logger::DEBUG: - return 'gray'; - default: - return 'yellow'; - } - } - - /** - * {@inheritdoc} - * - * @param array $record - */ - protected function write(array $record) - { - parent::write($record); - $this->closeSocket(); - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - if (count($records) == 0) { - return true; - } - - $batchRecords = $this->combineRecords($records); - - $handled = false; - foreach ($batchRecords as $batchRecord) { - if ($this->isHandling($batchRecord)) { - $this->write($batchRecord); - $handled = true; - } - } - - if (!$handled) { - return false; - } - - return false === $this->bubble; - } - - /** - * Combines multiple records into one. Error level of the combined record - * will be the highest level from the given records. Datetime will be taken - * from the first record. - * - * @param $records - * @return array - */ - private function combineRecords($records) - { - $batchRecord = null; - $batchRecords = array(); - $messages = array(); - $formattedMessages = array(); - $level = 0; - $levelName = null; - $datetime = null; - - foreach ($records as $record) { - $record = $this->processRecord($record); - - if ($record['level'] > $level) { - $level = $record['level']; - $levelName = $record['level_name']; - } - - if (null === $datetime) { - $datetime = $record['datetime']; - } - - $messages[] = $record['message']; - $messageStr = implode(PHP_EOL, $messages); - $formattedMessages[] = $this->getFormatter()->format($record); - $formattedMessageStr = implode('', $formattedMessages); - - $batchRecord = array( - 'message' => $messageStr, - 'formatted' => $formattedMessageStr, - 'context' => array(), - 'extra' => array(), - ); - - if (!$this->validateStringLength($batchRecord['formatted'], static::MAXIMUM_MESSAGE_LENGTH)) { - // Pop the last message and implode the remaining messages - $lastMessage = array_pop($messages); - $lastFormattedMessage = array_pop($formattedMessages); - $batchRecord['message'] = implode(PHP_EOL, $messages); - $batchRecord['formatted'] = implode('', $formattedMessages); - - $batchRecords[] = $batchRecord; - $messages = array($lastMessage); - $formattedMessages = array($lastFormattedMessage); - - $batchRecord = null; - } - } - - if (null !== $batchRecord) { - $batchRecords[] = $batchRecord; - } - - // Set the max level and datetime for all records - foreach ($batchRecords as &$batchRecord) { - $batchRecord = array_merge( - $batchRecord, - array( - 'level' => $level, - 'level_name' => $levelName, - 'datetime' => $datetime, - ) - ); - } - - return $batchRecords; - } - - /** - * Validates the length of a string. - * - * If the `mb_strlen()` function is available, it will use that, as HipChat - * allows UTF-8 characters. Otherwise, it will fall back to `strlen()`. - * - * Note that this might cause false failures in the specific case of using - * a valid name with less than 16 characters, but 16 or more bytes, on a - * system where `mb_strlen()` is unavailable. - * - * @param string $str - * @param int $length - * - * @return bool - */ - private function validateStringLength($str, $length) - { - if (function_exists('mb_strlen')) { - return (mb_strlen($str) <= $length); - } - - return (strlen($str) <= $length); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php deleted file mode 100644 index d60a3c8..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * IFTTTHandler uses cURL to trigger IFTTT Maker actions - * - * Register a secret key and trigger/event name at https://ifttt.com/maker - * - * value1 will be the channel from monolog's Logger constructor, - * value2 will be the level name (ERROR, WARNING, ..) - * value3 will be the log record's message - * - * @author Nehal Patel - */ -class IFTTTHandler extends AbstractProcessingHandler -{ - private $eventName; - private $secretKey; - - /** - * @param string $eventName The name of the IFTTT Maker event that should be triggered - * @param string $secretKey A valid IFTTT secret key - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) - { - $this->eventName = $eventName; - $this->secretKey = $secretKey; - - parent::__construct($level, $bubble); - } - - /** - * {@inheritdoc} - */ - public function write(array $record) - { - $postData = array( - "value1" => $record["channel"], - "value2" => $record["level_name"], - "value3" => $record["message"], - ); - $postString = json_encode($postData); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "Content-Type: application/json", - )); - - Curl\Util::execute($ch); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php deleted file mode 100644 index 494c605..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * @author Robert Kaufmann III - */ -class LogEntriesHandler extends SocketHandler -{ - /** - * @var string - */ - protected $logToken; - - /** - * @param string $token Log token supplied by LogEntries - * @param bool $useSSL Whether or not SSL encryption should be used. - * @param int $level The minimum logging level to trigger this handler - * @param bool $bubble Whether or not messages that are handled should bubble up the stack. - * - * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing - */ - public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true) - { - if ($useSSL && !extension_loaded('openssl')) { - throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); - } - - $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80'; - parent::__construct($endpoint, $level, $bubble); - $this->logToken = $token; - } - - /** - * {@inheritdoc} - * - * @param array $record - * @return string - */ - protected function generateDataStream($record) - { - return $this->logToken . ' ' . $record['formatted']; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php deleted file mode 100644 index bcd62e1..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\LogglyFormatter; - -/** - * Sends errors to Loggly. - * - * @author Przemek Sobstel - * @author Adam Pancutt - * @author Gregory Barchard - */ -class LogglyHandler extends AbstractProcessingHandler -{ - const HOST = 'logs-01.loggly.com'; - const ENDPOINT_SINGLE = 'inputs'; - const ENDPOINT_BATCH = 'bulk'; - - protected $token; - - protected $tag = array(); - - public function __construct($token, $level = Logger::DEBUG, $bubble = true) - { - if (!extension_loaded('curl')) { - throw new \LogicException('The curl extension is needed to use the LogglyHandler'); - } - - $this->token = $token; - - parent::__construct($level, $bubble); - } - - public function setTag($tag) - { - $tag = !empty($tag) ? $tag : array(); - $this->tag = is_array($tag) ? $tag : array($tag); - } - - public function addTag($tag) - { - if (!empty($tag)) { - $tag = is_array($tag) ? $tag : array($tag); - $this->tag = array_unique(array_merge($this->tag, $tag)); - } - } - - protected function write(array $record) - { - $this->send($record["formatted"], self::ENDPOINT_SINGLE); - } - - public function handleBatch(array $records) - { - $level = $this->level; - - $records = array_filter($records, function ($record) use ($level) { - return ($record['level'] >= $level); - }); - - if ($records) { - $this->send($this->getFormatter()->formatBatch($records), self::ENDPOINT_BATCH); - } - } - - protected function send($data, $endpoint) - { - $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token); - - $headers = array('Content-Type: application/json'); - - if (!empty($this->tag)) { - $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); - } - - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - - Curl\Util::execute($ch); - } - - protected function getDefaultFormatter() - { - return new LogglyFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php deleted file mode 100644 index 9e23283..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Base class for all mail handlers - * - * @author Gyula Sallai - */ -abstract class MailHandler extends AbstractProcessingHandler -{ - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - $messages = array(); - - foreach ($records as $record) { - if ($record['level'] < $this->level) { - continue; - } - $messages[] = $this->processRecord($record); - } - - if (!empty($messages)) { - $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); - } - } - - /** - * Send a mail with the given content - * - * @param string $content formatted email body to be sent - * @param array $records the array of log records that formed this content - */ - abstract protected function send($content, array $records); - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $this->send((string) $record['formatted'], array($record)); - } - - protected function getHighestRecord(array $records) - { - $highestRecord = null; - foreach ($records as $record) { - if ($highestRecord === null || $highestRecord['level'] < $record['level']) { - $highestRecord = $record; - } - } - - return $highestRecord; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php deleted file mode 100644 index ab95924..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * MandrillHandler uses cURL to send the emails to the Mandrill API - * - * @author Adam Nicholson - */ -class MandrillHandler extends MailHandler -{ - protected $message; - protected $apiKey; - - /** - * @param string $apiKey A valid Mandrill API key - * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) - { - parent::__construct($level, $bubble); - - if (!$message instanceof \Swift_Message && is_callable($message)) { - $message = call_user_func($message); - } - if (!$message instanceof \Swift_Message) { - throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); - } - $this->message = $message; - $this->apiKey = $apiKey; - } - - /** - * {@inheritdoc} - */ - protected function send($content, array $records) - { - $message = clone $this->message; - $message->setBody($content); - $message->setDate(time()); - - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( - 'key' => $this->apiKey, - 'raw_message' => (string) $message, - 'async' => false, - ))); - - Curl\Util::execute($ch); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php deleted file mode 100644 index 4724a7e..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Exception can be thrown if an extension for an handler is missing - * - * @author Christian Bergau - */ -class MissingExtensionException extends \Exception -{ -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php deleted file mode 100644 index 56fe755..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\NormalizerFormatter; - -/** - * Logs to a MongoDB database. - * - * usage example: - * - * $log = new Logger('application'); - * $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod"); - * $log->pushHandler($mongodb); - * - * @author Thomas Tourlourat - */ -class MongoDBHandler extends AbstractProcessingHandler -{ - protected $mongoCollection; - - public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true) - { - if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) { - throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required'); - } - - $this->mongoCollection = $mongo->selectCollection($database, $collection); - - parent::__construct($level, $bubble); - } - - protected function write(array $record) - { - if ($this->mongoCollection instanceof \MongoDB\Collection) { - $this->mongoCollection->insertOne($record["formatted"]); - } else { - $this->mongoCollection->save($record["formatted"]); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new NormalizerFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php deleted file mode 100644 index d7807fd..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -/** - * NativeMailerHandler uses the mail() function to send the emails - * - * @author Christophe Coevoet - * @author Mark Garrett - */ -class NativeMailerHandler extends MailHandler -{ - /** - * The email addresses to which the message will be sent - * @var array - */ - protected $to; - - /** - * The subject of the email - * @var string - */ - protected $subject; - - /** - * Optional headers for the message - * @var array - */ - protected $headers = array(); - - /** - * Optional parameters for the message - * @var array - */ - protected $parameters = array(); - - /** - * The wordwrap length for the message - * @var int - */ - protected $maxColumnWidth; - - /** - * The Content-type for the message - * @var string - */ - protected $contentType = 'text/plain'; - - /** - * The encoding for the message - * @var string - */ - protected $encoding = 'utf-8'; - - /** - * @param string|array $to The receiver of the mail - * @param string $subject The subject of the mail - * @param string $from The sender of the mail - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param int $maxColumnWidth The maximum column width that the message lines will have - */ - public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) - { - parent::__construct($level, $bubble); - $this->to = is_array($to) ? $to : array($to); - $this->subject = $subject; - $this->addHeader(sprintf('From: %s', $from)); - $this->maxColumnWidth = $maxColumnWidth; - } - - /** - * Add headers to the message - * - * @param string|array $headers Custom added headers - * @return self - */ - public function addHeader($headers) - { - foreach ((array) $headers as $header) { - if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) { - throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons'); - } - $this->headers[] = $header; - } - - return $this; - } - - /** - * Add parameters to the message - * - * @param string|array $parameters Custom added parameters - * @return self - */ - public function addParameter($parameters) - { - $this->parameters = array_merge($this->parameters, (array) $parameters); - - return $this; - } - - /** - * {@inheritdoc} - */ - protected function send($content, array $records) - { - $content = wordwrap($content, $this->maxColumnWidth); - $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n"); - $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n"; - if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { - $headers .= 'MIME-Version: 1.0' . "\r\n"; - } - - $subject = $this->subject; - if ($records) { - $subjectFormatter = new LineFormatter($this->subject); - $subject = $subjectFormatter->format($this->getHighestRecord($records)); - } - - $parameters = implode(' ', $this->parameters); - foreach ($this->to as $to) { - mail($to, $subject, $content, $headers, $parameters); - } - } - - /** - * @return string $contentType - */ - public function getContentType() - { - return $this->contentType; - } - - /** - * @return string $encoding - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML - * messages. - * @return self - */ - public function setContentType($contentType) - { - if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) { - throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection'); - } - - $this->contentType = $contentType; - - return $this; - } - - /** - * @param string $encoding - * @return self - */ - public function setEncoding($encoding) - { - if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) { - throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection'); - } - - $this->encoding = $encoding; - - return $this; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php deleted file mode 100644 index 6718e9e..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\NormalizerFormatter; - -/** - * Class to record a log on a NewRelic application. - * Enabling New Relic High Security mode may prevent capture of useful information. - * - * @see https://docs.newrelic.com/docs/agents/php-agent - * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security - */ -class NewRelicHandler extends AbstractProcessingHandler -{ - /** - * Name of the New Relic application that will receive logs from this handler. - * - * @var string - */ - protected $appName; - - /** - * Name of the current transaction - * - * @var string - */ - protected $transactionName; - - /** - * Some context and extra data is passed into the handler as arrays of values. Do we send them as is - * (useful if we are using the API), or explode them for display on the NewRelic RPM website? - * - * @var bool - */ - protected $explodeArrays; - - /** - * {@inheritDoc} - * - * @param string $appName - * @param bool $explodeArrays - * @param string $transactionName - */ - public function __construct( - $level = Logger::ERROR, - $bubble = true, - $appName = null, - $explodeArrays = false, - $transactionName = null - ) { - parent::__construct($level, $bubble); - - $this->appName = $appName; - $this->explodeArrays = $explodeArrays; - $this->transactionName = $transactionName; - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - if (!$this->isNewRelicEnabled()) { - throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); - } - - if ($appName = $this->getAppName($record['context'])) { - $this->setNewRelicAppName($appName); - } - - if ($transactionName = $this->getTransactionName($record['context'])) { - $this->setNewRelicTransactionName($transactionName); - unset($record['formatted']['context']['transaction_name']); - } - - if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) { - newrelic_notice_error($record['message'], $record['context']['exception']); - unset($record['formatted']['context']['exception']); - } else { - newrelic_notice_error($record['message']); - } - - if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { - foreach ($record['formatted']['context'] as $key => $parameter) { - if (is_array($parameter) && $this->explodeArrays) { - foreach ($parameter as $paramKey => $paramValue) { - $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); - } - } else { - $this->setNewRelicParameter('context_' . $key, $parameter); - } - } - } - - if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { - foreach ($record['formatted']['extra'] as $key => $parameter) { - if (is_array($parameter) && $this->explodeArrays) { - foreach ($parameter as $paramKey => $paramValue) { - $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); - } - } else { - $this->setNewRelicParameter('extra_' . $key, $parameter); - } - } - } - } - - /** - * Checks whether the NewRelic extension is enabled in the system. - * - * @return bool - */ - protected function isNewRelicEnabled() - { - return extension_loaded('newrelic'); - } - - /** - * Returns the appname where this log should be sent. Each log can override the default appname, set in this - * handler's constructor, by providing the appname in it's context. - * - * @param array $context - * @return null|string - */ - protected function getAppName(array $context) - { - if (isset($context['appname'])) { - return $context['appname']; - } - - return $this->appName; - } - - /** - * Returns the name of the current transaction. Each log can override the default transaction name, set in this - * handler's constructor, by providing the transaction_name in it's context - * - * @param array $context - * - * @return null|string - */ - protected function getTransactionName(array $context) - { - if (isset($context['transaction_name'])) { - return $context['transaction_name']; - } - - return $this->transactionName; - } - - /** - * Sets the NewRelic application that should receive this log. - * - * @param string $appName - */ - protected function setNewRelicAppName($appName) - { - newrelic_set_appname($appName); - } - - /** - * Overwrites the name of the current transaction - * - * @param string $transactionName - */ - protected function setNewRelicTransactionName($transactionName) - { - newrelic_name_transaction($transactionName); - } - - /** - * @param string $key - * @param mixed $value - */ - protected function setNewRelicParameter($key, $value) - { - if (null === $value || is_scalar($value)) { - newrelic_add_custom_parameter($key, $value); - } else { - newrelic_add_custom_parameter($key, @json_encode($value)); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new NormalizerFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php deleted file mode 100644 index 4b84588..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Blackhole - * - * Any record it can handle will be thrown away. This can be used - * to put on top of an existing stack to override it temporarily. - * - * @author Jordi Boggiano - */ -class NullHandler extends AbstractHandler -{ - /** - * @param int $level The minimum logging level at which this handler will be triggered - */ - public function __construct($level = Logger::DEBUG) - { - parent::__construct($level, false); - } - - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if ($record['level'] < $this->level) { - return false; - } - - return true; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php deleted file mode 100644 index 1f2076a..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +++ /dev/null @@ -1,242 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Exception; -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; -use PhpConsole\Connector; -use PhpConsole\Handler; -use PhpConsole\Helper; - -/** - * Monolog handler for Google Chrome extension "PHP Console" - * - * Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely - * - * Usage: - * 1. Install Google Chrome extension https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef - * 2. See overview https://github.com/barbushin/php-console#overview - * 3. Install PHP Console library https://github.com/barbushin/php-console#installation - * 4. Example (result will looks like http://i.hizliresim.com/vg3Pz4.png) - * - * $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler())); - * \Monolog\ErrorHandler::register($logger); - * echo $undefinedVar; - * $logger->addDebug('SELECT * FROM users', array('db', 'time' => 0.012)); - * PC::debug($_SERVER); // PHP Console debugger for any type of vars - * - * @author Sergey Barbushin https://www.linkedin.com/in/barbushin - */ -class PHPConsoleHandler extends AbstractProcessingHandler -{ - private $options = array( - 'enabled' => true, // bool Is PHP Console server enabled - 'classesPartialsTraceIgnore' => array('Monolog\\'), // array Hide calls of classes started with... - 'debugTagsKeysInContext' => array(0, 'tag'), // bool Is PHP Console server enabled - 'useOwnErrorsHandler' => false, // bool Enable errors handling - 'useOwnExceptionsHandler' => false, // bool Enable exceptions handling - 'sourcesBasePath' => null, // string Base path of all project sources to strip in errors source paths - 'registerHelper' => true, // bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s') - 'serverEncoding' => null, // string|null Server internal encoding - 'headersLimit' => null, // int|null Set headers size limit for your web-server - 'password' => null, // string|null Protect PHP Console connection by password - 'enableSslOnlyMode' => false, // bool Force connection by SSL for clients with PHP Console installed - 'ipMasks' => array(), // array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1') - 'enableEvalListener' => false, // bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required) - 'dumperDetectCallbacks' => false, // bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings - 'dumperLevelLimit' => 5, // int Maximum dumped vars array or object nested dump level - 'dumperItemsCountLimit' => 100, // int Maximum dumped var same level array items or object properties number - 'dumperItemSizeLimit' => 5000, // int Maximum length of any string or dumped array item - 'dumperDumpSizeLimit' => 500000, // int Maximum approximate size of dumped vars result formatted in JSON - 'detectDumpTraceAndSource' => false, // bool Autodetect and append trace data to debug - 'dataStorage' => null, // PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) - ); - - /** @var Connector */ - private $connector; - - /** - * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details - * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) - * @param int $level - * @param bool $bubble - * @throws Exception - */ - public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) - { - if (!class_exists('PhpConsole\Connector')) { - throw new Exception('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); - } - parent::__construct($level, $bubble); - $this->options = $this->initOptions($options); - $this->connector = $this->initConnector($connector); - } - - private function initOptions(array $options) - { - $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); - if ($wrongOptions) { - throw new Exception('Unknown options: ' . implode(', ', $wrongOptions)); - } - - return array_replace($this->options, $options); - } - - private function initConnector(Connector $connector = null) - { - if (!$connector) { - if ($this->options['dataStorage']) { - Connector::setPostponeStorage($this->options['dataStorage']); - } - $connector = Connector::getInstance(); - } - - if ($this->options['registerHelper'] && !Helper::isRegistered()) { - Helper::register(); - } - - if ($this->options['enabled'] && $connector->isActiveClient()) { - if ($this->options['useOwnErrorsHandler'] || $this->options['useOwnExceptionsHandler']) { - $handler = Handler::getInstance(); - $handler->setHandleErrors($this->options['useOwnErrorsHandler']); - $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); - $handler->start(); - } - if ($this->options['sourcesBasePath']) { - $connector->setSourcesBasePath($this->options['sourcesBasePath']); - } - if ($this->options['serverEncoding']) { - $connector->setServerEncoding($this->options['serverEncoding']); - } - if ($this->options['password']) { - $connector->setPassword($this->options['password']); - } - if ($this->options['enableSslOnlyMode']) { - $connector->enableSslOnlyMode(); - } - if ($this->options['ipMasks']) { - $connector->setAllowedIpMasks($this->options['ipMasks']); - } - if ($this->options['headersLimit']) { - $connector->setHeadersLimit($this->options['headersLimit']); - } - if ($this->options['detectDumpTraceAndSource']) { - $connector->getDebugDispatcher()->detectTraceAndSource = true; - } - $dumper = $connector->getDumper(); - $dumper->levelLimit = $this->options['dumperLevelLimit']; - $dumper->itemsCountLimit = $this->options['dumperItemsCountLimit']; - $dumper->itemSizeLimit = $this->options['dumperItemSizeLimit']; - $dumper->dumpSizeLimit = $this->options['dumperDumpSizeLimit']; - $dumper->detectCallbacks = $this->options['dumperDetectCallbacks']; - if ($this->options['enableEvalListener']) { - $connector->startEvalRequestsListener(); - } - } - - return $connector; - } - - public function getConnector() - { - return $this->connector; - } - - public function getOptions() - { - return $this->options; - } - - public function handle(array $record) - { - if ($this->options['enabled'] && $this->connector->isActiveClient()) { - return parent::handle($record); - } - - return !$this->bubble; - } - - /** - * Writes the record down to the log of the implementing handler - * - * @param array $record - * @return void - */ - protected function write(array $record) - { - if ($record['level'] < Logger::NOTICE) { - $this->handleDebugRecord($record); - } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) { - $this->handleExceptionRecord($record); - } else { - $this->handleErrorRecord($record); - } - } - - private function handleDebugRecord(array $record) - { - $tags = $this->getRecordTags($record); - $message = $record['message']; - if ($record['context']) { - $message .= ' ' . json_encode($this->connector->getDumper()->dump(array_filter($record['context']))); - } - $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); - } - - private function handleExceptionRecord(array $record) - { - $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); - } - - private function handleErrorRecord(array $record) - { - $context = $record['context']; - - $this->connector->getErrorsDispatcher()->dispatchError( - isset($context['code']) ? $context['code'] : null, - isset($context['message']) ? $context['message'] : $record['message'], - isset($context['file']) ? $context['file'] : null, - isset($context['line']) ? $context['line'] : null, - $this->options['classesPartialsTraceIgnore'] - ); - } - - private function getRecordTags(array &$record) - { - $tags = null; - if (!empty($record['context'])) { - $context = & $record['context']; - foreach ($this->options['debugTagsKeysInContext'] as $key) { - if (!empty($context[$key])) { - $tags = $context[$key]; - if ($key === 0) { - array_shift($context); - } else { - unset($context[$key]); - } - break; - } - } - } - - return $tags ?: strtolower($record['level_name']); - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new LineFormatter('%message%'); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php deleted file mode 100644 index 1ae8584..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Psr\Log\LoggerInterface; - -/** - * Proxies log messages to an existing PSR-3 compliant logger. - * - * @author Michael Moussa - */ -class PsrHandler extends AbstractHandler -{ - /** - * PSR-3 compliant logger - * - * @var LoggerInterface - */ - protected $logger; - - /** - * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - - $this->logger = $logger; - } - - /** - * {@inheritDoc} - */ - public function handle(array $record) - { - if (!$this->isHandling($record)) { - return false; - } - - $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); - - return false === $this->bubble; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php deleted file mode 100644 index bba7200..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Sends notifications through the pushover api to mobile phones - * - * @author Sebastian Göttschkes - * @see https://www.pushover.net/api - */ -class PushoverHandler extends SocketHandler -{ - private $token; - private $users; - private $title; - private $user; - private $retry; - private $expire; - - private $highPriorityLevel; - private $emergencyLevel; - private $useFormattedMessage = false; - - /** - * All parameters that can be sent to Pushover - * @see https://pushover.net/api - * @var array - */ - private $parameterNames = array( - 'token' => true, - 'user' => true, - 'message' => true, - 'device' => true, - 'title' => true, - 'url' => true, - 'url_title' => true, - 'priority' => true, - 'timestamp' => true, - 'sound' => true, - 'retry' => true, - 'expire' => true, - 'callback' => true, - ); - - /** - * Sounds the api supports by default - * @see https://pushover.net/api#sounds - * @var array - */ - private $sounds = array( - 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', - 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', - 'persistent', 'echo', 'updown', 'none', - ); - - /** - * @param string $token Pushover api token - * @param string|array $users Pushover user id or array of ids the message will be sent to - * @param string $title Title sent to the Pushover API - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not - * the pushover.net app owner. OpenSSL is required for this option. - * @param int $highPriorityLevel The minimum logging level at which this handler will start - * sending "high priority" requests to the Pushover API - * @param int $emergencyLevel The minimum logging level at which this handler will start - * sending "emergency" requests to the Pushover API - * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. - * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). - */ - public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) - { - $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80'; - parent::__construct($connectionString, $level, $bubble); - - $this->token = $token; - $this->users = (array) $users; - $this->title = $title ?: gethostname(); - $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); - $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); - $this->retry = $retry; - $this->expire = $expire; - } - - protected function generateDataStream($record) - { - $content = $this->buildContent($record); - - return $this->buildHeader($content) . $content; - } - - private function buildContent($record) - { - // Pushover has a limit of 512 characters on title and message combined. - $maxMessageLength = 512 - strlen($this->title); - - $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; - $message = substr($message, 0, $maxMessageLength); - - $timestamp = $record['datetime']->getTimestamp(); - - $dataArray = array( - 'token' => $this->token, - 'user' => $this->user, - 'message' => $message, - 'title' => $this->title, - 'timestamp' => $timestamp, - ); - - if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { - $dataArray['priority'] = 2; - $dataArray['retry'] = $this->retry; - $dataArray['expire'] = $this->expire; - } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { - $dataArray['priority'] = 1; - } - - // First determine the available parameters - $context = array_intersect_key($record['context'], $this->parameterNames); - $extra = array_intersect_key($record['extra'], $this->parameterNames); - - // Least important info should be merged with subsequent info - $dataArray = array_merge($extra, $context, $dataArray); - - // Only pass sounds that are supported by the API - if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { - unset($dataArray['sound']); - } - - return http_build_query($dataArray); - } - - private function buildHeader($content) - { - $header = "POST /1/messages.json HTTP/1.1\r\n"; - $header .= "Host: api.pushover.net\r\n"; - $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($content) . "\r\n"; - $header .= "\r\n"; - - return $header; - } - - protected function write(array $record) - { - foreach ($this->users as $user) { - $this->user = $user; - - parent::write($record); - $this->closeSocket(); - } - - $this->user = null; - } - - public function setHighPriorityLevel($value) - { - $this->highPriorityLevel = $value; - } - - public function setEmergencyLevel($value) - { - $this->emergencyLevel = $value; - } - - /** - * Use the formatted message? - * @param bool $value - */ - public function useFormattedMessage($value) - { - $this->useFormattedMessage = (boolean) $value; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php deleted file mode 100644 index 53a8b39..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +++ /dev/null @@ -1,232 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; -use Raven_Client; - -/** - * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server - * using raven-php (https://github.com/getsentry/raven-php) - * - * @author Marc Abramowitz - */ -class RavenHandler extends AbstractProcessingHandler -{ - /** - * Translates Monolog log levels to Raven log levels. - */ - private $logLevels = array( - Logger::DEBUG => Raven_Client::DEBUG, - Logger::INFO => Raven_Client::INFO, - Logger::NOTICE => Raven_Client::INFO, - Logger::WARNING => Raven_Client::WARNING, - Logger::ERROR => Raven_Client::ERROR, - Logger::CRITICAL => Raven_Client::FATAL, - Logger::ALERT => Raven_Client::FATAL, - Logger::EMERGENCY => Raven_Client::FATAL, - ); - - /** - * @var string should represent the current version of the calling - * software. Can be any string (git commit, version number) - */ - private $release; - - /** - * @var Raven_Client the client object that sends the message to the server - */ - protected $ravenClient; - - /** - * @var LineFormatter The formatter to use for the logs generated via handleBatch() - */ - protected $batchFormatter; - - /** - * @param Raven_Client $ravenClient - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - - $this->ravenClient = $ravenClient; - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - $level = $this->level; - - // filter records based on their level - $records = array_filter($records, function ($record) use ($level) { - return $record['level'] >= $level; - }); - - if (!$records) { - return; - } - - // the record with the highest severity is the "main" one - $record = array_reduce($records, function ($highest, $record) { - if ($record['level'] > $highest['level']) { - return $record; - } - - return $highest; - }); - - // the other ones are added as a context item - $logs = array(); - foreach ($records as $r) { - $logs[] = $this->processRecord($r); - } - - if ($logs) { - $record['context']['logs'] = (string) $this->getBatchFormatter()->formatBatch($logs); - } - - $this->handle($record); - } - - /** - * Sets the formatter for the logs generated by handleBatch(). - * - * @param FormatterInterface $formatter - */ - public function setBatchFormatter(FormatterInterface $formatter) - { - $this->batchFormatter = $formatter; - } - - /** - * Gets the formatter for the logs generated by handleBatch(). - * - * @return FormatterInterface - */ - public function getBatchFormatter() - { - if (!$this->batchFormatter) { - $this->batchFormatter = $this->getDefaultBatchFormatter(); - } - - return $this->batchFormatter; - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $previousUserContext = false; - $options = array(); - $options['level'] = $this->logLevels[$record['level']]; - $options['tags'] = array(); - if (!empty($record['extra']['tags'])) { - $options['tags'] = array_merge($options['tags'], $record['extra']['tags']); - unset($record['extra']['tags']); - } - if (!empty($record['context']['tags'])) { - $options['tags'] = array_merge($options['tags'], $record['context']['tags']); - unset($record['context']['tags']); - } - if (!empty($record['context']['fingerprint'])) { - $options['fingerprint'] = $record['context']['fingerprint']; - unset($record['context']['fingerprint']); - } - if (!empty($record['context']['logger'])) { - $options['logger'] = $record['context']['logger']; - unset($record['context']['logger']); - } else { - $options['logger'] = $record['channel']; - } - foreach ($this->getExtraParameters() as $key) { - foreach (array('extra', 'context') as $source) { - if (!empty($record[$source][$key])) { - $options[$key] = $record[$source][$key]; - unset($record[$source][$key]); - } - } - } - if (!empty($record['context'])) { - $options['extra']['context'] = $record['context']; - if (!empty($record['context']['user'])) { - $previousUserContext = $this->ravenClient->context->user; - $this->ravenClient->user_context($record['context']['user']); - unset($options['extra']['context']['user']); - } - } - if (!empty($record['extra'])) { - $options['extra']['extra'] = $record['extra']; - } - - if (!empty($this->release) && !isset($options['release'])) { - $options['release'] = $this->release; - } - - if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { - $options['extra']['message'] = $record['formatted']; - $this->ravenClient->captureException($record['context']['exception'], $options); - } else { - $this->ravenClient->captureMessage($record['formatted'], array(), $options); - } - - if ($previousUserContext !== false) { - $this->ravenClient->user_context($previousUserContext); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new LineFormatter('[%channel%] %message%'); - } - - /** - * Gets the default formatter for the logs generated by handleBatch(). - * - * @return FormatterInterface - */ - protected function getDefaultBatchFormatter() - { - return new LineFormatter(); - } - - /** - * Gets extra parameters supported by Raven that can be found in "extra" and "context" - * - * @return array - */ - protected function getExtraParameters() - { - return array('checksum', 'release', 'event_id'); - } - - /** - * @param string $value - * @return self - */ - public function setRelease($value) - { - $this->release = $value; - - return $this; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php deleted file mode 100644 index 590f996..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; - -/** - * Logs to a Redis key using rpush - * - * usage example: - * - * $log = new Logger('application'); - * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod"); - * $log->pushHandler($redis); - * - * @author Thomas Tourlourat - */ -class RedisHandler extends AbstractProcessingHandler -{ - private $redisClient; - private $redisKey; - protected $capSize; - - /** - * @param \Predis\Client|\Redis $redis The redis instance - * @param string $key The key name to push records to - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param int $capSize Number of entries to limit list size to - */ - public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) - { - if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { - throw new \InvalidArgumentException('Predis\Client or Redis instance required'); - } - - $this->redisClient = $redis; - $this->redisKey = $key; - $this->capSize = $capSize; - - parent::__construct($level, $bubble); - } - - /** - * {@inheritDoc} - */ - protected function write(array $record) - { - if ($this->capSize) { - $this->writeCapped($record); - } else { - $this->redisClient->rpush($this->redisKey, $record["formatted"]); - } - } - - /** - * Write and cap the collection - * Writes the record to the redis list and caps its - * - * @param array $record associative record array - * @return void - */ - protected function writeCapped(array $record) - { - if ($this->redisClient instanceof \Redis) { - $this->redisClient->multi() - ->rpush($this->redisKey, $record["formatted"]) - ->ltrim($this->redisKey, -$this->capSize, -1) - ->exec(); - } else { - $redisKey = $this->redisKey; - $capSize = $this->capSize; - $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { - $tx->rpush($redisKey, $record["formatted"]); - $tx->ltrim($redisKey, -$capSize, -1); - }); - } - } - - /** - * {@inheritDoc} - */ - protected function getDefaultFormatter() - { - return new LineFormatter(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php deleted file mode 100644 index 6c8a3e3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use RollbarNotifier; -use Exception; -use Monolog\Logger; - -/** - * Sends errors to Rollbar - * - * If the context data contains a `payload` key, that is used as an array - * of payload options to RollbarNotifier's report_message/report_exception methods. - * - * Rollbar's context info will contain the context + extra keys from the log record - * merged, and then on top of that a few keys: - * - * - level (rollbar level name) - * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) - * - channel - * - datetime (unix timestamp) - * - * @author Paul Statezny - */ -class RollbarHandler extends AbstractProcessingHandler -{ - /** - * Rollbar notifier - * - * @var RollbarNotifier - */ - protected $rollbarNotifier; - - protected $levelMap = array( - Logger::DEBUG => 'debug', - Logger::INFO => 'info', - Logger::NOTICE => 'info', - Logger::WARNING => 'warning', - Logger::ERROR => 'error', - Logger::CRITICAL => 'critical', - Logger::ALERT => 'critical', - Logger::EMERGENCY => 'critical', - ); - - /** - * Records whether any log records have been added since the last flush of the rollbar notifier - * - * @var bool - */ - private $hasRecords = false; - - protected $initialized = false; - - /** - * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) - { - $this->rollbarNotifier = $rollbarNotifier; - - parent::__construct($level, $bubble); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - if (!$this->initialized) { - // __destructor() doesn't get called on Fatal errors - register_shutdown_function(array($this, 'close')); - $this->initialized = true; - } - - $context = $record['context']; - $payload = array(); - if (isset($context['payload'])) { - $payload = $context['payload']; - unset($context['payload']); - } - $context = array_merge($context, $record['extra'], array( - 'level' => $this->levelMap[$record['level']], - 'monolog_level' => $record['level_name'], - 'channel' => $record['channel'], - 'datetime' => $record['datetime']->format('U'), - )); - - if (isset($context['exception']) && $context['exception'] instanceof Exception) { - $payload['level'] = $context['level']; - $exception = $context['exception']; - unset($context['exception']); - - $this->rollbarNotifier->report_exception($exception, $context, $payload); - } else { - $this->rollbarNotifier->report_message( - $record['message'], - $context['level'], - $context, - $payload - ); - } - - $this->hasRecords = true; - } - - public function flush() - { - if ($this->hasRecords) { - $this->rollbarNotifier->flush(); - $this->hasRecords = false; - } - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->flush(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php deleted file mode 100644 index 3b60b3d..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Stores logs to files that are rotated every day and a limited number of files are kept. - * - * This rotation is only intended to be used as a workaround. Using logrotate to - * handle the rotation is strongly encouraged when you can use it. - * - * @author Christophe Coevoet - * @author Jordi Boggiano - */ -class RotatingFileHandler extends StreamHandler -{ - const FILE_PER_DAY = 'Y-m-d'; - const FILE_PER_MONTH = 'Y-m'; - const FILE_PER_YEAR = 'Y'; - - protected $filename; - protected $maxFiles; - protected $mustRotate; - protected $nextRotation; - protected $filenameFormat; - protected $dateFormat; - - /** - * @param string $filename - * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param Boolean $useLocking Try to lock log file before doing any writes - */ - public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) - { - $this->filename = $filename; - $this->maxFiles = (int) $maxFiles; - $this->nextRotation = new \DateTime('tomorrow'); - $this->filenameFormat = '{filename}-{date}'; - $this->dateFormat = 'Y-m-d'; - - parent::__construct($this->getTimedFilename(), $level, $bubble, $filePermission, $useLocking); - } - - /** - * {@inheritdoc} - */ - public function close() - { - parent::close(); - - if (true === $this->mustRotate) { - $this->rotate(); - } - } - - public function setFilenameFormat($filenameFormat, $dateFormat) - { - if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { - trigger_error( - 'Invalid date format - format must be one of '. - 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. - 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '. - 'date formats using slashes, underscores and/or dots instead of dashes.', - E_USER_DEPRECATED - ); - } - if (substr_count($filenameFormat, '{date}') === 0) { - trigger_error( - 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.', - E_USER_DEPRECATED - ); - } - $this->filenameFormat = $filenameFormat; - $this->dateFormat = $dateFormat; - $this->url = $this->getTimedFilename(); - $this->close(); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - // on the first record written, if the log is new, we should rotate (once per day) - if (null === $this->mustRotate) { - $this->mustRotate = !file_exists($this->url); - } - - if ($this->nextRotation < $record['datetime']) { - $this->mustRotate = true; - $this->close(); - } - - parent::write($record); - } - - /** - * Rotates the files. - */ - protected function rotate() - { - // update filename - $this->url = $this->getTimedFilename(); - $this->nextRotation = new \DateTime('tomorrow'); - - // skip GC of old logs if files are unlimited - if (0 === $this->maxFiles) { - return; - } - - $logFiles = glob($this->getGlobPattern()); - if ($this->maxFiles >= count($logFiles)) { - // no files to remove - return; - } - - // Sorting the files by name to remove the older ones - usort($logFiles, function ($a, $b) { - return strcmp($b, $a); - }); - - foreach (array_slice($logFiles, $this->maxFiles) as $file) { - if (is_writable($file)) { - // suppress errors here as unlink() might fail if two processes - // are cleaning up/rotating at the same time - set_error_handler(function ($errno, $errstr, $errfile, $errline) {}); - unlink($file); - restore_error_handler(); - } - } - - $this->mustRotate = false; - } - - protected function getTimedFilename() - { - $fileInfo = pathinfo($this->filename); - $timedFilename = str_replace( - array('{filename}', '{date}'), - array($fileInfo['filename'], date($this->dateFormat)), - $fileInfo['dirname'] . '/' . $this->filenameFormat - ); - - if (!empty($fileInfo['extension'])) { - $timedFilename .= '.'.$fileInfo['extension']; - } - - return $timedFilename; - } - - protected function getGlobPattern() - { - $fileInfo = pathinfo($this->filename); - $glob = str_replace( - array('{filename}', '{date}'), - array($fileInfo['filename'], '*'), - $fileInfo['dirname'] . '/' . $this->filenameFormat - ); - if (!empty($fileInfo['extension'])) { - $glob .= '.'.$fileInfo['extension']; - } - - return $glob; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php deleted file mode 100644 index 9509ae3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Sampling handler - * - * A sampled event stream can be useful for logging high frequency events in - * a production environment where you only need an idea of what is happening - * and are not concerned with capturing every occurrence. Since the decision to - * handle or not handle a particular event is determined randomly, the - * resulting sampled log is not guaranteed to contain 1/N of the events that - * occurred in the application, but based on the Law of large numbers, it will - * tend to be close to this ratio with a large number of attempts. - * - * @author Bryan Davis - * @author Kunal Mehta - */ -class SamplingHandler extends AbstractHandler -{ - /** - * @var callable|HandlerInterface $handler - */ - protected $handler; - - /** - * @var int $factor - */ - protected $factor; - - /** - * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). - * @param int $factor Sample factor - */ - public function __construct($handler, $factor) - { - parent::__construct(); - $this->handler = $handler; - $this->factor = $factor; - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } - } - - public function isHandling(array $record) - { - return $this->handler->isHandling($record); - } - - public function handle(array $record) - { - if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { - // The same logic as in FingersCrossedHandler - if (!$this->handler instanceof HandlerInterface) { - $this->handler = call_user_func($this->handler, $record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); - } - } - - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - $this->handler->handle($record); - } - - return false === $this->bubble; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php deleted file mode 100644 index 38bc838..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +++ /dev/null @@ -1,294 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\Slack; - -use Monolog\Logger; -use Monolog\Formatter\NormalizerFormatter; -use Monolog\Formatter\FormatterInterface; - -/** - * Slack record utility helping to log to Slack webhooks or API. - * - * @author Greg Kedzierski - * @author Haralan Dobrev - * @see https://api.slack.com/incoming-webhooks - * @see https://api.slack.com/docs/message-attachments - */ -class SlackRecord -{ - const COLOR_DANGER = 'danger'; - - const COLOR_WARNING = 'warning'; - - const COLOR_GOOD = 'good'; - - const COLOR_DEFAULT = '#e3e4e6'; - - /** - * Slack channel (encoded ID or name) - * @var string|null - */ - private $channel; - - /** - * Name of a bot - * @var string|null - */ - private $username; - - /** - * User icon e.g. 'ghost', 'http://example.com/user.png' - * @var string - */ - private $userIcon; - - /** - * Whether the message should be added to Slack as attachment (plain text otherwise) - * @var bool - */ - private $useAttachment; - - /** - * Whether the the context/extra messages added to Slack as attachments are in a short style - * @var bool - */ - private $useShortAttachment; - - /** - * Whether the attachment should include context and extra data - * @var bool - */ - private $includeContextAndExtra; - - /** - * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] - * @var array - */ - private $excludeFields; - - /** - * @var FormatterInterface - */ - private $formatter; - - /** - * @var NormalizerFormatter - */ - private $normalizerFormatter; - - public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null) - { - $this->channel = $channel; - $this->username = $username; - $this->userIcon = trim($userIcon, ':'); - $this->useAttachment = $useAttachment; - $this->useShortAttachment = $useShortAttachment; - $this->includeContextAndExtra = $includeContextAndExtra; - $this->excludeFields = $excludeFields; - $this->formatter = $formatter; - - if ($this->includeContextAndExtra) { - $this->normalizerFormatter = new NormalizerFormatter(); - } - } - - public function getSlackData(array $record) - { - $dataArray = array(); - $record = $this->excludeFields($record); - - if ($this->username) { - $dataArray['username'] = $this->username; - } - - if ($this->channel) { - $dataArray['channel'] = $this->channel; - } - - if ($this->formatter && !$this->useAttachment) { - $message = $this->formatter->format($record); - } else { - $message = $record['message']; - } - - if ($this->useAttachment) { - $attachment = array( - 'fallback' => $message, - 'text' => $message, - 'color' => $this->getAttachmentColor($record['level']), - 'fields' => array(), - 'mrkdwn_in' => array('fields'), - 'ts' => $record['datetime']->getTimestamp() - ); - - if ($this->useShortAttachment) { - $attachment['title'] = $record['level_name']; - } else { - $attachment['title'] = 'Message'; - $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); - } - - - if ($this->includeContextAndExtra) { - foreach (array('extra', 'context') as $key) { - if (empty($record[$key])) { - continue; - } - - if ($this->useShortAttachment) { - $attachment['fields'][] = $this->generateAttachmentField( - ucfirst($key), - $record[$key] - ); - } else { - // Add all extra fields as individual fields in attachment - $attachment['fields'] = array_merge( - $attachment['fields'], - $this->generateAttachmentFields($record[$key]) - ); - } - } - } - - $dataArray['attachments'] = array($attachment); - } else { - $dataArray['text'] = $message; - } - - if ($this->userIcon) { - if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { - $dataArray['icon_url'] = $this->userIcon; - } else { - $dataArray['icon_emoji'] = ":{$this->userIcon}:"; - } - } - - return $dataArray; - } - - /** - * Returned a Slack message attachment color associated with - * provided level. - * - * @param int $level - * @return string - */ - public function getAttachmentColor($level) - { - switch (true) { - case $level >= Logger::ERROR: - return self::COLOR_DANGER; - case $level >= Logger::WARNING: - return self::COLOR_WARNING; - case $level >= Logger::INFO: - return self::COLOR_GOOD; - default: - return self::COLOR_DEFAULT; - } - } - - /** - * Stringifies an array of key/value pairs to be used in attachment fields - * - * @param array $fields - * - * @return string - */ - public function stringify($fields) - { - $normalized = $this->normalizerFormatter->format($fields); - $prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; - - $hasSecondDimension = count(array_filter($normalized, 'is_array')); - $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); - - return $hasSecondDimension || $hasNonNumericKeys - ? json_encode($normalized, $prettyPrintFlag) - : json_encode($normalized); - } - - /** - * Sets the formatter - * - * @param FormatterInterface $formatter - */ - public function setFormatter(FormatterInterface $formatter) - { - $this->formatter = $formatter; - } - - /** - * Generates attachment field - * - * @param string $title - * @param string|array $value\ - * - * @return array - */ - private function generateAttachmentField($title, $value) - { - $value = is_array($value) - ? sprintf('```%s```', $this->stringify($value)) - : $value; - - return array( - 'title' => $title, - 'value' => $value, - 'short' => false - ); - } - - /** - * Generates a collection of attachment fields from array - * - * @param array $data - * - * @return array - */ - private function generateAttachmentFields(array $data) - { - $fields = array(); - foreach ($data as $key => $value) { - $fields[] = $this->generateAttachmentField($key, $value); - } - - return $fields; - } - - /** - * Get a copy of record with fields excluded according to $this->excludeFields - * - * @param array $record - * - * @return array - */ - private function excludeFields(array $record) - { - foreach ($this->excludeFields as $field) { - $keys = explode('.', $field); - $node = &$record; - $lastKey = end($keys); - foreach ($keys as $key) { - if (!isset($node[$key])) { - break; - } - if ($lastKey === $key) { - unset($node[$key]); - break; - } - $node = &$node[$key]; - } - } - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php deleted file mode 100644 index 3ac4d83..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; -use Monolog\Handler\Slack\SlackRecord; - -/** - * Sends notifications through Slack API - * - * @author Greg Kedzierski - * @see https://api.slack.com/ - */ -class SlackHandler extends SocketHandler -{ - /** - * Slack API token - * @var string - */ - private $token; - - /** - * Instance of the SlackRecord util class preparing data for Slack API. - * @var SlackRecord - */ - private $slackRecord; - - /** - * @param string $token Slack API token - * @param string $channel Slack channel (encoded ID or name) - * @param string|null $username Name of a bot - * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) - * @param string|null $iconEmoji The emoji name to use (or null) - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style - * @param bool $includeContextAndExtra Whether the attachment should include context and extra data - * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] - * @throws MissingExtensionException If no OpenSSL PHP extension configured - */ - public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array()) - { - if (!extension_loaded('openssl')) { - throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler'); - } - - parent::__construct('ssl://slack.com:443', $level, $bubble); - - $this->slackRecord = new SlackRecord( - $channel, - $username, - $useAttachment, - $iconEmoji, - $useShortAttachment, - $includeContextAndExtra, - $excludeFields, - $this->formatter - ); - - $this->token = $token; - } - - public function getSlackRecord() - { - return $this->slackRecord; - } - - /** - * {@inheritdoc} - * - * @param array $record - * @return string - */ - protected function generateDataStream($record) - { - $content = $this->buildContent($record); - - return $this->buildHeader($content) . $content; - } - - /** - * Builds the body of API call - * - * @param array $record - * @return string - */ - private function buildContent($record) - { - $dataArray = $this->prepareContentData($record); - - return http_build_query($dataArray); - } - - /** - * Prepares content data - * - * @param array $record - * @return array - */ - protected function prepareContentData($record) - { - $dataArray = $this->slackRecord->getSlackData($record); - $dataArray['token'] = $this->token; - - if (!empty($dataArray['attachments'])) { - $dataArray['attachments'] = json_encode($dataArray['attachments']); - } - - return $dataArray; - } - - /** - * Builds the header of the API Call - * - * @param string $content - * @return string - */ - private function buildHeader($content) - { - $header = "POST /api/chat.postMessage HTTP/1.1\r\n"; - $header .= "Host: slack.com\r\n"; - $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; - $header .= "Content-Length: " . strlen($content) . "\r\n"; - $header .= "\r\n"; - - return $header; - } - - /** - * {@inheritdoc} - * - * @param array $record - */ - protected function write(array $record) - { - parent::write($record); - $this->finalizeWrite(); - } - - /** - * Finalizes the request by reading some bytes and then closing the socket - * - * If we do not read some but close the socket too early, slack sometimes - * drops the request entirely. - */ - protected function finalizeWrite() - { - $res = $this->getResource(); - if (is_resource($res)) { - @fread($res, 2048); - } - $this->closeSocket(); - } - - /** - * Returned a Slack message attachment color associated with - * provided level. - * - * @param int $level - * @return string - * @deprecated Use underlying SlackRecord instead - */ - protected function getAttachmentColor($level) - { - trigger_error( - 'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.', - E_USER_DEPRECATED - ); - - return $this->slackRecord->getAttachmentColor($level); - } - - /** - * Stringifies an array of key/value pairs to be used in attachment fields - * - * @param array $fields - * @return string - * @deprecated Use underlying SlackRecord instead - */ - protected function stringify($fields) - { - trigger_error( - 'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.', - E_USER_DEPRECATED - ); - - return $this->slackRecord->stringify($fields); - } - - public function setFormatter(FormatterInterface $formatter) - { - parent::setFormatter($formatter); - $this->slackRecord->setFormatter($formatter); - - return $this; - } - - public function getFormatter() - { - $formatter = parent::getFormatter(); - $this->slackRecord->setFormatter($formatter); - - return $formatter; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php deleted file mode 100644 index 9a1bbb4..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; -use Monolog\Handler\Slack\SlackRecord; - -/** - * Sends notifications through Slack Webhooks - * - * @author Haralan Dobrev - * @see https://api.slack.com/incoming-webhooks - */ -class SlackWebhookHandler extends AbstractProcessingHandler -{ - /** - * Slack Webhook token - * @var string - */ - private $webhookUrl; - - /** - * Instance of the SlackRecord util class preparing data for Slack API. - * @var SlackRecord - */ - private $slackRecord; - - /** - * @param string $webhookUrl Slack Webhook URL - * @param string|null $channel Slack channel (encoded ID or name) - * @param string|null $username Name of a bot - * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) - * @param string|null $iconEmoji The emoji name to use (or null) - * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style - * @param bool $includeContextAndExtra Whether the attachment should include context and extra data - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] - */ - public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array()) - { - parent::__construct($level, $bubble); - - $this->webhookUrl = $webhookUrl; - - $this->slackRecord = new SlackRecord( - $channel, - $username, - $useAttachment, - $iconEmoji, - $useShortAttachment, - $includeContextAndExtra, - $excludeFields, - $this->formatter - ); - } - - public function getSlackRecord() - { - return $this->slackRecord; - } - - /** - * {@inheritdoc} - * - * @param array $record - */ - protected function write(array $record) - { - $postData = $this->slackRecord->getSlackData($record); - $postString = json_encode($postData); - - $ch = curl_init(); - $options = array( - CURLOPT_URL => $this->webhookUrl, - CURLOPT_POST => true, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => array('Content-type: application/json'), - CURLOPT_POSTFIELDS => $postString - ); - if (defined('CURLOPT_SAFE_UPLOAD')) { - $options[CURLOPT_SAFE_UPLOAD] = true; - } - - curl_setopt_array($ch, $options); - - Curl\Util::execute($ch); - } - - public function setFormatter(FormatterInterface $formatter) - { - parent::setFormatter($formatter); - $this->slackRecord->setFormatter($formatter); - - return $this; - } - - public function getFormatter() - { - $formatter = parent::getFormatter(); - $this->slackRecord->setFormatter($formatter); - - return $formatter; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php deleted file mode 100644 index baead52..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Sends notifications through Slack's Slackbot - * - * @author Haralan Dobrev - * @see https://slack.com/apps/A0F81R8ET-slackbot - */ -class SlackbotHandler extends AbstractProcessingHandler -{ - /** - * The slug of the Slack team - * @var string - */ - private $slackTeam; - - /** - * Slackbot token - * @var string - */ - private $token; - - /** - * Slack channel name - * @var string - */ - private $channel; - - /** - * @param string $slackTeam Slack team slug - * @param string $token Slackbot token - * @param string $channel Slack channel (encoded ID or name) - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true) - { - parent::__construct($level, $bubble); - - $this->slackTeam = $slackTeam; - $this->token = $token; - $this->channel = $channel; - } - - /** - * {@inheritdoc} - * - * @param array $record - */ - protected function write(array $record) - { - $slackbotUrl = sprintf( - 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', - $this->slackTeam, - $this->token, - $this->channel - ); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $slackbotUrl); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); - - Curl\Util::execute($ch); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php deleted file mode 100644 index 7a61bf4..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +++ /dev/null @@ -1,346 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Stores to any socket - uses fsockopen() or pfsockopen(). - * - * @author Pablo de Leon Belloc - * @see http://php.net/manual/en/function.fsockopen.php - */ -class SocketHandler extends AbstractProcessingHandler -{ - private $connectionString; - private $connectionTimeout; - private $resource; - private $timeout = 0; - private $writingTimeout = 10; - private $lastSentBytes = null; - private $persistent = false; - private $errno; - private $errstr; - private $lastWritingAt; - - /** - * @param string $connectionString Socket connection string - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true) - { - parent::__construct($level, $bubble); - $this->connectionString = $connectionString; - $this->connectionTimeout = (float) ini_get('default_socket_timeout'); - } - - /** - * Connect (if necessary) and write to the socket - * - * @param array $record - * - * @throws \UnexpectedValueException - * @throws \RuntimeException - */ - protected function write(array $record) - { - $this->connectIfNotConnected(); - $data = $this->generateDataStream($record); - $this->writeToSocket($data); - } - - /** - * We will not close a PersistentSocket instance so it can be reused in other requests. - */ - public function close() - { - if (!$this->isPersistent()) { - $this->closeSocket(); - } - } - - /** - * Close socket, if open - */ - public function closeSocket() - { - if (is_resource($this->resource)) { - fclose($this->resource); - $this->resource = null; - } - } - - /** - * Set socket connection to nbe persistent. It only has effect before the connection is initiated. - * - * @param bool $persistent - */ - public function setPersistent($persistent) - { - $this->persistent = (boolean) $persistent; - } - - /** - * Set connection timeout. Only has effect before we connect. - * - * @param float $seconds - * - * @see http://php.net/manual/en/function.fsockopen.php - */ - public function setConnectionTimeout($seconds) - { - $this->validateTimeout($seconds); - $this->connectionTimeout = (float) $seconds; - } - - /** - * Set write timeout. Only has effect before we connect. - * - * @param float $seconds - * - * @see http://php.net/manual/en/function.stream-set-timeout.php - */ - public function setTimeout($seconds) - { - $this->validateTimeout($seconds); - $this->timeout = (float) $seconds; - } - - /** - * Set writing timeout. Only has effect during connection in the writing cycle. - * - * @param float $seconds 0 for no timeout - */ - public function setWritingTimeout($seconds) - { - $this->validateTimeout($seconds); - $this->writingTimeout = (float) $seconds; - } - - /** - * Get current connection string - * - * @return string - */ - public function getConnectionString() - { - return $this->connectionString; - } - - /** - * Get persistent setting - * - * @return bool - */ - public function isPersistent() - { - return $this->persistent; - } - - /** - * Get current connection timeout setting - * - * @return float - */ - public function getConnectionTimeout() - { - return $this->connectionTimeout; - } - - /** - * Get current in-transfer timeout - * - * @return float - */ - public function getTimeout() - { - return $this->timeout; - } - - /** - * Get current local writing timeout - * - * @return float - */ - public function getWritingTimeout() - { - return $this->writingTimeout; - } - - /** - * Check to see if the socket is currently available. - * - * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. - * - * @return bool - */ - public function isConnected() - { - return is_resource($this->resource) - && !feof($this->resource); // on TCP - other party can close connection. - } - - /** - * Wrapper to allow mocking - */ - protected function pfsockopen() - { - return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); - } - - /** - * Wrapper to allow mocking - */ - protected function fsockopen() - { - return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); - } - - /** - * Wrapper to allow mocking - * - * @see http://php.net/manual/en/function.stream-set-timeout.php - */ - protected function streamSetTimeout() - { - $seconds = floor($this->timeout); - $microseconds = round(($this->timeout - $seconds) * 1e6); - - return stream_set_timeout($this->resource, $seconds, $microseconds); - } - - /** - * Wrapper to allow mocking - */ - protected function fwrite($data) - { - return @fwrite($this->resource, $data); - } - - /** - * Wrapper to allow mocking - */ - protected function streamGetMetadata() - { - return stream_get_meta_data($this->resource); - } - - private function validateTimeout($value) - { - $ok = filter_var($value, FILTER_VALIDATE_FLOAT); - if ($ok === false || $value < 0) { - throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)"); - } - } - - private function connectIfNotConnected() - { - if ($this->isConnected()) { - return; - } - $this->connect(); - } - - protected function generateDataStream($record) - { - return (string) $record['formatted']; - } - - /** - * @return resource|null - */ - protected function getResource() - { - return $this->resource; - } - - private function connect() - { - $this->createSocketResource(); - $this->setSocketTimeout(); - } - - private function createSocketResource() - { - if ($this->isPersistent()) { - $resource = $this->pfsockopen(); - } else { - $resource = $this->fsockopen(); - } - if (!$resource) { - throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)"); - } - $this->resource = $resource; - } - - private function setSocketTimeout() - { - if (!$this->streamSetTimeout()) { - throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()"); - } - } - - private function writeToSocket($data) - { - $length = strlen($data); - $sent = 0; - $this->lastSentBytes = $sent; - while ($this->isConnected() && $sent < $length) { - if (0 == $sent) { - $chunk = $this->fwrite($data); - } else { - $chunk = $this->fwrite(substr($data, $sent)); - } - if ($chunk === false) { - throw new \RuntimeException("Could not write to socket"); - } - $sent += $chunk; - $socketInfo = $this->streamGetMetadata(); - if ($socketInfo['timed_out']) { - throw new \RuntimeException("Write timed-out"); - } - - if ($this->writingIsTimedOut($sent)) { - throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)"); - } - } - if (!$this->isConnected() && $sent < $length) { - throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)"); - } - } - - private function writingIsTimedOut($sent) - { - $writingTimeout = (int) floor($this->writingTimeout); - if (0 === $writingTimeout) { - return false; - } - - if ($sent !== $this->lastSentBytes) { - $this->lastWritingAt = time(); - $this->lastSentBytes = $sent; - - return false; - } else { - usleep(100); - } - - if ((time() - $this->lastWritingAt) >= $writingTimeout) { - $this->closeSocket(); - - return true; - } - - return false; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php deleted file mode 100644 index 09a1573..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +++ /dev/null @@ -1,176 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Stores to any stream resource - * - * Can be used to store into php://stderr, remote and local files, etc. - * - * @author Jordi Boggiano - */ -class StreamHandler extends AbstractProcessingHandler -{ - protected $stream; - protected $url; - private $errorMessage; - protected $filePermission; - protected $useLocking; - private $dirCreated; - - /** - * @param resource|string $stream - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param Boolean $useLocking Try to lock log file before doing any writes - * - * @throws \Exception If a missing directory is not buildable - * @throws \InvalidArgumentException If stream is not a resource or string - */ - public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) - { - parent::__construct($level, $bubble); - if (is_resource($stream)) { - $this->stream = $stream; - } elseif (is_string($stream)) { - $this->url = $stream; - } else { - throw new \InvalidArgumentException('A stream must either be a resource or a string.'); - } - - $this->filePermission = $filePermission; - $this->useLocking = $useLocking; - } - - /** - * {@inheritdoc} - */ - public function close() - { - if ($this->url && is_resource($this->stream)) { - fclose($this->stream); - } - $this->stream = null; - } - - /** - * Return the currently active stream if it is open - * - * @return resource|null - */ - public function getStream() - { - return $this->stream; - } - - /** - * Return the stream URL if it was configured with a URL and not an active resource - * - * @return string|null - */ - public function getUrl() - { - return $this->url; - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - if (!is_resource($this->stream)) { - if (null === $this->url || '' === $this->url) { - throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); - } - $this->createDir(); - $this->errorMessage = null; - set_error_handler(array($this, 'customErrorHandler')); - $this->stream = fopen($this->url, 'a'); - if ($this->filePermission !== null) { - @chmod($this->url, $this->filePermission); - } - restore_error_handler(); - if (!is_resource($this->stream)) { - $this->stream = null; - throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url)); - } - } - - if ($this->useLocking) { - // ignoring errors here, there's not much we can do about them - flock($this->stream, LOCK_EX); - } - - $this->streamWrite($this->stream, $record); - - if ($this->useLocking) { - flock($this->stream, LOCK_UN); - } - } - - /** - * Write to stream - * @param resource $stream - * @param array $record - */ - protected function streamWrite($stream, array $record) - { - fwrite($stream, (string) $record['formatted']); - } - - private function customErrorHandler($code, $msg) - { - $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); - } - - /** - * @param string $stream - * - * @return null|string - */ - private function getDirFromStream($stream) - { - $pos = strpos($stream, '://'); - if ($pos === false) { - return dirname($stream); - } - - if ('file://' === substr($stream, 0, 7)) { - return dirname(substr($stream, 7)); - } - - return; - } - - private function createDir() - { - // Do not try to create dir if it has already been tried. - if ($this->dirCreated) { - return; - } - - $dir = $this->getDirFromStream($this->url); - if (null !== $dir && !is_dir($dir)) { - $this->errorMessage = null; - set_error_handler(array($this, 'customErrorHandler')); - $status = mkdir($dir, 0777, true); - restore_error_handler(); - if (false === $status) { - throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir)); - } - } - $this->dirCreated = true; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php deleted file mode 100644 index 72f44a5..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Swift; - -/** - * SwiftMailerHandler uses Swift_Mailer to send the emails - * - * @author Gyula Sallai - */ -class SwiftMailerHandler extends MailHandler -{ - protected $mailer; - private $messageTemplate; - - /** - * @param \Swift_Mailer $mailer The mailer to use - * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) - { - parent::__construct($level, $bubble); - - $this->mailer = $mailer; - $this->messageTemplate = $message; - } - - /** - * {@inheritdoc} - */ - protected function send($content, array $records) - { - $this->mailer->send($this->buildMessage($content, $records)); - } - - /** - * Creates instance of Swift_Message to be sent - * - * @param string $content formatted email body to be sent - * @param array $records Log records that formed the content - * @return \Swift_Message - */ - protected function buildMessage($content, array $records) - { - $message = null; - if ($this->messageTemplate instanceof \Swift_Message) { - $message = clone $this->messageTemplate; - $message->generateId(); - } elseif (is_callable($this->messageTemplate)) { - $message = call_user_func($this->messageTemplate, $content, $records); - } - - if (!$message instanceof \Swift_Message) { - throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it'); - } - - if ($records) { - $subjectFormatter = new LineFormatter($message->getSubject()); - $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); - } - - $message->setBody($content); - if (version_compare(Swift::VERSION, '6.0.0', '>=')) { - $message->setDate(new \DateTimeImmutable()); - } else { - $message->setDate(time()); - } - - return $message; - } - - /** - * BC getter, to be removed in 2.0 - */ - public function __get($name) - { - if ($name === 'message') { - trigger_error('SwiftMailerHandler->message is deprecated, use ->buildMessage() instead to retrieve the message', E_USER_DEPRECATED); - - return $this->buildMessage(null, array()); - } - - throw new \InvalidArgumentException('Invalid property '.$name); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php deleted file mode 100644 index 376bc3b..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -/** - * Logs to syslog service. - * - * usage example: - * - * $log = new Logger('application'); - * $syslog = new SyslogHandler('myfacility', 'local6'); - * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); - * $syslog->setFormatter($formatter); - * $log->pushHandler($syslog); - * - * @author Sven Paulus - */ -class SyslogHandler extends AbstractSyslogHandler -{ - protected $ident; - protected $logopts; - - /** - * @param string $ident - * @param mixed $facility - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID - */ - public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID) - { - parent::__construct($facility, $level, $bubble); - - $this->ident = $ident; - $this->logopts = $logopts; - } - - /** - * {@inheritdoc} - */ - public function close() - { - closelog(); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - if (!openlog($this->ident, $this->logopts, $this->facility)) { - throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"'); - } - syslog($this->logLevels[$record['level']], (string) $record['formatted']); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php deleted file mode 100644 index 3bff085..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\SyslogUdp; - -class UdpSocket -{ - const DATAGRAM_MAX_LENGTH = 65023; - - protected $ip; - protected $port; - protected $socket; - - public function __construct($ip, $port = 514) - { - $this->ip = $ip; - $this->port = $port; - $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - } - - public function write($line, $header = "") - { - $this->send($this->assembleMessage($line, $header)); - } - - public function close() - { - if (is_resource($this->socket)) { - socket_close($this->socket); - $this->socket = null; - } - } - - protected function send($chunk) - { - if (!is_resource($this->socket)) { - throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore'); - } - socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port); - } - - protected function assembleMessage($line, $header) - { - $chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header); - - return $header . substr($line, 0, $chunkSize); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php deleted file mode 100644 index 4718711..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\Handler\SyslogUdp\UdpSocket; - -/** - * A Handler for logging to a remote syslogd server. - * - * @author Jesper Skovgaard Nielsen - */ -class SyslogUdpHandler extends AbstractSyslogHandler -{ - protected $socket; - protected $ident; - - /** - * @param string $host - * @param int $port - * @param mixed $facility - * @param int $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param string $ident Program name or tag for each log message. - */ - public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php') - { - parent::__construct($facility, $level, $bubble); - - $this->ident = $ident; - - $this->socket = new UdpSocket($host, $port ?: 514); - } - - protected function write(array $record) - { - $lines = $this->splitMessageIntoLines($record['formatted']); - - $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]); - - foreach ($lines as $line) { - $this->socket->write($line, $header); - } - } - - public function close() - { - $this->socket->close(); - } - - private function splitMessageIntoLines($message) - { - if (is_array($message)) { - $message = implode("\n", $message); - } - - return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY); - } - - /** - * Make common syslog header (see rfc5424) - */ - protected function makeCommonSyslogHeader($severity) - { - $priority = $severity + $this->facility; - - if (!$pid = getmypid()) { - $pid = '-'; - } - - if (!$hostname = gethostname()) { - $hostname = '-'; - } - - return "<$priority>1 " . - $this->getDateTime() . " " . - $hostname . " " . - $this->ident . " " . - $pid . " - - "; - } - - protected function getDateTime() - { - return date(\DateTime::RFC3339); - } - - /** - * Inject your own socket, mainly used for testing - */ - public function setSocket($socket) - { - $this->socket = $socket; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php deleted file mode 100644 index e39cfc6..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Used for testing purposes. - * - * It records all records and gives you access to them for verification. - * - * @author Jordi Boggiano - * - * @method bool hasEmergency($record) - * @method bool hasAlert($record) - * @method bool hasCritical($record) - * @method bool hasError($record) - * @method bool hasWarning($record) - * @method bool hasNotice($record) - * @method bool hasInfo($record) - * @method bool hasDebug($record) - * - * @method bool hasEmergencyRecords() - * @method bool hasAlertRecords() - * @method bool hasCriticalRecords() - * @method bool hasErrorRecords() - * @method bool hasWarningRecords() - * @method bool hasNoticeRecords() - * @method bool hasInfoRecords() - * @method bool hasDebugRecords() - * - * @method bool hasEmergencyThatContains($message) - * @method bool hasAlertThatContains($message) - * @method bool hasCriticalThatContains($message) - * @method bool hasErrorThatContains($message) - * @method bool hasWarningThatContains($message) - * @method bool hasNoticeThatContains($message) - * @method bool hasInfoThatContains($message) - * @method bool hasDebugThatContains($message) - * - * @method bool hasEmergencyThatMatches($message) - * @method bool hasAlertThatMatches($message) - * @method bool hasCriticalThatMatches($message) - * @method bool hasErrorThatMatches($message) - * @method bool hasWarningThatMatches($message) - * @method bool hasNoticeThatMatches($message) - * @method bool hasInfoThatMatches($message) - * @method bool hasDebugThatMatches($message) - * - * @method bool hasEmergencyThatPasses($message) - * @method bool hasAlertThatPasses($message) - * @method bool hasCriticalThatPasses($message) - * @method bool hasErrorThatPasses($message) - * @method bool hasWarningThatPasses($message) - * @method bool hasNoticeThatPasses($message) - * @method bool hasInfoThatPasses($message) - * @method bool hasDebugThatPasses($message) - */ -class TestHandler extends AbstractProcessingHandler -{ - protected $records = array(); - protected $recordsByLevel = array(); - - public function getRecords() - { - return $this->records; - } - - public function clear() - { - $this->records = array(); - $this->recordsByLevel = array(); - } - - public function hasRecords($level) - { - return isset($this->recordsByLevel[$level]); - } - - public function hasRecord($record, $level) - { - if (is_array($record)) { - $record = $record['message']; - } - - return $this->hasRecordThatPasses(function ($rec) use ($record) { - return $rec['message'] === $record; - }, $level); - } - - public function hasRecordThatContains($message, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($message) { - return strpos($rec['message'], $message) !== false; - }, $level); - } - - public function hasRecordThatMatches($regex, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($regex) { - return preg_match($regex, $rec['message']) > 0; - }, $level); - } - - public function hasRecordThatPasses($predicate, $level) - { - if (!is_callable($predicate)) { - throw new \InvalidArgumentException("Expected a callable for hasRecordThatSucceeds"); - } - - if (!isset($this->recordsByLevel[$level])) { - return false; - } - - foreach ($this->recordsByLevel[$level] as $i => $rec) { - if (call_user_func($predicate, $rec, $i)) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $this->recordsByLevel[$record['level']][] = $record; - $this->records[] = $record; - } - - public function __call($method, $args) - { - if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = constant('Monolog\Logger::' . strtoupper($matches[2])); - if (method_exists($this, $genericMethod)) { - $args[] = $level; - - return call_user_func_array(array($this, $genericMethod), $args); - } - } - - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php deleted file mode 100644 index 2732ba3..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -/** - * Forwards records to multiple handlers suppressing failures of each handler - * and continuing through to give every handler a chance to succeed. - * - * @author Craig D'Amelio - */ -class WhatFailureGroupHandler extends GroupHandler -{ - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - if ($this->processors) { - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - } - - foreach ($this->handlers as $handler) { - try { - $handler->handle($record); - } catch (\Exception $e) { - // What failure? - } catch (\Throwable $e) { - // What failure? - } - } - - return false === $this->bubble; - } - - /** - * {@inheritdoc} - */ - public function handleBatch(array $records) - { - foreach ($this->handlers as $handler) { - try { - $handler->handleBatch($records); - } catch (\Exception $e) { - // What failure? - } catch (\Throwable $e) { - // What failure? - } - } - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php deleted file mode 100644 index f22cf21..0000000 --- a/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\NormalizerFormatter; -use Monolog\Logger; - -/** - * Handler sending logs to Zend Monitor - * - * @author Christian Bergau - */ -class ZendMonitorHandler extends AbstractProcessingHandler -{ - /** - * Monolog level / ZendMonitor Custom Event priority map - * - * @var array - */ - protected $levelMap = array( - Logger::DEBUG => 1, - Logger::INFO => 2, - Logger::NOTICE => 3, - Logger::WARNING => 4, - Logger::ERROR => 5, - Logger::CRITICAL => 6, - Logger::ALERT => 7, - Logger::EMERGENCY => 0, - ); - - /** - * Construct - * - * @param int $level - * @param bool $bubble - * @throws MissingExtensionException - */ - public function __construct($level = Logger::DEBUG, $bubble = true) - { - if (!function_exists('zend_monitor_custom_event')) { - throw new MissingExtensionException('You must have Zend Server installed in order to use this handler'); - } - parent::__construct($level, $bubble); - } - - /** - * {@inheritdoc} - */ - protected function write(array $record) - { - $this->writeZendMonitorCustomEvent( - $this->levelMap[$record['level']], - $record['message'], - $record['formatted'] - ); - } - - /** - * Write a record to Zend Monitor - * - * @param int $level - * @param string $message - * @param array $formatted - */ - protected function writeZendMonitorCustomEvent($level, $message, $formatted) - { - zend_monitor_custom_event($level, $message, $formatted); - } - - /** - * {@inheritdoc} - */ - public function getDefaultFormatter() - { - return new NormalizerFormatter(); - } - - /** - * Get the level map - * - * @return array - */ - public function getLevelMap() - { - return $this->levelMap; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Logger.php b/vendor/monolog/monolog/src/Monolog/Logger.php deleted file mode 100644 index 49d00af..0000000 --- a/vendor/monolog/monolog/src/Monolog/Logger.php +++ /dev/null @@ -1,700 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Handler\HandlerInterface; -use Monolog\Handler\StreamHandler; -use Psr\Log\LoggerInterface; -use Psr\Log\InvalidArgumentException; - -/** - * Monolog log channel - * - * It contains a stack of Handlers and a stack of Processors, - * and uses them to store records that are added to it. - * - * @author Jordi Boggiano - */ -class Logger implements LoggerInterface -{ - /** - * Detailed debug information - */ - const DEBUG = 100; - - /** - * Interesting events - * - * Examples: User logs in, SQL logs. - */ - const INFO = 200; - - /** - * Uncommon events - */ - const NOTICE = 250; - - /** - * Exceptional occurrences that are not errors - * - * Examples: Use of deprecated APIs, poor use of an API, - * undesirable things that are not necessarily wrong. - */ - const WARNING = 300; - - /** - * Runtime errors - */ - const ERROR = 400; - - /** - * Critical conditions - * - * Example: Application component unavailable, unexpected exception. - */ - const CRITICAL = 500; - - /** - * Action must be taken immediately - * - * Example: Entire website down, database unavailable, etc. - * This should trigger the SMS alerts and wake you up. - */ - const ALERT = 550; - - /** - * Urgent alert. - */ - const EMERGENCY = 600; - - /** - * Monolog API version - * - * This is only bumped when API breaks are done and should - * follow the major version of the library - * - * @var int - */ - const API = 1; - - /** - * Logging levels from syslog protocol defined in RFC 5424 - * - * @var array $levels Logging levels - */ - protected static $levels = array( - self::DEBUG => 'DEBUG', - self::INFO => 'INFO', - self::NOTICE => 'NOTICE', - self::WARNING => 'WARNING', - self::ERROR => 'ERROR', - self::CRITICAL => 'CRITICAL', - self::ALERT => 'ALERT', - self::EMERGENCY => 'EMERGENCY', - ); - - /** - * @var \DateTimeZone - */ - protected static $timezone; - - /** - * @var string - */ - protected $name; - - /** - * The handler stack - * - * @var HandlerInterface[] - */ - protected $handlers; - - /** - * Processors that will process all log records - * - * To process records of a single handler instead, add the processor on that specific handler - * - * @var callable[] - */ - protected $processors; - - /** - * @var bool - */ - protected $microsecondTimestamps = true; - - /** - * @param string $name The logging channel - * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. - * @param callable[] $processors Optional array of processors - */ - public function __construct($name, array $handlers = array(), array $processors = array()) - { - $this->name = $name; - $this->handlers = $handlers; - $this->processors = $processors; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Return a new cloned instance with the name changed - * - * @return static - */ - public function withName($name) - { - $new = clone $this; - $new->name = $name; - - return $new; - } - - /** - * Pushes a handler on to the stack. - * - * @param HandlerInterface $handler - * @return $this - */ - public function pushHandler(HandlerInterface $handler) - { - array_unshift($this->handlers, $handler); - - return $this; - } - - /** - * Pops a handler from the stack - * - * @return HandlerInterface - */ - public function popHandler() - { - if (!$this->handlers) { - throw new \LogicException('You tried to pop from an empty handler stack.'); - } - - return array_shift($this->handlers); - } - - /** - * Set handlers, replacing all existing ones. - * - * If a map is passed, keys will be ignored. - * - * @param HandlerInterface[] $handlers - * @return $this - */ - public function setHandlers(array $handlers) - { - $this->handlers = array(); - foreach (array_reverse($handlers) as $handler) { - $this->pushHandler($handler); - } - - return $this; - } - - /** - * @return HandlerInterface[] - */ - public function getHandlers() - { - return $this->handlers; - } - - /** - * Adds a processor on to the stack. - * - * @param callable $callback - * @return $this - */ - public function pushProcessor($callback) - { - if (!is_callable($callback)) { - throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); - } - array_unshift($this->processors, $callback); - - return $this; - } - - /** - * Removes the processor on top of the stack and returns it. - * - * @return callable - */ - public function popProcessor() - { - if (!$this->processors) { - throw new \LogicException('You tried to pop from an empty processor stack.'); - } - - return array_shift($this->processors); - } - - /** - * @return callable[] - */ - public function getProcessors() - { - return $this->processors; - } - - /** - * Control the use of microsecond resolution timestamps in the 'datetime' - * member of new records. - * - * Generating microsecond resolution timestamps by calling - * microtime(true), formatting the result via sprintf() and then parsing - * the resulting string via \DateTime::createFromFormat() can incur - * a measurable runtime overhead vs simple usage of DateTime to capture - * a second resolution timestamp in systems which generate a large number - * of log events. - * - * @param bool $micro True to use microtime() to create timestamps - */ - public function useMicrosecondTimestamps($micro) - { - $this->microsecondTimestamps = (bool) $micro; - } - - /** - * Adds a log record. - * - * @param int $level The logging level - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addRecord($level, $message, array $context = array()) - { - if (!$this->handlers) { - $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG)); - } - - $levelName = static::getLevelName($level); - - // check if any handler will handle this message so we can return early and save cycles - $handlerKey = null; - reset($this->handlers); - while ($handler = current($this->handlers)) { - if ($handler->isHandling(array('level' => $level))) { - $handlerKey = key($this->handlers); - break; - } - - next($this->handlers); - } - - if (null === $handlerKey) { - return false; - } - - if (!static::$timezone) { - static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC'); - } - - // php7.1+ always has microseconds enabled, so we do not need this hack - if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) { - $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone); - } else { - $ts = new \DateTime(null, static::$timezone); - } - $ts->setTimezone(static::$timezone); - - $record = array( - 'message' => (string) $message, - 'context' => $context, - 'level' => $level, - 'level_name' => $levelName, - 'channel' => $this->name, - 'datetime' => $ts, - 'extra' => array(), - ); - - foreach ($this->processors as $processor) { - $record = call_user_func($processor, $record); - } - - while ($handler = current($this->handlers)) { - if (true === $handler->handle($record)) { - break; - } - - next($this->handlers); - } - - return true; - } - - /** - * Adds a log record at the DEBUG level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addDebug($message, array $context = array()) - { - return $this->addRecord(static::DEBUG, $message, $context); - } - - /** - * Adds a log record at the INFO level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addInfo($message, array $context = array()) - { - return $this->addRecord(static::INFO, $message, $context); - } - - /** - * Adds a log record at the NOTICE level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addNotice($message, array $context = array()) - { - return $this->addRecord(static::NOTICE, $message, $context); - } - - /** - * Adds a log record at the WARNING level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addWarning($message, array $context = array()) - { - return $this->addRecord(static::WARNING, $message, $context); - } - - /** - * Adds a log record at the ERROR level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addError($message, array $context = array()) - { - return $this->addRecord(static::ERROR, $message, $context); - } - - /** - * Adds a log record at the CRITICAL level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addCritical($message, array $context = array()) - { - return $this->addRecord(static::CRITICAL, $message, $context); - } - - /** - * Adds a log record at the ALERT level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addAlert($message, array $context = array()) - { - return $this->addRecord(static::ALERT, $message, $context); - } - - /** - * Adds a log record at the EMERGENCY level. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function addEmergency($message, array $context = array()) - { - return $this->addRecord(static::EMERGENCY, $message, $context); - } - - /** - * Gets all supported logging levels. - * - * @return array Assoc array with human-readable level names => level codes. - */ - public static function getLevels() - { - return array_flip(static::$levels); - } - - /** - * Gets the name of the logging level. - * - * @param int $level - * @return string - */ - public static function getLevelName($level) - { - if (!isset(static::$levels[$level])) { - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); - } - - return static::$levels[$level]; - } - - /** - * Converts PSR-3 levels to Monolog ones if necessary - * - * @param string|int Level number (monolog) or name (PSR-3) - * @return int - */ - public static function toMonologLevel($level) - { - if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) { - return constant(__CLASS__.'::'.strtoupper($level)); - } - - return $level; - } - - /** - * Checks whether the Logger has a handler that listens on the given level - * - * @param int $level - * @return Boolean - */ - public function isHandling($level) - { - $record = array( - 'level' => $level, - ); - - foreach ($this->handlers as $handler) { - if ($handler->isHandling($record)) { - return true; - } - } - - return false; - } - - /** - * Adds a log record at an arbitrary level. - * - * This method allows for compatibility with common interfaces. - * - * @param mixed $level The log level - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function log($level, $message, array $context = array()) - { - $level = static::toMonologLevel($level); - - return $this->addRecord($level, $message, $context); - } - - /** - * Adds a log record at the DEBUG level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function debug($message, array $context = array()) - { - return $this->addRecord(static::DEBUG, $message, $context); - } - - /** - * Adds a log record at the INFO level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function info($message, array $context = array()) - { - return $this->addRecord(static::INFO, $message, $context); - } - - /** - * Adds a log record at the NOTICE level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function notice($message, array $context = array()) - { - return $this->addRecord(static::NOTICE, $message, $context); - } - - /** - * Adds a log record at the WARNING level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function warn($message, array $context = array()) - { - return $this->addRecord(static::WARNING, $message, $context); - } - - /** - * Adds a log record at the WARNING level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function warning($message, array $context = array()) - { - return $this->addRecord(static::WARNING, $message, $context); - } - - /** - * Adds a log record at the ERROR level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function err($message, array $context = array()) - { - return $this->addRecord(static::ERROR, $message, $context); - } - - /** - * Adds a log record at the ERROR level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function error($message, array $context = array()) - { - return $this->addRecord(static::ERROR, $message, $context); - } - - /** - * Adds a log record at the CRITICAL level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function crit($message, array $context = array()) - { - return $this->addRecord(static::CRITICAL, $message, $context); - } - - /** - * Adds a log record at the CRITICAL level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function critical($message, array $context = array()) - { - return $this->addRecord(static::CRITICAL, $message, $context); - } - - /** - * Adds a log record at the ALERT level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function alert($message, array $context = array()) - { - return $this->addRecord(static::ALERT, $message, $context); - } - - /** - * Adds a log record at the EMERGENCY level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function emerg($message, array $context = array()) - { - return $this->addRecord(static::EMERGENCY, $message, $context); - } - - /** - * Adds a log record at the EMERGENCY level. - * - * This method allows for compatibility with common interfaces. - * - * @param string $message The log message - * @param array $context The log context - * @return Boolean Whether the record has been processed - */ - public function emergency($message, array $context = array()) - { - return $this->addRecord(static::EMERGENCY, $message, $context); - } - - /** - * Set the timezone to be used for the timestamp of log records. - * - * This is stored globally for all Logger instances - * - * @param \DateTimeZone $tz Timezone object - */ - public static function setTimezone(\DateTimeZone $tz) - { - self::$timezone = $tz; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php deleted file mode 100644 index 1899400..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\Logger; - -/** - * Injects Git branch and Git commit SHA in all records - * - * @author Nick Otter - * @author Jordi Boggiano - */ -class GitProcessor -{ - private $level; - private static $cache; - - public function __construct($level = Logger::DEBUG) - { - $this->level = Logger::toMonologLevel($level); - } - - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - // return if the level is not high enough - if ($record['level'] < $this->level) { - return $record; - } - - $record['extra']['git'] = self::getGitInfo(); - - return $record; - } - - private static function getGitInfo() - { - if (self::$cache) { - return self::$cache; - } - - $branches = `git branch -v --no-abbrev`; - if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { - return self::$cache = array( - 'branch' => $matches[1], - 'commit' => $matches[2], - ); - } - - return self::$cache = array(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php deleted file mode 100644 index 2c07cae..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\Logger; - -/** - * Injects line/file:class/function where the log message came from - * - * Warning: This only works if the handler processes the logs directly. - * If you put the processor on a handler that is behind a FingersCrossedHandler - * for example, the processor will only be called once the trigger level is reached, - * and all the log records will have the same file/line/.. data from the call that - * triggered the FingersCrossedHandler. - * - * @author Jordi Boggiano - */ -class IntrospectionProcessor -{ - private $level; - - private $skipClassesPartials; - - private $skipStackFramesCount; - - private $skipFunctions = array( - 'call_user_func', - 'call_user_func_array', - ); - - public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0) - { - $this->level = Logger::toMonologLevel($level); - $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials); - $this->skipStackFramesCount = $skipStackFramesCount; - } - - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - // return if the level is not high enough - if ($record['level'] < $this->level) { - return $record; - } - - /* - * http://php.net/manual/en/function.debug-backtrace.php - * As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. - * Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. - */ - $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); - - // skip first since it's always the current method - array_shift($trace); - // the call_user_func call is also skipped - array_shift($trace); - - $i = 0; - - while ($this->isTraceClassOrSkippedFunction($trace, $i)) { - if (isset($trace[$i]['class'])) { - foreach ($this->skipClassesPartials as $part) { - if (strpos($trace[$i]['class'], $part) !== false) { - $i++; - continue 2; - } - } - } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { - $i++; - continue; - } - - break; - } - - $i += $this->skipStackFramesCount; - - // we should have the call source now - $record['extra'] = array_merge( - $record['extra'], - array( - 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, - 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, - 'class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : null, - 'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null, - ) - ); - - return $record; - } - - private function isTraceClassOrSkippedFunction(array $trace, $index) - { - if (!isset($trace[$index])) { - return false; - } - - return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php deleted file mode 100644 index 0543e92..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Injects memory_get_peak_usage in all records - * - * @see Monolog\Processor\MemoryProcessor::__construct() for options - * @author Rob Jensen - */ -class MemoryPeakUsageProcessor extends MemoryProcessor -{ - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - $bytes = memory_get_peak_usage($this->realUsage); - $formatted = $this->formatBytes($bytes); - - $record['extra']['memory_peak_usage'] = $formatted; - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php deleted file mode 100644 index 85f9dc5..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Some methods that are common for all memory processors - * - * @author Rob Jensen - */ -abstract class MemoryProcessor -{ - /** - * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. - */ - protected $realUsage; - - /** - * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) - */ - protected $useFormatting; - - /** - * @param bool $realUsage Set this to true to get the real size of memory allocated from system. - * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) - */ - public function __construct($realUsage = true, $useFormatting = true) - { - $this->realUsage = (boolean) $realUsage; - $this->useFormatting = (boolean) $useFormatting; - } - - /** - * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is - * - * @param int $bytes - * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is - */ - protected function formatBytes($bytes) - { - $bytes = (int) $bytes; - - if (!$this->useFormatting) { - return $bytes; - } - - if ($bytes > 1024 * 1024) { - return round($bytes / 1024 / 1024, 2).' MB'; - } elseif ($bytes > 1024) { - return round($bytes / 1024, 2).' KB'; - } - - return $bytes . ' B'; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php deleted file mode 100644 index 2783d65..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Injects memory_get_usage in all records - * - * @see Monolog\Processor\MemoryProcessor::__construct() for options - * @author Rob Jensen - */ -class MemoryUsageProcessor extends MemoryProcessor -{ - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - $bytes = memory_get_usage($this->realUsage); - $formatted = $this->formatBytes($bytes); - - $record['extra']['memory_usage'] = $formatted; - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php deleted file mode 100644 index 7c07a7e..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\Logger; - -/** - * Injects Hg branch and Hg revision number in all records - * - * @author Jonathan A. Schweder - */ -class MercurialProcessor -{ - private $level; - private static $cache; - - public function __construct($level = Logger::DEBUG) - { - $this->level = Logger::toMonologLevel($level); - } - - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - // return if the level is not high enough - if ($record['level'] < $this->level) { - return $record; - } - - $record['extra']['hg'] = self::getMercurialInfo(); - - return $record; - } - - private static function getMercurialInfo() - { - if (self::$cache) { - return self::$cache; - } - - $result = explode(' ', trim(`hg id -nb`)); - if (count($result) >= 3) { - return self::$cache = array( - 'branch' => $result[1], - 'revision' => $result[2], - ); - } - - return self::$cache = array(); - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php deleted file mode 100644 index 9d3f559..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Adds value of getmypid into records - * - * @author Andreas Hörnicke - */ -class ProcessIdProcessor -{ - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - $record['extra']['process_id'] = getmypid(); - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php deleted file mode 100644 index c2686ce..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Processes a record's message according to PSR-3 rules - * - * It replaces {foo} with the value from $context['foo'] - * - * @author Jordi Boggiano - */ -class PsrLogMessageProcessor -{ - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - if (false === strpos($record['message'], '{')) { - return $record; - } - - $replacements = array(); - foreach ($record['context'] as $key => $val) { - if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { - $replacements['{'.$key.'}'] = $val; - } elseif (is_object($val)) { - $replacements['{'.$key.'}'] = '[object '.get_class($val).']'; - } else { - $replacements['{'.$key.'}'] = '['.gettype($val).']'; - } - } - - $record['message'] = strtr($record['message'], $replacements); - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php deleted file mode 100644 index 7e2df2a..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Adds a tags array into record - * - * @author Martijn Riemers - */ -class TagProcessor -{ - private $tags; - - public function __construct(array $tags = array()) - { - $this->setTags($tags); - } - - public function addTags(array $tags = array()) - { - $this->tags = array_merge($this->tags, $tags); - } - - public function setTags(array $tags = array()) - { - $this->tags = $tags; - } - - public function __invoke(array $record) - { - $record['extra']['tags'] = $this->tags; - - return $record; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php deleted file mode 100644 index 812707c..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Adds a unique identifier into records - * - * @author Simon Mönch - */ -class UidProcessor -{ - private $uid; - - public function __construct($length = 7) - { - if (!is_int($length) || $length > 32 || $length < 1) { - throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); - } - - $this->uid = substr(hash('md5', uniqid('', true)), 0, $length); - } - - public function __invoke(array $record) - { - $record['extra']['uid'] = $this->uid; - - return $record; - } - - /** - * @return string - */ - public function getUid() - { - return $this->uid; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php deleted file mode 100644 index ea1d897..0000000 --- a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -/** - * Injects url/method and remote IP of the current web request in all records - * - * @author Jordi Boggiano - */ -class WebProcessor -{ - /** - * @var array|\ArrayAccess - */ - protected $serverData; - - /** - * Default fields - * - * Array is structured as [key in record.extra => key in $serverData] - * - * @var array - */ - protected $extraFields = array( - 'url' => 'REQUEST_URI', - 'ip' => 'REMOTE_ADDR', - 'http_method' => 'REQUEST_METHOD', - 'server' => 'SERVER_NAME', - 'referrer' => 'HTTP_REFERER', - ); - - /** - * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data - * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer - */ - public function __construct($serverData = null, array $extraFields = null) - { - if (null === $serverData) { - $this->serverData = &$_SERVER; - } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { - $this->serverData = $serverData; - } else { - throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); - } - - if (null !== $extraFields) { - if (isset($extraFields[0])) { - foreach (array_keys($this->extraFields) as $fieldName) { - if (!in_array($fieldName, $extraFields)) { - unset($this->extraFields[$fieldName]); - } - } - } else { - $this->extraFields = $extraFields; - } - } - } - - /** - * @param array $record - * @return array - */ - public function __invoke(array $record) - { - // skip processing if for some reason request data - // is not present (CLI or wonky SAPIs) - if (!isset($this->serverData['REQUEST_URI'])) { - return $record; - } - - $record['extra'] = $this->appendExtraFields($record['extra']); - - return $record; - } - - /** - * @param string $extraName - * @param string $serverName - * @return $this - */ - public function addExtraField($extraName, $serverName) - { - $this->extraFields[$extraName] = $serverName; - - return $this; - } - - /** - * @param array $extra - * @return array - */ - private function appendExtraFields(array $extra) - { - foreach ($this->extraFields as $extraName => $serverName) { - $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null; - } - - if (isset($this->serverData['UNIQUE_ID'])) { - $extra['unique_id'] = $this->serverData['UNIQUE_ID']; - } - - return $extra; - } -} diff --git a/vendor/monolog/monolog/src/Monolog/Registry.php b/vendor/monolog/monolog/src/Monolog/Registry.php deleted file mode 100644 index 159b751..0000000 --- a/vendor/monolog/monolog/src/Monolog/Registry.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use InvalidArgumentException; - -/** - * Monolog log registry - * - * Allows to get `Logger` instances in the global scope - * via static method calls on this class. - * - * - * $application = new Monolog\Logger('application'); - * $api = new Monolog\Logger('api'); - * - * Monolog\Registry::addLogger($application); - * Monolog\Registry::addLogger($api); - * - * function testLogger() - * { - * Monolog\Registry::api()->addError('Sent to $api Logger instance'); - * Monolog\Registry::application()->addError('Sent to $application Logger instance'); - * } - * - * - * @author Tomas Tatarko - */ -class Registry -{ - /** - * List of all loggers in the registry (by named indexes) - * - * @var Logger[] - */ - private static $loggers = array(); - - /** - * Adds new logging channel to the registry - * - * @param Logger $logger Instance of the logging channel - * @param string|null $name Name of the logging channel ($logger->getName() by default) - * @param bool $overwrite Overwrite instance in the registry if the given name already exists? - * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists - */ - public static function addLogger(Logger $logger, $name = null, $overwrite = false) - { - $name = $name ?: $logger->getName(); - - if (isset(self::$loggers[$name]) && !$overwrite) { - throw new InvalidArgumentException('Logger with the given name already exists'); - } - - self::$loggers[$name] = $logger; - } - - /** - * Checks if such logging channel exists by name or instance - * - * @param string|Logger $logger Name or logger instance - */ - public static function hasLogger($logger) - { - if ($logger instanceof Logger) { - $index = array_search($logger, self::$loggers, true); - - return false !== $index; - } else { - return isset(self::$loggers[$logger]); - } - } - - /** - * Removes instance from registry by name or instance - * - * @param string|Logger $logger Name or logger instance - */ - public static function removeLogger($logger) - { - if ($logger instanceof Logger) { - if (false !== ($idx = array_search($logger, self::$loggers, true))) { - unset(self::$loggers[$idx]); - } - } else { - unset(self::$loggers[$logger]); - } - } - - /** - * Clears the registry - */ - public static function clear() - { - self::$loggers = array(); - } - - /** - * Gets Logger instance from the registry - * - * @param string $name Name of the requested Logger instance - * @throws \InvalidArgumentException If named Logger instance is not in the registry - * @return Logger Requested instance of Logger - */ - public static function getInstance($name) - { - if (!isset(self::$loggers[$name])) { - throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); - } - - return self::$loggers[$name]; - } - - /** - * Gets Logger instance from the registry via static method call - * - * @param string $name Name of the requested Logger instance - * @param array $arguments Arguments passed to static method call - * @throws \InvalidArgumentException If named Logger instance is not in the registry - * @return Logger Requested instance of Logger - */ - public static function __callStatic($name, $arguments) - { - return self::getInstance($name); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php deleted file mode 100644 index a9a3f30..0000000 --- a/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Handler\TestHandler; - -class ErrorHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testHandleError() - { - $logger = new Logger('test', array($handler = new TestHandler)); - $errHandler = new ErrorHandler($logger); - - $errHandler->registerErrorHandler(array(E_USER_NOTICE => Logger::EMERGENCY), false); - trigger_error('Foo', E_USER_ERROR); - $this->assertCount(1, $handler->getRecords()); - $this->assertTrue($handler->hasErrorRecords()); - trigger_error('Foo', E_USER_NOTICE); - $this->assertCount(2, $handler->getRecords()); - $this->assertTrue($handler->hasEmergencyRecords()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php deleted file mode 100644 index 71c4204..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testDefaultFormat() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - array( - 'message' => 'log', - 'context' => array('from' => 'logger'), - 'extra' => array('ip' => '127.0.0.1'), - ), - 'unknown', - 'error', - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::CRITICAL, - 'level_name' => 'CRITICAL', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - array( - 'message' => 'log', - 'context' => array('from' => 'logger'), - 'extra' => array('ip' => '127.0.0.1'), - ), - 'test : 14', - 'error', - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::format - */ - public function testFormatWithoutContext() - { - $formatter = new ChromePHPFormatter(); - $record = array( - 'level' => Logger::DEBUG, - 'level_name' => 'DEBUG', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertEquals( - array( - 'meh', - 'log', - 'unknown', - 'log', - ), - $message - ); - } - - /** - * @covers Monolog\Formatter\ChromePHPFormatter::formatBatch - */ - public function testBatchFormatThrowException() - { - $formatter = new ChromePHPFormatter(); - $records = array( - array( - 'level' => Logger::INFO, - 'level_name' => 'INFO', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ), - array( - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log2', - ), - ); - - $this->assertEquals( - array( - array( - 'meh', - 'log', - 'unknown', - 'info', - ), - array( - 'foo', - 'log2', - 'unknown', - 'warn', - ), - ), - $formatter->formatBatch($records) - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php deleted file mode 100644 index 90cc48d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists("Elastica\Document")) { - $this->markTestSkipped("ruflin/elastica not installed"); - } - } - - /** - * @covers Monolog\Formatter\ElasticaFormatter::__construct - * @covers Monolog\Formatter\ElasticaFormatter::format - * @covers Monolog\Formatter\ElasticaFormatter::getDocument - */ - public function testFormat() - { - // test log message - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - // expected values - $expected = $msg; - $expected['datetime'] = '1970-01-01T00:00:00.000000+00:00'; - $expected['context'] = array( - 'class' => '[object] (stdClass: {})', - 'foo' => 7, - 0 => 'bar', - ); - - // format log message - $formatter = new ElasticaFormatter('my_index', 'doc_type'); - $doc = $formatter->format($msg); - $this->assertInstanceOf('Elastica\Document', $doc); - - // Document parameters - $params = $doc->getParams(); - $this->assertEquals('my_index', $params['_index']); - $this->assertEquals('doc_type', $params['_type']); - - // Document data values - $data = $doc->getData(); - foreach (array_keys($expected) as $key) { - $this->assertEquals($expected[$key], $data[$key]); - } - } - - /** - * @covers Monolog\Formatter\ElasticaFormatter::getIndex - * @covers Monolog\Formatter\ElasticaFormatter::getType - */ - public function testGetters() - { - $formatter = new ElasticaFormatter('my_index', 'doc_type'); - $this->assertEquals('my_index', $formatter->getIndex()); - $this->assertEquals('doc_type', $formatter->getType()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php deleted file mode 100644 index 1b2fd97..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Monolog\TestCase; - -class FlowdockFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\FlowdockFormatter::format - */ - public function testFormat() - { - $formatter = new FlowdockFormatter('test_source', 'source@test.com'); - $record = $this->getRecord(); - - $expected = array( - 'source' => 'test_source', - 'from_address' => 'source@test.com', - 'subject' => 'in test_source: WARNING - test', - 'content' => 'test', - 'tags' => array('#logs', '#warning', '#test'), - 'project' => 'test_source', - ); - $formatted = $formatter->format($record); - - $this->assertEquals($expected, $formatted['flowdock']); - } - - /** - * @ covers Monolog\Formatter\FlowdockFormatter::formatBatch - */ - public function testFormatBatch() - { - $formatter = new FlowdockFormatter('test_source', 'source@test.com'); - $records = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - $formatted = $formatter->formatBatch($records); - - $this->assertArrayHasKey('flowdock', $formatted[0]); - $this->assertArrayHasKey('flowdock', $formatted[1]); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php deleted file mode 100644 index 622b2ba..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Monolog\TestCase; - -class FluentdFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\FluentdFormatter::__construct - * @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag - */ - public function testConstruct() - { - $formatter = new FluentdFormatter(); - $this->assertEquals(false, $formatter->isUsingLevelsInTag()); - $formatter = new FluentdFormatter(false); - $this->assertEquals(false, $formatter->isUsingLevelsInTag()); - $formatter = new FluentdFormatter(true); - $this->assertEquals(true, $formatter->isUsingLevelsInTag()); - } - - /** - * @covers Monolog\Formatter\FluentdFormatter::format - */ - public function testFormat() - { - $record = $this->getRecord(Logger::WARNING); - $record['datetime'] = new \DateTime("@0"); - - $formatter = new FluentdFormatter(); - $this->assertEquals( - '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]', - $formatter->format($record) - ); - } - - /** - * @covers Monolog\Formatter\FluentdFormatter::format - */ - public function testFormatWithTag() - { - $record = $this->getRecord(Logger::ERROR); - $record['datetime'] = new \DateTime("@0"); - - $formatter = new FluentdFormatter(true); - $this->assertEquals( - '["test.error",0,{"message":"test","extra":[]}]', - $formatter->format($record) - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php deleted file mode 100644 index 4a24761..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php +++ /dev/null @@ -1,258 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists('\Gelf\Message')) { - $this->markTestSkipped("graylog2/gelf-php or mlehner/gelf-php is not installed"); - } - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testDefaultFormatter() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals(0, $message->getTimestamp()); - $this->assertEquals('log', $message->getShortMessage()); - $this->assertEquals('meh', $message->getFacility()); - $this->assertEquals(null, $message->getLine()); - $this->assertEquals(null, $message->getFile()); - $this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel()); - $this->assertNotEmpty($message->getHost()); - - $formatter = new GelfMessageFormatter('mysystem'); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals('mysystem', $message->getHost()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - $this->assertEquals('test', $message->getFile()); - $this->assertEquals(14, $message->getLine()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - * @expectedException InvalidArgumentException - */ - public function testFormatInvalidFails() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - ); - - $formatter->format($record); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithContext() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_ctxt_from', $message_array); - $this->assertEquals('logger', $message_array['_ctxt_from']); - - // Test with extraPrefix - $formatter = new GelfMessageFormatter(null, null, 'CTX'); - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_CTXfrom', $message_array); - $this->assertEquals('logger', $message_array['_CTXfrom']); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithContextContainingException() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger', 'exception' => array( - 'class' => '\Exception', - 'file' => '/some/file/in/dir.php:56', - 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'), - )), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $this->assertEquals("/some/file/in/dir.php", $message->getFile()); - $this->assertEquals("56", $message->getLine()); - } - - /** - * @covers Monolog\Formatter\GelfMessageFormatter::format - */ - public function testFormatWithExtra() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_key', $message_array); - $this->assertEquals('pair', $message_array['_key']); - - // Test with extraPrefix - $formatter = new GelfMessageFormatter(null, 'EXT'); - $message = $formatter->format($record); - - $this->assertInstanceOf('Gelf\Message', $message); - - $message_array = $message->toArray(); - - $this->assertArrayHasKey('_EXTkey', $message_array); - $this->assertEquals('pair', $message_array['_EXTkey']); - } - - public function testFormatWithLargeData() - { - $formatter = new GelfMessageFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('exception' => str_repeat(' ', 32767)), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => str_repeat(' ', 32767)), - 'message' => 'log' - ); - $message = $formatter->format($record); - $messageArray = $message->toArray(); - - // 200 for padding + metadata - $length = 200; - - foreach ($messageArray as $key => $value) { - if (!in_array($key, array('level', 'timestamp'))) { - $length += strlen($value); - } - } - - $this->assertLessThanOrEqual(65792, $length, 'The message length is no longer than the maximum allowed length'); - } - - public function testFormatWithUnlimitedLength() - { - $formatter = new GelfMessageFormatter('LONG_SYSTEM_NAME', null, 'ctxt_', PHP_INT_MAX); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('exception' => str_repeat(' ', 32767 * 2)), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => str_repeat(' ', 32767 * 2)), - 'message' => 'log' - ); - $message = $formatter->format($record); - $messageArray = $message->toArray(); - - // 200 for padding + metadata - $length = 200; - - foreach ($messageArray as $key => $value) { - if (!in_array($key, array('level', 'timestamp'))) { - $length += strlen($value); - } - } - - $this->assertGreaterThanOrEqual(131289, $length, 'The message should not be truncated'); - } - - private function isLegacy() - { - return interface_exists('\Gelf\IMessagePublisher'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php deleted file mode 100644 index c9445f3..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php +++ /dev/null @@ -1,183 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; -use Monolog\TestCase; - -class JsonFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\JsonFormatter::__construct - * @covers Monolog\Formatter\JsonFormatter::getBatchMode - * @covers Monolog\Formatter\JsonFormatter::isAppendingNewlines - */ - public function testConstruct() - { - $formatter = new JsonFormatter(); - $this->assertEquals(JsonFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); - $this->assertEquals(true, $formatter->isAppendingNewlines()); - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES, false); - $this->assertEquals(JsonFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); - $this->assertEquals(false, $formatter->isAppendingNewlines()); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::format - */ - public function testFormat() - { - $formatter = new JsonFormatter(); - $record = $this->getRecord(); - $this->assertEquals(json_encode($record)."\n", $formatter->format($record)); - - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); - $record = $this->getRecord(); - $this->assertEquals(json_encode($record), $formatter->format($record)); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::formatBatch - * @covers Monolog\Formatter\JsonFormatter::formatBatchJson - */ - public function testFormatBatch() - { - $formatter = new JsonFormatter(); - $records = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - $this->assertEquals(json_encode($records), $formatter->formatBatch($records)); - } - - /** - * @covers Monolog\Formatter\JsonFormatter::formatBatch - * @covers Monolog\Formatter\JsonFormatter::formatBatchNewlines - */ - public function testFormatBatchNewlines() - { - $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES); - $records = $expected = array( - $this->getRecord(Logger::WARNING), - $this->getRecord(Logger::DEBUG), - ); - array_walk($expected, function (&$value, $key) { - $value = json_encode($value); - }); - $this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records)); - } - - public function testDefFormatWithException() - { - $formatter = new JsonFormatter(); - $exception = new \RuntimeException('Foo'); - $formattedException = $this->formatException($exception); - - $message = $this->formatRecordWithExceptionInContext($formatter, $exception); - - $this->assertContextContainsFormattedException($formattedException, $message); - } - - public function testDefFormatWithPreviousException() - { - $formatter = new JsonFormatter(); - $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?')); - $formattedPrevException = $this->formatException($exception->getPrevious()); - $formattedException = $this->formatException($exception, $formattedPrevException); - - $message = $this->formatRecordWithExceptionInContext($formatter, $exception); - - $this->assertContextContainsFormattedException($formattedException, $message); - } - - public function testDefFormatWithThrowable() - { - if (!class_exists('Error') || !is_subclass_of('Error', 'Throwable')) { - $this->markTestSkipped('Requires PHP >=7'); - } - - $formatter = new JsonFormatter(); - $throwable = new \Error('Foo'); - $formattedThrowable = $this->formatException($throwable); - - $message = $this->formatRecordWithExceptionInContext($formatter, $throwable); - - $this->assertContextContainsFormattedException($formattedThrowable, $message); - } - - /** - * @param string $expected - * @param string $actual - * - * @internal param string $exception - */ - private function assertContextContainsFormattedException($expected, $actual) - { - $this->assertEquals( - '{"level_name":"CRITICAL","channel":"core","context":{"exception":'.$expected.'},"datetime":null,"extra":[],"message":"foobar"}'."\n", - $actual - ); - } - - /** - * @param JsonFormatter $formatter - * @param \Exception|\Throwable $exception - * - * @return string - */ - private function formatRecordWithExceptionInContext(JsonFormatter $formatter, $exception) - { - $message = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'core', - 'context' => array('exception' => $exception), - 'datetime' => null, - 'extra' => array(), - 'message' => 'foobar', - )); - return $message; - } - - /** - * @param \Exception|\Throwable $exception - * - * @return string - */ - private function formatExceptionFilePathWithLine($exception) - { - $options = 0; - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; - } - $path = substr(json_encode($exception->getFile(), $options), 1, -1); - return $path . ':' . $exception->getLine(); - } - - /** - * @param \Exception|\Throwable $exception - * - * @param null|string $previous - * - * @return string - */ - private function formatException($exception, $previous = null) - { - $formattedException = - '{"class":"' . get_class($exception) . - '","message":"' . $exception->getMessage() . - '","code":' . $exception->getCode() . - ',"file":"' . $this->formatExceptionFilePathWithLine($exception) . - ($previous ? '","previous":' . $previous : '"') . - '}'; - return $formattedException; - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php deleted file mode 100644 index 310d93c..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php +++ /dev/null @@ -1,222 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * @covers Monolog\Formatter\LineFormatter - */ -class LineFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function testDefFormatWithString() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'context' => array(), - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array(), - )); - $this->assertEquals('['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); - } - - public function testDefFormatWithArrayContext() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array(), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'bool' => false, - 'null' => null, - ), - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message); - } - - public function testDefFormatExtras() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] {"ip":"127.0.0.1"}'."\n", $message); - } - - public function testFormatExtras() - { - $formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n", 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test'), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'."\n", $message); - } - - public function testContextAndExtraOptionallyNotShownIfEmpty() - { - $formatter = new LineFormatter(null, 'Y-m-d', false, true); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'log', - )); - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message); - } - - public function testContextAndExtraReplacement() - { - $formatter = new LineFormatter('%context.foo% => %extra.foo%'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 'bar'), - 'datetime' => new \DateTime, - 'extra' => array('foo' => 'xbar'), - 'message' => 'log', - )); - $this->assertEquals('bar => xbar', $message); - } - - public function testDefFormatWithObject() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), - 'message' => 'foobar', - )); - - $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'."\n", $message); - } - - public function testDefFormatWithException() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'core', - 'context' => array('exception' => new \RuntimeException('Foo')), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'foobar', - )); - - $path = str_replace('\\/', '/', json_encode(__FILE__)); - - $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message); - } - - public function testDefFormatWithPreviousException() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $previous = new \LogicException('Wut?'); - $message = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'core', - 'context' => array('exception' => new \RuntimeException('Foo', 0, $previous)), - 'datetime' => new \DateTime, - 'extra' => array(), - 'message' => 'foobar', - )); - - $path = str_replace('\\/', '/', json_encode(__FILE__)); - - $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__ - 12).')"} []'."\n", $message); - } - - public function testBatchFormat() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->formatBatch(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - )); - $this->assertEquals('['.date('Y-m-d').'] test.CRITICAL: bar [] []'."\n".'['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); - } - - public function testFormatShouldStripInlineLineBreaks() - { - $formatter = new LineFormatter(null, 'Y-m-d'); - $message = $formatter->format( - array( - 'message' => "foo\nbar", - 'context' => array(), - 'extra' => array(), - ) - ); - - $this->assertRegExp('/foo bar/', $message); - } - - public function testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet() - { - $formatter = new LineFormatter(null, 'Y-m-d', true); - $message = $formatter->format( - array( - 'message' => "foo\nbar", - 'context' => array(), - 'extra' => array(), - ) - ); - - $this->assertRegExp('/foo\nbar/', $message); - } -} - -class TestFoo -{ - public $foo = 'foo'; -} - -class TestBar -{ - public function __toString() - { - return 'bar'; - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php deleted file mode 100644 index 6d59b3f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\TestCase; - -class LogglyFormatterTest extends TestCase -{ - /** - * @covers Monolog\Formatter\LogglyFormatter::__construct - */ - public function testConstruct() - { - $formatter = new LogglyFormatter(); - $this->assertEquals(LogglyFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); - $formatter = new LogglyFormatter(LogglyFormatter::BATCH_MODE_JSON); - $this->assertEquals(LogglyFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); - } - - /** - * @covers Monolog\Formatter\LogglyFormatter::format - */ - public function testFormat() - { - $formatter = new LogglyFormatter(); - $record = $this->getRecord(); - $formatted_decoded = json_decode($formatter->format($record), true); - $this->assertArrayHasKey("timestamp", $formatted_decoded); - $this->assertEquals(new \DateTime($formatted_decoded["timestamp"]), $record["datetime"]); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php deleted file mode 100644 index 9f6b1cc..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php +++ /dev/null @@ -1,333 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class LogstashFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function tearDown() - { - \PHPUnit_Framework_Error_Warning::$enabled = true; - - return parent::tearDown(); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testDefaultFormatter() - { - $formatter = new LogstashFormatter('test', 'hostname'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); - $this->assertEquals('log', $message['@message']); - $this->assertEquals('meh', $message['@fields']['channel']); - $this->assertContains('meh', $message['@tags']); - $this->assertEquals(Logger::ERROR, $message['@fields']['level']); - $this->assertEquals('test', $message['@type']); - $this->assertEquals('hostname', $message['@source']); - - $formatter = new LogstashFormatter('mysystem'); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('mysystem', $message['@type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithFileAndLine() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('test', $message['@fields']['file']); - $this->assertEquals(14, $message['@fields']['line']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithContext() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('ctxt_from', $message_array); - $this->assertEquals('logger', $message_array['ctxt_from']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, null, 'CTX'); - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('CTXfrom', $message_array); - $this->assertEquals('logger', $message_array['CTXfrom']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithExtra() - { - $formatter = new LogstashFormatter('test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('key', $message_array); - $this->assertEquals('pair', $message_array['key']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, 'EXT'); - $message = json_decode($formatter->format($record), true); - - $message_array = $message['@fields']; - - $this->assertArrayHasKey('EXTkey', $message_array); - $this->assertEquals('pair', $message_array['EXTkey']); - } - - public function testFormatWithApplicationName() - { - $formatter = new LogstashFormatter('app', 'test'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('@type', $message); - $this->assertEquals('app', $message['@type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testDefaultFormatterV1() - { - $formatter = new LogstashFormatter('test', 'hostname', null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); - $this->assertEquals("1", $message['@version']); - $this->assertEquals('log', $message['message']); - $this->assertEquals('meh', $message['channel']); - $this->assertEquals('ERROR', $message['level']); - $this->assertEquals('test', $message['type']); - $this->assertEquals('hostname', $message['host']); - - $formatter = new LogstashFormatter('mysystem', null, null, 'ctxt_', LogstashFormatter::V1); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('mysystem', $message['type']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithFileAndLineV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals('test', $message['file']); - $this->assertEquals(14, $message['line']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithContextV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('ctxt_from', $message); - $this->assertEquals('logger', $message['ctxt_from']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, null, 'CTX', LogstashFormatter::V1); - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('CTXfrom', $message); - $this->assertEquals('logger', $message['CTXfrom']); - } - - /** - * @covers Monolog\Formatter\LogstashFormatter::format - */ - public function testFormatWithExtraV1() - { - $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('key', $message); - $this->assertEquals('pair', $message['key']); - - // Test with extraPrefix - $formatter = new LogstashFormatter('test', null, 'EXT', 'ctxt_', LogstashFormatter::V1); - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('EXTkey', $message); - $this->assertEquals('pair', $message['EXTkey']); - } - - public function testFormatWithApplicationNameV1() - { - $formatter = new LogstashFormatter('app', 'test', null, 'ctxt_', LogstashFormatter::V1); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('key' => 'pair'), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertArrayHasKey('type', $message); - $this->assertEquals('app', $message['type']); - } - - public function testFormatWithLatin9Data() - { - if (version_compare(PHP_VERSION, '5.5.0', '<')) { - // Ignore the warning that will be emitted by PHP <5.5.0 - \PHPUnit_Framework_Error_Warning::$enabled = false; - } - $formatter = new LogstashFormatter('test', 'hostname'); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => '¯\_(ツ)_/¯', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array( - 'user_agent' => "\xD6WN; FBCR/OrangeEspa\xF1a; Vers\xE3o/4.0; F\xE4rist", - ), - 'message' => 'log', - ); - - $message = json_decode($formatter->format($record), true); - - $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); - $this->assertEquals('log', $message['@message']); - $this->assertEquals('¯\_(ツ)_/¯', $message['@fields']['channel']); - $this->assertContains('¯\_(ツ)_/¯', $message['@tags']); - $this->assertEquals(Logger::ERROR, $message['@fields']['level']); - $this->assertEquals('test', $message['@type']); - $this->assertEquals('hostname', $message['@source']); - if (version_compare(PHP_VERSION, '5.5.0', '>=')) { - $this->assertEquals('ÖWN; FBCR/OrangeEspaña; Versão/4.0; Färist', $message['@fields']['user_agent']); - } else { - // PHP <5.5 does not return false for an element encoding failure, - // instead it emits a warning (possibly) and nulls the value. - $this->assertEquals(null, $message['@fields']['user_agent']); - } - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php deleted file mode 100644 index 52e699e..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php +++ /dev/null @@ -1,262 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -/** - * @author Florian Plattner - */ -class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function setUp() - { - if (!class_exists('MongoDate')) { - $this->markTestSkipped('mongo extension not installed'); - } - } - - public function constructArgumentProvider() - { - return array( - array(1, true, 1, true), - array(0, false, 0, false), - ); - } - - /** - * @param $traceDepth - * @param $traceAsString - * @param $expectedTraceDepth - * @param $expectedTraceAsString - * - * @dataProvider constructArgumentProvider - */ - public function testConstruct($traceDepth, $traceAsString, $expectedTraceDepth, $expectedTraceAsString) - { - $formatter = new MongoDBFormatter($traceDepth, $traceAsString); - - $reflTrace = new \ReflectionProperty($formatter, 'exceptionTraceAsString'); - $reflTrace->setAccessible(true); - $this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter)); - - $reflDepth = new\ReflectionProperty($formatter, 'maxNestingLevel'); - $reflDepth->setAccessible(true); - $this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter)); - } - - public function testSimpleFormat() - { - $record = array( - 'message' => 'some log message', - 'context' => array(), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(); - $formattedRecord = $formatter->format($record); - - $this->assertCount(7, $formattedRecord); - $this->assertEquals('some log message', $formattedRecord['message']); - $this->assertEquals(array(), $formattedRecord['context']); - $this->assertEquals(Logger::WARNING, $formattedRecord['level']); - $this->assertEquals(Logger::getLevelName(Logger::WARNING), $formattedRecord['level_name']); - $this->assertEquals('test', $formattedRecord['channel']); - $this->assertInstanceOf('\MongoDate', $formattedRecord['datetime']); - $this->assertEquals('0.00000000 1391212800', $formattedRecord['datetime']->__toString()); - $this->assertEquals(array(), $formattedRecord['extra']); - } - - public function testRecursiveFormat() - { - $someObject = new \stdClass(); - $someObject->foo = 'something'; - $someObject->bar = 'stuff'; - - $record = array( - 'message' => 'some log message', - 'context' => array( - 'stuff' => new \DateTime('2014-02-01 02:31:33'), - 'some_object' => $someObject, - 'context_string' => 'some string', - 'context_int' => 123456, - 'except' => new \Exception('exception message', 987), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(); - $formattedRecord = $formatter->format($record); - - $this->assertCount(5, $formattedRecord['context']); - $this->assertInstanceOf('\MongoDate', $formattedRecord['context']['stuff']); - $this->assertEquals('0.00000000 1391221893', $formattedRecord['context']['stuff']->__toString()); - $this->assertEquals( - array( - 'foo' => 'something', - 'bar' => 'stuff', - 'class' => 'stdClass', - ), - $formattedRecord['context']['some_object'] - ); - $this->assertEquals('some string', $formattedRecord['context']['context_string']); - $this->assertEquals(123456, $formattedRecord['context']['context_int']); - - $this->assertCount(5, $formattedRecord['context']['except']); - $this->assertEquals('exception message', $formattedRecord['context']['except']['message']); - $this->assertEquals(987, $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['file']); - $this->assertInternalType('integer', $formattedRecord['context']['except']['code']); - $this->assertInternalType('string', $formattedRecord['context']['except']['trace']); - $this->assertEquals('Exception', $formattedRecord['context']['except']['class']); - } - - public function testFormatDepthArray() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => array( - 'nest4' => 'value', - 'property' => 'nothing', - ), - ), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => '[...]', - ), - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthArrayInfiniteNesting() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => array( - 'property' => 'something', - 'nest3' => array( - 'property' => 'anything', - 'nest4' => array( - 'property' => 'nothing', - ), - ), - ), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(0); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'something', - 'nest3' => array( - 'property' => 'anything', - 'nest4' => array( - 'property' => 'nothing', - ), - ), - ), - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthObjects() - { - $someObject = new \stdClass(); - $someObject->property = 'anything'; - $someObject->nest3 = new \stdClass(); - $someObject->nest3->property = 'nothing'; - $someObject->nest3->nest4 = 'invisible'; - - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => $someObject, - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2, true); - $formattedResult = $formatter->format($record); - - $this->assertEquals( - array( - 'nest2' => array( - 'property' => 'anything', - 'nest3' => '[...]', - 'class' => 'stdClass', - ), - ), - $formattedResult['context'] - ); - } - - public function testFormatDepthException() - { - $record = array( - 'message' => 'some log message', - 'context' => array( - 'nest2' => new \Exception('exception message', 987), - ), - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'test', - 'datetime' => new \DateTime('2014-02-01 00:00:00'), - 'extra' => array(), - ); - - $formatter = new MongoDBFormatter(2, false); - $formattedRecord = $formatter->format($record); - - $this->assertEquals('exception message', $formattedRecord['context']['nest2']['message']); - $this->assertEquals(987, $formattedRecord['context']['nest2']['code']); - $this->assertEquals('[...]', $formattedRecord['context']['nest2']['trace']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php deleted file mode 100644 index 57bcdf9..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php +++ /dev/null @@ -1,423 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -/** - * @covers Monolog\Formatter\NormalizerFormatter - */ -class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase -{ - public function tearDown() - { - \PHPUnit_Framework_Error_Warning::$enabled = true; - - return parent::tearDown(); - } - - public function testFormat() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $formatted = $formatter->format(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => new \DateTime, - 'extra' => array('foo' => new TestFooNorm, 'bar' => new TestBarNorm, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'inf' => INF, - '-inf' => -INF, - 'nan' => acos(4), - ), - )); - - $this->assertEquals(array( - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'message' => 'foo', - 'datetime' => date('Y-m-d'), - 'extra' => array( - 'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})', - 'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)', - 'baz' => array(), - 'res' => '[resource] (stream)', - ), - 'context' => array( - 'foo' => 'bar', - 'baz' => 'qux', - 'inf' => 'INF', - '-inf' => '-INF', - 'nan' => 'NaN', - ), - ), $formatted); - } - - public function testFormatExceptions() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $e = new \LogicException('bar'); - $e2 = new \RuntimeException('foo', 0, $e); - $formatted = $formatter->format(array( - 'exception' => $e2, - )); - - $this->assertGreaterThan(5, count($formatted['exception']['trace'])); - $this->assertTrue(isset($formatted['exception']['previous'])); - unset($formatted['exception']['trace'], $formatted['exception']['previous']); - - $this->assertEquals(array( - 'exception' => array( - 'class' => get_class($e2), - 'message' => $e2->getMessage(), - 'code' => $e2->getCode(), - 'file' => $e2->getFile().':'.$e2->getLine(), - ), - ), $formatted); - } - - public function testFormatSoapFaultException() - { - if (!class_exists('SoapFault')) { - $this->markTestSkipped('Requires the soap extension'); - } - - $formatter = new NormalizerFormatter('Y-m-d'); - $e = new \SoapFault('foo', 'bar', 'hello', 'world'); - $formatted = $formatter->format(array( - 'exception' => $e, - )); - - unset($formatted['exception']['trace']); - - $this->assertEquals(array( - 'exception' => array( - 'class' => 'SoapFault', - 'message' => 'bar', - 'code' => 0, - 'file' => $e->getFile().':'.$e->getLine(), - 'faultcode' => 'foo', - 'faultactor' => 'hello', - 'detail' => 'world', - ), - ), $formatted); - } - - public function testFormatToStringExceptionHandle() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $this->setExpectedException('RuntimeException', 'Could not convert to string'); - $formatter->format(array( - 'myObject' => new TestToStringError(), - )); - } - - public function testBatchFormat() - { - $formatter = new NormalizerFormatter('Y-m-d'); - $formatted = $formatter->formatBatch(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => new \DateTime, - 'extra' => array(), - ), - )); - $this->assertEquals(array( - array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array(), - 'datetime' => date('Y-m-d'), - 'extra' => array(), - ), - array( - 'level_name' => 'WARNING', - 'channel' => 'log', - 'message' => 'foo', - 'context' => array(), - 'datetime' => date('Y-m-d'), - 'extra' => array(), - ), - ), $formatted); - } - - /** - * Test issue #137 - */ - public function testIgnoresRecursiveObjectReferences() - { - // set up the recursion - $foo = new \stdClass(); - $bar = new \stdClass(); - - $foo->bar = $bar; - $bar->foo = $foo; - - // set an error handler to assert that the error is not raised anymore - $that = $this; - set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { - if (error_reporting() & $level) { - restore_error_handler(); - $that->fail("$message should not be raised"); - } - }); - - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - $res = $reflMethod->invoke($formatter, array($foo, $bar), true); - - restore_error_handler(); - - $this->assertEquals(@json_encode(array($foo, $bar)), $res); - } - - public function testIgnoresInvalidTypes() - { - // set up the recursion - $resource = fopen(__FILE__, 'r'); - - // set an error handler to assert that the error is not raised anymore - $that = $this; - set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { - if (error_reporting() & $level) { - restore_error_handler(); - $that->fail("$message should not be raised"); - } - }); - - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - $res = $reflMethod->invoke($formatter, array($resource), true); - - restore_error_handler(); - - $this->assertEquals(@json_encode(array($resource)), $res); - } - - public function testNormalizeHandleLargeArrays() - { - $formatter = new NormalizerFormatter(); - $largeArray = range(1, 2000); - - $res = $formatter->format(array( - 'level_name' => 'CRITICAL', - 'channel' => 'test', - 'message' => 'bar', - 'context' => array($largeArray), - 'datetime' => new \DateTime, - 'extra' => array(), - )); - - $this->assertCount(1000, $res['context'][0]); - $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']); - } - - /** - * @expectedException RuntimeException - */ - public function testThrowsOnInvalidEncoding() - { - if (version_compare(PHP_VERSION, '5.5.0', '<')) { - // Ignore the warning that will be emitted by PHP <5.5.0 - \PHPUnit_Framework_Error_Warning::$enabled = false; - } - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - - // send an invalid unicode sequence as a object that can't be cleaned - $record = new \stdClass; - $record->message = "\xB1\x31"; - $res = $reflMethod->invoke($formatter, $record); - if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') { - throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely'); - } - } - - public function testConvertsInvalidEncodingAsLatin9() - { - if (version_compare(PHP_VERSION, '5.5.0', '<')) { - // Ignore the warning that will be emitted by PHP <5.5.0 - \PHPUnit_Framework_Error_Warning::$enabled = false; - } - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'toJson'); - $reflMethod->setAccessible(true); - - $res = $reflMethod->invoke($formatter, array('message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE")); - - if (version_compare(PHP_VERSION, '5.5.0', '>=')) { - $this->assertSame('{"message":"€ŠšŽžŒœŸ"}', $res); - } else { - // PHP <5.5 does not return false for an element encoding failure, - // instead it emits a warning (possibly) and nulls the value. - $this->assertSame('{"message":null}', $res); - } - } - - /** - * @param mixed $in Input - * @param mixed $expect Expected output - * @covers Monolog\Formatter\NormalizerFormatter::detectAndCleanUtf8 - * @dataProvider providesDetectAndCleanUtf8 - */ - public function testDetectAndCleanUtf8($in, $expect) - { - $formatter = new NormalizerFormatter(); - $formatter->detectAndCleanUtf8($in); - $this->assertSame($expect, $in); - } - - public function providesDetectAndCleanUtf8() - { - $obj = new \stdClass; - - return array( - 'null' => array(null, null), - 'int' => array(123, 123), - 'float' => array(123.45, 123.45), - 'bool false' => array(false, false), - 'bool true' => array(true, true), - 'ascii string' => array('abcdef', 'abcdef'), - 'latin9 string' => array("\xB1\x31\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xFF", '±1€ŠšŽžŒœŸÿ'), - 'unicode string' => array('¤¦¨´¸¼½¾€ŠšŽžŒœŸ', '¤¦¨´¸¼½¾€ŠšŽžŒœŸ'), - 'empty array' => array(array(), array()), - 'array' => array(array('abcdef'), array('abcdef')), - 'object' => array($obj, $obj), - ); - } - - /** - * @param int $code - * @param string $msg - * @dataProvider providesHandleJsonErrorFailure - */ - public function testHandleJsonErrorFailure($code, $msg) - { - $formatter = new NormalizerFormatter(); - $reflMethod = new \ReflectionMethod($formatter, 'handleJsonError'); - $reflMethod->setAccessible(true); - - $this->setExpectedException('RuntimeException', $msg); - $reflMethod->invoke($formatter, $code, 'faked'); - } - - public function providesHandleJsonErrorFailure() - { - return array( - 'depth' => array(JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'), - 'state' => array(JSON_ERROR_STATE_MISMATCH, 'Underflow or the modes mismatch'), - 'ctrl' => array(JSON_ERROR_CTRL_CHAR, 'Unexpected control character found'), - 'default' => array(-1, 'Unknown error'), - ); - } - - public function testExceptionTraceWithArgs() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('Not supported in HHVM since it detects errors differently'); - } - - // This happens i.e. in React promises or Guzzle streams where stream wrappers are registered - // and no file or line are included in the trace because it's treated as internal function - set_error_handler(function ($errno, $errstr, $errfile, $errline) { - throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); - }); - - try { - // This will contain $resource and $wrappedResource as arguments in the trace item - $resource = fopen('php://memory', 'rw+'); - fwrite($resource, 'test_resource'); - $wrappedResource = new TestFooNorm; - $wrappedResource->foo = $resource; - // Just do something stupid with a resource/wrapped resource as argument - array_keys($wrappedResource); - } catch (\Exception $e) { - restore_error_handler(); - } - - $formatter = new NormalizerFormatter(); - $record = array('context' => array('exception' => $e)); - $result = $formatter->format($record); - - $this->assertRegExp( - '%"resource":"\[resource\] \(stream\)"%', - $result['context']['exception']['trace'][0] - ); - - if (version_compare(PHP_VERSION, '5.5.0', '>=')) { - $pattern = '%"wrappedResource":"\[object\] \(Monolog\\\\\\\\Formatter\\\\\\\\TestFooNorm: \)"%'; - } else { - $pattern = '%\\\\"foo\\\\":null%'; - } - - // Tests that the wrapped resource is ignored while encoding, only works for PHP <= 5.4 - $this->assertRegExp( - $pattern, - $result['context']['exception']['trace'][0] - ); - } -} - -class TestFooNorm -{ - public $foo = 'foo'; -} - -class TestBarNorm -{ - public function __toString() - { - return 'bar'; - } -} - -class TestStreamFoo -{ - public $foo; - public $resource; - - public function __construct($resource) - { - $this->resource = $resource; - $this->foo = 'BAR'; - } - - public function __toString() - { - fseek($this->resource, 0); - - return $this->foo . ' - ' . (string) stream_get_contents($this->resource); - } -} - -class TestToStringError -{ - public function __toString() - { - throw new \RuntimeException('Could not convert to string'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php deleted file mode 100644 index b1c8fd4..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -class ScalarFormatterTest extends \PHPUnit_Framework_TestCase -{ - private $formatter; - - public function setUp() - { - $this->formatter = new ScalarFormatter(); - } - - public function buildTrace(\Exception $e) - { - $data = array(); - $trace = $e->getTrace(); - foreach ($trace as $frame) { - if (isset($frame['file'])) { - $data[] = $frame['file'].':'.$frame['line']; - } else { - $data[] = json_encode($frame); - } - } - - return $data; - } - - public function encodeJson($data) - { - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - } - - return json_encode($data); - } - - public function testFormat() - { - $exception = new \Exception('foo'); - $formatted = $this->formatter->format(array( - 'foo' => 'string', - 'bar' => 1, - 'baz' => false, - 'bam' => array(1, 2, 3), - 'bat' => array('foo' => 'bar'), - 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'), - 'ban' => $exception, - )); - - $this->assertSame(array( - 'foo' => 'string', - 'bar' => 1, - 'baz' => false, - 'bam' => $this->encodeJson(array(1, 2, 3)), - 'bat' => $this->encodeJson(array('foo' => 'bar')), - 'bap' => '1970-01-01 00:00:00', - 'ban' => $this->encodeJson(array( - 'class' => get_class($exception), - 'message' => $exception->getMessage(), - 'code' => $exception->getCode(), - 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception), - )), - ), $formatted); - } - - public function testFormatWithErrorContext() - { - $context = array('file' => 'foo', 'line' => 1); - $formatted = $this->formatter->format(array( - 'context' => $context, - )); - - $this->assertSame(array( - 'context' => $this->encodeJson($context), - ), $formatted); - } - - public function testFormatWithExceptionContext() - { - $exception = new \Exception('foo'); - $formatted = $this->formatter->format(array( - 'context' => array( - 'exception' => $exception, - ), - )); - - $this->assertSame(array( - 'context' => $this->encodeJson(array( - 'exception' => array( - 'class' => get_class($exception), - 'message' => $exception->getMessage(), - 'code' => $exception->getCode(), - 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception), - ), - )), - ), $formatted); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php deleted file mode 100644 index 52f15a3..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Logger; - -class WildfireFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testDefaultFormat() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1'), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '125|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},' - .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testFormatWithFileAndLine() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('from' => 'logger'), - 'datetime' => new \DateTime("@0"), - 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '129|[{"Type":"ERROR","File":"test","Line":14,"Label":"meh"},' - .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testFormatWithoutContext() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '58|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log"]|', - $message - ); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::formatBatch - * @expectedException BadMethodCallException - */ - public function testBatchFormatThrowException() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array(), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $wildfire->formatBatch(array($record)); - } - - /** - * @covers Monolog\Formatter\WildfireFormatter::format - */ - public function testTableFormat() - { - $wildfire = new WildfireFormatter(); - $record = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'table-channel', - 'context' => array( - WildfireFormatter::TABLE => array( - array('col1', 'col2', 'col3'), - array('val1', 'val2', 'val3'), - array('foo1', 'foo2', 'foo3'), - array('bar1', 'bar2', 'bar3'), - ), - ), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'table-message', - ); - - $message = $wildfire->format($record); - - $this->assertEquals( - '171|[{"Type":"TABLE","File":"","Line":"","Label":"table-channel: table-message"},[["col1","col2","col3"],["val1","val2","val3"],["foo1","foo2","foo3"],["bar1","bar2","bar3"]]]|', - $message - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php deleted file mode 100644 index 568eb9d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Monolog\Processor\WebProcessor; - -class AbstractHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\AbstractHandler::__construct - * @covers Monolog\Handler\AbstractHandler::getLevel - * @covers Monolog\Handler\AbstractHandler::setLevel - * @covers Monolog\Handler\AbstractHandler::getBubble - * @covers Monolog\Handler\AbstractHandler::setBubble - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::setFormatter - */ - public function testConstructAndGetSet() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); - $this->assertEquals(Logger::WARNING, $handler->getLevel()); - $this->assertEquals(false, $handler->getBubble()); - - $handler->setLevel(Logger::ERROR); - $handler->setBubble(true); - $handler->setFormatter($formatter = new LineFormatter); - $this->assertEquals(Logger::ERROR, $handler->getLevel()); - $this->assertEquals(true, $handler->getBubble()); - $this->assertSame($formatter, $handler->getFormatter()); - } - - /** - * @covers Monolog\Handler\AbstractHandler::handleBatch - */ - public function testHandleBatch() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $handler->expects($this->exactly(2)) - ->method('handle'); - $handler->handleBatch(array($this->getRecord(), $this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractHandler::isHandling - */ - public function testIsHandling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); - $this->assertTrue($handler->isHandling($this->getRecord())); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractHandler::__construct - */ - public function testHandlesPsrStyleLevels() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array('warning', false)); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - $handler->setLevel('debug'); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractHandler::getFormatter - * @covers Monolog\Handler\AbstractHandler::getDefaultFormatter - */ - public function testGetFormatterInitializesDefault() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter()); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @covers Monolog\Handler\AbstractHandler::popProcessor - * @expectedException LogicException - */ - public function testPushPopProcessor() - { - $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - - $logger->pushProcessor($processor1); - $logger->pushProcessor($processor2); - - $this->assertEquals($processor2, $logger->popProcessor()); - $this->assertEquals($processor1, $logger->popProcessor()); - $logger->popProcessor(); - } - - /** - * @covers Monolog\Handler\AbstractHandler::pushProcessor - * @expectedException InvalidArgumentException - */ - public function testPushProcessorWithNonCallable() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); - - $handler->pushProcessor(new \stdClass()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php deleted file mode 100644 index 24d4f63..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Processor\WebProcessor; - -class AbstractProcessingHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleLowerLevelMessage() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true)); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleBubbling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true)); - $this->assertFalse($handler->handle($this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleNotBubbling() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false)); - $this->assertTrue($handler->handle($this->getRecord())); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::handle - */ - public function testHandleIsFalseWhenNotHandled() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false)); - $this->assertTrue($handler->handle($this->getRecord())); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\AbstractProcessingHandler::processRecord - */ - public function testProcessRecord() - { - $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler'); - $handler->pushProcessor(new WebProcessor(array( - 'REQUEST_URI' => '', - 'REQUEST_METHOD' => '', - 'REMOTE_ADDR' => '', - 'SERVER_NAME' => '', - 'UNIQUE_ID' => '', - ))); - $handledRecord = null; - $handler->expects($this->once()) - ->method('write') - ->will($this->returnCallback(function ($record) use (&$handledRecord) { - $handledRecord = $record; - })) - ; - $handler->handle($this->getRecord()); - $this->assertEquals(6, count($handledRecord['extra'])); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php deleted file mode 100644 index 8e0e723..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use PhpAmqpLib\Message\AMQPMessage; -use PhpAmqpLib\Connection\AMQPConnection; - -/** - * @covers Monolog\Handler\RotatingFileHandler - */ -class AmqpHandlerTest extends TestCase -{ - public function testHandleAmqpExt() - { - if (!class_exists('AMQPConnection') || !class_exists('AMQPExchange')) { - $this->markTestSkipped("amqp-php not installed"); - } - - if (!class_exists('AMQPChannel')) { - $this->markTestSkipped("Please update AMQP to version >= 1.0"); - } - - $messages = array(); - - $exchange = $this->getMock('AMQPExchange', array('publish', 'setName'), array(), '', false); - $exchange->expects($this->once()) - ->method('setName') - ->with('log') - ; - $exchange->expects($this->any()) - ->method('publish') - ->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = array()) use (&$messages) { - $messages[] = array($message, $routing_key, $flags, $attributes); - })) - ; - - $handler = new AmqpHandler($exchange, 'log'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - array( - 'message' => 'test', - 'context' => array( - 'data' => array(), - 'foo' => 34, - ), - 'level' => 300, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'extra' => array(), - ), - 'warn.test', - 0, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ), - ); - - $handler->handle($record); - - $this->assertCount(1, $messages); - $messages[0][0] = json_decode($messages[0][0], true); - unset($messages[0][0]['datetime']); - $this->assertEquals($expected, $messages[0]); - } - - public function testHandlePhpAmqpLib() - { - if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) { - $this->markTestSkipped("php-amqplib not installed"); - } - - $messages = array(); - - $exchange = $this->getMock('PhpAmqpLib\Channel\AMQPChannel', array('basic_publish', '__destruct'), array(), '', false); - - $exchange->expects($this->any()) - ->method('basic_publish') - ->will($this->returnCallback(function (AMQPMessage $msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = null) use (&$messages) { - $messages[] = array($msg, $exchange, $routing_key, $mandatory, $immediate, $ticket); - })) - ; - - $handler = new AmqpHandler($exchange, 'log'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - array( - 'message' => 'test', - 'context' => array( - 'data' => array(), - 'foo' => 34, - ), - 'level' => 300, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'extra' => array(), - ), - 'log', - 'warn.test', - false, - false, - null, - array( - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ), - ); - - $handler->handle($record); - - $this->assertCount(1, $messages); - - /* @var $msg AMQPMessage */ - $msg = $messages[0][0]; - $messages[0][0] = json_decode($msg->body, true); - $messages[0][] = $msg->get_properties(); - unset($messages[0][0]['datetime']); - - $this->assertEquals($expected, $messages[0]); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php deleted file mode 100644 index ffb1d74..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\BrowserConsoleHandlerTest - */ -class BrowserConsoleHandlerTest extends TestCase -{ - protected function setUp() - { - BrowserConsoleHandler::reset(); - } - - protected function generateScript() - { - $reflMethod = new \ReflectionMethod('Monolog\Handler\BrowserConsoleHandler', 'generateScript'); - $reflMethod->setAccessible(true); - - return $reflMethod->invoke(null); - } - - public function testStyling() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, 'foo[[bar]]{color: red}')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testEscaping() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, "[foo] [[\"bar\n[baz]\"]]{color: red}")); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testAutolabel() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); - $handler->handle($this->getRecord(Logger::DEBUG, '[[bar]]{macro: autolabel}')); - $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testContext() - { - $handler = new BrowserConsoleHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - - $handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar'))); - - $expected = <<assertEquals($expected, $this->generateScript()); - } - - public function testConcurrentHandlers() - { - $handler1 = new BrowserConsoleHandler(); - $handler1->setFormatter($this->getIdentityFormatter()); - - $handler2 = new BrowserConsoleHandler(); - $handler2->setFormatter($this->getIdentityFormatter()); - - $handler1->handle($this->getRecord(Logger::DEBUG, 'test1')); - $handler2->handle($this->getRecord(Logger::DEBUG, 'test2')); - $handler1->handle($this->getRecord(Logger::DEBUG, 'test3')); - $handler2->handle($this->getRecord(Logger::DEBUG, 'test4')); - - $expected = <<assertEquals($expected, $this->generateScript()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php deleted file mode 100644 index da8b3c3..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class BufferHandlerTest extends TestCase -{ - private $shutdownCheckHandler; - - /** - * @covers Monolog\Handler\BufferHandler::__construct - * @covers Monolog\Handler\BufferHandler::handle - * @covers Monolog\Handler\BufferHandler::close - */ - public function testHandleBuffers() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->close(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - - /** - * @covers Monolog\Handler\BufferHandler::close - * @covers Monolog\Handler\BufferHandler::flush - */ - public function testPropagatesRecordsAtEndOfRequest() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->shutdownCheckHandler = $test; - register_shutdown_function(array($this, 'checkPropagation')); - } - - public function checkPropagation() - { - if (!$this->shutdownCheckHandler->hasWarningRecords() || !$this->shutdownCheckHandler->hasDebugRecords()) { - echo '!!! BufferHandlerTest::testPropagatesRecordsAtEndOfRequest failed to verify that the messages have been propagated' . PHP_EOL; - exit(1); - } - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleBufferLimit() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 2); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleBufferLimitWithFlushOnOverflow() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 3, Logger::DEBUG, true, true); - - // send two records - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertCount(0, $test->getRecords()); - - // overflow - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertCount(3, $test->getRecords()); - - // should buffer again - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertCount(3, $test->getRecords()); - - $handler->close(); - $this->assertCount(5, $test->getRecords()); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleLevel() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 0, Logger::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::flush - */ - public function testFlush() - { - $test = new TestHandler(); - $handler = new BufferHandler($test, 0); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->flush(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\BufferHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new BufferHandler($test); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->flush(); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php deleted file mode 100644 index 0449f8b..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\ChromePHPHandler - */ -class ChromePHPHandlerTest extends TestCase -{ - protected function setUp() - { - TestChromePHPHandler::reset(); - $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0'; - } - - /** - * @dataProvider agentsProvider - */ - public function testHeaders($agent) - { - $_SERVER['HTTP_USER_AGENT'] = $agent; - - $handler = new TestChromePHPHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - 'test', - 'test', - ), - 'request_uri' => '', - )))), - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public static function agentsProvider() - { - return array( - array('Monolog Test; Chrome/1.0'), - array('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'), - array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36'), - array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'), - ); - } - - public function testHeadersOverflow() - { - $handler = new TestChromePHPHandler(); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024))); - - // overflow chrome headers limit - $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024))); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - array( - 'test', - 'test', - 'unknown', - 'log', - ), - array( - 'test', - str_repeat('a', 150 * 1024), - 'unknown', - 'warn', - ), - array( - 'monolog', - 'Incomplete logs, chrome header size limit reached', - 'unknown', - 'warn', - ), - ), - 'request_uri' => '', - )))), - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public function testConcurrentHandlers() - { - $handler = new TestChromePHPHandler(); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $handler2 = new TestChromePHPHandler(); - $handler2->setFormatter($this->getIdentityFormatter()); - $handler2->handle($this->getRecord(Logger::DEBUG)); - $handler2->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( - 'version' => ChromePHPHandler::VERSION, - 'columns' => array('label', 'log', 'backtrace', 'type'), - 'rows' => array( - 'test', - 'test', - 'test', - 'test', - ), - 'request_uri' => '', - )))), - ); - - $this->assertEquals($expected, $handler2->getHeaders()); - } -} - -class TestChromePHPHandler extends ChromePHPHandler -{ - protected $headers = array(); - - public static function reset() - { - self::$initialized = false; - self::$overflowed = false; - self::$sendHeaders = true; - self::$json['rows'] = array(); - } - - protected function sendHeader($header, $content) - { - $this->headers[$header] = $content; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php deleted file mode 100644 index 9fc4b38..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class CouchDBHandlerTest extends TestCase -{ - public function testHandle() - { - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new CouchDBHandler(); - - try { - $handler->handle($record); - } catch (\RuntimeException $e) { - $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984'); - } - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php deleted file mode 100644 index e2aff86..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class DeduplicationHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\DeduplicationHandler::flush - */ - public function testFlushPassthruIfAllRecordsUnderTrigger() - { - $test = new TestHandler(); - @unlink(sys_get_temp_dir().'/monolog_dedup.log'); - $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); - - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - - $handler->flush(); - - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\DeduplicationHandler::flush - * @covers Monolog\Handler\DeduplicationHandler::appendRecord - */ - public function testFlushPassthruIfEmptyLog() - { - $test = new TestHandler(); - @unlink(sys_get_temp_dir().'/monolog_dedup.log'); - $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); - - $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar')); - $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar")); - - $handler->flush(); - - $this->assertTrue($test->hasErrorRecords()); - $this->assertTrue($test->hasCriticalRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\DeduplicationHandler::flush - * @covers Monolog\Handler\DeduplicationHandler::appendRecord - * @covers Monolog\Handler\DeduplicationHandler::isDuplicate - * @depends testFlushPassthruIfEmptyLog - */ - public function testFlushSkipsIfLogExists() - { - $test = new TestHandler(); - $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); - - $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar')); - $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar")); - - $handler->flush(); - - $this->assertFalse($test->hasErrorRecords()); - $this->assertFalse($test->hasCriticalRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\DeduplicationHandler::flush - * @covers Monolog\Handler\DeduplicationHandler::appendRecord - * @covers Monolog\Handler\DeduplicationHandler::isDuplicate - * @depends testFlushPassthruIfEmptyLog - */ - public function testFlushPassthruIfLogTooOld() - { - $test = new TestHandler(); - $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); - - $record = $this->getRecord(Logger::ERROR); - $record['datetime']->modify('+62seconds'); - $handler->handle($record); - $record = $this->getRecord(Logger::CRITICAL); - $record['datetime']->modify('+62seconds'); - $handler->handle($record); - - $handler->flush(); - - $this->assertTrue($test->hasErrorRecords()); - $this->assertTrue($test->hasCriticalRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\DeduplicationHandler::flush - * @covers Monolog\Handler\DeduplicationHandler::appendRecord - * @covers Monolog\Handler\DeduplicationHandler::isDuplicate - * @covers Monolog\Handler\DeduplicationHandler::collectLogs - */ - public function testGcOldLogs() - { - $test = new TestHandler(); - @unlink(sys_get_temp_dir().'/monolog_dedup.log'); - $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); - - // handle two records from yesterday, and one recent - $record = $this->getRecord(Logger::ERROR); - $record['datetime']->modify('-1day -10seconds'); - $handler->handle($record); - $record2 = $this->getRecord(Logger::CRITICAL); - $record2['datetime']->modify('-1day -10seconds'); - $handler->handle($record2); - $record3 = $this->getRecord(Logger::CRITICAL); - $record3['datetime']->modify('-30seconds'); - $handler->handle($record3); - - // log is written as none of them are duplicate - $handler->flush(); - $this->assertSame( - $record['datetime']->getTimestamp() . ":ERROR:test\n" . - $record2['datetime']->getTimestamp() . ":CRITICAL:test\n" . - $record3['datetime']->getTimestamp() . ":CRITICAL:test\n", - file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log') - ); - $this->assertTrue($test->hasErrorRecords()); - $this->assertTrue($test->hasCriticalRecords()); - $this->assertFalse($test->hasWarningRecords()); - - // clear test handler - $test->clear(); - $this->assertFalse($test->hasErrorRecords()); - $this->assertFalse($test->hasCriticalRecords()); - - // log new records, duplicate log gets GC'd at the end of this flush call - $handler->handle($record = $this->getRecord(Logger::ERROR)); - $handler->handle($record2 = $this->getRecord(Logger::CRITICAL)); - $handler->flush(); - - // log should now contain the new errors and the previous one that was recent enough - $this->assertSame( - $record3['datetime']->getTimestamp() . ":CRITICAL:test\n" . - $record['datetime']->getTimestamp() . ":ERROR:test\n" . - $record2['datetime']->getTimestamp() . ":CRITICAL:test\n", - file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log') - ); - $this->assertTrue($test->hasErrorRecords()); - $this->assertTrue($test->hasCriticalRecords()); - $this->assertFalse($test->hasWarningRecords()); - } - - public static function tearDownAfterClass() - { - @unlink(sys_get_temp_dir().'/monolog_dedup.log'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php deleted file mode 100644 index d67da90..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class DoctrineCouchDBHandlerTest extends TestCase -{ - protected function setup() - { - if (!class_exists('Doctrine\CouchDB\CouchDBClient')) { - $this->markTestSkipped('The "doctrine/couchdb" package is not installed'); - } - } - - public function testHandle() - { - $client = $this->getMockBuilder('Doctrine\\CouchDB\\CouchDBClient') - ->setMethods(array('postDocument')) - ->disableOriginalConstructor() - ->getMock(); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - 'message' => 'test', - 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), - 'extra' => array(), - ); - - $client->expects($this->once()) - ->method('postDocument') - ->with($expected); - - $handler = new DoctrineCouchDBHandler($client); - $handler->handle($record); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php deleted file mode 100644 index 2e6c348..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -class DynamoDbHandlerTest extends TestCase -{ - private $client; - - public function setUp() - { - if (!class_exists('Aws\DynamoDb\DynamoDbClient')) { - $this->markTestSkipped('aws/aws-sdk-php not installed'); - } - - $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient') - ->setMethods(array('formatAttributes', '__call')) - ->disableOriginalConstructor()->getMock(); - } - - public function testConstruct() - { - $this->assertInstanceOf('Monolog\Handler\DynamoDbHandler', new DynamoDbHandler($this->client, 'foo')); - } - - public function testInterface() - { - $this->assertInstanceOf('Monolog\Handler\HandlerInterface', new DynamoDbHandler($this->client, 'foo')); - } - - public function testGetFormatter() - { - $handler = new DynamoDbHandler($this->client, 'foo'); - $this->assertInstanceOf('Monolog\Formatter\ScalarFormatter', $handler->getFormatter()); - } - - public function testHandle() - { - $record = $this->getRecord(); - $formatter = $this->getMock('Monolog\Formatter\FormatterInterface'); - $formatted = array('foo' => 1, 'bar' => 2); - $handler = new DynamoDbHandler($this->client, 'foo'); - $handler->setFormatter($formatter); - - $isV3 = defined('Aws\Sdk::VERSION') && version_compare(\Aws\Sdk::VERSION, '3.0', '>='); - if ($isV3) { - $expFormatted = array('foo' => array('N' => 1), 'bar' => array('N' => 2)); - } else { - $expFormatted = $formatted; - } - - $formatter - ->expects($this->once()) - ->method('format') - ->with($record) - ->will($this->returnValue($formatted)); - $this->client - ->expects($isV3 ? $this->never() : $this->once()) - ->method('formatAttributes') - ->with($this->isType('array')) - ->will($this->returnValue($formatted)); - $this->client - ->expects($this->once()) - ->method('__call') - ->with('putItem', array(array( - 'TableName' => 'foo', - 'Item' => $expFormatted, - ))); - - $handler->handle($record); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php deleted file mode 100644 index 1687074..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\ElasticaFormatter; -use Monolog\Formatter\NormalizerFormatter; -use Monolog\TestCase; -use Monolog\Logger; -use Elastica\Client; -use Elastica\Request; -use Elastica\Response; - -class ElasticSearchHandlerTest extends TestCase -{ - /** - * @var Client mock - */ - protected $client; - - /** - * @var array Default handler options - */ - protected $options = array( - 'index' => 'my_index', - 'type' => 'doc_type', - ); - - public function setUp() - { - // Elastica lib required - if (!class_exists("Elastica\Client")) { - $this->markTestSkipped("ruflin/elastica not installed"); - } - - // base mock Elastica Client object - $this->client = $this->getMockBuilder('Elastica\Client') - ->setMethods(array('addDocuments')) - ->disableOriginalConstructor() - ->getMock(); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::write - * @covers Monolog\Handler\ElasticSearchHandler::handleBatch - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter - */ - public function testHandle() - { - // log message - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - // format expected result - $formatter = new ElasticaFormatter($this->options['index'], $this->options['type']); - $expected = array($formatter->format($msg)); - - // setup ES client mock - $this->client->expects($this->any()) - ->method('addDocuments') - ->with($expected); - - // perform tests - $handler = new ElasticSearchHandler($this->client, $this->options); - $handler->handle($msg); - $handler->handleBatch(array($msg)); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::setFormatter - */ - public function testSetFormatter() - { - $handler = new ElasticSearchHandler($this->client); - $formatter = new ElasticaFormatter('index_new', 'type_new'); - $handler->setFormatter($formatter); - $this->assertInstanceOf('Monolog\Formatter\ElasticaFormatter', $handler->getFormatter()); - $this->assertEquals('index_new', $handler->getFormatter()->getIndex()); - $this->assertEquals('type_new', $handler->getFormatter()->getType()); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::setFormatter - * @expectedException InvalidArgumentException - * @expectedExceptionMessage ElasticSearchHandler is only compatible with ElasticaFormatter - */ - public function testSetFormatterInvalid() - { - $handler = new ElasticSearchHandler($this->client); - $formatter = new NormalizerFormatter(); - $handler->setFormatter($formatter); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::__construct - * @covers Monolog\Handler\ElasticSearchHandler::getOptions - */ - public function testOptions() - { - $expected = array( - 'index' => $this->options['index'], - 'type' => $this->options['type'], - 'ignore_error' => false, - ); - $handler = new ElasticSearchHandler($this->client, $this->options); - $this->assertEquals($expected, $handler->getOptions()); - } - - /** - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @dataProvider providerTestConnectionErrors - */ - public function testConnectionErrors($ignore, $expectedError) - { - $clientOpts = array('host' => '127.0.0.1', 'port' => 1); - $client = new Client($clientOpts); - $handlerOpts = array('ignore_error' => $ignore); - $handler = new ElasticSearchHandler($client, $handlerOpts); - - if ($expectedError) { - $this->setExpectedException($expectedError[0], $expectedError[1]); - $handler->handle($this->getRecord()); - } else { - $this->assertFalse($handler->handle($this->getRecord())); - } - } - - /** - * @return array - */ - public function providerTestConnectionErrors() - { - return array( - array(false, array('RuntimeException', 'Error sending messages to Elasticsearch')), - array(true, false), - ); - } - - /** - * Integration test using localhost Elastic Search server - * - * @covers Monolog\Handler\ElasticSearchHandler::__construct - * @covers Monolog\Handler\ElasticSearchHandler::handleBatch - * @covers Monolog\Handler\ElasticSearchHandler::bulkSend - * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter - */ - public function testHandleIntegration() - { - $msg = array( - 'level' => Logger::ERROR, - 'level_name' => 'ERROR', - 'channel' => 'meh', - 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), - 'datetime' => new \DateTime("@0"), - 'extra' => array(), - 'message' => 'log', - ); - - $expected = $msg; - $expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601); - $expected['context'] = array( - 'class' => '[object] (stdClass: {})', - 'foo' => 7, - 0 => 'bar', - ); - - $client = new Client(); - $handler = new ElasticSearchHandler($client, $this->options); - try { - $handler->handleBatch(array($msg)); - } catch (\RuntimeException $e) { - $this->markTestSkipped("Cannot connect to Elastic Search server on localhost"); - } - - // check document id from ES server response - $documentId = $this->getCreatedDocId($client->getLastResponse()); - $this->assertNotEmpty($documentId, 'No elastic document id received'); - - // retrieve document source from ES and validate - $document = $this->getDocSourceFromElastic( - $client, - $this->options['index'], - $this->options['type'], - $documentId - ); - $this->assertEquals($expected, $document); - - // remove test index from ES - $client->request("/{$this->options['index']}", Request::DELETE); - } - - /** - * Return last created document id from ES response - * @param Response $response Elastica Response object - * @return string|null - */ - protected function getCreatedDocId(Response $response) - { - $data = $response->getData(); - if (!empty($data['items'][0]['create']['_id'])) { - return $data['items'][0]['create']['_id']; - } - } - - /** - * Retrieve document by id from Elasticsearch - * @param Client $client Elastica client - * @param string $index - * @param string $type - * @param string $documentId - * @return array - */ - protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId) - { - $resp = $client->request("/{$index}/{$type}/{$documentId}", Request::GET); - $data = $resp->getData(); - if (!empty($data['_source'])) { - return $data['_source']; - } - - return array(); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php deleted file mode 100644 index 99785cb..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -function error_log() -{ - $GLOBALS['error_log'][] = func_get_args(); -} - -class ErrorLogHandlerTest extends TestCase -{ - protected function setUp() - { - $GLOBALS['error_log'] = array(); - } - - /** - * @covers Monolog\Handler\ErrorLogHandler::__construct - * @expectedException InvalidArgumentException - * @expectedExceptionMessage The given message type "42" is not supported - */ - public function testShouldNotAcceptAnInvalidTypeOnContructor() - { - new ErrorLogHandler(42); - } - - /** - * @covers Monolog\Handler\ErrorLogHandler::write - */ - public function testShouldLogMessagesUsingErrorLogFuncion() - { - $type = ErrorLogHandler::OPERATING_SYSTEM; - $handler = new ErrorLogHandler($type); - $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true)); - $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - - $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]); - $this->assertSame($GLOBALS['error_log'][0][1], $type); - - $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true); - $handler->setFormatter(new LineFormatter(null, null, true)); - $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - - $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]); - $this->assertSame($GLOBALS['error_log'][1][1], $type); - - $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]); - $this->assertSame($GLOBALS['error_log'][2][1], $type); - - $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]); - $this->assertSame($GLOBALS['error_log'][3][1], $type); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php deleted file mode 100644 index 31b7686..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\TestCase; - -class FilterHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\FilterHandler::isHandling - */ - public function testIsHandling() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::INFO))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::NOTICE))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::CRITICAL))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::ALERT))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::EMERGENCY))); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - * @covers Monolog\Handler\FilterHandler::setAcceptedLevels - * @covers Monolog\Handler\FilterHandler::isHandling - */ - public function testHandleProcessOnlyNeededLevels() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); - - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::NOTICE)); - $this->assertTrue($test->hasNoticeRecords()); - - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $handler->handle($this->getRecord(Logger::ERROR)); - $this->assertFalse($test->hasErrorRecords()); - $handler->handle($this->getRecord(Logger::CRITICAL)); - $this->assertFalse($test->hasCriticalRecords()); - $handler->handle($this->getRecord(Logger::ALERT)); - $this->assertFalse($test->hasAlertRecords()); - $handler->handle($this->getRecord(Logger::EMERGENCY)); - $this->assertFalse($test->hasEmergencyRecords()); - - $test = new TestHandler(); - $handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR)); - - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::NOTICE)); - $this->assertFalse($test->hasNoticeRecords()); - $handler->handle($this->getRecord(Logger::ERROR)); - $this->assertTrue($test->hasErrorRecords()); - $handler->handle($this->getRecord(Logger::CRITICAL)); - $this->assertFalse($test->hasCriticalRecords()); - } - - /** - * @covers Monolog\Handler\FilterHandler::setAcceptedLevels - * @covers Monolog\Handler\FilterHandler::getAcceptedLevels - */ - public function testAcceptedLevelApi() - { - $test = new TestHandler(); - $handler = new FilterHandler($test); - - $levels = array(Logger::INFO, Logger::ERROR); - $handler->setAcceptedLevels($levels); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $handler->setAcceptedLevels(array('info', 'error')); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $levels = array(Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY); - $handler->setAcceptedLevels(Logger::CRITICAL, Logger::EMERGENCY); - $this->assertSame($levels, $handler->getAcceptedLevels()); - - $handler->setAcceptedLevels('critical', 'emergency'); - $this->assertSame($levels, $handler->getAcceptedLevels()); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new FilterHandler($test, Logger::DEBUG, Logger::EMERGENCY); - $handler->pushProcessor( - function ($record) { - $record['extra']['foo'] = true; - - return $record; - } - ); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleRespectsBubble() - { - $test = new TestHandler(); - - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, false); - $this->assertTrue($handler->handle($this->getRecord(Logger::INFO))); - $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); - - $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, true); - $this->assertFalse($handler->handle($this->getRecord(Logger::INFO))); - $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - */ - public function testHandleWithCallback() - { - $test = new TestHandler(); - $handler = new FilterHandler( - function ($record, $handler) use ($test) { - return $test; - }, Logger::INFO, Logger::NOTICE, false - ); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FilterHandler::handle - * @expectedException \RuntimeException - */ - public function testHandleWithBadCallbackThrowsException() - { - $handler = new FilterHandler( - function ($record, $handler) { - return 'foo'; - } - ); - $handler->handle($this->getRecord(Logger::WARNING)); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php deleted file mode 100644 index b92bf43..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; -use Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy; -use Psr\Log\LogLevel; - -class FingersCrossedHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleBuffers() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->close(); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 3); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleStopsBufferingAfterTrigger() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - * @covers Monolog\Handler\FingersCrossedHandler::reset - */ - public function testHandleRestartBufferingAfterReset() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->reset(); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleBufferLimit() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::WARNING, 2); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertFalse($test->hasDebugRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleWithCallback() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) { - return $test; - }); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertFalse($test->hasDebugRecords()); - $this->assertFalse($test->hasInfoRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 3); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - * @expectedException RuntimeException - */ - public function testHandleWithBadCallbackThrowsException() - { - $handler = new FingersCrossedHandler(function ($record, $handler) { - return 'foo'; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::isHandling - */ - public function testIsHandlingAlways() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::ERROR); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated - */ - public function testErrorLevelActivationStrategy() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING)); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated - */ - public function testErrorLevelActivationStrategyWithPsrLevel() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::__construct - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testOverrideActivationStrategy() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); - $handler->handle($this->getRecord(Logger::DEBUG)); - $this->assertFalse($test->hasDebugRecords()); - $handler->activate(); - $this->assertTrue($test->hasDebugRecords()); - $handler->handle($this->getRecord(Logger::INFO)); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated - */ - public function testChannelLevelActivationStrategy() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG))); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $record = $this->getRecord(Logger::DEBUG); - $record['channel'] = 'othertest'; - $handler->handle($record); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct - * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated - */ - public function testChannelLevelActivationStrategyWithPsrLevels() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug'))); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertFalse($test->hasWarningRecords()); - $record = $this->getRecord(Logger::DEBUG); - $record['channel'] = 'othertest'; - $handler->handle($record); - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasWarningRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::handle - * @covers Monolog\Handler\FingersCrossedHandler::activate - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, Logger::INFO); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::close - */ - public function testPassthruOnClose() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } - - /** - * @covers Monolog\Handler\FingersCrossedHandler::close - */ - public function testPsrLevelPassthruOnClose() - { - $test = new TestHandler(); - $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - $handler->close(); - $this->assertFalse($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php deleted file mode 100644 index 0eb10a6..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\FirePHPHandler - */ -class FirePHPHandlerTest extends TestCase -{ - public function setUp() - { - TestFirePHPHandler::reset(); - $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0'; - } - - public function testHeaders() - { - $handler = new TestFirePHPHandler; - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', - 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', - 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', - 'X-Wf-1-1-1-1' => 'test', - 'X-Wf-1-1-1-2' => 'test', - ); - - $this->assertEquals($expected, $handler->getHeaders()); - } - - public function testConcurrentHandlers() - { - $handler = new TestFirePHPHandler; - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::WARNING)); - - $handler2 = new TestFirePHPHandler; - $handler2->setFormatter($this->getIdentityFormatter()); - $handler2->handle($this->getRecord(Logger::DEBUG)); - $handler2->handle($this->getRecord(Logger::WARNING)); - - $expected = array( - 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', - 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', - 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', - 'X-Wf-1-1-1-1' => 'test', - 'X-Wf-1-1-1-2' => 'test', - ); - - $expected2 = array( - 'X-Wf-1-1-1-3' => 'test', - 'X-Wf-1-1-1-4' => 'test', - ); - - $this->assertEquals($expected, $handler->getHeaders()); - $this->assertEquals($expected2, $handler2->getHeaders()); - } -} - -class TestFirePHPHandler extends FirePHPHandler -{ - protected $headers = array(); - - public static function reset() - { - self::$initialized = false; - self::$sendHeaders = true; - self::$messageIndex = 1; - } - - protected function sendHeader($header, $content) - { - $this->headers[$header] = $content; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep b/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php deleted file mode 100644 index 91cdd31..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; -use Monolog\TestCase; - -/** - * @coversDefaultClass \Monolog\Handler\FleepHookHandler - */ -class FleepHookHandlerTest extends TestCase -{ - /** - * Default token to use in tests - */ - const TOKEN = '123abc'; - - /** - * @var FleepHookHandler - */ - private $handler; - - public function setUp() - { - parent::setUp(); - - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl extension to run'); - } - - // Create instances of the handler and logger for convenience - $this->handler = new FleepHookHandler(self::TOKEN); - } - - /** - * @covers ::__construct - */ - public function testConstructorSetsExpectedDefaults() - { - $this->assertEquals(Logger::DEBUG, $this->handler->getLevel()); - $this->assertEquals(true, $this->handler->getBubble()); - } - - /** - * @covers ::getDefaultFormatter - */ - public function testHandlerUsesLineFormatterWhichIgnoresEmptyArrays() - { - $record = array( - 'message' => 'msg', - 'context' => array(), - 'level' => Logger::DEBUG, - 'level_name' => Logger::getLevelName(Logger::DEBUG), - 'channel' => 'channel', - 'datetime' => new \DateTime(), - 'extra' => array(), - ); - - $expectedFormatter = new LineFormatter(null, null, true, true); - $expected = $expectedFormatter->format($record); - - $handlerFormatter = $this->handler->getFormatter(); - $actual = $handlerFormatter->format($record); - - $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered'); - } - - /** - * @covers ::__construct - */ - public function testConnectionStringisConstructedCorrectly() - { - $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php deleted file mode 100644 index 4b120d5..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\FlowdockFormatter; -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Dominik Liebler - * @see https://www.hipchat.com/docs/api - */ -class FlowdockHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var FlowdockHandler - */ - private $handler; - - public function setUp() - { - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl to run'); - } - } - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/messages\/team_inbox\/.* HTTP\/1.1\\r\\nHost: api.flowdock.com\\r\\nContent-Type: application\/json\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/"source":"test_source"/', $content); - $this->assertRegexp('/"from_address":"source@test\.com"/', $content); - } - - private function createHandler($token = 'myToken') - { - $constructorArgs = array($token, Logger::DEBUG); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\FlowdockHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter(new FlowdockFormatter('test_source', 'source@test.com')); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php deleted file mode 100644 index 9d007b1..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\Message; -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\GelfMessageFormatter; - -class GelfHandlerLegacyTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Gelf\MessagePublisher') || !class_exists('Gelf\Message')) { - $this->markTestSkipped("mlehner/gelf-php not installed"); - } - - require_once __DIR__ . '/GelfMockMessagePublisher.php'; - } - - /** - * @covers Monolog\Handler\GelfHandler::__construct - */ - public function testConstruct() - { - $handler = new GelfHandler($this->getMessagePublisher()); - $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); - } - - protected function getHandler($messagePublisher) - { - $handler = new GelfHandler($messagePublisher); - - return $handler; - } - - protected function getMessagePublisher() - { - return new GelfMockMessagePublisher('localhost'); - } - - public function testDebug() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $record = $this->getRecord(Logger::DEBUG, "A test debug message"); - $handler->handle($record); - - $this->assertEquals(7, $messagePublisher->lastMessage->getLevel()); - $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); - $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); - $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); - } - - public function testWarning() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $handler->handle($record); - - $this->assertEquals(4, $messagePublisher->lastMessage->getLevel()); - $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); - $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); - $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); - } - - public function testInjectedGelfMessageFormatter() - { - $messagePublisher = $this->getMessagePublisher(); - $handler = $this->getHandler($messagePublisher); - - $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); - - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $record['extra']['blarg'] = 'yep'; - $record['context']['from'] = 'logger'; - $handler->handle($record); - - $this->assertEquals('mysystem', $messagePublisher->lastMessage->getHost()); - $this->assertArrayHasKey('_EXTblarg', $messagePublisher->lastMessage->toArray()); - $this->assertArrayHasKey('_CTXfrom', $messagePublisher->lastMessage->toArray()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php deleted file mode 100644 index 8cdd64f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\Message; -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\GelfMessageFormatter; - -class GelfHandlerTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Gelf\Publisher') || !class_exists('Gelf\Message')) { - $this->markTestSkipped("graylog2/gelf-php not installed"); - } - } - - /** - * @covers Monolog\Handler\GelfHandler::__construct - */ - public function testConstruct() - { - $handler = new GelfHandler($this->getMessagePublisher()); - $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); - } - - protected function getHandler($messagePublisher) - { - $handler = new GelfHandler($messagePublisher); - - return $handler; - } - - protected function getMessagePublisher() - { - return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false); - } - - public function testDebug() - { - $record = $this->getRecord(Logger::DEBUG, "A test debug message"); - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(7) - ->setFacility("test") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - - $handler->handle($record); - } - - public function testWarning() - { - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(4) - ->setFacility("test") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - - $handler->handle($record); - } - - public function testInjectedGelfMessageFormatter() - { - $record = $this->getRecord(Logger::WARNING, "A test warning message"); - $record['extra']['blarg'] = 'yep'; - $record['context']['from'] = 'logger'; - - $expectedMessage = new Message(); - $expectedMessage - ->setLevel(4) - ->setFacility("test") - ->setHost("mysystem") - ->setShortMessage($record['message']) - ->setTimestamp($record['datetime']) - ->setAdditional("EXTblarg", 'yep') - ->setAdditional("CTXfrom", 'logger') - ; - - $messagePublisher = $this->getMessagePublisher(); - $messagePublisher->expects($this->once()) - ->method('publish') - ->with($expectedMessage); - - $handler = $this->getHandler($messagePublisher); - $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); - $handler->handle($record); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php deleted file mode 100644 index 873d92f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Gelf\MessagePublisher; -use Gelf\Message; - -class GelfMockMessagePublisher extends MessagePublisher -{ - public function publish(Message $message) - { - $this->lastMessage = $message; - } - - public $lastMessage = null; -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php deleted file mode 100644 index a1b8617..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class GroupHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\GroupHandler::__construct - * @expectedException InvalidArgumentException - */ - public function testConstructorOnlyTakesHandler() - { - new GroupHandler(array(new TestHandler(), "foo")); - } - - /** - * @covers Monolog\Handler\GroupHandler::__construct - * @covers Monolog\Handler\GroupHandler::handle - */ - public function testHandle() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new GroupHandler($testHandlers); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\GroupHandler::handleBatch - */ - public function testHandleBatch() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new GroupHandler($testHandlers); - $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\GroupHandler::isHandling - */ - public function testIsHandling() - { - $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); - $handler = new GroupHandler($testHandlers); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\GroupHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new GroupHandler(array($test)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\GroupHandler::handle - */ - public function testHandleBatchUsesProcessors() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new GroupHandler($testHandlers); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - $this->assertTrue($records[1]['extra']['foo']); - } - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php deleted file mode 100644 index d8d0452..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -/** - * @author Alexey Karapetov - */ -class HandlerWrapperTest extends TestCase -{ - /** - * @var HandlerWrapper - */ - private $wrapper; - - private $handler; - - public function setUp() - { - parent::setUp(); - $this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface'); - $this->wrapper = new HandlerWrapper($this->handler); - } - - /** - * @return array - */ - public function trueFalseDataProvider() - { - return array( - array(true), - array(false), - ); - } - - /** - * @param $result - * @dataProvider trueFalseDataProvider - */ - public function testIsHandling($result) - { - $record = $this->getRecord(); - $this->handler->expects($this->once()) - ->method('isHandling') - ->with($record) - ->willReturn($result); - - $this->assertEquals($result, $this->wrapper->isHandling($record)); - } - - /** - * @param $result - * @dataProvider trueFalseDataProvider - */ - public function testHandle($result) - { - $record = $this->getRecord(); - $this->handler->expects($this->once()) - ->method('handle') - ->with($record) - ->willReturn($result); - - $this->assertEquals($result, $this->wrapper->handle($record)); - } - - /** - * @param $result - * @dataProvider trueFalseDataProvider - */ - public function testHandleBatch($result) - { - $records = $this->getMultipleRecords(); - $this->handler->expects($this->once()) - ->method('handleBatch') - ->with($records) - ->willReturn($result); - - $this->assertEquals($result, $this->wrapper->handleBatch($records)); - } - - public function testPushProcessor() - { - $processor = function () {}; - $this->handler->expects($this->once()) - ->method('pushProcessor') - ->with($processor); - - $this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor)); - } - - public function testPopProcessor() - { - $processor = function () {}; - $this->handler->expects($this->once()) - ->method('popProcessor') - ->willReturn($processor); - - $this->assertEquals($processor, $this->wrapper->popProcessor()); - } - - public function testSetFormatter() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $this->handler->expects($this->once()) - ->method('setFormatter') - ->with($formatter); - - $this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter)); - } - - public function testGetFormatter() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $this->handler->expects($this->once()) - ->method('getFormatter') - ->willReturn($formatter); - - $this->assertEquals($formatter, $this->wrapper->getFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php deleted file mode 100644 index 52dc9da..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Rafael Dohms - * @see https://www.hipchat.com/docs/api - */ -class HipChatHandlerTest extends TestCase -{ - private $res; - /** @var HipChatHandler */ - private $handler; - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteCustomHostHeader() - { - $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteV2() - { - $this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testWriteV2Notify() - { - $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - public function testRoomSpaces() - { - $this->createHandler('myToken', 'room name', 'Monolog', false, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/v2\/room\/room%20name\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); - } - - public function testWriteContentV1WithoutName() - { - $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v1'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=$/', $content); - - return $content; - } - - /** - * @depends testWriteCustomHostHeader - */ - public function testWriteContentNotify($content) - { - $this->assertRegexp('/notify=1&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); - } - - /** - * @depends testWriteV2 - */ - public function testWriteContentV2($content) - { - $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red&from=Monolog$/', $content); - } - - /** - * @depends testWriteV2Notify - */ - public function testWriteContentV2Notify($content) - { - $this->assertRegexp('/notify=true&message=test1&message_format=text&color=red&from=Monolog$/', $content); - } - - public function testWriteContentV2WithoutName() - { - $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v2'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content); - - return $content; - } - - public function testWriteWithComplexMessage() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); - } - - public function testWriteTruncatesLongMessage() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, str_repeat('abcde', 2000))); - fseek($this->res, 0); - $content = fread($this->res, 12000); - - $this->assertRegexp('/message='.str_repeat('abcde', 1900).'\+%5Btruncated%5D/', $content); - } - - /** - * @dataProvider provideLevelColors - */ - public function testWriteWithErrorLevelsAndColors($level, $expectedColor) - { - $this->createHandler(); - $this->handler->handle($this->getRecord($level, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/color='.$expectedColor.'/', $content); - } - - public function provideLevelColors() - { - return array( - array(Logger::DEBUG, 'gray'), - array(Logger::INFO, 'green'), - array(Logger::WARNING, 'yellow'), - array(Logger::ERROR, 'red'), - array(Logger::CRITICAL, 'red'), - array(Logger::ALERT, 'red'), - array(Logger::EMERGENCY,'red'), - array(Logger::NOTICE, 'green'), - ); - } - - /** - * @dataProvider provideBatchRecords - */ - public function testHandleBatch($records, $expectedColor) - { - $this->createHandler(); - - $this->handler->handleBatch($records); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/color='.$expectedColor.'/', $content); - } - - public function provideBatchRecords() - { - return array( - array( - array( - array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()), - ), - 'red', - ), - array( - array( - array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - ), - 'yellow', - ), - array( - array( - array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), - array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - ), - 'green', - ), - array( - array( - array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), - ), - 'gray', - ), - ); - } - - private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com', $version = 'v1') - { - $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\HipChatHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testCreateWithTooLongName() - { - $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere'); - } - - public function testCreateWithTooLongNameV2() - { - // creating a handler with too long of a name but using the v2 api doesn't matter. - $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php deleted file mode 100644 index b2deb40..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Robert Kaufmann III - */ -class LogEntriesHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var LogEntriesHandler - */ - private $handler; - - public function testWriteContent() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test')); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content); - } - - public function testWriteBatchContent() - { - $records = array( - $this->getRecord(), - $this->getRecord(), - $this->getRecord(), - ); - $this->createHandler(); - $this->handler->handleBatch($records); - - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content); - } - - private function createHandler() - { - $useSSL = extension_loaded('openssl'); - $args = array('testToken', $useSSL, Logger::DEBUG, true); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\LogEntriesHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $args - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php deleted file mode 100644 index 6754f3d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\TestCase; - -class MailHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\MailHandler::handleBatch - */ - public function testHandleBatch() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->once()) - ->method('formatBatch'); // Each record is formatted - - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - $handler->expects($this->once()) - ->method('send'); - $handler->expects($this->never()) - ->method('write'); // write is for individual records - - $handler->setFormatter($formatter); - - $handler->handleBatch($this->getMultipleRecords()); - } - - /** - * @covers Monolog\Handler\MailHandler::handleBatch - */ - public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel() - { - $records = array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - ); - - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - $handler->expects($this->never()) - ->method('send'); - $handler->setLevel(Logger::ERROR); - - $handler->handleBatch($records); - } - - /** - * @covers Monolog\Handler\MailHandler::write - */ - public function testHandle() - { - $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); - - $record = $this->getRecord(); - $records = array($record); - $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n"; - - $handler->expects($this->once()) - ->method('send') - ->with($records[0]['formatted'], $records); - - $handler->handle($record); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php deleted file mode 100644 index a083322..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Raven_Client; - -class MockRavenClient extends Raven_Client -{ - public function capture($data, $stack, $vars = null) - { - $data = array_merge($this->get_user_data(), $data); - $this->lastData = $data; - $this->lastStack = $stack; - } - - public $lastData; - public $lastStack; -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php deleted file mode 100644 index 0fdef63..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class MongoDBHandlerTest extends TestCase -{ - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForInvalidMongo() - { - new MongoDBHandler(new \stdClass(), 'DB', 'Collection'); - } - - public function testHandle() - { - $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false); - $collection = $this->getMock('stdClass', array('save')); - - $mongo->expects($this->once()) - ->method('selectCollection') - ->with('DB', 'Collection') - ->will($this->returnValue($collection)); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $expected = array( - 'message' => 'test', - 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), - 'level' => Logger::WARNING, - 'level_name' => 'WARNING', - 'channel' => 'test', - 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), - 'extra' => array(), - ); - - $collection->expects($this->once()) - ->method('save') - ->with($expected); - - $handler = new MongoDBHandler($mongo, 'DB', 'Collection'); - $handler->handle($record); - } -} - -if (!class_exists('Mongo')) { - class Mongo - { - public function selectCollection() - { - } - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php deleted file mode 100644 index ddf545d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use InvalidArgumentException; - -function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null) -{ - $GLOBALS['mail'][] = func_get_args(); -} - -class NativeMailerHandlerTest extends TestCase -{ - protected function setUp() - { - $GLOBALS['mail'] = array(); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', "receiver@example.org\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->addHeader("Content-Type: text/html\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterArrayHeaderInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org")); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterContentTypeInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->setContentType("text/html\r\nFrom: faked@attacker.org"); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetterEncodingInjection() - { - $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); - $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org"); - } - - public function testSend() - { - $to = 'spammer@example.org'; - $subject = 'dear victim'; - $from = 'receiver@example.org'; - - $mailer = new NativeMailerHandler($to, $subject, $from); - $mailer->handleBatch(array()); - - // batch is empty, nothing sent - $this->assertEmpty($GLOBALS['mail']); - - // non-empty batch - $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - $this->assertNotEmpty($GLOBALS['mail']); - $this->assertInternalType('array', $GLOBALS['mail']); - $this->assertArrayHasKey('0', $GLOBALS['mail']); - $params = $GLOBALS['mail'][0]; - $this->assertCount(5, $params); - $this->assertSame($to, $params[0]); - $this->assertSame($subject, $params[1]); - $this->assertStringEndsWith(" test.ERROR: Foo Bar Baz [] []\n", $params[2]); - $this->assertSame("From: $from\r\nContent-type: text/plain; charset=utf-8\r\n", $params[3]); - $this->assertSame('', $params[4]); - } - - public function testMessageSubjectFormatting() - { - $mailer = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org'); - $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); - $this->assertNotEmpty($GLOBALS['mail']); - $this->assertInternalType('array', $GLOBALS['mail']); - $this->assertArrayHasKey('0', $GLOBALS['mail']); - $params = $GLOBALS['mail'][0]; - $this->assertCount(5, $params); - $this->assertSame('Alert: ERROR Foo Bar Baz', $params[1]); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php deleted file mode 100644 index 4d3a615..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php +++ /dev/null @@ -1,200 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Formatter\LineFormatter; -use Monolog\TestCase; -use Monolog\Logger; - -class NewRelicHandlerTest extends TestCase -{ - public static $appname; - public static $customParameters; - public static $transactionName; - - public function setUp() - { - self::$appname = null; - self::$customParameters = array(); - self::$transactionName = null; - } - - /** - * @expectedException Monolog\Handler\MissingExtensionException - */ - public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded() - { - $handler = new StubNewRelicHandlerWithoutExtension(); - $handler->handle($this->getRecord(Logger::ERROR)); - } - - public function testThehandlerCanHandleTheRecord() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR)); - } - - public function testThehandlerCanAddContextParamsToTheNewRelicTrace() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'))); - $this->assertEquals(array('context_a' => 'b'), self::$customParameters); - } - - public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace() - { - $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); - $handler->handle($this->getRecord( - Logger::ERROR, - 'log message', - array('a' => array('key1' => 'value1', 'key2' => 'value2')) - )); - $this->assertEquals( - array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'), - self::$customParameters - ); - } - - public function testThehandlerCanAddExtraParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message'); - $record['extra'] = array('c' => 'd'); - - $handler = new StubNewRelicHandler(); - $handler->handle($record); - - $this->assertEquals(array('extra_c' => 'd'), self::$customParameters); - } - - public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message'); - $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2')); - - $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); - $handler->handle($record); - - $this->assertEquals( - array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'), - self::$customParameters - ); - } - - public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace() - { - $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')); - $record['extra'] = array('c' => 'd'); - - $handler = new StubNewRelicHandler(); - $handler->handle($record); - - $expected = array( - 'context_a' => 'b', - 'extra_c' => 'd', - ); - - $this->assertEquals($expected, self::$customParameters); - } - - public function testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter() - { - $handler = new StubNewRelicHandler(); - $handler->setFormatter(new LineFormatter()); - $handler->handle($this->getRecord(Logger::ERROR)); - } - - public function testTheAppNameIsNullByDefault() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals(null, self::$appname); - } - - public function testTheAppNameCanBeInjectedFromtheConstructor() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals('myAppName', self::$appname); - } - - public function testTheAppNameCanBeOverriddenFromEachLog() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName'))); - - $this->assertEquals('logAppName', self::$appname); - } - - public function testTheTransactionNameIsNullByDefault() - { - $handler = new StubNewRelicHandler(); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals(null, self::$transactionName); - } - - public function testTheTransactionNameCanBeInjectedFromTheConstructor() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message')); - - $this->assertEquals('myTransaction', self::$transactionName); - } - - public function testTheTransactionNameCanBeOverriddenFromEachLog() - { - $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); - $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName'))); - - $this->assertEquals('logTransactName', self::$transactionName); - } -} - -class StubNewRelicHandlerWithoutExtension extends NewRelicHandler -{ - protected function isNewRelicEnabled() - { - return false; - } -} - -class StubNewRelicHandler extends NewRelicHandler -{ - protected function isNewRelicEnabled() - { - return true; - } -} - -function newrelic_notice_error() -{ - return true; -} - -function newrelic_set_appname($appname) -{ - return NewRelicHandlerTest::$appname = $appname; -} - -function newrelic_name_transaction($transactionName) -{ - return NewRelicHandlerTest::$transactionName = $transactionName; -} - -function newrelic_add_custom_parameter($key, $value) -{ - NewRelicHandlerTest::$customParameters[$key] = $value; - - return true; -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php deleted file mode 100644 index 292df78..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\NullHandler::handle - */ -class NullHandlerTest extends TestCase -{ - public function testHandle() - { - $handler = new NullHandler(); - $this->assertTrue($handler->handle($this->getRecord())); - } - - public function testHandleLowerLevelRecord() - { - $handler = new NullHandler(Logger::WARNING); - $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php deleted file mode 100644 index 152573e..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php +++ /dev/null @@ -1,273 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Exception; -use Monolog\ErrorHandler; -use Monolog\Logger; -use Monolog\TestCase; -use PhpConsole\Connector; -use PhpConsole\Dispatcher\Debug as DebugDispatcher; -use PhpConsole\Dispatcher\Errors as ErrorDispatcher; -use PhpConsole\Handler; -use PHPUnit_Framework_MockObject_MockObject; - -/** - * @covers Monolog\Handler\PHPConsoleHandler - * @author Sergey Barbushin https://www.linkedin.com/in/barbushin - */ -class PHPConsoleHandlerTest extends TestCase -{ - /** @var Connector|PHPUnit_Framework_MockObject_MockObject */ - protected $connector; - /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */ - protected $debugDispatcher; - /** @var ErrorDispatcher|PHPUnit_Framework_MockObject_MockObject */ - protected $errorDispatcher; - - protected function setUp() - { - if (!class_exists('PhpConsole\Connector')) { - $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); - } - $this->connector = $this->initConnectorMock(); - - $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector); - $this->connector->setDebugDispatcher($this->debugDispatcher); - - $this->errorDispatcher = $this->initErrorDispatcherMock($this->connector); - $this->connector->setErrorsDispatcher($this->errorDispatcher); - } - - protected function initDebugDispatcherMock(Connector $connector) - { - return $this->getMockBuilder('PhpConsole\Dispatcher\Debug') - ->disableOriginalConstructor() - ->setMethods(array('dispatchDebug')) - ->setConstructorArgs(array($connector, $connector->getDumper())) - ->getMock(); - } - - protected function initErrorDispatcherMock(Connector $connector) - { - return $this->getMockBuilder('PhpConsole\Dispatcher\Errors') - ->disableOriginalConstructor() - ->setMethods(array('dispatchError', 'dispatchException')) - ->setConstructorArgs(array($connector, $connector->getDumper())) - ->getMock(); - } - - protected function initConnectorMock() - { - $connector = $this->getMockBuilder('PhpConsole\Connector') - ->disableOriginalConstructor() - ->setMethods(array( - 'sendMessage', - 'onShutDown', - 'isActiveClient', - 'setSourcesBasePath', - 'setServerEncoding', - 'setPassword', - 'enableSslOnlyMode', - 'setAllowedIpMasks', - 'setHeadersLimit', - 'startEvalRequestsListener', - )) - ->getMock(); - - $connector->expects($this->any()) - ->method('isActiveClient') - ->will($this->returnValue(true)); - - return $connector; - } - - protected function getHandlerDefaultOption($name) - { - $handler = new PHPConsoleHandler(array(), $this->connector); - $options = $handler->getOptions(); - - return $options[$name]; - } - - protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG) - { - return new Logger('test', array( - new PHPConsoleHandler($handlerOptions, $this->connector, $level), - )); - } - - public function testInitWithDefaultConnector() - { - $handler = new PHPConsoleHandler(); - $this->assertEquals(spl_object_hash(Connector::getInstance()), spl_object_hash($handler->getConnector())); - } - - public function testInitWithCustomConnector() - { - $handler = new PHPConsoleHandler(array(), $this->connector); - $this->assertEquals(spl_object_hash($this->connector), spl_object_hash($handler->getConnector())); - } - - public function testDebug() - { - $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with($this->equalTo('test')); - $this->initLogger()->addDebug('test'); - } - - public function testDebugContextInMessage() - { - $message = 'test'; - $tag = 'tag'; - $context = array($tag, 'custom' => mt_rand()); - $expectedMessage = $message . ' ' . json_encode(array_slice($context, 1)); - $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with( - $this->equalTo($expectedMessage), - $this->equalTo($tag) - ); - $this->initLogger()->addDebug($message, $context); - } - - public function testDebugTags($tagsContextKeys = null) - { - $expectedTags = mt_rand(); - $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array()); - if (!$tagsContextKeys) { - $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext'); - } - foreach ($tagsContextKeys as $key) { - $debugDispatcher = $this->initDebugDispatcherMock($this->connector); - $debugDispatcher->expects($this->once())->method('dispatchDebug')->with( - $this->anything(), - $this->equalTo($expectedTags) - ); - $this->connector->setDebugDispatcher($debugDispatcher); - $logger->addDebug('test', array($key => $expectedTags)); - } - } - - public function testError($classesPartialsTraceIgnore = null) - { - $code = E_USER_NOTICE; - $message = 'message'; - $file = __FILE__; - $line = __LINE__; - $this->errorDispatcher->expects($this->once())->method('dispatchError')->with( - $this->equalTo($code), - $this->equalTo($message), - $this->equalTo($file), - $this->equalTo($line), - $classesPartialsTraceIgnore ?: $this->equalTo($this->getHandlerDefaultOption('classesPartialsTraceIgnore')) - ); - $errorHandler = ErrorHandler::register($this->initLogger($classesPartialsTraceIgnore ? array('classesPartialsTraceIgnore' => $classesPartialsTraceIgnore) : array()), false); - $errorHandler->registerErrorHandler(array(), false, E_USER_WARNING); - $errorHandler->handleError($code, $message, $file, $line); - } - - public function testException() - { - $e = new Exception(); - $this->errorDispatcher->expects($this->once())->method('dispatchException')->with( - $this->equalTo($e) - ); - $handler = $this->initLogger(); - $handler->log( - \Psr\Log\LogLevel::ERROR, - sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), - array('exception' => $e) - ); - } - - /** - * @expectedException Exception - */ - public function testWrongOptionsThrowsException() - { - new PHPConsoleHandler(array('xxx' => 1)); - } - - public function testOptionEnabled() - { - $this->debugDispatcher->expects($this->never())->method('dispatchDebug'); - $this->initLogger(array('enabled' => false))->addDebug('test'); - } - - public function testOptionClassesPartialsTraceIgnore() - { - $this->testError(array('Class', 'Namespace\\')); - } - - public function testOptionDebugTagsKeysInContext() - { - $this->testDebugTags(array('key1', 'key2')); - } - - public function testOptionUseOwnErrorsAndExceptionsHandler() - { - $this->initLogger(array('useOwnErrorsHandler' => true, 'useOwnExceptionsHandler' => true)); - $this->assertEquals(array(Handler::getInstance(), 'handleError'), set_error_handler(function () { - })); - $this->assertEquals(array(Handler::getInstance(), 'handleException'), set_exception_handler(function () { - })); - } - - public static function provideConnectorMethodsOptionsSets() - { - return array( - array('sourcesBasePath', 'setSourcesBasePath', __DIR__), - array('serverEncoding', 'setServerEncoding', 'cp1251'), - array('password', 'setPassword', '******'), - array('enableSslOnlyMode', 'enableSslOnlyMode', true, false), - array('ipMasks', 'setAllowedIpMasks', array('127.0.0.*')), - array('headersLimit', 'setHeadersLimit', 2500), - array('enableEvalListener', 'startEvalRequestsListener', true, false), - ); - } - - /** - * @dataProvider provideConnectorMethodsOptionsSets - */ - public function testOptionCallsConnectorMethod($option, $method, $value, $isArgument = true) - { - $expectCall = $this->connector->expects($this->once())->method($method); - if ($isArgument) { - $expectCall->with($value); - } - new PHPConsoleHandler(array($option => $value), $this->connector); - } - - public function testOptionDetectDumpTraceAndSource() - { - new PHPConsoleHandler(array('detectDumpTraceAndSource' => true), $this->connector); - $this->assertTrue($this->connector->getDebugDispatcher()->detectTraceAndSource); - } - - public static function provideDumperOptionsValues() - { - return array( - array('dumperLevelLimit', 'levelLimit', 1001), - array('dumperItemsCountLimit', 'itemsCountLimit', 1002), - array('dumperItemSizeLimit', 'itemSizeLimit', 1003), - array('dumperDumpSizeLimit', 'dumpSizeLimit', 1004), - array('dumperDetectCallbacks', 'detectCallbacks', true), - ); - } - - /** - * @dataProvider provideDumperOptionsValues - */ - public function testDumperOptions($option, $dumperProperty, $value) - { - new PHPConsoleHandler(array($option => $value), $this->connector); - $this->assertEquals($value, $this->connector->getDumper()->$dumperProperty); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php deleted file mode 100644 index 64eaab1..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\PsrHandler::handle - */ -class PsrHandlerTest extends TestCase -{ - public function logLevelProvider() - { - $levels = array(); - $monologLogger = new Logger(''); - - foreach ($monologLogger->getLevels() as $levelName => $level) { - $levels[] = array($levelName, $level); - } - - return $levels; - } - - /** - * @dataProvider logLevelProvider - */ - public function testHandlesAllLevels($levelName, $level) - { - $message = 'Hello, world! ' . $level; - $context = array('foo' => 'bar', 'level' => $level); - - $psrLogger = $this->getMock('Psr\Log\NullLogger'); - $psrLogger->expects($this->once()) - ->method('log') - ->with(strtolower($levelName), $message, $context); - - $handler = new PsrHandler($psrLogger); - $handler->handle(array('level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context)); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php deleted file mode 100644 index 56df474..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * Almost all examples (expected header, titles, messages) taken from - * https://www.pushover.net/api - * @author Sebastian Göttschkes - * @see https://www.pushover.net/api - */ -class PushoverHandlerTest extends TestCase -{ - private $res; - private $handler; - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - - return $content; - } - - /** - * @depends testWriteHeader - */ - public function testWriteContent($content) - { - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content); - } - - public function testWriteWithComplexTitle() - { - $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/title=Backup\+finished\+-\+SQL1/', $content); - } - - public function testWriteWithComplexMessage() - { - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); - } - - public function testWriteWithTooLongMessage() - { - $message = str_pad('test', 520, 'a'); - $this->createHandler(); - $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications - $this->handler->handle($this->getRecord(Logger::CRITICAL, $message)); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $expectedMessage = substr($message, 0, 505); - - $this->assertRegexp('/message=' . $expectedMessage . '&title/', $content); - } - - public function testWriteWithHighPriority() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content); - } - - public function testWriteWithEmergencyPriority() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); - } - - public function testWriteToMultipleUsers() - { - $this->createHandler('myToken', array('userA', 'userB')); - $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content); - $this->assertRegexp('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); - } - - private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog') - { - $constructorArgs = array($token, $user, $title); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\PushoverHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php deleted file mode 100644 index 26d212b..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -class RavenHandlerTest extends TestCase -{ - public function setUp() - { - if (!class_exists('Raven_Client')) { - $this->markTestSkipped('raven/raven not installed'); - } - - require_once __DIR__ . '/MockRavenClient.php'; - } - - /** - * @covers Monolog\Handler\RavenHandler::__construct - */ - public function testConstruct() - { - $handler = new RavenHandler($this->getRavenClient()); - $this->assertInstanceOf('Monolog\Handler\RavenHandler', $handler); - } - - protected function getHandler($ravenClient) - { - $handler = new RavenHandler($ravenClient); - - return $handler; - } - - protected function getRavenClient() - { - $dsn = 'http://43f6017361224d098402974103bfc53d:a6a0538fc2934ba2bed32e08741b2cd3@marca.python.live.cheggnet.com:9000/1'; - - return new MockRavenClient($dsn); - } - - public function testDebug() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $record = $this->getRecord(Logger::DEBUG, 'A test debug message'); - $handler->handle($record); - - $this->assertEquals($ravenClient::DEBUG, $ravenClient->lastData['level']); - $this->assertContains($record['message'], $ravenClient->lastData['message']); - } - - public function testWarning() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $record = $this->getRecord(Logger::WARNING, 'A test warning message'); - $handler->handle($record); - - $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData['level']); - $this->assertContains($record['message'], $ravenClient->lastData['message']); - } - - public function testTag() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $tags = array(1, 2, 'foo'); - $record = $this->getRecord(Logger::INFO, 'test', array('tags' => $tags)); - $handler->handle($record); - - $this->assertEquals($tags, $ravenClient->lastData['tags']); - } - - public function testExtraParameters() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $checksum = '098f6bcd4621d373cade4e832627b4f6'; - $release = '05a671c66aefea124cc08b76ea6d30bb'; - $eventId = '31423'; - $record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum, 'release' => $release, 'event_id' => $eventId)); - $handler->handle($record); - - $this->assertEquals($checksum, $ravenClient->lastData['checksum']); - $this->assertEquals($release, $ravenClient->lastData['release']); - $this->assertEquals($eventId, $ravenClient->lastData['event_id']); - } - - public function testFingerprint() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $fingerprint = array('{{ default }}', 'other value'); - $record = $this->getRecord(Logger::INFO, 'test', array('fingerprint' => $fingerprint)); - $handler->handle($record); - - $this->assertEquals($fingerprint, $ravenClient->lastData['fingerprint']); - } - - public function testUserContext() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $recordWithNoContext = $this->getRecord(Logger::INFO, 'test with default user context'); - // set user context 'externally' - - $user = array( - 'id' => '123', - 'email' => 'test@test.com', - ); - - $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user)); - - $ravenClient->user_context(array('id' => 'test_user_id')); - // handle context - $handler->handle($recordWithContext); - $this->assertEquals($user, $ravenClient->lastData['user']); - - // check to see if its reset - $handler->handle($recordWithNoContext); - $this->assertInternalType('array', $ravenClient->context->user); - $this->assertSame('test_user_id', $ravenClient->context->user['id']); - - // handle with null context - $ravenClient->user_context(null); - $handler->handle($recordWithContext); - $this->assertEquals($user, $ravenClient->lastData['user']); - - // check to see if its reset - $handler->handle($recordWithNoContext); - $this->assertNull($ravenClient->context->user); - } - - public function testException() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - try { - $this->methodThatThrowsAnException(); - } catch (\Exception $e) { - $record = $this->getRecord(Logger::ERROR, $e->getMessage(), array('exception' => $e)); - $handler->handle($record); - } - - $this->assertEquals($record['message'], $ravenClient->lastData['message']); - } - - public function testHandleBatch() - { - $records = $this->getMultipleRecords(); - $records[] = $this->getRecord(Logger::WARNING, 'warning'); - $records[] = $this->getRecord(Logger::WARNING, 'warning'); - - $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $logFormatter->expects($this->once())->method('formatBatch'); - - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) { - return $record['level'] == 400; - })); - - $handler = $this->getHandler($this->getRavenClient()); - $handler->setBatchFormatter($logFormatter); - $handler->setFormatter($formatter); - $handler->handleBatch($records); - } - - public function testHandleBatchDoNothingIfRecordsAreBelowLevel() - { - $records = array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - ); - - $handler = $this->getMock('Monolog\Handler\RavenHandler', null, array($this->getRavenClient())); - $handler->expects($this->never())->method('handle'); - $handler->setLevel(Logger::ERROR); - $handler->handleBatch($records); - } - - public function testHandleBatchPicksProperMessage() - { - $records = array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information 1'), - $this->getRecord(Logger::ERROR, 'error 1'), - $this->getRecord(Logger::WARNING, 'warning'), - $this->getRecord(Logger::ERROR, 'error 2'), - $this->getRecord(Logger::INFO, 'information 2'), - ); - - $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $logFormatter->expects($this->once())->method('formatBatch'); - - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) { - return $record['message'] == 'error 1'; - })); - - $handler = $this->getHandler($this->getRavenClient()); - $handler->setBatchFormatter($logFormatter); - $handler->setFormatter($formatter); - $handler->handleBatch($records); - } - - public function testGetSetBatchFormatter() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - - $handler->setBatchFormatter($formatter = new LineFormatter()); - $this->assertSame($formatter, $handler->getBatchFormatter()); - } - - public function testRelease() - { - $ravenClient = $this->getRavenClient(); - $handler = $this->getHandler($ravenClient); - $release = 'v42.42.42'; - $handler->setRelease($release); - $record = $this->getRecord(Logger::INFO, 'test'); - $handler->handle($record); - $this->assertEquals($release, $ravenClient->lastData['release']); - - $localRelease = 'v41.41.41'; - $record = $this->getRecord(Logger::INFO, 'test', array('release' => $localRelease)); - $handler->handle($record); - $this->assertEquals($localRelease, $ravenClient->lastData['release']); - } - - private function methodThatThrowsAnException() - { - throw new \Exception('This is an exception'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php deleted file mode 100644 index 689d527..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; - -class RedisHandlerTest extends TestCase -{ - /** - * @expectedException InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForInvalidRedis() - { - new RedisHandler(new \stdClass(), 'key'); - } - - public function testConstructorShouldWorkWithPredis() - { - $redis = $this->getMock('Predis\Client'); - $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); - } - - public function testConstructorShouldWorkWithRedis() - { - $redis = $this->getMock('Redis'); - $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); - } - - public function testPredisHandle() - { - $redis = $this->getMock('Predis\Client', array('rpush')); - - // Predis\Client uses rpush - $redis->expects($this->once()) - ->method('rpush') - ->with('key', 'test'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key'); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testRedisHandle() - { - $redis = $this->getMock('Redis', array('rpush')); - - // Redis uses rPush - $redis->expects($this->once()) - ->method('rPush') - ->with('key', 'test'); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key'); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testRedisHandleCapped() - { - $redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'exec')); - - // Redis uses multi - $redis->expects($this->once()) - ->method('multi') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('rpush') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('ltrim') - ->will($this->returnSelf()); - - $redis->expects($this->once()) - ->method('exec') - ->will($this->returnSelf()); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } - - public function testPredisHandleCapped() - { - $redis = $this->getMock('Predis\Client', array('transaction')); - - $redisTransaction = $this->getMock('Predis\Client', array('rpush', 'ltrim')); - - $redisTransaction->expects($this->once()) - ->method('rpush') - ->will($this->returnSelf()); - - $redisTransaction->expects($this->once()) - ->method('ltrim') - ->will($this->returnSelf()); - - // Redis uses multi - $redis->expects($this->once()) - ->method('transaction') - ->will($this->returnCallback(function ($cb) use ($redisTransaction) { - $cb($redisTransaction); - })); - - $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); - - $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); - $handler->setFormatter(new LineFormatter("%message%")); - $handler->handle($record); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php deleted file mode 100644 index f302e91..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Exception; -use Monolog\TestCase; -use Monolog\Logger; -use PHPUnit_Framework_MockObject_MockObject as MockObject; - -/** - * @author Erik Johansson - * @see https://rollbar.com/docs/notifier/rollbar-php/ - * - * @coversDefaultClass Monolog\Handler\RollbarHandler - */ -class RollbarHandlerTest extends TestCase -{ - /** - * @var MockObject - */ - private $rollbarNotifier; - - /** - * @var array - */ - public $reportedExceptionArguments = null; - - protected function setUp() - { - parent::setUp(); - - $this->setupRollbarNotifierMock(); - } - - /** - * When reporting exceptions to Rollbar the - * level has to be set in the payload data - */ - public function testExceptionLogLevel() - { - $handler = $this->createHandler(); - - $handler->handle($this->createExceptionRecord(Logger::DEBUG)); - - $this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']); - } - - private function setupRollbarNotifierMock() - { - $this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier') - ->setMethods(array('report_message', 'report_exception', 'flush')) - ->getMock(); - - $that = $this; - - $this->rollbarNotifier - ->expects($this->any()) - ->method('report_exception') - ->willReturnCallback(function ($exception, $context, $payload) use ($that) { - $that->reportedExceptionArguments = compact('exception', 'context', 'payload'); - }); - } - - private function createHandler() - { - return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG); - } - - private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null) - { - return $this->getRecord($level, $message, array( - 'exception' => $exception ?: new Exception() - )); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php deleted file mode 100644 index f1feb22..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use PHPUnit_Framework_Error_Deprecated; - -/** - * @covers Monolog\Handler\RotatingFileHandler - */ -class RotatingFileHandlerTest extends TestCase -{ - /** - * This var should be private but then the anonymous function - * in the `setUp` method won't be able to set it. `$this` cant't - * be used in the anonymous function in `setUp` because PHP 5.3 - * does not support it. - */ - public $lastError; - - public function setUp() - { - $dir = __DIR__.'/Fixtures'; - chmod($dir, 0777); - if (!is_writable($dir)) { - $this->markTestSkipped($dir.' must be writable to test the RotatingFileHandler.'); - } - $this->lastError = null; - $self = $this; - // workaround with &$self used for PHP 5.3 - set_error_handler(function($code, $message) use (&$self) { - $self->lastError = array( - 'code' => $code, - 'message' => $message, - ); - }); - } - - private function assertErrorWasTriggered($code, $message) - { - if (empty($this->lastError)) { - $this->fail( - sprintf( - 'Failed asserting that error with code `%d` and message `%s` was triggered', - $code, - $message - ) - ); - } - $this->assertEquals($code, $this->lastError['code'], sprintf('Expected an error with code %d to be triggered, got `%s` instead', $code, $this->lastError['code'])); - $this->assertEquals($message, $this->lastError['message'], sprintf('Expected an error with message `%d` to be triggered, got `%s` instead', $message, $this->lastError['message'])); - } - - public function testRotationCreatesNewFile() - { - touch(__DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400).'.rot'); - - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord()); - - $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; - $this->assertTrue(file_exists($log)); - $this->assertEquals('test', file_get_contents($log)); - } - - /** - * @dataProvider rotationTests - */ - public function testRotation($createFile, $dateFormat, $timeCallback) - { - touch($old1 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-1)).'.rot'); - touch($old2 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-2)).'.rot'); - touch($old3 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-3)).'.rot'); - touch($old4 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-4)).'.rot'); - - $log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot'; - - if ($createFile) { - touch($log); - } - - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->setFilenameFormat('{filename}-{date}', $dateFormat); - $handler->handle($this->getRecord()); - - $handler->close(); - - $this->assertTrue(file_exists($log)); - $this->assertTrue(file_exists($old1)); - $this->assertEquals($createFile, file_exists($old2)); - $this->assertEquals($createFile, file_exists($old3)); - $this->assertEquals($createFile, file_exists($old4)); - $this->assertEquals('test', file_get_contents($log)); - } - - public function rotationTests() - { - $now = time(); - $dayCallback = function($ago) use ($now) { - return $now + 86400 * $ago; - }; - $monthCallback = function($ago) { - return gmmktime(0, 0, 0, date('n') + $ago, 1, date('Y')); - }; - $yearCallback = function($ago) { - return gmmktime(0, 0, 0, 1, 1, date('Y') + $ago); - }; - - return array( - 'Rotation is triggered when the file of the current day is not present' - => array(true, RotatingFileHandler::FILE_PER_DAY, $dayCallback), - 'Rotation is not triggered when the file of the current day is already present' - => array(false, RotatingFileHandler::FILE_PER_DAY, $dayCallback), - - 'Rotation is triggered when the file of the current month is not present' - => array(true, RotatingFileHandler::FILE_PER_MONTH, $monthCallback), - 'Rotation is not triggered when the file of the current month is already present' - => array(false, RotatingFileHandler::FILE_PER_MONTH, $monthCallback), - - 'Rotation is triggered when the file of the current year is not present' - => array(true, RotatingFileHandler::FILE_PER_YEAR, $yearCallback), - 'Rotation is not triggered when the file of the current year is already present' - => array(false, RotatingFileHandler::FILE_PER_YEAR, $yearCallback), - ); - } - - /** - * @dataProvider dateFormatProvider - */ - public function testAllowOnlyFixedDefinedDateFormats($dateFormat, $valid) - { - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); - $handler->setFilenameFormat('{filename}-{date}', $dateFormat); - if (!$valid) { - $this->assertErrorWasTriggered( - E_USER_DEPRECATED, - 'Invalid date format - format must be one of RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), '. - 'RotatingFileHandler::FILE_PER_MONTH ("Y-m") or RotatingFileHandler::FILE_PER_YEAR ("Y"), '. - 'or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.' - ); - } - } - - public function dateFormatProvider() - { - return array( - array(RotatingFileHandler::FILE_PER_DAY, true), - array(RotatingFileHandler::FILE_PER_MONTH, true), - array(RotatingFileHandler::FILE_PER_YEAR, true), - array('m-d-Y', false), - array('Y-m-d-h-i', false) - ); - } - - /** - * @dataProvider filenameFormatProvider - */ - public function testDisallowFilenameFormatsWithoutDate($filenameFormat, $valid) - { - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); - $handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY); - if (!$valid) { - $this->assertErrorWasTriggered( - E_USER_DEPRECATED, - 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.' - ); - } - } - - public function filenameFormatProvider() - { - return array( - array('{filename}', false), - array('{filename}-{date}', true), - array('{date}', true), - array('foobar-{date}', true), - array('foo-{date}-bar', true), - array('{date}-foobar', true), - array('foobar', false), - ); - } - - public function testReuseCurrentFile() - { - $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; - file_put_contents($log, "foo"); - $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord()); - $this->assertEquals('footest', file_get_contents($log)); - } - - public function tearDown() - { - foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) { - unlink($file); - } - restore_error_handler(); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php deleted file mode 100644 index b354cee..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -/** - * @covers Monolog\Handler\SamplingHandler::handle - */ -class SamplingHandlerTest extends TestCase -{ - public function testHandle() - { - $testHandler = new TestHandler(); - $handler = new SamplingHandler($testHandler, 2); - for ($i = 0; $i < 10000; $i++) { - $handler->handle($this->getRecord()); - } - $count = count($testHandler->getRecords()); - // $count should be half of 10k, so between 4k and 6k - $this->assertLessThan(6000, $count); - $this->assertGreaterThan(4000, $count); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php deleted file mode 100644 index e1aa96d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ /dev/null @@ -1,387 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\Slack; - -use Monolog\Logger; -use Monolog\TestCase; - -/** - * @coversDefaultClass Monolog\Handler\Slack\SlackRecord - */ -class SlackRecordTest extends TestCase -{ - private $jsonPrettyPrintFlag; - - protected function setUp() - { - $this->jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; - } - - public function dataGetAttachmentColor() - { - return array( - array(Logger::DEBUG, SlackRecord::COLOR_DEFAULT), - array(Logger::INFO, SlackRecord::COLOR_GOOD), - array(Logger::NOTICE, SlackRecord::COLOR_GOOD), - array(Logger::WARNING, SlackRecord::COLOR_WARNING), - array(Logger::ERROR, SlackRecord::COLOR_DANGER), - array(Logger::CRITICAL, SlackRecord::COLOR_DANGER), - array(Logger::ALERT, SlackRecord::COLOR_DANGER), - array(Logger::EMERGENCY, SlackRecord::COLOR_DANGER), - ); - } - - /** - * @dataProvider dataGetAttachmentColor - * @param int $logLevel - * @param string $expectedColour RGB hex color or name of Slack color - * @covers ::getAttachmentColor - */ - public function testGetAttachmentColor($logLevel, $expectedColour) - { - $slackRecord = new SlackRecord(); - $this->assertSame( - $expectedColour, - $slackRecord->getAttachmentColor($logLevel) - ); - } - - public function testAddsChannel() - { - $channel = '#test'; - $record = new SlackRecord($channel); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayHasKey('channel', $data); - $this->assertSame($channel, $data['channel']); - } - - public function testNoUsernameByDefault() - { - $record = new SlackRecord(); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayNotHasKey('username', $data); - } - - /** - * @return array - */ - public function dataStringify() - { - $jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; - - $multipleDimensions = array(array(1, 2)); - $numericKeys = array('library' => 'monolog'); - $singleDimension = array(1, 'Hello', 'Jordi'); - - return array( - array(array(), '[]'), - array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)), - array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)), - array($singleDimension, json_encode($singleDimension)) - ); - } - - /** - * @dataProvider dataStringify - */ - public function testStringify($fields, $expectedResult) - { - $slackRecord = new SlackRecord( - '#test', - 'test', - true, - null, - true, - true - ); - - $this->assertSame($expectedResult, $slackRecord->stringify($fields)); - } - - public function testAddsCustomUsername() - { - $username = 'Monolog bot'; - $record = new SlackRecord(null, $username); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayHasKey('username', $data); - $this->assertSame($username, $data['username']); - } - - public function testNoIcon() - { - $record = new SlackRecord(); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayNotHasKey('icon_emoji', $data); - } - - public function testAddsIcon() - { - $record = $this->getRecord(); - $slackRecord = new SlackRecord(null, null, false, 'ghost'); - $data = $slackRecord->getSlackData($record); - - $slackRecord2 = new SlackRecord(null, null, false, 'http://github.com/Seldaek/monolog'); - $data2 = $slackRecord2->getSlackData($record); - - $this->assertArrayHasKey('icon_emoji', $data); - $this->assertSame(':ghost:', $data['icon_emoji']); - $this->assertArrayHasKey('icon_url', $data2); - $this->assertSame('http://github.com/Seldaek/monolog', $data2['icon_url']); - } - - public function testAttachmentsNotPresentIfNoAttachment() - { - $record = new SlackRecord(null, null, false); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayNotHasKey('attachments', $data); - } - - public function testAddsOneAttachment() - { - $record = new SlackRecord(); - $data = $record->getSlackData($this->getRecord()); - - $this->assertArrayHasKey('attachments', $data); - $this->assertArrayHasKey(0, $data['attachments']); - $this->assertInternalType('array', $data['attachments'][0]); - } - - public function testTextEqualsMessageIfNoAttachment() - { - $message = 'Test message'; - $record = new SlackRecord(null, null, false); - $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); - - $this->assertArrayHasKey('text', $data); - $this->assertSame($message, $data['text']); - } - - public function testTextEqualsFormatterOutput() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter - ->expects($this->any()) - ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; })); - - $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter2 - ->expects($this->any()) - ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; })); - - $message = 'Test message'; - $record = new SlackRecord(null, null, false, null, false, false, array(), $formatter); - $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); - - $this->assertArrayHasKey('text', $data); - $this->assertSame($message . 'test', $data['text']); - - $record->setFormatter($formatter2); - $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); - - $this->assertArrayHasKey('text', $data); - $this->assertSame($message . 'test1', $data['text']); - } - - public function testAddsFallbackAndTextToAttachment() - { - $message = 'Test message'; - $record = new SlackRecord(null); - $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); - - $this->assertSame($message, $data['attachments'][0]['text']); - $this->assertSame($message, $data['attachments'][0]['fallback']); - } - - public function testMapsLevelToColorAttachmentColor() - { - $record = new SlackRecord(null); - $errorLoggerRecord = $this->getRecord(Logger::ERROR); - $emergencyLoggerRecord = $this->getRecord(Logger::EMERGENCY); - $warningLoggerRecord = $this->getRecord(Logger::WARNING); - $infoLoggerRecord = $this->getRecord(Logger::INFO); - $debugLoggerRecord = $this->getRecord(Logger::DEBUG); - - $data = $record->getSlackData($errorLoggerRecord); - $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']); - - $data = $record->getSlackData($emergencyLoggerRecord); - $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']); - - $data = $record->getSlackData($warningLoggerRecord); - $this->assertSame(SlackRecord::COLOR_WARNING, $data['attachments'][0]['color']); - - $data = $record->getSlackData($infoLoggerRecord); - $this->assertSame(SlackRecord::COLOR_GOOD, $data['attachments'][0]['color']); - - $data = $record->getSlackData($debugLoggerRecord); - $this->assertSame(SlackRecord::COLOR_DEFAULT, $data['attachments'][0]['color']); - } - - public function testAddsShortAttachmentWithoutContextAndExtra() - { - $level = Logger::ERROR; - $levelName = Logger::getLevelName($level); - $record = new SlackRecord(null, null, true, null, true); - $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1))); - - $attachment = $data['attachments'][0]; - $this->assertArrayHasKey('title', $attachment); - $this->assertArrayHasKey('fields', $attachment); - $this->assertSame($levelName, $attachment['title']); - $this->assertSame(array(), $attachment['fields']); - } - - public function testAddsShortAttachmentWithContextAndExtra() - { - $level = Logger::ERROR; - $levelName = Logger::getLevelName($level); - $context = array('test' => 1); - $extra = array('tags' => array('web')); - $record = new SlackRecord(null, null, true, null, true, true); - $loggerRecord = $this->getRecord($level, 'test', $context); - $loggerRecord['extra'] = $extra; - $data = $record->getSlackData($loggerRecord); - - $attachment = $data['attachments'][0]; - $this->assertArrayHasKey('title', $attachment); - $this->assertArrayHasKey('fields', $attachment); - $this->assertCount(2, $attachment['fields']); - $this->assertSame($levelName, $attachment['title']); - $this->assertSame( - array( - array( - 'title' => 'Extra', - 'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)), - 'short' => false - ), - array( - 'title' => 'Context', - 'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)), - 'short' => false - ) - ), - $attachment['fields'] - ); - } - - public function testAddsLongAttachmentWithoutContextAndExtra() - { - $level = Logger::ERROR; - $levelName = Logger::getLevelName($level); - $record = new SlackRecord(null, null, true, null); - $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1))); - - $attachment = $data['attachments'][0]; - $this->assertArrayHasKey('title', $attachment); - $this->assertArrayHasKey('fields', $attachment); - $this->assertCount(1, $attachment['fields']); - $this->assertSame('Message', $attachment['title']); - $this->assertSame( - array(array( - 'title' => 'Level', - 'value' => $levelName, - 'short' => false - )), - $attachment['fields'] - ); - } - - public function testAddsLongAttachmentWithContextAndExtra() - { - $level = Logger::ERROR; - $levelName = Logger::getLevelName($level); - $context = array('test' => 1); - $extra = array('tags' => array('web')); - $record = new SlackRecord(null, null, true, null, false, true); - $loggerRecord = $this->getRecord($level, 'test', $context); - $loggerRecord['extra'] = $extra; - $data = $record->getSlackData($loggerRecord); - - $expectedFields = array( - array( - 'title' => 'Level', - 'value' => $levelName, - 'short' => false, - ), - array( - 'title' => 'tags', - 'value' => sprintf('```%s```', json_encode($extra['tags'])), - 'short' => false - ), - array( - 'title' => 'test', - 'value' => $context['test'], - 'short' => false - ) - ); - - $attachment = $data['attachments'][0]; - $this->assertArrayHasKey('title', $attachment); - $this->assertArrayHasKey('fields', $attachment); - $this->assertCount(3, $attachment['fields']); - $this->assertSame('Message', $attachment['title']); - $this->assertSame( - $expectedFields, - $attachment['fields'] - ); - } - - public function testAddsTimestampToAttachment() - { - $record = $this->getRecord(); - $slackRecord = new SlackRecord(); - $data = $slackRecord->getSlackData($this->getRecord()); - - $attachment = $data['attachments'][0]; - $this->assertArrayHasKey('ts', $attachment); - $this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']); - } - - public function testExcludeExtraAndContextFields() - { - $record = $this->getRecord( - Logger::WARNING, - 'test', - array('info' => array('library' => 'monolog', 'author' => 'Jordi')) - ); - $record['extra'] = array('tags' => array('web', 'cli')); - - $slackRecord = new SlackRecord(null, null, true, null, false, true, array('context.info.library', 'extra.tags.1')); - $data = $slackRecord->getSlackData($record); - $attachment = $data['attachments'][0]; - - $expected = array( - array( - 'title' => 'info', - 'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)), - 'short' => false - ), - array( - 'title' => 'tags', - 'value' => sprintf('```%s```', json_encode(array('web'))), - 'short' => false - ), - ); - - foreach ($expected as $field) { - $this->assertNotFalse(array_search($field, $attachment['fields'])); - break; - } - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php deleted file mode 100644 index b12b01f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Monolog\Handler\Slack\SlackRecord; - -/** - * @author Greg Kedzierski - * @see https://api.slack.com/ - */ -class SlackHandlerTest extends TestCase -{ - /** - * @var resource - */ - private $res; - - /** - * @var SlackHandler - */ - private $handler; - - public function setUp() - { - if (!extension_loaded('openssl')) { - $this->markTestSkipped('This test requires openssl to run'); - } - } - - public function testWriteHeader() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/POST \/api\/chat.postMessage HTTP\/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); - } - - public function testWriteContent() - { - $this->createHandler(); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegExp('/username=Monolog/', $content); - $this->assertRegExp('/channel=channel1/', $content); - $this->assertRegExp('/token=myToken/', $content); - $this->assertRegExp('/attachments/', $content); - } - - public function testWriteContentUsesFormatterIfProvided() - { - $this->createHandler('myToken', 'channel1', 'Monolog', false); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->createHandler('myToken', 'channel1', 'Monolog', false); - $this->handler->setFormatter(new LineFormatter('foo--%message%')); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2')); - fseek($this->res, 0); - $content2 = fread($this->res, 1024); - - $this->assertRegexp('/text=test1/', $content); - $this->assertRegexp('/text=foo--test2/', $content2); - } - - public function testWriteContentWithEmoji() - { - $this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien'); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/icon_emoji=%3Aalien%3A/', $content); - } - - /** - * @dataProvider provideLevelColors - */ - public function testWriteContentWithColors($level, $expectedColor) - { - $this->createHandler(); - $this->handler->handle($this->getRecord($level, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/%22color%22%3A%22'.$expectedColor.'/', $content); - } - - public function testWriteContentWithPlainTextMessage() - { - $this->createHandler('myToken', 'channel1', 'Monolog', false); - $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); - fseek($this->res, 0); - $content = fread($this->res, 1024); - - $this->assertRegexp('/text=test1/', $content); - } - - public function provideLevelColors() - { - return array( - array(Logger::DEBUG, urlencode(SlackRecord::COLOR_DEFAULT)), - array(Logger::INFO, SlackRecord::COLOR_GOOD), - array(Logger::NOTICE, SlackRecord::COLOR_GOOD), - array(Logger::WARNING, SlackRecord::COLOR_WARNING), - array(Logger::ERROR, SlackRecord::COLOR_DANGER), - array(Logger::CRITICAL, SlackRecord::COLOR_DANGER), - array(Logger::ALERT, SlackRecord::COLOR_DANGER), - array(Logger::EMERGENCY,SlackRecord::COLOR_DANGER), - ); - } - - private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeExtra = false) - { - $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra); - $this->res = fopen('php://memory', 'a'); - $this->handler = $this->getMock( - '\Monolog\Handler\SlackHandler', - array('fsockopen', 'streamSetTimeout', 'closeSocket'), - $constructorArgs - ); - - $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($this->handler, 'localhost:1234'); - - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - $this->handler->expects($this->any()) - ->method('closeSocket') - ->will($this->returnValue(true)); - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php deleted file mode 100644 index c9229e2..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; -use Monolog\Formatter\LineFormatter; -use Monolog\Handler\Slack\SlackRecord; - -/** - * @author Haralan Dobrev - * @see https://api.slack.com/incoming-webhooks - * @coversDefaultClass Monolog\Handler\SlackWebhookHandler - */ -class SlackWebhookHandlerTest extends TestCase -{ - const WEBHOOK_URL = 'https://hooks.slack.com/services/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E'; - - /** - * @covers ::__construct - * @covers ::getSlackRecord - */ - public function testConstructorMinimal() - { - $handler = new SlackWebhookHandler(self::WEBHOOK_URL); - $record = $this->getRecord(); - $slackRecord = $handler->getSlackRecord(); - $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord); - $this->assertEquals(array( - 'attachments' => array( - array( - 'fallback' => 'test', - 'text' => 'test', - 'color' => SlackRecord::COLOR_WARNING, - 'fields' => array( - array( - 'title' => 'Level', - 'value' => 'WARNING', - 'short' => false, - ), - ), - 'title' => 'Message', - 'mrkdwn_in' => array('fields'), - 'ts' => $record['datetime']->getTimestamp(), - ), - ), - ), $slackRecord->getSlackData($record)); - } - - /** - * @covers ::__construct - * @covers ::getSlackRecord - */ - public function testConstructorFull() - { - $handler = new SlackWebhookHandler( - self::WEBHOOK_URL, - 'test-channel', - 'test-username', - false, - ':ghost:', - false, - false, - Logger::DEBUG, - false - ); - - $slackRecord = $handler->getSlackRecord(); - $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord); - $this->assertEquals(array( - 'username' => 'test-username', - 'text' => 'test', - 'channel' => 'test-channel', - 'icon_emoji' => ':ghost:', - ), $slackRecord->getSlackData($this->getRecord())); - } - - /** - * @covers ::getFormatter - */ - public function testGetFormatter() - { - $handler = new SlackWebhookHandler(self::WEBHOOK_URL); - $formatter = $handler->getFormatter(); - $this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter); - } - - /** - * @covers ::setFormatter - */ - public function testSetFormatter() - { - $handler = new SlackWebhookHandler(self::WEBHOOK_URL); - $formatter = new LineFormatter(); - $handler->setFormatter($formatter); - $this->assertSame($formatter, $handler->getFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php deleted file mode 100644 index b1b02bd..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Haralan Dobrev - * @see https://slack.com/apps/A0F81R8ET-slackbot - * @coversDefaultClass Monolog\Handler\SlackbotHandler - */ -class SlackbotHandlerTest extends TestCase -{ - /** - * @covers ::__construct - */ - public function testConstructorMinimal() - { - $handler = new SlackbotHandler('test-team', 'test-token', 'test-channel'); - $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler); - } - - /** - * @covers ::__construct - */ - public function testConstructorFull() - { - $handler = new SlackbotHandler( - 'test-team', - 'test-token', - 'test-channel', - Logger::DEBUG, - false - ); - $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php deleted file mode 100644 index 1f9c1f2..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php +++ /dev/null @@ -1,309 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @author Pablo de Leon Belloc - */ -class SocketHandlerTest extends TestCase -{ - /** - * @var Monolog\Handler\SocketHandler - */ - private $handler; - - /** - * @var resource - */ - private $res; - - /** - * @expectedException UnexpectedValueException - */ - public function testInvalidHostname() - { - $this->createHandler('garbage://here'); - $this->writeRecord('data'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testBadConnectionTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setConnectionTimeout(-1); - } - - public function testSetConnectionTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setConnectionTimeout(10.1); - $this->assertEquals(10.1, $this->handler->getConnectionTimeout()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testBadTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setTimeout(-1); - } - - public function testSetTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setTimeout(10.25); - $this->assertEquals(10.25, $this->handler->getTimeout()); - } - - public function testSetWritingTimeout() - { - $this->createHandler('localhost:1234'); - $this->handler->setWritingTimeout(10.25); - $this->assertEquals(10.25, $this->handler->getWritingTimeout()); - } - - public function testSetConnectionString() - { - $this->createHandler('tcp://localhost:9090'); - $this->assertEquals('tcp://localhost:9090', $this->handler->getConnectionString()); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownOnFsockopenError() - { - $this->setMockHandler(array('fsockopen')); - $this->handler->expects($this->once()) - ->method('fsockopen') - ->will($this->returnValue(false)); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownOnPfsockopenError() - { - $this->setMockHandler(array('pfsockopen')); - $this->handler->expects($this->once()) - ->method('pfsockopen') - ->will($this->returnValue(false)); - $this->handler->setPersistent(true); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testExceptionIsThrownIfCannotSetTimeout() - { - $this->setMockHandler(array('streamSetTimeout')); - $this->handler->expects($this->once()) - ->method('streamSetTimeout') - ->will($this->returnValue(false)); - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsOnIfFwriteReturnsFalse() - { - $this->setMockHandler(array('fwrite')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => false, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(2)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsIfStreamTimesOut() - { - $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => 5, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(1)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - $this->handler->expects($this->exactly(1)) - ->method('streamGetMetadata') - ->will($this->returnValue(array('timed_out' => true))); - - $this->writeRecord('Hello world'); - } - - /** - * @expectedException RuntimeException - */ - public function testWriteFailsOnIncompleteWrite() - { - $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - - $res = $this->res; - $callback = function ($string) use ($res) { - fclose($res); - - return strlen('Hello'); - }; - - $this->handler->expects($this->exactly(1)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - $this->handler->expects($this->exactly(1)) - ->method('streamGetMetadata') - ->will($this->returnValue(array('timed_out' => false))); - - $this->writeRecord('Hello world'); - } - - public function testWriteWithMemoryFile() - { - $this->setMockHandler(); - $this->writeRecord('test1'); - $this->writeRecord('test2'); - $this->writeRecord('test3'); - fseek($this->res, 0); - $this->assertEquals('test1test2test3', fread($this->res, 1024)); - } - - public function testWriteWithMock() - { - $this->setMockHandler(array('fwrite')); - - $callback = function ($arg) { - $map = array( - 'Hello world' => 6, - 'world' => 5, - ); - - return $map[$arg]; - }; - - $this->handler->expects($this->exactly(2)) - ->method('fwrite') - ->will($this->returnCallback($callback)); - - $this->writeRecord('Hello world'); - } - - public function testClose() - { - $this->setMockHandler(); - $this->writeRecord('Hello world'); - $this->assertInternalType('resource', $this->res); - $this->handler->close(); - $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler"); - } - - public function testCloseDoesNotClosePersistentSocket() - { - $this->setMockHandler(); - $this->handler->setPersistent(true); - $this->writeRecord('Hello world'); - $this->assertTrue(is_resource($this->res)); - $this->handler->close(); - $this->assertTrue(is_resource($this->res)); - } - - /** - * @expectedException \RuntimeException - */ - public function testAvoidInfiniteLoopWhenNoDataIsWrittenForAWritingTimeoutSeconds() - { - $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - - $this->handler->expects($this->any()) - ->method('fwrite') - ->will($this->returnValue(0)); - - $this->handler->expects($this->any()) - ->method('streamGetMetadata') - ->will($this->returnValue(array('timed_out' => false))); - - $this->handler->setWritingTimeout(1); - - $this->writeRecord('Hello world'); - } - - private function createHandler($connectionString) - { - $this->handler = new SocketHandler($connectionString); - $this->handler->setFormatter($this->getIdentityFormatter()); - } - - private function writeRecord($string) - { - $this->handler->handle($this->getRecord(Logger::WARNING, $string)); - } - - private function setMockHandler(array $methods = array()) - { - $this->res = fopen('php://memory', 'a'); - - $defaultMethods = array('fsockopen', 'pfsockopen', 'streamSetTimeout'); - $newMethods = array_diff($methods, $defaultMethods); - - $finalMethods = array_merge($defaultMethods, $newMethods); - - $this->handler = $this->getMock( - '\Monolog\Handler\SocketHandler', $finalMethods, array('localhost:1234') - ); - - if (!in_array('fsockopen', $methods)) { - $this->handler->expects($this->any()) - ->method('fsockopen') - ->will($this->returnValue($this->res)); - } - - if (!in_array('pfsockopen', $methods)) { - $this->handler->expects($this->any()) - ->method('pfsockopen') - ->will($this->returnValue($this->res)); - } - - if (!in_array('streamSetTimeout', $methods)) { - $this->handler->expects($this->any()) - ->method('streamSetTimeout') - ->will($this->returnValue(true)); - } - - $this->handler->setFormatter($this->getIdentityFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php deleted file mode 100644 index 487030f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php +++ /dev/null @@ -1,184 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class StreamHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWrite() - { - $handle = fopen('php://memory', 'a+'); - $handler = new StreamHandler($handle); - $handler->setFormatter($this->getIdentityFormatter()); - $handler->handle($this->getRecord(Logger::WARNING, 'test')); - $handler->handle($this->getRecord(Logger::WARNING, 'test2')); - $handler->handle($this->getRecord(Logger::WARNING, 'test3')); - fseek($handle, 0); - $this->assertEquals('testtest2test3', fread($handle, 100)); - } - - /** - * @covers Monolog\Handler\StreamHandler::close - */ - public function testCloseKeepsExternalHandlersOpen() - { - $handle = fopen('php://memory', 'a+'); - $handler = new StreamHandler($handle); - $this->assertTrue(is_resource($handle)); - $handler->close(); - $this->assertTrue(is_resource($handle)); - } - - /** - * @covers Monolog\Handler\StreamHandler::close - */ - public function testClose() - { - $handler = new StreamHandler('php://memory'); - $handler->handle($this->getRecord(Logger::WARNING, 'test')); - $streamProp = new \ReflectionProperty('Monolog\Handler\StreamHandler', 'stream'); - $streamProp->setAccessible(true); - $handle = $streamProp->getValue($handler); - - $this->assertTrue(is_resource($handle)); - $handler->close(); - $this->assertFalse(is_resource($handle)); - } - - /** - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteCreatesTheStreamResource() - { - $handler = new StreamHandler('php://memory'); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteLocking() - { - $temp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'monolog_locked_log'; - $handler = new StreamHandler($temp, Logger::DEBUG, true, null, true); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException LogicException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteMissingResource() - { - $handler = new StreamHandler(null); - $handler->handle($this->getRecord()); - } - - public function invalidArgumentProvider() - { - return array( - array(1), - array(array()), - array(array('bogus://url')), - ); - } - - /** - * @dataProvider invalidArgumentProvider - * @expectedException InvalidArgumentException - * @covers Monolog\Handler\StreamHandler::__construct - */ - public function testWriteInvalidArgument($invalidArgument) - { - $handler = new StreamHandler($invalidArgument); - } - - /** - * @expectedException UnexpectedValueException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteInvalidResource() - { - $handler = new StreamHandler('bogus://url'); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException UnexpectedValueException - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingResource() - { - $handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingPath() - { - $handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingFileResource() - { - $handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException Exception - * @expectedExceptionMessageRegExp /There is no existing directory at/ - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingAndNotCreatablePath() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Permissions checks can not run on windows'); - } - $handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } - - /** - * @expectedException Exception - * @expectedExceptionMessageRegExp /There is no existing directory at/ - * @covers Monolog\Handler\StreamHandler::__construct - * @covers Monolog\Handler\StreamHandler::write - */ - public function testWriteNonExistingAndNotCreatableFileResource() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Permissions checks can not run on windows'); - } - $handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); - $handler->handle($this->getRecord()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php deleted file mode 100644 index 1d62940..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; -use Monolog\TestCase; - -class SwiftMailerHandlerTest extends TestCase -{ - /** @var \Swift_Mailer|\PHPUnit_Framework_MockObject_MockObject */ - private $mailer; - - public function setUp() - { - $this->mailer = $this - ->getMockBuilder('Swift_Mailer') - ->disableOriginalConstructor() - ->getMock(); - } - - public function testMessageCreationIsLazyWhenUsingCallback() - { - $this->mailer->expects($this->never()) - ->method('send'); - - $callback = function () { - throw new \RuntimeException('Swift_Message creation callback should not have been called in this test'); - }; - $handler = new SwiftMailerHandler($this->mailer, $callback); - - $records = array( - $this->getRecord(Logger::DEBUG), - $this->getRecord(Logger::INFO), - ); - $handler->handleBatch($records); - } - - public function testMessageCanBeCustomizedGivenLoggedData() - { - // Wire Mailer to expect a specific Swift_Message with a customized Subject - $expectedMessage = new \Swift_Message(); - $this->mailer->expects($this->once()) - ->method('send') - ->with($this->callback(function ($value) use ($expectedMessage) { - return $value instanceof \Swift_Message - && $value->getSubject() === 'Emergency' - && $value === $expectedMessage; - })); - - // Callback dynamically changes subject based on number of logged records - $callback = function ($content, array $records) use ($expectedMessage) { - $subject = count($records) > 0 ? 'Emergency' : 'Normal'; - $expectedMessage->setSubject($subject); - - return $expectedMessage; - }; - $handler = new SwiftMailerHandler($this->mailer, $callback); - - // Logging 1 record makes this an Emergency - $records = array( - $this->getRecord(Logger::EMERGENCY), - ); - $handler->handleBatch($records); - } - - public function testMessageSubjectFormatting() - { - // Wire Mailer to expect a specific Swift_Message with a customized Subject - $messageTemplate = new \Swift_Message(); - $messageTemplate->setSubject('Alert: %level_name% %message%'); - $receivedMessage = null; - - $this->mailer->expects($this->once()) - ->method('send') - ->with($this->callback(function ($value) use (&$receivedMessage) { - $receivedMessage = $value; - return true; - })); - - $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); - - $records = array( - $this->getRecord(Logger::EMERGENCY), - ); - $handler->handleBatch($records); - - $this->assertEquals('Alert: EMERGENCY test', $receivedMessage->getSubject()); - } - - public function testMessageHaveUniqueId() - { - $messageTemplate = new \Swift_Message(); - $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); - - $method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage'); - $method->setAccessible(true); - $method->invokeArgs($handler, array($messageTemplate, array())); - - $builtMessage1 = $method->invoke($handler, $messageTemplate, array()); - $builtMessage2 = $method->invoke($handler, $messageTemplate, array()); - - $this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php deleted file mode 100644 index 8f9e46b..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\Logger; - -class SyslogHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Handler\SyslogHandler::__construct - */ - public function testConstruct() - { - $handler = new SyslogHandler('test'); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', LOG_USER); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', 'user'); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - - $handler = new SyslogHandler('test', LOG_USER, Logger::DEBUG, true, LOG_PERROR); - $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); - } - - /** - * @covers Monolog\Handler\SyslogHandler::__construct - */ - public function testConstructInvalidFacility() - { - $this->setExpectedException('UnexpectedValueException'); - $handler = new SyslogHandler('test', 'unknown'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php deleted file mode 100644 index 7ee8a98..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -/** - * @requires extension sockets - */ -class SyslogUdpHandlerTest extends TestCase -{ - /** - * @expectedException UnexpectedValueException - */ - public function testWeValidateFacilities() - { - $handler = new SyslogUdpHandler("ip", null, "invalidFacility"); - } - - public function testWeSplitIntoLines() - { - $time = '2014-01-07T12:34'; - $pid = getmypid(); - $host = gethostname(); - - $handler = $this->getMockBuilder('\Monolog\Handler\SyslogUdpHandler') - ->setConstructorArgs(array("127.0.0.1", 514, "authpriv")) - ->setMethods(array('getDateTime')) - ->getMock(); - - $handler->method('getDateTime') - ->willReturn($time); - - $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter()); - - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol')); - $socket->expects($this->at(0)) - ->method('write') - ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "); - $socket->expects($this->at(1)) - ->method('write') - ->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "); - - $handler->setSocket($socket); - - $handler->handle($this->getRecordWithMessage("hej\nlol")); - } - - public function testSplitWorksOnEmptyMsg() - { - $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv"); - $handler->setFormatter($this->getIdentityFormatter()); - - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol')); - $socket->expects($this->never()) - ->method('write'); - - $handler->setSocket($socket); - - $handler->handle($this->getRecordWithMessage(null)); - } - - protected function getRecordWithMessage($msg) - { - return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php deleted file mode 100644 index bfb8d3d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -/** - * @covers Monolog\Handler\TestHandler - */ -class TestHandlerTest extends TestCase -{ - /** - * @dataProvider methodProvider - */ - public function testHandler($method, $level) - { - $handler = new TestHandler; - $record = $this->getRecord($level, 'test'.$method); - $this->assertFalse($handler->hasRecords($level)); - $this->assertFalse($handler->hasRecord($record, $level)); - $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method); - $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); - $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) { - return true; - }), 'has'.$method.'ThatPasses'); - $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); - $this->assertFalse($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); - $handler->handle($record); - - $this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method); - $this->assertTrue($handler->hasRecords($level)); - $this->assertTrue($handler->hasRecord($record, $level)); - $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method); - $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method); - $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); - $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) { - return true; - }), 'has'.$method.'ThatPasses'); - $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); - $this->assertTrue($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); - - $records = $handler->getRecords(); - unset($records[0]['formatted']); - $this->assertEquals(array($record), $records); - } - - public function methodProvider() - { - return array( - array('Emergency', Logger::EMERGENCY), - array('Alert' , Logger::ALERT), - array('Critical' , Logger::CRITICAL), - array('Error' , Logger::ERROR), - array('Warning' , Logger::WARNING), - array('Info' , Logger::INFO), - array('Notice' , Logger::NOTICE), - array('Debug' , Logger::DEBUG), - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php deleted file mode 100644 index fa524d0..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Handler\SyslogUdp\UdpSocket; - -/** - * @requires extension sockets - */ -class UdpSocketTest extends TestCase -{ - public function testWeDoNotTruncateShortMessages() - { - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); - - $socket->expects($this->at(0)) - ->method('send') - ->with("HEADER: The quick brown fox jumps over the lazy dog"); - - $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: "); - } - - public function testLongMessagesAreTruncated() - { - $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); - - $truncatedString = str_repeat("derp", 16254).'d'; - - $socket->expects($this->exactly(1)) - ->method('send') - ->with("HEADER" . $truncatedString); - - $longString = str_repeat("derp", 20000); - - $socket->write($longString, "HEADER"); - } - - public function testDoubleCloseDoesNotError() - { - $socket = new UdpSocket('127.0.0.1', 514); - $socket->close(); - $socket->close(); - } - - /** - * @expectedException LogicException - */ - public function testWriteAfterCloseErrors() - { - $socket = new UdpSocket('127.0.0.1', 514); - $socket->close(); - $socket->write('foo', "HEADER"); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php deleted file mode 100644 index 8d37a1f..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; -use Monolog\Logger; - -class WhatFailureGroupHandlerTest extends TestCase -{ - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::__construct - * @expectedException InvalidArgumentException - */ - public function testConstructorOnlyTakesHandler() - { - new WhatFailureGroupHandler(array(new TestHandler(), "foo")); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::__construct - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandle() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new WhatFailureGroupHandler($testHandlers); - $handler->handle($this->getRecord(Logger::DEBUG)); - $handler->handle($this->getRecord(Logger::INFO)); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch - */ - public function testHandleBatch() - { - $testHandlers = array(new TestHandler(), new TestHandler()); - $handler = new WhatFailureGroupHandler($testHandlers); - $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); - foreach ($testHandlers as $test) { - $this->assertTrue($test->hasDebugRecords()); - $this->assertTrue($test->hasInfoRecords()); - $this->assertTrue(count($test->getRecords()) === 2); - } - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::isHandling - */ - public function testIsHandling() - { - $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); - $handler = new WhatFailureGroupHandler($testHandlers); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); - $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); - $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandleUsesProcessors() - { - $test = new TestHandler(); - $handler = new WhatFailureGroupHandler(array($test)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } - - /** - * @covers Monolog\Handler\WhatFailureGroupHandler::handle - */ - public function testHandleException() - { - $test = new TestHandler(); - $exception = new ExceptionTestHandler(); - $handler = new WhatFailureGroupHandler(array($exception, $test, $exception)); - $handler->pushProcessor(function ($record) { - $record['extra']['foo'] = true; - - return $record; - }); - $handler->handle($this->getRecord(Logger::WARNING)); - $this->assertTrue($test->hasWarningRecords()); - $records = $test->getRecords(); - $this->assertTrue($records[0]['extra']['foo']); - } -} - -class ExceptionTestHandler extends TestHandler -{ - /** - * {@inheritdoc} - */ - public function handle(array $record) - { - parent::handle($record); - - throw new \Exception("ExceptionTestHandler::handle"); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php deleted file mode 100644 index 69b001e..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler; - -use Monolog\TestCase; - -class ZendMonitorHandlerTest extends TestCase -{ - protected $zendMonitorHandler; - - public function setUp() - { - if (!function_exists('zend_monitor_custom_event')) { - $this->markTestSkipped('ZendServer is not installed'); - } - } - - /** - * @covers Monolog\Handler\ZendMonitorHandler::write - */ - public function testWrite() - { - $record = $this->getRecord(); - $formatterResult = array( - 'message' => $record['message'], - ); - - $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') - ->setMethods(array('writeZendMonitorCustomEvent', 'getDefaultFormatter')) - ->getMock(); - - $formatterMock = $this->getMockBuilder('Monolog\Formatter\NormalizerFormatter') - ->disableOriginalConstructor() - ->getMock(); - - $formatterMock->expects($this->once()) - ->method('format') - ->will($this->returnValue($formatterResult)); - - $zendMonitor->expects($this->once()) - ->method('getDefaultFormatter') - ->will($this->returnValue($formatterMock)); - - $levelMap = $zendMonitor->getLevelMap(); - - $zendMonitor->expects($this->once()) - ->method('writeZendMonitorCustomEvent') - ->with($levelMap[$record['level']], $record['message'], $formatterResult); - - $zendMonitor->handle($record); - } - - /** - * @covers Monolog\Handler\ZendMonitorHandler::getDefaultFormatter - */ - public function testGetDefaultFormatterReturnsNormalizerFormatter() - { - $zendMonitor = new ZendMonitorHandler(); - $this->assertInstanceOf('Monolog\Formatter\NormalizerFormatter', $zendMonitor->getDefaultFormatter()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/LoggerTest.php b/vendor/monolog/monolog/tests/Monolog/LoggerTest.php deleted file mode 100644 index 1ecc34a..0000000 --- a/vendor/monolog/monolog/tests/Monolog/LoggerTest.php +++ /dev/null @@ -1,548 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Processor\WebProcessor; -use Monolog\Handler\TestHandler; - -class LoggerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers Monolog\Logger::getName - */ - public function testGetName() - { - $logger = new Logger('foo'); - $this->assertEquals('foo', $logger->getName()); - } - - /** - * @covers Monolog\Logger::getLevelName - */ - public function testGetLevelName() - { - $this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR)); - } - - /** - * @covers Monolog\Logger::withName - */ - public function testWithName() - { - $first = new Logger('first', array($handler = new TestHandler())); - $second = $first->withName('second'); - - $this->assertSame('first', $first->getName()); - $this->assertSame('second', $second->getName()); - $this->assertSame($handler, $second->popHandler()); - } - - /** - * @covers Monolog\Logger::toMonologLevel - */ - public function testConvertPSR3ToMonologLevel() - { - $this->assertEquals(Logger::toMonologLevel('debug'), 100); - $this->assertEquals(Logger::toMonologLevel('info'), 200); - $this->assertEquals(Logger::toMonologLevel('notice'), 250); - $this->assertEquals(Logger::toMonologLevel('warning'), 300); - $this->assertEquals(Logger::toMonologLevel('error'), 400); - $this->assertEquals(Logger::toMonologLevel('critical'), 500); - $this->assertEquals(Logger::toMonologLevel('alert'), 550); - $this->assertEquals(Logger::toMonologLevel('emergency'), 600); - } - - /** - * @covers Monolog\Logger::getLevelName - * @expectedException InvalidArgumentException - */ - public function testGetLevelNameThrows() - { - Logger::getLevelName(5); - } - - /** - * @covers Monolog\Logger::__construct - */ - public function testChannel() - { - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->addWarning('test'); - list($record) = $handler->getRecords(); - $this->assertEquals('foo', $record['channel']); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testLog() - { - $logger = new Logger(__METHOD__); - - $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle')); - $handler->expects($this->once()) - ->method('handle'); - $logger->pushHandler($handler); - - $this->assertTrue($logger->addWarning('test')); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testLogNotHandled() - { - $logger = new Logger(__METHOD__); - - $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR)); - $handler->expects($this->never()) - ->method('handle'); - $logger->pushHandler($handler); - - $this->assertFalse($logger->addWarning('test')); - } - - public function testHandlersInCtor() - { - $handler1 = new TestHandler; - $handler2 = new TestHandler; - $logger = new Logger(__METHOD__, array($handler1, $handler2)); - - $this->assertEquals($handler1, $logger->popHandler()); - $this->assertEquals($handler2, $logger->popHandler()); - } - - public function testProcessorsInCtor() - { - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - $logger = new Logger(__METHOD__, array(), array($processor1, $processor2)); - - $this->assertEquals($processor1, $logger->popProcessor()); - $this->assertEquals($processor2, $logger->popProcessor()); - } - - /** - * @covers Monolog\Logger::pushHandler - * @covers Monolog\Logger::popHandler - * @expectedException LogicException - */ - public function testPushPopHandler() - { - $logger = new Logger(__METHOD__); - $handler1 = new TestHandler; - $handler2 = new TestHandler; - - $logger->pushHandler($handler1); - $logger->pushHandler($handler2); - - $this->assertEquals($handler2, $logger->popHandler()); - $this->assertEquals($handler1, $logger->popHandler()); - $logger->popHandler(); - } - - /** - * @covers Monolog\Logger::setHandlers - */ - public function testSetHandlers() - { - $logger = new Logger(__METHOD__); - $handler1 = new TestHandler; - $handler2 = new TestHandler; - - $logger->pushHandler($handler1); - $logger->setHandlers(array($handler2)); - - // handler1 has been removed - $this->assertEquals(array($handler2), $logger->getHandlers()); - - $logger->setHandlers(array( - "AMapKey" => $handler1, - "Woop" => $handler2, - )); - - // Keys have been scrubbed - $this->assertEquals(array($handler1, $handler2), $logger->getHandlers()); - } - - /** - * @covers Monolog\Logger::pushProcessor - * @covers Monolog\Logger::popProcessor - * @expectedException LogicException - */ - public function testPushPopProcessor() - { - $logger = new Logger(__METHOD__); - $processor1 = new WebProcessor; - $processor2 = new WebProcessor; - - $logger->pushProcessor($processor1); - $logger->pushProcessor($processor2); - - $this->assertEquals($processor2, $logger->popProcessor()); - $this->assertEquals($processor1, $logger->popProcessor()); - $logger->popProcessor(); - } - - /** - * @covers Monolog\Logger::pushProcessor - * @expectedException InvalidArgumentException - */ - public function testPushProcessorWithNonCallable() - { - $logger = new Logger(__METHOD__); - - $logger->pushProcessor(new \stdClass()); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsAreExecuted() - { - $logger = new Logger(__METHOD__); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->pushProcessor(function ($record) { - $record['extra']['win'] = true; - - return $record; - }); - $logger->addError('test'); - list($record) = $handler->getRecords(); - $this->assertTrue($record['extra']['win']); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsAreCalledOnlyOnce() - { - $logger = new Logger(__METHOD__); - $handler = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler->expects($this->any()) - ->method('handle') - ->will($this->returnValue(true)) - ; - $logger->pushHandler($handler); - - $processor = $this->getMockBuilder('Monolog\Processor\WebProcessor') - ->disableOriginalConstructor() - ->setMethods(array('__invoke')) - ->getMock() - ; - $processor->expects($this->once()) - ->method('__invoke') - ->will($this->returnArgument(0)) - ; - $logger->pushProcessor($processor); - - $logger->addError('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testProcessorsNotCalledWhenNotHandled() - { - $logger = new Logger(__METHOD__); - $handler = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler); - $that = $this; - $logger->pushProcessor(function ($record) use ($that) { - $that->fail('The processor should not be called'); - }); - $logger->addAlert('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testHandlersNotCalledBeforeFirstHandling() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->never()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler1->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler2); - - $handler3 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler3->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler3->expects($this->never()) - ->method('handle') - ; - $logger->pushHandler($handler3); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testHandlersNotCalledBeforeFirstHandlingWithAssocArray() - { - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->never()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler1->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - - $handler3 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler3->expects($this->once()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - $handler3->expects($this->never()) - ->method('handle') - ; - - $logger = new Logger(__METHOD__, array('last' => $handler3, 'second' => $handler2, 'first' => $handler1)); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testBubblingWhenTheHandlerReturnsFalse() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler1->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(false)) - ; - $logger->pushHandler($handler2); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::addRecord - */ - public function testNotBubblingWhenTheHandlerReturnsTrue() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler1->expects($this->never()) - ->method('handle') - ; - $logger->pushHandler($handler1); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - $handler2->expects($this->once()) - ->method('handle') - ->will($this->returnValue(true)) - ; - $logger->pushHandler($handler2); - - $logger->debug('test'); - } - - /** - * @covers Monolog\Logger::isHandling - */ - public function testIsHandling() - { - $logger = new Logger(__METHOD__); - - $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler1->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(false)) - ; - - $logger->pushHandler($handler1); - $this->assertFalse($logger->isHandling(Logger::DEBUG)); - - $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); - $handler2->expects($this->any()) - ->method('isHandling') - ->will($this->returnValue(true)) - ; - - $logger->pushHandler($handler2); - $this->assertTrue($logger->isHandling(Logger::DEBUG)); - } - - /** - * @dataProvider logMethodProvider - * @covers Monolog\Logger::addDebug - * @covers Monolog\Logger::addInfo - * @covers Monolog\Logger::addNotice - * @covers Monolog\Logger::addWarning - * @covers Monolog\Logger::addError - * @covers Monolog\Logger::addCritical - * @covers Monolog\Logger::addAlert - * @covers Monolog\Logger::addEmergency - * @covers Monolog\Logger::debug - * @covers Monolog\Logger::info - * @covers Monolog\Logger::notice - * @covers Monolog\Logger::warn - * @covers Monolog\Logger::err - * @covers Monolog\Logger::crit - * @covers Monolog\Logger::alert - * @covers Monolog\Logger::emerg - */ - public function testLogMethods($method, $expectedLevel) - { - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->{$method}('test'); - list($record) = $handler->getRecords(); - $this->assertEquals($expectedLevel, $record['level']); - } - - public function logMethodProvider() - { - return array( - // monolog methods - array('addDebug', Logger::DEBUG), - array('addInfo', Logger::INFO), - array('addNotice', Logger::NOTICE), - array('addWarning', Logger::WARNING), - array('addError', Logger::ERROR), - array('addCritical', Logger::CRITICAL), - array('addAlert', Logger::ALERT), - array('addEmergency', Logger::EMERGENCY), - - // ZF/Sf2 compat methods - array('debug', Logger::DEBUG), - array('info', Logger::INFO), - array('notice', Logger::NOTICE), - array('warn', Logger::WARNING), - array('err', Logger::ERROR), - array('crit', Logger::CRITICAL), - array('alert', Logger::ALERT), - array('emerg', Logger::EMERGENCY), - ); - } - - /** - * @dataProvider setTimezoneProvider - * @covers Monolog\Logger::setTimezone - */ - public function testSetTimezone($tz) - { - Logger::setTimezone($tz); - $logger = new Logger('foo'); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->info('test'); - list($record) = $handler->getRecords(); - $this->assertEquals($tz, $record['datetime']->getTimezone()); - } - - public function setTimezoneProvider() - { - return array_map( - function ($tz) { return array(new \DateTimeZone($tz)); }, - \DateTimeZone::listIdentifiers() - ); - } - - /** - * @dataProvider useMicrosecondTimestampsProvider - * @covers Monolog\Logger::useMicrosecondTimestamps - * @covers Monolog\Logger::addRecord - */ - public function testUseMicrosecondTimestamps($micro, $assert) - { - $logger = new Logger('foo'); - $logger->useMicrosecondTimestamps($micro); - $handler = new TestHandler; - $logger->pushHandler($handler); - $logger->info('test'); - list($record) = $handler->getRecords(); - $this->{$assert}('000000', $record['datetime']->format('u')); - } - - public function useMicrosecondTimestampsProvider() - { - return array( - // this has a very small chance of a false negative (1/10^6) - 'with microseconds' => array(true, 'assertNotSame'), - 'without microseconds' => array(false, PHP_VERSION_ID >= 70100 ? 'assertNotSame' : 'assertSame'), - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php deleted file mode 100644 index 5adb505..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class GitProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\GitProcessor::__invoke - */ - public function testProcessor() - { - $processor = new GitProcessor(); - $record = $processor($this->getRecord()); - - $this->assertArrayHasKey('git', $record['extra']); - $this->assertTrue(!is_array($record['extra']['git']['branch'])); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php deleted file mode 100644 index 0dd411d..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Acme; - -class Tester -{ - public function test($handler, $record) - { - $handler->handle($record); - } -} - -function tester($handler, $record) -{ - $handler->handle($record); -} - -namespace Monolog\Processor; - -use Monolog\Logger; -use Monolog\TestCase; -use Monolog\Handler\TestHandler; - -class IntrospectionProcessorTest extends TestCase -{ - public function getHandler() - { - $processor = new IntrospectionProcessor(); - $handler = new TestHandler(); - $handler->pushProcessor($processor); - - return $handler; - } - - public function testProcessorFromClass() - { - $handler = $this->getHandler(); - $tester = new \Acme\Tester; - $tester->test($handler, $this->getRecord()); - list($record) = $handler->getRecords(); - $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(18, $record['extra']['line']); - $this->assertEquals('Acme\Tester', $record['extra']['class']); - $this->assertEquals('test', $record['extra']['function']); - } - - public function testProcessorFromFunc() - { - $handler = $this->getHandler(); - \Acme\tester($handler, $this->getRecord()); - list($record) = $handler->getRecords(); - $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(24, $record['extra']['line']); - $this->assertEquals(null, $record['extra']['class']); - $this->assertEquals('Acme\tester', $record['extra']['function']); - } - - public function testLevelTooLow() - { - $input = array( - 'level' => Logger::DEBUG, - 'extra' => array(), - ); - - $expected = $input; - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } - - public function testLevelEqual() - { - $input = array( - 'level' => Logger::CRITICAL, - 'extra' => array(), - ); - - $expected = $input; - $expected['extra'] = array( - 'file' => null, - 'line' => null, - 'class' => 'ReflectionMethod', - 'function' => 'invokeArgs', - ); - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } - - public function testLevelHigher() - { - $input = array( - 'level' => Logger::EMERGENCY, - 'extra' => array(), - ); - - $expected = $input; - $expected['extra'] = array( - 'file' => null, - 'line' => null, - 'class' => 'ReflectionMethod', - 'function' => 'invokeArgs', - ); - - $processor = new IntrospectionProcessor(Logger::CRITICAL); - $actual = $processor($input); - - $this->assertEquals($expected, $actual); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php deleted file mode 100644 index eb66614..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class MemoryPeakUsageProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessor() - { - $processor = new MemoryPeakUsageProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_peak_usage', $record['extra']); - $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']); - } - - /** - * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessorWithoutFormatting() - { - $processor = new MemoryPeakUsageProcessor(true, false); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_peak_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_peak_usage']); - $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php deleted file mode 100644 index 4692dbf..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class MemoryUsageProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\MemoryUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessor() - { - $processor = new MemoryUsageProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_usage', $record['extra']); - $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']); - } - - /** - * @covers Monolog\Processor\MemoryUsageProcessor::__invoke - * @covers Monolog\Processor\MemoryProcessor::formatBytes - */ - public function testProcessorWithoutFormatting() - { - $processor = new MemoryUsageProcessor(true, false); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('memory_usage', $record['extra']); - $this->assertInternalType('int', $record['extra']['memory_usage']); - $this->assertGreaterThan(0, $record['extra']['memory_usage']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php deleted file mode 100644 index 11f2b35..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class MercurialProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\MercurialProcessor::__invoke - */ - public function testProcessor() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - exec("where hg 2>NUL", $output, $result); - } else { - exec("which hg 2>/dev/null >/dev/null", $output, $result); - } - if ($result != 0) { - $this->markTestSkipped('hg is missing'); - return; - } - - `hg init`; - $processor = new MercurialProcessor(); - $record = $processor($this->getRecord()); - - $this->assertArrayHasKey('hg', $record['extra']); - $this->assertTrue(!is_array($record['extra']['hg']['branch'])); - $this->assertTrue(!is_array($record['extra']['hg']['revision'])); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php deleted file mode 100644 index 458d2a3..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class ProcessIdProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\ProcessIdProcessor::__invoke - */ - public function testProcessor() - { - $processor = new ProcessIdProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('process_id', $record['extra']); - $this->assertInternalType('int', $record['extra']['process_id']); - $this->assertGreaterThan(0, $record['extra']['process_id']); - $this->assertEquals(getmypid(), $record['extra']['process_id']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php deleted file mode 100644 index 029a0c0..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getPairs - */ - public function testReplacement($val, $expected) - { - $proc = new PsrLogMessageProcessor; - - $message = $proc(array( - 'message' => '{foo}', - 'context' => array('foo' => $val), - )); - $this->assertEquals($expected, $message['message']); - } - - public function getPairs() - { - return array( - array('foo', 'foo'), - array('3', '3'), - array(3, '3'), - array(null, ''), - array(true, '1'), - array(false, ''), - array(new \stdClass, '[object stdClass]'), - array(array(), '[array]'), - ); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php deleted file mode 100644 index 0d860c6..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class TagProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\TagProcessor::__invoke - */ - public function testProcessor() - { - $tags = array(1, 2, 3); - $processor = new TagProcessor($tags); - $record = $processor($this->getRecord()); - - $this->assertEquals($tags, $record['extra']['tags']); - } - - /** - * @covers Monolog\Processor\TagProcessor::__invoke - */ - public function testProcessorTagModification() - { - $tags = array(1, 2, 3); - $processor = new TagProcessor($tags); - - $record = $processor($this->getRecord()); - $this->assertEquals($tags, $record['extra']['tags']); - - $processor->setTags(array('a', 'b')); - $record = $processor($this->getRecord()); - $this->assertEquals(array('a', 'b'), $record['extra']['tags']); - - $processor->addTags(array('a', 'c', 'foo' => 'bar')); - $record = $processor($this->getRecord()); - $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php deleted file mode 100644 index 5d13058..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class UidProcessorTest extends TestCase -{ - /** - * @covers Monolog\Processor\UidProcessor::__invoke - */ - public function testProcessor() - { - $processor = new UidProcessor(); - $record = $processor($this->getRecord()); - $this->assertArrayHasKey('uid', $record['extra']); - } - - public function testGetUid() - { - $processor = new UidProcessor(10); - $this->assertEquals(10, strlen($processor->getUid())); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php deleted file mode 100644 index 4105baf..0000000 --- a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Processor; - -use Monolog\TestCase; - -class WebProcessorTest extends TestCase -{ - public function testProcessor() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'HTTP_REFERER' => 'D', - 'SERVER_NAME' => 'F', - 'UNIQUE_ID' => 'G', - ); - - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']); - $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']); - $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']); - $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']); - $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']); - $this->assertEquals($server['UNIQUE_ID'], $record['extra']['unique_id']); - } - - public function testProcessorDoNothingIfNoRequestUri() - { - $server = array( - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertEmpty($record['extra']); - } - - public function testProcessorReturnNullIfNoHttpReferer() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertNull($record['extra']['referrer']); - } - - public function testProcessorDoesNotAddUniqueIdIfNotPresent() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - $processor = new WebProcessor($server); - $record = $processor($this->getRecord()); - $this->assertFalse(isset($record['extra']['unique_id'])); - } - - public function testProcessorAddsOnlyRequestedExtraFields() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - - $processor = new WebProcessor($server, array('url', 'http_method')); - $record = $processor($this->getRecord()); - - $this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']); - } - - public function testProcessorConfiguringOfExtraFields() - { - $server = array( - 'REQUEST_URI' => 'A', - 'REMOTE_ADDR' => 'B', - 'REQUEST_METHOD' => 'C', - 'SERVER_NAME' => 'F', - ); - - $processor = new WebProcessor($server, array('url' => 'REMOTE_ADDR')); - $record = $processor($this->getRecord()); - - $this->assertSame(array('url' => 'B'), $record['extra']); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testInvalidData() - { - new WebProcessor(new \stdClass); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php b/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php deleted file mode 100644 index ab89944..0000000 --- a/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Monolog\Handler\TestHandler; -use Monolog\Formatter\LineFormatter; -use Monolog\Processor\PsrLogMessageProcessor; -use Psr\Log\Test\LoggerInterfaceTest; - -class PsrLogCompatTest extends LoggerInterfaceTest -{ - private $handler; - - public function getLogger() - { - $logger = new Logger('foo'); - $logger->pushHandler($handler = new TestHandler); - $logger->pushProcessor(new PsrLogMessageProcessor); - $handler->setFormatter(new LineFormatter('%level_name% %message%')); - - $this->handler = $handler; - - return $logger; - } - - public function getLogs() - { - $convert = function ($record) { - $lower = function ($match) { - return strtolower($match[0]); - }; - - return preg_replace_callback('{^[A-Z]+}', $lower, $record['formatted']); - }; - - return array_map($convert, $this->handler->getRecords()); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/RegistryTest.php b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php deleted file mode 100644 index 15fdfbd..0000000 --- a/vendor/monolog/monolog/tests/Monolog/RegistryTest.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -class RegistryTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - Registry::clear(); - } - - /** - * @dataProvider hasLoggerProvider - * @covers Monolog\Registry::hasLogger - */ - public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult) - { - foreach ($loggersToAdd as $loggerToAdd) { - Registry::addLogger($loggerToAdd); - } - foreach ($loggersToCheck as $index => $loggerToCheck) { - $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck)); - } - } - - public function hasLoggerProvider() - { - $logger1 = new Logger('test1'); - $logger2 = new Logger('test2'); - $logger3 = new Logger('test3'); - - return array( - // only instances - array( - array($logger1), - array($logger1, $logger2), - array(true, false), - ), - // only names - array( - array($logger1), - array('test1', 'test2'), - array(true, false), - ), - // mixed case - array( - array($logger1, $logger2), - array('test1', $logger2, 'test3', $logger3), - array(true, true, false, false), - ), - ); - } - - /** - * @covers Monolog\Registry::clear - */ - public function testClearClears() - { - Registry::addLogger(new Logger('test1'), 'log'); - Registry::clear(); - - $this->setExpectedException('\InvalidArgumentException'); - Registry::getInstance('log'); - } - - /** - * @dataProvider removedLoggerProvider - * @covers Monolog\Registry::addLogger - * @covers Monolog\Registry::removeLogger - */ - public function testRemovesLogger($loggerToAdd, $remove) - { - Registry::addLogger($loggerToAdd); - Registry::removeLogger($remove); - - $this->setExpectedException('\InvalidArgumentException'); - Registry::getInstance($loggerToAdd->getName()); - } - - public function removedLoggerProvider() - { - $logger1 = new Logger('test1'); - - return array( - array($logger1, $logger1), - array($logger1, 'test1'), - ); - } - - /** - * @covers Monolog\Registry::addLogger - * @covers Monolog\Registry::getInstance - * @covers Monolog\Registry::__callStatic - */ - public function testGetsSameLogger() - { - $logger1 = new Logger('test1'); - $logger2 = new Logger('test2'); - - Registry::addLogger($logger1, 'test1'); - Registry::addLogger($logger2); - - $this->assertSame($logger1, Registry::getInstance('test1')); - $this->assertSame($logger2, Registry::test2()); - } - - /** - * @expectedException \InvalidArgumentException - * @covers Monolog\Registry::getInstance - */ - public function testFailsOnNonExistantLogger() - { - Registry::getInstance('test1'); - } - - /** - * @covers Monolog\Registry::addLogger - */ - public function testReplacesLogger() - { - $log1 = new Logger('test1'); - $log2 = new Logger('test2'); - - Registry::addLogger($log1, 'log'); - - Registry::addLogger($log2, 'log', true); - - $this->assertSame($log2, Registry::getInstance('log')); - } - - /** - * @expectedException \InvalidArgumentException - * @covers Monolog\Registry::addLogger - */ - public function testFailsOnUnspecifiedReplacement() - { - $log1 = new Logger('test1'); - $log2 = new Logger('test2'); - - Registry::addLogger($log1, 'log'); - - Registry::addLogger($log2, 'log'); - } -} diff --git a/vendor/monolog/monolog/tests/Monolog/TestCase.php b/vendor/monolog/monolog/tests/Monolog/TestCase.php deleted file mode 100644 index 4eb7b4c..0000000 --- a/vendor/monolog/monolog/tests/Monolog/TestCase.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -class TestCase extends \PHPUnit_Framework_TestCase -{ - /** - * @return array Record - */ - protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array()) - { - return array( - 'message' => $message, - 'context' => $context, - 'level' => $level, - 'level_name' => Logger::getLevelName($level), - 'channel' => 'test', - 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), - 'extra' => array(), - ); - } - - /** - * @return array - */ - protected function getMultipleRecords() - { - return array( - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - $this->getRecord(Logger::WARNING, 'warning'), - $this->getRecord(Logger::ERROR, 'error'), - ); - } - - /** - * @return Monolog\Formatter\FormatterInterface - */ - protected function getIdentityFormatter() - { - $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); - $formatter->expects($this->any()) - ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message']; })); - - return $formatter; - } -} diff --git a/vendor/pimple/pimple/.gitignore b/vendor/pimple/pimple/.gitignore deleted file mode 100644 index c089b09..0000000 --- a/vendor/pimple/pimple/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -phpunit.xml -composer.lock -/vendor/ diff --git a/vendor/pimple/pimple/.travis.yml b/vendor/pimple/pimple/.travis.yml deleted file mode 100644 index 196f7fc..0000000 --- a/vendor/pimple/pimple/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: php - -env: - matrix: - - PIMPLE_EXT=no - - PIMPLE_EXT=yes - global: - - REPORT_EXIT_STATUS=1 - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - -before_script: - - composer self-update - - COMPOSER_ROOT_VERSION=dev-master composer install - - if [ "$PIMPLE_EXT" == "yes" ]; then sh -c "cd ext/pimple && phpize && ./configure && make && sudo make install"; fi - - if [ "$PIMPLE_EXT" == "yes" ]; then echo "extension=pimple.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi - -script: - - cd ext/pimple - - if [ "$PIMPLE_EXT" == "yes" ]; then yes n | make test | tee output ; grep -E 'Tests failed +. +0' output; fi - - if [ "$PIMPLE_EXT" == "yes" ]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi - - cd ../.. - - ./vendor/bin/simple-phpunit - -matrix: - include: - - php: hhvm - dist: trusty - env: PIMPLE_EXT=no - exclude: - - php: 7.0 - env: PIMPLE_EXT=yes - - php: 7.1 - env: PIMPLE_EXT=yes diff --git a/vendor/pimple/pimple/CHANGELOG b/vendor/pimple/pimple/CHANGELOG deleted file mode 100644 index f277b96..0000000 --- a/vendor/pimple/pimple/CHANGELOG +++ /dev/null @@ -1,55 +0,0 @@ -* 3.2.2 (2017-07-23) - - * reverted extending a protected closure throws an exception (deprecated it instead) - -* 3.2.1 (2017-07-17) - - * fixed PHP error - -* 3.2.0 (2017-07-17) - - * added a PSR-11 service locator - * added a PSR-11 wrapper - * added ServiceIterator - * fixed extending a protected closure (now throws InvalidServiceIdentifierException) - -* 3.1.0 (2017-07-03) - - * deprecated the C extension - * added support for PSR-11 exceptions - -* 3.0.2 (2015-09-11) - - * refactored the C extension - * minor non-significant changes - -* 3.0.1 (2015-07-30) - - * simplified some code - * fixed a segfault in the C extension - -* 3.0.0 (2014-07-24) - - * removed the Pimple class alias (use Pimple\Container instead) - -* 2.1.1 (2014-07-24) - - * fixed compiler warnings for the C extension - * fixed code when dealing with circular references - -* 2.1.0 (2014-06-24) - - * moved the Pimple to Pimple\Container (with a BC layer -- Pimple is now a - deprecated alias which will be removed in Pimple 3.0) - * added Pimple\ServiceProviderInterface (and Pimple::register()) - -* 2.0.0 (2014-02-10) - - * changed extend to automatically re-assign the extended service and keep it as shared or factory - (to keep BC, extend still returns the extended service) - * changed services to be shared by default (use factory() for factory - services) - -* 1.0.0 - - * initial version diff --git a/vendor/pimple/pimple/LICENSE b/vendor/pimple/pimple/LICENSE deleted file mode 100644 index e02dc5a..0000000 --- a/vendor/pimple/pimple/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2009-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/pimple/pimple/README.rst b/vendor/pimple/pimple/README.rst deleted file mode 100644 index d27d8aa..0000000 --- a/vendor/pimple/pimple/README.rst +++ /dev/null @@ -1,326 +0,0 @@ -Pimple -====== - -.. caution:: - - This is the documentation for Pimple 3.x. If you are using Pimple 1.x, read - the `Pimple 1.x documentation`_. Reading the Pimple 1.x code is also a good - way to learn more about how to create a simple Dependency Injection - Container (recent versions of Pimple are more focused on performance). - -Pimple is a small Dependency Injection Container for PHP. - -Installation ------------- - -Before using Pimple in your project, add it to your ``composer.json`` file: - -.. code-block:: bash - - $ ./composer.phar require pimple/pimple "^3.0" - -Usage ------ - -Creating a container is a matter of creating a ``Container`` instance: - -.. code-block:: php - - use Pimple\Container; - - $container = new Container(); - -As many other dependency injection containers, Pimple manages two different -kind of data: **services** and **parameters**. - -Defining Services -~~~~~~~~~~~~~~~~~ - -A service is an object that does something as part of a larger system. Examples -of services: a database connection, a templating engine, or a mailer. Almost -any **global** object can be a service. - -Services are defined by **anonymous functions** that return an instance of an -object: - -.. code-block:: php - - // define some services - $container['session_storage'] = function ($c) { - return new SessionStorage('SESSION_ID'); - }; - - $container['session'] = function ($c) { - return new Session($c['session_storage']); - }; - -Notice that the anonymous function has access to the current container -instance, allowing references to other services or parameters. - -As objects are only created when you get them, the order of the definitions -does not matter. - -Using the defined services is also very easy: - -.. code-block:: php - - // get the session object - $session = $container['session']; - - // the above call is roughly equivalent to the following code: - // $storage = new SessionStorage('SESSION_ID'); - // $session = new Session($storage); - -Defining Factory Services -~~~~~~~~~~~~~~~~~~~~~~~~~ - -By default, each time you get a service, Pimple returns the **same instance** -of it. If you want a different instance to be returned for all calls, wrap your -anonymous function with the ``factory()`` method - -.. code-block:: php - - $container['session'] = $container->factory(function ($c) { - return new Session($c['session_storage']); - }); - -Now, each call to ``$container['session']`` returns a new instance of the -session. - -Defining Parameters -~~~~~~~~~~~~~~~~~~~ - -Defining a parameter allows to ease the configuration of your container from -the outside and to store global values: - -.. code-block:: php - - // define some parameters - $container['cookie_name'] = 'SESSION_ID'; - $container['session_storage_class'] = 'SessionStorage'; - -If you change the ``session_storage`` service definition like below: - -.. code-block:: php - - $container['session_storage'] = function ($c) { - return new $c['session_storage_class']($c['cookie_name']); - }; - -You can now easily change the cookie name by overriding the -``session_storage_class`` parameter instead of redefining the service -definition. - -Protecting Parameters -~~~~~~~~~~~~~~~~~~~~~ - -Because Pimple sees anonymous functions as service definitions, you need to -wrap anonymous functions with the ``protect()`` method to store them as -parameters: - -.. code-block:: php - - $container['random_func'] = $container->protect(function () { - return rand(); - }); - -Modifying Services after Definition -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In some cases you may want to modify a service definition after it has been -defined. You can use the ``extend()`` method to define additional code to be -run on your service just after it is created: - -.. code-block:: php - - $container['session_storage'] = function ($c) { - return new $c['session_storage_class']($c['cookie_name']); - }; - - $container->extend('session_storage', function ($storage, $c) { - $storage->...(); - - return $storage; - }); - -The first argument is the name of the service to extend, the second a function -that gets access to the object instance and the container. - -Extending a Container -~~~~~~~~~~~~~~~~~~~~~ - -If you use the same libraries over and over, you might want to reuse some -services from one project to the next one; package your services into a -**provider** by implementing ``Pimple\ServiceProviderInterface``: - -.. code-block:: php - - use Pimple\Container; - - class FooProvider implements Pimple\ServiceProviderInterface - { - public function register(Container $pimple) - { - // register some services and parameters - // on $pimple - } - } - -Then, register the provider on a Container: - -.. code-block:: php - - $pimple->register(new FooProvider()); - -Fetching the Service Creation Function -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When you access an object, Pimple automatically calls the anonymous function -that you defined, which creates the service object for you. If you want to get -raw access to this function, you can use the ``raw()`` method: - -.. code-block:: php - - $container['session'] = function ($c) { - return new Session($c['session_storage']); - }; - - $sessionFunction = $container->raw('session'); - -PSR-11 compatibility --------------------- - -For historical reasons, the ``Container`` class does not implement the PSR-11 -``ContainerInterface``. However, Pimple provides a helper class that will let -you decouple your code from the Pimple container class. - -The PSR-11 container class -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``Pimple\Psr11\Container`` class lets you access the content of an -underlying Pimple container using ``Psr\Container\ContainerInterface`` -methods: - -.. code-block:: php - - use Pimple\Container; - use Pimple\Psr11\Container as PsrContainer; - - $container = new Container(); - $container['service'] = function ($c) { - return new Service(); - }; - $psr11 = new PsrContainer($container); - - $controller = function (PsrContainer $container) { - $service = $container->get('service'); - }; - $controller($psr11); - -Using the PSR-11 ServiceLocator -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Sometimes, a service needs access to several other services without being sure -that all of them will actually be used. In those cases, you may want the -instantiation of the services to be lazy. - -The traditional solution is to inject the entire service container to get only -the services really needed. However, this is not recommended because it gives -services a too broad access to the rest of the application and it hides their -actual dependencies. - -The ``ServiceLocator`` is intended to solve this problem by giving access to a -set of predefined services while instantiating them only when actually needed. - -It also allows you to make your services available under a different name than -the one used to register them. For instance, you may want to use an object -that expects an instance of ``EventDispatcherInterface`` to be available under -the name ``event_dispatcher`` while your event dispatcher has been -registered under the name ``dispatcher``: - -.. code-block:: php - - use Monolog\Logger; - use Pimple\Psr11\ServiceLocator; - use Psr\Container\ContainerInterface; - use Symfony\Component\EventDispatcher\EventDispatcher; - - class MyService - { - /** - * "logger" must be an instance of Psr\Log\LoggerInterface - * "event_dispatcher" must be an instance of Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - private $services; - - public function __construct(ContainerInterface $services) - { - $this->services = $services; - } - } - - $container['logger'] = function ($c) { - return new Monolog\Logger(); - }; - $container['dispatcher'] = function () { - return new EventDispatcher(); - }; - - $container['service'] = function ($c) { - $locator = new ServiceLocator($c, array('logger', 'event_dispatcher' => 'dispatcher')); - - return new MyService($locator); - }; - -Referencing a Collection of Services Lazily -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Passing a collection of services instances in an array may prove inefficient -if the class that consumes the collection only needs to iterate over it at a -later stage, when one of its method is called. It can also lead to problems -if there is a circular dependency between one of the services stored in the -collection and the class that consumes it. - -The ``ServiceIterator`` class helps you solve these issues. It receives a -list of service names during instantiation and will retrieve the services -when iterated over: - -.. code-block:: php - - use Pimple\Container; - use Pimple\ServiceIterator; - - class AuthorizationService - { - private $voters; - - public function __construct($voters) - { - $this->voters = $voters; - } - - public function canAccess($resource) - { - foreach ($this->voters as $voter) { - if (true === $voter->canAccess($resource) { - return true; - } - } - - return false; - } - } - - $container = new Container(); - - $container['voter1'] = function ($c) { - return new SomeVoter(); - } - $container['voter2'] = function ($c) { - return new SomeOtherVoter($c['auth']); - } - $container['auth'] = function ($c) { - return new AuthorizationService(new ServiceIterator($c, array('voter1', 'voter2')); - } - -.. _Pimple 1.x documentation: https://github.com/silexphp/Pimple/tree/1.1 diff --git a/vendor/pimple/pimple/composer.json b/vendor/pimple/pimple/composer.json deleted file mode 100644 index dabf190..0000000 --- a/vendor/pimple/pimple/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "pimple/pimple", - "type": "library", - "description": "Pimple, a simple Dependency Injection Container", - "keywords": ["dependency injection", "container"], - "homepage": "http://pimple.sensiolabs.org", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "require": { - "php": ">=5.3.0", - "psr/container": "^1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^3.2" - }, - "autoload": { - "psr-0": { "Pimple": "src/" } - }, - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - } -} diff --git a/vendor/pimple/pimple/ext/pimple/.gitignore b/vendor/pimple/pimple/ext/pimple/.gitignore deleted file mode 100644 index 1861088..0000000 --- a/vendor/pimple/pimple/ext/pimple/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -*.sw* -.deps -Makefile -Makefile.fragments -Makefile.global -Makefile.objects -acinclude.m4 -aclocal.m4 -build/ -config.cache -config.guess -config.h -config.h.in -config.log -config.nice -config.status -config.sub -configure -configure.in -install-sh -libtool -ltmain.sh -missing -mkinstalldirs -run-tests.php -*.loT -.libs/ -modules/ -*.la -*.lo diff --git a/vendor/pimple/pimple/ext/pimple/README.md b/vendor/pimple/pimple/ext/pimple/README.md deleted file mode 100644 index 7b39eb2..0000000 --- a/vendor/pimple/pimple/ext/pimple/README.md +++ /dev/null @@ -1,12 +0,0 @@ -This is Pimple 2 implemented in C - -* PHP >= 5.3 -* Not tested under Windows, might work - -Install -======= - - > phpize - > ./configure - > make - > make install diff --git a/vendor/pimple/pimple/ext/pimple/config.m4 b/vendor/pimple/pimple/ext/pimple/config.m4 deleted file mode 100644 index 3a6e9aa..0000000 --- a/vendor/pimple/pimple/ext/pimple/config.m4 +++ /dev/null @@ -1,63 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension pimple - -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. - -dnl If your extension references something external, use with: - -dnl PHP_ARG_WITH(pimple, for pimple support, -dnl Make sure that the comment is aligned: -dnl [ --with-pimple Include pimple support]) - -dnl Otherwise use enable: - -PHP_ARG_ENABLE(pimple, whether to enable pimple support, -dnl Make sure that the comment is aligned: -[ --enable-pimple Enable pimple support]) - -if test "$PHP_PIMPLE" != "no"; then - dnl Write more examples of tests here... - - dnl # --with-pimple -> check with-path - dnl SEARCH_PATH="/usr/local /usr" # you might want to change this - dnl SEARCH_FOR="/include/pimple.h" # you most likely want to change this - dnl if test -r $PHP_PIMPLE/$SEARCH_FOR; then # path given as parameter - dnl PIMPLE_DIR=$PHP_PIMPLE - dnl else # search default path list - dnl AC_MSG_CHECKING([for pimple files in default path]) - dnl for i in $SEARCH_PATH ; do - dnl if test -r $i/$SEARCH_FOR; then - dnl PIMPLE_DIR=$i - dnl AC_MSG_RESULT(found in $i) - dnl fi - dnl done - dnl fi - dnl - dnl if test -z "$PIMPLE_DIR"; then - dnl AC_MSG_RESULT([not found]) - dnl AC_MSG_ERROR([Please reinstall the pimple distribution]) - dnl fi - - dnl # --with-pimple -> add include path - dnl PHP_ADD_INCLUDE($PIMPLE_DIR/include) - - dnl # --with-pimple -> check for lib and symbol presence - dnl LIBNAME=pimple # you may want to change this - dnl LIBSYMBOL=pimple # you most likely want to change this - - dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - dnl [ - dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PIMPLE_DIR/lib, PIMPLE_SHARED_LIBADD) - dnl AC_DEFINE(HAVE_PIMPLELIB,1,[ ]) - dnl ],[ - dnl AC_MSG_ERROR([wrong pimple lib version or lib not found]) - dnl ],[ - dnl -L$PIMPLE_DIR/lib -lm - dnl ]) - dnl - dnl PHP_SUBST(PIMPLE_SHARED_LIBADD) - - PHP_NEW_EXTENSION(pimple, pimple.c, $ext_shared) -fi diff --git a/vendor/pimple/pimple/ext/pimple/config.w32 b/vendor/pimple/pimple/ext/pimple/config.w32 deleted file mode 100644 index 39857b3..0000000 --- a/vendor/pimple/pimple/ext/pimple/config.w32 +++ /dev/null @@ -1,13 +0,0 @@ -// $Id$ -// vim:ft=javascript - -// If your extension references something external, use ARG_WITH -// ARG_WITH("pimple", "for pimple support", "no"); - -// Otherwise, use ARG_ENABLE -// ARG_ENABLE("pimple", "enable pimple support", "no"); - -if (PHP_PIMPLE != "no") { - EXTENSION("pimple", "pimple.c"); -} - diff --git a/vendor/pimple/pimple/ext/pimple/php_pimple.h b/vendor/pimple/pimple/ext/pimple/php_pimple.h deleted file mode 100644 index 258f3ee..0000000 --- a/vendor/pimple/pimple/ext/pimple/php_pimple.h +++ /dev/null @@ -1,137 +0,0 @@ - -/* - * This file is part of Pimple. - * - * Copyright (c) 2014 Fabien Potencier - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished - * to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef PHP_PIMPLE_H -#define PHP_PIMPLE_H - -extern zend_module_entry pimple_module_entry; -#define phpext_pimple_ptr &pimple_module_entry - -#ifdef PHP_WIN32 -# define PHP_PIMPLE_API __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define PHP_PIMPLE_API __attribute__ ((visibility("default"))) -#else -# define PHP_PIMPLE_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -#define PIMPLE_VERSION "3.2.2-DEV" - -#define PIMPLE_NS "Pimple" -#define PSR_CONTAINER_NS "Psr\\Container" -#define PIMPLE_EXCEPTION_NS "Pimple\\Exception" - -#define PIMPLE_DEFAULT_ZVAL_CACHE_NUM 5 -#define PIMPLE_DEFAULT_ZVAL_VALUES_NUM 10 - -#define PIMPLE_DEPRECATE do { \ - int er = EG(error_reporting); \ - EG(error_reporting) = 0;\ - php_error(E_DEPRECATED, "The Pimple C extension is deprecated since version 3.1 and will be removed in 4.0."); \ - EG(error_reporting) = er; \ -} while (0); - -zend_module_entry *get_module(void); - -PHP_MINIT_FUNCTION(pimple); -PHP_MINFO_FUNCTION(pimple); - -PHP_METHOD(FrozenServiceException, __construct); -PHP_METHOD(InvalidServiceIdentifierException, __construct); -PHP_METHOD(UnknownIdentifierException, __construct); - -PHP_METHOD(Pimple, __construct); -PHP_METHOD(Pimple, factory); -PHP_METHOD(Pimple, protect); -PHP_METHOD(Pimple, raw); -PHP_METHOD(Pimple, extend); -PHP_METHOD(Pimple, keys); -PHP_METHOD(Pimple, register); -PHP_METHOD(Pimple, offsetSet); -PHP_METHOD(Pimple, offsetUnset); -PHP_METHOD(Pimple, offsetGet); -PHP_METHOD(Pimple, offsetExists); - -PHP_METHOD(PimpleClosure, invoker); - -typedef struct _pimple_bucket_value { - zval *value; /* Must be the first element */ - zval *raw; - zend_object_handle handle_num; - enum { - PIMPLE_IS_PARAM = 0, - PIMPLE_IS_SERVICE = 2 - } type; - zend_bool initialized; - zend_fcall_info_cache fcc; -} pimple_bucket_value; - -typedef struct _pimple_object { - zend_object zobj; - HashTable values; - HashTable factories; - HashTable protected; -} pimple_object; - -typedef struct _pimple_closure_object { - zend_object zobj; - zval *callable; - zval *factory; -} pimple_closure_object; - -static const char sensiolabs_logo[] = ""; - -static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC); - -static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); -static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); - -static void pimple_bucket_dtor(pimple_bucket_value *bucket); -static void pimple_free_bucket(pimple_bucket_value *bucket); - -static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC); -static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC); -static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC); -static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC); -static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC); -static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC); - -static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC); -static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC); -static zend_function *pimple_closure_get_constructor(zval * TSRMLS_DC); -static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC); - -#ifdef ZTS -#define PIMPLE_G(v) TSRMG(pimple_globals_id, zend_pimple_globals *, v) -#else -#define PIMPLE_G(v) (pimple_globals.v) -#endif - -#endif /* PHP_PIMPLE_H */ - diff --git a/vendor/pimple/pimple/ext/pimple/pimple.c b/vendor/pimple/pimple/ext/pimple/pimple.c deleted file mode 100644 index c80499b..0000000 --- a/vendor/pimple/pimple/ext/pimple/pimple.c +++ /dev/null @@ -1,1114 +0,0 @@ - -/* - * This file is part of Pimple. - * - * Copyright (c) 2014 Fabien Potencier - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished - * to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_pimple.h" -#include "pimple_compat.h" -#include "zend_interfaces.h" -#include "zend.h" -#include "Zend/zend_closures.h" -#include "ext/spl/spl_exceptions.h" -#include "Zend/zend_exceptions.h" -#include "main/php_output.h" -#include "SAPI.h" - -static zend_class_entry *pimple_ce_PsrContainerInterface; -static zend_class_entry *pimple_ce_PsrContainerExceptionInterface; -static zend_class_entry *pimple_ce_PsrNotFoundExceptionInterface; - -static zend_class_entry *pimple_ce_ExpectedInvokableException; -static zend_class_entry *pimple_ce_FrozenServiceException; -static zend_class_entry *pimple_ce_InvalidServiceIdentifierException; -static zend_class_entry *pimple_ce_UnknownIdentifierException; - -static zend_class_entry *pimple_ce; -static zend_object_handlers pimple_object_handlers; -static zend_class_entry *pimple_closure_ce; -static zend_class_entry *pimple_serviceprovider_ce; -static zend_object_handlers pimple_closure_object_handlers; -static zend_internal_function pimple_closure_invoker_function; - -#define FETCH_DIM_HANDLERS_VARS pimple_object *pimple_obj = NULL; \ - ulong index; \ - pimple_obj = (pimple_object *)zend_object_store_get_object(object TSRMLS_CC); \ - -#define PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS do { \ - if (ce != pimple_ce) { \ - zend_hash_find(&ce->function_table, ZEND_STRS("offsetget"), (void **)&function); \ - if (function->common.scope != ce) { /* if the function is not defined in this actual class */ \ - pimple_object_handlers.read_dimension = pimple_object_read_dimension; /* then overwrite the handler to use custom one */ \ - } \ - zend_hash_find(&ce->function_table, ZEND_STRS("offsetset"), (void **)&function); \ - if (function->common.scope != ce) { \ - pimple_object_handlers.write_dimension = pimple_object_write_dimension; \ - } \ - zend_hash_find(&ce->function_table, ZEND_STRS("offsetexists"), (void **)&function); \ - if (function->common.scope != ce) { \ - pimple_object_handlers.has_dimension = pimple_object_has_dimension; \ - } \ - zend_hash_find(&ce->function_table, ZEND_STRS("offsetunset"), (void **)&function); \ - if (function->common.scope != ce) { \ - pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \ - } \ - } else { \ - pimple_object_handlers.read_dimension = pimple_object_read_dimension; \ - pimple_object_handlers.write_dimension = pimple_object_write_dimension; \ - pimple_object_handlers.has_dimension = pimple_object_has_dimension; \ - pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \ - }\ - } while(0); - -#define PIMPLE_CALL_CB do { \ - zend_fcall_info_argn(&fci TSRMLS_CC, 1, &object); \ - fci.size = sizeof(fci); \ - fci.object_ptr = retval->fcc.object_ptr; \ - fci.function_name = retval->value; \ - fci.no_separation = 1; \ - fci.retval_ptr_ptr = &retval_ptr_ptr; \ -\ - zend_call_function(&fci, &retval->fcc TSRMLS_CC); \ - efree(fci.params); \ - if (EG(exception)) { \ - return EG(uninitialized_zval_ptr); \ - } \ - } while(0); - - -/* Psr\Container\ContainerInterface */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_get, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_has, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_ce_PsrContainerInterface_functions[] = { - PHP_ABSTRACT_ME(ContainerInterface, get, arginfo_pimple_PsrContainerInterface_get) - PHP_ABSTRACT_ME(ContainerInterface, has, arginfo_pimple_PsrContainerInterface_has) - PHP_FE_END -}; - -/* Psr\Container\ContainerExceptionInterface */ -static const zend_function_entry pimple_ce_PsrContainerExceptionInterface_functions[] = { - PHP_FE_END -}; - -/* Psr\Container\NotFoundExceptionInterface */ -static const zend_function_entry pimple_ce_PsrNotFoundExceptionInterface_functions[] = { - PHP_FE_END -}; - -/* Pimple\Exception\FrozenServiceException */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_FrozenServiceException___construct, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_ce_FrozenServiceException_functions[] = { - PHP_ME(FrozenServiceException, __construct, arginfo_FrozenServiceException___construct, ZEND_ACC_PUBLIC) - PHP_FE_END -}; - -/* Pimple\Exception\InvalidServiceIdentifierException */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_InvalidServiceIdentifierException___construct, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_ce_InvalidServiceIdentifierException_functions[] = { - PHP_ME(InvalidServiceIdentifierException, __construct, arginfo_InvalidServiceIdentifierException___construct, ZEND_ACC_PUBLIC) - PHP_FE_END -}; - -/* Pimple\Exception\UnknownIdentifierException */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_UnknownIdentifierException___construct, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_ce_UnknownIdentifierException_functions[] = { - PHP_ME(UnknownIdentifierException, __construct, arginfo_UnknownIdentifierException___construct, ZEND_ACC_PUBLIC) - PHP_FE_END -}; - -/* Pimple\Container */ -ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0) -ZEND_ARG_ARRAY_INFO(0, value, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetset, 0, 0, 2) -ZEND_ARG_INFO(0, offset) -ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetget, 0, 0, 1) -ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetexists, 0, 0, 1) -ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetunset, 0, 0, 1) -ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_factory, 0, 0, 1) -ZEND_ARG_INFO(0, callable) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_protect, 0, 0, 1) -ZEND_ARG_INFO(0, callable) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_raw, 0, 0, 1) -ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_extend, 0, 0, 2) -ZEND_ARG_INFO(0, id) -ZEND_ARG_INFO(0, callable) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_keys, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_register, 0, 0, 1) -ZEND_ARG_OBJ_INFO(0, provider, Pimple\\ServiceProviderInterface, 0) -ZEND_ARG_ARRAY_INFO(0, values, 1) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_ce_functions[] = { - PHP_ME(Pimple, __construct, arginfo___construct, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, factory, arginfo_factory, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, protect, arginfo_protect, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, raw, arginfo_raw, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, extend, arginfo_extend, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, keys, arginfo_keys, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, register, arginfo_register, ZEND_ACC_PUBLIC) - - PHP_ME(Pimple, offsetSet, arginfo_offsetset, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, offsetGet, arginfo_offsetget, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, offsetExists, arginfo_offsetexists, ZEND_ACC_PUBLIC) - PHP_ME(Pimple, offsetUnset, arginfo_offsetunset, ZEND_ACC_PUBLIC) - PHP_FE_END -}; - -/* Pimple\ServiceProviderInterface */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_serviceprovider_register, 0, 0, 1) -ZEND_ARG_OBJ_INFO(0, pimple, Pimple\\Container, 0) -ZEND_END_ARG_INFO() - -static const zend_function_entry pimple_serviceprovider_iface_ce_functions[] = { - PHP_ABSTRACT_ME(ServiceProviderInterface, register, arginfo_serviceprovider_register) - PHP_FE_END -}; - -/* parent::__construct(sprintf("Something with %s", $arg1)) */ -static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC) -{ - zend_class_entry *ce = Z_OBJCE_P(this_ptr); - char *message = NULL; - int message_len; - zval *constructor_arg; - - message_len = spprintf(&message, 0, format, arg1); - ALLOC_INIT_ZVAL(constructor_arg); - ZVAL_STRINGL(constructor_arg, message, message_len, 1); - - zend_call_method_with_1_params(&this_ptr, ce, &ce->parent->constructor, "__construct", NULL, constructor_arg); - - efree(message); - zval_ptr_dtor(&constructor_arg); -} - -/** - * Pass a single string parameter to exception constructor and throw - */ -static void pimple_throw_exception_string(zend_class_entry *ce, const char *message, zend_uint message_len TSRMLS_DC) -{ - zval *exception, *param; - - ALLOC_INIT_ZVAL(exception); - object_init_ex(exception, ce); - - ALLOC_INIT_ZVAL(param); - ZVAL_STRINGL(param, message, message_len, 1); - - zend_call_method_with_1_params(&exception, ce, &ce->constructor, "__construct", NULL, param); - - zend_throw_exception_object(exception TSRMLS_CC); - - zval_ptr_dtor(¶m); -} - -static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC) -{ - zend_object_std_dtor(&obj->zobj TSRMLS_CC); - if (obj->factory) { - zval_ptr_dtor(&obj->factory); - } - if (obj->callable) { - zval_ptr_dtor(&obj->callable); - } - efree(obj); -} - -static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC) -{ - zend_hash_destroy(&obj->factories); - zend_hash_destroy(&obj->protected); - zend_hash_destroy(&obj->values); - zend_object_std_dtor(&obj->zobj TSRMLS_CC); - efree(obj); -} - -static void pimple_free_bucket(pimple_bucket_value *bucket) -{ - if (bucket->raw) { - zval_ptr_dtor(&bucket->raw); - } -} - -static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC) -{ - zend_object_value retval; - pimple_closure_object *pimple_closure_obj = NULL; - - pimple_closure_obj = ecalloc(1, sizeof(pimple_closure_object)); - ZEND_OBJ_INIT(&pimple_closure_obj->zobj, ce); - - pimple_closure_object_handlers.get_constructor = pimple_closure_get_constructor; - retval.handlers = &pimple_closure_object_handlers; - retval.handle = zend_objects_store_put(pimple_closure_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_closure_free_object_storage, NULL TSRMLS_CC); - - return retval; -} - -static zend_function *pimple_closure_get_constructor(zval *obj TSRMLS_DC) -{ - zend_error(E_ERROR, "Pimple\\ContainerClosure is an internal class and cannot be instantiated"); - - return NULL; -} - -static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC) -{ - *zobj_ptr = obj; - *ce_ptr = Z_OBJCE_P(obj); - *fptr_ptr = (zend_function *)&pimple_closure_invoker_function; - - return SUCCESS; -} - -static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC) -{ - zend_object_value retval; - pimple_object *pimple_obj = NULL; - zend_function *function = NULL; - - pimple_obj = emalloc(sizeof(pimple_object)); - ZEND_OBJ_INIT(&pimple_obj->zobj, ce); - - PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS - - retval.handlers = &pimple_object_handlers; - retval.handle = zend_objects_store_put(pimple_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_free_object_storage, NULL TSRMLS_CC); - - zend_hash_init(&pimple_obj->factories, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0); - zend_hash_init(&pimple_obj->protected, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0); - zend_hash_init(&pimple_obj->values, PIMPLE_DEFAULT_ZVAL_VALUES_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0); - - return retval; -} - -static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) -{ - FETCH_DIM_HANDLERS_VARS - - pimple_bucket_value pimple_value = {0}, *found_value = NULL; - ulong hash; - - pimple_zval_to_pimpleval(value, &pimple_value TSRMLS_CC); - - if (!offset) {/* $p[] = 'foo' when not overloaded */ - zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL); - Z_ADDREF_P(value); - return; - } - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - hash = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - zend_hash_quick_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void **)&found_value); - if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) { - pimple_free_bucket(&pimple_value); - pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - return; - } - if (zend_hash_quick_update(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) { - pimple_free_bucket(&pimple_value); - return; - } - Z_ADDREF_P(value); - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - zend_hash_index_find(&pimple_obj->values, index, (void **)&found_value); - if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) { - pimple_free_bucket(&pimple_value); - convert_to_string(offset); - pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - return; - } - if (zend_hash_index_update(&pimple_obj->values, index, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) { - pimple_free_bucket(&pimple_value); - return; - } - Z_ADDREF_P(value); - break; - case IS_NULL: /* $p[] = 'foo' when overloaded */ - zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL); - Z_ADDREF_P(value); - break; - default: - pimple_free_bucket(&pimple_value); - zend_error(E_WARNING, "Unsupported offset type"); - } -} - -static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC) -{ - FETCH_DIM_HANDLERS_VARS - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - zend_symtable_del(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - zend_symtable_del(&pimple_obj->factories, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - zend_symtable_del(&pimple_obj->protected, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - zend_hash_index_del(&pimple_obj->values, index); - zend_hash_index_del(&pimple_obj->factories, index); - zend_hash_index_del(&pimple_obj->protected, index); - break; - default: - zend_error(E_WARNING, "Unsupported offset type"); - } -} - -static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) -{ - FETCH_DIM_HANDLERS_VARS - - pimple_bucket_value *retval = NULL; - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == SUCCESS) { - switch (check_empty) { - case 0: /* isset */ - return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;) */ - case 1: /* empty */ - default: - return zend_is_true(retval->value); - } - } - return 0; - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == SUCCESS) { - switch (check_empty) { - case 0: /* isset */ - return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;)*/ - case 1: /* empty */ - default: - return zend_is_true(retval->value); - } - } - return 0; - break; - default: - zend_error(E_WARNING, "Unsupported offset type"); - return 0; - } -} - -static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) -{ - FETCH_DIM_HANDLERS_VARS - - pimple_bucket_value *retval = NULL; - zend_fcall_info fci = {0}; - zval *retval_ptr_ptr = NULL; - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == FAILURE) { - pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - - return EG(uninitialized_zval_ptr); - } - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == FAILURE) { - return EG(uninitialized_zval_ptr); - } - break; - case IS_NULL: /* $p[][3] = 'foo' first dim access */ - return EG(uninitialized_zval_ptr); - break; - default: - zend_error(E_WARNING, "Unsupported offset type"); - return EG(uninitialized_zval_ptr); - } - - if(retval->type == PIMPLE_IS_PARAM) { - return retval->value; - } - - if (zend_hash_index_exists(&pimple_obj->protected, retval->handle_num)) { - /* Service is protected, return the value every time */ - return retval->value; - } - - if (zend_hash_index_exists(&pimple_obj->factories, retval->handle_num)) { - /* Service is a factory, call it every time and never cache its result */ - PIMPLE_CALL_CB - Z_DELREF_P(retval_ptr_ptr); /* fetch dim addr will increment refcount */ - return retval_ptr_ptr; - } - - if (retval->initialized == 1) { - /* Service has already been called, return its cached value */ - return retval->value; - } - - ALLOC_INIT_ZVAL(retval->raw); - MAKE_COPY_ZVAL(&retval->value, retval->raw); - - PIMPLE_CALL_CB - - retval->initialized = 1; - zval_ptr_dtor(&retval->value); - retval->value = retval_ptr_ptr; - - return retval->value; -} - -static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC) -{ - if (Z_TYPE_P(_zval) != IS_OBJECT) { - return FAILURE; - } - - if (_pimple_bucket_value->fcc.called_scope) { - return SUCCESS; - } - - if (Z_OBJ_HANDLER_P(_zval, get_closure) && Z_OBJ_HANDLER_P(_zval, get_closure)(_zval, &_pimple_bucket_value->fcc.calling_scope, &_pimple_bucket_value->fcc.function_handler, &_pimple_bucket_value->fcc.object_ptr TSRMLS_CC) == SUCCESS) { - _pimple_bucket_value->fcc.called_scope = _pimple_bucket_value->fcc.calling_scope; - return SUCCESS; - } else { - return FAILURE; - } -} - -static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC) -{ - _pimple_bucket_value->value = _zval; - - if (Z_TYPE_P(_zval) != IS_OBJECT) { - return PIMPLE_IS_PARAM; - } - - if (pimple_zval_is_valid_callback(_zval, _pimple_bucket_value TSRMLS_CC) == SUCCESS) { - _pimple_bucket_value->type = PIMPLE_IS_SERVICE; - _pimple_bucket_value->handle_num = Z_OBJ_HANDLE_P(_zval); - } - - return PIMPLE_IS_SERVICE; -} - -static void pimple_bucket_dtor(pimple_bucket_value *bucket) -{ - zval_ptr_dtor(&bucket->value); - pimple_free_bucket(bucket); -} - -PHP_METHOD(FrozenServiceException, __construct) -{ - char *id = NULL; - int id_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { - return; - } - pimple_exception_call_parent_constructor(getThis(), "Cannot override frozen service \"%s\".", id TSRMLS_CC); -} - -PHP_METHOD(InvalidServiceIdentifierException, __construct) -{ - char *id = NULL; - int id_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { - return; - } - pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" does not contain an object definition.", id TSRMLS_CC); -} - -PHP_METHOD(UnknownIdentifierException, __construct) -{ - char *id = NULL; - int id_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { - return; - } - pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" is not defined.", id TSRMLS_CC); -} - -PHP_METHOD(Pimple, protect) -{ - zval *protected = NULL; - pimple_object *pobj = NULL; - pimple_bucket_value bucket = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &protected) == FAILURE) { - return; - } - - if (pimple_zval_is_valid_callback(protected, &bucket TSRMLS_CC) == FAILURE) { - pimple_free_bucket(&bucket); - zend_throw_exception(pimple_ce_ExpectedInvokableException, "Callable is not a Closure or invokable object.", 0 TSRMLS_CC); - return; - } - - pimple_zval_to_pimpleval(protected, &bucket TSRMLS_CC); - pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC); - - if (zend_hash_index_update(&pobj->protected, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) { - Z_ADDREF_P(protected); - RETURN_ZVAL(protected, 1 , 0); - } else { - pimple_free_bucket(&bucket); - } - RETURN_FALSE; -} - -PHP_METHOD(Pimple, raw) -{ - zval *offset = NULL; - pimple_object *pobj = NULL; - pimple_bucket_value *value = NULL; - ulong index; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) { - return; - } - - pobj = zend_object_store_get_object(getThis() TSRMLS_CC); - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) { - pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - RETURN_NULL(); - } - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) { - RETURN_NULL(); - } - break; - case IS_NULL: - default: - zend_error(E_WARNING, "Unsupported offset type"); - } - - if (value->raw) { - RETVAL_ZVAL(value->raw, 1, 0); - } else { - RETVAL_ZVAL(value->value, 1, 0); - } -} - -PHP_METHOD(Pimple, extend) -{ - zval *offset = NULL, *callable = NULL, *pimple_closure_obj = NULL; - pimple_bucket_value bucket = {0}, *value = NULL; - pimple_object *pobj = NULL; - pimple_closure_object *pcobj = NULL; - ulong index; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &callable) == FAILURE) { - return; - } - - pobj = zend_object_store_get_object(getThis() TSRMLS_CC); - - switch (Z_TYPE_P(offset)) { - case IS_STRING: - if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) { - pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - RETURN_NULL(); - } - - if (value->type != PIMPLE_IS_SERVICE) { - pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - RETURN_NULL(); - } - if (zend_hash_index_exists(&pobj->protected, value->handle_num)) { - int er = EG(error_reporting); - EG(error_reporting) = 0; - php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%s\" should be protected?", Z_STRVAL_P(offset)); - EG(error_reporting) = er; - } - break; - case IS_DOUBLE: - case IS_BOOL: - case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (ulong)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } - if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) { - convert_to_string(offset); - pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - RETURN_NULL(); - } - if (value->type != PIMPLE_IS_SERVICE) { - convert_to_string(offset); - pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); - RETURN_NULL(); - } - if (zend_hash_index_exists(&pobj->protected, value->handle_num)) { - int er = EG(error_reporting); - EG(error_reporting) = 0; - php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%ld\" should be protected?", index); - EG(error_reporting) = er; - } - break; - case IS_NULL: - default: - zend_error(E_WARNING, "Unsupported offset type"); - } - - if (pimple_zval_is_valid_callback(callable, &bucket TSRMLS_CC) == FAILURE) { - pimple_free_bucket(&bucket); - zend_throw_exception(pimple_ce_ExpectedInvokableException, "Extension service definition is not a Closure or invokable object.", 0 TSRMLS_CC); - RETURN_NULL(); - } - pimple_free_bucket(&bucket); - - ALLOC_INIT_ZVAL(pimple_closure_obj); - object_init_ex(pimple_closure_obj, pimple_closure_ce); - - pcobj = zend_object_store_get_object(pimple_closure_obj TSRMLS_CC); - pcobj->callable = callable; - pcobj->factory = value->value; - Z_ADDREF_P(callable); - Z_ADDREF_P(value->value); - - if (zend_hash_index_exists(&pobj->factories, value->handle_num)) { - pimple_zval_to_pimpleval(pimple_closure_obj, &bucket TSRMLS_CC); - zend_hash_index_del(&pobj->factories, value->handle_num); - zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL); - Z_ADDREF_P(pimple_closure_obj); - } - - pimple_object_write_dimension(getThis(), offset, pimple_closure_obj TSRMLS_CC); - - RETVAL_ZVAL(pimple_closure_obj, 1, 1); -} - -PHP_METHOD(Pimple, keys) -{ - HashPosition pos; - pimple_object *pobj = NULL; - zval **value = NULL; - zval *endval = NULL; - char *str_index = NULL; - int str_len; - ulong num_index; - - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - pobj = zend_object_store_get_object(getThis() TSRMLS_CC); - array_init_size(return_value, zend_hash_num_elements(&pobj->values)); - - zend_hash_internal_pointer_reset_ex(&pobj->values, &pos); - - while(zend_hash_get_current_data_ex(&pobj->values, (void **)&value, &pos) == SUCCESS) { - MAKE_STD_ZVAL(endval); - switch (zend_hash_get_current_key_ex(&pobj->values, &str_index, (uint *)&str_len, &num_index, 0, &pos)) { - case HASH_KEY_IS_STRING: - ZVAL_STRINGL(endval, str_index, str_len - 1, 1); - zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL); - break; - case HASH_KEY_IS_LONG: - ZVAL_LONG(endval, num_index); - zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL); - break; - } - zend_hash_move_forward_ex(&pobj->values, &pos); - } -} - -PHP_METHOD(Pimple, factory) -{ - zval *factory = NULL; - pimple_object *pobj = NULL; - pimple_bucket_value bucket = {0}; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &factory) == FAILURE) { - return; - } - - if (pimple_zval_is_valid_callback(factory, &bucket TSRMLS_CC) == FAILURE) { - pimple_free_bucket(&bucket); - zend_throw_exception(pimple_ce_ExpectedInvokableException, "Service definition is not a Closure or invokable object.", 0 TSRMLS_CC); - return; - } - - pimple_zval_to_pimpleval(factory, &bucket TSRMLS_CC); - pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC); - - if (zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) { - Z_ADDREF_P(factory); - RETURN_ZVAL(factory, 1 , 0); - } else { - pimple_free_bucket(&bucket); - } - - RETURN_FALSE; -} - -PHP_METHOD(Pimple, offsetSet) -{ - zval *offset = NULL, *value = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &value) == FAILURE) { - return; - } - - pimple_object_write_dimension(getThis(), offset, value TSRMLS_CC); -} - -PHP_METHOD(Pimple, offsetGet) -{ - zval *offset = NULL, *retval = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) { - return; - } - - retval = pimple_object_read_dimension(getThis(), offset, 0 TSRMLS_CC); - - RETVAL_ZVAL(retval, 1, 0); -} - -PHP_METHOD(Pimple, offsetUnset) -{ - zval *offset = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) { - return; - } - - pimple_object_unset_dimension(getThis(), offset TSRMLS_CC); -} - -PHP_METHOD(Pimple, offsetExists) -{ - zval *offset = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) { - return; - } - - RETVAL_BOOL(pimple_object_has_dimension(getThis(), offset, 1 TSRMLS_CC)); -} - -PHP_METHOD(Pimple, register) -{ - zval *provider; - zval **data; - zval *retval = NULL; - zval key; - - HashTable *array = NULL; - HashPosition pos; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|h", &provider, pimple_serviceprovider_ce, &array) == FAILURE) { - return; - } - - RETVAL_ZVAL(getThis(), 1, 0); - - zend_call_method_with_1_params(&provider, Z_OBJCE_P(provider), NULL, "register", &retval, getThis()); - - if (retval) { - zval_ptr_dtor(&retval); - } - - if (!array) { - return; - } - - zend_hash_internal_pointer_reset_ex(array, &pos); - - while(zend_hash_get_current_data_ex(array, (void **)&data, &pos) == SUCCESS) { - zend_hash_get_current_key_zval_ex(array, &key, &pos); - pimple_object_write_dimension(getThis(), &key, *data TSRMLS_CC); - zend_hash_move_forward_ex(array, &pos); - } -} - -PHP_METHOD(Pimple, __construct) -{ - zval *values = NULL, **pData = NULL, offset; - HashPosition pos; - char *str_index = NULL; - zend_uint str_length; - ulong num_index; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &values) == FAILURE) { - return; - } - - PIMPLE_DEPRECATE - - if (!values) { - return; - } - - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos); - while (zend_hash_has_more_elements_ex(Z_ARRVAL_P(values), &pos) == SUCCESS) { - zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&pData, &pos); - zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &str_index, &str_length, &num_index, 0, &pos); - INIT_ZVAL(offset); - if (zend_hash_get_current_key_type_ex(Z_ARRVAL_P(values), &pos) == HASH_KEY_IS_LONG) { - ZVAL_LONG(&offset, num_index); - } else { - ZVAL_STRINGL(&offset, str_index, (str_length - 1), 0); - } - pimple_object_write_dimension(getThis(), &offset, *pData TSRMLS_CC); - zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos); - } -} - -/* - * This is PHP code snippet handling extend()s calls : - - $extended = function ($c) use ($callable, $factory) { - return $callable($factory($c), $c); - }; - - */ -PHP_METHOD(PimpleClosure, invoker) -{ - pimple_closure_object *pcobj = NULL; - zval *arg = NULL, *retval = NULL, *newretval = NULL; - zend_fcall_info fci = {0}; - zval **args[2]; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { - return; - } - - pcobj = zend_object_store_get_object(getThis() TSRMLS_CC); - - fci.function_name = pcobj->factory; - args[0] = &arg; - zend_fcall_info_argp(&fci TSRMLS_CC, 1, args); - fci.retval_ptr_ptr = &retval; - fci.size = sizeof(fci); - - if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) { - efree(fci.params); - return; /* Should here return default zval */ - } - - efree(fci.params); - memset(&fci, 0, sizeof(fci)); - fci.size = sizeof(fci); - - fci.function_name = pcobj->callable; - args[0] = &retval; - args[1] = &arg; - zend_fcall_info_argp(&fci TSRMLS_CC, 2, args); - fci.retval_ptr_ptr = &newretval; - - if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) { - efree(fci.params); - zval_ptr_dtor(&retval); - return; - } - - efree(fci.params); - zval_ptr_dtor(&retval); - - RETVAL_ZVAL(newretval, 1 ,1); -} - -PHP_MINIT_FUNCTION(pimple) -{ - zend_class_entry tmp_ce_PsrContainerInterface, tmp_ce_PsrContainerExceptionInterface, tmp_ce_PsrNotFoundExceptionInterface; - zend_class_entry tmp_ce_ExpectedInvokableException, tmp_ce_FrozenServiceException, tmp_ce_InvalidServiceIdentifierException, tmp_ce_UnknownIdentifierException; - zend_class_entry tmp_pimple_ce, tmp_pimple_closure_ce, tmp_pimple_serviceprovider_iface_ce; - - /* Psr\Container namespace */ - INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerInterface, PSR_CONTAINER_NS, "ContainerInterface", pimple_ce_PsrContainerInterface_functions); - INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerExceptionInterface, PSR_CONTAINER_NS, "ContainerExceptionInterface", pimple_ce_PsrContainerExceptionInterface_functions); - INIT_NS_CLASS_ENTRY(tmp_ce_PsrNotFoundExceptionInterface, PSR_CONTAINER_NS, "NotFoundExceptionInterface", pimple_ce_PsrNotFoundExceptionInterface_functions); - - pimple_ce_PsrContainerInterface = zend_register_internal_interface(&tmp_ce_PsrContainerInterface TSRMLS_CC); - pimple_ce_PsrContainerExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrContainerExceptionInterface TSRMLS_CC); - pimple_ce_PsrNotFoundExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrNotFoundExceptionInterface TSRMLS_CC); - - zend_class_implements(pimple_ce_PsrNotFoundExceptionInterface TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); - - /* Pimple\Exception namespace */ - INIT_NS_CLASS_ENTRY(tmp_ce_ExpectedInvokableException, PIMPLE_EXCEPTION_NS, "ExpectedInvokableException", NULL); - INIT_NS_CLASS_ENTRY(tmp_ce_FrozenServiceException, PIMPLE_EXCEPTION_NS, "FrozenServiceException", pimple_ce_FrozenServiceException_functions); - INIT_NS_CLASS_ENTRY(tmp_ce_InvalidServiceIdentifierException, PIMPLE_EXCEPTION_NS, "InvalidServiceIdentifierException", pimple_ce_InvalidServiceIdentifierException_functions); - INIT_NS_CLASS_ENTRY(tmp_ce_UnknownIdentifierException, PIMPLE_EXCEPTION_NS, "UnknownIdentifierException", pimple_ce_UnknownIdentifierException_functions); - - pimple_ce_ExpectedInvokableException = zend_register_internal_class_ex(&tmp_ce_ExpectedInvokableException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); - pimple_ce_FrozenServiceException = zend_register_internal_class_ex(&tmp_ce_FrozenServiceException, spl_ce_RuntimeException, NULL TSRMLS_CC); - pimple_ce_InvalidServiceIdentifierException = zend_register_internal_class_ex(&tmp_ce_InvalidServiceIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); - pimple_ce_UnknownIdentifierException = zend_register_internal_class_ex(&tmp_ce_UnknownIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); - - zend_class_implements(pimple_ce_ExpectedInvokableException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); - zend_class_implements(pimple_ce_FrozenServiceException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); - zend_class_implements(pimple_ce_InvalidServiceIdentifierException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); - zend_class_implements(pimple_ce_UnknownIdentifierException TSRMLS_CC, 1, pimple_ce_PsrNotFoundExceptionInterface); - - /* Pimple namespace */ - INIT_NS_CLASS_ENTRY(tmp_pimple_ce, PIMPLE_NS, "Container", pimple_ce_functions); - INIT_NS_CLASS_ENTRY(tmp_pimple_closure_ce, PIMPLE_NS, "ContainerClosure", NULL); - INIT_NS_CLASS_ENTRY(tmp_pimple_serviceprovider_iface_ce, PIMPLE_NS, "ServiceProviderInterface", pimple_serviceprovider_iface_ce_functions); - - tmp_pimple_ce.create_object = pimple_object_create; - tmp_pimple_closure_ce.create_object = pimple_closure_object_create; - - pimple_ce = zend_register_internal_class(&tmp_pimple_ce TSRMLS_CC); - zend_class_implements(pimple_ce TSRMLS_CC, 1, zend_ce_arrayaccess); - - pimple_closure_ce = zend_register_internal_class(&tmp_pimple_closure_ce TSRMLS_CC); - pimple_closure_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; - - pimple_serviceprovider_ce = zend_register_internal_interface(&tmp_pimple_serviceprovider_iface_ce TSRMLS_CC); - - memcpy(&pimple_closure_object_handlers, zend_get_std_object_handlers(), sizeof(*zend_get_std_object_handlers())); - pimple_object_handlers = std_object_handlers; - pimple_closure_object_handlers.get_closure = pimple_closure_get_closure; - - pimple_closure_invoker_function.function_name = "Pimple closure internal invoker"; - pimple_closure_invoker_function.fn_flags |= ZEND_ACC_CLOSURE; - pimple_closure_invoker_function.handler = ZEND_MN(PimpleClosure_invoker); - pimple_closure_invoker_function.num_args = 1; - pimple_closure_invoker_function.required_num_args = 1; - pimple_closure_invoker_function.scope = pimple_closure_ce; - pimple_closure_invoker_function.type = ZEND_INTERNAL_FUNCTION; - pimple_closure_invoker_function.module = &pimple_module_entry; - - return SUCCESS; -} - -PHP_MINFO_FUNCTION(pimple) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "SensioLabs Pimple C support", "enabled"); - php_info_print_table_row(2, "Pimple supported version", PIMPLE_VERSION); - php_info_print_table_end(); - - php_info_print_box_start(0); - php_write((void *)ZEND_STRL("SensioLabs Pimple C support developed by Julien Pauli") TSRMLS_CC); - if (!sapi_module.phpinfo_as_text) { - php_write((void *)ZEND_STRL(sensiolabs_logo) TSRMLS_CC); - } - php_info_print_box_end(); -} - -zend_module_entry pimple_module_entry = { - STANDARD_MODULE_HEADER, - "pimple", - NULL, - PHP_MINIT(pimple), - NULL, - NULL, - NULL, - PHP_MINFO(pimple), - PIMPLE_VERSION, - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_PIMPLE -ZEND_GET_MODULE(pimple) -#endif diff --git a/vendor/pimple/pimple/ext/pimple/pimple_compat.h b/vendor/pimple/pimple/ext/pimple/pimple_compat.h deleted file mode 100644 index d234e17..0000000 --- a/vendor/pimple/pimple/ext/pimple/pimple_compat.h +++ /dev/null @@ -1,81 +0,0 @@ - -/* - * This file is part of Pimple. - * - * Copyright (c) 2014 Fabien Potencier - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished - * to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef PIMPLE_COMPAT_H_ -#define PIMPLE_COMPAT_H_ - -#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ - -#define PHP_5_0_X_API_NO 220040412 -#define PHP_5_1_X_API_NO 220051025 -#define PHP_5_2_X_API_NO 220060519 -#define PHP_5_3_X_API_NO 220090626 -#define PHP_5_4_X_API_NO 220100525 -#define PHP_5_5_X_API_NO 220121212 -#define PHP_5_6_X_API_NO 220131226 - -#define IS_PHP_56 ZEND_EXTENSION_API_NO == PHP_5_6_X_API_NO -#define IS_AT_LEAST_PHP_56 ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO - -#define IS_PHP_55 ZEND_EXTENSION_API_NO == PHP_5_5_X_API_NO -#define IS_AT_LEAST_PHP_55 ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO - -#define IS_PHP_54 ZEND_EXTENSION_API_NO == PHP_5_4_X_API_NO -#define IS_AT_LEAST_PHP_54 ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO - -#define IS_PHP_53 ZEND_EXTENSION_API_NO == PHP_5_3_X_API_NO -#define IS_AT_LEAST_PHP_53 ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - -#if IS_PHP_53 -#define object_properties_init(obj, ce) do { \ - zend_hash_copy(obj->properties, &ce->default_properties, zval_copy_property_ctor(ce), NULL, sizeof(zval *)); \ - } while (0); -#endif - -#define ZEND_OBJ_INIT(obj, ce) do { \ - zend_object_std_init(obj, ce TSRMLS_CC); \ - object_properties_init((obj), (ce)); \ - } while(0); - -#if IS_PHP_53 || IS_PHP_54 -static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) { - Bucket *p; - - p = pos ? (*pos) : ht->pInternalPointer; - - if (!p) { - Z_TYPE_P(key) = IS_NULL; - } else if (p->nKeyLength) { - Z_TYPE_P(key) = IS_STRING; - Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1); - Z_STRLEN_P(key) = p->nKeyLength - 1; - } else { - Z_TYPE_P(key) = IS_LONG; - Z_LVAL_P(key) = p->h; - } -} -#endif - -#endif /* PIMPLE_COMPAT_H_ */ diff --git a/vendor/pimple/pimple/ext/pimple/tests/001.phpt b/vendor/pimple/pimple/ext/pimple/tests/001.phpt deleted file mode 100644 index 0809ea2..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/001.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -Test for read_dim/write_dim handlers ---SKIPIF-- - ---FILE-- - - ---EXPECTF-- -foo -42 -foo2 -foo99 -baz -strstr \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/002.phpt b/vendor/pimple/pimple/ext/pimple/tests/002.phpt deleted file mode 100644 index 7b56d2c..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/002.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Test for constructor ---SKIPIF-- - ---FILE-- -'foo')); -var_dump($p[42]); -?> ---EXPECT-- -NULL -string(3) "foo" diff --git a/vendor/pimple/pimple/ext/pimple/tests/003.phpt b/vendor/pimple/pimple/ext/pimple/tests/003.phpt deleted file mode 100644 index a22cfa3..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/003.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Test empty dimensions ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(42) -string(3) "bar" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/004.phpt b/vendor/pimple/pimple/ext/pimple/tests/004.phpt deleted file mode 100644 index 1e1d251..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/004.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Test has/unset dim handlers ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(42) -NULL -bool(true) -bool(false) -bool(true) -bool(true) \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/005.phpt b/vendor/pimple/pimple/ext/pimple/tests/005.phpt deleted file mode 100644 index 0479ee0..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/005.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Test simple class inheritance ---SKIPIF-- - ---FILE-- -someAttr; -?> ---EXPECT-- -string(3) "hit" -foo -fooAttr \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/006.phpt b/vendor/pimple/pimple/ext/pimple/tests/006.phpt deleted file mode 100644 index cfe8a11..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/006.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test complex class inheritance ---SKIPIF-- - ---FILE-- - 'bar', 88 => 'baz'); - -$p = new TestPimple($defaultValues); -$p[42] = 'foo'; -var_dump($p[42]); -var_dump($p[0]); -?> ---EXPECT-- -string(13) "hit offsetset" -string(27) "hit offsetget in TestPimple" -string(25) "hit offsetget in MyPimple" -string(3) "foo" -string(27) "hit offsetget in TestPimple" -string(25) "hit offsetget in MyPimple" -string(3) "baz" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/007.phpt b/vendor/pimple/pimple/ext/pimple/tests/007.phpt deleted file mode 100644 index 5aac683..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/007.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test for read_dim/write_dim handlers ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -foo -42 \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/008.phpt b/vendor/pimple/pimple/ext/pimple/tests/008.phpt deleted file mode 100644 index db7eeec..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/008.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test frozen services ---SKIPIF-- - ---FILE-- - ---EXPECTF-- diff --git a/vendor/pimple/pimple/ext/pimple/tests/009.phpt b/vendor/pimple/pimple/ext/pimple/tests/009.phpt deleted file mode 100644 index bb05ea2..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/009.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Test service is called as callback, and only once ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -bool(true) \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/010.phpt b/vendor/pimple/pimple/ext/pimple/tests/010.phpt deleted file mode 100644 index badce01..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/010.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -Test service is called as callback for every callback type ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -callme -called -Foo::bar -array(2) { - [0]=> - string(3) "Foo" - [1]=> - string(3) "bar" -} \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/011.phpt b/vendor/pimple/pimple/ext/pimple/tests/011.phpt deleted file mode 100644 index 6682ab8..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/011.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Test service callback throwing an exception ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -all right! \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/012.phpt b/vendor/pimple/pimple/ext/pimple/tests/012.phpt deleted file mode 100644 index 4c6ac48..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/012.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Test service factory ---SKIPIF-- - ---FILE-- -factory($f = function() { var_dump('called-1'); return 'ret-1';}); - -$p[] = $f; - -$p[] = function () { var_dump('called-2'); return 'ret-2'; }; - -var_dump($p[0]); -var_dump($p[0]); -var_dump($p[1]); -var_dump($p[1]); -?> ---EXPECTF-- -string(8) "called-1" -string(5) "ret-1" -string(8) "called-1" -string(5) "ret-1" -string(8) "called-2" -string(5) "ret-2" -string(5) "ret-2" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/013.phpt b/vendor/pimple/pimple/ext/pimple/tests/013.phpt deleted file mode 100644 index f419958..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/013.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Test keys() ---SKIPIF-- - ---FILE-- -keys()); - -$p['foo'] = 'bar'; -$p[] = 'foo'; - -var_dump($p->keys()); - -unset($p['foo']); - -var_dump($p->keys()); -?> ---EXPECTF-- -array(0) { -} -array(2) { - [0]=> - string(3) "foo" - [1]=> - int(0) -} -array(1) { - [0]=> - int(0) -} \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/014.phpt b/vendor/pimple/pimple/ext/pimple/tests/014.phpt deleted file mode 100644 index ac93721..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/014.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Test raw() ---SKIPIF-- - ---FILE-- -raw('foo')); -var_dump($p[42]); - -unset($p['foo']); - -try { - $p->raw('foo'); - echo "expected exception"; -} catch (InvalidArgumentException $e) { } ---EXPECTF-- -string(8) "called-2" -string(5) "ret-2" -object(Closure)#%i (0) { -} -string(8) "called-2" -string(5) "ret-2" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/015.phpt b/vendor/pimple/pimple/ext/pimple/tests/015.phpt deleted file mode 100644 index 314f008..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/015.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Test protect() ---SKIPIF-- - ---FILE-- -protect($f); - -var_dump($p['foo']); ---EXPECTF-- -object(Closure)#%i (0) { -} \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/016.phpt b/vendor/pimple/pimple/ext/pimple/tests/016.phpt deleted file mode 100644 index e55edb0..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/016.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Test extend() ---SKIPIF-- - ---FILE-- -extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */ - -var_dump($c('param')); ---EXPECTF-- -string(5) "param" -string(3) "foo" -string(3) "bar" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/017.phpt b/vendor/pimple/pimple/ext/pimple/tests/017.phpt deleted file mode 100644 index bac23ce..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/017.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Test extend() with exception in service extension ---SKIPIF-- - ---FILE-- -extend(12, function ($w) { throw new BadMethodCallException; }); - -try { - $p[12]; - echo "Exception expected"; -} catch (BadMethodCallException $e) { } ---EXPECTF-- diff --git a/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt b/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt deleted file mode 100644 index 8f881d6..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/017_1.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Test extend() with exception in service factory ---SKIPIF-- - ---FILE-- -extend(12, function ($w) { return 'foobar'; }); - -try { - $p[12]; - echo "Exception expected"; -} catch (BadMethodCallException $e) { } ---EXPECTF-- diff --git a/vendor/pimple/pimple/ext/pimple/tests/018.phpt b/vendor/pimple/pimple/ext/pimple/tests/018.phpt deleted file mode 100644 index 27c12a1..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/018.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Test register() ---SKIPIF-- - ---FILE-- -register(new Foo, array(42 => 'bar')); - -var_dump($p[42]); ---EXPECTF-- -object(Pimple\Container)#1 (0) { -} -string(3) "bar" \ No newline at end of file diff --git a/vendor/pimple/pimple/ext/pimple/tests/019.phpt b/vendor/pimple/pimple/ext/pimple/tests/019.phpt deleted file mode 100644 index 28a9aec..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/019.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Test register() returns static and is a fluent interface ---SKIPIF-- - ---FILE-- -register(new Foo)); ---EXPECTF-- -bool(true) diff --git a/vendor/pimple/pimple/ext/pimple/tests/bench.phpb b/vendor/pimple/pimple/ext/pimple/tests/bench.phpb deleted file mode 100644 index 8f983e6..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/bench.phpb +++ /dev/null @@ -1,51 +0,0 @@ -factory($factory); - -$p['factory'] = $factory; - -echo $p['factory']; -echo $p['factory']; -echo $p['factory']; - -} - -echo microtime(true) - $time; diff --git a/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb b/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb deleted file mode 100644 index aec541f..0000000 --- a/vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/vendor/pimple/pimple/phpunit.xml.dist b/vendor/pimple/pimple/phpunit.xml.dist deleted file mode 100644 index 5c8d487..0000000 --- a/vendor/pimple/pimple/phpunit.xml.dist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - ./src/Pimple/Tests - - - diff --git a/vendor/pimple/pimple/src/Pimple/Container.php b/vendor/pimple/pimple/src/Pimple/Container.php deleted file mode 100644 index e761964..0000000 --- a/vendor/pimple/pimple/src/Pimple/Container.php +++ /dev/null @@ -1,298 +0,0 @@ -factories = new \SplObjectStorage(); - $this->protected = new \SplObjectStorage(); - - foreach ($values as $key => $value) { - $this->offsetSet($key, $value); - } - } - - /** - * Sets a parameter or an object. - * - * Objects must be defined as Closures. - * - * Allowing any PHP callable leads to difficult to debug problems - * as function names (strings) are callable (creating a function with - * the same name as an existing parameter would break your container). - * - * @param string $id The unique identifier for the parameter or object - * @param mixed $value The value of the parameter or a closure to define an object - * - * @throws FrozenServiceException Prevent override of a frozen service - */ - public function offsetSet($id, $value) - { - if (isset($this->frozen[$id])) { - throw new FrozenServiceException($id); - } - - $this->values[$id] = $value; - $this->keys[$id] = true; - } - - /** - * Gets a parameter or an object. - * - * @param string $id The unique identifier for the parameter or object - * - * @return mixed The value of the parameter or an object - * - * @throws UnknownIdentifierException If the identifier is not defined - */ - public function offsetGet($id) - { - if (!isset($this->keys[$id])) { - throw new UnknownIdentifierException($id); - } - - if ( - isset($this->raw[$id]) - || !is_object($this->values[$id]) - || isset($this->protected[$this->values[$id]]) - || !method_exists($this->values[$id], '__invoke') - ) { - return $this->values[$id]; - } - - if (isset($this->factories[$this->values[$id]])) { - return $this->values[$id]($this); - } - - $raw = $this->values[$id]; - $val = $this->values[$id] = $raw($this); - $this->raw[$id] = $raw; - - $this->frozen[$id] = true; - - return $val; - } - - /** - * Checks if a parameter or an object is set. - * - * @param string $id The unique identifier for the parameter or object - * - * @return bool - */ - public function offsetExists($id) - { - return isset($this->keys[$id]); - } - - /** - * Unsets a parameter or an object. - * - * @param string $id The unique identifier for the parameter or object - */ - public function offsetUnset($id) - { - if (isset($this->keys[$id])) { - if (is_object($this->values[$id])) { - unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); - } - - unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]); - } - } - - /** - * Marks a callable as being a factory service. - * - * @param callable $callable A service definition to be used as a factory - * - * @return callable The passed callable - * - * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object - */ - public function factory($callable) - { - if (!method_exists($callable, '__invoke')) { - throw new ExpectedInvokableException('Service definition is not a Closure or invokable object.'); - } - - $this->factories->attach($callable); - - return $callable; - } - - /** - * Protects a callable from being interpreted as a service. - * - * This is useful when you want to store a callable as a parameter. - * - * @param callable $callable A callable to protect from being evaluated - * - * @return callable The passed callable - * - * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object - */ - public function protect($callable) - { - if (!method_exists($callable, '__invoke')) { - throw new ExpectedInvokableException('Callable is not a Closure or invokable object.'); - } - - $this->protected->attach($callable); - - return $callable; - } - - /** - * Gets a parameter or the closure defining an object. - * - * @param string $id The unique identifier for the parameter or object - * - * @return mixed The value of the parameter or the closure defining an object - * - * @throws UnknownIdentifierException If the identifier is not defined - */ - public function raw($id) - { - if (!isset($this->keys[$id])) { - throw new UnknownIdentifierException($id); - } - - if (isset($this->raw[$id])) { - return $this->raw[$id]; - } - - return $this->values[$id]; - } - - /** - * Extends an object definition. - * - * Useful when you want to extend an existing object definition, - * without necessarily loading that object. - * - * @param string $id The unique identifier for the object - * @param callable $callable A service definition to extend the original - * - * @return callable The wrapped callable - * - * @throws UnknownIdentifierException If the identifier is not defined - * @throws FrozenServiceException If the service is frozen - * @throws InvalidServiceIdentifierException If the identifier belongs to a parameter - * @throws ExpectedInvokableException If the extension callable is not a closure or an invokable object - */ - public function extend($id, $callable) - { - if (!isset($this->keys[$id])) { - throw new UnknownIdentifierException($id); - } - - if (isset($this->frozen[$id])) { - throw new FrozenServiceException($id); - } - - if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) { - throw new InvalidServiceIdentifierException($id); - } - - if (isset($this->protected[$this->values[$id]])) { - @trigger_error(sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), E_USER_DEPRECATED); - } - - if (!is_object($callable) || !method_exists($callable, '__invoke')) { - throw new ExpectedInvokableException('Extension service definition is not a Closure or invokable object.'); - } - - $factory = $this->values[$id]; - - $extended = function ($c) use ($callable, $factory) { - return $callable($factory($c), $c); - }; - - if (isset($this->factories[$factory])) { - $this->factories->detach($factory); - $this->factories->attach($extended); - } - - return $this[$id] = $extended; - } - - /** - * Returns all defined value names. - * - * @return array An array of value names - */ - public function keys() - { - return array_keys($this->values); - } - - /** - * Registers a service provider. - * - * @param ServiceProviderInterface $provider A ServiceProviderInterface instance - * @param array $values An array of values that customizes the provider - * - * @return static - */ - public function register(ServiceProviderInterface $provider, array $values = array()) - { - $provider->register($this); - - foreach ($values as $key => $value) { - $this[$key] = $value; - } - - return $this; - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php b/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php deleted file mode 100644 index 7228421..0000000 --- a/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -class ExpectedInvokableException extends \InvalidArgumentException implements ContainerExceptionInterface -{ -} diff --git a/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php b/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php deleted file mode 100644 index 64b0265..0000000 --- a/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -class FrozenServiceException extends \RuntimeException implements ContainerExceptionInterface -{ - /** - * @param string $id Identifier of the frozen service - */ - public function __construct($id) - { - parent::__construct(sprintf('Cannot override frozen service "%s".', $id)); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Psr11/Container.php b/vendor/pimple/pimple/src/Pimple/Psr11/Container.php deleted file mode 100644 index cadbfff..0000000 --- a/vendor/pimple/pimple/src/Pimple/Psr11/Container.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -final class Container implements ContainerInterface -{ - private $pimple; - - public function __construct(PimpleContainer $pimple) - { - $this->pimple = $pimple; - } - - public function get($id) - { - return $this->pimple[$id]; - } - - public function has($id) - { - return isset($this->pimple[$id]); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php b/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php deleted file mode 100644 index 61e4984..0000000 --- a/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +++ /dev/null @@ -1,75 +0,0 @@ - - */ -class ServiceLocator implements ContainerInterface -{ - private $container; - private $aliases = array(); - - /** - * @param PimpleContainer $container The Container instance used to locate services - * @param array $ids Array of service ids that can be located. String keys can be used to define aliases - */ - public function __construct(PimpleContainer $container, array $ids) - { - $this->container = $container; - - foreach ($ids as $key => $id) { - $this->aliases[is_int($key) ? $id : $key] = $id; - } - } - - /** - * {@inheritdoc} - */ - public function get($id) - { - if (!isset($this->aliases[$id])) { - throw new UnknownIdentifierException($id); - } - - return $this->container[$this->aliases[$id]]; - } - - /** - * {@inheritdoc} - */ - public function has($id) - { - return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/ServiceIterator.php b/vendor/pimple/pimple/src/Pimple/ServiceIterator.php deleted file mode 100644 index 744271d..0000000 --- a/vendor/pimple/pimple/src/Pimple/ServiceIterator.php +++ /dev/null @@ -1,69 +0,0 @@ - - */ -final class ServiceIterator implements \Iterator -{ - private $container; - private $ids; - - public function __construct(Container $container, array $ids) - { - $this->container = $container; - $this->ids = $ids; - } - - public function rewind() - { - reset($this->ids); - } - - public function current() - { - return $this->container[current($this->ids)]; - } - - public function key() - { - return current($this->ids); - } - - public function next() - { - next($this->ids); - } - - public function valid() - { - return null !== key($this->ids); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php b/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php deleted file mode 100644 index c004594..0000000 --- a/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -value = $value; - - return $service; - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php b/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php deleted file mode 100644 index 33cd4e5..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +++ /dev/null @@ -1,34 +0,0 @@ -factory(function () { - return new Service(); - }); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php b/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php deleted file mode 100644 index d71b184..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ -class Service -{ - public $value; -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php b/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php deleted file mode 100644 index 8e5c4c7..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - */ -class PimpleServiceProviderInterfaceTest extends \PHPUnit_Framework_TestCase -{ - public function testProvider() - { - $pimple = new Container(); - - $pimpleServiceProvider = new Fixtures\PimpleServiceProvider(); - $pimpleServiceProvider->register($pimple); - - $this->assertEquals('value', $pimple['param']); - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']); - - $serviceOne = $pimple['factory']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - - $serviceTwo = $pimple['factory']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - - $this->assertNotSame($serviceOne, $serviceTwo); - } - - public function testProviderWithRegisterMethod() - { - $pimple = new Container(); - - $pimple->register(new Fixtures\PimpleServiceProvider(), array( - 'anotherParameter' => 'anotherValue', - )); - - $this->assertEquals('value', $pimple['param']); - $this->assertEquals('anotherValue', $pimple['anotherParameter']); - - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']); - - $serviceOne = $pimple['factory']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - - $serviceTwo = $pimple['factory']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - - $this->assertNotSame($serviceOne, $serviceTwo); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php b/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php deleted file mode 100644 index acb66e0..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +++ /dev/null @@ -1,589 +0,0 @@ - - */ -class PimpleTest extends \PHPUnit_Framework_TestCase -{ - public function testWithString() - { - $pimple = new Container(); - $pimple['param'] = 'value'; - - $this->assertEquals('value', $pimple['param']); - } - - public function testWithClosure() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']); - } - - public function testServicesShouldBeDifferent() - { - $pimple = new Container(); - $pimple['service'] = $pimple->factory(function () { - return new Fixtures\Service(); - }); - - $serviceOne = $pimple['service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - - $serviceTwo = $pimple['service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - - $this->assertNotSame($serviceOne, $serviceTwo); - } - - public function testShouldPassContainerAsParameter() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $pimple['container'] = function ($container) { - return $container; - }; - - $this->assertNotSame($pimple, $pimple['service']); - $this->assertSame($pimple, $pimple['container']); - } - - public function testIsset() - { - $pimple = new Container(); - $pimple['param'] = 'value'; - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - - $pimple['null'] = null; - - $this->assertTrue(isset($pimple['param'])); - $this->assertTrue(isset($pimple['service'])); - $this->assertTrue(isset($pimple['null'])); - $this->assertFalse(isset($pimple['non_existent'])); - } - - public function testConstructorInjection() - { - $params = array('param' => 'value'); - $pimple = new Container($params); - - $this->assertSame($params['param'], $pimple['param']); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testOffsetGetValidatesKeyIsPresent() - { - $pimple = new Container(); - echo $pimple['foo']; - } - - /** - * @group legacy - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testLegacyOffsetGetValidatesKeyIsPresent() - { - $pimple = new Container(); - echo $pimple['foo']; - } - - public function testOffsetGetHonorsNullValues() - { - $pimple = new Container(); - $pimple['foo'] = null; - $this->assertNull($pimple['foo']); - } - - public function testUnset() - { - $pimple = new Container(); - $pimple['param'] = 'value'; - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - - unset($pimple['param'], $pimple['service']); - $this->assertFalse(isset($pimple['param'])); - $this->assertFalse(isset($pimple['service'])); - } - - /** - * @dataProvider serviceDefinitionProvider - */ - public function testShare($service) - { - $pimple = new Container(); - $pimple['shared_service'] = $service; - - $serviceOne = $pimple['shared_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - - $serviceTwo = $pimple['shared_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - - $this->assertSame($serviceOne, $serviceTwo); - } - - /** - * @dataProvider serviceDefinitionProvider - */ - public function testProtect($service) - { - $pimple = new Container(); - $pimple['protected'] = $pimple->protect($service); - - $this->assertSame($service, $pimple['protected']); - } - - public function testGlobalFunctionNameAsParameterValue() - { - $pimple = new Container(); - $pimple['global_function'] = 'strlen'; - $this->assertSame('strlen', $pimple['global_function']); - } - - public function testRaw() - { - $pimple = new Container(); - $pimple['service'] = $definition = $pimple->factory(function () { return 'foo'; }); - $this->assertSame($definition, $pimple->raw('service')); - } - - public function testRawHonorsNullValues() - { - $pimple = new Container(); - $pimple['foo'] = null; - $this->assertNull($pimple->raw('foo')); - } - - public function testFluentRegister() - { - $pimple = new Container(); - $this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock())); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testRawValidatesKeyIsPresent() - { - $pimple = new Container(); - $pimple->raw('foo'); - } - - /** - * @group legacy - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testLegacyRawValidatesKeyIsPresent() - { - $pimple = new Container(); - $pimple->raw('foo'); - } - - /** - * @dataProvider serviceDefinitionProvider - */ - public function testExtend($service) - { - $pimple = new Container(); - $pimple['shared_service'] = function () { - return new Fixtures\Service(); - }; - $pimple['factory_service'] = $pimple->factory(function () { - return new Fixtures\Service(); - }); - - $pimple->extend('shared_service', $service); - $serviceOne = $pimple['shared_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - $serviceTwo = $pimple['shared_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - $this->assertSame($serviceOne, $serviceTwo); - $this->assertSame($serviceOne->value, $serviceTwo->value); - - $pimple->extend('factory_service', $service); - $serviceOne = $pimple['factory_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); - $serviceTwo = $pimple['factory_service']; - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); - $this->assertNotSame($serviceOne, $serviceTwo); - $this->assertNotSame($serviceOne->value, $serviceTwo->value); - } - - public function testExtendDoesNotLeakWithFactories() - { - if (extension_loaded('pimple')) { - $this->markTestSkipped('Pimple extension does not support this test'); - } - $pimple = new Container(); - - $pimple['foo'] = $pimple->factory(function () { return; }); - $pimple['foo'] = $pimple->extend('foo', function ($foo, $pimple) { return; }); - unset($pimple['foo']); - - $p = new \ReflectionProperty($pimple, 'values'); - $p->setAccessible(true); - $this->assertEmpty($p->getValue($pimple)); - - $p = new \ReflectionProperty($pimple, 'factories'); - $p->setAccessible(true); - $this->assertCount(0, $p->getValue($pimple)); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testExtendValidatesKeyIsPresent() - { - $pimple = new Container(); - $pimple->extend('foo', function () {}); - } - - /** - * @group legacy - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testLegacyExtendValidatesKeyIsPresent() - { - $pimple = new Container(); - $pimple->extend('foo', function () {}); - } - - public function testKeys() - { - $pimple = new Container(); - $pimple['foo'] = 123; - $pimple['bar'] = 123; - - $this->assertEquals(array('foo', 'bar'), $pimple->keys()); - } - - /** @test */ - public function settingAnInvokableObjectShouldTreatItAsFactory() - { - $pimple = new Container(); - $pimple['invokable'] = new Fixtures\Invokable(); - - $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['invokable']); - } - - /** @test */ - public function settingNonInvokableObjectShouldTreatItAsParameter() - { - $pimple = new Container(); - $pimple['non_invokable'] = new Fixtures\NonInvokable(); - - $this->assertInstanceOf('Pimple\Tests\Fixtures\NonInvokable', $pimple['non_invokable']); - } - - /** - * @dataProvider badServiceDefinitionProvider - * @expectedException \Pimple\Exception\ExpectedInvokableException - * @expectedExceptionMessage Service definition is not a Closure or invokable object. - */ - public function testFactoryFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple->factory($service); - } - - /** - * @group legacy - * @dataProvider badServiceDefinitionProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Service definition is not a Closure or invokable object. - */ - public function testLegacyFactoryFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple->factory($service); - } - - /** - * @dataProvider badServiceDefinitionProvider - * @expectedException \Pimple\Exception\ExpectedInvokableException - * @expectedExceptionMessage Callable is not a Closure or invokable object. - */ - public function testProtectFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple->protect($service); - } - - /** - * @group legacy - * @dataProvider badServiceDefinitionProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Callable is not a Closure or invokable object. - */ - public function testLegacyProtectFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple->protect($service); - } - - /** - * @dataProvider badServiceDefinitionProvider - * @expectedException \Pimple\Exception\InvalidServiceIdentifierException - * @expectedExceptionMessage Identifier "foo" does not contain an object definition. - */ - public function testExtendFailsForKeysNotContainingServiceDefinitions($service) - { - $pimple = new Container(); - $pimple['foo'] = $service; - $pimple->extend('foo', function () {}); - } - - /** - * @group legacy - * @dataProvider badServiceDefinitionProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Identifier "foo" does not contain an object definition. - */ - public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($service) - { - $pimple = new Container(); - $pimple['foo'] = $service; - $pimple->extend('foo', function () {}); - } - - /** - * @group legacy - * @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected? - */ - public function testExtendingProtectedClosureDeprecation() - { - $pimple = new Container(); - $pimple['foo'] = $pimple->protect(function () { - return 'bar'; - }); - - $pimple->extend('foo', function ($value) { - return $value.'-baz'; - }); - - $this->assertSame('bar-baz', $pimple['foo']); - } - - /** - * @dataProvider badServiceDefinitionProvider - * @expectedException \Pimple\Exception\ExpectedInvokableException - * @expectedExceptionMessage Extension service definition is not a Closure or invokable object. - */ - public function testExtendFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple['foo'] = function () {}; - $pimple->extend('foo', $service); - } - - /** - * @group legacy - * @dataProvider badServiceDefinitionProvider - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Extension service definition is not a Closure or invokable object. - */ - public function testLegacyExtendFailsForInvalidServiceDefinitions($service) - { - $pimple = new Container(); - $pimple['foo'] = function () {}; - $pimple->extend('foo', $service); - } - - /** - * @expectedException \Pimple\Exception\FrozenServiceException - * @expectedExceptionMessage Cannot override frozen service "foo". - */ - public function testExtendFailsIfFrozenServiceIsNonInvokable() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return new Fixtures\NonInvokable(); - }; - $foo = $pimple['foo']; - - $pimple->extend('foo', function () {}); - } - - /** - * @expectedException \Pimple\Exception\FrozenServiceException - * @expectedExceptionMessage Cannot override frozen service "foo". - */ - public function testExtendFailsIfFrozenServiceIsInvokable() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return new Fixtures\Invokable(); - }; - $foo = $pimple['foo']; - - $pimple->extend('foo', function () {}); - } - - /** - * Provider for invalid service definitions. - */ - public function badServiceDefinitionProvider() - { - return array( - array(123), - array(new Fixtures\NonInvokable()), - ); - } - - /** - * Provider for service definitions. - */ - public function serviceDefinitionProvider() - { - return array( - array(function ($value) { - $service = new Fixtures\Service(); - $service->value = $value; - - return $service; - }), - array(new Fixtures\Invokable()), - ); - } - - public function testDefiningNewServiceAfterFreeze() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $foo = $pimple['foo']; - - $pimple['bar'] = function () { - return 'bar'; - }; - $this->assertSame('bar', $pimple['bar']); - } - - /** - * @expectedException \Pimple\Exception\FrozenServiceException - * @expectedExceptionMessage Cannot override frozen service "foo". - */ - public function testOverridingServiceAfterFreeze() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $foo = $pimple['foo']; - - $pimple['foo'] = function () { - return 'bar'; - }; - } - - /** - * @group legacy - * @expectedException \RuntimeException - * @expectedExceptionMessage Cannot override frozen service "foo". - */ - public function testLegacyOverridingServiceAfterFreeze() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $foo = $pimple['foo']; - - $pimple['foo'] = function () { - return 'bar'; - }; - } - - public function testRemovingServiceAfterFreeze() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $foo = $pimple['foo']; - - unset($pimple['foo']); - $pimple['foo'] = function () { - return 'bar'; - }; - $this->assertSame('bar', $pimple['foo']); - } - - public function testExtendingService() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) { - return "$foo.bar"; - }); - $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) { - return "$foo.baz"; - }); - $this->assertSame('foo.bar.baz', $pimple['foo']); - } - - public function testExtendingServiceAfterOtherServiceFreeze() - { - $pimple = new Container(); - $pimple['foo'] = function () { - return 'foo'; - }; - $pimple['bar'] = function () { - return 'bar'; - }; - $foo = $pimple['foo']; - - $pimple['bar'] = $pimple->extend('bar', function ($bar, $app) { - return "$bar.baz"; - }); - $this->assertSame('bar.baz', $pimple['bar']); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php deleted file mode 100644 index 7ca2d7f..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +++ /dev/null @@ -1,77 +0,0 @@ -assertSame($pimple['service'], $psr->get('service')); - } - - /** - * @expectedException \Psr\Container\NotFoundExceptionInterface - * @expectedExceptionMessage Identifier "service" is not defined. - */ - public function testGetThrowsExceptionIfServiceIsNotFound() - { - $pimple = new Container(); - $psr = new PsrContainer($pimple); - - $psr->get('service'); - } - - public function testHasReturnsTrueIfServiceExists() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Service(); - }; - $psr = new PsrContainer($pimple); - - $this->assertTrue($psr->has('service')); - } - - public function testHasReturnsFalseIfServiceDoesNotExist() - { - $pimple = new Container(); - $psr = new PsrContainer($pimple); - - $this->assertFalse($psr->has('service')); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php deleted file mode 100644 index c9a0812..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +++ /dev/null @@ -1,134 +0,0 @@ - - */ -class ServiceLocatorTest extends TestCase -{ - public function testCanAccessServices() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('service')); - - $this->assertSame($pimple['service'], $locator->get('service')); - } - - public function testCanAccessAliasedServices() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('alias' => 'service')); - - $this->assertSame($pimple['service'], $locator->get('alias')); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "service" is not defined. - */ - public function testCannotAccessAliasedServiceUsingRealIdentifier() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('alias' => 'service')); - - $service = $locator->get('service'); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "foo" is not defined. - */ - public function testGetValidatesServiceCanBeLocated() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('alias' => 'service')); - - $service = $locator->get('foo'); - } - - /** - * @expectedException \Pimple\Exception\UnknownIdentifierException - * @expectedExceptionMessage Identifier "invalid" is not defined. - */ - public function testGetValidatesTargetServiceExists() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('alias' => 'invalid')); - - $service = $locator->get('alias'); - } - - public function testHasValidatesServiceCanBeLocated() - { - $pimple = new Container(); - $pimple['service1'] = function () { - return new Fixtures\Service(); - }; - $pimple['service2'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('service1')); - - $this->assertTrue($locator->has('service1')); - $this->assertFalse($locator->has('service2')); - } - - public function testHasChecksIfTargetServiceExists() - { - $pimple = new Container(); - $pimple['service'] = function () { - return new Fixtures\Service(); - }; - $locator = new ServiceLocator($pimple, array('foo' => 'service', 'bar' => 'invalid')); - - $this->assertTrue($locator->has('foo')); - $this->assertFalse($locator->has('bar')); - } -} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php b/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php deleted file mode 100644 index 5dd52f0..0000000 --- a/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +++ /dev/null @@ -1,52 +0,0 @@ -assertSame(array('service1' => $pimple['service1'], 'service2' => $pimple['service2']), iterator_to_array($iterator)); - } -} diff --git a/vendor/psr/container/.gitignore b/vendor/psr/container/.gitignore deleted file mode 100644 index b2395aa..0000000 --- a/vendor/psr/container/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -composer.lock -composer.phar -/vendor/ diff --git a/vendor/psr/container/LICENSE b/vendor/psr/container/LICENSE deleted file mode 100644 index 2877a48..0000000 --- a/vendor/psr/container/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2016 container-interop -Copyright (c) 2016 PHP Framework Interoperability Group - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/psr/container/README.md b/vendor/psr/container/README.md deleted file mode 100644 index 084f6df..0000000 --- a/vendor/psr/container/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# PSR Container - -This repository holds all interfaces/classes/traits related to [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md). - -Note that this is not a container implementation of its own. See the specification for more details. diff --git a/vendor/psr/container/composer.json b/vendor/psr/container/composer.json deleted file mode 100644 index b8ee012..0000000 --- a/vendor/psr/container/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "psr/container", - "type": "library", - "description": "Common Container Interface (PHP FIG PSR-11)", - "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], - "homepage": "https://github.com/php-fig/container", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/vendor/psr/container/src/ContainerExceptionInterface.php b/vendor/psr/container/src/ContainerExceptionInterface.php deleted file mode 100644 index d35c6b4..0000000 --- a/vendor/psr/container/src/ContainerExceptionInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff --git a/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/vendor/psr/log/Psr/Log/InvalidArgumentException.php deleted file mode 100644 index 67f852d..0000000 --- a/vendor/psr/log/Psr/Log/InvalidArgumentException.php +++ /dev/null @@ -1,7 +0,0 @@ -logger = $logger; - } -} diff --git a/vendor/psr/log/Psr/Log/LoggerInterface.php b/vendor/psr/log/Psr/Log/LoggerInterface.php deleted file mode 100644 index 5ea7243..0000000 --- a/vendor/psr/log/Psr/Log/LoggerInterface.php +++ /dev/null @@ -1,123 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - abstract public function log($level, $message, array $context = array()); -} diff --git a/vendor/psr/log/Psr/Log/NullLogger.php b/vendor/psr/log/Psr/Log/NullLogger.php deleted file mode 100644 index d8cd682..0000000 --- a/vendor/psr/log/Psr/Log/NullLogger.php +++ /dev/null @@ -1,28 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - public function log($level, $message, array $context = array()) - { - // noop - } -} diff --git a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php deleted file mode 100644 index a0391a5..0000000 --- a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ /dev/null @@ -1,140 +0,0 @@ - ". - * - * Example ->error('Foo') would yield "error Foo". - * - * @return string[] - */ - abstract public function getLogs(); - - public function testImplements() - { - $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); - } - - /** - * @dataProvider provideLevelsAndMessages - */ - public function testLogsAtAllLevels($level, $message) - { - $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); - - $expected = array( - $level.' message of level '.$level.' with context: Bob', - $level.' message of level '.$level.' with context: Bob', - ); - $this->assertEquals($expected, $this->getLogs()); - } - - public function provideLevelsAndMessages() - { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); - } - - /** - * @expectedException \Psr\Log\InvalidArgumentException - */ - public function testThrowsOnInvalidLevel() - { - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } - - public function testContextReplacement() - { - $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); - - $expected = array('info {Message {nothing} Bob Bar a}'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testObjectCastToString() - { - if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); - } else { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); - } - $dummy->expects($this->once()) - ->method('__toString') - ->will($this->returnValue('DUMMY')); - - $this->getLogger()->warning($dummy); - - $expected = array('warning DUMMY'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextCanContainAnything() - { - $context = array( - 'bool' => true, - 'null' => null, - 'string' => 'Foo', - 'int' => 0, - 'float' => 0.5, - 'nested' => array('with object' => new DummyTest), - 'object' => new \DateTime, - 'resource' => fopen('php://memory', 'r'), - ); - - $this->getLogger()->warning('Crazy context data', $context); - - $expected = array('warning Crazy context data'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextExceptionKeyCanBeExceptionOrOtherValues() - { - $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); - - $expected = array( - 'warning Random message', - 'critical Uncaught Exception!' - ); - $this->assertEquals($expected, $this->getLogs()); - } -} - -class DummyTest -{ - public function __toString() - { - } -} diff --git a/vendor/psr/log/README.md b/vendor/psr/log/README.md deleted file mode 100644 index 574bc1c..0000000 --- a/vendor/psr/log/README.md +++ /dev/null @@ -1,45 +0,0 @@ -PSR Log -======= - -This repository holds all interfaces/classes/traits related to -[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). - -Note that this is not a logger of its own. It is merely an interface that -describes a logger. See the specification for more details. - -Usage ------ - -If you need a logger, you can use the interface like this: - -```php -logger = $logger; - } - - public function doSomething() - { - if ($this->logger) { - $this->logger->info('Doing work'); - } - - // do something useful - } -} -``` - -You can then pick one of the implementations of the interface to get a logger. - -If you want to implement the interface, you can require this package and -implement `Psr\Log\LoggerInterface` in your code. Please read the -[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) -for details. diff --git a/vendor/psr/log/composer.json b/vendor/psr/log/composer.json deleted file mode 100644 index 87934d7..0000000 --- a/vendor/psr/log/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "psr/log", - "description": "Common interface for logging libraries", - "keywords": ["psr", "psr-3", "log"], - "homepage": "https://github.com/php-fig/log", - "license": "MIT", - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "require": { - "php": ">=5.3.0" - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/vendor/silex/silex/.gitignore b/vendor/silex/silex/.gitignore deleted file mode 100644 index 3d4ff05..0000000 --- a/vendor/silex/silex/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/phpunit.xml -/vendor -/build -/composer.lock - diff --git a/vendor/silex/silex/.travis.yml b/vendor/silex/silex/.travis.yml deleted file mode 100644 index a2b7fe8..0000000 --- a/vendor/silex/silex/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: php - -sudo: false - -env: - global: - - SYMFONY_DEPRECATIONS_HELPER=weak - -cache: - directories: - - $HOME/.composer/cache/files - - .phpunit - -before_install: - - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi - -before_script: - # Twig 1.x - - if [[ $TWIG_VERSION != 2.0 ]]; then sed -i 's/~1.8|~2.0/~1.8/g' composer.json; fi - - # Symfony 2.8 - - if [[ $SYMFONY_DEPS_VERSION = 2.8 ]]; then sed -i 's/~2\.8|^3\.0/2.8.*@dev/g' composer.json; fi - # Symfony 3.0 - - if [[ $SYMFONY_DEPS_VERSION = 3.0 ]]; then sed -i 's/~2\.8|^3\.0/3.0.*@dev/g' composer.json; fi - # Symfony 3.1 - - if [[ $SYMFONY_DEPS_VERSION = 3.1 ]]; then sed -i 's/~2\.8|^3\.0/3.1.*@dev/g' composer.json; fi - # Symfony 3.2 - - if [[ $SYMFONY_DEPS_VERSION = 3.2 ]]; then sed -i 's/~2\.8|^3\.0/3.2.*@dev/g' composer.json; fi - # Symfony 3.3 - - | - if [[ $SYMFONY_DEPS_VERSION = 3.3 ]]; then - sed -i 's/~2\.8|^3\.0/3.3.*@dev/g' composer.json; - composer require --dev --no-update symfony/web-link:3.3.* - fi - - - composer update --no-suggest - -script: ./vendor/bin/simple-phpunit - -matrix: - include: - - php: 5.5 - - php: 5.6 - env: TWIG_VERSION=2.0 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=2.8 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.0 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.1 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.2 - - php: 5.6 - env: SYMFONY_DEPS_VERSION=3.3 - - php: 5.6 - - php: 7.0 - - php: 7.1 - - php: hhvm - dist: trusty diff --git a/vendor/silex/silex/LICENSE b/vendor/silex/silex/LICENSE deleted file mode 100644 index b420d71..0000000 --- a/vendor/silex/silex/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/silex/silex/README.rst b/vendor/silex/silex/README.rst deleted file mode 100644 index b79e47b..0000000 --- a/vendor/silex/silex/README.rst +++ /dev/null @@ -1,64 +0,0 @@ -Silex, a simple Web Framework -============================= - -Silex is a PHP micro-framework to develop websites based on `Symfony -components`_: - -.. code-block:: php - - get('/hello/{name}', function ($name) use ($app) { - return 'Hello '.$app->escape($name); - }); - - $app->run(); - -Silex works with PHP 5.5.9 or later. - -Installation ------------- - -The recommended way to install Silex is through `Composer`_: - -.. code-block:: bash - - composer require silex/silex "~2.0" - -Alternatively, you can download the `silex.zip`_ file and extract it. - -More Information ----------------- - -Read the `documentation`_ for more information and `changelog -`_ for upgrading information. - -Tests ------ - -To run the test suite, you need `Composer`_ and `PHPUnit`_: - -.. code-block:: bash - - composer install - phpunit - -Community ---------- - -Check out #silex-php on irc.freenode.net. - -License -------- - -Silex is licensed under the MIT license. - -.. _Symfony components: http://symfony.com -.. _Composer: http://getcomposer.org -.. _PHPUnit: https://phpunit.de -.. _silex.zip: http://silex.sensiolabs.org/download -.. _documentation: http://silex.sensiolabs.org/documentation diff --git a/vendor/silex/silex/composer.json b/vendor/silex/silex/composer.json deleted file mode 100644 index 935c518..0000000 --- a/vendor/silex/silex/composer.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "silex/silex", - "description": "The PHP micro-framework based on the Symfony Components", - "keywords": ["microframework"], - "homepage": "http://silex.sensiolabs.org", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "require": { - "php": ">=5.5.9", - "pimple/pimple": "~3.0", - "symfony/event-dispatcher": "~2.8|^3.0", - "symfony/http-foundation": "~2.8|^3.0", - "symfony/http-kernel": "~2.8|^3.0", - "symfony/routing": "~2.8|^3.0" - }, - "require-dev": { - "symfony/asset": "~2.8|^3.0", - "symfony/expression-language": "~2.8|^3.0", - "symfony/security": "~2.8|^3.0", - "symfony/config": "~2.8|^3.0", - "symfony/form": "~2.8|^3.0", - "symfony/browser-kit": "~2.8|^3.0", - "symfony/css-selector": "~2.8|^3.0", - "symfony/debug": "~2.8|^3.0", - "symfony/dom-crawler": "~2.8|^3.0", - "symfony/finder": "~2.8|^3.0", - "symfony/intl": "~2.8|^3.0", - "symfony/monolog-bridge": "~2.8|^3.0", - "symfony/doctrine-bridge": "~2.8|^3.0", - "symfony/options-resolver": "~2.8|^3.0", - "symfony/phpunit-bridge": "^3.2", - "symfony/process": "~2.8|^3.0", - "symfony/serializer": "~2.8|^3.0", - "symfony/translation": "~2.8|^3.0", - "symfony/twig-bridge": "~2.8|^3.0", - "symfony/validator": "~2.8|^3.0", - "symfony/var-dumper": "~2.8|^3.0", - "twig/twig": "~1.28|~2.0", - "doctrine/dbal": "~2.2", - "swiftmailer/swiftmailer": "~5", - "monolog/monolog": "^1.4.1", - "symfony/web-link": "^3.3" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35 || >= 5.0, <5.4.3" - }, - "replace": { - "silex/api": "self.version", - "silex/providers": "self.version" - }, - "autoload": { - "psr-4": { "Silex\\": "src/Silex" } - }, - "autoload-dev" : { - "psr-4": { "Silex\\Tests\\" : "tests/Silex/Tests" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "minimum-stability": "dev" -} diff --git a/vendor/silex/silex/doc/changelog.rst b/vendor/silex/silex/doc/changelog.rst deleted file mode 100644 index a291756..0000000 --- a/vendor/silex/silex/doc/changelog.rst +++ /dev/null @@ -1,387 +0,0 @@ -Changelog -========= - -2.2.0 (2017-07-23) ------------------- - -* added json manifest version strategy support -* fixed EsiFragment constructor -* fixed RedirectableUrlMatcher compatibility with Symfony -* fixed compatibility with Pimple 3.2 -* fixed WebTestCase compatibility with PHPUnit 6+ - -2.1.0 (2017-05-03) ------------------- - -* added more options to security.firewalls -* added WebLink component integration -* added parameters to configure the Twig core extension behavior -* fixed deprecation notices with symfony/twig-bridge 3.2+ in TwigServiceProvider -* added FormRegistry as a service to enable the extension point -* removed the build scripts -* fixed some deprecation warnings -* added support for registering Swiftmailer plugins - -2.0.4 (2016-11-06) ------------------- - -* fixed twig.app_variable definition -* added support for latest versions of Twig 1.x and 2.0 (Twig runtime loaders) -* added support for Symfony 2.3 - -2.0.3 (2016-08-22) ------------------- - -* fixed lazy evaluation of 'monolog.use_error_handler' -* fixed PHP7 type hint on controllers - -2.0.2 (2016-06-14) ------------------- - -* fixed Symfony 3.1 deprecations - -2.0.1 (2016-05-27) ------------------- - -* fixed the silex form extension registration to allow overriding default ones -* removed support for the obsolete Locale Symfony component (uses the Intl one now) -* added support for Symfony 3.1 - -2.0.0 (2016-05-18) ------------------- - -* decoupled the exception handler from HttpKernelServiceProvider -* Switched to BCrypt as the default encoder in the security provider -* added full support for RequestMatcher -* added support for Symfony Guard -* added support for callables in CallbackResolver -* added FormTrait::namedForm() -* added support for delivery_addresses, delivery_whitelist, and sender_address -* added support to register form types / form types extensions / form types guessers as services -* added support for callable in mounts (allow nested route collection to be built easily) -* added support for conditions on routes -* added support for the Symfony VarDumper Component -* added a global Twig variable (an AppVariable instance) -* [BC BREAK] CSRF has been moved to a standalone provider (``form.secret`` is not available anymore) -* added support for the Symfony HttpFoundation Twig bridge extension -* added support for the Symfony Asset Component -* bumped minimum version of Symfony to 2.8 -* bumped minimum version of PHP to 5.5.0 -* Updated Pimple to 3.0 -* Updated session listeners to extends HttpKernel ones -* [BC BREAK] Locale management has been moved to LocaleServiceProvider which must be registered - if you want Silex to manage your locale (must also be registered for the translation service provider) -* [BC BREAK] Provider interfaces moved to Silex\Api namespace, published as - separate package via subtree split -* [BC BREAK] ServiceProviderInterface split in to EventListenerProviderInterface - and BootableProviderInterface -* [BC BREAK] Service Provider support files moved under Silex\Provider - namespace, allowing publishing as separate package via sub-tree split -* ``monolog.exception.logger_filter`` option added to Monolog service provider -* [BC BREAK] ``$app['request']`` service removed, use ``$app['request_stack']`` instead - -1.3.6 (2016-XX-XX) ------------------- - -* n/a - -1.3.5 (2016-01-06) ------------------- - -* fixed typo in SecurityServiceProvider - -1.3.4 (2015-09-15) ------------------- - -* fixed some new deprecations -* fixed translation registration for the validators - -1.3.3 (2015-09-08) ------------------- - -* added support for Symfony 3.0 and Twig 2.0 -* fixed some Form deprecations -* removed deprecated method call in the exception handler -* fixed Swiftmailer spool flushing when spool is not enabled - -1.3.2 (2015-08-24) ------------------- - -* no changes - -1.3.1 (2015-08-04) ------------------- - -* added missing support for the Expression constraint -* fixed the possibility to override translations for validator error messages -* fixed sub-mounts with same name clash -* fixed session logout handler when a firewall is stateless - -1.3.0 (2015-06-05) ------------------- - -* added a `$app['user']` to get the current user (security provider) -* added view handlers -* added support for the OPTIONS HTTP method -* added caching for the Translator provider -* deprecated `$app['exception_handler']->disable()` in favor of `unset($app['exception_handler'])` -* made Silex compatible with Symfony 2.7 an 2.8 (and keep compatibility with Symfony 2.3, 2.5, and 2.6) -* removed deprecated TwigCoreExtension class (register the new HttpFragmentServiceProvider instead) -* bumped minimum version of PHP to 5.3.9 - -1.2.5 (2015-06-04) ------------------- - -* no code changes (last version of the 1.2 branch) - -1.2.4 (2015-04-11) ------------------- - -* fixed the exception message when mounting a collection that doesn't return a ControllerCollection -* fixed Symfony dependencies (Silex 1.2 is not compatible with Symfony 2.7) - -1.2.3 (2015-01-20) ------------------- - -* fixed remember me listener -* fixed translation files loading when they do not exist -* allowed global after middlewares to return responses like route specific ones - -1.2.2 (2014-09-26) ------------------- - -* fixed Translator locale management -* added support for the $app argument in application middlewares (to make it consistent with route middlewares) -* added form.types to the Form provider - -1.2.1 (2014-07-01) ------------------- - -* added support permissions in the Monolog provider -* fixed Switfmailer spool where the event dispatcher is different from the other ones -* fixed locale when changing it on the translator itself - -1.2.0 (2014-03-29) ------------------- - -* Allowed disabling the boot logic of MonologServiceProvider -* Reverted "convert attributes on the request that actually exist" -* [BC BREAK] Routes are now always added in the order of their registration (even for mounted routes) -* Added run() on Route to be able to define the controller code -* Deprecated TwigCoreExtension (register the new HttpFragmentServiceProvider instead) -* Added HttpFragmentServiceProvider -* Allowed a callback to be a method call on a service (before, after, finish, error, on Application; convert, before, after on Controller) - -1.1.3 (2013-XX-XX) ------------------- - -* Fixed translator locale management - -1.1.2 (2013-10-30) ------------------- - -* Added missing "security.hide_user_not_found" support in SecurityServiceProvider -* Fixed event listeners that are registered after the boot via the on() method - -1.0.2 (2013-10-30) ------------------- - -* Fixed SecurityServiceProvider to use null as a fake controller so that routes can be dumped - -1.1.1 (2013-10-11) ------------------- - -* Removed or replaced deprecated Symfony code -* Updated code to take advantages of 2.3 new features -* Only convert attributes on the request that actually exist. - -1.1.0 (2013-07-04) ------------------- - -* Support for any ``Psr\Log\LoggerInterface`` as opposed to the monolog-bridge - one. -* Made dispatcher proxy methods ``on``, ``before``, ``after`` and ``error`` - lazy, so that they will not instantiate the dispatcher early. -* Dropped support for 2.1 and 2.2 versions of Symfony. - -1.0.1 (2013-07-04) ------------------- - -* Fixed RedirectableUrlMatcher::redirect() when Silex is configured to use a logger -* Make ``DoctrineServiceProvider`` multi-db support lazy. - -1.0.0 (2013-05-03) ------------------- - -* **2013-04-12**: Added support for validators as services. - -* **2013-04-01**: Added support for host matching with symfony 2.2:: - - $app->match('/', function() { - // app-specific action - })->host('example.com'); - - $app->match('/', function ($user) { - // user-specific action - })->host('{user}.example.com'); - -* **2013-03-08**: Added support for form type extensions and guessers as - services. - -* **2013-03-08**: Added support for remember-me via the - ``RememberMeServiceProvider``. - -* **2013-02-07**: Added ``Application::sendFile()`` to ease sending - ``BinaryFileResponse``. - -* **2012-11-05**: Filters have been renamed to application middlewares in the - documentation. - -* **2012-11-05**: The ``before()``, ``after()``, ``error()``, and ``finish()`` - listener priorities now set the priority of the underlying Symfony event - instead of a custom one before. - -* **2012-11-05**: Removing the default exception handler should now be done - via its ``disable()`` method: - - Before: - - unset($app['exception_handler']); - - After: - - $app['exception_handler']->disable(); - -* **2012-07-15**: removed the ``monolog.configure`` service. Use the - ``extend`` method instead: - - Before:: - - $app['monolog.configure'] = $app->protect(function ($monolog) use ($app) { - // do something - }); - - After:: - - $app['monolog'] = $app->share($app->extend('monolog', function($monolog, $app) { - // do something - - return $monolog; - })); - - -* **2012-06-17**: ``ControllerCollection`` now takes a required route instance - as a constructor argument. - - Before:: - - $controllers = new ControllerCollection(); - - After:: - - $controllers = new ControllerCollection(new Route()); - - // or even better - $controllers = $app['controllers_factory']; - -* **2012-06-17**: added application traits for PHP 5.4 - -* **2012-06-16**: renamed ``request.default_locale`` to ``locale`` - -* **2012-06-16**: Removed the ``translator.loader`` service. See documentation - for how to use XLIFF or YAML-based translation files. - -* **2012-06-15**: removed the ``twig.configure`` service. Use the ``extend`` - method instead: - - Before:: - - $app['twig.configure'] = $app->protect(function ($twig) use ($app) { - // do something - }); - - After:: - - $app['twig'] = $app->share($app->extend('twig', function($twig, $app) { - // do something - - return $twig; - })); - -* **2012-06-13**: Added a route ``before`` middleware - -* **2012-06-13**: Renamed the route ``middleware`` to ``before`` - -* **2012-06-13**: Added an extension for the Symfony Security component - -* **2012-05-31**: Made the ``BrowserKit``, ``CssSelector``, ``DomCrawler``, - ``Finder`` and ``Process`` components optional dependencies. Projects that - depend on them (e.g. through functional tests) should add those dependencies - to their ``composer.json``. - -* **2012-05-26**: added ``boot()`` to ``ServiceProviderInterface``. - -* **2012-05-26**: Removed ``SymfonyBridgesServiceProvider``. It is now implicit - by checking the existence of the bridge. - -* **2012-05-26**: Removed the ``translator.messages`` parameter (use - ``translator.domains`` instead). - -* **2012-05-24**: Removed the ``autoloader`` service (use composer instead). - The ``*.class_path`` settings on all the built-in providers have also been - removed in favor of Composer. - -* **2012-05-21**: Changed error() to allow handling specific exceptions. - -* **2012-05-20**: Added a way to define settings on a controller collection. - -* **2012-05-20**: The Request instance is not available anymore from the - Application after it has been handled. - -* **2012-04-01**: Added ``finish`` filters. - -* **2012-03-20**: Added ``json`` helper:: - - $data = array('some' => 'data'); - $response = $app->json($data); - -* **2012-03-11**: Added route middlewares. - -* **2012-03-02**: Switched to use Composer for dependency management. - -* **2012-02-27**: Updated to Symfony 2.1 session handling. - -* **2012-01-02**: Introduced support for streaming responses. - -* **2011-09-22**: ``ExtensionInterface`` has been renamed to - ``ServiceProviderInterface``. All built-in extensions have been renamed - accordingly (for instance, ``Silex\Extension\TwigExtension`` has been - renamed to ``Silex\Provider\TwigServiceProvider``). - -* **2011-09-22**: The way reusable applications work has changed. The - ``mount()`` method now takes an instance of ``ControllerCollection`` instead - of an ``Application`` one. - - Before:: - - $app = new Application(); - $app->get('/bar', function() { return 'foo'; }); - - return $app; - - After:: - - $app = new ControllerCollection(); - $app->get('/bar', function() { return 'foo'; }); - - return $app; - -* **2011-08-08**: The controller method configuration is now done on the Controller itself - - Before:: - - $app->match('/', function () { echo 'foo'; }, 'GET|POST'); - - After:: - - $app->match('/', function () { echo 'foo'; })->method('GET|POST'); diff --git a/vendor/silex/silex/doc/conf.py b/vendor/silex/silex/doc/conf.py deleted file mode 100644 index dfe355c..0000000 --- a/vendor/silex/silex/doc/conf.py +++ /dev/null @@ -1,17 +0,0 @@ -import sys, os -from sphinx.highlighting import lexers -from pygments.lexers.web import PhpLexer - -sys.path.append(os.path.abspath('_exts')) - -extensions = [] -master_doc = 'index' -highlight_language = 'php' - -project = u'Silex' -copyright = u'2010 Fabien Potencier' - -version = '0' -release = '0.0.0' - -lexers['php'] = PhpLexer(startinline=True) diff --git a/vendor/silex/silex/doc/contributing.rst b/vendor/silex/silex/doc/contributing.rst deleted file mode 100644 index 34a339d..0000000 --- a/vendor/silex/silex/doc/contributing.rst +++ /dev/null @@ -1,34 +0,0 @@ -Contributing -============ - -We are open to contributions to the Silex code. If you find a bug or want to -contribute a provider, just follow these steps: - -* Fork `the Silex repository `_; - -* Make your feature addition or bug fix; - -* Add tests for it; - -* Optionally, add some documentation; - -* `Send a pull request - `_, to the correct - target branch (1.3 for bug fixes, master for new features). - -.. note:: - - Any code you contribute must be licensed under the MIT - License. - -Writing Documentation -===================== - -The documentation is written in `reStructuredText -`_ and can be generated using `sphinx -`_. - -.. code-block:: bash - - $ cd doc - $ sphinx-build -b html . build diff --git a/vendor/silex/silex/doc/cookbook/error_handler.rst b/vendor/silex/silex/doc/cookbook/error_handler.rst deleted file mode 100644 index 235c263..0000000 --- a/vendor/silex/silex/doc/cookbook/error_handler.rst +++ /dev/null @@ -1,38 +0,0 @@ -Converting Errors to Exceptions -=============================== - -Silex catches exceptions that are thrown from within a request/response cycle. -However, it does *not* catch PHP errors and notices. This recipe tells you how -to catch them by converting them to exceptions. - -Registering the ErrorHandler ----------------------------- - -The ``Symfony/Debug`` package has an ``ErrorHandler`` class that solves this -problem. It converts all errors to exceptions, and exceptions are then caught -by Silex. - -Register it by calling the static ``register`` method:: - - use Symfony\Component\Debug\ErrorHandler; - - ErrorHandler::register(); - -It is recommended that you do this as early as possible. - -Handling fatal errors ---------------------- - -To handle fatal errors, you can additionally register a global -``ExceptionHandler``:: - - use Symfony\Component\Debug\ExceptionHandler; - - ExceptionHandler::register(); - -In production you may want to disable the debug output by passing ``false`` as -the ``$debug`` argument:: - - use Symfony\Component\Debug\ExceptionHandler; - - ExceptionHandler::register(false); diff --git a/vendor/silex/silex/doc/cookbook/form_no_csrf.rst b/vendor/silex/silex/doc/cookbook/form_no_csrf.rst deleted file mode 100644 index e9bf595..0000000 --- a/vendor/silex/silex/doc/cookbook/form_no_csrf.rst +++ /dev/null @@ -1,36 +0,0 @@ -Disabling CSRF Protection on a Form using the FormExtension -=========================================================== - -The *FormExtension* provides a service for building form in your application -with the Symfony Form component. When the :doc:`CSRF Service Provider -` is registered, the *FormExtension* uses the CSRF Protection -avoiding Cross-site request forgery, a method by which a malicious user -attempts to make your legitimate users unknowingly submit data that they don't -intend to submit. - -You can find more details about CSRF Protection and CSRF token in the -`Symfony Book -`_. - -In some cases (for example, when embedding a form in an html email) you might -want not to use this protection. The easiest way to avoid this is to -understand that it is possible to give specific options to your form builder -through the ``createBuilder()`` function. - -Example -------- - -.. code-block:: php - - $form = $app['form.factory']->createBuilder('form', null, array('csrf_protection' => false)); - -That's it, your form could be submitted from everywhere without CSRF Protection. - -Going further -------------- - -This specific example showed how to change the ``csrf_protection`` in the -``$options`` parameter of the ``createBuilder()`` function. More of them could -be passed through this parameter, it is as simple as using the Symfony -``getDefaultOptions()`` method in your form classes. `See more here -`_. diff --git a/vendor/silex/silex/doc/cookbook/guard_authentication.rst b/vendor/silex/silex/doc/cookbook/guard_authentication.rst deleted file mode 100644 index 8774f68..0000000 --- a/vendor/silex/silex/doc/cookbook/guard_authentication.rst +++ /dev/null @@ -1,183 +0,0 @@ -How to Create a Custom Authentication System with Guard -======================================================= - -Whether you need to build a traditional login form, an API token -authentication system or you need to integrate with some proprietary -single-sign-on system, the Guard component can make it easy... and fun! - -In this example, you'll build an API token authentication system and -learn how to work with Guard. - -Step 1) Create the Authenticator Class --------------------------------------- - -Suppose you have an API where your clients will send an X-AUTH-TOKEN -header on each request. This token is composed of the username followed -by a password, separated by a colon (e.g. ``X-AUTH-TOKEN: coolguy:awesomepassword``). -Your job is to read this, find the associated user (if any) and check -the password. - -To create a custom authentication system, just create a class and make -it implement GuardAuthenticatorInterface. Or, extend the simpler -AbstractGuardAuthenticator. This requires you to implement six methods: - -.. code-block:: php - - encoderFactory = $encoderFactory; - } - - public function getCredentials(Request $request) - { - // Checks if the credential header is provided - if (!$token = $request->headers->get('X-AUTH-TOKEN')) { - return; - } - - // Parse the header or ignore it if the format is incorrect. - if (false === strpos($token, ':')) { - return; - } - list($username, $secret) = explode(':', $token, 2); - - return array( - 'username' => $username, - 'secret' => $secret, - ); - } - - public function getUser($credentials, UserProviderInterface $userProvider) - { - return $userProvider->loadUserByUsername($credentials['username']); - } - - public function checkCredentials($credentials, UserInterface $user) - { - // check credentials - e.g. make sure the password is valid - // return true to cause authentication success - - $encoder = $this->encoderFactory->getEncoder($user); - - return $encoder->isPasswordValid( - $user->getPassword(), - $credentials['secret'], - $user->getSalt() - ); - } - - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) - { - // on success, let the request continue - return; - } - - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) - { - $data = array( - 'message' => strtr($exception->getMessageKey(), $exception->getMessageData()), - - // or to translate this message - // $this->translator->trans($exception->getMessageKey(), $exception->getMessageData()) - ); - - return new JsonResponse($data, 403); - } - - /** - * Called when authentication is needed, but it's not sent - */ - public function start(Request $request, AuthenticationException $authException = null) - { - $data = array( - // you might translate this message - 'message' => 'Authentication Required', - ); - - return new JsonResponse($data, 401); - } - - public function supportsRememberMe() - { - return false; - } - } - - -Step 2) Configure the Authenticator ------------------------------------ - -To finish this, register the class as a service: - -.. code-block:: php - - $app['app.token_authenticator'] = function ($app) { - return new App\Security\TokenAuthenticator($app['security.encoder_factory']); - }; - - -Finally, configure your `security.firewalls` key to use this authenticator: - -.. code-block:: php - - $app['security.firewalls'] = array( - 'main' => array( - 'guard' => array( - 'authenticators' => array( - 'app.token_authenticator' - ), - - // Using more than 1 authenticator, you must specify - // which one is used as entry point. - // 'entry_point' => 'app.token_authenticator', - ), - // configure where your users come from. Hardcode them, or load them from somewhere - // http://silex.sensiolabs.org/doc/providers/security.html#defining-a-custom-user-provider - 'users' => array( - //raw password = foo - 'victoria' => array('ROLE_USER', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'), - ), - // 'anonymous' => true - ), - ); - -.. note:: - You can use many authenticators, they are executed by the order - they are configured. - -You did it! You now have a fully-working API token authentication -system. If your homepage required ROLE_USER, then you could test it -under different conditions: - -.. code-block:: bash - - # test with no token - curl http://localhost:8000/ - # {"message":"Authentication Required"} - - # test with a bad token - curl -H "X-AUTH-TOKEN: alan" http://localhost:8000/ - # {"message":"Username could not be found."} - - # test with a working token - curl -H "X-AUTH-TOKEN: victoria:foo" http://localhost:8000/ - # the homepage controller is executed: the page loads normally - -For more details read the Symfony cookbook entry on -`How to Create a Custom Authentication System with Guard `_. diff --git a/vendor/silex/silex/doc/cookbook/index.rst b/vendor/silex/silex/doc/cookbook/index.rst deleted file mode 100644 index 53b10fe..0000000 --- a/vendor/silex/silex/doc/cookbook/index.rst +++ /dev/null @@ -1,40 +0,0 @@ -Cookbook -======== - -The cookbook section contains recipes for solving specific problems. - -.. toctree:: - :maxdepth: 1 - :hidden: - - json_request_body - session_storage - form_no_csrf - validator_yaml - sub_requests - error_handler - multiple_loggers - guard_authentication - -Recipes -------- - -* :doc:`Accepting a JSON Request Body ` A common need when - building a restful API is the ability to accept a JSON encoded entity from - the request body. - -* :doc:`Using PdoSessionStorage to store Sessions in the Database - `. - -* :doc:`Disabling the CSRF Protection on a Form using the FormExtension - `. - -* :doc:`Using YAML to configure Validation `. - -* :doc:`Making sub-Requests `. - -* :doc:`Converting Errors to Exceptions `. - -* :doc:`Using multiple Monolog Loggers `. - -* :doc:`How to Create a Custom Authentication System with Guard `. diff --git a/vendor/silex/silex/doc/cookbook/json_request_body.rst b/vendor/silex/silex/doc/cookbook/json_request_body.rst deleted file mode 100644 index 4715900..0000000 --- a/vendor/silex/silex/doc/cookbook/json_request_body.rst +++ /dev/null @@ -1,95 +0,0 @@ -Accepting a JSON Request Body -============================= - -A common need when building a restful API is the ability to accept a JSON -encoded entity from the request body. - -An example for such an API could be a blog post creation. - -Example API ------------ - -In this example we will create an API for creating a blog post. The following -is a spec of how we want it to work. - -Request -~~~~~~~ - -In the request we send the data for the blog post as a JSON object. We also -indicate that using the ``Content-Type`` header: - -.. code-block:: text - - POST /blog/posts - Accept: application/json - Content-Type: application/json - Content-Length: 57 - - {"title":"Hello World!","body":"This is my first post!"} - -Response -~~~~~~~~ - -The server responds with a 201 status code, telling us that the post was -created. It tells us the ``Content-Type`` of the response, which is also -JSON: - -.. code-block:: text - - HTTP/1.1 201 Created - Content-Type: application/json - Content-Length: 65 - Connection: close - - {"id":"1","title":"Hello World!","body":"This is my first post!"} - -Parsing the request body ------------------------- - -The request body should only be parsed as JSON if the ``Content-Type`` header -begins with ``application/json``. Since we want to do this for every request, -the easiest solution is to use an application before middleware. - -We simply use ``json_decode`` to parse the content of the request and then -replace the request data on the ``$request`` object:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpFoundation\ParameterBag; - - $app->before(function (Request $request) { - if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) { - $data = json_decode($request->getContent(), true); - $request->request->replace(is_array($data) ? $data : array()); - } - }); - -Controller implementation -------------------------- - -Our controller will create a new blog post from the data provided and will -return the post object, including its ``id``, as JSON:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpFoundation\Response; - - $app->post('/blog/posts', function (Request $request) use ($app) { - $post = array( - 'title' => $request->request->get('title'), - 'body' => $request->request->get('body'), - ); - - $post['id'] = createPost($post); - - return $app->json($post, 201); - }); - -Manual testing --------------- - -In order to manually test our API, we can use the ``curl`` command line -utility, which allows sending HTTP requests: - -.. code-block:: bash - - $ curl http://blog.lo/blog/posts -d '{"title":"Hello World!","body":"This is my first post!"}' -H 'Content-Type: application/json' - {"id":"1","title":"Hello World!","body":"This is my first post!"} diff --git a/vendor/silex/silex/doc/cookbook/multiple_loggers.rst b/vendor/silex/silex/doc/cookbook/multiple_loggers.rst deleted file mode 100644 index cb10395..0000000 --- a/vendor/silex/silex/doc/cookbook/multiple_loggers.rst +++ /dev/null @@ -1,69 +0,0 @@ -Using multiple Monolog Loggers -============================== - -Having separate instances of Monolog for different parts of your system is -often desirable and allows you to configure them independently, allowing for fine -grained control of where your logging goes and in what detail. - -This simple example allows you to quickly configure several monolog instances, -using the bundled handler, but each with a different channel. - -.. code-block:: php - - $app['monolog.factory'] = $app->protect(function ($name) use ($app) { - $log = new $app['monolog.logger.class']($name); - $log->pushHandler($app['monolog.handler']); - - return $log; - }); - - foreach (array('auth', 'payments', 'stats') as $channel) { - $app['monolog.'.$channel] = function ($app) use ($channel) { - return $app['monolog.factory']($channel); - }; - } - -As your application grows, or your logging needs for certain areas of the -system become apparent, it should be straightforward to then configure that -particular service separately, including your customizations. - -.. code-block:: php - - use Monolog\Handler\StreamHandler; - - $app['monolog.payments'] = function ($app) { - $log = new $app['monolog.logger.class']('payments'); - $handler = new StreamHandler($app['monolog.payments.logfile'], $app['monolog.payment.level']); - $log->pushHandler($handler); - - return $log; - }; - -Alternatively, you could attempt to make the factory more complicated, and rely -on some conventions, such as checking for an array of handlers registered with -the container with the channel name, defaulting to the bundled handler. - -.. code-block:: php - - use Monolog\Handler\StreamHandler; - use Monolog\Logger; - - $app['monolog.factory'] = $app->protect(function ($name) use ($app) { - $log = new $app['monolog.logger.class']($name); - - $handlers = isset($app['monolog.'.$name.'.handlers']) - ? $app['monolog.'.$name.'.handlers'] - : array($app['monolog.handler']); - - foreach ($handlers as $handler) { - $log->pushHandler($handler); - } - - return $log; - }); - - $app['monolog.payments.handlers'] = function ($app) { - return array( - new StreamHandler(__DIR__.'/../payments.log', Logger::DEBUG), - ); - }; diff --git a/vendor/silex/silex/doc/cookbook/session_storage.rst b/vendor/silex/silex/doc/cookbook/session_storage.rst deleted file mode 100644 index 29328b4..0000000 --- a/vendor/silex/silex/doc/cookbook/session_storage.rst +++ /dev/null @@ -1,89 +0,0 @@ -Using PdoSessionStorage to store Sessions in the Database -========================================================= - -By default, the :doc:`SessionServiceProvider ` writes -session information in files using Symfony NativeFileSessionStorage. Most -medium to large websites use a database to store sessions instead of files, -because databases are easier to use and scale in a multi-webserver environment. - -Symfony's `NativeSessionStorage -`_ -has multiple storage handlers and one of them uses PDO to store sessions, -`PdoSessionHandler -`_. -To use it, replace the ``session.storage.handler`` service in your application -like explained below. - -With a dedicated PDO service ----------------------------- - -.. code-block:: php - - use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; - - $app->register(new Silex\Provider\SessionServiceProvider()); - - $app['pdo.dsn'] = 'mysql:dbname=mydatabase'; - $app['pdo.user'] = 'myuser'; - $app['pdo.password'] = 'mypassword'; - - $app['session.db_options'] = array( - 'db_table' => 'session', - 'db_id_col' => 'session_id', - 'db_data_col' => 'session_value', - 'db_time_col' => 'session_time', - ); - - $app['pdo'] = function () use ($app) { - return new PDO( - $app['pdo.dsn'], - $app['pdo.user'], - $app['pdo.password'] - ); - }; - - $app['session.storage.handler'] = function () use ($app) { - return new PdoSessionHandler( - $app['pdo'], - $app['session.db_options'] - ); - }; - -Using the DoctrineServiceProvider ---------------------------------- - -When using the :doc:`DoctrineServiceProvider ` You don't -have to make another database connection, simply pass the getWrappedConnection method. - -.. code-block:: php - - use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; - - $app->register(new Silex\Provider\SessionServiceProvider()); - - $app['session.storage.handler'] = function () use ($app) { - return new PdoSessionHandler( - $app['db']->getWrappedConnection(), - array( - 'db_table' => 'session', - 'db_id_col' => 'session_id', - 'db_data_col' => 'session_value', - 'db_lifetime_col' => 'session_lifetime', - 'db_time_col' => 'session_time', - ) - ); - }; - -Database structure ------------------- - -PdoSessionStorage needs a database table with 3 columns: - -* ``session_id``: ID column (VARCHAR(255) or larger) -* ``session_value``: Value column (TEXT or CLOB) -* ``session_lifetime``: Lifetime column (INTEGER) -* ``session_time``: Time column (INTEGER) - -You can find examples of SQL statements to create the session table in the -`Symfony cookbook -`_ diff --git a/vendor/silex/silex/doc/cookbook/sub_requests.rst b/vendor/silex/silex/doc/cookbook/sub_requests.rst deleted file mode 100644 index 95d3913..0000000 --- a/vendor/silex/silex/doc/cookbook/sub_requests.rst +++ /dev/null @@ -1,137 +0,0 @@ -Making sub-Requests -=================== - -Since Silex is based on the ``HttpKernelInterface``, it allows you to simulate -requests against your application. This means that you can embed a page within -another, it also allows you to forward a request which is essentially an -internal redirect that does not change the URL. - -Basics ------- - -You can make a sub-request by calling the ``handle`` method on the -``Application``. This method takes three arguments: - -* ``$request``: An instance of the ``Request`` class which represents the - HTTP request. - -* ``$type``: Must be either ``HttpKernelInterface::MASTER_REQUEST`` or - ``HttpKernelInterface::SUB_REQUEST``. Certain listeners are only executed for - the master request, so it's important that this is set to ``SUB_REQUEST``. - -* ``$catch``: Catches exceptions and turns them into a response with status code - ``500``. This argument defaults to ``true``. For sub-requests you will most - likely want to set it to ``false``. - -By calling ``handle``, you can make a sub-request manually. Here's an example:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpKernel\HttpKernelInterface; - - $subRequest = Request::create('/'); - $response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); - -There's some more things that you need to keep in mind though. In most cases -you will want to forward some parts of the current master request to the -sub-request like cookies, server information, or the session. - -Here is a more advanced example that forwards said information (``$request`` -holds the master request):: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpKernel\HttpKernelInterface; - - $subRequest = Request::create('/', 'GET', array(), $request->cookies->all(), array(), $request->server->all()); - if ($request->getSession()) { - $subRequest->setSession($request->getSession()); - } - - $response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); - -To forward this response to the client, you can simply return it from a -controller:: - - use Silex\Application; - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpKernel\HttpKernelInterface; - - $app->get('/foo', function (Application $app, Request $request) { - $subRequest = Request::create('/', ...); - $response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); - - return $response; - }); - -If you want to embed the response as part of a larger page you can call -``Response::getContent``:: - - $header = ...; - $footer = ...; - $body = $response->getContent(); - - return $header.$body.$footer; - -Rendering pages in Twig templates ---------------------------------- - -The :doc:`TwigServiceProvider ` provides a ``render`` -function that you can use in Twig templates. It gives you a convenient way to -embed pages. - -.. code-block:: jinja - - {{ render('/sidebar') }} - -For details, refer to the :doc:`TwigServiceProvider ` docs. - -Edge Side Includes ------------------- - -You can use ESI either through the :doc:`HttpCacheServiceProvider -` or a reverse proxy cache such as Varnish. This also -allows you to embed pages, however it also gives you the benefit of caching -parts of the page. - -Here is an example of how you would embed a page via ESI: - -.. code-block:: jinja - - - -For details, refer to the :doc:`HttpCacheServiceProvider -` docs. - -Dealing with the request base URL ---------------------------------- - -One thing to watch out for is the base URL. If your application is not -hosted at the webroot of your web server, then you may have an URL like -``http://example.org/foo/index.php/articles/42``. - -In this case, ``/foo/index.php`` is your request base path. Silex accounts for -this path prefix in the routing process, it reads it from -``$request->server``. In the context of sub-requests this can lead to issues, -because if you do not prepend the base path the request could mistake a part -of the path you want to match as the base path and cut it off. - -You can prevent that from happening by always prepending the base path when -constructing a request:: - - $url = $request->getUriForPath('/'); - $subRequest = Request::create($url, 'GET', array(), $request->cookies->all(), array(), $request->server->all()); - -This is something to be aware of when making sub-requests by hand. - -Services depending on the Request ---------------------------------- - -The container is a concept that is global to a Silex application, since the -application object **is** the container. Any request that is run against an -application will re-use the same set of services. Since these services are -mutable, code in a master request can affect the sub-requests and vice versa. -Any services depending on the ``request`` service will store the first request -that they get (could be master or sub-request), and keep using it, even if -that request is already over. - -Instead of injecting the ``request`` service, you should always inject the -``request_stack`` one instead. diff --git a/vendor/silex/silex/doc/cookbook/validator_yaml.rst b/vendor/silex/silex/doc/cookbook/validator_yaml.rst deleted file mode 100644 index 10a41fc..0000000 --- a/vendor/silex/silex/doc/cookbook/validator_yaml.rst +++ /dev/null @@ -1,35 +0,0 @@ -Using YAML to configure Validation -================================== - -Simplicity is at the heart of Silex so there is no out of the box solution to -use YAML files for validation. But this doesn't mean that this is not -possible. Let's see how to do it. - -First, you need to install the YAML Component: - -.. code-block:: bash - - composer require symfony/yaml - -Next, you need to tell the Validation Service that you are not using -``StaticMethodLoader`` to load your class metadata but a YAML file:: - - $app->register(new ValidatorServiceProvider()); - - $app['validator.mapping.class_metadata_factory'] = new Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory( - new Symfony\Component\Validator\Mapping\Loader\YamlFileLoader(__DIR__.'/validation.yml') - ); - -Now, we can replace the usage of the static method and move all the validation -rules to ``validation.yml``: - -.. code-block:: yaml - - # validation.yml - Post: - properties: - title: - - NotNull: ~ - - NotBlank: ~ - body: - - Min: 100 diff --git a/vendor/silex/silex/doc/index.rst b/vendor/silex/silex/doc/index.rst deleted file mode 100644 index d1a851d..0000000 --- a/vendor/silex/silex/doc/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -The Book -======== - -.. toctree:: - :maxdepth: 1 - - intro - usage - middlewares - organizing_controllers - services - providers - testing - cookbook/index - internals - contributing - providers/index - web_servers - changelog diff --git a/vendor/silex/silex/doc/internals.rst b/vendor/silex/silex/doc/internals.rst deleted file mode 100644 index c7ffac8..0000000 --- a/vendor/silex/silex/doc/internals.rst +++ /dev/null @@ -1,84 +0,0 @@ -Internals -========= - -This chapter will tell you how Silex works internally. - -Silex ------ - -Application -~~~~~~~~~~~ - -The application is the main interface to Silex. It implements Symfony's -`HttpKernelInterface -`_, -so you can pass a `Request -`_ -to the ``handle`` method and it will return a `Response -`_. - -It extends the ``Pimple`` service container, allowing for flexibility on the -outside as well as the inside. You could replace any service, and you are also -able to read them. - -The application makes strong use of the `EventDispatcher -`_ to hook into the Symfony `HttpKernel -`_ -events. This allows fetching the ``Request``, converting string responses into -``Response`` objects and handling Exceptions. We also use it to dispatch some -custom events like before/after middlewares and errors. - -Controller -~~~~~~~~~~ - -The Symfony `Route -`_ is -actually quite powerful. Routes can be named, which allows for URL generation. -They can also have requirements for the variable parts. In order to allow -setting these through a nice interface, the ``match`` method (which is used by -``get``, ``post``, etc.) returns an instance of the ``Controller``, which -wraps a route. - -ControllerCollection -~~~~~~~~~~~~~~~~~~~~ - -One of the goals of exposing the `RouteCollection -`_ -was to make it mutable, so providers could add stuff to it. The challenge here -is the fact that routes know nothing about their name. The name only has -meaning in context of the ``RouteCollection`` and cannot be changed. - -To solve this challenge we came up with a staging area for routes. The -``ControllerCollection`` holds the controllers until ``flush`` is called, at -which point the routes are added to the ``RouteCollection``. Also, the -controllers are then frozen. This means that they can no longer be modified -and will throw an Exception if you try to do so. - -Unfortunately no good way for flushing implicitly could be found, which is why -flushing is now always explicit. The Application will flush, but if you want -to read the ``ControllerCollection`` before the request takes place, you will -have to call flush yourself. - -The ``Application`` provides a shortcut ``flush`` method for flushing the -``ControllerCollection``. - -.. tip:: - - Instead of creating an instance of ``RouteCollection`` yourself, use the - ``$app['controllers_factory']`` factory instead. - -Symfony -------- - -Following Symfony components are used by Silex: - -* **HttpFoundation**: For ``Request`` and ``Response``. - -* **HttpKernel**: Because we need a heart. - -* **Routing**: For matching defined routes. - -* **EventDispatcher**: For hooking into the HttpKernel. - -For more information, `check out the Symfony website `_. diff --git a/vendor/silex/silex/doc/intro.rst b/vendor/silex/silex/doc/intro.rst deleted file mode 100644 index 2ab2bc3..0000000 --- a/vendor/silex/silex/doc/intro.rst +++ /dev/null @@ -1,50 +0,0 @@ -Introduction -============ - -Silex is a PHP microframework. It is built on the shoulders of `Symfony`_ and -`Pimple`_ and also inspired by `Sinatra`_. - -Silex aims to be: - -* *Concise*: Silex exposes an intuitive and concise API. - -* *Extensible*: Silex has an extension system based around the Pimple - service-container that makes it easy to tie in third party libraries. - -* *Testable*: Silex uses Symfony's HttpKernel which abstracts request and - response. This makes it very easy to test apps and the framework itself. It - also respects the HTTP specification and encourages its proper use. - -In a nutshell, you define controllers and map them to routes, all in one step. - -Usage ------ - -.. code-block:: php - - get('/hello/{name}', function ($name) use ($app) { - return 'Hello '.$app->escape($name); - }); - - $app->run(); - -All that is needed to get access to the Framework is to include the -autoloader. - -Next, a route for ``/hello/{name}`` that matches for ``GET`` requests is -defined. When the route matches, the function is executed and the return value -is sent back to the client. - -Finally, the app is run. Visit ``/hello/world`` to see the result. It's really -that easy! - -.. _Symfony: http://symfony.com/ -.. _Pimple: http://pimple.sensiolabs.org/ -.. _Sinatra: http://www.sinatrarb.com/ diff --git a/vendor/silex/silex/doc/middlewares.rst b/vendor/silex/silex/doc/middlewares.rst deleted file mode 100644 index c5c17cf..0000000 --- a/vendor/silex/silex/doc/middlewares.rst +++ /dev/null @@ -1,162 +0,0 @@ -Middleware -========== - -Silex allows you to run code, that changes the default Silex behavior, at -different stages during the handling of a request through *middleware*: - -* *Application middleware* is triggered independently of the current handled - request; - -* *Route middleware* is triggered when its associated route is matched. - -Application Middleware ----------------------- - -Application middleware is only run for the "master" Request. - -Before Middleware -~~~~~~~~~~~~~~~~~ - -A *before* application middleware allows you to tweak the Request before the -controller is executed:: - - $app->before(function (Request $request, Application $app) { - // ... - }); - -By default, the middleware is run after the routing and the security. - -If you want your middleware to be run even if an exception is thrown early on -(on a 404 or 403 error for instance), then, you need to register it as an -early event:: - - $app->before(function (Request $request, Application $app) { - // ... - }, Application::EARLY_EVENT); - -In this case, the routing and the security won't have been executed, and so you -won't have access to the locale, the current route, or the security user. - -.. note:: - - The before middleware is an event registered on the Symfony *request* - event. - -After Middleware -~~~~~~~~~~~~~~~~ - -An *after* application middleware allows you to tweak the Response before it -is sent to the client:: - - $app->after(function (Request $request, Response $response) { - // ... - }); - -.. note:: - - The after middleware is an event registered on the Symfony *response* - event. - -Finish Middleware -~~~~~~~~~~~~~~~~~ - -A *finish* application middleware allows you to execute tasks after the -Response has been sent to the client (like sending emails or logging):: - - $app->finish(function (Request $request, Response $response) { - // ... - // Warning: modifications to the Request or Response will be ignored - }); - -.. note:: - - The finish middleware is an event registered on the Symfony *terminate* - event. - -Route Middleware ----------------- - -Route middleware is added to routes or route collections and it is only -triggered when the corresponding route is matched. You can also stack them:: - - $app->get('/somewhere', function () { - // ... - }) - ->before($before1) - ->before($before2) - ->after($after1) - ->after($after2) - ; - -Before Middleware -~~~~~~~~~~~~~~~~~ - -A *before* route middleware is fired just before the route callback, but after -the *before* application middleware:: - - $before = function (Request $request, Application $app) { - // ... - }; - - $app->get('/somewhere', function () { - // ... - }) - ->before($before); - -After Middleware -~~~~~~~~~~~~~~~~ - -An *after* route middleware is fired just after the route callback, but before -the application *after* application middleware:: - - $after = function (Request $request, Response $response, Application $app) { - // ... - }; - - $app->get('/somewhere', function () { - // ... - }) - ->after($after); - -Middleware Priority -------------------- - -You can add as much middleware as you want, in which case they are triggered -in the same order as you added them. - -You can explicitly control the priority of your middleware by passing an -additional argument to the registration methods:: - - $app->before(function (Request $request) { - // ... - }, 32); - -As a convenience, two constants allow you to register an event as early as -possible or as late as possible:: - - $app->before(function (Request $request) { - // ... - }, Application::EARLY_EVENT); - - $app->before(function (Request $request) { - // ... - }, Application::LATE_EVENT); - -Short-circuiting the Controller -------------------------------- - -If a *before* middleware returns a ``Response`` object, the request handling is -short-circuited (the next middleware won't be run, nor the route -callback), and the Response is passed to the *after* middleware right away:: - - $app->before(function (Request $request) { - // redirect the user to the login screen if access to the Resource is protected - if (...) { - return new RedirectResponse('/login'); - } - }); - -.. note:: - - A ``RuntimeException`` is thrown if a before middleware does not return a - Response or ``null``. diff --git a/vendor/silex/silex/doc/organizing_controllers.rst b/vendor/silex/silex/doc/organizing_controllers.rst deleted file mode 100644 index 50558cb..0000000 --- a/vendor/silex/silex/doc/organizing_controllers.rst +++ /dev/null @@ -1,84 +0,0 @@ -Organizing Controllers -====================== - -When your application starts to define too many controllers, you might want to -group them logically:: - - // define controllers for a blog - $blog = $app['controllers_factory']; - $blog->get('/', function () { - return 'Blog home page'; - }); - // ... - - // define controllers for a forum - $forum = $app['controllers_factory']; - $forum->get('/', function () { - return 'Forum home page'; - }); - - // define "global" controllers - $app->get('/', function () { - return 'Main home page'; - }); - - $app->mount('/blog', $blog); - $app->mount('/forum', $forum); - - // define controllers for a admin - $app->mount('/admin', function ($admin) { - // recursively mount - $admin->mount('/blog', function ($user) { - $user->get('/', function () { - return 'Admin Blog home page'; - }); - }); - }); - -.. note:: - - ``$app['controllers_factory']`` is a factory that returns a new instance - of ``ControllerCollection`` when used. - -``mount()`` prefixes all routes with the given prefix and merges them into the -main Application. So, ``/`` will map to the main home page, ``/blog/`` to the -blog home page, ``/forum/`` to the forum home page, and ``/admin/blog/`` to the -admin blog home page. - -.. caution:: - - When mounting a route collection under ``/blog``, it is not possible to - define a route for the ``/blog`` URL. The shortest possible URL is - ``/blog/``. - -.. note:: - - When calling ``get()``, ``match()``, or any other HTTP methods on the - Application, you are in fact calling them on a default instance of - ``ControllerCollection`` (stored in ``$app['controllers']``). - -Another benefit is the ability to apply settings on a set of controllers very -easily. Building on the example from the middleware section, here is how you -would secure all controllers for the backend collection:: - - $backend = $app['controllers_factory']; - - // ensure that all controllers require logged-in users - $backend->before($mustBeLogged); - -.. tip:: - - For a better readability, you can split each controller collection into a - separate file:: - - // blog.php - $blog = $app['controllers_factory']; - $blog->get('/', function () { return 'Blog home page'; }); - - return $blog; - - // app.php - $app->mount('/blog', include 'blog.php'); - - Instead of requiring a file, you can also create a :ref:`Controller - provider `. diff --git a/vendor/silex/silex/doc/providers.rst b/vendor/silex/silex/doc/providers.rst deleted file mode 100644 index c3d049d..0000000 --- a/vendor/silex/silex/doc/providers.rst +++ /dev/null @@ -1,262 +0,0 @@ -Providers -========= - -Providers allow the developer to reuse parts of an application into another -one. Silex provides two types of providers defined by two interfaces: -``ServiceProviderInterface`` for services and ``ControllerProviderInterface`` -for controllers. - -Service Providers ------------------ - -Loading providers -~~~~~~~~~~~~~~~~~ - -In order to load and use a service provider, you must register it on the -application:: - - $app = new Silex\Application(); - - $app->register(new Acme\DatabaseServiceProvider()); - -You can also provide some parameters as a second argument. These will be set -**after** the provider is registered, but **before** it is booted:: - - $app->register(new Acme\DatabaseServiceProvider(), array( - 'database.dsn' => 'mysql:host=localhost;dbname=myapp', - 'database.user' => 'root', - 'database.password' => 'secret_root_password', - )); - -Conventions -~~~~~~~~~~~ - -You need to watch out in what order you do certain things when interacting -with providers. Just keep these rules in mind: - -* Overriding existing services must occur **after** the provider is - registered. - - *Reason: If the service already exists, the provider will overwrite it.* - -* You can set parameters any time **after** the provider is registered, but - **before** the service is accessed. - - *Reason: Providers can set default values for parameters. Just like with - services, the provider will overwrite existing values.* - -Included providers -~~~~~~~~~~~~~~~~~~ - -There are a few providers that you get out of the box. All of these are within -the ``Silex\Provider`` namespace: - -* :doc:`AssetServiceProvider ` -* :doc:`CsrfServiceProvider ` -* :doc:`DoctrineServiceProvider ` -* :doc:`FormServiceProvider ` -* :doc:`HttpCacheServiceProvider ` -* :doc:`HttpFragmentServiceProvider ` -* :doc:`LocaleServiceProvider ` -* :doc:`MonologServiceProvider ` -* :doc:`RememberMeServiceProvider ` -* :doc:`SecurityServiceProvider ` -* :doc:`SerializerServiceProvider ` -* :doc:`ServiceControllerServiceProvider ` -* :doc:`SessionServiceProvider ` -* :doc:`SwiftmailerServiceProvider ` -* :doc:`TranslationServiceProvider ` -* :doc:`TwigServiceProvider ` -* :doc:`ValidatorServiceProvider ` -* :doc:`VarDumperServiceProvider ` - -.. note:: - - The Silex core team maintains a `WebProfiler - `_ provider that helps debug - code in the development environment thanks to the Symfony web debug toolbar - and the Symfony profiler. - -Third party providers -~~~~~~~~~~~~~~~~~~~~~ - -Some service providers are developed by the community. Those third-party -providers are listed on `Silex' repository wiki -`_. - -You are encouraged to share yours. - -Creating a provider -~~~~~~~~~~~~~~~~~~~ - -Providers must implement the ``Pimple\ServiceProviderInterface``:: - - interface ServiceProviderInterface - { - public function register(Container $container); - } - -This is very straight forward, just create a new class that implements the -register method. In the ``register()`` method, you can define services on the -application which then may make use of other services and parameters. - -.. tip:: - - The ``Pimple\ServiceProviderInterface`` belongs to the Pimple package, so - take care to only use the API of ``Pimple\Container`` within your - ``register`` method. Not only is this a good practice due to the way Pimple - and Silex work, but may allow your provider to be used outside of Silex. - -Optionally, your service provider can implement the -``Silex\Api\BootableProviderInterface``. A bootable provider must -implement the ``boot()`` method, with which you can configure the application, just -before it handles a request:: - - interface BootableProviderInterface - { - function boot(Application $app); - } - -Another optional interface, is the ``Silex\Api\EventListenerProviderInterface``. -This interface contains the ``subscribe()`` method, which allows your provider to -subscribe event listener with Silex's EventDispatcher, just before it handles a -request:: - - interface EventListenerProviderInterface - { - function subscribe(Container $app, EventDispatcherInterface $dispatcher); - } - -Here is an example of such a provider:: - - namespace Acme; - - use Pimple\Container; - use Pimple\ServiceProviderInterface; - use Silex\Application; - use Silex\Api\BootableProviderInterface; - use Silex\Api\EventListenerProviderInterface; - use Symfony\Component\EventDispatcher\EventDispatcherInterface; - use Symfony\Component\HttpKernel\KernelEvents; - use Symfony\Component\HttpKernel\Event\FilterResponseEvent; - - class HelloServiceProvider implements ServiceProviderInterface, BootableProviderInterface, EventListenerProviderInterface - { - public function register(Container $app) - { - $app['hello'] = $app->protect(function ($name) use ($app) { - $default = $app['hello.default_name'] ? $app['hello.default_name'] : ''; - $name = $name ?: $default; - - return 'Hello '.$app->escape($name); - }); - } - - public function boot(Application $app) - { - // do something - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addListener(KernelEvents::REQUEST, function(FilterResponseEvent $event) use ($app) { - // do something - }); - } - } - -This class provides a ``hello`` service which is a protected closure. It takes -a ``name`` argument and will return ``hello.default_name`` if no name is -given. If the default is also missing, it will use an empty string. - -You can now use this provider as follows:: - - use Symfony\Component\HttpFoundation\Request; - - $app = new Silex\Application(); - - $app->register(new Acme\HelloServiceProvider(), array( - 'hello.default_name' => 'Igor', - )); - - $app->get('/hello', function (Request $request) use ($app) { - $name = $request->get('name'); - - return $app['hello']($name); - }); - -In this example we are getting the ``name`` parameter from the query string, -so the request path would have to be ``/hello?name=Fabien``. - -.. _controller-providers: - -Controller Providers --------------------- - -Loading providers -~~~~~~~~~~~~~~~~~ - -In order to load and use a controller provider, you must "mount" its -controllers under a path:: - - $app = new Silex\Application(); - - $app->mount('/blog', new Acme\BlogControllerProvider()); - -All controllers defined by the provider will now be available under the -``/blog`` path. - -Creating a provider -~~~~~~~~~~~~~~~~~~~ - -Providers must implement the ``Silex\Api\ControllerProviderInterface``:: - - interface ControllerProviderInterface - { - public function connect(Application $app); - } - -Here is an example of such a provider:: - - namespace Acme; - - use Silex\Application; - use Silex\Api\ControllerProviderInterface; - - class HelloControllerProvider implements ControllerProviderInterface - { - public function connect(Application $app) - { - // creates a new controller based on the default route - $controllers = $app['controllers_factory']; - - $controllers->get('/', function (Application $app) { - return $app->redirect('/hello'); - }); - - return $controllers; - } - } - -The ``connect`` method must return an instance of ``ControllerCollection``. -``ControllerCollection`` is the class where all controller related methods are -defined (like ``get``, ``post``, ``match``, ...). - -.. tip:: - - The ``Application`` class acts in fact as a proxy for these methods. - -You can use this provider as follows:: - - $app = new Silex\Application(); - - $app->mount('/blog', new Acme\HelloControllerProvider()); - -In this example, the ``/blog/`` path now references the controller defined in -the provider. - -.. tip:: - - You can also define a provider that implements both the service and the - controller provider interface and package in the same class the services - needed to make your controllers work. diff --git a/vendor/silex/silex/doc/providers/asset.rst b/vendor/silex/silex/doc/providers/asset.rst deleted file mode 100644 index 72c3d70..0000000 --- a/vendor/silex/silex/doc/providers/asset.rst +++ /dev/null @@ -1,67 +0,0 @@ -Asset -===== - -The *AssetServiceProvider* provides a way to manage URL generation and -versioning of web assets such as CSS stylesheets, JavaScript files and image -files. - -Parameters ----------- - -* **assets.version**: Default version for assets. - -* **assets.format_version** (optional): Default format for assets. - -* **assets.named_packages** (optional): Named packages. Keys are the package - names and values the configuration (supported keys are ``version``, - ``version_format``, ``base_urls``, and ``base_path``). - -Services --------- - -* **assets.packages**: The asset service. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\AssetServiceProvider(), array( - 'assets.version' => 'v1', - 'assets.version_format' => '%s?version=%s', - 'assets.named_packages' => array( - 'css' => array('version' => 'css2', 'base_path' => '/whatever-makes-sense'), - 'images' => array('base_urls' => array('https://img.example.com')), - ), - )); - -.. note:: - - Add the Symfony Asset Component as a dependency: - - .. code-block:: bash - - composer require symfony/asset - - If you want to use assets in your Twig templates, you must also install the - Symfony Twig Bridge: - - .. code-block:: bash - - composer require symfony/twig-bridge - -Usage ------ - -The AssetServiceProvider is mostly useful with the Twig provider: - -.. code-block:: jinja - - {{ asset('/css/foo.png') }} - {{ asset('/css/foo.css', 'css') }} - {{ asset('/img/foo.png', 'images') }} - - {{ asset_version('/css/foo.png') }} - -For more information, check out the `Asset Component documentation -`_. diff --git a/vendor/silex/silex/doc/providers/csrf.rst b/vendor/silex/silex/doc/providers/csrf.rst deleted file mode 100644 index a055c11..0000000 --- a/vendor/silex/silex/doc/providers/csrf.rst +++ /dev/null @@ -1,53 +0,0 @@ -CSRF -==== - -The *CsrfServiceProvider* provides a service for building forms in your -application with the Symfony Form component. - -Parameters ----------- - -* none - -Services --------- - -* **csrf.token_manager**: An instance of an implementation of the - `CsrfTokenManagerInterface - `_, - -Registering ------------ - -.. code-block:: php - - use Silex\Provider\CsrfServiceProvider; - - $app->register(new CsrfServiceProvider()); - -.. note:: - - Add the Symfony's `Security CSRF Component - `_ as a - dependency: - - .. code-block:: bash - - composer require symfony/security-csrf - -Usage ------ - -When the CSRF Service Provider is registered, all forms created via the Form -Service Provider are protected against CSRF by default. - -You can also use the CSRF protection without using the Symfony Form component. -If, for example, you're doing a DELETE action, create a CSRF token to use in -your code:: - - use Symfony\Component\Security\Csrf\CsrfToken; - $csrfToken = $app['csrf.token_manager']->getToken('token_id'); //'TOKEN' - -Then check it:: - - $app['csrf.token_manager']->isTokenValid(new CsrfToken('token_id', 'TOKEN')); diff --git a/vendor/silex/silex/doc/providers/doctrine.rst b/vendor/silex/silex/doc/providers/doctrine.rst deleted file mode 100644 index 0ef167b..0000000 --- a/vendor/silex/silex/doc/providers/doctrine.rst +++ /dev/null @@ -1,137 +0,0 @@ -Doctrine -======== - -The *DoctrineServiceProvider* provides integration with the `Doctrine DBAL -`_ for easy database access -(Doctrine ORM integration is **not** supplied). - -Parameters ----------- - -* **db.options**: Array of Doctrine DBAL options. - - These options are available: - - * **driver**: The database driver to use, defaults to ``pdo_mysql``. - Can be any of: ``pdo_mysql``, ``pdo_sqlite``, ``pdo_pgsql``, - ``pdo_oci``, ``oci8``, ``ibm_db2``, ``pdo_ibm``, ``pdo_sqlsrv``. - - * **dbname**: The name of the database to connect to. - - * **host**: The host of the database to connect to. Defaults to - localhost. - - * **user**: The user of the database to connect to. Defaults to - root. - - * **password**: The password of the database to connect to. - - * **charset**: Only relevant for ``pdo_mysql``, and ``pdo_oci/oci8``, - specifies the charset used when connecting to the database. - - * **path**: Only relevant for ``pdo_sqlite``, specifies the path to - the SQLite database. - - * **port**: Only relevant for ``pdo_mysql``, ``pdo_pgsql``, and ``pdo_oci/oci8``, - specifies the port of the database to connect to. - - These and additional options are described in detail in the `Doctrine DBAL - configuration documentation `_. - -Services --------- - -* **db**: The database connection, instance of - ``Doctrine\DBAL\Connection``. - -* **db.config**: Configuration object for Doctrine. Defaults to - an empty ``Doctrine\DBAL\Configuration``. - -* **db.event_manager**: Event Manager for Doctrine. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\DoctrineServiceProvider(), array( - 'db.options' => array( - 'driver' => 'pdo_sqlite', - 'path' => __DIR__.'/app.db', - ), - )); - -.. note:: - - Add the Doctrine DBAL as a dependency: - - .. code-block:: bash - - composer require "doctrine/dbal:~2.2" - -Usage ------ - -The Doctrine provider provides a ``db`` service. Here is a usage -example:: - - $app->get('/blog/{id}', function ($id) use ($app) { - $sql = "SELECT * FROM posts WHERE id = ?"; - $post = $app['db']->fetchAssoc($sql, array((int) $id)); - - return "

    {$post['title']}

    ". - "

    {$post['body']}

    "; - }); - -Using multiple databases ------------------------- - -The Doctrine provider can allow access to multiple databases. In order to -configure the data sources, replace the **db.options** with **dbs.options**. -**dbs.options** is an array of configurations where keys are connection names -and values are options:: - - $app->register(new Silex\Provider\DoctrineServiceProvider(), array( - 'dbs.options' => array ( - 'mysql_read' => array( - 'driver' => 'pdo_mysql', - 'host' => 'mysql_read.someplace.tld', - 'dbname' => 'my_database', - 'user' => 'my_username', - 'password' => 'my_password', - 'charset' => 'utf8mb4', - ), - 'mysql_write' => array( - 'driver' => 'pdo_mysql', - 'host' => 'mysql_write.someplace.tld', - 'dbname' => 'my_database', - 'user' => 'my_username', - 'password' => 'my_password', - 'charset' => 'utf8mb4', - ), - ), - )); - -The first registered connection is the default and can simply be accessed as -you would if there was only one connection. Given the above configuration, -these two lines are equivalent:: - - $app['db']->fetchAll('SELECT * FROM table'); - - $app['dbs']['mysql_read']->fetchAll('SELECT * FROM table'); - -Using multiple connections:: - - $app->get('/blog/{id}', function ($id) use ($app) { - $sql = "SELECT * FROM posts WHERE id = ?"; - $post = $app['dbs']['mysql_read']->fetchAssoc($sql, array((int) $id)); - - $sql = "UPDATE posts SET value = ? WHERE id = ?"; - $app['dbs']['mysql_write']->executeUpdate($sql, array('newValue', (int) $id)); - - return "

    {$post['title']}

    ". - "

    {$post['body']}

    "; - }); - -For more information, consult the `Doctrine DBAL documentation -`_. diff --git a/vendor/silex/silex/doc/providers/form.rst b/vendor/silex/silex/doc/providers/form.rst deleted file mode 100644 index 6818b85..0000000 --- a/vendor/silex/silex/doc/providers/form.rst +++ /dev/null @@ -1,216 +0,0 @@ -Form -==== - -The *FormServiceProvider* provides a service for building forms in -your application with the Symfony Form component. - -Parameters ----------- - -* none - -Services --------- - -* **form.factory**: An instance of `FormFactory - `_, - that is used to build a form. - -Registering ------------ - -.. code-block:: php - - use Silex\Provider\FormServiceProvider; - - $app->register(new FormServiceProvider()); - -.. note:: - - If you don't want to create your own form layout, it's fine: a default one - will be used. But you will have to register the :doc:`translation provider - ` as the default form layout requires it:: - - $app->register(new Silex\Provider\TranslationServiceProvider(), array( - 'translator.domains' => array(), - )); - - If you want to use validation with forms, do not forget to register the - :doc:`Validator provider `. - -.. note:: - - Add the Symfony Form Component as a dependency: - - .. code-block:: bash - - composer require symfony/form - - If you are going to use the validation extension with forms, you must also - add a dependency to the ``symfony/validator`` and ``symfony/config`` - components: - - .. code-block:: bash - - composer require symfony/validator symfony/config - - If you want to use forms in your Twig templates, you can also install the - Symfony Twig Bridge. Make sure to install, if you didn't do that already, - the Translation component in order for the bridge to work: - - .. code-block:: bash - - composer require symfony/twig-bridge - -Usage ------ - -The FormServiceProvider provides a ``form.factory`` service. Here is a usage -example:: - - use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - use Symfony\Component\Form\Extension\Core\Type\FormType; - use Symfony\Component\Form\Extension\Core\Type\SubmitType; - - $app->match('/form', function (Request $request) use ($app) { - // some default data for when the form is displayed the first time - $data = array( - 'name' => 'Your name', - 'email' => 'Your email', - ); - - $form = $app['form.factory']->createBuilder(FormType::class, $data) - ->add('name') - ->add('email') - ->add('billing_plan', ChoiceType::class, array( - 'choices' => array('free' => 1, 'small business' => 2, 'corporate' => 3), - 'expanded' => true, - )) - ->add('submit', SubmitType::class, [ - 'label' => 'Save', - ]) - ->getForm(); - - $form->handleRequest($request); - - if ($form->isValid()) { - $data = $form->getData(); - - // do something with the data - - // redirect somewhere - return $app->redirect('...'); - } - - // display the form - return $app['twig']->render('index.twig', array('form' => $form->createView())); - }); - -And here is the ``index.twig`` form template (requires ``symfony/twig-bridge``): - -.. code-block:: jinja - -
    - {{ form_widget(form) }} - - -
    - -If you are using the validator provider, you can also add validation to your -form by adding constraints on the fields:: - - use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - use Symfony\Component\Form\Extension\Core\Type\FormType; - use Symfony\Component\Form\Extension\Core\Type\SubmitType; - use Symfony\Component\Form\Extension\Core\Type\TextType; - use Symfony\Component\Validator\Constraints as Assert; - - $app->register(new Silex\Provider\ValidatorServiceProvider()); - $app->register(new Silex\Provider\TranslationServiceProvider(), array( - 'translator.domains' => array(), - )); - - $form = $app['form.factory']->createBuilder(FormType::class) - ->add('name', TextType::class, array( - 'constraints' => array(new Assert\NotBlank(), new Assert\Length(array('min' => 5))) - )) - ->add('email', TextType::class, array( - 'constraints' => new Assert\Email() - )) - ->add('billing_plan', ChoiceType::class, array( - 'choices' => array('free' => 1, 'small business' => 2, 'corporate' => 3), - 'expanded' => true, - 'constraints' => new Assert\Choice(array(1, 2, 3)), - )) - ->add('submit', SubmitType::class, [ - 'label' => 'Save', - ]) - ->getForm(); - -You can register form types by extending ``form.types``:: - - $app['your.type.service'] = function ($app) { - return new YourServiceFormType(); - }; - $app->extend('form.types', function ($types) use ($app) { - $types[] = new YourFormType(); - $types[] = 'your.type.service'; - - return $types; - })); - -You can register form extensions by extending ``form.extensions``:: - - $app->extend('form.extensions', function ($extensions) use ($app) { - $extensions[] = new YourTopFormExtension(); - - return $extensions; - }); - - -You can register form type extensions by extending ``form.type.extensions``:: - - $app['your.type.extension.service'] = function ($app) { - return new YourServiceFormTypeExtension(); - }; - $app->extend('form.type.extensions', function ($extensions) use ($app) { - $extensions[] = new YourFormTypeExtension(); - $extensions[] = 'your.type.extension.service'; - - return $extensions; - }); - -You can register form type guessers by extending ``form.type.guessers``:: - - $app['your.type.guesser.service'] = function ($app) { - return new YourServiceFormTypeGuesser(); - }; - $app->extend('form.type.guessers', function ($guessers) use ($app) { - $guessers[] = new YourFormTypeGuesser(); - $guessers[] = 'your.type.guesser.service'; - - return $guessers; - }); - -.. warning:: - - CSRF protection is only available and automatically enabled when the - :doc:`CSRF Service Provider
    ` is registered. - -Traits ------- - -``Silex\Application\FormTrait`` adds the following shortcuts: - -* **form**: Creates a FormBuilderInterface instance. - -* **namedForm**: Creates a FormBuilderInterface instance (named). - -.. code-block:: php - - $app->form($data); - - $app->namedForm($name, $data, $options, $type); - -For more information, consult the `Symfony Forms documentation -`_. diff --git a/vendor/silex/silex/doc/providers/http_cache.rst b/vendor/silex/silex/doc/providers/http_cache.rst deleted file mode 100644 index 8bc98f6..0000000 --- a/vendor/silex/silex/doc/providers/http_cache.rst +++ /dev/null @@ -1,128 +0,0 @@ -HTTP Cache -========== - -The *HttpCacheServiceProvider* provides support for the Symfony Reverse -Proxy. - -Parameters ----------- - -* **http_cache.cache_dir**: The cache directory to store the HTTP cache data. - -* **http_cache.options** (optional): An array of options for the `HttpCache - `_ - constructor. - -Services --------- - -* **http_cache**: An instance of `HttpCache - `_. - -* **http_cache.esi**: An instance of `Esi - `_, - that implements the ESI capabilities to Request and Response instances. - -* **http_cache.store**: An instance of `Store - `_, - that implements all the logic for storing cache metadata (Request and Response - headers). - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\HttpCacheServiceProvider(), array( - 'http_cache.cache_dir' => __DIR__.'/cache/', - )); - -Usage ------ - -Silex already supports any reverse proxy like Varnish out of the box by -setting Response HTTP cache headers:: - - use Symfony\Component\HttpFoundation\Response; - - $app->get('/', function() { - return new Response('Foo', 200, array( - 'Cache-Control' => 's-maxage=5', - )); - }); - -.. tip:: - - If you want Silex to trust the ``X-Forwarded-For*`` headers from your - reverse proxy at address $ip, you will need to whitelist it as documented - in `Trusting Proxies - `_. - - If you would be running Varnish in front of your application on the same machine:: - - use Symfony\Component\HttpFoundation\Request; - - Request::setTrustedProxies(array('127.0.0.1', '::1')); - $app->run(); - -This provider allows you to use the Symfony reverse proxy natively with -Silex applications by using the ``http_cache`` service. The Symfony reverse proxy -acts much like any other proxy would, so you will want to whitelist it:: - - use Symfony\Component\HttpFoundation\Request; - - Request::setTrustedProxies(array('127.0.0.1')); - $app['http_cache']->run(); - -The provider also provides ESI support:: - - $app->get('/', function() { - $response = new Response(<< - - Hello - - - - - EOF - , 200, array( - 'Surrogate-Control' => 'content="ESI/1.0"', - )); - - $response->setTtl(20); - - return $response; - }); - - $app->get('/included', function() { - $response = new Response('Foo'); - $response->setTtl(5); - - return $response; - }); - - $app['http_cache']->run(); - -If your application doesn't use ESI, you can disable it to slightly improve the -overall performance:: - - $app->register(new Silex\Provider\HttpCacheServiceProvider(), array( - 'http_cache.cache_dir' => __DIR__.'/cache/', - 'http_cache.esi' => null, - )); - -.. tip:: - - To help you debug caching issues, set your application ``debug`` to true. - Symfony automatically adds a ``X-Symfony-Cache`` header to each response - with useful information about cache hits and misses. - - If you are *not* using the Symfony Session provider, you might want to set - the PHP ``session.cache_limiter`` setting to an empty value to avoid the - default PHP behavior. - - Finally, check that your Web server does not override your caching strategy. - -For more information, consult the `Symfony HTTP Cache documentation -`_. diff --git a/vendor/silex/silex/doc/providers/http_fragment.rst b/vendor/silex/silex/doc/providers/http_fragment.rst deleted file mode 100644 index 8e68185..0000000 --- a/vendor/silex/silex/doc/providers/http_fragment.rst +++ /dev/null @@ -1,70 +0,0 @@ -HTTP Fragment -============= - -The *HttpFragmentServiceProvider* provides support for the Symfony fragment -sub-framework, which allows you to embed fragments of HTML in a template. - -Parameters ----------- - -* **fragment.path**: The path to use for the URL generated for ESI and - HInclude URLs (``/_fragment`` by default). - -* **uri_signer.secret**: The secret to use for the URI signer service (used - for the HInclude renderer). - -* **fragment.renderers.hinclude.global_template**: The content or Twig - template to use for the default content when using the HInclude renderer. - -Services --------- - -* **fragment.handler**: An instance of `FragmentHandler - `_. - -* **fragment.renderers**: An array of fragment renderers (by default, the - inline, ESI, and HInclude renderers are pre-configured). - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\HttpFragmentServiceProvider()); - -Usage ------ - -.. note:: - - This section assumes that you are using Twig for your templates. - -Instead of building a page out of a single request/controller/template, the -fragment framework allows you to build a page from several -controllers/sub-requests/sub-templates by using **fragments**. - -Including "sub-pages" in the main page can be done with the Twig ``render()`` -function: - -.. code-block:: jinja - - The main page content. - - {{ render('/foo') }} - - The main page content resumes here. - -The ``render()`` call is replaced by the content of the ``/foo`` URL -(internally, a sub-request is handled by Silex to render the sub-page). - -Instead of making internal sub-requests, you can also use the ESI (the -sub-request is handled by a reverse proxy) or the HInclude strategies (the -sub-request is handled by a web browser): - -.. code-block:: jinja - - {{ render(url('route_name')) }} - - {{ render_esi(url('route_name')) }} - - {{ render_hinclude(url('route_name')) }} diff --git a/vendor/silex/silex/doc/providers/index.rst b/vendor/silex/silex/doc/providers/index.rst deleted file mode 100644 index 8c5a175..0000000 --- a/vendor/silex/silex/doc/providers/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -Built-in Service Providers -========================== - -.. toctree:: - :maxdepth: 1 - - twig - asset - monolog - session - swiftmailer - locale - translation - validator - form - csrf - http_cache - http_fragment - security - remember_me - serializer - service_controller - var_dumper - doctrine diff --git a/vendor/silex/silex/doc/providers/locale.rst b/vendor/silex/silex/doc/providers/locale.rst deleted file mode 100644 index 8f6cd67..0000000 --- a/vendor/silex/silex/doc/providers/locale.rst +++ /dev/null @@ -1,24 +0,0 @@ -Locale -====== - -The *LocaleServiceProvider* manages the locale of an application. - -Parameters ----------- - -* **locale**: The locale of the user. When set before any request handling, it - defines the default locale (``en`` by default). When a request is being - handled, it is automatically set according to the ``_locale`` request - attribute of the current route. - -Services --------- - -* n/a - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\LocaleServiceProvider()); diff --git a/vendor/silex/silex/doc/providers/monolog.rst b/vendor/silex/silex/doc/providers/monolog.rst deleted file mode 100644 index 645b710..0000000 --- a/vendor/silex/silex/doc/providers/monolog.rst +++ /dev/null @@ -1,115 +0,0 @@ -Monolog -======= - -The *MonologServiceProvider* provides a default logging mechanism through -Jordi Boggiano's `Monolog `_ library. - -It will log requests and errors and allow you to add logging to your -application. This allows you to debug and monitor the behaviour, -even in production. - -Parameters ----------- - -* **monolog.logfile**: File where logs are written to. -* **monolog.bubble**: (optional) Whether the messages that are handled can bubble up the stack or not. -* **monolog.permission**: (optional) File permissions default (null), nothing change. - -* **monolog.level** (optional): Level of logging, defaults - to ``DEBUG``. Must be one of ``Logger::DEBUG``, ``Logger::INFO``, - ``Logger::WARNING``, ``Logger::ERROR``. ``DEBUG`` will log - everything, ``INFO`` will log everything except ``DEBUG``, - etc. - - In addition to the ``Logger::`` constants, it is also possible to supply the - level in string form, for example: ``"DEBUG"``, ``"INFO"``, ``"WARNING"``, - ``"ERROR"``. - -* **monolog.name** (optional): Name of the monolog channel, - defaults to ``myapp``. - -* **monolog.exception.logger_filter** (optional): An anonymous function that - returns an error level for on uncaught exception that should be logged. - -* **monolog.use_error_handler** (optional): Whether errors and uncaught exceptions - should be handled by the Monolog ``ErrorHandler`` class and added to the log. - By default the error handler is enabled unless the application ``debug`` parameter - is set to true. - - Please note that enabling the error handler may silence some errors, - ignoring the PHP ``display_errors`` configuration setting. - -Services --------- - -* **monolog**: The monolog logger instance. - - Example usage:: - - $app['monolog']->debug('Testing the Monolog logging.'); - -* **monolog.listener**: An event listener to log requests, responses and errors. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\MonologServiceProvider(), array( - 'monolog.logfile' => __DIR__.'/development.log', - )); - -.. note:: - - Add Monolog as a dependency: - - .. code-block:: bash - - composer require monolog/monolog - -Usage ------ - -The MonologServiceProvider provides a ``monolog`` service. You can use it to -add log entries for any logging level through ``debug()``, ``info()``, -``warning()`` and ``error()``:: - - use Symfony\Component\HttpFoundation\Response; - - $app->post('/user', function () use ($app) { - // ... - - $app['monolog']->info(sprintf("User '%s' registered.", $username)); - - return new Response('', 201); - }); - -Customization -------------- - -You can configure Monolog (like adding or changing the handlers) before using -it by extending the ``monolog`` service:: - - $app->extend('monolog', function($monolog, $app) { - $monolog->pushHandler(...); - - return $monolog; - }); - -By default, all requests, responses and errors are logged by an event listener -registered as a service called `monolog.listener`. You can replace or remove -this service if you want to modify or disable the logged information. - -Traits ------- - -``Silex\Application\MonologTrait`` adds the following shortcuts: - -* **log**: Logs a message. - -.. code-block:: php - - $app->log(sprintf("User '%s' registered.", $username)); - -For more information, check out the `Monolog documentation -`_. diff --git a/vendor/silex/silex/doc/providers/remember_me.rst b/vendor/silex/silex/doc/providers/remember_me.rst deleted file mode 100644 index 7fdaaab..0000000 --- a/vendor/silex/silex/doc/providers/remember_me.rst +++ /dev/null @@ -1,69 +0,0 @@ -Remember Me -=========== - -The *RememberMeServiceProvider* adds "Remember-Me" authentication to the -*SecurityServiceProvider*. - -Parameters ----------- - -n/a - -Services --------- - -n/a - -.. note:: - - The service provider defines many other services that are used internally - but rarely need to be customized. - -Registering ------------ - -Before registering this service provider, you must register the -*SecurityServiceProvider*:: - - $app->register(new Silex\Provider\SecurityServiceProvider()); - $app->register(new Silex\Provider\RememberMeServiceProvider()); - - $app['security.firewalls'] = array( - 'my-firewall' => array( - 'pattern' => '^/secure$', - 'form' => true, - 'logout' => true, - 'remember_me' => array( - 'key' => 'Choose_A_Unique_Random_Key', - 'always_remember_me' => true, - /* Other options */ - ), - 'users' => array( /* ... */ ), - ), - ); - -Options -------- - -* **key**: A secret key to generate tokens (you should generate a random - string). - -* **name**: Cookie name (default: ``REMEMBERME``). - -* **lifetime**: Cookie lifetime (default: ``31536000`` ~ 1 year). - -* **path**: Cookie path (default: ``/``). - -* **domain**: Cookie domain (default: ``null`` = request domain). - -* **secure**: Cookie is secure (default: ``false``). - -* **httponly**: Cookie is HTTP only (default: ``true``). - -* **always_remember_me**: Enable remember me (default: ``false``). - -* **remember_me_parameter**: Name of the request parameter enabling remember_me - on login. To add the checkbox to the login form. You can find more - information in the `Symfony cookbook - `_ - (default: ``_remember_me``). diff --git a/vendor/silex/silex/doc/providers/security.rst b/vendor/silex/silex/doc/providers/security.rst deleted file mode 100644 index 49da817..0000000 --- a/vendor/silex/silex/doc/providers/security.rst +++ /dev/null @@ -1,709 +0,0 @@ -Security -======== - -The *SecurityServiceProvider* manages authentication and authorization for -your applications. - -Parameters ----------- - -* **security.hide_user_not_found** (optional): Defines whether to hide user not - found exception or not. Defaults to ``true``. - -* **security.encoder.bcrypt.cost** (optional): Defines BCrypt password encoder cost. Defaults to 13. - -Services --------- - -* **security.token_storage**: Gives access to the user token. - -* **security.authorization_checker**: Allows to check authorizations for the - users. - -* **security.authentication_manager**: An instance of - `AuthenticationProviderManager - `_, - responsible for authentication. - -* **security.access_manager**: An instance of `AccessDecisionManager - `_, - responsible for authorization. - -* **security.session_strategy**: Define the session strategy used for - authentication (default to a migration strategy). - -* **security.user_checker**: Checks user flags after authentication. - -* **security.last_error**: Returns the last authentication errors when given a - Request object. - -* **security.encoder_factory**: Defines the encoding strategies for user - passwords (uses ``security.default_encoder``). - -* **security.default_encoder**: The encoder to use by default for all users (BCrypt). - -* **security.encoder.digest**: Digest password encoder. - -* **security.encoder.bcrypt**: BCrypt password encoder. - -* **security.encoder.pbkdf2**: Pbkdf2 password encoder. - -* **user**: Returns the current user - -.. note:: - - The service provider defines many other services that are used internally - but rarely need to be customized. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\SecurityServiceProvider(), array( - 'security.firewalls' => // see below - )); - -.. note:: - - Add the Symfony Security Component as a dependency: - - .. code-block:: bash - - composer require symfony/security - -.. caution:: - - If you're using a form to authenticate users, you need to enable - ``SessionServiceProvider``. - -.. caution:: - - The security features are only available after the Application has been - booted. So, if you want to use it outside of the handling of a request, - don't forget to call ``boot()`` first:: - - $app->boot(); - -Usage ------ - -The Symfony Security component is powerful. To learn more about it, read the -`Symfony Security documentation -`_. - -.. tip:: - - When a security configuration does not behave as expected, enable logging - (with the Monolog extension for instance) as the Security Component logs a - lot of interesting information about what it does and why. - -Below is a list of recipes that cover some common use cases. - -Accessing the current User -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The current user information is stored in a token that is accessible via the -``security`` service:: - - $token = $app['security.token_storage']->getToken(); - -If there is no information about the user, the token is ``null``. If the user -is known, you can get it with a call to ``getUser()``:: - - if (null !== $token) { - $user = $token->getUser(); - } - -The user can be a string, an object with a ``__toString()`` method, or an -instance of `UserInterface -`_. - -Securing a Path with HTTP Authentication -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The following configuration uses HTTP basic authentication to secure URLs -under ``/admin/``:: - - $app['security.firewalls'] = array( - 'admin' => array( - 'pattern' => '^/admin', - 'http' => true, - 'users' => array( - // raw password is foo - 'admin' => array('ROLE_ADMIN', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'), - ), - ), - ); - -The ``pattern`` is a regular expression on the URL path; the ``http`` setting -tells the security layer to use HTTP basic authentication and the ``users`` -entry defines valid users. - -If you want to restrict the firewall by more than the URL pattern (like the -HTTP method, the client IP, the hostname, or any Request attributes), use an -instance of a `RequestMatcher -`_ -for the ``pattern`` option:: - - use Symfony/Component/HttpFoundation/RequestMatcher; - - $app['security.firewalls'] = array( - 'admin' => array( - 'pattern' => new RequestMatcher('^/admin', 'example.com', 'POST'), - // ... - ), - ); - -Each user is defined with the following information: - -* The role or an array of roles for the user (roles are strings beginning with - ``ROLE_`` and ending with anything you want); - -* The user encoded password. - -.. caution:: - - All users must at least have one role associated with them. - -The default configuration of the extension enforces encoded passwords. To -generate a valid encoded password from a raw password, use the -``security.encoder_factory`` service:: - - // find the encoder for a UserInterface instance - $encoder = $app['security.encoder_factory']->getEncoder($user); - - // compute the encoded password for foo - $password = $encoder->encodePassword('foo', $user->getSalt()); - -When the user is authenticated, the user stored in the token is an instance of -`User -`_ - -.. caution:: - - If you are using php-cgi under Apache, you need to add this configuration - to make things work correctly: - - .. code-block:: apache - - RewriteEngine On - RewriteCond %{HTTP:Authorization} ^(.+)$ - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ app.php [QSA,L] - -Securing a Path with a Form -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Using a form to authenticate users is very similar to the above configuration. -Instead of using the ``http`` setting, use the ``form`` one and define these -two parameters: - -* **login_path**: The login path where the user is redirected when they are - accessing a secured area without being authenticated so that they can enter - their credentials; - -* **check_path**: The check URL used by Symfony to validate the credentials of - the user. - -Here is how to secure all URLs under ``/admin/`` with a form:: - - $app['security.firewalls'] = array( - 'admin' => array( - 'pattern' => '^/admin/', - 'form' => array('login_path' => '/login', 'check_path' => '/admin/login_check'), - 'users' => array( - 'admin' => array('ROLE_ADMIN', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'), - ), - ), - ); - -Always keep in mind the following two golden rules: - -* The ``login_path`` path must always be defined **outside** the secured area - (or if it is in the secured area, the ``anonymous`` authentication mechanism - must be enabled -- see below); - -* The ``check_path`` path must always be defined **inside** the secured area. - -For the login form to work, create a controller like the following:: - - use Symfony\Component\HttpFoundation\Request; - - $app->get('/login', function(Request $request) use ($app) { - return $app['twig']->render('login.html', array( - 'error' => $app['security.last_error']($request), - 'last_username' => $app['session']->get('_security.last_username'), - )); - }); - -The ``error`` and ``last_username`` variables contain the last authentication -error and the last username entered by the user in case of an authentication -error. - -Create the associated template: - -.. code-block:: jinja - -
    - {{ error }} - - - -
    - -.. note:: - - The ``admin_login_check`` route is automatically defined by Silex and its - name is derived from the ``check_path`` value (all ``/`` are replaced with - ``_`` and the leading ``/`` is stripped). - -Defining more than one Firewall -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You are not limited to define one firewall per project. - -Configuring several firewalls is useful when you want to secure different -parts of your website with different authentication strategies or for -different users (like using an HTTP basic authentication for the website API -and a form to secure your website administration area). - -It's also useful when you want to secure all URLs except the login form:: - - $app['security.firewalls'] = array( - 'login' => array( - 'pattern' => '^/login$', - ), - 'secured' => array( - 'pattern' => '^.*$', - 'form' => array('login_path' => '/login', 'check_path' => '/login_check'), - 'users' => array( - 'admin' => array('ROLE_ADMIN', '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a'), - ), - ), - ); - -The order of the firewall configurations is significant as the first one to -match wins. The above configuration first ensures that the ``/login`` URL is -not secured (no authentication settings), and then it secures all other URLs. - -.. tip:: - - You can toggle all registered authentication mechanisms for a particular - area on and off with the ``security`` flag:: - - $app['security.firewalls'] = array( - 'api' => array( - 'pattern' => '^/api', - 'security' => $app['debug'] ? false : true, - 'wsse' => true, - - // ... - ), - ); - -Adding a Logout -~~~~~~~~~~~~~~~ - -When using a form for authentication, you can let users log out if you add the -``logout`` setting, where ``logout_path`` must match the main firewall -pattern:: - - $app['security.firewalls'] = array( - 'secured' => array( - 'pattern' => '^/admin/', - 'form' => array('login_path' => '/login', 'check_path' => '/admin/login_check'), - 'logout' => array('logout_path' => '/admin/logout', 'invalidate_session' => true), - - // ... - ), - ); - -A route is automatically generated, based on the configured path (all ``/`` -are replaced with ``_`` and the leading ``/`` is stripped): - -.. code-block:: jinja - - Logout - -Allowing Anonymous Users -~~~~~~~~~~~~~~~~~~~~~~~~ - -When securing only some parts of your website, the user information are not -available in non-secured areas. To make the user accessible in such areas, -enabled the ``anonymous`` authentication mechanism:: - - $app['security.firewalls'] = array( - 'unsecured' => array( - 'anonymous' => true, - - // ... - ), - ); - -When enabling the anonymous setting, a user will always be accessible from the -security context; if the user is not authenticated, it returns the ``anon.`` -string. - -Checking User Roles -~~~~~~~~~~~~~~~~~~~ - -To check if a user is granted some role, use the ``isGranted()`` method on the -security context:: - - if ($app['security.authorization_checker']->isGranted('ROLE_ADMIN')) { - // ... - } - -You can check roles in Twig templates too: - -.. code-block:: jinja - - {% if is_granted('ROLE_ADMIN') %} - Switch to Fabien - {% endif %} - -You can check if a user is "fully authenticated" (not an anonymous user for -instance) with the special ``IS_AUTHENTICATED_FULLY`` role: - -.. code-block:: jinja - - {% if is_granted('IS_AUTHENTICATED_FULLY') %} - Logout - {% else %} - Login - {% endif %} - -Of course you will need to define a ``login`` route for this to work. - -.. tip:: - - Don't use the ``getRoles()`` method to check user roles. - -.. caution:: - - ``isGranted()`` throws an exception when no authentication information is - available (which is the case on non-secured area). - -Impersonating a User -~~~~~~~~~~~~~~~~~~~~ - -If you want to be able to switch to another user (without knowing the user -credentials), enable the ``switch_user`` authentication strategy:: - - $app['security.firewalls'] = array( - 'unsecured' => array( - 'switch_user' => array('parameter' => '_switch_user', 'role' => 'ROLE_ALLOWED_TO_SWITCH'), - - // ... - ), - ); - -Switching to another user is now a matter of adding the ``_switch_user`` query -parameter to any URL when logged in as a user who has the -``ROLE_ALLOWED_TO_SWITCH`` role: - -.. code-block:: jinja - - {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %} - Switch to user Fabien - {% endif %} - -You can check that you are impersonating a user by checking the special -``ROLE_PREVIOUS_ADMIN``. This is useful for instance to allow the user to -switch back to their primary account: - -.. code-block:: jinja - - {% if is_granted('ROLE_PREVIOUS_ADMIN') %} - You are an admin but you've switched to another user, - exit the switch. - {% endif %} - -Defining a Role Hierarchy -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Defining a role hierarchy allows to automatically grant users some additional -roles:: - - $app['security.role_hierarchy'] = array( - 'ROLE_ADMIN' => array('ROLE_USER', 'ROLE_ALLOWED_TO_SWITCH'), - ); - -With this configuration, all users with the ``ROLE_ADMIN`` role also -automatically have the ``ROLE_USER`` and ``ROLE_ALLOWED_TO_SWITCH`` roles. - -Defining Access Rules -~~~~~~~~~~~~~~~~~~~~~ - -Roles are a great way to adapt the behavior of your website depending on -groups of users, but they can also be used to further secure some areas by -defining access rules:: - - $app['security.access_rules'] = array( - array('^/admin', 'ROLE_ADMIN', 'https'), - array('^.*$', 'ROLE_USER'), - ); - -With the above configuration, users must have the ``ROLE_ADMIN`` to access the -``/admin`` section of the website, and ``ROLE_USER`` for everything else. -Furthermore, the admin section can only be accessible via HTTPS (if that's not -the case, the user will be automatically redirected). - -.. note:: - - The first argument can also be a `RequestMatcher - `_ - instance. - -Defining a custom User Provider -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Using an array of users is simple and useful when securing an admin section of -a personal website, but you can override this default mechanism with you own. - -The ``users`` setting can be defined as a service that returns an instance of -`UserProviderInterface -`_:: - - 'users' => function () use ($app) { - return new UserProvider($app['db']); - }, - -Here is a simple example of a user provider, where Doctrine DBAL is used to -store the users:: - - use Symfony\Component\Security\Core\User\UserProviderInterface; - use Symfony\Component\Security\Core\User\UserInterface; - use Symfony\Component\Security\Core\User\User; - use Symfony\Component\Security\Core\Exception\UnsupportedUserException; - use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; - use Doctrine\DBAL\Connection; - - class UserProvider implements UserProviderInterface - { - private $conn; - - public function __construct(Connection $conn) - { - $this->conn = $conn; - } - - public function loadUserByUsername($username) - { - $stmt = $this->conn->executeQuery('SELECT * FROM users WHERE username = ?', array(strtolower($username))); - - if (!$user = $stmt->fetch()) { - throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username)); - } - - return new User($user['username'], $user['password'], explode(',', $user['roles']), true, true, true, true); - } - - public function refreshUser(UserInterface $user) - { - if (!$user instanceof User) { - throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); - } - - return $this->loadUserByUsername($user->getUsername()); - } - - public function supportsClass($class) - { - return $class === 'Symfony\Component\Security\Core\User\User'; - } - } - -In this example, instances of the default ``User`` class are created for the -users, but you can define your own class; the only requirement is that the -class must implement `UserInterface -`_ - -And here is the code that you can use to create the database schema and some -sample users:: - - use Doctrine\DBAL\Schema\Table; - - $schema = $app['db']->getSchemaManager(); - if (!$schema->tablesExist('users')) { - $users = new Table('users'); - $users->addColumn('id', 'integer', array('unsigned' => true, 'autoincrement' => true)); - $users->setPrimaryKey(array('id')); - $users->addColumn('username', 'string', array('length' => 32)); - $users->addUniqueIndex(array('username')); - $users->addColumn('password', 'string', array('length' => 255)); - $users->addColumn('roles', 'string', array('length' => 255)); - - $schema->createTable($users); - - $app['db']->insert('users', array( - 'username' => 'fabien', - 'password' => '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a', - 'roles' => 'ROLE_USER' - )); - - $app['db']->insert('users', array( - 'username' => 'admin', - 'password' => '$2y$10$3i9/lVd8UOFIJ6PAMFt8gu3/r5g0qeCJvoSlLCsvMTythye19F77a', - 'roles' => 'ROLE_ADMIN' - )); - } - -.. tip:: - - If you are using the Doctrine ORM, the Symfony bridge for Doctrine - provides a user provider class that is able to load users from your - entities. - -Defining a custom Encoder -~~~~~~~~~~~~~~~~~~~~~~~~~ - -By default, Silex uses the ``BCrypt`` algorithm to encode passwords. -Additionally, the password is encoded multiple times. -You can change these defaults by overriding ``security.default_encoder`` -service to return one of the predefined encoders: - -* **security.encoder.digest**: Digest password encoder. - -* **security.encoder.bcrypt**: BCrypt password encoder. - -* **security.encoder.pbkdf2**: Pbkdf2 password encoder. - -.. code-block:: php - - $app['security.default_encoder'] = function ($app) { - return $app['security.encoder.pbkdf2']; - }; - -Or you can define you own, fully customizable encoder:: - - use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder; - - $app['security.default_encoder'] = function ($app) { - // Plain text (e.g. for debugging) - return new PlaintextPasswordEncoder(); - }; - -.. tip:: - - You can change the default BCrypt encoding cost by overriding ``security.encoder.bcrypt.cost`` - -Defining a custom Authentication Provider -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The Symfony Security component provides a lot of ready-to-use authentication -providers (form, HTTP, X509, remember me, ...), but you can add new ones -easily. To register a new authentication provider, create a service named -``security.authentication_listener.factory.XXX`` where ``XXX`` is the name you want to -use in your configuration:: - - $app['security.authentication_listener.factory.wsse'] = $app->protect(function ($name, $options) use ($app) { - // define the authentication provider object - $app['security.authentication_provider.'.$name.'.wsse'] = function () use ($app) { - return new WsseProvider($app['security.user_provider.default'], __DIR__.'/security_cache'); - }; - - // define the authentication listener object - $app['security.authentication_listener.'.$name.'.wsse'] = function () use ($app) { - return new WsseListener($app['security.token_storage'], $app['security.authentication_manager']); - }; - - return array( - // the authentication provider id - 'security.authentication_provider.'.$name.'.wsse', - // the authentication listener id - 'security.authentication_listener.'.$name.'.wsse', - // the entry point id - null, - // the position of the listener in the stack - 'pre_auth' - ); - }); - -You can now use it in your configuration like any other built-in -authentication provider:: - - $app->register(new Silex\Provider\SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'wsse' => true, - - // ... - ), - ), - )); - -Instead of ``true``, you can also define an array of options that customize -the behavior of your authentication factory; it will be passed as the second -argument of your authentication factory (see above). - -This example uses the authentication provider classes as described in the -Symfony `cookbook`_. - - -.. note:: - - The Guard component simplifies the creation of custom authentication - providers. :doc:`How to Create a Custom Authentication System with Guard - ` - -Stateless Authentication -~~~~~~~~~~~~~~~~~~~~~~~~ - -By default, a session cookie is created to persist the security context of -the user. However, if you use certificates, HTTP authentication, WSSE and so -on, the credentials are sent for each request. In that case, you can turn off -persistence by activating the ``stateless`` authentication flag:: - - $app['security.firewalls'] = array( - 'default' => array( - 'stateless' => true, - 'wsse' => true, - - // ... - ), - ); - -Traits ------- - -``Silex\Application\SecurityTrait`` adds the following shortcuts: - -* **encodePassword**: Encode a given password. - -.. code-block:: php - - $encoded = $app->encodePassword($app['user'], 'foo'); - -``Silex\Route\SecurityTrait`` adds the following methods to the controllers: - -* **secure**: Secures a controller for the given roles. - -.. code-block:: php - - $app->get('/', function () { - // do something but only for admins - })->secure('ROLE_ADMIN'); - -.. caution:: - - The ``Silex\Route\SecurityTrait`` must be used with a user defined - ``Route`` class, not the application. - - .. code-block:: php - - use Silex\Route; - - class MyRoute extends Route - { - use Route\SecurityTrait; - } - - .. code-block:: php - - $app['route_class'] = 'MyRoute'; - - -.. _cookbook: http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html diff --git a/vendor/silex/silex/doc/providers/serializer.rst b/vendor/silex/silex/doc/providers/serializer.rst deleted file mode 100644 index be5847d..0000000 --- a/vendor/silex/silex/doc/providers/serializer.rst +++ /dev/null @@ -1,85 +0,0 @@ -Serializer -========== - -The *SerializerServiceProvider* provides a service for serializing objects. - -Parameters ----------- - -None. - -Services --------- - -* **serializer**: An instance of `Symfony\\Component\\Serializer\\Serializer - `_. - -* **serializer.encoders**: `Symfony\\Component\\Serializer\\Encoder\\JsonEncoder - `_ - and `Symfony\\Component\\Serializer\\Encoder\\XmlEncoder - `_. - -* **serializer.normalizers**: `Symfony\\Component\\Serializer\\Normalizer\\CustomNormalizer - `_ - and `Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer - `_. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\SerializerServiceProvider()); - -.. note:: - - Add the Symfony's `Serializer Component - `_ as a - dependency: - - .. code-block:: bash - - composer require symfony/serializer - -Usage ------ - -The ``SerializerServiceProvider`` provider provides a ``serializer`` service:: - - use Silex\Application; - use Silex\Provider\SerializerServiceProvider; - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpFoundation\Response; - - $app = new Application(); - - $app->register(new SerializerServiceProvider()); - - // only accept content types supported by the serializer via the assert method. - $app->get("/pages/{id}.{_format}", function (Request $request, $id) use ($app) { - // assume a page_repository service exists that returns Page objects. The - // object returned has getters and setters exposing the state. - $page = $app['page_repository']->find($id); - $format = $request->getRequestFormat(); - - if (!$page instanceof Page) { - $app->abort("No page found for id: $id"); - } - - return new Response($app['serializer']->serialize($page, $format), 200, array( - "Content-Type" => $request->getMimeType($format) - )); - })->assert("_format", "xml|json") - ->assert("id", "\d+"); - -Using a Cache -------------- - -To use a cache, register a class implementing ``Doctrine\Common\Cache\Cache``:: - - $app->register(new Silex\Provider\SerializerServiceProvider()); - $app['serializer.normalizers'] = function () use ($app) { - return [new \Symfony\Component\Serializer\Normalizer\CustomNormalizer(), - new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $app['my_custom_cache'])) - ]; - }; diff --git a/vendor/silex/silex/doc/providers/service_controller.rst b/vendor/silex/silex/doc/providers/service_controller.rst deleted file mode 100644 index 15bca28..0000000 --- a/vendor/silex/silex/doc/providers/service_controller.rst +++ /dev/null @@ -1,142 +0,0 @@ -Service Controllers -=================== - -As your Silex application grows, you may wish to begin organizing your -controllers in a more formal fashion. Silex can use controller classes out of -the box, but with a bit of work, your controllers can be created as services, -giving you the full power of dependency injection and lazy loading. - -.. ::todo Link above to controller classes cookbook - -Why would I want to do this? ----------------------------- - -- Dependency Injection over Service Location - - Using this method, you can inject the actual dependencies required by your - controller and gain total inversion of control, while still maintaining the - lazy loading of your controllers and its dependencies. Because your - dependencies are clearly defined, they are easily mocked, allowing you to test - your controllers in isolation. - -- Framework Independence - - Using this method, your controllers start to become more independent of the - framework you are using. Carefully crafted, your controllers will become - reusable with multiple frameworks. By keeping careful control of your - dependencies, your controllers could easily become compatible with Silex, - Symfony (full stack) and Drupal, to name just a few. - -Parameters ----------- - -There are currently no parameters for the ``ServiceControllerServiceProvider``. - -Services --------- - -There are no extra services provided, the ``ServiceControllerServiceProvider`` -simply extends the existing **resolver** service. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\ServiceControllerServiceProvider()); - -Usage ------ - -In this slightly contrived example of a blog API, we're going to change the -``/posts.json`` route to use a controller, that is defined as a service. - -.. code-block:: php - - use Silex\Application; - use Demo\Repository\PostRepository; - - $app = new Application(); - - $app['posts.repository'] = function() { - return new PostRepository; - }; - - $app->get('/posts.json', function() use ($app) { - return $app->json($app['posts.repository']->findAll()); - }); - -Rewriting your controller as a service is pretty simple, create a Plain Ol' PHP -Object with your ``PostRepository`` as a dependency, along with an -``indexJsonAction`` method to handle the request. Although not shown in the -example below, you can use type hinting and parameter naming to get the -parameters you need, just like with standard Silex routes. - -If you are a TDD/BDD fan (and you should be), you may notice that this -controller has well defined responsibilities and dependencies, and is easily -tested/specced. You may also notice that the only external dependency is on -``Symfony\Component\HttpFoundation\JsonResponse``, meaning this controller could -easily be used in a Symfony (full stack) application, or potentially with other -applications or frameworks that know how to handle a `Symfony/HttpFoundation -`_ -``Response`` object. - -.. code-block:: php - - namespace Demo\Controller; - - use Demo\Repository\PostRepository; - use Symfony\Component\HttpFoundation\JsonResponse; - - class PostController - { - protected $repo; - - public function __construct(PostRepository $repo) - { - $this->repo = $repo; - } - - public function indexJsonAction() - { - return new JsonResponse($this->repo->findAll()); - } - } - -And lastly, define your controller as a service in the application, along with -your route. The syntax in the route definition is the name of the service, -followed by a single colon (:), followed by the method name. - -.. code-block:: php - - $app['posts.controller'] = function() use ($app) { - return new PostController($app['posts.repository']); - }; - - $app->get('/posts.json', "posts.controller:indexJsonAction"); - -In addition to using classes for service controllers, you can define any -callable as a service in the application to be used for a route. - -.. code-block:: php - - namespace Demo\Controller; - - use Demo\Repository\PostRepository; - use Symfony\Component\HttpFoundation\JsonResponse; - - function postIndexJson(PostRepository $repo) { - return function() use ($repo) { - return new JsonResponse($repo->findAll()); - }; - } - -And when defining your route, the code would look like the following: - -.. code-block:: php - - $app['posts.controller'] = function($app) { - return Demo\Controller\postIndexJson($app['posts.repository']); - }; - - $app->get('/posts.json', 'posts.controller'); diff --git a/vendor/silex/silex/doc/providers/session.rst b/vendor/silex/silex/doc/providers/session.rst deleted file mode 100644 index 011b69f..0000000 --- a/vendor/silex/silex/doc/providers/session.rst +++ /dev/null @@ -1,120 +0,0 @@ -Session -======= - -The *SessionServiceProvider* provides a service for storing data persistently -between requests. - -Parameters ----------- - -* **session.storage.save_path** (optional): The path for the - ``NativeFileSessionHandler``, defaults to the value of - ``sys_get_temp_dir()``. - -* **session.storage.options**: An array of options that is passed to the - constructor of the ``session.storage`` service. - - In case of the default `NativeSessionStorage - `_, - the most useful options are: - - * **name**: The cookie name (_SESS by default) - * **id**: The session id (null by default) - * **cookie_lifetime**: Cookie lifetime - * **cookie_path**: Cookie path - * **cookie_domain**: Cookie domain - * **cookie_secure**: Cookie secure (HTTPS) - * **cookie_httponly**: Whether the cookie is http only - - However, all of these are optional. Default Sessions life time is 1800 - seconds (30 minutes). To override this, set the ``lifetime`` option. - - For a full list of available options, read the `PHP - `_ official documentation. - -* **session.test**: Whether to simulate sessions or not (useful when writing - functional tests). - -Services --------- - -* **session**: An instance of Symfony's `Session - `_. - -* **session.storage**: A service that is used for persistence of the session - data. - -* **session.storage.handler**: A service that is used by the - ``session.storage`` for data access. Defaults to a `NativeFileSessionHandler - `_ - storage handler. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\SessionServiceProvider()); - -Using Handlers --------------- - -The default session handler is ``NativeFileSessionHandler``. However, there are -multiple handlers available for use by setting ``session.storage.handler`` to -an instance of one of the following handler objects: - -* `LegacyPdoSessionHandler `_ -* `MemcacheSessionHandler `_ -* `MemcachedSessionHandler `_ -* `MongoDbSessionHandler `_ -* `NativeFileSessionHandler `_ -* `NativeSessionHandler `_ -* `NullSessionHandler `_ -* `PdoSessionHandler `_ -* `WriteCheckSessionHandler `_ - -Usage ------ - -The Session provider provides a ``session`` service. Here is an example that -authenticates a user and creates a session for them:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpFoundation\Response; - - $app->get('/login', function (Request $request) use ($app) { - $username = $request->server->get('PHP_AUTH_USER', false); - $password = $request->server->get('PHP_AUTH_PW'); - - if ('igor' === $username && 'password' === $password) { - $app['session']->set('user', array('username' => $username)); - return $app->redirect('/account'); - } - - $response = new Response(); - $response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', 'site_login')); - $response->setStatusCode(401, 'Please sign in.'); - return $response; - }); - - $app->get('/account', function () use ($app) { - if (null === $user = $app['session']->get('user')) { - return $app->redirect('/login'); - } - - return "Welcome {$user['username']}!"; - }); - - -Custom Session Configurations ------------------------------ - -If your system is using a custom session configuration (such as a redis handler -from a PHP extension) then you need to disable the NativeFileSessionHandler by -setting ``session.storage.handler`` to null. You will have to configure the -``session.save_path`` ini setting yourself in that case. - -.. code-block:: php - - $app['session.storage.handler'] = null; - diff --git a/vendor/silex/silex/doc/providers/swiftmailer.rst b/vendor/silex/silex/doc/providers/swiftmailer.rst deleted file mode 100644 index 9297d66..0000000 --- a/vendor/silex/silex/doc/providers/swiftmailer.rst +++ /dev/null @@ -1,156 +0,0 @@ -Swiftmailer -=========== - -The *SwiftmailerServiceProvider* provides a service for sending email through -the `Swift Mailer `_ library. - -You can use the ``mailer`` service to send messages easily. By default, it -will attempt to send emails through SMTP. - -Parameters ----------- - -* **swiftmailer.use_spool**: A boolean to specify whether or not to use the - memory spool, defaults to true. - -* **swiftmailer.options**: An array of options for the default SMTP-based - configuration. - - The following options can be set: - - * **host**: SMTP hostname, defaults to 'localhost'. - * **port**: SMTP port, defaults to 25. - * **username**: SMTP username, defaults to an empty string. - * **password**: SMTP password, defaults to an empty string. - * **encryption**: SMTP encryption, defaults to null. Valid values are 'tls', 'ssl', or null (indicating no encryption). - * **auth_mode**: SMTP authentication mode, defaults to null. Valid values are 'plain', 'login', 'cram-md5', or null. - - Example usage:: - - $app['swiftmailer.options'] = array( - 'host' => 'host', - 'port' => '25', - 'username' => 'username', - 'password' => 'password', - 'encryption' => null, - 'auth_mode' => null - ); - -* **swiftmailer.sender_address**: If set, all messages will be delivered with - this address as the "return path" address. - -* **swiftmailer.delivery_addresses**: If not empty, all email messages will be - sent to those addresses instead of being sent to their actual recipients. This - is often useful when developing. - -* **swiftmailer.delivery_whitelist**: Used in combination with - ``delivery_addresses``. If set, emails matching any of these patterns will be - delivered like normal, as well as being sent to ``delivery_addresses``. - -* **swiftmailer.plugins**: Array of SwiftMailer plugins. - - Example usage:: - - $app['swiftmailer.plugins'] = function ($app) { - return array( - new \Swift_Plugins_PopBeforeSmtpPlugin('pop3.example.com'), - ); - }; - -Services --------- - -* **mailer**: The mailer instance. - - Example usage:: - - $message = \Swift_Message::newInstance(); - - // ... - - $app['mailer']->send($message); - -* **swiftmailer.transport**: The transport used for e-mail - delivery. Defaults to a ``Swift_Transport_EsmtpTransport``. - -* **swiftmailer.transport.buffer**: StreamBuffer used by - the transport. - -* **swiftmailer.transport.authhandler**: Authentication - handler used by the transport. Will try the following - by default: CRAM-MD5, login, plaintext. - -* **swiftmailer.transport.eventdispatcher**: Internal event - dispatcher used by Swiftmailer. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\SwiftmailerServiceProvider()); - -.. note:: - - Add SwiftMailer as a dependency: - - .. code-block:: bash - - composer require swiftmailer/swiftmailer - -Usage ------ - -The Swiftmailer provider provides a ``mailer`` service:: - - use Symfony\Component\HttpFoundation\Request; - - $app->post('/feedback', function (Request $request) use ($app) { - $message = \Swift_Message::newInstance() - ->setSubject('[YourSite] Feedback') - ->setFrom(array('noreply@yoursite.com')) - ->setTo(array('feedback@yoursite.com')) - ->setBody($request->get('message')); - - $app['mailer']->send($message); - - return new Response('Thank you for your feedback!', 201); - }); - -Usage in commands -~~~~~~~~~~~~~~~~~ - -By default, the Swiftmailer provider sends the emails using the ``KernelEvents::TERMINATE`` -event, which is fired after the response has been sent. However, as this event -isn't fired for console commands, your emails won't be sent. - -For that reason, if you send emails using a command console, it is recommended -that you disable the use of the memory spool (before accessing ``$app['mailer']``):: - - $app['swiftmailer.use_spool'] = false; - -Alternatively, you can just make sure to flush the message spool by hand before -ending the command execution. To do so, use the following code:: - - $app['swiftmailer.spooltransport'] - ->getSpool() - ->flushQueue($app['swiftmailer.transport']) - ; - -Traits ------- - -``Silex\Application\SwiftmailerTrait`` adds the following shortcuts: - -* **mail**: Sends an email. - -.. code-block:: php - - $app->mail(\Swift_Message::newInstance() - ->setSubject('[YourSite] Feedback') - ->setFrom(array('noreply@yoursite.com')) - ->setTo(array('feedback@yoursite.com')) - ->setBody($request->get('message'))); - -For more information, check out the `Swift Mailer documentation -`_. diff --git a/vendor/silex/silex/doc/providers/translation.rst b/vendor/silex/silex/doc/providers/translation.rst deleted file mode 100644 index 145fc18..0000000 --- a/vendor/silex/silex/doc/providers/translation.rst +++ /dev/null @@ -1,193 +0,0 @@ -Translation -=========== - -The *TranslationServiceProvider* provides a service for translating your -application into different languages. - -Parameters ----------- - -* **translator.domains** (optional): A mapping of domains/locales/messages. - This parameter contains the translation data for all languages and domains. - -* **locale** (optional): The locale for the translator. You will most likely - want to set this based on some request parameter. Defaults to ``en``. - -* **locale_fallbacks** (optional): Fallback locales for the translator. It will - be used when the current locale has no messages set. Defaults to ``en``. - -Services --------- - -* **translator**: An instance of `Translator - `_, - that is used for translation. - -* **translator.loader**: An instance of an implementation of the translation - `LoaderInterface - `_, - defaults to an `ArrayLoader - `_. - -* **translator.message_selector**: An instance of `MessageSelector - `_. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\LocaleServiceProvider()); - $app->register(new Silex\Provider\TranslationServiceProvider(), array( - 'locale_fallbacks' => array('en'), - )); - -.. note:: - - Add the Symfony Translation Component as a dependency: - - .. code-block:: bash - - composer require symfony/translation - -Usage ------ - -The Translation provider provides a ``translator`` service and makes use of -the ``translator.domains`` parameter:: - - $app['translator.domains'] = array( - 'messages' => array( - 'en' => array( - 'hello' => 'Hello %name%', - 'goodbye' => 'Goodbye %name%', - ), - 'de' => array( - 'hello' => 'Hallo %name%', - 'goodbye' => 'Tschüss %name%', - ), - 'fr' => array( - 'hello' => 'Bonjour %name%', - 'goodbye' => 'Au revoir %name%', - ), - ), - 'validators' => array( - 'fr' => array( - 'This value should be a valid number.' => 'Cette valeur doit être un nombre.', - ), - ), - ); - - $app->get('/{_locale}/{message}/{name}', function ($message, $name) use ($app) { - return $app['translator']->trans($message, array('%name%' => $name)); - }); - -The above example will result in following routes: - -* ``/en/hello/igor`` will return ``Hello igor``. - -* ``/de/hello/igor`` will return ``Hallo igor``. - -* ``/fr/hello/igor`` will return ``Bonjour igor``. - -* ``/it/hello/igor`` will return ``Hello igor`` (because of the fallback). - -Using Resources ---------------- - -When translations are stored in a file, you can load them as follows:: - - $app = new Application(); - - $app->register(new TranslationServiceProvider()); - $app->extend('translator.resources', function ($resources, $app) { - $resources = array_merge($resources, array( - array('array', array('This value should be a valid number.' => 'Cette valeur doit être un nombre.'), 'fr', 'validators'), - )); - - return $resources; - }); - -Traits ------- - -``Silex\Application\TranslationTrait`` adds the following shortcuts: - -* **trans**: Translates the given message. - -* **transChoice**: Translates the given choice message by choosing a - translation according to a number. - -.. code-block:: php - - $app->trans('Hello World'); - - $app->transChoice('Hello World'); - -Recipes -------- - -YAML-based language files -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Having your translations in PHP files can be inconvenient. This recipe will -show you how to load translations from external YAML files. - -First, add the Symfony ``Config`` and ``Yaml`` components as dependencies: - -.. code-block:: bash - - composer require symfony/config symfony/yaml - -Next, you have to create the language mappings in YAML files. A naming you can -use is ``locales/en.yml``. Just do the mapping in this file as follows: - -.. code-block:: yaml - - hello: Hello %name% - goodbye: Goodbye %name% - -Then, register the ``YamlFileLoader`` on the ``translator`` and add all your -translation files:: - - use Symfony\Component\Translation\Loader\YamlFileLoader; - - $app->extend('translator', function($translator, $app) { - $translator->addLoader('yaml', new YamlFileLoader()); - - $translator->addResource('yaml', __DIR__.'/locales/en.yml', 'en'); - $translator->addResource('yaml', __DIR__.'/locales/de.yml', 'de'); - $translator->addResource('yaml', __DIR__.'/locales/fr.yml', 'fr'); - - return $translator; - }); - -XLIFF-based language files -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Just as you would do with YAML translation files, you first need to add the -Symfony ``Config`` component as a dependency (see above for details). - -Then, similarly, create XLIFF files in your locales directory and add them to -the translator:: - - $translator->addResource('xliff', __DIR__.'/locales/en.xlf', 'en'); - $translator->addResource('xliff', __DIR__.'/locales/de.xlf', 'de'); - $translator->addResource('xliff', __DIR__.'/locales/fr.xlf', 'fr'); - -.. note:: - - The XLIFF loader is already pre-configured by the extension. - -Accessing translations in Twig templates -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Once loaded, the translation service provider is available from within Twig -templates when using the Twig bridge provided by Symfony (see -:doc:`TwigServiceProvider
    `): - -.. code-block:: jinja - - {{ 'translation_key'|trans }} - {{ 'translation_key'|transchoice }} - {% trans %}translation_key{% endtrans %} diff --git a/vendor/silex/silex/doc/providers/twig.rst b/vendor/silex/silex/doc/providers/twig.rst deleted file mode 100644 index b713e1a..0000000 --- a/vendor/silex/silex/doc/providers/twig.rst +++ /dev/null @@ -1,237 +0,0 @@ -Twig -==== - -The *TwigServiceProvider* provides integration with the `Twig -`_ template engine. - -Parameters ----------- - -* **twig.path** (optional): Path to the directory containing twig template - files (it can also be an array of paths). - -* **twig.templates** (optional): An associative array of template names to - template contents. Use this if you want to define your templates inline. - -* **twig.options** (optional): An associative array of twig - options. Check out the `twig documentation `_ - for more information. - -* **twig.form.templates** (optional): An array of templates used to render - forms (only available when the ``FormServiceProvider`` is enabled). The - default theme is ``form_div_layout.html.twig``, but you can use the other - built-in themes: ``form_table_layout.html.twig``, - ``bootstrap_3_layout.html.twig``, and - ``bootstrap_3_horizontal_layout.html.twig``. - -* **twig.date.format** (optional): Default format used by the ``date`` - filter. The format string must conform to the format accepted by - `date() `_. - -* **twig.date.interval_format** (optional): Default format used by the - ``date`` filter when the filtered data is of type `DateInterval `_. - The format string must conform to the format accepted by - `DateInterval::format() `_. - -* **twig.date.timezone** (optional): Default timezone used when formatting - dates. If set to ``null`` the timezone returned by `date_default_timezone_get() `_ - is used. - -* **twig.number_format.decimals** (optional): Default number of decimals - displayed by the ``number_format`` filter. - -* **twig.number_format.decimal_point** (optional): Default separator for - the decimal point used by the ``number_format`` filter. - -* **twig.number_format.thousands_separator** (optional): Default thousands - separator used by the ``number_format`` filter. - -Services --------- - -* **twig**: The ``Twig_Environment`` instance. The main way of - interacting with Twig. - -* **twig.loader**: The loader for Twig templates which uses the ``twig.path`` - and the ``twig.templates`` options. You can also replace the loader - completely. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\TwigServiceProvider(), array( - 'twig.path' => __DIR__.'/views', - )); - -.. note:: - - Add Twig as a dependency: - - .. code-block:: bash - - composer require twig/twig - -Usage ------ - -The Twig provider provides a ``twig`` service that can render templates:: - - $app->get('/hello/{name}', function ($name) use ($app) { - return $app['twig']->render('hello.twig', array( - 'name' => $name, - )); - }); - -Symfony Components Integration ------------------------------- - -Symfony provides a Twig bridge that provides additional integration between -some Symfony components and Twig. Add it as a dependency: - -.. code-block:: bash - - composer require symfony/twig-bridge - -When present, the ``TwigServiceProvider`` will provide you with the following -additional capabilities. - -* Access to the ``path()`` and ``url()`` functions. You can find more - information in the `Symfony Routing documentation - `_: - - .. code-block:: jinja - - {{ path('homepage') }} - {{ url('homepage') }} {# generates the absolute url http://example.org/ #} - {{ path('hello', {name: 'Fabien'}) }} - {{ url('hello', {name: 'Fabien'}) }} {# generates the absolute url http://example.org/hello/Fabien #} - -* Access to the ``absolute_url()`` and ``relative_path()`` Twig functions. - -Translations Support -~~~~~~~~~~~~~~~~~~~~ - -If you are using the ``TranslationServiceProvider``, you will get the -``trans()`` and ``transchoice()`` functions for translation in Twig templates. -You can find more information in the `Symfony Translation documentation -`_. - -Form Support -~~~~~~~~~~~~ - -If you are using the ``FormServiceProvider``, you will get a set of helpers for -working with forms in templates. You can find more information in the `Symfony -Forms reference -`_. - -Security Support -~~~~~~~~~~~~~~~~ - -If you are using the ``SecurityServiceProvider``, you will have access to the -``is_granted()`` function in templates. You can find more information in the -`Symfony Security documentation -`_. - -Web Link Support -~~~~~~~~~~~~~~~~ - -If you are using the ``symfony/web-link`` component, you will have access to the -``preload()``, ``prefetch()``, ``prerender()``, ``dns_prefetch()``, -``preconnect()`` and ``link()`` functions in templates. You can find more -information in the `Symfony WebLink documentation -`_. - -Global Variable -~~~~~~~~~~~~~~~ - -When the Twig bridge is available, the ``global`` variable refers to an -instance of `AppVariable `_. -It gives access to the following methods: - -.. code-block:: jinja - - {# The current Request #} - {{ global.request }} - - {# The current User (when security is enabled) #} - {{ global.user }} - - {# The current Session #} - {{ global.session }} - - {# The debug flag #} - {{ global.debug }} - -Rendering a Controller -~~~~~~~~~~~~~~~~~~~~~~ - -A ``render`` function is also registered to help you render another controller -from a template (available when the :doc:`HttpFragment Service Provider -
    ` is registered): - -.. code-block:: jinja - - {{ render(url('sidebar')) }} - - {# or you can reference a controller directly without defining a route for it #} - {{ render(controller(controller)) }} - -.. note:: - - You must prepend the ``app.request.baseUrl`` to render calls to ensure - that the render works when deployed into a sub-directory of the docroot. - -.. note:: - - Read the Twig `reference`_ for Symfony document to learn more about the - various Twig functions. - -Traits ------- - -``Silex\Application\TwigTrait`` adds the following shortcuts: - -* **render**: Renders a view with the given parameters and returns a Response - object. - -.. code-block:: php - - return $app->render('index.html', ['name' => 'Fabien']); - - $response = new Response(); - $response->setTtl(10); - - return $app->render('index.html', ['name' => 'Fabien'], $response); - -.. code-block:: php - - // stream a view - use Symfony\Component\HttpFoundation\StreamedResponse; - - return $app->render('index.html', ['name' => 'Fabien'], new StreamedResponse()); - -* **renderView**: Renders a view with the given parameters and returns a string. - -.. code-block:: php - - $content = $app->renderView('index.html', ['name' => 'Fabien']); - -Customization -------------- - -You can configure the Twig environment before using it by extending the -``twig`` service:: - - $app->extend('twig', function($twig, $app) { - $twig->addGlobal('pi', 3.14); - $twig->addFilter('levenshtein', new \Twig_Filter_Function('levenshtein')); - - return $twig; - }); - -For more information, check out the `official Twig documentation -`_. - -.. _reference: https://symfony.com/doc/current/reference/twig_reference.html#controller diff --git a/vendor/silex/silex/doc/providers/validator.rst b/vendor/silex/silex/doc/providers/validator.rst deleted file mode 100644 index bd4e998..0000000 --- a/vendor/silex/silex/doc/providers/validator.rst +++ /dev/null @@ -1,217 +0,0 @@ -Validator -========= - -The *ValidatorServiceProvider* provides a service for validating data. It is -most useful when used with the *FormServiceProvider*, but can also be used -standalone. - -Parameters ----------- - -* **validator.validator_service_ids**: An array of service names representing - validators. - -Services --------- - -* **validator**: An instance of `Validator - `_. - -* **validator.mapping.class_metadata_factory**: Factory for metadata loaders, - which can read validation constraint information from classes. Defaults to - StaticMethodLoader--ClassMetadataFactory. - - This means you can define a static ``loadValidatorMetadata`` method on your - data class, which takes a ClassMetadata argument. Then you can set - constraints on this ClassMetadata instance. - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\ValidatorServiceProvider()); - -.. note:: - - Add the Symfony Validator Component as a dependency: - - .. code-block:: bash - - composer require symfony/validator - -Usage ------ - -The Validator provider provides a ``validator`` service. - -Validating Values -~~~~~~~~~~~~~~~~~ - -You can validate values directly using the ``validate`` validator -method:: - - use Symfony\Component\Validator\Constraints as Assert; - - $app->get('/validate/{email}', function ($email) use ($app) { - $errors = $app['validator']->validate($email, new Assert\Email()); - - if (count($errors) > 0) { - return (string) $errors; - } else { - return 'The email is valid'; - } - }); - -Validating Associative Arrays -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Validating associative arrays is like validating simple values, with a -collection of constraints:: - - use Symfony\Component\Validator\Constraints as Assert; - - $book = array( - 'title' => 'My Book', - 'author' => array( - 'first_name' => 'Fabien', - 'last_name' => 'Potencier', - ), - ); - - $constraint = new Assert\Collection(array( - 'title' => new Assert\Length(array('min' => 10)), - 'author' => new Assert\Collection(array( - 'first_name' => array(new Assert\NotBlank(), new Assert\Length(array('min' => 10))), - 'last_name' => new Assert\Length(array('min' => 10)), - )), - )); - $errors = $app['validator']->validate($book, $constraint); - - if (count($errors) > 0) { - foreach ($errors as $error) { - echo $error->getPropertyPath().' '.$error->getMessage()."\n"; - } - } else { - echo 'The book is valid'; - } - -Validating Objects -~~~~~~~~~~~~~~~~~~ - -If you want to add validations to a class, you can define the constraint for -the class properties and getters, and then call the ``validate`` method:: - - use Symfony\Component\Validator\Constraints as Assert; - - class Book - { - public $title; - public $author; - } - - class Author - { - public $first_name; - public $last_name; - } - - $author = new Author(); - $author->first_name = 'Fabien'; - $author->last_name = 'Potencier'; - - $book = new Book(); - $book->title = 'My Book'; - $book->author = $author; - - $metadata = $app['validator.mapping.class_metadata_factory']->getMetadataFor('Author'); - $metadata->addPropertyConstraint('first_name', new Assert\NotBlank()); - $metadata->addPropertyConstraint('first_name', new Assert\Length(array('min' => 10))); - $metadata->addPropertyConstraint('last_name', new Assert\Length(array('min' => 10))); - - $metadata = $app['validator.mapping.class_metadata_factory']->getMetadataFor('Book'); - $metadata->addPropertyConstraint('title', new Assert\Length(array('min' => 10))); - $metadata->addPropertyConstraint('author', new Assert\Valid()); - - $errors = $app['validator']->validate($book); - - if (count($errors) > 0) { - foreach ($errors as $error) { - echo $error->getPropertyPath().' '.$error->getMessage()."\n"; - } - } else { - echo 'The author is valid'; - } - -You can also declare the class constraint by adding a static -``loadValidatorMetadata`` method to your classes:: - - use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints as Assert; - - class Book - { - public $title; - public $author; - - static public function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('title', new Assert\Length(array('min' => 10))); - $metadata->addPropertyConstraint('author', new Assert\Valid()); - } - } - - class Author - { - public $first_name; - public $last_name; - - static public function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('first_name', new Assert\NotBlank()); - $metadata->addPropertyConstraint('first_name', new Assert\Length(array('min' => 10))); - $metadata->addPropertyConstraint('last_name', new Assert\Length(array('min' => 10))); - } - } - - $app->get('/validate/{email}', function ($email) use ($app) { - $author = new Author(); - $author->first_name = 'Fabien'; - $author->last_name = 'Potencier'; - - $book = new Book(); - $book->title = 'My Book'; - $book->author = $author; - - $errors = $app['validator']->validate($book); - - if (count($errors) > 0) { - foreach ($errors as $error) { - echo $error->getPropertyPath().' '.$error->getMessage()."\n"; - } - } else { - echo 'The author is valid'; - } - }); - -.. note:: - - Use ``addGetterConstraint()`` to add constraints on getter methods and - ``addConstraint()`` to add constraints on the class itself. - -Translation -~~~~~~~~~~~ - -To be able to translate the error messages, you can use the translator -provider and register the messages under the ``validators`` domain:: - - $app['translator.domains'] = array( - 'validators' => array( - 'fr' => array( - 'This value should be a valid number.' => 'Cette valeur doit être un nombre.', - ), - ), - ); - -For more information, consult the `Symfony Validation documentation -`_. diff --git a/vendor/silex/silex/doc/providers/var_dumper.rst b/vendor/silex/silex/doc/providers/var_dumper.rst deleted file mode 100644 index ea4dd19..0000000 --- a/vendor/silex/silex/doc/providers/var_dumper.rst +++ /dev/null @@ -1,44 +0,0 @@ -Var Dumper -========== - -The *VarDumperServiceProvider* provides a mechanism that allows exploring then -dumping any PHP variable. - -Parameters ----------- - -* **var_dumper.dump_destination**: A stream URL where dumps should be written - to (defaults to ``null``). - -Services --------- - -* n/a - -Registering ------------ - -.. code-block:: php - - $app->register(new Silex\Provider\VarDumperServiceProvider()); - -.. note:: - - Add the Symfony VarDumper Component as a dependency: - - .. code-block:: bash - - composer require symfony/var-dumper - -Usage ------ - -Adding the VarDumper component as a Composer dependency gives you access to the -``dump()`` PHP function anywhere in your code. - -If you are using Twig, it also provides a ``dump()`` Twig function and a -``dump`` Twig tag. - -The VarDumperServiceProvider is also useful when used with the Silex -WebProfiler as the dumps are made available in the web debug toolbar and in the -web profiler. diff --git a/vendor/silex/silex/doc/services.rst b/vendor/silex/silex/doc/services.rst deleted file mode 100644 index 0b34ad3..0000000 --- a/vendor/silex/silex/doc/services.rst +++ /dev/null @@ -1,269 +0,0 @@ -Services -======== - -Silex is not only a framework, it is also a service container. It does this by -extending `Pimple `_ which provides a very simple -service container. - -Dependency Injection --------------------- - -.. note:: - - You can skip this if you already know what Dependency Injection is. - -Dependency Injection is a design pattern where you pass dependencies to -services instead of creating them from within the service or relying on -globals. This generally leads to code that is decoupled, re-usable, flexible -and testable. - -Here is an example of a class that takes a ``User`` object and stores it as a -file in JSON format:: - - class JsonUserPersister - { - private $basePath; - - public function __construct($basePath) - { - $this->basePath = $basePath; - } - - public function persist(User $user) - { - $data = $user->getAttributes(); - $json = json_encode($data); - $filename = $this->basePath.'/'.$user->id.'.json'; - file_put_contents($filename, $json, LOCK_EX); - } - } - -In this simple example the dependency is the ``basePath`` property. It is -passed to the constructor. This means you can create several independent -instances with different base paths. Of course dependencies do not have to be -simple strings. More often they are in fact other services. - -A service container is responsible for creating and storing services. It can -recursively create dependencies of the requested services and inject them. It -does so lazily, which means a service is only created when you actually need it. - -Pimple ------- - -Pimple makes strong use of closures and implements the ArrayAccess interface. - -We will start off by creating a new instance of Pimple -- and because -``Silex\Application`` extends ``Pimple\Container`` all of this applies to Silex -as well:: - - $container = new Pimple\Container(); - -or:: - - $app = new Silex\Application(); - -Parameters -~~~~~~~~~~ - -You can set parameters (which are usually strings) by setting an array key on -the container:: - - $app['some_parameter'] = 'value'; - -The array key can be any value. By convention dots are used for namespacing:: - - $app['asset.host'] = 'http://cdn.mysite.com/'; - -Reading parameter values is possible with the same syntax:: - - echo $app['some_parameter']; - -Service definitions -~~~~~~~~~~~~~~~~~~~ - -Defining services is no different than defining parameters. You just set an -array key on the container to be a closure. However, when you retrieve the -service, the closure is executed. This allows for lazy service creation:: - - $app['some_service'] = function () { - return new Service(); - }; - -And to retrieve the service, use:: - - $service = $app['some_service']; - -On first invocation, this will create the service; the same instance will then -be returned on any subsequent access. - -Factory services -~~~~~~~~~~~~~~~~ - -If you want a different instance to be returned for each service access, wrap -the service definition with the ``factory()`` method:: - - $app['some_service'] = $app->factory(function () { - return new Service(); - }); - -Every time you call ``$app['some_service']``, a new instance of the service is -created. - -Access container from closure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In many cases you will want to access the service container from within a -service definition closure. For example when fetching services the current -service depends on. - -Because of this, the container is passed to the closure as an argument:: - - $app['some_service'] = function ($app) { - return new Service($app['some_other_service'], $app['some_service.config']); - }; - -Here you can see an example of Dependency Injection. ``some_service`` depends -on ``some_other_service`` and takes ``some_service.config`` as configuration -options. The dependency is only created when ``some_service`` is accessed, and -it is possible to replace either of the dependencies by simply overriding -those definitions. - -Going back to our initial example, here's how we could use the container -to manage its dependencies:: - - $app['user.persist_path'] = '/tmp/users'; - $app['user.persister'] = function ($app) { - return new JsonUserPersister($app['user.persist_path']); - }; - - -Protected closures -~~~~~~~~~~~~~~~~~~ - -Because the container sees closures as factories for services, it will always -execute them when reading them. - -In some cases you will however want to store a closure as a parameter, so that -you can fetch it and execute it yourself -- with your own arguments. - -This is why Pimple allows you to protect your closures from being executed, by -using the ``protect`` method:: - - $app['closure_parameter'] = $app->protect(function ($a, $b) { - return $a + $b; - }); - - // will not execute the closure - $add = $app['closure_parameter']; - - // calling it now - echo $add(2, 3); - -Note that the container is not provided as an argument to protected closures. -However, you can inject it via `use($app)`:: - - $app['closure_parameter'] = $app->protect(function ($a, $b) use ($app) { - // ... - }); - -Core services -------------- - -Silex defines a range of services. - -* **request_stack**: Controls the lifecycle of requests, an instance of - `RequestStack `_. - It gives you access to ``GET``, ``POST`` parameters and lots more! - - Example usage:: - - $id = $app['request_stack']->getCurrentRequest()->get('id'); - - A request is only available when a request is being served; you can only - access it from within a controller, an application before/after middlewares, - or an error handler. - -* **routes**: The `RouteCollection - `_ - that is used internally. You can add, modify, read routes. - -* **url_generator**: An instance of `UrlGenerator - `_, - using the `RouteCollection - `_ - that is provided through the ``routes`` service. It has a ``generate`` - method, which takes the route name as an argument, followed by an array of - route parameters. - -* **controllers**: The ``Silex\ControllerCollection`` that is used internally. - Check the :doc:`Internals chapter ` for more information. - -* **dispatcher**: The `EventDispatcher - `_ - that is used internally. It is the core of the Symfony system and is used - quite a bit by Silex. - -* **resolver**: The `ControllerResolver - `_ - that is used internally. It takes care of executing the controller with the - right arguments. - -* **kernel**: The `HttpKernel - `_ - that is used internally. The HttpKernel is the heart of Symfony, it takes a - Request as input and returns a Response as output. - -* **request_context**: The request context is a simplified representation of - the request that is used by the router and the URL generator. - -* **exception_handler**: The Exception handler is the default handler that is - used when you don't register one via the ``error()`` method or if your - handler does not return a Response. Disable it with - ``unset($app['exception_handler'])``. - -* **logger**: A `LoggerInterface `_ instance. By default, logging is - disabled as the value is set to ``null``. To enable logging you can either use - the :doc:`MonologServiceProvider ` or define your own ``logger`` service that - conforms to the PSR logger interface. - -Core traits ------------ - -* ``Silex\Application\UrlGeneratorTrait`` adds the following shortcuts: - - * **path**: Generates a path. - - * **url**: Generates an absolute URL. - - .. code-block:: php - - $app->path('homepage'); - $app->url('homepage'); - -Core parameters ---------------- - -* **request.http_port** (optional): Allows you to override the default port - for non-HTTPS URLs. If the current request is HTTP, it will always use the - current port. - - Defaults to 80. - - This parameter can be used when generating URLs. - -* **request.https_port** (optional): Allows you to override the default port - for HTTPS URLs. If the current request is HTTPS, it will always use the - current port. - - Defaults to 443. - - This parameter can be used when generating URLs. - -* **debug** (optional): Returns whether or not the application is running in - debug mode. - - Defaults to false. - -* **charset** (optional): The charset to use for Responses. - - Defaults to UTF-8. diff --git a/vendor/silex/silex/doc/testing.rst b/vendor/silex/silex/doc/testing.rst deleted file mode 100644 index 17f5f57..0000000 --- a/vendor/silex/silex/doc/testing.rst +++ /dev/null @@ -1,222 +0,0 @@ -Testing -======= - -Because Silex is built on top of Symfony, it is very easy to write functional -tests for your application. Functional tests are automated software tests that -ensure that your code is working correctly. They go through the user interface, -using a fake browser, and mimic the actions a user would do. - -Why ---- - -If you are not familiar with software tests, you may be wondering why you would -need this. Every time you make a change to your application, you have to test -it. This means going through all the pages and making sure they are still -working. Functional tests save you a lot of time, because they enable you to -test your application in usually under a second by running a single command. - -For more information on functional testing, unit testing, and automated -software tests in general, check out `PHPUnit -`_ and `Bulat Shakirzyanov's talk -on Clean Code `_. - -PHPUnit -------- - -`PHPUnit `_ is the de-facto -standard testing framework for PHP. It was built for writing unit tests, but it -can be used for functional tests too. You write tests by creating a new class, -that extends the ``PHPUnit_Framework_TestCase``. Your test cases are methods -prefixed with ``test``:: - - class ContactFormTest extends \PHPUnit_Framework_TestCase - { - public function testInitialPage() - { - ... - } - } - -In your test cases, you do assertions on the state of what you are testing. In -this case we are testing a contact form, so we would want to assert that the -page loaded correctly and contains our form:: - - public function testInitialPage() - { - $statusCode = ... - $pageContent = ... - - $this->assertEquals(200, $statusCode); - $this->assertContains('Contact us', $pageContent); - $this->assertContains('`_ -section of the PHPUnit documentation. - -WebTestCase ------------ - -Symfony provides a WebTestCase class that can be used to write functional -tests. The Silex version of this class is ``Silex\WebTestCase``, and you can -use it by making your test extend it:: - - use Silex\WebTestCase; - - class ContactFormTest extends WebTestCase - { - ... - } - -.. caution:: - - If you need to override the ``setUp()`` method, don't forget to call the - parent (``parent::setUp()``) to call the Silex default setup. - -.. note:: - - If you want to use the Symfony ``WebTestCase`` class you will need to - explicitly install its dependencies for your project: - - .. code-block:: bash - - composer require --dev symfony/browser-kit symfony/css-selector - -For your WebTestCase, you will have to implement a ``createApplication`` -method, which returns your application instance:: - - public function createApplication() - { - // app.php must return an Application instance - return require __DIR__.'/path/to/app.php'; - } - -Make sure you do **not** use ``require_once`` here, as this method will be -executed before every test. - -.. tip:: - - By default, the application behaves in the same way as when using it from a - browser. But when an error occurs, it is sometimes easier to get raw - exceptions instead of HTML pages. It is rather simple if you tweak the - application configuration in the ``createApplication()`` method like - follows:: - - public function createApplication() - { - $app = require __DIR__.'/path/to/app.php'; - $app['debug'] = true; - unset($app['exception_handler']); - - return $app; - } - -.. tip:: - - If your application use sessions, set ``session.test`` to ``true`` to - simulate sessions:: - - public function createApplication() - { - // ... - - $app['session.test'] = true; - - // ... - } - -The WebTestCase provides a ``createClient`` method. A client acts as a browser, -and allows you to interact with your application. Here's how it works:: - - public function testInitialPage() - { - $client = $this->createClient(); - $crawler = $client->request('GET', '/'); - - $this->assertTrue($client->getResponse()->isOk()); - $this->assertCount(1, $crawler->filter('h1:contains("Contact us")')); - $this->assertCount(1, $crawler->filter('form')); - ... - } - -There are several things going on here. You have both a ``Client`` and a -``Crawler``. - -You can also access the application through ``$this->app``. - -Client -~~~~~~ - -The client represents a browser. It holds your browsing history, cookies and -more. The ``request`` method allows you to make a request to a page on your -application. - -.. note:: - - You can find some documentation for it in `the client section of the - testing chapter of the Symfony documentation - `_. - -Crawler -~~~~~~~ - -The crawler allows you to inspect the content of a page. You can filter it -using CSS expressions and lots more. - -.. note:: - - You can find some documentation for it in `the crawler section of the testing - chapter of the Symfony documentation - `_. - -Configuration -------------- - -The suggested way to configure PHPUnit is to create a ``phpunit.xml.dist`` -file, a ``tests`` folder and your tests in -``tests/YourApp/Tests/YourTest.php``. The ``phpunit.xml.dist`` file should -look like this: - -.. code-block:: xml - - - - - - ./tests/ - - - - -Your ``tests/YourApp/Tests/YourTest.php`` should look like this:: - - namespace YourApp\Tests; - - use Silex\WebTestCase; - - class YourTest extends WebTestCase - { - public function createApplication() - { - return require __DIR__.'/../../../app.php'; - } - - public function testFooBar() - { - ... - } - } - -Now, when running ``phpunit`` on the command line, tests should run. diff --git a/vendor/silex/silex/doc/usage.rst b/vendor/silex/silex/doc/usage.rst deleted file mode 100644 index 724254c..0000000 --- a/vendor/silex/silex/doc/usage.rst +++ /dev/null @@ -1,799 +0,0 @@ -Usage -===== - -Installation ------------- - -If you want to get started fast, use the `Silex Skeleton`_: - -.. code-block:: bash - - composer create-project fabpot/silex-skeleton path/to/install "~2.0" - -If you want more flexibility, use Composer_ instead: - -.. code-block:: bash - - composer require silex/silex:~2.0 - -Web Server ----------- - -All examples in the documentation rely on a well-configured web server; read -the :doc:`webserver documentation` to check yours. - -Bootstrap ---------- - -To bootstrap Silex, all you need to do is require the ``vendor/autoload.php`` -file and create an instance of ``Silex\Application``. After your controller -definitions, call the ``run`` method on your application:: - - // web/index.php - require_once __DIR__.'/../vendor/autoload.php'; - - $app = new Silex\Application(); - - // ... definitions - - $app->run(); - -.. tip:: - - When developing a website, you might want to turn on the debug mode to - ease debugging:: - - $app['debug'] = true; - -.. tip:: - - If your application is hosted behind a reverse proxy at address ``$ip``, - and you want Silex to trust the ``X-Forwarded-For*`` headers, you will - need to run your application like this:: - - use Symfony\Component\HttpFoundation\Request; - - Request::setTrustedProxies(array($ip)); - $app->run(); - -Routing -------- - -In Silex you define a route and the controller that is called when that -route is matched. A route pattern consists of: - -* *Pattern*: The route pattern defines a path that points to a resource. The - pattern can include variable parts and you are able to set RegExp - requirements for them. - -* *Method*: One of the following HTTP methods: ``GET``, ``POST``, ``PUT``, - ``DELETE``, ``PATCH``, or ``OPTIONS``. This describes the interaction with - the resource. - -The controller is defined using a closure like this:: - - function () { - // ... do something - } - -The return value of the closure becomes the content of the page. - -Example GET Route -~~~~~~~~~~~~~~~~~ - -Here is an example definition of a ``GET`` route:: - - $blogPosts = array( - 1 => array( - 'date' => '2011-03-29', - 'author' => 'igorw', - 'title' => 'Using Silex', - 'body' => '...', - ), - ); - - $app->get('/blog', function () use ($blogPosts) { - $output = ''; - foreach ($blogPosts as $post) { - $output .= $post['title']; - $output .= '
    '; - } - - return $output; - }); - -Visiting ``/blog`` will return a list of blog post titles. The ``use`` -statement means something different in this context. It tells the closure to -import the ``$blogPosts`` variable from the outer scope. This allows you to use -it from within the closure. - -Dynamic Routing -~~~~~~~~~~~~~~~ - -Now, you can create another controller for viewing individual blog posts:: - - $app->get('/blog/{id}', function (Silex\Application $app, $id) use ($blogPosts) { - if (!isset($blogPosts[$id])) { - $app->abort(404, "Post $id does not exist."); - } - - $post = $blogPosts[$id]; - - return "

    {$post['title']}

    ". - "

    {$post['body']}

    "; - }); - -This route definition has a variable ``{id}`` part which is passed to the -closure. - -The current ``Application`` is automatically injected by Silex to the Closure -thanks to the type hinting. - -When the post does not exist, you are using ``abort()`` to stop the request -early. It actually throws an exception, which you will see how to handle later -on. - -Example POST Route -~~~~~~~~~~~~~~~~~~ - -POST routes signify the creation of a resource. An example for this is a -feedback form. You will use the ``mail`` function to send an e-mail:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpFoundation\Response; - - $app->post('/feedback', function (Request $request) { - $message = $request->get('message'); - mail('feedback@yoursite.com', '[YourSite] Feedback', $message); - - return new Response('Thank you for your feedback!', 201); - }); - -It is pretty straightforward. - -.. note:: - - There is a :doc:`SwiftmailerServiceProvider ` - included that you can use instead of ``mail()``. - -The current ``request`` is automatically injected by Silex to the Closure -thanks to the type hinting. It is an instance of -Request_, so you can fetch variables using the request ``get`` method. - -Instead of returning a string you are returning an instance of Response_. -This allows setting an HTTP status code, in this case it is set to -``201 Created``. - -.. note:: - - Silex always uses a ``Response`` internally, it converts strings to - responses with status code ``200``. - -Other methods -~~~~~~~~~~~~~ - -You can create controllers for most HTTP methods. Just call one of these -methods on your application: ``get``, ``post``, ``put``, ``delete``, ``patch``, ``options``:: - - $app->put('/blog/{id}', function ($id) { - // ... - }); - - $app->delete('/blog/{id}', function ($id) { - // ... - }); - - $app->patch('/blog/{id}', function ($id) { - // ... - }); - -.. tip:: - - Forms in most web browsers do not directly support the use of other HTTP - methods. To use methods other than GET and POST you can utilize a special - form field with a name of ``_method``. The form's ``method`` attribute must - be set to POST when using this field: - - .. code-block:: html - -
    - - -
    - - You need to explicitly enable this method override:: - - use Symfony\Component\HttpFoundation\Request; - - Request::enableHttpMethodParameterOverride(); - $app->run(); - -You can also call ``match``, which will match all methods. This can be -restricted via the ``method`` method:: - - $app->match('/blog', function () { - // ... - }); - - $app->match('/blog', function () { - // ... - }) - ->method('PATCH'); - - $app->match('/blog', function () { - // ... - }) - ->method('PUT|POST'); - -.. note:: - - The order in which the routes are defined is significant. The first - matching route will be used, so place more generic routes at the bottom. - -Route Variables -~~~~~~~~~~~~~~~ - -As it has been shown before you can define variable parts in a route like -this:: - - $app->get('/blog/{id}', function ($id) { - // ... - }); - -It is also possible to have more than one variable part, just make sure the -closure arguments match the names of the variable parts:: - - $app->get('/blog/{postId}/{commentId}', function ($postId, $commentId) { - // ... - }); - -While it's not recommended, you could also do this (note the switched -arguments):: - - $app->get('/blog/{postId}/{commentId}', function ($commentId, $postId) { - // ... - }); - -You can also ask for the current Request and Application objects:: - - $app->get('/blog/{id}', function (Application $app, Request $request, $id) { - // ... - }); - -.. note:: - - Note for the Application and Request objects, Silex does the injection - based on the type hinting and not on the variable name:: - - $app->get('/blog/{id}', function (Application $foo, Request $bar, $id) { - // ... - }); - -Route Variable Converters -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Before injecting the route variables into the controller, you can apply some -converters:: - - $app->get('/user/{id}', function ($id) { - // ... - })->convert('id', function ($id) { return (int) $id; }); - -This is useful when you want to convert route variables to objects as it -allows to reuse the conversion code across different controllers:: - - $userProvider = function ($id) { - return new User($id); - }; - - $app->get('/user/{user}', function (User $user) { - // ... - })->convert('user', $userProvider); - - $app->get('/user/{user}/edit', function (User $user) { - // ... - })->convert('user', $userProvider); - -The converter callback also receives the ``Request`` as its second argument:: - - $callback = function ($post, Request $request) { - return new Post($request->attributes->get('slug')); - }; - - $app->get('/blog/{id}/{slug}', function (Post $post) { - // ... - })->convert('post', $callback); - -A converter can also be defined as a service. For example, here is a user -converter based on Doctrine ObjectManager:: - - use Doctrine\Common\Persistence\ObjectManager; - use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - - class UserConverter - { - private $om; - - public function __construct(ObjectManager $om) - { - $this->om = $om; - } - - public function convert($id) - { - if (null === $user = $this->om->find('User', (int) $id)) { - throw new NotFoundHttpException(sprintf('User %d does not exist', $id)); - } - - return $user; - } - } - -The service will now be registered in the application, and the -``convert()`` method will be used as converter (using the syntax -``service_name:method_name``):: - - $app['converter.user'] = function () { - return new UserConverter(); - }; - - $app->get('/user/{user}', function (User $user) { - // ... - })->convert('user', 'converter.user:convert'); - -Requirements -~~~~~~~~~~~~ - -In some cases you may want to only match certain expressions. You can define -requirements using regular expressions by calling ``assert`` on the -``Controller`` object, which is returned by the routing methods. - -The following will make sure the ``id`` argument is a positive integer, since -``\d+`` matches any amount of digits:: - - $app->get('/blog/{id}', function ($id) { - // ... - }) - ->assert('id', '\d+'); - -You can also chain these calls:: - - $app->get('/blog/{postId}/{commentId}', function ($postId, $commentId) { - // ... - }) - ->assert('postId', '\d+') - ->assert('commentId', '\d+'); - -Conditions -~~~~~~~~~~ - -Besides restricting route matching based on the HTTP method or parameter -requirements, you can set conditions on any part of the request by calling -``when`` on the ``Controller`` object, which is returned by the routing -methods:: - - $app->get('/blog/{id}', function ($id) { - // ... - }) - ->when("request.headers.get('User-Agent') matches '/firefox/i'"); - -The ``when`` argument is a Symfony Expression_ , which means that you need to -add ``symfony/expression-language`` as a dependency of your project. - -Default Values -~~~~~~~~~~~~~~ - -You can define a default value for any route variable by calling ``value`` on -the ``Controller`` object:: - - $app->get('/{pageName}', function ($pageName) { - // ... - }) - ->value('pageName', 'index'); - -This will allow matching ``/``, in which case the ``pageName`` variable will -have the value ``index``. - -Named Routes -~~~~~~~~~~~~ - -Some providers can make use of named routes. By default Silex will generate an -internal route name for you but you can give an explicit route name by calling -``bind``:: - - $app->get('/', function () { - // ... - }) - ->bind('homepage'); - - $app->get('/blog/{id}', function ($id) { - // ... - }) - ->bind('blog_post'); - -Controllers as Classes -~~~~~~~~~~~~~~~~~~~~~~ - -Instead of anonymous functions, you can also define your controllers as -methods. By using the ``ControllerClass::methodName`` syntax, you can tell -Silex to lazily create the controller object for you:: - - $app->get('/', 'Acme\\Foo::bar'); - - use Silex\Application; - use Symfony\Component\HttpFoundation\Request; - - namespace Acme - { - class Foo - { - public function bar(Request $request, Application $app) - { - // ... - } - } - } - -This will load the ``Acme\Foo`` class on demand, create an instance and call -the ``bar`` method to get the response. You can use ``Request`` and -``Silex\Application`` type hints to get ``$request`` and ``$app`` injected. - -It is also possible to :doc:`define your controllers as services -`. - -Global Configuration --------------------- - -If a controller setting must be applied to **all** controllers (a converter, a -middleware, a requirement, or a default value), configure it on -``$app['controllers']``, which holds all application controllers:: - - $app['controllers'] - ->value('id', '1') - ->assert('id', '\d+') - ->requireHttps() - ->method('get') - ->convert('id', function () { /* ... */ }) - ->before(function () { /* ... */ }) - ->when('request.isSecure() == true') - ; - -These settings are applied to already registered controllers and they become -the defaults for new controllers. - -.. note:: - - The global configuration does not apply to controller providers you might - mount as they have their own global configuration (read the - :doc:`dedicated chapter` for more information). - -Error Handlers --------------- - -When an exception is thrown, error handlers allow you to display a custom -error page to the user. They can also be used to do additional things, such as -logging. - -To register an error handler, pass a closure to the ``error`` method which -takes an ``Exception`` argument and returns a response:: - - use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\HttpFoundation\Request; - - $app->error(function (\Exception $e, Request $request, $code) { - return new Response('We are sorry, but something went terribly wrong.'); - }); - -You can also check for specific errors by using the ``$code`` argument, and -handle them differently:: - - use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\HttpFoundation\Request; - - $app->error(function (\Exception $e, Request $request, $code) { - switch ($code) { - case 404: - $message = 'The requested page could not be found.'; - break; - default: - $message = 'We are sorry, but something went terribly wrong.'; - } - - return new Response($message); - }); - -You can restrict an error handler to only handle some Exception classes by -setting a more specific type hint for the Closure argument:: - - use Symfony\Component\HttpFoundation\Request; - - $app->error(function (\LogicException $e, Request $request, $code) { - // this handler will only handle \LogicException exceptions - // and exceptions that extend \LogicException - }); - -.. note:: - - As Silex ensures that the Response status code is set to the most - appropriate one depending on the exception, setting the status on the - response won't work. If you want to overwrite the status code, set the - ``X-Status-Code`` header:: - - return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200)); - -If you want to use a separate error handler for logging, make sure you register -it with a higher priority than response error handlers, because once a response -is returned, the following handlers are ignored. - -.. note:: - - Silex ships with a provider for Monolog_ which handles logging of errors. - Check out the *Providers* :doc:`chapter ` for details. - -.. tip:: - - Silex comes with a default error handler that displays a detailed error - message with the stack trace when **debug** is true, and a simple error - message otherwise. Error handlers registered via the ``error()`` method - always take precedence but you can keep the nice error messages when debug - is turned on like this:: - - use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\HttpFoundation\Request; - - $app->error(function (\Exception $e, Request $request, $code) use ($app) { - if ($app['debug']) { - return; - } - - // ... logic to handle the error and return a Response - }); - -The error handlers are also called when you use ``abort`` to abort a request -early:: - - $app->get('/blog/{id}', function (Silex\Application $app, $id) use ($blogPosts) { - if (!isset($blogPosts[$id])) { - $app->abort(404, "Post $id does not exist."); - } - - return new Response(...); - }); - -You can convert errors to ``Exceptions``, check out the cookbook :doc:`chapter ` for details. - -View Handlers -------------- - -View Handlers allow you to intercept a controller result that is not a -``Response`` and transform it before it gets returned to the kernel. - -To register a view handler, pass a callable (or string that can be resolved to a -callable) to the ``view()`` method. The callable should accept some sort of result -from the controller:: - - $app->view(function (array $controllerResult) use ($app) { - return $app->json($controllerResult); - }); - -View Handlers also receive the ``Request`` as their second argument, -making them a good candidate for basic content negotiation:: - - $app->view(function (array $controllerResult, Request $request) use ($app) { - $acceptHeader = $request->headers->get('Accept'); - $bestFormat = $app['negotiator']->getBestFormat($acceptHeader, array('json', 'xml')); - - if ('json' === $bestFormat) { - return new JsonResponse($controllerResult); - } - - if ('xml' === $bestFormat) { - return $app['serializer.xml']->renderResponse($controllerResult); - } - - return $controllerResult; - }); - -View Handlers will be examined in the order they are added to the application -and Silex will use type hints to determine if a view handler should be used for -the current result, continuously using the return value of the last view handler -as the input for the next. - -.. note:: - - You must ensure that Silex receives a ``Response`` or a string as the result of - the last view handler (or controller) to be run. - -Redirects ---------- - -You can redirect to another page by returning a ``RedirectResponse`` response, -which you can create by calling the ``redirect`` method:: - - $app->get('/', function () use ($app) { - return $app->redirect('/hello'); - }); - -This will redirect from ``/`` to ``/hello``. - -Forwards --------- - -When you want to delegate the rendering to another controller, without a -round-trip to the browser (as for a redirect), use an internal sub-request:: - - use Symfony\Component\HttpFoundation\Request; - use Symfony\Component\HttpKernel\HttpKernelInterface; - - $app->get('/', function () use ($app) { - // forward to /hello - $subRequest = Request::create('/hello', 'GET'); - - return $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST); - }); - -.. tip:: - - You can also generate the URI via the built-in URL generator:: - - $request = Request::create($app['url_generator']->generate('hello'), 'GET'); - -There's some more things that you need to keep in mind though. In most cases you -will want to forward some parts of the current master request to the sub-request. -That includes: Cookies, server information, session. -Read more on :doc:`how to make sub-requests `. - -JSON ----- - -If you want to return JSON data, you can use the ``json`` helper method. -Simply pass it your data, status code and headers, and it will create a JSON -response for you:: - - $app->get('/users/{id}', function ($id) use ($app) { - $user = getUser($id); - - if (!$user) { - $error = array('message' => 'The user was not found.'); - - return $app->json($error, 404); - } - - return $app->json($user); - }); - -Streaming ---------- - -It's possible to stream a response, which is important in cases when you don't -want to buffer the data being sent:: - - $app->get('/images/{file}', function ($file) use ($app) { - if (!file_exists(__DIR__.'/images/'.$file)) { - return $app->abort(404, 'The image was not found.'); - } - - $stream = function () use ($file) { - readfile($file); - }; - - return $app->stream($stream, 200, array('Content-Type' => 'image/png')); - }); - -If you need to send chunks, make sure you call ``ob_flush`` and ``flush`` -after every chunk:: - - $stream = function () { - $fh = fopen('http://www.example.com/', 'rb'); - while (!feof($fh)) { - echo fread($fh, 1024); - ob_flush(); - flush(); - } - fclose($fh); - }; - -Sending a file --------------- - -If you want to return a file, you can use the ``sendFile`` helper method. -It eases returning files that would otherwise not be publicly available. Simply -pass it your file path, status code, headers and the content disposition and it -will create a ``BinaryFileResponse`` response for you:: - - $app->get('/files/{path}', function ($path) use ($app) { - if (!file_exists('/base/path/' . $path)) { - $app->abort(404); - } - - return $app->sendFile('/base/path/' . $path); - }); - -To further customize the response before returning it, check the API doc for -`Symfony\Component\HttpFoundation\BinaryFileResponse -`_:: - - return $app - ->sendFile('/base/path/' . $path) - ->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'pic.jpg') - ; - -Traits ------- - -Silex comes with PHP traits that define shortcut methods. - -Almost all built-in service providers have some corresponding PHP traits. To -use them, define your own Application class and include the traits you want:: - - use Silex\Application; - - class MyApplication extends Application - { - use Application\TwigTrait; - use Application\SecurityTrait; - use Application\FormTrait; - use Application\UrlGeneratorTrait; - use Application\SwiftmailerTrait; - use Application\MonologTrait; - use Application\TranslationTrait; - } - -You can also define your own Route class and use some traits:: - - use Silex\Route; - - class MyRoute extends Route - { - use Route\SecurityTrait; - } - -To use your newly defined route, override the ``$app['route_class']`` -setting:: - - $app['route_class'] = 'MyRoute'; - -Read each provider chapter to learn more about the added methods. - -Security --------- - -Make sure to protect your application against attacks. - -Escaping -~~~~~~~~ - -When outputting any user input, make sure to escape it correctly to prevent -Cross-Site-Scripting attacks. - -* **Escaping HTML**: PHP provides the ``htmlspecialchars`` function for this. - Silex provides a shortcut ``escape`` method:: - - use Symfony\Component\HttpFoundation\Request; - - $app->get('/name', function (Request $request, Silex\Application $app) { - $name = $request->get('name'); - - return "You provided the name {$app->escape($name)}."; - }); - - If you use the Twig template engine, you should use its escaping or even - auto-escaping mechanisms. Check out the *Providers* :doc:`chapter ` for details. - -* **Escaping JSON**: If you want to provide data in JSON format you should - use the Silex ``json`` function:: - - use Symfony\Component\HttpFoundation\Request; - - $app->get('/name.json', function (Request $request, Silex\Application $app) { - $name = $request->get('name'); - - return $app->json(array('name' => $name)); - }); - -.. _Silex Skeleton: http://github.com/silexphp/Silex-Skeleton -.. _Composer: http://getcomposer.org/ -.. _Request: http://api.symfony.com/master/Symfony/Component/HttpFoundation/Request.html -.. _Response: http://api.symfony.com/master/Symfony/Component/HttpFoundation/Response.html -.. _Monolog: https://github.com/Seldaek/monolog -.. _Expression: https://symfony.com/doc/current/book/routing.html#completely-customized-route-matching-with-conditions diff --git a/vendor/silex/silex/doc/web_servers.rst b/vendor/silex/silex/doc/web_servers.rst deleted file mode 100644 index c3d43aa..0000000 --- a/vendor/silex/silex/doc/web_servers.rst +++ /dev/null @@ -1,183 +0,0 @@ -Webserver Configuration -======================= - -Apache ------- - -If you are using Apache, make sure ``mod_rewrite`` is enabled and use the -following ``.htaccess`` file: - -.. code-block:: apache - - - Options -MultiViews - - RewriteEngine On - #RewriteBase /path/to/app - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [QSA,L] - - -.. note:: - - If your site is not at the webroot level you will have to uncomment the - ``RewriteBase`` statement and adjust the path to point to your directory, - relative from the webroot. - -Alternatively, if you use Apache 2.2.16 or higher, you can use the -`FallbackResource directive`_ to make your .htaccess even easier: - -.. code-block:: apache - - FallbackResource index.php - -.. note:: - - If your site is not at the webroot level you will have to adjust the path to - point to your directory, relative from the webroot. - -Or if you're using a VirtualHost, you can add the same directive to the VirtualHost's Directory entry: - -.. code-block:: apache - - - # other directives - - - # other directives - - FallbackResource /index.php - - - -.. note:: - - Note that you need the leading forward slash there, unlike with the .htaccess version - -nginx ------ - -The **minimum configuration** to get your application running under Nginx is: - -.. code-block:: nginx - - server { - server_name domain.tld www.domain.tld; - root /var/www/project/web; - - location / { - # try to serve file directly, fallback to front controller - try_files $uri /index.php$is_args$args; - } - - # If you have 2 front controllers for dev|prod use the following line instead - # location ~ ^/(index|index_dev)\.php(/|$) { - location ~ ^/index\.php(/|$) { - # the ubuntu default - fastcgi_pass unix:/var/run/php/phpX.X-fpm.sock; - # for running on centos - #fastcgi_pass unix:/var/run/php-fpm/www.sock; - - fastcgi_split_path_info ^(.+\.php)(/.*)$; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param HTTPS off; - - # Prevents URIs that include the front controller. This will 404: - # http://domain.tld/index.php/some-path - # Enable the internal directive to disable URIs like this - # internal; - } - - #return 404 for all php files as we do have a front controller - location ~ \.php$ { - return 404; - } - - error_log /var/log/nginx/project_error.log; - access_log /var/log/nginx/project_access.log; - } - -IIS ---- - -If you are using the Internet Information Services from Windows, you can use -this sample ``web.config`` file: - -.. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - -Lighttpd --------- - -If you are using lighttpd, use this sample ``simple-vhost`` as a starting -point: - -.. code-block:: lighttpd - - server.document-root = "/path/to/app" - - url.rewrite-once = ( - # configure some static files - "^/assets/.+" => "$0", - "^/favicon\.ico$" => "$0", - - "^(/[^\?]*)(\?.*)?" => "/index.php$1$2" - ) - -.. _FallbackResource directive: http://www.adayinthelifeof.nl/2012/01/21/apaches-fallbackresource-your-new-htaccess-command/ - -PHP ---- - -PHP ships with a built-in webserver for development. This server allows you to -run silex without any configuration. However, in order to serve static files, -you'll have to make sure your front controller returns false in that case:: - - // web/index.php - - $filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']); - if (php_sapi_name() === 'cli-server' && is_file($filename)) { - return false; - } - - $app = require __DIR__.'/../src/app.php'; - $app->run(); - - -Assuming your front controller is at ``web/index.php``, you can start the -server from the command-line with this command: - -.. code-block:: text - - $ php -S localhost:8080 -t web web/index.php - -Now the application should be running at ``http://localhost:8080``. - -.. note:: - - This server is for development only. It is **not** recommended to use it - in production. diff --git a/vendor/silex/silex/phpunit.xml.dist b/vendor/silex/silex/phpunit.xml.dist deleted file mode 100644 index 799f16c..0000000 --- a/vendor/silex/silex/phpunit.xml.dist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - ./tests/Silex/ - - - - - ./src - - - diff --git a/vendor/silex/silex/src/Silex/Api/BootableProviderInterface.php b/vendor/silex/silex/src/Silex/Api/BootableProviderInterface.php deleted file mode 100644 index 739e04d..0000000 --- a/vendor/silex/silex/src/Silex/Api/BootableProviderInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Api; - -use Silex\Application; - -/** - * Interface for bootable service providers. - * - * @author Fabien Potencier - */ -interface BootableProviderInterface -{ - /** - * Bootstraps the application. - * - * This method is called after all services are registered - * and should be used for "dynamic" configuration (whenever - * a service must be requested). - * - * @param Application $app - */ - public function boot(Application $app); -} diff --git a/vendor/silex/silex/src/Silex/Api/ControllerProviderInterface.php b/vendor/silex/silex/src/Silex/Api/ControllerProviderInterface.php deleted file mode 100644 index 28d9d0e..0000000 --- a/vendor/silex/silex/src/Silex/Api/ControllerProviderInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Api; - -use Silex\Application; -use Silex\ControllerCollection; - -/** - * Interface for controller providers. - * - * @author Fabien Potencier - */ -interface ControllerProviderInterface -{ - /** - * Returns routes to connect to the given application. - * - * @param Application $app An Application instance - * - * @return ControllerCollection A ControllerCollection instance - */ - public function connect(Application $app); -} diff --git a/vendor/silex/silex/src/Silex/Api/EventListenerProviderInterface.php b/vendor/silex/silex/src/Silex/Api/EventListenerProviderInterface.php deleted file mode 100644 index f3e6255..0000000 --- a/vendor/silex/silex/src/Silex/Api/EventListenerProviderInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Api; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Pimple\Container; - -/** - * Interface for event listener providers. - * - * @author Fabien Potencier - */ -interface EventListenerProviderInterface -{ - public function subscribe(Container $app, EventDispatcherInterface $dispatcher); -} diff --git a/vendor/silex/silex/src/Silex/Api/LICENSE b/vendor/silex/silex/src/Silex/Api/LICENSE deleted file mode 100644 index bc6ad04..0000000 --- a/vendor/silex/silex/src/Silex/Api/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/silex/silex/src/Silex/Api/composer.json b/vendor/silex/silex/src/Silex/Api/composer.json deleted file mode 100644 index 7290988..0000000 --- a/vendor/silex/silex/src/Silex/Api/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "minimum-stability": "dev", - "name": "silex/api", - "description": "The Silex interfaces", - "keywords": ["microframework"], - "homepage": "http://silex.sensiolabs.org", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "require": { - "php": ">=5.5.9", - "pimple/pimple": "~3.0" - }, - "suggest": { - "symfony/event-dispatcher": "For EventListenerProviderInterface", - "silex/silex": "For BootableProviderInterface and ControllerProviderInterface" - }, - "autoload": { - "psr-4": { "Silex\\Api\\": "" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - } -} diff --git a/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php b/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php deleted file mode 100644 index cc2197a..0000000 --- a/vendor/silex/silex/src/Silex/AppArgumentValueResolver.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * HttpKernel Argument Resolver for Silex. - * - * @author Romain Neutron - */ -class AppArgumentValueResolver implements ArgumentValueResolverInterface -{ - private $app; - - public function __construct(Application $app) - { - $this->app = $app; - } - - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return null !== $argument->getType() && ($argument->getType() === Application::class || is_subclass_of($argument->getType(), Application::class)); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $this->app; - } -} diff --git a/vendor/silex/silex/src/Silex/Application.php b/vendor/silex/silex/src/Silex/Application.php deleted file mode 100644 index c3b751b..0000000 --- a/vendor/silex/silex/src/Silex/Application.php +++ /dev/null @@ -1,506 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\BinaryFileResponse; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\JsonResponse; -use Silex\Api\BootableProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Silex\Api\ControllerProviderInterface; -use Silex\Provider\ExceptionHandlerServiceProvider; -use Silex\Provider\RoutingServiceProvider; -use Silex\Provider\HttpKernelServiceProvider; - -/** - * The Silex framework class. - * - * @author Fabien Potencier - */ -class Application extends Container implements HttpKernelInterface, TerminableInterface -{ - const VERSION = '2.2.0-DEV'; - - const EARLY_EVENT = 512; - const LATE_EVENT = -512; - - protected $providers = array(); - protected $booted = false; - - /** - * Instantiate a new Application. - * - * Objects and parameters can be passed as argument to the constructor. - * - * @param array $values The parameters or objects. - */ - public function __construct(array $values = array()) - { - parent::__construct(); - - $this['request.http_port'] = 80; - $this['request.https_port'] = 443; - $this['debug'] = false; - $this['charset'] = 'UTF-8'; - $this['logger'] = null; - - $this->register(new HttpKernelServiceProvider()); - $this->register(new RoutingServiceProvider()); - $this->register(new ExceptionHandlerServiceProvider()); - - foreach ($values as $key => $value) { - $this[$key] = $value; - } - } - - /** - * Registers a service provider. - * - * @param ServiceProviderInterface $provider A ServiceProviderInterface instance - * @param array $values An array of values that customizes the provider - * - * @return Application - */ - public function register(ServiceProviderInterface $provider, array $values = array()) - { - $this->providers[] = $provider; - - parent::register($provider, $values); - - return $this; - } - - /** - * Boots all service providers. - * - * This method is automatically called by handle(), but you can use it - * to boot all service providers when not handling a request. - */ - public function boot() - { - if ($this->booted) { - return; - } - - $this->booted = true; - - foreach ($this->providers as $provider) { - if ($provider instanceof EventListenerProviderInterface) { - $provider->subscribe($this, $this['dispatcher']); - } - - if ($provider instanceof BootableProviderInterface) { - $provider->boot($this); - } - } - } - - /** - * Maps a pattern to a callable. - * - * You can optionally specify HTTP methods that should be matched. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function match($pattern, $to = null) - { - return $this['controllers']->match($pattern, $to); - } - - /** - * Maps a GET request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function get($pattern, $to = null) - { - return $this['controllers']->get($pattern, $to); - } - - /** - * Maps a POST request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function post($pattern, $to = null) - { - return $this['controllers']->post($pattern, $to); - } - - /** - * Maps a PUT request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function put($pattern, $to = null) - { - return $this['controllers']->put($pattern, $to); - } - - /** - * Maps a DELETE request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function delete($pattern, $to = null) - { - return $this['controllers']->delete($pattern, $to); - } - - /** - * Maps an OPTIONS request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function options($pattern, $to = null) - { - return $this['controllers']->options($pattern, $to); - } - - /** - * Maps a PATCH request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function patch($pattern, $to = null) - { - return $this['controllers']->patch($pattern, $to); - } - - /** - * Adds an event listener that listens on the specified events. - * - * @param string $eventName The event to listen on - * @param callable $callback The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function on($eventName, $callback, $priority = 0) - { - if ($this->booted) { - $this['dispatcher']->addListener($eventName, $this['callback_resolver']->resolveCallback($callback), $priority); - - return; - } - - $this->extend('dispatcher', function (EventDispatcherInterface $dispatcher, $app) use ($callback, $priority, $eventName) { - $dispatcher->addListener($eventName, $app['callback_resolver']->resolveCallback($callback), $priority); - - return $dispatcher; - }); - } - - /** - * Registers a before filter. - * - * Before filters are run before any route has been matched. - * - * @param mixed $callback Before filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function before($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($callback, $app) { - if (!$event->isMasterRequest()) { - return; - } - - $ret = call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $app); - - if ($ret instanceof Response) { - $event->setResponse($ret); - } - }, $priority); - } - - /** - * Registers an after filter. - * - * After filters are run after the controller has been executed. - * - * @param mixed $callback After filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function after($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::RESPONSE, function (FilterResponseEvent $event) use ($callback, $app) { - if (!$event->isMasterRequest()) { - return; - } - - $response = call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $event->getResponse(), $app); - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - throw new \RuntimeException('An after middleware returned an invalid response value. Must return null or an instance of Response.'); - } - }, $priority); - } - - /** - * Registers a finish filter. - * - * Finish filters are run after the response has been sent. - * - * @param mixed $callback Finish filter callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function finish($callback, $priority = 0) - { - $app = $this; - - $this->on(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($callback, $app) { - call_user_func($app['callback_resolver']->resolveCallback($callback), $event->getRequest(), $event->getResponse(), $app); - }, $priority); - } - - /** - * Aborts the current request by sending a proper HTTP error. - * - * @param int $statusCode The HTTP status code - * @param string $message The status message - * @param array $headers An array of HTTP headers - */ - public function abort($statusCode, $message = '', array $headers = array()) - { - throw new HttpException($statusCode, $message, null, $headers); - } - - /** - * Registers an error handler. - * - * Error handlers are simple callables which take a single Exception - * as an argument. If a controller throws an exception, an error handler - * can return a specific response. - * - * When an exception occurs, all handlers will be called, until one returns - * something (a string or a Response object), at which point that will be - * returned to the client. - * - * For this reason you should add logging handlers before output handlers. - * - * @param mixed $callback Error handler callback, takes an Exception argument - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to -8) - */ - public function error($callback, $priority = -8) - { - $this->on(KernelEvents::EXCEPTION, new ExceptionListenerWrapper($this, $callback), $priority); - } - - /** - * Registers a view handler. - * - * View handlers are simple callables which take a controller result and the - * request as arguments, whenever a controller returns a value that is not - * an instance of Response. When this occurs, all suitable handlers will be - * called, until one returns a Response object. - * - * @param mixed $callback View handler callback - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function view($callback, $priority = 0) - { - $this->on(KernelEvents::VIEW, new ViewListenerWrapper($this, $callback), $priority); - } - - /** - * Flushes the controller collection. - */ - public function flush() - { - $this['routes']->addCollection($this['controllers']->flush()); - } - - /** - * Redirects the user to another URL. - * - * @param string $url The URL to redirect to - * @param int $status The status code (302 by default) - * - * @return RedirectResponse - */ - public function redirect($url, $status = 302) - { - return new RedirectResponse($url, $status); - } - - /** - * Creates a streaming response. - * - * @param mixed $callback A valid PHP callback - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return StreamedResponse - */ - public function stream($callback = null, $status = 200, array $headers = array()) - { - return new StreamedResponse($callback, $status, $headers); - } - - /** - * Escapes a text for HTML. - * - * @param string $text The input text to be escaped - * @param int $flags The flags (@see htmlspecialchars) - * @param string $charset The charset - * @param bool $doubleEncode Whether to try to avoid double escaping or not - * - * @return string Escaped text - */ - public function escape($text, $flags = ENT_COMPAT, $charset = null, $doubleEncode = true) - { - return htmlspecialchars($text, $flags, $charset ?: $this['charset'], $doubleEncode); - } - - /** - * Convert some data into a JSON response. - * - * @param mixed $data The response data - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return JsonResponse - */ - public function json($data = array(), $status = 200, array $headers = array()) - { - return new JsonResponse($data, $status, $headers); - } - - /** - * Sends a file. - * - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * - * @return BinaryFileResponse - */ - public function sendFile($file, $status = 200, array $headers = array(), $contentDisposition = null) - { - return new BinaryFileResponse($file, $status, $headers, true, $contentDisposition); - } - - /** - * Mounts controllers under the given route prefix. - * - * @param string $prefix The route prefix - * @param ControllerCollection|callable|ControllerProviderInterface $controllers A ControllerCollection, a callable, or a ControllerProviderInterface instance - * - * @return Application - * - * @throws \LogicException - */ - public function mount($prefix, $controllers) - { - if ($controllers instanceof ControllerProviderInterface) { - $connectedControllers = $controllers->connect($this); - - if (!$connectedControllers instanceof ControllerCollection) { - throw new \LogicException(sprintf('The method "%s::connect" must return a "ControllerCollection" instance. Got: "%s"', get_class($controllers), is_object($connectedControllers) ? get_class($connectedControllers) : gettype($connectedControllers))); - } - - $controllers = $connectedControllers; - } elseif (!$controllers instanceof ControllerCollection && !is_callable($controllers)) { - throw new \LogicException('The "mount" method takes either a "ControllerCollection" instance, "ControllerProviderInterface" instance, or a callable.'); - } - - $this['controllers']->mount($prefix, $controllers); - - return $this; - } - - /** - * Handles the request and delivers the response. - * - * @param Request|null $request Request to process - */ - public function run(Request $request = null) - { - if (null === $request) { - $request = Request::createFromGlobals(); - } - - $response = $this->handle($request); - $response->send(); - $this->terminate($request, $response); - } - - /** - * {@inheritdoc} - * - * If you call this method directly instead of run(), you must call the - * terminate() method yourself if you want the finish filters to be run. - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (!$this->booted) { - $this->boot(); - } - - $this->flush(); - - return $this['kernel']->handle($request, $type, $catch); - } - - /** - * {@inheritdoc} - */ - public function terminate(Request $request, Response $response) - { - $this['kernel']->terminate($request, $response); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/FormTrait.php b/vendor/silex/silex/src/Silex/Application/FormTrait.php deleted file mode 100644 index 2eeb23e..0000000 --- a/vendor/silex/silex/src/Silex/Application/FormTrait.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Form; -use Symfony\Component\Form\Extension\Core\Type\FormType; -use Symfony\Component\Form\FormBuilder; -use Symfony\Component\OptionsResolver\OptionsResolver\FormTypeInterface; - -/** - * Form trait. - * - * @author Fabien Potencier - * @author David Berlioz - */ -trait FormTrait -{ - /** - * Creates and returns a form builder instance. - * - * @param mixed $data The initial data for the form - * @param array $options Options for the form - * @param string|FormTypeInterface $type Type of the form - * - * @return FormBuilder - */ - public function form($data = null, array $options = array(), $type = null) - { - return $this['form.factory']->createBuilder($type ?: FormType::class, $data, $options); - } - - /** - * Creates and returns a named form builder instance. - * - * @param string $name - * @param mixed $data The initial data for the form - * @param array $options Options for the form - * @param string|FormTypeInterface $type Type of the form - * - * @return FormBuilder - */ - public function namedForm($name, $data = null, array $options = array(), $type = null) - { - return $this['form.factory']->createNamedBuilder($name, $type ?: FormType::class, $data, $options); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/MonologTrait.php b/vendor/silex/silex/src/Silex/Application/MonologTrait.php deleted file mode 100644 index 18cb54c..0000000 --- a/vendor/silex/silex/src/Silex/Application/MonologTrait.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Monolog\Logger; - -/** - * Monolog trait. - * - * @author Fabien Potencier - */ -trait MonologTrait -{ - /** - * Adds a log record. - * - * @param string $message The log message - * @param array $context The log context - * @param int $level The logging level - * - * @return bool Whether the record has been processed - */ - public function log($message, array $context = array(), $level = Logger::INFO) - { - return $this['monolog']->addRecord($level, $message, $context); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/SecurityTrait.php b/vendor/silex/silex/src/Silex/Application/SecurityTrait.php deleted file mode 100644 index 43ce555..0000000 --- a/vendor/silex/silex/src/Silex/Application/SecurityTrait.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; -use Symfony\Component\Security\Core\User\UserInterface; - -/** - * Security trait. - * - * @author Fabien Potencier - */ -trait SecurityTrait -{ - /** - * Encodes the raw password. - * - * @param UserInterface $user A UserInterface instance - * @param string $password The password to encode - * - * @return string The encoded password - * - * @throws \RuntimeException when no password encoder could be found for the user - */ - public function encodePassword(UserInterface $user, $password) - { - return $this['security.encoder_factory']->getEncoder($user)->encodePassword($password, $user->getSalt()); - } - - /** - * Checks if the attributes are granted against the current authentication token and optionally supplied object. - * - * @param mixed $attributes - * @param mixed $object - * - * @return bool - * - * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token. - */ - public function isGranted($attributes, $object = null) - { - return $this['security.authorization_checker']->isGranted($attributes, $object); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php b/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php deleted file mode 100644 index 157f94d..0000000 --- a/vendor/silex/silex/src/Silex/Application/SwiftmailerTrait.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -/** - * Swiftmailer trait. - * - * @author Fabien Potencier - */ -trait SwiftmailerTrait -{ - /** - * Sends an email. - * - * @param \Swift_Message $message A \Swift_Message instance - * @param array $failedRecipients An array of failures by-reference - * - * @return int The number of sent messages - */ - public function mail(\Swift_Message $message, &$failedRecipients = null) - { - return $this['mailer']->send($message, $failedRecipients); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/TranslationTrait.php b/vendor/silex/silex/src/Silex/Application/TranslationTrait.php deleted file mode 100644 index 8b6e818..0000000 --- a/vendor/silex/silex/src/Silex/Application/TranslationTrait.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -/** - * Translation trait. - * - * @author Fabien Potencier - */ -trait TranslationTrait -{ - /** - * Translates the given message. - * - * @param string $id The message id - * @param array $parameters An array of parameters for the message - * @param string $domain The domain for the message - * @param string $locale The locale - * - * @return string The translated string - */ - public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this['translator']->trans($id, $parameters, $domain, $locale); - } - - /** - * Translates the given choice message by choosing a translation according to a number. - * - * @param string $id The message id - * @param int $number The number to use to find the indice of the message - * @param array $parameters An array of parameters for the message - * @param string $domain The domain for the message - * @param string $locale The locale - * - * @return string The translated string - */ - public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null) - { - return $this['translator']->transChoice($id, $number, $parameters, $domain, $locale); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/TwigTrait.php b/vendor/silex/silex/src/Silex/Application/TwigTrait.php deleted file mode 100644 index cb4127d..0000000 --- a/vendor/silex/silex/src/Silex/Application/TwigTrait.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; - -/** - * Twig trait. - * - * @author Fabien Potencier - */ -trait TwigTrait -{ - /** - * Renders a view and returns a Response. - * - * To stream a view, pass an instance of StreamedResponse as a third argument. - * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view - * @param Response $response A Response instance - * - * @return Response A Response instance - */ - public function render($view, array $parameters = array(), Response $response = null) - { - $twig = $this['twig']; - - if ($response instanceof StreamedResponse) { - $response->setCallback(function () use ($twig, $view, $parameters) { - $twig->display($view, $parameters); - }); - } else { - if (null === $response) { - $response = new Response(); - } - $response->setContent($twig->render($view, $parameters)); - } - - return $response; - } - - /** - * Renders a view. - * - * @param string $view The view name - * @param array $parameters An array of parameters to pass to the view - * - * @return string The rendered view - */ - public function renderView($view, array $parameters = array()) - { - return $this['twig']->render($view, $parameters); - } -} diff --git a/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php b/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php deleted file mode 100644 index 7ccdf8a..0000000 --- a/vendor/silex/silex/src/Silex/Application/UrlGeneratorTrait.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Application; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - -/** - * UrlGenerator trait. - * - * @author Fabien Potencier - */ -trait UrlGeneratorTrait -{ - /** - * Generates a path from the given parameters. - * - * @param string $route The name of the route - * @param mixed $parameters An array of parameters - * - * @return string The generated path - */ - public function path($route, $parameters = array()) - { - return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH); - } - - /** - * Generates an absolute URL from the given parameters. - * - * @param string $route The name of the route - * @param mixed $parameters An array of parameters - * - * @return string The generated URL - */ - public function url($route, $parameters = array()) - { - return $this['url_generator']->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL); - } -} diff --git a/vendor/silex/silex/src/Silex/CallbackResolver.php b/vendor/silex/silex/src/Silex/CallbackResolver.php deleted file mode 100644 index 692901c..0000000 --- a/vendor/silex/silex/src/Silex/CallbackResolver.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Pimple\Container; - -class CallbackResolver -{ - const SERVICE_PATTERN = "/[A-Za-z0-9\._\-]+:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/"; - - private $app; - - public function __construct(Container $app) - { - $this->app = $app; - } - - /** - * Returns true if the string is a valid service method representation. - * - * @param string $name - * - * @return bool - */ - public function isValid($name) - { - return is_string($name) && (preg_match(static::SERVICE_PATTERN, $name) || isset($this->app[$name])); - } - - /** - * Returns a callable given its string representation. - * - * @param string $name - * - * @return callable - * - * @throws \InvalidArgumentException In case the method does not exist. - */ - public function convertCallback($name) - { - if (preg_match(static::SERVICE_PATTERN, $name)) { - list($service, $method) = explode(':', $name, 2); - $callback = array($this->app[$service], $method); - } else { - $service = $name; - $callback = $this->app[$name]; - } - - if (!is_callable($callback)) { - throw new \InvalidArgumentException(sprintf('Service "%s" is not callable.', $service)); - } - - return $callback; - } - - /** - * Returns a callable given its string representation if it is a valid service method. - * - * @param string $name - * - * @return string|callable A callable value or the string passed in - * - * @throws \InvalidArgumentException In case the method does not exist. - */ - public function resolveCallback($name) - { - return $this->isValid($name) ? $this->convertCallback($name) : $name; - } -} diff --git a/vendor/silex/silex/src/Silex/Controller.php b/vendor/silex/silex/src/Silex/Controller.php deleted file mode 100644 index 9a80755..0000000 --- a/vendor/silex/silex/src/Silex/Controller.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Silex\Exception\ControllerFrozenException; - -/** - * A wrapper for a controller, mapped to a route. - * - * __call() forwards method-calls to Route, but returns instance of Controller - * listing Route's methods below, so that IDEs know they are valid - * - * @method Controller assert(string $variable, string $regexp) - * @method Controller value(string $variable, mixed $default) - * @method Controller convert(string $variable, mixed $callback) - * @method Controller method(string $method) - * @method Controller requireHttp() - * @method Controller requireHttps() - * @method Controller before(mixed $callback) - * @method Controller after(mixed $callback) - * @method Controller when(string $condition) - * - * @author Igor Wiedler - */ -class Controller -{ - private $route; - private $routeName; - private $isFrozen = false; - - /** - * Constructor. - * - * @param Route $route - */ - public function __construct(Route $route) - { - $this->route = $route; - } - - /** - * Gets the controller's route. - * - * @return Route - */ - public function getRoute() - { - return $this->route; - } - - /** - * Gets the controller's route name. - * - * @return string - */ - public function getRouteName() - { - return $this->routeName; - } - - /** - * Sets the controller's route. - * - * @param string $routeName - * - * @return Controller $this The current Controller instance - */ - public function bind($routeName) - { - if ($this->isFrozen) { - throw new ControllerFrozenException(sprintf('Calling %s on frozen %s instance.', __METHOD__, __CLASS__)); - } - - $this->routeName = $routeName; - - return $this; - } - - public function __call($method, $arguments) - { - if (!method_exists($this->route, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->route), $method)); - } - - call_user_func_array(array($this->route, $method), $arguments); - - return $this; - } - - /** - * Freezes the controller. - * - * Once the controller is frozen, you can no longer change the route name - */ - public function freeze() - { - $this->isFrozen = true; - } - - public function generateRouteName($prefix) - { - $methods = implode('_', $this->route->getMethods()).'_'; - - $routeName = $methods.$prefix.$this->route->getPath(); - $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); - $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); - - // Collapse consecutive underscores down into a single underscore. - $routeName = preg_replace('/_+/', '_', $routeName); - - return $routeName; - } -} diff --git a/vendor/silex/silex/src/Silex/ControllerCollection.php b/vendor/silex/silex/src/Silex/ControllerCollection.php deleted file mode 100644 index 4036896..0000000 --- a/vendor/silex/silex/src/Silex/ControllerCollection.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\HttpFoundation\Request; - -/** - * Builds Silex controllers. - * - * It acts as a staging area for routes. You are able to set the route name - * until flush() is called, at which point all controllers are frozen and - * converted to a RouteCollection. - * - * __call() forwards method-calls to Route, but returns instance of ControllerCollection - * listing Route's methods below, so that IDEs know they are valid - * - * @method ControllerCollection assert(string $variable, string $regexp) - * @method ControllerCollection value(string $variable, mixed $default) - * @method ControllerCollection convert(string $variable, mixed $callback) - * @method ControllerCollection method(string $method) - * @method ControllerCollection requireHttp() - * @method ControllerCollection requireHttps() - * @method ControllerCollection before(mixed $callback) - * @method ControllerCollection after(mixed $callback) - * @method ControllerCollection when(string $condition) - * - * @author Igor Wiedler - * @author Fabien Potencier - */ -class ControllerCollection -{ - protected $controllers = array(); - protected $defaultRoute; - protected $defaultController; - protected $prefix; - protected $routesFactory; - protected $controllersFactory; - - public function __construct(Route $defaultRoute, RouteCollection $routesFactory = null, $controllersFactory = null) - { - $this->defaultRoute = $defaultRoute; - $this->routesFactory = $routesFactory; - $this->controllersFactory = $controllersFactory; - $this->defaultController = function (Request $request) { - throw new \LogicException(sprintf('The "%s" route must have code to run when it matches.', $request->attributes->get('_route'))); - }; - } - - /** - * Mounts controllers under the given route prefix. - * - * @param string $prefix The route prefix - * @param ControllerCollection|callable $controllers A ControllerCollection instance or a callable for defining routes - * - * @throws \LogicException - */ - public function mount($prefix, $controllers) - { - if (is_callable($controllers)) { - $collection = $this->controllersFactory ? call_user_func($this->controllersFactory) : new static(new Route(), new RouteCollection()); - call_user_func($controllers, $collection); - $controllers = $collection; - } elseif (!$controllers instanceof self) { - throw new \LogicException('The "mount" method takes either a "ControllerCollection" instance or callable.'); - } - - $controllers->prefix = $prefix; - - $this->controllers[] = $controllers; - } - - /** - * Maps a pattern to a callable. - * - * You can optionally specify HTTP methods that should be matched. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function match($pattern, $to = null) - { - $route = clone $this->defaultRoute; - $route->setPath($pattern); - $this->controllers[] = $controller = new Controller($route); - $route->setDefault('_controller', null === $to ? $this->defaultController : $to); - - return $controller; - } - - /** - * Maps a GET request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function get($pattern, $to = null) - { - return $this->match($pattern, $to)->method('GET'); - } - - /** - * Maps a POST request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function post($pattern, $to = null) - { - return $this->match($pattern, $to)->method('POST'); - } - - /** - * Maps a PUT request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function put($pattern, $to = null) - { - return $this->match($pattern, $to)->method('PUT'); - } - - /** - * Maps a DELETE request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function delete($pattern, $to = null) - { - return $this->match($pattern, $to)->method('DELETE'); - } - - /** - * Maps an OPTIONS request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function options($pattern, $to = null) - { - return $this->match($pattern, $to)->method('OPTIONS'); - } - - /** - * Maps a PATCH request to a callable. - * - * @param string $pattern Matched route pattern - * @param mixed $to Callback that returns the response when matched - * - * @return Controller - */ - public function patch($pattern, $to = null) - { - return $this->match($pattern, $to)->method('PATCH'); - } - - public function __call($method, $arguments) - { - if (!method_exists($this->defaultRoute, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s::%s" does not exist.', get_class($this->defaultRoute), $method)); - } - - call_user_func_array(array($this->defaultRoute, $method), $arguments); - - foreach ($this->controllers as $controller) { - call_user_func_array(array($controller, $method), $arguments); - } - - return $this; - } - - /** - * Persists and freezes staged controllers. - * - * @return RouteCollection A RouteCollection instance - */ - public function flush() - { - if (null === $this->routesFactory) { - $routes = new RouteCollection(); - } else { - $routes = $this->routesFactory; - } - - return $this->doFlush('', $routes); - } - - private function doFlush($prefix, RouteCollection $routes) - { - if ($prefix !== '') { - $prefix = '/'.trim(trim($prefix), '/'); - } - - foreach ($this->controllers as $controller) { - if ($controller instanceof Controller) { - $controller->getRoute()->setPath($prefix.$controller->getRoute()->getPath()); - if (!$name = $controller->getRouteName()) { - $name = $base = $controller->generateRouteName(''); - $i = 0; - while ($routes->get($name)) { - $name = $base.'_'.++$i; - } - $controller->bind($name); - } - $routes->add($name, $controller->getRoute()); - $controller->freeze(); - } else { - $controller->doFlush($prefix.$controller->prefix, $routes); - } - } - - $this->controllers = array(); - - return $routes; - } -} diff --git a/vendor/silex/silex/src/Silex/ControllerResolver.php b/vendor/silex/silex/src/Silex/ControllerResolver.php deleted file mode 100644 index 0a95e15..0000000 --- a/vendor/silex/silex/src/Silex/ControllerResolver.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver; -use Symfony\Component\HttpFoundation\Request; - -/** - * Adds Application as a valid argument for controllers. - * - * @author Fabien Potencier - * - * @deprecated This class can be dropped once Symfony 3.0 is not supported anymore. - */ -class ControllerResolver extends BaseControllerResolver -{ - protected $app; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(Application $app, LoggerInterface $logger = null) - { - $this->app = $app; - - parent::__construct($logger); - } - - protected function doGetArguments(Request $request, $controller, array $parameters) - { - foreach ($parameters as $param) { - if ($param->getClass() && $param->getClass()->isInstance($this->app)) { - $request->attributes->set($param->getName(), $this->app); - - break; - } - } - - return parent::doGetArguments($request, $controller, $parameters); - } -} diff --git a/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php b/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php deleted file mode 100644 index 2fa93c1..0000000 --- a/vendor/silex/silex/src/Silex/EventListener/ConverterListener.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Silex\CallbackResolver; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\Routing\RouteCollection; - -/** - * Handles converters. - * - * @author Fabien Potencier - */ -class ConverterListener implements EventSubscriberInterface -{ - protected $routes; - protected $callbackResolver; - - /** - * Constructor. - * - * @param RouteCollection $routes A RouteCollection instance - * @param CallbackResolver $callbackResolver A CallbackResolver instance - */ - public function __construct(RouteCollection $routes, CallbackResolver $callbackResolver) - { - $this->routes = $routes; - $this->callbackResolver = $callbackResolver; - } - - /** - * Handles converters. - * - * @param FilterControllerEvent $event The event to handle - */ - public function onKernelController(FilterControllerEvent $event) - { - $request = $event->getRequest(); - $route = $this->routes->get($request->attributes->get('_route')); - if ($route && $converters = $route->getOption('_converters')) { - foreach ($converters as $name => $callback) { - $callback = $this->callbackResolver->resolveCallback($callback); - - $request->attributes->set($name, call_user_func($callback, $request->attributes->get($name), $request)); - } - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::CONTROLLER => 'onKernelController', - ); - } -} diff --git a/vendor/silex/silex/src/Silex/EventListener/LogListener.php b/vendor/silex/silex/src/Silex/EventListener/LogListener.php deleted file mode 100644 index 5f3cc90..0000000 --- a/vendor/silex/silex/src/Silex/EventListener/LogListener.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Psr\Log\LoggerInterface; -use Psr\Log\LogLevel; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; - -/** - * Logs request, response, and exceptions. - */ -class LogListener implements EventSubscriberInterface -{ - protected $logger; - protected $exceptionLogFilter; - - public function __construct(LoggerInterface $logger, $exceptionLogFilter = null) - { - $this->logger = $logger; - if (null === $exceptionLogFilter) { - $exceptionLogFilter = function (\Exception $e) { - if ($e instanceof HttpExceptionInterface && $e->getStatusCode() < 500) { - return LogLevel::ERROR; - } - - return LogLevel::CRITICAL; - }; - } - - $this->exceptionLogFilter = $exceptionLogFilter; - } - - /** - * Logs master requests on event KernelEvents::REQUEST. - * - * @param GetResponseEvent $event - */ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $this->logRequest($event->getRequest()); - } - - /** - * Logs master response on event KernelEvents::RESPONSE. - * - * @param FilterResponseEvent $event - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $this->logResponse($event->getResponse()); - } - - /** - * Logs uncaught exceptions on event KernelEvents::EXCEPTION. - * - * @param GetResponseForExceptionEvent $event - */ - public function onKernelException(GetResponseForExceptionEvent $event) - { - $this->logException($event->getException()); - } - - /** - * Logs a request. - * - * @param Request $request - */ - protected function logRequest(Request $request) - { - $this->logger->log(LogLevel::DEBUG, '> '.$request->getMethod().' '.$request->getRequestUri()); - } - - /** - * Logs a response. - * - * @param Response $response - */ - protected function logResponse(Response $response) - { - $message = '< '.$response->getStatusCode(); - - if ($response instanceof RedirectResponse) { - $message .= ' '.$response->getTargetUrl(); - } - - $this->logger->log(LogLevel::DEBUG, $message); - } - - /** - * Logs an exception. - */ - protected function logException(\Exception $e) - { - $this->logger->log(call_user_func($this->exceptionLogFilter, $e), sprintf('%s: %s (uncaught exception) at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), array('exception' => $e)); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 0), - KernelEvents::RESPONSE => array('onKernelResponse', 0), - /* - * Priority -4 is used to come after those from SecurityServiceProvider (0) - * but before the error handlers added with Silex\Application::error (defaults to -8) - */ - KernelEvents::EXCEPTION => array('onKernelException', -4), - ); - } -} diff --git a/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php b/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php deleted file mode 100644 index 9b28ff1..0000000 --- a/vendor/silex/silex/src/Silex/EventListener/MiddlewareListener.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Silex\Application; - -/** - * Manages the route middlewares. - * - * @author Fabien Potencier - */ -class MiddlewareListener implements EventSubscriberInterface -{ - protected $app; - - /** - * Constructor. - * - * @param Application $app An Application instance - */ - public function __construct(Application $app) - { - $this->app = $app; - } - - /** - * Runs before filters. - * - * @param GetResponseEvent $event The event to handle - */ - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { - return; - } - - foreach ((array) $route->getOption('_before_middlewares') as $callback) { - $ret = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $this->app); - if ($ret instanceof Response) { - $event->setResponse($ret); - - return; - } elseif (null !== $ret) { - throw new \RuntimeException(sprintf('A before middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName)); - } - } - } - - /** - * Runs after filters. - * - * @param FilterResponseEvent $event The event to handle - */ - public function onKernelResponse(FilterResponseEvent $event) - { - $request = $event->getRequest(); - $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { - return; - } - - foreach ((array) $route->getOption('_after_middlewares') as $callback) { - $response = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $event->getResponse(), $this->app); - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - throw new \RuntimeException(sprintf('An after middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName)); - } - } - } - - public static function getSubscribedEvents() - { - return array( - // this must be executed after the late events defined with before() (and their priority is -512) - KernelEvents::REQUEST => array('onKernelRequest', -1024), - KernelEvents::RESPONSE => array('onKernelResponse', 128), - ); - } -} diff --git a/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php b/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php deleted file mode 100644 index 9fdba5f..0000000 --- a/vendor/silex/silex/src/Silex/EventListener/StringToResponseListener.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\EventListener; - -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; - -/** - * Converts string responses to proper Response instances. - * - * @author Fabien Potencier - */ -class StringToResponseListener implements EventSubscriberInterface -{ - /** - * Handles string responses. - * - * @param GetResponseForControllerResultEvent $event The event to handle - */ - public function onKernelView(GetResponseForControllerResultEvent $event) - { - $response = $event->getControllerResult(); - - if (!( - null === $response - || is_array($response) - || $response instanceof Response - || (is_object($response) && !method_exists($response, '__toString')) - )) { - $event->setResponse(new Response((string) $response)); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::VIEW => array('onKernelView', -10), - ); - } -} diff --git a/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php b/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php deleted file mode 100644 index 7f0d65f..0000000 --- a/vendor/silex/silex/src/Silex/Exception/ControllerFrozenException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Exception; - -/** - * Exception, is thrown when a frozen controller is modified. - * - * @author Igor Wiedler - */ -class ControllerFrozenException extends \RuntimeException -{ -} diff --git a/vendor/silex/silex/src/Silex/ExceptionHandler.php b/vendor/silex/silex/src/Silex/ExceptionHandler.php deleted file mode 100644 index 34eb893..0000000 --- a/vendor/silex/silex/src/Silex/ExceptionHandler.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Default exception handler. - * - * @author Fabien Potencier - */ -class ExceptionHandler implements EventSubscriberInterface -{ - protected $debug; - - public function __construct($debug) - { - $this->debug = $debug; - } - - public function onSilexError(GetResponseForExceptionEvent $event) - { - $handler = new DebugExceptionHandler($this->debug); - - $exception = $event->getException(); - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - $response = Response::create($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset(ini_get('default_charset')); - - $event->setResponse($response); - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array(KernelEvents::EXCEPTION => array('onSilexError', -255)); - } -} diff --git a/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php b/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php deleted file mode 100644 index e0d527b..0000000 --- a/vendor/silex/silex/src/Silex/ExceptionListenerWrapper.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; - -/** - * Wraps exception listeners. - * - * @author Fabien Potencier - */ -class ExceptionListenerWrapper -{ - protected $app; - protected $callback; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param callable $callback - */ - public function __construct(Application $app, $callback) - { - $this->app = $app; - $this->callback = $callback; - } - - public function __invoke(GetResponseForExceptionEvent $event) - { - $exception = $event->getException(); - $this->callback = $this->app['callback_resolver']->resolveCallback($this->callback); - - if (!$this->shouldRun($exception)) { - return; - } - - $code = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; - - $response = call_user_func($this->callback, $exception, $event->getRequest(), $code); - - $this->ensureResponse($response, $event); - } - - protected function shouldRun(\Exception $exception) - { - if (is_array($this->callback)) { - $callbackReflection = new \ReflectionMethod($this->callback[0], $this->callback[1]); - } elseif (is_object($this->callback) && !$this->callback instanceof \Closure) { - $callbackReflection = new \ReflectionObject($this->callback); - $callbackReflection = $callbackReflection->getMethod('__invoke'); - } else { - $callbackReflection = new \ReflectionFunction($this->callback); - } - - if ($callbackReflection->getNumberOfParameters() > 0) { - $parameters = $callbackReflection->getParameters(); - $expectedException = $parameters[0]; - if ($expectedException->getClass() && !$expectedException->getClass()->isInstance($exception)) { - return false; - } - } - - return true; - } - - protected function ensureResponse($response, GetResponseForExceptionEvent $event) - { - if ($response instanceof Response) { - $event->setResponse($response); - } else { - $viewEvent = new GetResponseForControllerResultEvent($this->app['kernel'], $event->getRequest(), $event->getRequestType(), $response); - $this->app['dispatcher']->dispatch(KernelEvents::VIEW, $viewEvent); - - if ($viewEvent->hasResponse()) { - $event->setResponse($viewEvent->getResponse()); - } - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php deleted file mode 100644 index fa60330..0000000 --- a/vendor/silex/silex/src/Silex/Provider/AssetServiceProvider.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\Asset\Packages; -use Symfony\Component\Asset\Package; -use Symfony\Component\Asset\PathPackage; -use Symfony\Component\Asset\UrlPackage; -use Symfony\Component\Asset\Context\RequestStackContext; -use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy; -use Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy; -use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy; - -/** - * Symfony Asset component Provider. - * - * @author Fabien Potencier - */ -class AssetServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app['assets.packages'] = function ($app) { - $packages = array(); - foreach ($app['assets.named_packages'] as $name => $package) { - $version = $app['assets.strategy_factory'](isset($package['version']) ? $package['version'] : null, isset($package['version_format']) ? $package['version_format'] : null, isset($package['json_manifest_path']) ? $package['json_manifest_path'] : null, $name); - - $packages[$name] = $app['assets.package_factory'](isset($package['base_path']) ? $package['base_path'] : '', isset($package['base_urls']) ? $package['base_urls'] : array(), $version, $name); - } - - return new Packages($app['assets.default_package'], $packages); - }; - - $app['assets.default_package'] = function ($app) { - $version = $app['assets.strategy_factory']($app['assets.version'], $app['assets.version_format'], $app['assets.json_manifest_path'], 'default'); - - return $app['assets.package_factory']($app['assets.base_path'], $app['assets.base_urls'], $version, 'default'); - }; - - $app['assets.context'] = function ($app) { - return new RequestStackContext($app['request_stack']); - }; - - $app['assets.base_path'] = ''; - $app['assets.base_urls'] = array(); - $app['assets.version'] = null; - $app['assets.version_format'] = null; - $app['assets.json_manifest_path'] = null; - - $app['assets.named_packages'] = array(); - - // prototypes - - $app['assets.strategy_factory'] = $app->protect(function ($version, $format, $jsonManifestPath, $name) use ($app) { - if ($version && $jsonManifestPath) { - throw new \LogicException(sprintf('Asset package "%s" cannot have version and manifest.', $name)); - } - - if ($version) { - return new StaticVersionStrategy($version, $format); - } - - if ($jsonManifestPath) { - if (!class_exists('Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy')) { - throw new \RuntimeException('You must require symfony/asset >= 3.3 to use JSON manifest version strategy.'); - } - - return new JsonManifestVersionStrategy($jsonManifestPath); - } - - return new EmptyVersionStrategy(); - }); - - $app['assets.package_factory'] = $app->protect(function ($basePath, $baseUrls, $version, $name) use ($app) { - if ($basePath && $baseUrls) { - throw new \LogicException(sprintf('Asset package "%s" cannot have base URLs and base paths.', $name)); - } - - if (!$baseUrls) { - return new PathPackage($basePath, $version, $app['assets.context']); - } - - return new UrlPackage($baseUrls, $version, $app['assets.context']); - }); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/CsrfServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/CsrfServiceProvider.php deleted file mode 100644 index eb6e882..0000000 --- a/vendor/silex/silex/src/Silex/Provider/CsrfServiceProvider.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\Security\Csrf\CsrfTokenManager; -use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator; -use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage; -use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage; - -/** - * Symfony CSRF Security component Provider. - * - * @author Fabien Potencier - */ -class CsrfServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app['csrf.token_manager'] = function ($app) { - return new CsrfTokenManager($app['csrf.token_generator'], $app['csrf.token_storage']); - }; - - $app['csrf.token_storage'] = function ($app) { - if (isset($app['session'])) { - return new SessionTokenStorage($app['session'], $app['csrf.session_namespace']); - } - - return new NativeSessionTokenStorage($app['csrf.session_namespace']); - }; - - $app['csrf.token_generator'] = function ($app) { - return new UriSafeTokenGenerator(); - }; - - $app['csrf.session_namespace'] = '_csrf'; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php deleted file mode 100644 index 9c71d5b..0000000 --- a/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Doctrine\DBAL\DriverManager; -use Doctrine\DBAL\Configuration; -use Doctrine\Common\EventManager; -use Symfony\Bridge\Doctrine\Logger\DbalLogger; - -/** - * Doctrine DBAL Provider. - * - * @author Fabien Potencier - */ -class DoctrineServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app['db.default_options'] = array( - 'driver' => 'pdo_mysql', - 'dbname' => null, - 'host' => 'localhost', - 'user' => 'root', - 'password' => null, - ); - - $app['dbs.options.initializer'] = $app->protect(function () use ($app) { - static $initialized = false; - - if ($initialized) { - return; - } - - $initialized = true; - - if (!isset($app['dbs.options'])) { - $app['dbs.options'] = array('default' => isset($app['db.options']) ? $app['db.options'] : array()); - } - - $tmp = $app['dbs.options']; - foreach ($tmp as $name => &$options) { - $options = array_replace($app['db.default_options'], $options); - - if (!isset($app['dbs.default'])) { - $app['dbs.default'] = $name; - } - } - $app['dbs.options'] = $tmp; - }); - - $app['dbs'] = function ($app) { - $app['dbs.options.initializer'](); - - $dbs = new Container(); - foreach ($app['dbs.options'] as $name => $options) { - if ($app['dbs.default'] === $name) { - // we use shortcuts here in case the default has been overridden - $config = $app['db.config']; - $manager = $app['db.event_manager']; - } else { - $config = $app['dbs.config'][$name]; - $manager = $app['dbs.event_manager'][$name]; - } - - $dbs[$name] = function ($dbs) use ($options, $config, $manager) { - return DriverManager::getConnection($options, $config, $manager); - }; - } - - return $dbs; - }; - - $app['dbs.config'] = function ($app) { - $app['dbs.options.initializer'](); - - $configs = new Container(); - $addLogger = isset($app['logger']) && null !== $app['logger'] && class_exists('Symfony\Bridge\Doctrine\Logger\DbalLogger'); - foreach ($app['dbs.options'] as $name => $options) { - $configs[$name] = new Configuration(); - if ($addLogger) { - $configs[$name]->setSQLLogger(new DbalLogger($app['logger'], isset($app['stopwatch']) ? $app['stopwatch'] : null)); - } - } - - return $configs; - }; - - $app['dbs.event_manager'] = function ($app) { - $app['dbs.options.initializer'](); - - $managers = new Container(); - foreach ($app['dbs.options'] as $name => $options) { - $managers[$name] = new EventManager(); - } - - return $managers; - }; - - // shortcuts for the "first" DB - $app['db'] = function ($app) { - $dbs = $app['dbs']; - - return $dbs[$app['dbs.default']]; - }; - - $app['db.config'] = function ($app) { - $dbs = $app['dbs.config']; - - return $dbs[$app['dbs.default']]; - }; - - $app['db.event_manager'] = function ($app) { - $dbs = $app['dbs.event_manager']; - - return $dbs[$app['dbs.default']]; - }; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/ExceptionHandlerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/ExceptionHandlerServiceProvider.php deleted file mode 100644 index 1c6f202..0000000 --- a/vendor/silex/silex/src/Silex/Provider/ExceptionHandlerServiceProvider.php +++ /dev/null @@ -1,32 +0,0 @@ -addSubscriber($app['exception_handler']); - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Form/SilexFormExtension.php b/vendor/silex/silex/src/Silex/Provider/Form/SilexFormExtension.php deleted file mode 100644 index 12efbdf..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Form/SilexFormExtension.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Form; - -use Pimple\Container; -use Symfony\Component\Form\Exception\InvalidArgumentException; -use Symfony\Component\Form\FormExtensionInterface; -use Symfony\Component\Form\FormTypeGuesserChain; - -class SilexFormExtension implements FormExtensionInterface -{ - private $app; - private $types; - private $typeExtensions; - private $guessers; - private $guesserLoaded = false; - private $guesser; - - public function __construct(Container $app, array $types, array $typeExtensions, array $guessers) - { - $this->app = $app; - $this->setTypes($types); - $this->setTypeExtensions($typeExtensions); - $this->setGuessers($guessers); - } - - public function getType($name) - { - if (!isset($this->types[$name])) { - throw new InvalidArgumentException(sprintf('The type "%s" is not the name of a registered form type.', $name)); - } - if (!is_object($this->types[$name])) { - $this->types[$name] = $this->app[$this->types[$name]]; - } - - return $this->types[$name]; - } - - public function hasType($name) - { - return isset($this->types[$name]); - } - - public function getTypeExtensions($name) - { - return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : []; - } - - public function hasTypeExtensions($name) - { - return isset($this->typeExtensions[$name]); - } - - public function getTypeGuesser() - { - if (!$this->guesserLoaded) { - $this->guesserLoaded = true; - - if ($this->guessers) { - $guessers = []; - foreach ($this->guessers as $guesser) { - if (!is_object($guesser)) { - $guesser = $this->app[$guesser]; - } - $guessers[] = $guesser; - } - $this->guesser = new FormTypeGuesserChain($guessers); - } - } - - return $this->guesser; - } - - private function setTypes(array $types) - { - $this->types = []; - foreach ($types as $type) { - if (!is_object($type)) { - if (!isset($this->app[$type])) { - throw new InvalidArgumentException(sprintf('Invalid form type. The silex service "%s" does not exist.', $type)); - } - $this->types[$type] = $type; - } else { - $this->types[get_class($type)] = $type; - } - } - } - - private function setTypeExtensions(array $typeExtensions) - { - $this->typeExtensions = []; - foreach ($typeExtensions as $extension) { - if (!is_object($extension)) { - if (!isset($this->app[$extension])) { - throw new InvalidArgumentException(sprintf('Invalid form type extension. The silex service "%s" does not exist.', $extension)); - } - $extension = $this->app[$extension]; - } - $this->typeExtensions[$extension->getExtendedType()][] = $extension; - } - } - - private function setGuessers(array $guessers) - { - $this->guessers = []; - foreach ($guessers as $guesser) { - if (!is_object($guesser) && !isset($this->app[$guesser])) { - throw new InvalidArgumentException(sprintf('Invalid form type guesser. The silex service "%s" does not exist.', $guesser)); - } - $this->guessers[] = $guesser; - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php deleted file mode 100644 index 00841d0..0000000 --- a/vendor/silex/silex/src/Silex/Provider/FormServiceProvider.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\Form\Extension\Csrf\CsrfExtension; -use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension; -use Symfony\Component\Form\Extension\Validator\ValidatorExtension as FormValidatorExtension; -use Symfony\Component\Form\FormFactory; -use Symfony\Component\Form\FormRegistry; -use Symfony\Component\Form\ResolvedFormTypeFactory; - -/** - * Symfony Form component Provider. - * - * @author Fabien Potencier - */ -class FormServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - if (!class_exists('Locale')) { - throw new \RuntimeException('You must either install the PHP intl extension or the Symfony Intl Component to use the Form extension.'); - } - - $app['form.types'] = function ($app) { - return array(); - }; - - $app['form.type.extensions'] = function ($app) { - return array(); - }; - - $app['form.type.guessers'] = function ($app) { - return array(); - }; - - $app['form.extension.csrf'] = function ($app) { - if (isset($app['translator'])) { - return new CsrfExtension($app['csrf.token_manager'], $app['translator']); - } - - return new CsrfExtension($app['csrf.token_manager']); - }; - - $app['form.extension.silex'] = function ($app) { - return new Form\SilexFormExtension($app, $app['form.types'], $app['form.type.extensions'], $app['form.type.guessers']); - }; - - $app['form.extensions'] = function ($app) { - $extensions = array( - new HttpFoundationExtension(), - ); - - if (isset($app['csrf.token_manager'])) { - $extensions[] = $app['form.extension.csrf']; - } - - if (isset($app['validator'])) { - $extensions[] = new FormValidatorExtension($app['validator']); - } - $extensions[] = $app['form.extension.silex']; - - return $extensions; - }; - - $app['form.factory'] = function ($app) { - return new FormFactory($app['form.registry'], $app['form.resolved_type_factory']); - }; - - $app['form.registry'] = function ($app) { - return new FormRegistry($app['form.extensions'], $app['form.resolved_type_factory']); - }; - - $app['form.resolved_type_factory'] = function ($app) { - return new ResolvedFormTypeFactory(); - }; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/HttpCache/HttpCache.php b/vendor/silex/silex/src/Silex/Provider/HttpCache/HttpCache.php deleted file mode 100644 index b0ebb5c..0000000 --- a/vendor/silex/silex/src/Silex/Provider/HttpCache/HttpCache.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\HttpCache; - -use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache; -use Symfony\Component\HttpFoundation\Request; - -/** - * HTTP Cache extension to allow using the run() shortcut. - * - * @author Fabien Potencier - */ -class HttpCache extends BaseHttpCache -{ - /** - * Handles the Request and delivers the Response. - * - * @param Request $request The Request object - */ - public function run(Request $request = null) - { - if (null === $request) { - $request = Request::createFromGlobals(); - } - - $response = $this->handle($request); - $response->send(); - $this->terminate($request, $response); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php deleted file mode 100644 index 8b3f37e..0000000 --- a/vendor/silex/silex/src/Silex/Provider/HttpCacheServiceProvider.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Provider\HttpCache\HttpCache; -use Silex\Api\EventListenerProviderInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpKernel\HttpCache\Store; -use Symfony\Component\HttpKernel\EventListener\SurrogateListener; - -/** - * Symfony HttpKernel component Provider for HTTP cache. - * - * @author Fabien Potencier - */ -class HttpCacheServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['http_cache'] = function ($app) { - $app['http_cache.options'] = array_replace( - array( - 'debug' => $app['debug'], - ), $app['http_cache.options'] - ); - - return new HttpCache($app, $app['http_cache.store'], $app['http_cache.esi'], $app['http_cache.options']); - }; - - $app['http_cache.esi'] = function ($app) { - return new Esi(); - }; - - $app['http_cache.store'] = function ($app) { - return new Store($app['http_cache.cache_dir']); - }; - - $app['http_cache.esi_listener'] = function ($app) { - return new SurrogateListener($app['http_cache.esi']); - }; - - $app['http_cache.options'] = array(); - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['http_cache.esi_listener']); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php deleted file mode 100644 index fb1f499..0000000 --- a/vendor/silex/silex/src/Silex/Provider/HttpFragmentServiceProvider.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; -use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer; -use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer; -use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\UriSigner; - -/** - * HttpKernel Fragment integration for Silex. - * - * @author Fabien Potencier - */ -class HttpFragmentServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['fragment.handler'] = function ($app) { - return new FragmentHandler($app['request_stack'], $app['fragment.renderers'], $app['debug']); - }; - - $app['fragment.renderer.inline'] = function ($app) { - $renderer = new InlineFragmentRenderer($app['kernel'], $app['dispatcher']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }; - - $app['fragment.renderer.hinclude'] = function ($app) { - $renderer = new HIncludeFragmentRenderer(null, $app['uri_signer'], $app['fragment.renderer.hinclude.global_template'], $app['charset']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }; - - $app['fragment.renderer.esi'] = function ($app) { - $renderer = new EsiFragmentRenderer($app['http_cache.esi'], $app['fragment.renderer.inline'], $app['uri_signer']); - $renderer->setFragmentPath($app['fragment.path']); - - return $renderer; - }; - - $app['fragment.listener'] = function ($app) { - return new FragmentListener($app['uri_signer'], $app['fragment.path']); - }; - - $app['uri_signer'] = function ($app) { - return new UriSigner($app['uri_signer.secret']); - }; - - $app['uri_signer.secret'] = md5(__DIR__); - $app['fragment.path'] = '/_fragment'; - $app['fragment.renderer.hinclude.global_template'] = null; - $app['fragment.renderers'] = function ($app) { - $renderers = array($app['fragment.renderer.inline'], $app['fragment.renderer.hinclude']); - - if (isset($app['http_cache.esi'])) { - $renderers[] = $app['fragment.renderer.esi']; - } - - return $renderers; - }; - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['fragment.listener']); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php deleted file mode 100644 index 86f155f..0000000 --- a/vendor/silex/silex/src/Silex/Provider/HttpKernelServiceProvider.php +++ /dev/null @@ -1,101 +0,0 @@ -= 30100) { - return new SfControllerResolver($app['logger']); - } - - return new ControllerResolver($app, $app['logger']); - }; - - if (Kernel::VERSION_ID >= 30100) { - $app['argument_metadata_factory'] = function ($app) { - return new ArgumentMetadataFactory(); - }; - $app['argument_value_resolvers'] = function ($app) { - if (Kernel::VERSION_ID < 30200) { - return array( - new AppArgumentValueResolver($app), - new RequestAttributeValueResolver(), - new RequestValueResolver(), - new DefaultValueResolver(), - new VariadicValueResolver(), - ); - } - - return array_merge(array(new AppArgumentValueResolver($app)), ArgumentResolver::getDefaultArgumentValueResolvers()); - }; - } - - $app['argument_resolver'] = function ($app) { - if (Kernel::VERSION_ID >= 30100) { - return new ArgumentResolver($app['argument_metadata_factory'], $app['argument_value_resolvers']); - } - }; - - $app['kernel'] = function ($app) { - return new HttpKernel($app['dispatcher'], $app['resolver'], $app['request_stack'], $app['argument_resolver']); - }; - - $app['request_stack'] = function () { - return new RequestStack(); - }; - - $app['dispatcher'] = function () { - return new EventDispatcher(); - }; - - $app['callback_resolver'] = function ($app) { - return new CallbackResolver($app); - }; - } - - /** - * {@inheritdoc} - */ - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber(new ResponseListener($app['charset'])); - $dispatcher->addSubscriber(new MiddlewareListener($app)); - $dispatcher->addSubscriber(new ConverterListener($app['routes'], $app['callback_resolver'])); - $dispatcher->addSubscriber(new StringToResponseListener()); - - if (class_exists(HttpHeaderSerializer::class)) { - $dispatcher->addSubscriber(new AddLinkHeaderListener()); - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/LICENSE b/vendor/silex/silex/src/Silex/Provider/LICENSE deleted file mode 100644 index bc6ad04..0000000 --- a/vendor/silex/silex/src/Silex/Provider/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php b/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php deleted file mode 100644 index d500264..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Locale/LocaleListener.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Locale; - -use Pimple\Container; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Initializes the locale based on the current request. - * - * @author Fabien Potencier - * @author Jérôme Tamarelle - */ -class LocaleListener implements EventSubscriberInterface -{ - private $app; - private $defaultLocale; - private $requestStack; - private $requestContext; - - public function __construct(Container $app, $defaultLocale = 'en', RequestStack $requestStack, RequestContext $requestContext = null) - { - $this->app = $app; - $this->defaultLocale = $defaultLocale; - $this->requestStack = $requestStack; - $this->requestContext = $requestContext; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - $request->setDefaultLocale($this->defaultLocale); - - $this->setLocale($request); - $this->setRouterContext($request); - - $this->app['locale'] = $request->getLocale(); - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null !== $parentRequest = $this->requestStack->getParentRequest()) { - $this->setRouterContext($parentRequest); - } - } - - private function setLocale(Request $request) - { - if ($locale = $request->attributes->get('_locale')) { - $request->setLocale($locale); - } - } - - private function setRouterContext(Request $request) - { - if (null !== $this->requestContext) { - $this->requestContext->setParameter('_locale', $request->getLocale()); - } - } - - public static function getSubscribedEvents() - { - return array( - // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/LocaleServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/LocaleServiceProvider.php deleted file mode 100644 index ddea81b..0000000 --- a/vendor/silex/silex/src/Silex/Provider/LocaleServiceProvider.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Silex\Provider\Locale\LocaleListener; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Locale Provider. - * - * @author Fabien Potencier - */ -class LocaleServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['locale.listener'] = function ($app) { - return new LocaleListener($app, $app['locale'], $app['request_stack'], isset($app['request_context']) ? $app['request_context'] : null); - }; - - $app['locale'] = 'en'; - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['locale.listener']); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php deleted file mode 100644 index f8cba4e..0000000 --- a/vendor/silex/silex/src/Silex/Provider/MonologServiceProvider.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Monolog\Formatter\LineFormatter; -use Monolog\Logger; -use Monolog\Handler; -use Monolog\ErrorHandler; -use Silex\Application; -use Silex\Api\BootableProviderInterface; -use Symfony\Bridge\Monolog\Handler\DebugHandler; -use Symfony\Bridge\Monolog\Handler\FingersCrossed\NotFoundActivationStrategy; -use Symfony\Bridge\Monolog\Processor\DebugProcessor; -use Silex\EventListener\LogListener; - -/** - * Monolog Provider. - * - * @author Fabien Potencier - */ -class MonologServiceProvider implements ServiceProviderInterface, BootableProviderInterface -{ - public function register(Container $app) - { - $app['logger'] = function () use ($app) { - return $app['monolog']; - }; - - if ($bridge = class_exists('Symfony\Bridge\Monolog\Logger')) { - $app['monolog.handler.debug'] = function () use ($app) { - $level = MonologServiceProvider::translateLevel($app['monolog.level']); - - return new DebugHandler($level); - }; - - if (isset($app['request_stack'])) { - $app['monolog.not_found_activation_strategy'] = function () use ($app) { - return new NotFoundActivationStrategy($app['request_stack'], array('^/'), $app['monolog.level']); - }; - } - } - - $app['monolog.logger.class'] = $bridge ? 'Symfony\Bridge\Monolog\Logger' : 'Monolog\Logger'; - - $app['monolog'] = function ($app) use ($bridge) { - $log = new $app['monolog.logger.class']($app['monolog.name']); - - $handler = new Handler\GroupHandler($app['monolog.handlers']); - if (isset($app['monolog.not_found_activation_strategy'])) { - $handler = new Handler\FingersCrossedHandler($handler, $app['monolog.not_found_activation_strategy']); - } - - $log->pushHandler($handler); - - if ($app['debug'] && $bridge) { - if (class_exists(DebugProcessor::class)) { - $log->pushProcessor(new DebugProcessor()); - } else { - $log->pushHandler($app['monolog.handler.debug']); - } - } - - return $log; - }; - - $app['monolog.formatter'] = function () { - return new LineFormatter(); - }; - - $app['monolog.handler'] = $defaultHandler = function () use ($app) { - $level = MonologServiceProvider::translateLevel($app['monolog.level']); - - $handler = new Handler\StreamHandler($app['monolog.logfile'], $level, $app['monolog.bubble'], $app['monolog.permission']); - $handler->setFormatter($app['monolog.formatter']); - - return $handler; - }; - - $app['monolog.handlers'] = function () use ($app, $defaultHandler) { - $handlers = array(); - - // enables the default handler if a logfile was set or the monolog.handler service was redefined - if ($app['monolog.logfile'] || $defaultHandler !== $app->raw('monolog.handler')) { - $handlers[] = $app['monolog.handler']; - } - - return $handlers; - }; - - $app['monolog.level'] = function () { - return Logger::DEBUG; - }; - - $app['monolog.listener'] = function () use ($app) { - return new LogListener($app['logger'], $app['monolog.exception.logger_filter']); - }; - - $app['monolog.name'] = 'app'; - $app['monolog.bubble'] = true; - $app['monolog.permission'] = null; - $app['monolog.exception.logger_filter'] = null; - $app['monolog.logfile'] = null; - $app['monolog.use_error_handler'] = function ($app) { - return !$app['debug']; - }; - } - - public function boot(Application $app) - { - if ($app['monolog.use_error_handler']) { - ErrorHandler::register($app['monolog']); - } - - if (isset($app['monolog.listener'])) { - $app['dispatcher']->addSubscriber($app['monolog.listener']); - } - } - - public static function translateLevel($name) - { - // level is already translated to logger constant, return as-is - if (is_int($name)) { - return $name; - } - - $levels = Logger::getLevels(); - $upper = strtoupper($name); - - if (!isset($levels[$upper])) { - throw new \InvalidArgumentException("Provided logging level '$name' does not exist. Must be a valid monolog logging level."); - } - - return $levels[$upper]; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php deleted file mode 100644 index 766631c..0000000 --- a/vendor/silex/silex/src/Silex/Provider/RememberMeServiceProvider.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider; -use Symfony\Component\Security\Http\Firewall\RememberMeListener; -use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices; -use Symfony\Component\Security\Http\RememberMe\ResponseListener; - -/** - * Remember-me authentication for the SecurityServiceProvider. - * - * @author Jérôme Tamarelle - */ -class RememberMeServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['security.remember_me.response_listener'] = function ($app) { - if (!isset($app['security.token_storage'])) { - throw new \LogicException('You must register the SecurityServiceProvider to use the RememberMeServiceProvider'); - } - - return new ResponseListener(); - }; - - $app['security.authentication_listener.factory.remember_me'] = $app->protect(function ($name, $options) use ($app) { - if (empty($options['key'])) { - $options['key'] = $name; - } - - if (!isset($app['security.remember_me.service.'.$name])) { - $app['security.remember_me.service.'.$name] = $app['security.remember_me.service._proto']($name, $options); - } - - if (!isset($app['security.authentication_listener.'.$name.'.remember_me'])) { - $app['security.authentication_listener.'.$name.'.remember_me'] = $app['security.authentication_listener.remember_me._proto']($name, $options); - } - - if (!isset($app['security.authentication_provider.'.$name.'.remember_me'])) { - $app['security.authentication_provider.'.$name.'.remember_me'] = $app['security.authentication_provider.remember_me._proto']($name, $options); - } - - return array( - 'security.authentication_provider.'.$name.'.remember_me', - 'security.authentication_listener.'.$name.'.remember_me', - null, // entry point - 'remember_me', - ); - }); - - $app['security.remember_me.service._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return function () use ($providerKey, $options, $app) { - $options = array_replace(array( - 'name' => 'REMEMBERME', - 'lifetime' => 31536000, - 'path' => '/', - 'domain' => null, - 'secure' => false, - 'httponly' => true, - 'always_remember_me' => false, - 'remember_me_parameter' => '_remember_me', - ), $options); - - return new TokenBasedRememberMeServices(array($app['security.user_provider.'.$providerKey]), $options['key'], $providerKey, $options, $app['logger']); - }; - }); - - $app['security.authentication_listener.remember_me._proto'] = $app->protect(function ($providerKey) use ($app) { - return function () use ($app, $providerKey) { - $listener = new RememberMeListener( - $app['security.token_storage'], - $app['security.remember_me.service.'.$providerKey], - $app['security.authentication_manager'], - $app['logger'], - $app['dispatcher'] - ); - - return $listener; - }; - }); - - $app['security.authentication_provider.remember_me._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($app, $name, $options) { - return new RememberMeAuthenticationProvider($app['security.user_checker'], $options['key'], $name); - }; - }); - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['security.remember_me.response_listener']); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Routing/LazyRequestMatcher.php b/vendor/silex/silex/src/Silex/Provider/Routing/LazyRequestMatcher.php deleted file mode 100644 index 6837c79..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Routing/LazyRequestMatcher.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Routing; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; - -/** - * Implements a lazy UrlMatcher. - * - * @author Igor Wiedler - * @author Jérôme Tamarelle - */ -class LazyRequestMatcher implements RequestMatcherInterface -{ - private $factory; - - public function __construct(\Closure $factory) - { - $this->factory = $factory; - } - - /** - * Returns the corresponding RequestMatcherInterface instance. - * - * @return UrlMatcherInterface - */ - public function getRequestMatcher() - { - $matcher = call_user_func($this->factory); - if (!$matcher instanceof RequestMatcherInterface) { - throw new \LogicException("Factory supplied to LazyRequestMatcher must return implementation of Symfony\Component\Routing\RequestMatcherInterface."); - } - - return $matcher; - } - - /** - * {@inheritdoc} - */ - public function matchRequest(Request $request) - { - return $this->getRequestMatcher()->matchRequest($request); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php b/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php deleted file mode 100644 index 8b4a4da..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Routing/RedirectableUrlMatcher.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Routing; - -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher as BaseRedirectableUrlMatcher; - -/** - * Implements the RedirectableUrlMatcherInterface for Silex. - * - * @author Fabien Potencier - */ -class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher -{ - /** - * {@inheritdoc} - */ - public function redirect($path, $route, $scheme = null) - { - $url = $this->context->getBaseUrl().$path; - $query = $this->context->getQueryString() ?: ''; - - if ($query !== '') { - $url .= '?'.$query; - } - - if ($this->context->getHost()) { - if ($scheme) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); - } - - $url = $scheme.'://'.$this->context->getHost().$port.$url; - } - } - - return array( - '_controller' => function ($url) { return new RedirectResponse($url, 301); }, - '_route' => $route, - 'url' => $url, - ); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php deleted file mode 100644 index d040ba0..0000000 --- a/vendor/silex/silex/src/Silex/Provider/RoutingServiceProvider.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\ControllerCollection; -use Silex\Api\EventListenerProviderInterface; -use Silex\Provider\Routing\RedirectableUrlMatcher; -use Silex\Provider\Routing\LazyRequestMatcher; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Generator\UrlGenerator; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\HttpKernel\EventListener\RouterListener; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Symfony Routing component Provider. - * - * @author Fabien Potencier - */ -class RoutingServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['route_class'] = 'Silex\\Route'; - - $app['route_factory'] = $app->factory(function ($app) { - return new $app['route_class'](); - }); - - $app['routes_factory'] = $app->factory(function () { - return new RouteCollection(); - }); - - $app['routes'] = function ($app) { - return $app['routes_factory']; - }; - $app['url_generator'] = function ($app) { - return new UrlGenerator($app['routes'], $app['request_context']); - }; - - $app['request_matcher'] = function ($app) { - return new RedirectableUrlMatcher($app['routes'], $app['request_context']); - }; - - $app['request_context'] = function ($app) { - $context = new RequestContext(); - - $context->setHttpPort(isset($app['request.http_port']) ? $app['request.http_port'] : 80); - $context->setHttpsPort(isset($app['request.https_port']) ? $app['request.https_port'] : 443); - - return $context; - }; - - $app['controllers'] = function ($app) { - return $app['controllers_factory']; - }; - - $controllers_factory = function () use ($app, &$controllers_factory) { - return new ControllerCollection($app['route_factory'], $app['routes_factory'], $controllers_factory); - }; - $app['controllers_factory'] = $app->factory($controllers_factory); - - $app['routing.listener'] = function ($app) { - $urlMatcher = new LazyRequestMatcher(function () use ($app) { - return $app['request_matcher']; - }); - - return new RouterListener($urlMatcher, $app['request_stack'], $app['request_context'], $app['logger']); - }; - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['routing.listener']); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php deleted file mode 100644 index ebc5bea..0000000 --- a/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php +++ /dev/null @@ -1,696 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Application; -use Silex\Api\BootableProviderInterface; -use Silex\Api\ControllerProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\RequestMatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Security\Core\Security; -use Symfony\Component\Security\Core\User\UserChecker; -use Symfony\Component\Security\Core\User\InMemoryUserProvider; -use Symfony\Component\Security\Core\Encoder\EncoderFactory; -use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder; -use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder; -use Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder; -use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider; -use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider; -use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager; -use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; -use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; -use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; -use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; -use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter; -use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; -use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; -use Symfony\Component\Security\Core\Role\RoleHierarchy; -use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator; -use Symfony\Component\Security\Http\Firewall; -use Symfony\Component\Security\Http\FirewallMap; -use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\AccessListener; -use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\LogoutListener; -use Symfony\Component\Security\Http\Firewall\SwitchUserListener; -use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener; -use Symfony\Component\Security\Http\Firewall\ContextListener; -use Symfony\Component\Security\Http\Firewall\ExceptionListener; -use Symfony\Component\Security\Http\Firewall\ChannelListener; -use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint; -use Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint; -use Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint; -use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; -use Symfony\Component\Security\Http\Logout\SessionLogoutHandler; -use Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler; -use Symfony\Component\Security\Http\AccessMap; -use Symfony\Component\Security\Http\HttpUtils; -use Symfony\Component\Security\Guard\GuardAuthenticatorHandler; -use Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener; -use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider; - -/** - * Symfony Security component Provider. - * - * @author Fabien Potencier - */ -class SecurityServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface, ControllerProviderInterface, BootableProviderInterface -{ - protected $fakeRoutes; - - public function register(Container $app) - { - // used to register routes for login_check and logout - $this->fakeRoutes = array(); - - $that = $this; - - $app['security.role_hierarchy'] = array(); - $app['security.access_rules'] = array(); - $app['security.hide_user_not_found'] = true; - $app['security.encoder.bcrypt.cost'] = 13; - - $app['security.authorization_checker'] = function ($app) { - return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']); - }; - - $app['security.token_storage'] = function ($app) { - return new TokenStorage(); - }; - - $app['user'] = $app->factory(function ($app) { - if (null === $token = $app['security.token_storage']->getToken()) { - return; - } - - if (!is_object($user = $token->getUser())) { - return; - } - - return $user; - }); - - $app['security.authentication_manager'] = function ($app) { - $manager = new AuthenticationProviderManager($app['security.authentication_providers']); - $manager->setEventDispatcher($app['dispatcher']); - - return $manager; - }; - - // by default, all users use the digest encoder - $app['security.encoder_factory'] = function ($app) { - return new EncoderFactory(array( - 'Symfony\Component\Security\Core\User\UserInterface' => $app['security.default_encoder'], - )); - }; - - // by default, all users use the BCrypt encoder - $app['security.default_encoder'] = function ($app) { - return $app['security.encoder.bcrypt']; - }; - - $app['security.encoder.digest'] = function ($app) { - return new MessageDigestPasswordEncoder(); - }; - - $app['security.encoder.bcrypt'] = function ($app) { - return new BCryptPasswordEncoder($app['security.encoder.bcrypt.cost']); - }; - - $app['security.encoder.pbkdf2'] = function ($app) { - return new Pbkdf2PasswordEncoder(); - }; - - $app['security.user_checker'] = function ($app) { - return new UserChecker(); - }; - - $app['security.access_manager'] = function ($app) { - return new AccessDecisionManager($app['security.voters']); - }; - - $app['security.voters'] = function ($app) { - return array( - new RoleHierarchyVoter(new RoleHierarchy($app['security.role_hierarchy'])), - new AuthenticatedVoter($app['security.trust_resolver']), - ); - }; - - $app['security.firewall'] = function ($app) { - return new Firewall($app['security.firewall_map'], $app['dispatcher']); - }; - - $app['security.channel_listener'] = function ($app) { - return new ChannelListener( - $app['security.access_map'], - new RetryAuthenticationEntryPoint( - isset($app['request.http_port']) ? $app['request.http_port'] : 80, - isset($app['request.https_port']) ? $app['request.https_port'] : 443 - ), - $app['logger'] - ); - }; - - // generate the build-in authentication factories - foreach (array('logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous') as $type) { - $entryPoint = null; - if ('http' === $type) { - $entryPoint = 'http'; - } elseif ('form' === $type) { - $entryPoint = 'form'; - } elseif ('guard' === $type) { - $entryPoint = 'guard'; - } - - $app['security.authentication_listener.factory.'.$type] = $app->protect(function ($name, $options) use ($type, $app, $entryPoint) { - if ($entryPoint && !isset($app['security.entry_point.'.$name.'.'.$entryPoint])) { - $app['security.entry_point.'.$name.'.'.$entryPoint] = $app['security.entry_point.'.$entryPoint.'._proto']($name, $options); - } - - if (!isset($app['security.authentication_listener.'.$name.'.'.$type])) { - $app['security.authentication_listener.'.$name.'.'.$type] = $app['security.authentication_listener.'.$type.'._proto']($name, $options); - } - - $provider = 'dao'; - if ('anonymous' === $type) { - $provider = 'anonymous'; - } elseif ('guard' === $type) { - $provider = 'guard'; - } - if (!isset($app['security.authentication_provider.'.$name.'.'.$provider])) { - $app['security.authentication_provider.'.$name.'.'.$provider] = $app['security.authentication_provider.'.$provider.'._proto']($name, $options); - } - - return array( - 'security.authentication_provider.'.$name.'.'.$provider, - 'security.authentication_listener.'.$name.'.'.$type, - $entryPoint ? 'security.entry_point.'.$name.'.'.$entryPoint : null, - $type, - ); - }); - } - - $app['security.firewall_map'] = function ($app) { - $positions = array('logout', 'pre_auth', 'guard', 'form', 'http', 'remember_me', 'anonymous'); - $providers = array(); - $configs = array(); - foreach ($app['security.firewalls'] as $name => $firewall) { - $entryPoint = null; - $pattern = isset($firewall['pattern']) ? $firewall['pattern'] : null; - $users = isset($firewall['users']) ? $firewall['users'] : array(); - $security = isset($firewall['security']) ? (bool) $firewall['security'] : true; - $stateless = isset($firewall['stateless']) ? (bool) $firewall['stateless'] : false; - $context = isset($firewall['context']) ? $firewall['context'] : $name; - $hosts = isset($firewall['hosts']) ? $firewall['hosts'] : null; - $methods = isset($firewall['methods']) ? $firewall['methods'] : null; - unset($firewall['pattern'], $firewall['users'], $firewall['security'], $firewall['stateless'], $firewall['context'], $firewall['methods'], $firewall['hosts']); - $protected = false === $security ? false : count($firewall); - $listeners = array('security.channel_listener'); - - if ($protected) { - if (!isset($app['security.context_listener.'.$name])) { - if (!isset($app['security.user_provider.'.$name])) { - $app['security.user_provider.'.$name] = is_array($users) ? $app['security.user_provider.inmemory._proto']($users) : $users; - } - - $app['security.context_listener.'.$name] = $app['security.context_listener._proto']($name, array($app['security.user_provider.'.$name])); - } - - if (false === $stateless) { - $listeners[] = 'security.context_listener.'.$context; - } - - $factories = array(); - foreach ($positions as $position) { - $factories[$position] = array(); - } - - foreach ($firewall as $type => $options) { - if ('switch_user' === $type) { - continue; - } - - // normalize options - if (!is_array($options)) { - if (!$options) { - continue; - } - - $options = array(); - } - - if (!isset($app['security.authentication_listener.factory.'.$type])) { - throw new \LogicException(sprintf('The "%s" authentication entry is not registered.', $type)); - } - - $options['stateless'] = $stateless; - - list($providerId, $listenerId, $entryPointId, $position) = $app['security.authentication_listener.factory.'.$type]($name, $options); - - if (null !== $entryPointId) { - $entryPoint = $entryPointId; - } - - $factories[$position][] = $listenerId; - $providers[] = $providerId; - } - - foreach ($positions as $position) { - foreach ($factories[$position] as $listener) { - $listeners[] = $listener; - } - } - - $listeners[] = 'security.access_listener'; - - if (isset($firewall['switch_user'])) { - $app['security.switch_user.'.$name] = $app['security.authentication_listener.switch_user._proto']($name, $firewall['switch_user']); - - $listeners[] = 'security.switch_user.'.$name; - } - - if (!isset($app['security.exception_listener.'.$name])) { - if (null == $entryPoint) { - $app[$entryPoint = 'security.entry_point.'.$name.'.form'] = $app['security.entry_point.form._proto']($name, array()); - } - $accessDeniedHandler = null; - if (isset($app['security.access_denied_handler.'.$name])) { - $accessDeniedHandler = $app['security.access_denied_handler.'.$name]; - } - $app['security.exception_listener.'.$name] = $app['security.exception_listener._proto']($entryPoint, $name, $accessDeniedHandler); - } - } - - $configs[$name] = array( - 'pattern' => $pattern, - 'listeners' => $listeners, - 'protected' => $protected, - 'methods' => $methods, - 'hosts' => $hosts, - ); - } - - $app['security.authentication_providers'] = array_map(function ($provider) use ($app) { - return $app[$provider]; - }, array_unique($providers)); - - $map = new FirewallMap(); - foreach ($configs as $name => $config) { - if (is_string($config['pattern'])) { - $requestMatcher = new RequestMatcher($config['pattern'], $config['hosts'], $config['methods']); - } else { - $requestMatcher = $config['pattern']; - } - - $map->add( - $requestMatcher, - array_map(function ($listenerId) use ($app, $name) { - $listener = $app[$listenerId]; - - if (isset($app['security.remember_me.service.'.$name])) { - if ($listener instanceof AbstractAuthenticationListener || $listener instanceof GuardAuthenticationListener) { - $listener->setRememberMeServices($app['security.remember_me.service.'.$name]); - } - if ($listener instanceof LogoutListener) { - $listener->addHandler($app['security.remember_me.service.'.$name]); - } - } - - return $listener; - }, $config['listeners']), - $config['protected'] ? $app['security.exception_listener.'.$name] : null - ); - } - - return $map; - }; - - $app['security.access_listener'] = function ($app) { - return new AccessListener( - $app['security.token_storage'], - $app['security.access_manager'], - $app['security.access_map'], - $app['security.authentication_manager'], - $app['logger'] - ); - }; - - $app['security.access_map'] = function ($app) { - $map = new AccessMap(); - - foreach ($app['security.access_rules'] as $rule) { - if (is_string($rule[0])) { - $rule[0] = new RequestMatcher($rule[0]); - } elseif (is_array($rule[0])) { - $rule[0] += array( - 'path' => null, - 'host' => null, - 'methods' => null, - 'ips' => null, - 'attributes' => array(), - 'schemes' => null, - ); - $rule[0] = new RequestMatcher($rule[0]['path'], $rule[0]['host'], $rule[0]['methods'], $rule[0]['ips'], $rule[0]['attributes'], $rule[0]['schemes']); - } - $map->add($rule[0], (array) $rule[1], isset($rule[2]) ? $rule[2] : null); - } - - return $map; - }; - - $app['security.trust_resolver'] = function ($app) { - return new AuthenticationTrustResolver('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken', 'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken'); - }; - - $app['security.session_strategy'] = function ($app) { - return new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE); - }; - - $app['security.http_utils'] = function ($app) { - return new HttpUtils($app['url_generator'], $app['request_matcher']); - }; - - $app['security.last_error'] = $app->protect(function (Request $request) { - if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) { - return $request->attributes->get(Security::AUTHENTICATION_ERROR)->getMessage(); - } - - $session = $request->getSession(); - if ($session && $session->has(Security::AUTHENTICATION_ERROR)) { - $message = $session->get(Security::AUTHENTICATION_ERROR)->getMessage(); - $session->remove(Security::AUTHENTICATION_ERROR); - - return $message; - } - }); - - // prototypes (used by the Firewall Map) - - $app['security.context_listener._proto'] = $app->protect(function ($providerKey, $userProviders) use ($app) { - return function () use ($app, $userProviders, $providerKey) { - return new ContextListener( - $app['security.token_storage'], - $userProviders, - $providerKey, - $app['logger'], - $app['dispatcher'] - ); - }; - }); - - $app['security.user_provider.inmemory._proto'] = $app->protect(function ($params) use ($app) { - return function () use ($app, $params) { - $users = array(); - foreach ($params as $name => $user) { - $users[$name] = array('roles' => (array) $user[0], 'password' => $user[1]); - } - - return new InMemoryUserProvider($users); - }; - }); - - $app['security.exception_listener._proto'] = $app->protect(function ($entryPoint, $name, $accessDeniedHandler = null) use ($app) { - return function () use ($app, $entryPoint, $name, $accessDeniedHandler) { - return new ExceptionListener( - $app['security.token_storage'], - $app['security.trust_resolver'], - $app['security.http_utils'], - $name, - $app[$entryPoint], - null, // errorPage - $accessDeniedHandler, - $app['logger'] - ); - }; - }); - - $app['security.authentication.success_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($name, $options, $app) { - $handler = new DefaultAuthenticationSuccessHandler( - $app['security.http_utils'], - $options - ); - $handler->setProviderKey($name); - - return $handler; - }; - }); - - $app['security.authentication.failure_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($name, $options, $app) { - return new DefaultAuthenticationFailureHandler( - $app, - $app['security.http_utils'], - $options, - $app['logger'] - ); - }; - }); - - $app['security.authentication_listener.guard._proto'] = $app->protect(function ($providerKey, $options) use ($app, $that) { - return function () use ($app, $providerKey, $options, $that) { - if (!isset($app['security.authentication.guard_handler'])) { - $app['security.authentication.guard_handler'] = new GuardAuthenticatorHandler($app['security.token_storage'], $app['dispatcher']); - } - - $authenticators = array(); - foreach ($options['authenticators'] as $authenticatorId) { - $authenticators[] = $app[$authenticatorId]; - } - - return new GuardAuthenticationListener( - $app['security.authentication.guard_handler'], - $app['security.authentication_manager'], - $providerKey, - $authenticators, - $app['logger'] - ); - }; - }); - - $app['security.authentication_listener.form._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return function () use ($app, $name, $options, $that) { - $that->addFakeRoute( - 'match', - $tmp = isset($options['check_path']) ? $options['check_path'] : '/login_check', - str_replace('/', '_', ltrim($tmp, '/')) - ); - - $class = isset($options['listener_class']) ? $options['listener_class'] : 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener'; - - if (!isset($app['security.authentication.success_handler.'.$name])) { - $app['security.authentication.success_handler.'.$name] = $app['security.authentication.success_handler._proto']($name, $options); - } - - if (!isset($app['security.authentication.failure_handler.'.$name])) { - $app['security.authentication.failure_handler.'.$name] = $app['security.authentication.failure_handler._proto']($name, $options); - } - - return new $class( - $app['security.token_storage'], - $app['security.authentication_manager'], - isset($app['security.session_strategy.'.$name]) ? $app['security.session_strategy.'.$name] : $app['security.session_strategy'], - $app['security.http_utils'], - $name, - $app['security.authentication.success_handler.'.$name], - $app['security.authentication.failure_handler.'.$name], - $options, - $app['logger'], - $app['dispatcher'], - isset($options['with_csrf']) && $options['with_csrf'] && isset($app['csrf.token_manager']) ? $app['csrf.token_manager'] : null - ); - }; - }); - - $app['security.authentication_listener.http._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return function () use ($app, $providerKey, $options) { - return new BasicAuthenticationListener( - $app['security.token_storage'], - $app['security.authentication_manager'], - $providerKey, - $app['security.entry_point.'.$providerKey.'.http'], - $app['logger'] - ); - }; - }); - - $app['security.authentication_listener.anonymous._proto'] = $app->protect(function ($providerKey, $options) use ($app) { - return function () use ($app, $providerKey, $options) { - return new AnonymousAuthenticationListener( - $app['security.token_storage'], - $providerKey, - $app['logger'] - ); - }; - }); - - $app['security.authentication.logout_handler._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($name, $options, $app) { - return new DefaultLogoutSuccessHandler( - $app['security.http_utils'], - isset($options['target_url']) ? $options['target_url'] : '/' - ); - }; - }); - - $app['security.authentication_listener.logout._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return function () use ($app, $name, $options, $that) { - $that->addFakeRoute( - 'get', - $tmp = isset($options['logout_path']) ? $options['logout_path'] : '/logout', - str_replace('/', '_', ltrim($tmp, '/')) - ); - - if (!isset($app['security.authentication.logout_handler.'.$name])) { - $app['security.authentication.logout_handler.'.$name] = $app['security.authentication.logout_handler._proto']($name, $options); - } - - $listener = new LogoutListener( - $app['security.token_storage'], - $app['security.http_utils'], - $app['security.authentication.logout_handler.'.$name], - $options, - isset($options['with_csrf']) && $options['with_csrf'] && isset($app['csrf.token_manager']) ? $app['csrf.token_manager'] : null - ); - - $invalidateSession = isset($options['invalidate_session']) ? $options['invalidate_session'] : true; - if (true === $invalidateSession && false === $options['stateless']) { - $listener->addHandler(new SessionLogoutHandler()); - } - - return $listener; - }; - }); - - $app['security.authentication_listener.switch_user._proto'] = $app->protect(function ($name, $options) use ($app, $that) { - return function () use ($app, $name, $options, $that) { - return new SwitchUserListener( - $app['security.token_storage'], - $app['security.user_provider.'.$name], - $app['security.user_checker'], - $name, - $app['security.access_manager'], - $app['logger'], - isset($options['parameter']) ? $options['parameter'] : '_switch_user', - isset($options['role']) ? $options['role'] : 'ROLE_ALLOWED_TO_SWITCH', - $app['dispatcher'] - ); - }; - }); - - $app['security.entry_point.form._proto'] = $app->protect(function ($name, array $options) use ($app) { - return function () use ($app, $options) { - $loginPath = isset($options['login_path']) ? $options['login_path'] : '/login'; - $useForward = isset($options['use_forward']) ? $options['use_forward'] : false; - - return new FormAuthenticationEntryPoint($app, $app['security.http_utils'], $loginPath, $useForward); - }; - }); - - $app['security.entry_point.http._proto'] = $app->protect(function ($name, array $options) use ($app) { - return function () use ($app, $name, $options) { - return new BasicAuthenticationEntryPoint(isset($options['real_name']) ? $options['real_name'] : 'Secured'); - }; - }); - - $app['security.entry_point.guard._proto'] = $app->protect(function ($name, array $options) use ($app) { - if (isset($options['entry_point'])) { - // if it's configured explicitly, use it! - return $app[$options['entry_point']]; - } - $authenticatorIds = $options['authenticators']; - if (count($authenticatorIds) == 1) { - // if there is only one authenticator, use that as the entry point - return $app[reset($authenticatorIds)]; - } - // we have multiple entry points - we must ask them to configure one - throw new \LogicException(sprintf( - 'Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', - implode(', ', $authenticatorIds) - )); - }); - - $app['security.authentication_provider.dao._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($app, $name) { - return new DaoAuthenticationProvider( - $app['security.user_provider.'.$name], - $app['security.user_checker'], - $name, - $app['security.encoder_factory'], - $app['security.hide_user_not_found'] - ); - }; - }); - - $app['security.authentication_provider.guard._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($app, $name, $options) { - $authenticators = array(); - foreach ($options['authenticators'] as $authenticatorId) { - $authenticators[] = $app[$authenticatorId]; - } - - return new GuardAuthenticationProvider( - $authenticators, - $app['security.user_provider.'.$name], - $name, - $app['security.user_checker'] - ); - }; - }); - - $app['security.authentication_provider.anonymous._proto'] = $app->protect(function ($name, $options) use ($app) { - return function () use ($app, $name) { - return new AnonymousAuthenticationProvider($name); - }; - }); - - if (isset($app['validator'])) { - $app['security.validator.user_password_validator'] = function ($app) { - return new UserPasswordValidator($app['security.token_storage'], $app['security.encoder_factory']); - }; - - $app['validator.validator_service_ids'] = array_merge($app['validator.validator_service_ids'], array('security.validator.user_password' => 'security.validator.user_password_validator')); - } - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['security.firewall']); - } - - public function connect(Application $app) - { - $controllers = $app['controllers_factory']; - foreach ($this->fakeRoutes as $route) { - list($method, $pattern, $name) = $route; - - $controllers->$method($pattern)->run(null)->bind($name); - } - - return $controllers; - } - - public function boot(Application $app) - { - $app->mount('/', $this->connect($app)); - } - - public function addFakeRoute($method, $pattern, $name) - { - $this->fakeRoutes[] = array($method, $pattern, $name); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php deleted file mode 100644 index 8986abe..0000000 --- a/vendor/silex/silex/src/Silex/Provider/SerializerServiceProvider.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\Serializer\Serializer; -use Symfony\Component\Serializer\Encoder\JsonEncoder; -use Symfony\Component\Serializer\Encoder\XmlEncoder; -use Symfony\Component\Serializer\Normalizer\CustomNormalizer; -use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; - -/** - * Symfony Serializer component Provider. - * - * @author Fabien Potencier - * @author Marijn Huizendveld - */ -class SerializerServiceProvider implements ServiceProviderInterface -{ - /** - * {@inheritdoc} - * - * This method registers a serializer service. {@link http://api.symfony.com/master/Symfony/Component/Serializer/Serializer.html - * The service is provided by the Symfony Serializer component}. - */ - public function register(Container $app) - { - $app['serializer'] = function ($app) { - return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']); - }; - - $app['serializer.encoders'] = function () { - return array(new JsonEncoder(), new XmlEncoder()); - }; - - $app['serializer.normalizers'] = function () { - return array(new CustomNormalizer(), new GetSetMethodNormalizer()); - }; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php deleted file mode 100644 index 1c38adc..0000000 --- a/vendor/silex/silex/src/Silex/Provider/ServiceControllerServiceProvider.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\ServiceControllerResolver; - -class ServiceControllerServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app->extend('resolver', function ($resolver, $app) { - return new ServiceControllerResolver($resolver, $app['callback_resolver']); - }); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Session/SessionListener.php b/vendor/silex/silex/src/Silex/Provider/Session/SessionListener.php deleted file mode 100644 index aba4c4e..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Session/SessionListener.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Session; - -use Pimple\Container; -use Symfony\Component\HttpKernel\EventListener\SessionListener as BaseSessionListener; - -/** - * Sets the session in the request. - * - * @author Fabien Potencier - */ -class SessionListener extends BaseSessionListener -{ - private $app; - - public function __construct(Container $app) - { - $this->app = $app; - } - - protected function getSession() - { - if (!isset($this->app['session'])) { - return; - } - - return $this->app['session']; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Session/TestSessionListener.php b/vendor/silex/silex/src/Silex/Provider/Session/TestSessionListener.php deleted file mode 100644 index ab98eb1..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Session/TestSessionListener.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Session; - -use Pimple\Container; -use Symfony\Component\HttpKernel\EventListener\TestSessionListener as BaseTestSessionListener; - -/** - * Simulates sessions for testing purpose. - * - * @author Fabien Potencier - */ -class TestSessionListener extends BaseTestSessionListener -{ - private $app; - - public function __construct(Container $app) - { - $this->app = $app; - } - - protected function getSession() - { - if (!isset($this->app['session'])) { - return; - } - - return $this->app['session']; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php deleted file mode 100644 index a51e230..0000000 --- a/vendor/silex/silex/src/Silex/Provider/SessionServiceProvider.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Silex\Provider\Session\SessionListener; -use Silex\Provider\Session\TestSessionListener; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; - -/** - * Symfony HttpFoundation component Provider for sessions. - * - * @author Fabien Potencier - */ -class SessionServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['session.test'] = false; - - $app['session'] = function ($app) { - return new Session($app['session.storage'], $app['session.attribute_bag'], $app['session.flash_bag']); - }; - - $app['session.storage'] = function ($app) { - if ($app['session.test']) { - return $app['session.storage.test']; - } - - return $app['session.storage.native']; - }; - - $app['session.storage.handler'] = function ($app) { - return new NativeFileSessionHandler($app['session.storage.save_path']); - }; - - $app['session.storage.native'] = function ($app) { - return new NativeSessionStorage( - $app['session.storage.options'], - $app['session.storage.handler'] - ); - }; - - $app['session.listener'] = function ($app) { - return new SessionListener($app); - }; - - $app['session.storage.test'] = function () { - return new MockFileSessionStorage(); - }; - - $app['session.listener.test'] = function ($app) { - return new TestSessionListener($app); - }; - - $app['session.storage.options'] = array(); - $app['session.default_locale'] = 'en'; - $app['session.storage.save_path'] = null; - $app['session.attribute_bag'] = null; - $app['session.flash_bag'] = null; - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - $dispatcher->addSubscriber($app['session.listener']); - - if ($app['session.test']) { - $app['dispatcher']->addSubscriber($app['session.listener.test']); - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php deleted file mode 100644 index c3dce6c..0000000 --- a/vendor/silex/silex/src/Silex/Provider/SwiftmailerServiceProvider.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Api\EventListenerProviderInterface; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; - -/** - * Swiftmailer Provider. - * - * @author Fabien Potencier - */ -class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['swiftmailer.options'] = array(); - $app['swiftmailer.use_spool'] = true; - - $app['mailer.initialized'] = false; - - $app['mailer'] = function ($app) { - $app['mailer.initialized'] = true; - $transport = $app['swiftmailer.use_spool'] ? $app['swiftmailer.spooltransport'] : $app['swiftmailer.transport']; - - return new \Swift_Mailer($transport); - }; - - $app['swiftmailer.spooltransport'] = function ($app) { - return new \Swift_Transport_SpoolTransport($app['swiftmailer.transport.eventdispatcher'], $app['swiftmailer.spool']); - }; - - $app['swiftmailer.spool'] = function ($app) { - return new \Swift_MemorySpool(); - }; - - $app['swiftmailer.transport'] = function ($app) { - $transport = new \Swift_Transport_EsmtpTransport( - $app['swiftmailer.transport.buffer'], - array($app['swiftmailer.transport.authhandler']), - $app['swiftmailer.transport.eventdispatcher'] - ); - - $options = $app['swiftmailer.options'] = array_replace(array( - 'host' => 'localhost', - 'port' => 25, - 'username' => '', - 'password' => '', - 'encryption' => null, - 'auth_mode' => null, - ), $app['swiftmailer.options']); - - $transport->setHost($options['host']); - $transport->setPort($options['port']); - $transport->setEncryption($options['encryption']); - $transport->setUsername($options['username']); - $transport->setPassword($options['password']); - $transport->setAuthMode($options['auth_mode']); - - return $transport; - }; - - $app['swiftmailer.transport.buffer'] = function () { - return new \Swift_Transport_StreamBuffer(new \Swift_StreamFilters_StringReplacementFilterFactory()); - }; - - $app['swiftmailer.transport.authhandler'] = function () { - return new \Swift_Transport_Esmtp_AuthHandler(array( - new \Swift_Transport_Esmtp_Auth_CramMd5Authenticator(), - new \Swift_Transport_Esmtp_Auth_LoginAuthenticator(), - new \Swift_Transport_Esmtp_Auth_PlainAuthenticator(), - )); - }; - - $app['swiftmailer.transport.eventdispatcher'] = function ($app) { - $dispatcher = new \Swift_Events_SimpleEventDispatcher(); - - $plugins = $app['swiftmailer.plugins']; - - if (null !== $app['swiftmailer.sender_address']) { - $plugins[] = new \Swift_Plugins_ImpersonatePlugin($app['swiftmailer.sender_address']); - } - - if (!empty($app['swiftmailer.delivery_addresses'])) { - $plugins[] = new \Swift_Plugins_RedirectingPlugin( - $app['swiftmailer.delivery_addresses'], - $app['swiftmailer.delivery_whitelist'] - ); - } - - foreach ($plugins as $plugin) { - $dispatcher->bindEventListener($plugin); - } - - return $dispatcher; - }; - - $app['swiftmailer.plugins'] = function ($app) { - return array(); - }; - - $app['swiftmailer.sender_address'] = null; - $app['swiftmailer.delivery_addresses'] = array(); - $app['swiftmailer.delivery_whitelist'] = array(); - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - // Event has no typehint as it can be either a PostResponseEvent or a ConsoleTerminateEvent - $onTerminate = function ($event) use ($app) { - // To speed things up (by avoiding Swift Mailer initialization), flush - // messages only if our mailer has been created (potentially used) - if ($app['mailer.initialized'] && $app['swiftmailer.use_spool'] && $app['swiftmailer.spooltransport'] instanceof \Swift_Transport_SpoolTransport) { - $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']); - } - }; - - $dispatcher->addListener(KernelEvents::TERMINATE, $onTerminate); - - if (class_exists('Symfony\Component\Console\ConsoleEvents')) { - $dispatcher->addListener(ConsoleEvents::TERMINATE, $onTerminate); - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php deleted file mode 100644 index a9ee55c..0000000 --- a/vendor/silex/silex/src/Silex/Provider/TranslationServiceProvider.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\MessageSelector; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Symfony\Component\Translation\Loader\XliffFileLoader; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpKernel\EventListener\TranslatorListener; -use Silex\Api\EventListenerProviderInterface; - -/** - * Symfony Translation component Provider. - * - * @author Fabien Potencier - */ -class TranslationServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface -{ - public function register(Container $app) - { - $app['translator'] = function ($app) { - if (!isset($app['locale'])) { - throw new \LogicException('You must define \'locale\' parameter or register the LocaleServiceProvider to use the TranslationServiceProvider'); - } - - $translator = new Translator($app['locale'], $app['translator.message_selector'], $app['translator.cache_dir'], $app['debug']); - $translator->setFallbackLocales($app['locale_fallbacks']); - $translator->addLoader('array', new ArrayLoader()); - $translator->addLoader('xliff', new XliffFileLoader()); - - if (isset($app['validator'])) { - $r = new \ReflectionClass('Symfony\Component\Validator\Validation'); - $file = dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf'; - if (file_exists($file)) { - $translator->addResource('xliff', $file, $app['locale'], 'validators'); - } - } - - if (isset($app['form.factory'])) { - $r = new \ReflectionClass('Symfony\Component\Form\Form'); - $file = dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf'; - if (file_exists($file)) { - $translator->addResource('xliff', $file, $app['locale'], 'validators'); - } - } - - // Register default resources - foreach ($app['translator.resources'] as $resource) { - $translator->addResource($resource[0], $resource[1], $resource[2], $resource[3]); - } - - foreach ($app['translator.domains'] as $domain => $data) { - foreach ($data as $locale => $messages) { - $translator->addResource('array', $messages, $locale, $domain); - } - } - - return $translator; - }; - - if (isset($app['request_stack'])) { - $app['translator.listener'] = function ($app) { - return new TranslatorListener($app['translator'], $app['request_stack']); - }; - } - - $app['translator.message_selector'] = function () { - return new MessageSelector(); - }; - - $app['translator.resources'] = function ($app) { - return array(); - }; - - $app['translator.domains'] = array(); - $app['locale_fallbacks'] = array('en'); - $app['translator.cache_dir'] = null; - } - - public function subscribe(Container $app, EventDispatcherInterface $dispatcher) - { - if (isset($app['translator.listener'])) { - $dispatcher->addSubscriber($app['translator.listener']); - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Twig/RuntimeLoader.php b/vendor/silex/silex/src/Silex/Provider/Twig/RuntimeLoader.php deleted file mode 100644 index 9a7aa91..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Twig/RuntimeLoader.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Twig; - -use Pimple\Container; - -/** - * Loads Twig extension runtimes via Pimple. - * - * @author Fabien Potencier - */ -class RuntimeLoader implements \Twig_RuntimeLoaderInterface -{ - private $container; - private $mapping; - - public function __construct(Container $container, array $mapping) - { - $this->container = $container; - $this->mapping = $mapping; - } - - /** - * {@inheritdoc} - */ - public function load($class) - { - if (isset($this->mapping[$class])) { - return $this->container[$this->mapping[$class]]; - } - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php deleted file mode 100644 index f15a93b..0000000 --- a/vendor/silex/silex/src/Silex/Provider/TwigServiceProvider.php +++ /dev/null @@ -1,190 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Provider\Twig\RuntimeLoader; -use Symfony\Bridge\Twig\AppVariable; -use Symfony\Bridge\Twig\Extension\AssetExtension; -use Symfony\Bridge\Twig\Extension\DumpExtension; -use Symfony\Bridge\Twig\Extension\RoutingExtension; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Extension\SecurityExtension; -use Symfony\Bridge\Twig\Extension\HttpFoundationExtension; -use Symfony\Bridge\Twig\Extension\HttpKernelExtension; -use Symfony\Bridge\Twig\Extension\WebLinkExtension; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Symfony\Bridge\Twig\Extension\HttpKernelRuntime; -use Symfony\Component\WebLink\HttpHeaderSerializer; - -/** - * Twig integration for Silex. - * - * @author Fabien Potencier - */ -class TwigServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app['twig.options'] = array(); - $app['twig.form.templates'] = array('form_div_layout.html.twig'); - $app['twig.path'] = array(); - $app['twig.templates'] = array(); - - $app['twig.date.format'] = 'F j, Y H:i'; - $app['twig.date.interval_format'] = '%d days'; - $app['twig.date.timezone'] = null; - - $app['twig.number_format.decimals'] = 0; - $app['twig.number_format.decimal_point'] = '.'; - $app['twig.number_format.thousands_separator'] = ','; - - $app['twig'] = function ($app) { - $app['twig.options'] = array_replace( - array( - 'charset' => $app['charset'], - 'debug' => $app['debug'], - 'strict_variables' => $app['debug'], - ), $app['twig.options'] - ); - - $twig = $app['twig.environment_factory']($app); - // registered for BC, but should not be used anymore - // deprecated and should probably be removed in Silex 3.0 - $twig->addGlobal('app', $app); - - $coreExtension = $twig->getExtension('Twig_Extension_Core'); - - $coreExtension->setDateFormat($app['twig.date.format'], $app['twig.date.interval_format']); - - if (null !== $app['twig.date.timezone']) { - $coreExtension->setTimezone($app['twig.date.timezone']); - } - - $coreExtension->setNumberFormat($app['twig.number_format.decimals'], $app['twig.number_format.decimal_point'], $app['twig.number_format.thousands_separator']); - - if ($app['debug']) { - $twig->addExtension(new \Twig_Extension_Debug()); - } - - if (class_exists('Symfony\Bridge\Twig\Extension\RoutingExtension')) { - $app['twig.app_variable'] = function ($app) { - $var = new AppVariable(); - if (isset($app['security.token_storage'])) { - $var->setTokenStorage($app['security.token_storage']); - } - if (isset($app['request_stack'])) { - $var->setRequestStack($app['request_stack']); - } - $var->setDebug($app['debug']); - - return $var; - }; - - $twig->addGlobal('global', $app['twig.app_variable']); - - if (isset($app['request_stack'])) { - $twig->addExtension(new HttpFoundationExtension($app['request_stack'])); - $twig->addExtension(new RoutingExtension($app['url_generator'])); - } - - if (isset($app['translator'])) { - $twig->addExtension(new TranslationExtension($app['translator'])); - } - - if (isset($app['security.authorization_checker'])) { - $twig->addExtension(new SecurityExtension($app['security.authorization_checker'])); - } - - if (isset($app['fragment.handler'])) { - $app['fragment.renderer.hinclude']->setTemplating($twig); - - $twig->addExtension(new HttpKernelExtension($app['fragment.handler'])); - } - - if (isset($app['assets.packages'])) { - $twig->addExtension(new AssetExtension($app['assets.packages'])); - } - - if (isset($app['form.factory'])) { - $app['twig.form.engine'] = function ($app) use ($twig) { - return new TwigRendererEngine($app['twig.form.templates'], $twig); - }; - - $app['twig.form.renderer'] = function ($app) { - $csrfTokenManager = isset($app['csrf.token_manager']) ? $app['csrf.token_manager'] : null; - - return new TwigRenderer($app['twig.form.engine'], $csrfTokenManager); - }; - - $twig->addExtension(new FormExtension(class_exists(HttpKernelRuntime::class) ? null : $app['twig.form.renderer'])); - - // add loader for Symfony built-in form templates - $reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); - $path = dirname($reflected->getFileName()).'/../Resources/views/Form'; - $app['twig.loader']->addLoader(new \Twig_Loader_Filesystem($path)); - } - - if (isset($app['var_dumper.cloner'])) { - $twig->addExtension(new DumpExtension($app['var_dumper.cloner'])); - } - - if (class_exists(HttpKernelRuntime::class)) { - $twig->addRuntimeLoader($app['twig.runtime_loader']); - } - - if (class_exists(HttpHeaderSerializer::class) && class_exists(WebLinkExtension::class)) { - $twig->addExtension(new WebLinkExtension($app['request_stack'])); - } - } - - return $twig; - }; - - $app['twig.loader.filesystem'] = function ($app) { - return new \Twig_Loader_Filesystem($app['twig.path']); - }; - - $app['twig.loader.array'] = function ($app) { - return new \Twig_Loader_Array($app['twig.templates']); - }; - - $app['twig.loader'] = function ($app) { - return new \Twig_Loader_Chain(array( - $app['twig.loader.array'], - $app['twig.loader.filesystem'], - )); - }; - - $app['twig.environment_factory'] = $app->protect(function ($app) { - return new \Twig_Environment($app['twig.loader'], $app['twig.options']); - }); - - $app['twig.runtime.httpkernel'] = function ($app) { - return new HttpKernelRuntime($app['fragment.handler']); - }; - - $app['twig.runtimes'] = function ($app) { - return array( - HttpKernelRuntime::class => 'twig.runtime.httpkernel', - TwigRenderer::class => 'twig.form.renderer', - ); - }; - - $app['twig.runtime_loader'] = function ($app) { - return new RuntimeLoader($app, $app['twig.runtimes']); - }; - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php b/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php deleted file mode 100644 index 9f5e499..0000000 --- a/vendor/silex/silex/src/Silex/Provider/Validator/ConstraintValidatorFactory.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider\Validator; - -use Pimple\Container; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidatorFactory as BaseConstraintValidatorFactory; - -/** - * Uses a service container to create constraint validators with dependencies. - * - * @author Kris Wallsmith - * @author Alex Kalyvitis - */ -class ConstraintValidatorFactory extends BaseConstraintValidatorFactory -{ - /** - * @var Container - */ - protected $container; - - /** - * @var array - */ - protected $serviceNames; - - /** - * Constructor. - * - * @param Container $container DI container - * @param array $serviceNames Validator service names - */ - public function __construct(Container $container, array $serviceNames = array(), $propertyAccessor = null) - { - parent::__construct($propertyAccessor); - - $this->container = $container; - $this->serviceNames = $serviceNames; - } - - /** - * {@inheritdoc} - */ - public function getInstance(Constraint $constraint) - { - $name = $constraint->validatedBy(); - - if (isset($this->serviceNames[$name])) { - return $this->container[$this->serviceNames[$name]]; - } - - return parent::getInstance($constraint); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php deleted file mode 100644 index d89a3cb..0000000 --- a/vendor/silex/silex/src/Silex/Provider/ValidatorServiceProvider.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Provider\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Validator; -use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; -use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Validation; - -/** - * Symfony Validator component Provider. - * - * @author Fabien Potencier - */ -class ValidatorServiceProvider implements ServiceProviderInterface -{ - public function register(Container $app) - { - $app['validator'] = function ($app) { - return $app['validator.builder']->getValidator(); - }; - - $app['validator.builder'] = function ($app) { - $builder = Validation::createValidatorBuilder(); - $builder->setConstraintValidatorFactory($app['validator.validator_factory']); - $builder->setTranslationDomain('validators'); - $builder->addObjectInitializers($app['validator.object_initializers']); - $builder->setMetadataFactory($app['validator.mapping.class_metadata_factory']); - if (isset($app['translator'])) { - $builder->setTranslator($app['translator']); - } - - return $builder; - }; - - $app['validator.mapping.class_metadata_factory'] = function ($app) { - return new LazyLoadingMetadataFactory(new StaticMethodLoader()); - }; - - $app['validator.validator_factory'] = function () use ($app) { - return new ConstraintValidatorFactory($app, $app['validator.validator_service_ids']); - }; - - $app['validator.object_initializers'] = function ($app) { - return array(); - }; - - $app['validator.validator_service_ids'] = array(); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/VarDumperServiceProvider.php b/vendor/silex/silex/src/Silex/Provider/VarDumperServiceProvider.php deleted file mode 100644 index 7c40b5e..0000000 --- a/vendor/silex/silex/src/Silex/Provider/VarDumperServiceProvider.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Provider; - -use Pimple\Container; -use Pimple\ServiceProviderInterface; -use Silex\Application; -use Silex\Api\BootableProviderInterface; -use Symfony\Component\VarDumper\VarDumper; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; - -/** - * Symfony Var Dumper component Provider. - * - * @author Fabien Potencier - */ -class VarDumperServiceProvider implements ServiceProviderInterface, BootableProviderInterface -{ - public function register(Container $app) - { - $app['var_dumper.cli_dumper'] = function ($app) { - return new CliDumper($app['var_dumper.dump_destination'], $app['charset']); - }; - - $app['var_dumper.cloner'] = function ($app) { - return new VarCloner(); - }; - - $app['var_dumper.dump_destination'] = null; - } - - public function boot(Application $app) - { - if (!$app['debug']) { - return; - } - - // This code is here to lazy load the dump stack. This default - // configuration for CLI mode is overridden in HTTP mode on - // 'kernel.request' event - VarDumper::setHandler(function ($var) use ($app) { - VarDumper::setHandler($handler = function ($var) use ($app) { - $app['var_dumper.cli_dumper']->dump($app['var_dumper.cloner']->cloneVar($var)); - }); - $handler($var); - }); - } -} diff --git a/vendor/silex/silex/src/Silex/Provider/composer.json b/vendor/silex/silex/src/Silex/Provider/composer.json deleted file mode 100644 index a1e9fbf..0000000 --- a/vendor/silex/silex/src/Silex/Provider/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "minimum-stability": "dev", - "name": "silex/providers", - "description": "The Silex providers", - "keywords": ["microframework"], - "homepage": "http://silex.sensiolabs.org", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - } - ], - "require": { - "php": ">=5.5.9", - "pimple/pimple": "~3.0", - "silex/api": "~2.2" - }, - "autoload": { - "psr-4": { "Silex\\Provider\\": "" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - } -} diff --git a/vendor/silex/silex/src/Silex/Route.php b/vendor/silex/silex/src/Silex/Route.php deleted file mode 100644 index 99e82d8..0000000 --- a/vendor/silex/silex/src/Silex/Route.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\Routing\Route as BaseRoute; - -/** - * A wrapper for a controller, mapped to a route. - * - * @author Fabien Potencier - */ -class Route extends BaseRoute -{ - /** - * Constructor. - * - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * - * @param string $path The path pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * @param string $host The host pattern to match - * @param string|array $schemes A required URI scheme or an array of restricted schemes - * @param string|array $methods A required HTTP method or an array of restricted methods - */ - public function __construct($path = '/', array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array()) - { - // overridden constructor to make $path optional - parent::__construct($path, $defaults, $requirements, $options, $host, $schemes, $methods); - } - - /** - * Sets the route code that should be executed when matched. - * - * @param callable $to PHP callback that returns the response when matched - * - * @return Route $this The current Route instance - */ - public function run($to) - { - $this->setDefault('_controller', $to); - - return $this; - } - - /** - * Sets the requirement for a route variable. - * - * @param string $variable The variable name - * @param string $regexp The regexp to apply - * - * @return Route $this The current route instance - */ - public function assert($variable, $regexp) - { - $this->setRequirement($variable, $regexp); - - return $this; - } - - /** - * Sets the default value for a route variable. - * - * @param string $variable The variable name - * @param mixed $default The default value - * - * @return Route $this The current Route instance - */ - public function value($variable, $default) - { - $this->setDefault($variable, $default); - - return $this; - } - - /** - * Sets a converter for a route variable. - * - * @param string $variable The variable name - * @param mixed $callback A PHP callback that converts the original value - * - * @return Route $this The current Route instance - */ - public function convert($variable, $callback) - { - $converters = $this->getOption('_converters'); - $converters[$variable] = $callback; - $this->setOption('_converters', $converters); - - return $this; - } - - /** - * Sets the requirement for the HTTP method. - * - * @param string $method The HTTP method name. Multiple methods can be supplied, delimited by a pipe character '|', eg. 'GET|POST' - * - * @return Route $this The current Route instance - */ - public function method($method) - { - $this->setMethods(explode('|', $method)); - - return $this; - } - - /** - * Sets the requirement of host on this Route. - * - * @param string $host The host for which this route should be enabled - * - * @return Route $this The current Route instance - */ - public function host($host) - { - $this->setHost($host); - - return $this; - } - - /** - * Sets the requirement of HTTP (no HTTPS) on this Route. - * - * @return Route $this The current Route instance - */ - public function requireHttp() - { - $this->setSchemes('http'); - - return $this; - } - - /** - * Sets the requirement of HTTPS on this Route. - * - * @return Route $this The current Route instance - */ - public function requireHttps() - { - $this->setSchemes('https'); - - return $this; - } - - /** - * Sets a callback to handle before triggering the route callback. - * - * @param mixed $callback A PHP callback to be triggered when the Route is matched, just before the route callback - * - * @return Route $this The current Route instance - */ - public function before($callback) - { - $callbacks = $this->getOption('_before_middlewares'); - $callbacks[] = $callback; - $this->setOption('_before_middlewares', $callbacks); - - return $this; - } - - /** - * Sets a callback to handle after the route callback. - * - * @param mixed $callback A PHP callback to be triggered after the route callback - * - * @return Route $this The current Route instance - */ - public function after($callback) - { - $callbacks = $this->getOption('_after_middlewares'); - $callbacks[] = $callback; - $this->setOption('_after_middlewares', $callbacks); - - return $this; - } - - /** - * Sets a condition for the route to match. - * - * @param string $condition The condition - * - * @return Route $this The current Route instance - */ - public function when($condition) - { - $this->setCondition($condition); - - return $this; - } -} diff --git a/vendor/silex/silex/src/Silex/Route/SecurityTrait.php b/vendor/silex/silex/src/Silex/Route/SecurityTrait.php deleted file mode 100644 index d42ba2f..0000000 --- a/vendor/silex/silex/src/Silex/Route/SecurityTrait.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Route; - -use Symfony\Component\Security\Core\Exception\AccessDeniedException; - -/** - * Security trait. - * - * @author Fabien Potencier - */ -trait SecurityTrait -{ - public function secure($roles) - { - $this->before(function ($request, $app) use ($roles) { - if (!$app['security.authorization_checker']->isGranted($roles)) { - throw new AccessDeniedException(); - } - }); - } -} diff --git a/vendor/silex/silex/src/Silex/ServiceControllerResolver.php b/vendor/silex/silex/src/Silex/ServiceControllerResolver.php deleted file mode 100644 index 87f91b0..0000000 --- a/vendor/silex/silex/src/Silex/ServiceControllerResolver.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; - -/** - * Enables name_of_service:method_name syntax for declaring controllers. - * - * @link http://silex.sensiolabs.org/doc/providers/service_controller.html - */ -class ServiceControllerResolver implements ControllerResolverInterface -{ - protected $controllerResolver; - protected $callbackResolver; - - /** - * Constructor. - * - * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance to delegate to - * @param CallbackResolver $callbackResolver A service resolver instance - */ - public function __construct(ControllerResolverInterface $controllerResolver, CallbackResolver $callbackResolver) - { - $this->controllerResolver = $controllerResolver; - $this->callbackResolver = $callbackResolver; - } - - /** - * {@inheritdoc} - */ - public function getController(Request $request) - { - $controller = $request->attributes->get('_controller', null); - - if (!$this->callbackResolver->isValid($controller)) { - return $this->controllerResolver->getController($request); - } - - return $this->callbackResolver->convertCallback($controller); - } - - /** - * {@inheritdoc} - */ - public function getArguments(Request $request, $controller) - { - return $this->controllerResolver->getArguments($request, $controller); - } -} diff --git a/vendor/silex/silex/src/Silex/ViewListenerWrapper.php b/vendor/silex/silex/src/Silex/ViewListenerWrapper.php deleted file mode 100644 index a67ec93..0000000 --- a/vendor/silex/silex/src/Silex/ViewListenerWrapper.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; - -/** - * Wraps view listeners. - * - * @author Dave Marshall - */ -class ViewListenerWrapper -{ - private $app; - private $callback; - - /** - * Constructor. - * - * @param Application $app An Application instance - * @param mixed $callback - */ - public function __construct(Application $app, $callback) - { - $this->app = $app; - $this->callback = $callback; - } - - public function __invoke(GetResponseForControllerResultEvent $event) - { - $controllerResult = $event->getControllerResult(); - $callback = $this->app['callback_resolver']->resolveCallback($this->callback); - - if (!$this->shouldRun($callback, $controllerResult)) { - return; - } - - $response = call_user_func($callback, $controllerResult, $event->getRequest()); - - if ($response instanceof Response) { - $event->setResponse($response); - } elseif (null !== $response) { - $event->setControllerResult($response); - } - } - - private function shouldRun($callback, $controllerResult) - { - if (is_array($callback)) { - $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]); - } elseif (is_object($callback) && !$callback instanceof \Closure) { - $callbackReflection = new \ReflectionObject($callback); - $callbackReflection = $callbackReflection->getMethod('__invoke'); - } else { - $callbackReflection = new \ReflectionFunction($callback); - } - - if ($callbackReflection->getNumberOfParameters() > 0) { - $parameters = $callbackReflection->getParameters(); - $expectedControllerResult = $parameters[0]; - - if ($expectedControllerResult->getClass() && (!is_object($controllerResult) || !$expectedControllerResult->getClass()->isInstance($controllerResult))) { - return false; - } - - if ($expectedControllerResult->isArray() && !is_array($controllerResult)) { - return false; - } - - if (method_exists($expectedControllerResult, 'isCallable') && $expectedControllerResult->isCallable() && !is_callable($controllerResult)) { - return false; - } - } - - return true; - } -} diff --git a/vendor/silex/silex/src/Silex/WebTestCase.php b/vendor/silex/silex/src/Silex/WebTestCase.php deleted file mode 100644 index e72403a..0000000 --- a/vendor/silex/silex/src/Silex/WebTestCase.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * WebTestCase is the base class for functional tests. - * - * @author Igor Wiedler - */ -abstract class WebTestCase extends TestCase -{ - /** - * HttpKernelInterface instance. - * - * @var HttpKernelInterface - */ - protected $app; - - /** - * PHPUnit setUp for setting up the application. - * - * Note: Child classes that define a setUp method must call - * parent::setUp(). - */ - protected function setUp() - { - $this->app = $this->createApplication(); - } - - /** - * Creates the application. - * - * @return HttpKernelInterface - */ - abstract public function createApplication(); - - /** - * Creates a Client. - * - * @param array $server Server parameters - * - * @return Client A Client instance - */ - public function createClient(array $server = array()) - { - if (!class_exists('Symfony\Component\BrowserKit\Client')) { - throw new \LogicException('Component "symfony/browser-kit" is required by WebTestCase.'.PHP_EOL.'Run composer require symfony/browser-kit'); - } - - return new Client($this->app, $server); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/FormApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/FormApplication.php deleted file mode 100644 index 5851a4c..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/FormApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class FormApplication extends Application -{ - use Application\FormTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/FormTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/FormTraitTest.php deleted file mode 100644 index 1d36a0c..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/FormTraitTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\FormServiceProvider; -use Symfony\Component\Form\FormBuilder; - -/** - * FormTrait test cases. - * - * @author Fabien Potencier - */ -class FormTraitTest extends TestCase -{ - public function testForm() - { - $this->assertInstanceOf(FormBuilder::class, $this->createApplication()->form()); - } - - public function testNamedForm() - { - $builder = $this->createApplication()->namedForm('foo'); - - $this->assertInstanceOf(FormBuilder::class, $builder); - $this->assertSame('foo', $builder->getName()); - } - - public function createApplication() - { - $app = new FormApplication(); - $app->register(new FormServiceProvider()); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/MonologApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/MonologApplication.php deleted file mode 100644 index 9fec12f..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/MonologApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class MonologApplication extends Application -{ - use Application\MonologTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php deleted file mode 100644 index 73dcda6..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/MonologTraitTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\MonologServiceProvider; -use Monolog\Handler\TestHandler; -use Monolog\Logger; - -/** - * MonologTrait test cases. - * - * @author Fabien Potencier - */ -class MonologTraitTest extends TestCase -{ - public function testLog() - { - $app = $this->createApplication(); - - $app->log('Foo'); - $app->log('Bar', array(), Logger::DEBUG); - $this->assertTrue($app['monolog.handler']->hasInfo('Foo')); - $this->assertTrue($app['monolog.handler']->hasDebug('Bar')); - } - - public function createApplication() - { - $app = new MonologApplication(); - $app->register(new MonologServiceProvider(), array( - 'monolog.handler' => function () use ($app) { - return new TestHandler($app['monolog.level']); - }, - 'monolog.logfile' => 'php://memory', - )); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/SecurityApplication.php deleted file mode 100644 index dc85999..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class SecurityApplication extends Application -{ - use Application\SecurityTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php deleted file mode 100644 index 71cb3af..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/SecurityTraitTest.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\SecurityServiceProvider; -use Symfony\Component\Security\Core\User\User; -use Symfony\Component\HttpFoundation\Request; - -/** - * SecurityTrait test cases. - * - * @author Fabien Potencier - */ -class SecurityTraitTest extends TestCase -{ - public function testEncodePassword() - { - $app = $this->createApplication(array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - )); - - $user = new User('foo', 'bar'); - $password = 'foo'; - $encoded = $app->encodePassword($user, $password); - - $this->assertTrue( - $app['security.encoder_factory']->getEncoder($user)->isPasswordValid($encoded, $password, $user->getSalt()) - ); - } - - /** - * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException - */ - public function testIsGrantedWithoutTokenThrowsException() - { - $app = $this->createApplication(); - $app->get('/', function () { return 'foo'; }); - $app->handle(Request::create('/')); - $app->isGranted('ROLE_ADMIN'); - } - - public function testIsGranted() - { - $request = Request::create('/'); - - $app = $this->createApplication(array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'monique' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - )); - $app->get('/', function () { return 'foo'; }); - - // User is Monique (ROLE_USER) - $request->headers->set('PHP_AUTH_USER', 'monique'); - $request->headers->set('PHP_AUTH_PW', 'foo'); - $app->handle($request); - $this->assertTrue($app->isGranted('ROLE_USER')); - $this->assertFalse($app->isGranted('ROLE_ADMIN')); - - // User is Fabien (ROLE_ADMIN) - $request->headers->set('PHP_AUTH_USER', 'fabien'); - $request->headers->set('PHP_AUTH_PW', 'foo'); - $app->handle($request); - $this->assertFalse($app->isGranted('ROLE_USER')); - $this->assertTrue($app->isGranted('ROLE_ADMIN')); - } - - public function createApplication($users = array()) - { - $app = new SecurityApplication(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - 'users' => $users, - ), - ), - )); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerApplication.php deleted file mode 100644 index 6a28d53..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class SwiftmailerApplication extends Application -{ - use Application\SwiftmailerTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerTraitTest.php deleted file mode 100644 index 34620b7..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/SwiftmailerTraitTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\SwiftmailerServiceProvider; - -/** - * SwiftmailerTrait test cases. - * - * @author Fabien Potencier - */ -class SwiftmailerTraitTest extends TestCase -{ - public function testMail() - { - $app = $this->createApplication(); - - $message = $this->getMockBuilder('Swift_Message')->disableOriginalConstructor()->getMock(); - $app['mailer'] = $mailer = $this->getMockBuilder('Swift_Mailer')->disableOriginalConstructor()->getMock(); - $mailer->expects($this->once()) - ->method('send') - ->with($message) - ; - - $app->mail($message); - } - - public function createApplication() - { - $app = new SwiftmailerApplication(); - $app->register(new SwiftmailerServiceProvider()); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/TranslationApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/TranslationApplication.php deleted file mode 100644 index 3e51b9c..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/TranslationApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class TranslationApplication extends Application -{ - use Application\TranslationTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/TranslationTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/TranslationTraitTest.php deleted file mode 100644 index 5c05460..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/TranslationTraitTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\TranslationServiceProvider; - -/** - * TranslationTrait test cases. - * - * @author Fabien Potencier - */ -class TranslationTraitTest extends TestCase -{ - public function testTrans() - { - $app = $this->createApplication(); - $app['translator'] = $translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')->disableOriginalConstructor()->getMock(); - $translator->expects($this->once())->method('trans'); - $app->trans('foo'); - } - - public function testTransChoice() - { - $app = $this->createApplication(); - $app['translator'] = $translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')->disableOriginalConstructor()->getMock(); - $translator->expects($this->once())->method('transChoice'); - $app->transChoice('foo', 2); - } - - public function createApplication() - { - $app = new TranslationApplication(); - $app->register(new TranslationServiceProvider()); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/TwigApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/TwigApplication.php deleted file mode 100644 index f1bb473..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/TwigApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class TwigApplication extends Application -{ - use Application\TwigTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php deleted file mode 100644 index 250ebcf..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/TwigTraitTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Silex\Provider\TwigServiceProvider; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; - -/** - * TwigTrait test cases. - * - * @author Fabien Potencier - */ -class TwigTraitTest extends TestCase -{ - public function testRender() - { - $app = $this->createApplication(); - - $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); - $mailer->expects($this->once())->method('render')->will($this->returnValue('foo')); - - $response = $app->render('view'); - $this->assertEquals('Symfony\Component\HttpFoundation\Response', get_class($response)); - $this->assertEquals('foo', $response->getContent()); - } - - public function testRenderKeepResponse() - { - $app = $this->createApplication(); - - $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); - $mailer->expects($this->once())->method('render')->will($this->returnValue('foo')); - - $response = $app->render('view', array(), new Response('', 404)); - $this->assertEquals(404, $response->getStatusCode()); - } - - public function testRenderForStream() - { - $app = $this->createApplication(); - - $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); - $mailer->expects($this->once())->method('display')->will($this->returnCallback(function () { echo 'foo'; })); - - $response = $app->render('view', array(), new StreamedResponse()); - $this->assertEquals('Symfony\Component\HttpFoundation\StreamedResponse', get_class($response)); - - ob_start(); - $response->send(); - $this->assertEquals('foo', ob_get_clean()); - } - - public function testRenderView() - { - $app = $this->createApplication(); - - $app['twig'] = $mailer = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock(); - $mailer->expects($this->once())->method('render'); - - $app->renderView('view'); - } - - public function createApplication() - { - $app = new TwigApplication(); - $app->register(new TwigServiceProvider()); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorApplication.php b/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorApplication.php deleted file mode 100644 index 4239af4..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorApplication.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use Silex\Application; - -class UrlGeneratorApplication extends Application -{ - use Application\UrlGeneratorTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php deleted file mode 100644 index df29d6e..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Application/UrlGeneratorTraitTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Application; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - -/** - * UrlGeneratorTrait test cases. - * - * @author Fabien Potencier - */ -class UrlGeneratorTraitTest extends TestCase -{ - public function testUrl() - { - $app = new UrlGeneratorApplication(); - $app['url_generator'] = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->disableOriginalConstructor()->getMock(); - $app['url_generator']->expects($this->once())->method('generate')->with('foo', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $app->url('foo'); - } - - public function testPath() - { - $app = new UrlGeneratorApplication(); - $app['url_generator'] = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->disableOriginalConstructor()->getMock(); - $app['url_generator']->expects($this->once())->method('generate')->with('foo', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - $app->path('foo'); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php b/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php deleted file mode 100644 index 57a1d63..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ApplicationTest.php +++ /dev/null @@ -1,725 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use Fig\Link\GenericLinkProvider; -use Fig\Link\Link; -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\ControllerCollection; -use Silex\Api\ControllerProviderInterface; -use Silex\Route; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\WebLink\HttpHeaderSerializer; - -/** - * Application test cases. - * - * @author Igor Wiedler - */ -class ApplicationTest extends TestCase -{ - public function testMatchReturnValue() - { - $app = new Application(); - - $returnValue = $app->match('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - - $returnValue = $app->get('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - - $returnValue = $app->post('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - - $returnValue = $app->put('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - - $returnValue = $app->patch('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - - $returnValue = $app->delete('/foo', function () {}); - $this->assertInstanceOf('Silex\Controller', $returnValue); - } - - public function testConstructorInjection() - { - // inject a custom parameter - $params = array('param' => 'value'); - $app = new Application($params); - $this->assertSame($params['param'], $app['param']); - - // inject an existing parameter - $params = array('locale' => 'value'); - $app = new Application($params); - $this->assertSame($params['locale'], $app['locale']); - } - - public function testGetRequest() - { - $request = Request::create('/'); - - $app = new Application(); - $app->get('/', function (Request $req) use ($request) { - return $request === $req ? 'ok' : 'ko'; - }); - - $this->assertEquals('ok', $app->handle($request)->getContent()); - } - - public function testGetRoutesWithNoRoutes() - { - $app = new Application(); - - $routes = $app['routes']; - $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); - $this->assertEquals(0, count($routes->all())); - } - - public function testGetRoutesWithRoutes() - { - $app = new Application(); - - $app->get('/foo', function () { - return 'foo'; - }); - - $app->get('/bar')->run(function () { - return 'bar'; - }); - - $routes = $app['routes']; - $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); - $this->assertEquals(0, count($routes->all())); - $app->flush(); - $this->assertEquals(2, count($routes->all())); - } - - public function testOnCoreController() - { - $app = new Application(); - - $app->get('/foo/{foo}', function (\ArrayObject $foo) { - return $foo['foo']; - })->convert('foo', function ($foo) { return new \ArrayObject(array('foo' => $foo)); }); - - $response = $app->handle(Request::create('/foo/bar')); - $this->assertEquals('bar', $response->getContent()); - - $app->get('/foo/{foo}/{bar}', function (\ArrayObject $foo) { - return $foo['foo']; - })->convert('foo', function ($foo, Request $request) { return new \ArrayObject(array('foo' => $foo.$request->attributes->get('bar'))); }); - - $response = $app->handle(Request::create('/foo/foo/bar')); - $this->assertEquals('foobar', $response->getContent()); - } - - public function testOn() - { - $app = new Application(); - $app['pass'] = false; - - $app->on('test', function (Event $e) use ($app) { - $app['pass'] = true; - }); - - $app['dispatcher']->dispatch('test'); - - $this->assertTrue($app['pass']); - } - - public function testAbort() - { - $app = new Application(); - - try { - $app->abort(404); - $this->fail(); - } catch (HttpException $e) { - $this->assertEquals(404, $e->getStatusCode()); - } - } - - /** - * @dataProvider escapeProvider - */ - public function testEscape($expected, $text) - { - $app = new Application(); - - $this->assertEquals($expected, $app->escape($text)); - } - - public function escapeProvider() - { - return array( - array('<', '<'), - array('>', '>'), - array('"', '"'), - array("'", "'"), - array('abc', 'abc'), - ); - } - - public function testControllersAsMethods() - { - $app = new Application(); - unset($app['exception_handler']); - - $app->get('/{name}', 'Silex\Tests\FooController::barAction'); - - $this->assertEquals('Hello Fabien', $app->handle(Request::create('/Fabien'))->getContent()); - } - - public function testApplicationTypeHintWorks() - { - $app = new SpecialApplication(); - unset($app['exception_handler']); - - $app->get('/{name}', 'Silex\Tests\FooController::barSpecialAction'); - - $this->assertEquals('Hello Fabien in Silex\Tests\SpecialApplication', $app->handle(Request::create('/Fabien'))->getContent()); - } - - /** - * @requires PHP 7.0 - */ - public function testPhp7TypeHintWorks() - { - $app = new SpecialApplication(); - unset($app['exception_handler']); - - $app->get('/{name}', 'Silex\Tests\Fixtures\Php7Controller::typehintedAction'); - - $this->assertEquals('Hello Fabien in Silex\Tests\SpecialApplication', $app->handle(Request::create('/Fabien'))->getContent()); - } - - public function testHttpSpec() - { - $app = new Application(); - $app['charset'] = 'ISO-8859-1'; - - $app->get('/', function () { - return 'hello'; - }); - - // content is empty for HEAD requests - $response = $app->handle(Request::create('/', 'HEAD')); - $this->assertEquals('', $response->getContent()); - - // charset is appended to Content-Type - $response = $app->handle(Request::create('/')); - - $this->assertEquals('text/html; charset=ISO-8859-1', $response->headers->get('Content-Type')); - } - - public function testRoutesMiddlewares() - { - $app = new Application(); - - $test = $this; - - $middlewareTarget = array(); - $beforeMiddleware1 = function (Request $request) use (&$middlewareTarget, $test) { - $test->assertEquals('/reached', $request->getRequestUri()); - $middlewareTarget[] = 'before_middleware1_triggered'; - }; - $beforeMiddleware2 = function (Request $request) use (&$middlewareTarget, $test) { - $test->assertEquals('/reached', $request->getRequestUri()); - $middlewareTarget[] = 'before_middleware2_triggered'; - }; - $beforeMiddleware3 = function (Request $request) use (&$middlewareTarget, $test) { - throw new \Exception('This middleware shouldn\'t run!'); - }; - - $afterMiddleware1 = function (Request $request, Response $response) use (&$middlewareTarget, $test) { - $test->assertEquals('/reached', $request->getRequestUri()); - $middlewareTarget[] = 'after_middleware1_triggered'; - }; - $afterMiddleware2 = function (Request $request, Response $response) use (&$middlewareTarget, $test) { - $test->assertEquals('/reached', $request->getRequestUri()); - $middlewareTarget[] = 'after_middleware2_triggered'; - }; - $afterMiddleware3 = function (Request $request, Response $response) use (&$middlewareTarget, $test) { - throw new \Exception('This middleware shouldn\'t run!'); - }; - - $app->get('/reached', function () use (&$middlewareTarget) { - $middlewareTarget[] = 'route_triggered'; - - return 'hello'; - }) - ->before($beforeMiddleware1) - ->before($beforeMiddleware2) - ->after($afterMiddleware1) - ->after($afterMiddleware2); - - $app->get('/never-reached', function () use (&$middlewareTarget) { - throw new \Exception('This route shouldn\'t run!'); - }) - ->before($beforeMiddleware3) - ->after($afterMiddleware3); - - $result = $app->handle(Request::create('/reached')); - - $this->assertSame(array('before_middleware1_triggered', 'before_middleware2_triggered', 'route_triggered', 'after_middleware1_triggered', 'after_middleware2_triggered'), $middlewareTarget); - $this->assertEquals('hello', $result->getContent()); - } - - public function testRoutesBeforeMiddlewaresWithResponseObject() - { - $app = new Application(); - - $app->get('/foo', function () { - throw new \Exception('This route shouldn\'t run!'); - }) - ->before(function () { - return new Response('foo'); - }); - - $request = Request::create('/foo'); - $result = $app->handle($request); - - $this->assertEquals('foo', $result->getContent()); - } - - public function testRoutesAfterMiddlewaresWithResponseObject() - { - $app = new Application(); - - $app->get('/foo', function () { - return new Response('foo'); - }) - ->after(function () { - return new Response('bar'); - }); - - $request = Request::create('/foo'); - $result = $app->handle($request); - - $this->assertEquals('bar', $result->getContent()); - } - - public function testRoutesBeforeMiddlewaresWithRedirectResponseObject() - { - $app = new Application(); - - $app->get('/foo', function () { - throw new \Exception('This route shouldn\'t run!'); - }) - ->before(function () use ($app) { - return $app->redirect('/bar'); - }); - - $request = Request::create('/foo'); - $result = $app->handle($request); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $result); - $this->assertEquals('/bar', $result->getTargetUrl()); - } - - public function testRoutesBeforeMiddlewaresTriggeredAfterSilexBeforeFilters() - { - $app = new Application(); - - $middlewareTarget = array(); - $middleware = function (Request $request) use (&$middlewareTarget) { - $middlewareTarget[] = 'middleware_triggered'; - }; - - $app->get('/foo', function () use (&$middlewareTarget) { - $middlewareTarget[] = 'route_triggered'; - }) - ->before($middleware); - - $app->before(function () use (&$middlewareTarget) { - $middlewareTarget[] = 'before_triggered'; - }); - - $app->handle(Request::create('/foo')); - - $this->assertSame(array('before_triggered', 'middleware_triggered', 'route_triggered'), $middlewareTarget); - } - - public function testRoutesAfterMiddlewaresTriggeredBeforeSilexAfterFilters() - { - $app = new Application(); - - $middlewareTarget = array(); - $middleware = function (Request $request) use (&$middlewareTarget) { - $middlewareTarget[] = 'middleware_triggered'; - }; - - $app->get('/foo', function () use (&$middlewareTarget) { - $middlewareTarget[] = 'route_triggered'; - }) - ->after($middleware); - - $app->after(function () use (&$middlewareTarget) { - $middlewareTarget[] = 'after_triggered'; - }); - - $app->handle(Request::create('/foo')); - - $this->assertSame(array('route_triggered', 'middleware_triggered', 'after_triggered'), $middlewareTarget); - } - - public function testFinishFilter() - { - $containerTarget = array(); - - $app = new Application(); - - $app->finish(function () use (&$containerTarget) { - $containerTarget[] = '4_filterFinish'; - }); - - $app->get('/foo', function () use (&$containerTarget) { - $containerTarget[] = '1_routeTriggered'; - - return new StreamedResponse(function () use (&$containerTarget) { - $containerTarget[] = '3_responseSent'; - }); - }); - - $app->after(function () use (&$containerTarget) { - $containerTarget[] = '2_filterAfter'; - }); - - $app->run(Request::create('/foo')); - - $this->assertSame(array('1_routeTriggered', '2_filterAfter', '3_responseSent', '4_filterFinish'), $containerTarget); - } - - /** - * @expectedException \RuntimeException - */ - public function testNonResponseAndNonNullReturnFromRouteBeforeMiddlewareShouldThrowRuntimeException() - { - $app = new Application(); - - $middleware = function (Request $request) { - return 'string return'; - }; - - $app->get('/', function () { - return 'hello'; - }) - ->before($middleware); - - $app->handle(Request::create('/'), HttpKernelInterface::MASTER_REQUEST, false); - } - - /** - * @expectedException \RuntimeException - */ - public function testNonResponseAndNonNullReturnFromRouteAfterMiddlewareShouldThrowRuntimeException() - { - $app = new Application(); - - $middleware = function (Request $request) { - return 'string return'; - }; - - $app->get('/', function () { - return 'hello'; - }) - ->after($middleware); - - $app->handle(Request::create('/'), HttpKernelInterface::MASTER_REQUEST, false); - } - - public function testSubRequest() - { - $app = new Application(); - $app->get('/sub', function (Request $request) { - return new Response('foo'); - }); - $app->get('/', function (Request $request) use ($app) { - return $app->handle(Request::create('/sub'), HttpKernelInterface::SUB_REQUEST); - }); - - $this->assertEquals('foo', $app->handle(Request::create('/'))->getContent()); - } - - public function testRegisterShouldReturnSelf() - { - $app = new Application(); - $provider = $this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock(); - - $this->assertSame($app, $app->register($provider)); - } - - public function testMountShouldReturnSelf() - { - $app = new Application(); - $mounted = new ControllerCollection(new Route()); - $mounted->get('/{name}', function ($name) { return new Response($name); }); - - $this->assertSame($app, $app->mount('/hello', $mounted)); - } - - public function testMountPreservesOrder() - { - $app = new Application(); - $mounted = new ControllerCollection(new Route()); - $mounted->get('/mounted')->bind('second'); - - $app->get('/before')->bind('first'); - $app->mount('/', $mounted); - $app->get('/after')->bind('third'); - $app->flush(); - - $this->assertEquals(array('first', 'second', 'third'), array_keys(iterator_to_array($app['routes']))); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage The "mount" method takes either a "ControllerCollection" instance, "ControllerProviderInterface" instance, or a callable. - */ - public function testMountNullException() - { - $app = new Application(); - $app->mount('/exception', null); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage The method "Silex\Tests\IncorrectControllerCollection::connect" must return a "ControllerCollection" instance. Got: "NULL" - */ - public function testMountWrongConnectReturnValueException() - { - $app = new Application(); - $app->mount('/exception', new IncorrectControllerCollection()); - } - - public function testMountCallable() - { - $app = new Application(); - $app->mount('/prefix', function (ControllerCollection $coll) { - $coll->get('/path'); - }); - - $app->flush(); - - $this->assertEquals(1, $app['routes']->count()); - } - - public function testSendFile() - { - $app = new Application(); - - $response = $app->sendFile(__FILE__, 200, array('Content-Type: application/php')); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\BinaryFileResponse', $response); - $this->assertEquals(__FILE__, (string) $response->getFile()); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage The "homepage" route must have code to run when it matches. - */ - public function testGetRouteCollectionWithRouteWithoutController() - { - $app = new Application(); - unset($app['exception_handler']); - $app->match('/')->bind('homepage'); - $app->handle(Request::create('/')); - } - - public function testBeforeFilterOnMountedControllerGroupIsolatedToGroup() - { - $app = new Application(); - $app->match('/', function () { return new Response('ok'); }); - $mounted = $app['controllers_factory']; - $mounted->before(function () { return new Response('not ok'); }); - $app->mount('/group', $mounted); - - $response = $app->handle(Request::create('/')); - $this->assertEquals('ok', $response->getContent()); - } - - public function testViewListenerWithPrimitive() - { - $app = new Application(); - $app->get('/foo', function () { return 123; }); - $app->view(function ($view, Request $request) { - return new Response($view); - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('123', $response->getContent()); - } - - public function testViewListenerWithArrayTypeHint() - { - $app = new Application(); - $app->get('/foo', function () { return array('ok'); }); - $app->view(function (array $view) { - return new Response($view[0]); - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('ok', $response->getContent()); - } - - public function testViewListenerWithObjectTypeHint() - { - $app = new Application(); - $app->get('/foo', function () { return (object) array('name' => 'world'); }); - $app->view(function (\stdClass $view) { - return new Response('Hello '.$view->name); - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('Hello world', $response->getContent()); - } - - public function testViewListenerWithCallableTypeHint() - { - $app = new Application(); - $app->get('/foo', function () { return function () { return 'world'; }; }); - $app->view(function (callable $view) { - return new Response('Hello '.$view()); - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('Hello world', $response->getContent()); - } - - public function testViewListenersCanBeChained() - { - $app = new Application(); - $app->get('/foo', function () { return (object) array('name' => 'world'); }); - - $app->view(function (\stdClass $view) { - return array('msg' => 'Hello '.$view->name); - }); - - $app->view(function (array $view) { - return $view['msg']; - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('Hello world', $response->getContent()); - } - - public function testViewListenersAreIgnoredIfNotSuitable() - { - $app = new Application(); - $app->get('/foo', function () { return 'Hello world'; }); - - $app->view(function (\stdClass $view) { - throw new \Exception('View listener was called'); - }); - - $app->view(function (array $view) { - throw new \Exception('View listener was called'); - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('Hello world', $response->getContent()); - } - - public function testViewListenersResponsesAreNotUsedIfNull() - { - $app = new Application(); - $app->get('/foo', function () { return 'Hello world'; }); - - $app->view(function ($view) { - return 'Hello view listener'; - }); - - $app->view(function ($view) { - return; - }); - - $response = $app->handle(Request::create('/foo')); - - $this->assertEquals('Hello view listener', $response->getContent()); - } - - public function testWebLinkListener() - { - if (!class_exists(HttpHeaderSerializer::class)) { - self::markTestSkipped('Symfony WebLink component is required.'); - } - - $app = new Application(); - - $app->get('/', function () { - return 'hello'; - }); - - $request = Request::create('/'); - $request->attributes->set('_links', (new GenericLinkProvider())->withLink(new Link('preload', '/foo.css'))); - - $response = $app->handle($request); - - $this->assertEquals('; rel="preload"', $response->headers->get('Link')); - } - - public function testDefaultRoutesFactory() - { - $app = new Application(); - $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $app['routes']); - } - - public function testOverriddenRoutesFactory() - { - $app = new Application(); - $app['routes_factory'] = $app->factory(function () { - return new RouteCollectionSubClass(); - }); - $this->assertInstanceOf('Silex\Tests\RouteCollectionSubClass', $app['routes']); - } -} - -class FooController -{ - public function barAction(Application $app, $name) - { - return 'Hello '.$app->escape($name); - } - - public function barSpecialAction(SpecialApplication $app, $name) - { - return 'Hello '.$app->escape($name).' in '.get_class($app); - } -} - -class IncorrectControllerCollection implements ControllerProviderInterface -{ - public function connect(Application $app) - { - return; - } -} - -class RouteCollectionSubClass extends RouteCollection -{ -} - -class SpecialApplication extends Application -{ -} diff --git a/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php deleted file mode 100644 index b637a94..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/CallbackResolverTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Pimple\Container; -use Silex\CallbackResolver; - -class CallbackResolverTest extends Testcase -{ - private $app; - private $resolver; - - public function setup() - { - $this->app = new Container(); - $this->resolver = new CallbackResolver($this->app); - } - - public function testShouldResolveCallback() - { - $callable = function () {}; - $this->app['some_service'] = function () { return new \ArrayObject(); }; - $this->app['callable_service'] = function () use ($callable) { - return $callable; - }; - - $this->assertTrue($this->resolver->isValid('some_service:methodName')); - $this->assertTrue($this->resolver->isValid('callable_service')); - $this->assertEquals( - array($this->app['some_service'], 'append'), - $this->resolver->convertCallback('some_service:append') - ); - $this->assertSame($callable, $this->resolver->convertCallback('callable_service')); - } - - /** - * @dataProvider nonStringsAreNotValidProvider - */ - public function testNonStringsAreNotValid($name) - { - $this->assertFalse($this->resolver->isValid($name)); - } - - public function nonStringsAreNotValidProvider() - { - return array( - array(null), - array('some_service::methodName'), - array('missing_service'), - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessageRegExp /Service "[a-z_]+" is not callable./ - * @dataProvider shouldThrowAnExceptionIfServiceIsNotCallableProvider - */ - public function testShouldThrowAnExceptionIfServiceIsNotCallable($name) - { - $this->app['non_callable_obj'] = function () { return new \stdClass(); }; - $this->app['non_callable'] = function () { return array(); }; - $this->resolver->convertCallback($name); - } - - public function shouldThrowAnExceptionIfServiceIsNotCallableProvider() - { - return array( - array('non_callable_obj:methodA'), - array('non_callable'), - ); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php b/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php deleted file mode 100644 index 915c049..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/CallbackServicesTest.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; -use Silex\Provider\ServiceControllerServiceProvider; - -/** - * Callback as services test cases. - * - * @author Fabien Potencier - */ -class CallbackServicesTest extends TestCase -{ - public $called = array(); - - public function testCallbacksAsServices() - { - $app = new Application(); - $app->register(new ServiceControllerServiceProvider()); - - $app['service'] = function () { - return new CallbackServicesTest(); - }; - - $app->before('service:beforeApp'); - $app->after('service:afterApp'); - $app->finish('service:finishApp'); - $app->error('service:error'); - $app->on('kernel.request', 'service:onRequest'); - - $app - ->match('/', 'service:controller') - ->convert('foo', 'service:convert') - ->before('service:before') - ->after('service:after') - ; - - $request = Request::create('/'); - $response = $app->handle($request); - $app->terminate($request, $response); - - $this->assertEquals(array( - 'BEFORE APP', - 'ON REQUEST', - 'BEFORE', - 'CONVERT', - 'ERROR', - 'AFTER', - 'AFTER APP', - 'FINISH APP', - ), $app['service']->called); - } - - public function controller(Application $app) - { - $app->abort(404); - } - - public function before() - { - $this->called[] = 'BEFORE'; - } - - public function after() - { - $this->called[] = 'AFTER'; - } - - public function beforeApp() - { - $this->called[] = 'BEFORE APP'; - } - - public function afterApp() - { - $this->called[] = 'AFTER APP'; - } - - public function finishApp() - { - $this->called[] = 'FINISH APP'; - } - - public function error() - { - $this->called[] = 'ERROR'; - } - - public function convert() - { - $this->called[] = 'CONVERT'; - } - - public function onRequest() - { - $this->called[] = 'ON REQUEST'; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php deleted file mode 100644 index 53e3384..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerCollectionTest.php +++ /dev/null @@ -1,328 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Controller; -use Silex\ControllerCollection; -use Silex\Exception\ControllerFrozenException; -use Silex\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * ControllerCollection test cases. - * - * @author Igor Wiedler - */ -class ControllerCollectionTest extends TestCase -{ - public function testGetRouteCollectionWithNoRoutes() - { - $controllers = new ControllerCollection(new Route()); - $routes = $controllers->flush(); - $this->assertEquals(0, count($routes->all())); - } - - public function testGetRouteCollectionWithRoutes() - { - $controllers = new ControllerCollection(new Route()); - $controllers->match('/foo', function () {}); - $controllers->match('/bar', function () {}); - - $routes = $controllers->flush(); - $this->assertEquals(2, count($routes->all())); - } - - public function testControllerFreezing() - { - $controllers = new ControllerCollection(new Route()); - - $fooController = $controllers->match('/foo', function () {})->bind('foo'); - $barController = $controllers->match('/bar', function () {})->bind('bar'); - - $controllers->flush(); - - try { - $fooController->bind('foo2'); - $this->fail(); - } catch (ControllerFrozenException $e) { - } - - try { - $barController->bind('bar2'); - $this->fail(); - } catch (ControllerFrozenException $e) { - } - } - - public function testConflictingRouteNames() - { - $controllers = new ControllerCollection(new Route()); - - $mountedRootController = $controllers->match('/', function () {}); - - $mainRootController = new Controller(new Route('/')); - $mainRootController->bind($mainRootController->generateRouteName('main_1')); - - $controllers->flush(); - - $this->assertNotEquals($mainRootController->getRouteName(), $mountedRootController->getRouteName()); - } - - public function testUniqueGeneratedRouteNames() - { - $controllers = new ControllerCollection(new Route()); - - $controllers->match('/a-a', function () {}); - $controllers->match('/a_a', function () {}); - $controllers->match('/a/a', function () {}); - - $routes = $controllers->flush(); - - $this->assertCount(3, $routes->all()); - $this->assertEquals(array('_a_a', '_a_a_1', '_a_a_2'), array_keys($routes->all())); - } - - public function testUniqueGeneratedRouteNamesAmongMounts() - { - $controllers = new ControllerCollection(new Route()); - - $controllers->mount('/root-a', $rootA = new ControllerCollection(new Route())); - $controllers->mount('/root_a', $rootB = new ControllerCollection(new Route())); - - $rootA->match('/leaf', function () {}); - $rootB->match('/leaf', function () {}); - - $routes = $controllers->flush(); - - $this->assertCount(2, $routes->all()); - $this->assertEquals(array('_root_a_leaf', '_root_a_leaf_1'), array_keys($routes->all())); - } - - public function testUniqueGeneratedRouteNamesAmongNestedMounts() - { - $controllers = new ControllerCollection(new Route()); - - $controllers->mount('/root-a', $rootA = new ControllerCollection(new Route())); - $controllers->mount('/root_a', $rootB = new ControllerCollection(new Route())); - - $rootA->mount('/tree', $treeA = new ControllerCollection(new Route())); - $rootB->mount('/tree', $treeB = new ControllerCollection(new Route())); - - $treeA->match('/leaf', function () {}); - $treeB->match('/leaf', function () {}); - - $routes = $controllers->flush(); - - $this->assertCount(2, $routes->all()); - $this->assertEquals(array('_root_a_tree_leaf', '_root_a_tree_leaf_1'), array_keys($routes->all())); - } - - public function testMountCallable() - { - $controllers = new ControllerCollection(new Route()); - $controllers->mount('/prefix', function (ControllerCollection $coll) { - $coll->mount('/path', function ($coll) { - $coll->get('/part'); - }); - }); - - $routes = $controllers->flush(); - $this->assertEquals('/prefix/path/part', current($routes->all())->getPath()); - } - - public function testMountCallableProperClone() - { - $controllers = new ControllerCollection(new Route(), new RouteCollection()); - $controllers->get('/'); - - $subControllers = null; - $controllers->mount('/prefix', function (ControllerCollection $coll) use (&$subControllers) { - $subControllers = $coll; - $coll->get('/'); - }); - - $routes = $controllers->flush(); - $subRoutes = $subControllers->flush(); - $this->assertTrue($routes->count() == 2 && $subRoutes->count() == 0); - } - - public function testMountControllersFactory() - { - $testControllers = new ControllerCollection(new Route()); - $controllers = new ControllerCollection(new Route(), null, function () use ($testControllers) { - return $testControllers; - }); - - $controllers->mount('/prefix', function ($mounted) use ($testControllers) { - $this->assertSame($mounted, $testControllers); - }); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage The "mount" method takes either a "ControllerCollection" instance or callable. - */ - public function testMountCallableException() - { - $controllers = new ControllerCollection(new Route()); - $controllers->mount('/prefix', ''); - } - - public function testAssert() - { - $controllers = new ControllerCollection(new Route()); - $controllers->assert('id', '\d+'); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->assert('name', '\w+')->assert('extra', '.*'); - $controllers->assert('extra', '\w+'); - - $this->assertEquals('\d+', $controller->getRoute()->getRequirement('id')); - $this->assertEquals('\w+', $controller->getRoute()->getRequirement('name')); - $this->assertEquals('\w+', $controller->getRoute()->getRequirement('extra')); - } - - public function testValue() - { - $controllers = new ControllerCollection(new Route()); - $controllers->value('id', '1'); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->value('name', 'Fabien')->value('extra', 'Symfony'); - $controllers->value('extra', 'Twig'); - - $this->assertEquals('1', $controller->getRoute()->getDefault('id')); - $this->assertEquals('Fabien', $controller->getRoute()->getDefault('name')); - $this->assertEquals('Twig', $controller->getRoute()->getDefault('extra')); - } - - public function testConvert() - { - $controllers = new ControllerCollection(new Route()); - $controllers->convert('id', '1'); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->convert('name', 'Fabien')->convert('extra', 'Symfony'); - $controllers->convert('extra', 'Twig'); - - $this->assertEquals(array('id' => '1', 'name' => 'Fabien', 'extra' => 'Twig'), $controller->getRoute()->getOption('_converters')); - } - - public function testRequireHttp() - { - $controllers = new ControllerCollection(new Route()); - $controllers->requireHttp(); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->requireHttps(); - - $this->assertEquals(array('https'), $controller->getRoute()->getSchemes()); - - $controllers->requireHttp(); - - $this->assertEquals(array('http'), $controller->getRoute()->getSchemes()); - } - - public function testBefore() - { - $controllers = new ControllerCollection(new Route()); - $controllers->before('mid1'); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->before('mid2'); - $controllers->before('mid3'); - - $this->assertEquals(array('mid1', 'mid2', 'mid3'), $controller->getRoute()->getOption('_before_middlewares')); - } - - public function testAfter() - { - $controllers = new ControllerCollection(new Route()); - $controllers->after('mid1'); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->after('mid2'); - $controllers->after('mid3'); - - $this->assertEquals(array('mid1', 'mid2', 'mid3'), $controller->getRoute()->getOption('_after_middlewares')); - } - - public function testWhen() - { - $controllers = new ControllerCollection(new Route()); - $controller = $controllers->match('/{id}/{name}/{extra}', function () {})->when('request.isSecure() == true'); - - $this->assertEquals('request.isSecure() == true', $controller->getRoute()->getCondition()); - } - - public function testRouteExtension() - { - $route = new MyRoute1(); - - $controller = new ControllerCollection($route); - $controller->foo('foo'); - - $this->assertEquals('foo', $route->foo); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRouteMethodDoesNotExist() - { - $route = new MyRoute1(); - - $controller = new ControllerCollection($route); - $controller->bar(); - } - - public function testNestedCollectionRouteCallbacks() - { - $cl1 = new ControllerCollection(new MyRoute1()); - $cl2 = new ControllerCollection(new MyRoute1()); - - $c1 = $cl2->match('/c1', function () {}); - $cl1->mount('/foo', $cl2); - $c2 = $cl2->match('/c2', function () {}); - $cl1->before('before'); - $c3 = $cl2->match('/c3', function () {}); - - $cl1->flush(); - - $this->assertEquals(array('before'), $c1->getRoute()->getOption('_before_middlewares')); - $this->assertEquals(array('before'), $c2->getRoute()->getOption('_before_middlewares')); - $this->assertEquals(array('before'), $c3->getRoute()->getOption('_before_middlewares')); - } - - public function testRoutesFactoryOmitted() - { - $controllers = new ControllerCollection(new Route()); - $routes = $controllers->flush(); - $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); - } - - public function testRoutesFactoryInConstructor() - { - $app = new Application(); - $app['routes_factory'] = $app->factory(function () { - return new RouteCollectionSubClass2(); - }); - - $controllers = new ControllerCollection(new Route(), $app['routes_factory']); - $routes = $controllers->flush(); - $this->assertInstanceOf('Silex\Tests\RouteCollectionSubClass2', $routes); - } -} - -class MyRoute1 extends Route -{ - public $foo; - - public function foo($value) - { - $this->foo = $value; - } -} - -class RouteCollectionSubClass2 extends RouteCollection -{ -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php deleted file mode 100644 index efc39c9..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerResolverTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\ControllerResolver; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; - -/** - * ControllerResolver test cases. - * - * @author Fabien Potencier - */ -class ControllerResolverTest extends TestCase -{ - /** - * @group legacy - */ - public function testGetArguments() - { - $app = new Application(); - $resolver = new ControllerResolver($app); - - $controller = function (Application $app) {}; - - $args = $resolver->getArguments(Request::create('/'), $controller); - $this->assertSame($app, $args[0]); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php b/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php deleted file mode 100644 index 88c6f0a..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ControllerTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Controller; -use Silex\Route; - -/** - * Controller test cases. - * - * @author Igor Wiedler - */ -class ControllerTest extends TestCase -{ - public function testBind() - { - $controller = new Controller(new Route('/foo')); - $ret = $controller->bind('foo'); - - $this->assertSame($ret, $controller); - $this->assertEquals('foo', $controller->getRouteName()); - } - - /** - * @expectedException \Silex\Exception\ControllerFrozenException - */ - public function testBindOnFrozenControllerShouldThrowException() - { - $controller = new Controller(new Route('/foo')); - $controller->bind('foo'); - $controller->freeze(); - $controller->bind('bar'); - } - - public function testAssert() - { - $controller = new Controller(new Route('/foo/{bar}')); - $ret = $controller->assert('bar', '\d+'); - - $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => '\d+'), $controller->getRoute()->getRequirements()); - } - - public function testValue() - { - $controller = new Controller(new Route('/foo/{bar}')); - $ret = $controller->value('bar', 'foo'); - - $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => 'foo'), $controller->getRoute()->getDefaults()); - } - - public function testConvert() - { - $controller = new Controller(new Route('/foo/{bar}')); - $ret = $controller->convert('bar', $func = function ($bar) { return $bar; }); - - $this->assertSame($ret, $controller); - $this->assertEquals(array('bar' => $func), $controller->getRoute()->getOption('_converters')); - } - - public function testRun() - { - $controller = new Controller(new Route('/foo/{bar}')); - $ret = $controller->run($cb = function () { return 'foo'; }); - - $this->assertSame($ret, $controller); - $this->assertEquals($cb, $controller->getRoute()->getDefault('_controller')); - } - - /** - * @dataProvider provideRouteAndExpectedRouteName - */ - public function testDefaultRouteNameGeneration(Route $route, $prefix, $expectedRouteName) - { - $controller = new Controller($route); - $controller->bind($controller->generateRouteName($prefix)); - - $this->assertEquals($expectedRouteName, $controller->getRouteName()); - } - - public function provideRouteAndExpectedRouteName() - { - return array( - array(new Route('/Invalid%Symbols#Stripped', array(), array(), array(), '', array(), array('POST')), '', 'POST_InvalidSymbolsStripped'), - array(new Route('/post/{id}', array(), array(), array(), '', array(), array('GET')), '', 'GET_post_id'), - array(new Route('/colon:pipe|dashes-escaped'), '', '_colon_pipe_dashes_escaped'), - array(new Route('/underscores_and.periods'), '', '_underscores_and.periods'), - array(new Route('/post/{id}', array(), array(), array(), '', array(), array('GET')), 'prefix', 'GET_prefix_post_id'), - ); - } - - public function testRouteExtension() - { - $route = new MyRoute(); - - $controller = new Controller($route); - $controller->foo('foo'); - - $this->assertEquals('foo', $route->foo); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRouteMethodDoesNotExist() - { - $route = new MyRoute(); - - $controller = new Controller($route); - $controller->bar(); - } -} - -class MyRoute extends Route -{ - public $foo; - - public function foo($value) - { - $this->foo = $value; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/EventListener/LogListenerTest.php b/vendor/silex/silex/tests/Silex/Tests/EventListener/LogListenerTest.php deleted file mode 100644 index b56082e..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/EventListener/LogListenerTest.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Psr\Log\LogLevel; -use Silex\EventListener\LogListener; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Exception\HttpException; - -/** - * LogListener. - * - * @author Jérôme Tamarelle - */ -class LogListenerTest extends TestCase -{ - public function testRequestListener() - { - $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock(); - $logger - ->expects($this->once()) - ->method('log') - ->with(LogLevel::DEBUG, '> GET /foo') - ; - - $dispatcher = new EventDispatcher(); - $dispatcher->addSubscriber(new LogListener($logger)); - - $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock(); - - $dispatcher->dispatch(KernelEvents::REQUEST, new GetResponseEvent($kernel, Request::create('/subrequest'), HttpKernelInterface::SUB_REQUEST), 'Skip sub requests'); - - $dispatcher->dispatch(KernelEvents::REQUEST, new GetResponseEvent($kernel, Request::create('/foo'), HttpKernelInterface::MASTER_REQUEST), 'Log master requests'); - } - - public function testResponseListener() - { - $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock(); - $logger - ->expects($this->once()) - ->method('log') - ->with(LogLevel::DEBUG, '< 301') - ; - - $dispatcher = new EventDispatcher(); - $dispatcher->addSubscriber(new LogListener($logger)); - - $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock(); - - $dispatcher->dispatch(KernelEvents::RESPONSE, new FilterResponseEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, Response::create('subrequest', 200)), 'Skip sub requests'); - - $dispatcher->dispatch(KernelEvents::RESPONSE, new FilterResponseEvent($kernel, Request::create('/foo'), HttpKernelInterface::MASTER_REQUEST, Response::create('bar', 301)), 'Log master requests'); - } - - public function testExceptionListener() - { - $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock(); - $logger - ->expects($this->at(0)) - ->method('log') - ->with(LogLevel::CRITICAL, 'RuntimeException: Fatal error (uncaught exception) at '.__FILE__.' line '.(__LINE__ + 13)) - ; - $logger - ->expects($this->at(1)) - ->method('log') - ->with(LogLevel::ERROR, 'Symfony\Component\HttpKernel\Exception\HttpException: Http error (uncaught exception) at '.__FILE__.' line '.(__LINE__ + 9)) - ; - - $dispatcher = new EventDispatcher(); - $dispatcher->addSubscriber(new LogListener($logger)); - - $kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->getMock(); - - $dispatcher->dispatch(KernelEvents::EXCEPTION, new GetResponseForExceptionEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, new \RuntimeException('Fatal error'))); - $dispatcher->dispatch(KernelEvents::EXCEPTION, new GetResponseForExceptionEvent($kernel, Request::create('/foo'), HttpKernelInterface::SUB_REQUEST, new HttpException(400, 'Http error'))); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php b/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php deleted file mode 100644 index aea31b0..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ExceptionHandlerTest.php +++ /dev/null @@ -1,404 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - -/** - * Error handler test cases. - * - * @author Igor Wiedler - */ -class ExceptionHandlerTest extends TestCase -{ - public function testExceptionHandlerExceptionNoDebug() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Whoops, looks like something went wrong.', $response->getContent()); - $this->assertEquals(500, $response->getStatusCode()); - } - - public function testExceptionHandlerExceptionDebug() - { - $app = new Application(); - $app['debug'] = true; - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - - $this->assertContains('foo exception', $response->getContent()); - $this->assertEquals(500, $response->getStatusCode()); - } - - public function testExceptionHandlerNotFoundNoDebug() - { - $app = new Application(); - $app['debug'] = false; - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Sorry, the page you are looking for could not be found.', $response->getContent()); - $this->assertEquals(404, $response->getStatusCode()); - } - - public function testExceptionHandlerNotFoundDebug() - { - $app = new Application(); - $app['debug'] = true; - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('No route found for "GET /foo"', html_entity_decode($response->getContent())); - $this->assertEquals(404, $response->getStatusCode()); - } - - public function testExceptionHandlerMethodNotAllowedNoDebug() - { - $app = new Application(); - $app['debug'] = false; - - $app->get('/foo', function () { return 'foo'; }); - - $request = Request::create('/foo', 'POST'); - $response = $app->handle($request); - $this->assertContains('Whoops, looks like something went wrong.', $response->getContent()); - $this->assertEquals(405, $response->getStatusCode()); - $this->assertEquals('GET', $response->headers->get('Allow')); - } - - public function testExceptionHandlerMethodNotAllowedDebug() - { - $app = new Application(); - $app['debug'] = true; - - $app->get('/foo', function () { return 'foo'; }); - - $request = Request::create('/foo', 'POST'); - $response = $app->handle($request); - $this->assertContains('No route found for "POST /foo": Method Not Allowed (Allow: GET)', html_entity_decode($response->getContent())); - $this->assertEquals(405, $response->getStatusCode()); - $this->assertEquals('GET', $response->headers->get('Allow')); - } - - public function testNoExceptionHandler() - { - $app = new Application(); - unset($app['exception_handler']); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - try { - $request = Request::create('/foo'); - $app->handle($request); - $this->fail('->handle() should not catch exceptions where no error handler was supplied'); - } catch (\RuntimeException $e) { - $this->assertEquals('foo exception', $e->getMessage()); - } - } - - public function testOneExceptionHandler() - { - $app = new Application(); - - $app->match('/500', function () { - throw new \RuntimeException('foo exception'); - }); - - $app->match('/404', function () { - throw new NotFoundHttpException('foo exception'); - }); - - $app->get('/405', function () { return 'foo'; }); - - $app->error(function ($e, $code) { - return new Response('foo exception handler'); - }); - - $response = $this->checkRouteResponse($app, '/500', 'foo exception handler'); - $this->assertEquals(500, $response->getStatusCode()); - - $response = $app->handle(Request::create('/404')); - $this->assertEquals(404, $response->getStatusCode()); - - $response = $app->handle(Request::create('/405', 'POST')); - $this->assertEquals(405, $response->getStatusCode()); - $this->assertEquals('GET', $response->headers->get('Allow')); - } - - public function testMultipleExceptionHandlers() - { - $app = new Application(); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $errors = 0; - - $app->error(function ($e) use (&$errors) { - ++$errors; - }); - - $app->error(function ($e) use (&$errors) { - ++$errors; - }); - - $app->error(function ($e) use (&$errors) { - ++$errors; - - return new Response('foo exception handler'); - }); - - $app->error(function ($e) use (&$errors) { - // should not execute - ++$errors; - }); - - $request = Request::create('/foo'); - $this->checkRouteResponse($app, '/foo', 'foo exception handler', 'should return the first response returned by an exception handler'); - - $this->assertEquals(3, $errors, 'should execute error handlers until a response is returned'); - } - - public function testNoResponseExceptionHandler() - { - $app = new Application(); - unset($app['exception_handler']); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $errors = 0; - - $app->error(function ($e) use (&$errors) { - ++$errors; - }); - - try { - $request = Request::create('/foo'); - $app->handle($request); - $this->fail('->handle() should not catch exceptions where an empty error handler was supplied'); - } catch (\RuntimeException $e) { - $this->assertEquals('foo exception', $e->getMessage()); - } catch (\LogicException $e) { - $this->assertEquals('foo exception', $e->getPrevious()->getMessage()); - } - - $this->assertEquals(1, $errors, 'should execute the error handler'); - } - - public function testStringResponseExceptionHandler() - { - $app = new Application(); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $app->error(function ($e) { - return 'foo exception handler'; - }); - - $request = Request::create('/foo'); - $this->checkRouteResponse($app, '/foo', 'foo exception handler', 'should accept a string response from the error handler'); - } - - public function testExceptionHandlerException() - { - $app = new Application(); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $app->error(function ($e) { - throw new \RuntimeException('foo exception handler exception'); - }); - - try { - $request = Request::create('/foo'); - $app->handle($request); - $this->fail('->handle() should not catch exceptions thrown from an error handler'); - } catch (\RuntimeException $e) { - $this->assertEquals('foo exception handler exception', $e->getMessage()); - } - } - - public function testRemoveExceptionHandlerAfterDispatcherAccess() - { - $app = new Application(); - - $app->match('/foo', function () { - throw new \RuntimeException('foo exception'); - }); - - $app->before(function () { - // just making sure the dispatcher gets created - }); - - unset($app['exception_handler']); - - try { - $request = Request::create('/foo'); - $app->handle($request); - $this->fail('default exception handler should have been removed'); - } catch (\RuntimeException $e) { - $this->assertEquals('foo exception', $e->getMessage()); - } - } - - public function testExceptionHandlerWithDefaultException() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - throw new \Exception(); - }); - - $app->error(function (\Exception $e) { - return new Response('Exception thrown', 500); - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Exception thrown', $response->getContent()); - $this->assertEquals(500, $response->getStatusCode()); - } - - public function testExceptionHandlerWithStandardException() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - // Throw a normal exception - throw new \Exception(); - }); - - // Register 2 error handlers, each with a specified Exception class - // Since we throw a standard Exception above only - // the second error handler should fire - $app->error(function (\LogicException $e) { // Extends \Exception - return 'Caught LogicException'; - }); - $app->error(function (\Exception $e) { - return 'Caught Exception'; - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Caught Exception', $response->getContent()); - } - - public function testExceptionHandlerWithSpecifiedException() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - // Throw a specified exception - throw new \LogicException(); - }); - - // Register 2 error handlers, each with a specified Exception class - // Since we throw a LogicException above - // the first error handler should fire - $app->error(function (\LogicException $e) { // Extends \Exception - return 'Caught LogicException'; - }); - $app->error(function (\Exception $e) { - return 'Caught Exception'; - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Caught LogicException', $response->getContent()); - } - - public function testExceptionHandlerWithSpecifiedExceptionInReverseOrder() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - // Throw a specified exception - throw new \LogicException(); - }); - - // Register the \Exception error handler first, since the - // error handler works with an instanceof mechanism the - // second more specific error handler should not fire since - // the \Exception error handler is registered first and also - // captures all exceptions that extend it - $app->error(function (\Exception $e) { - return 'Caught Exception'; - }); - $app->error(function (\LogicException $e) { // Extends \Exception - return 'Caught LogicException'; - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Caught Exception', $response->getContent()); - } - - public function testExceptionHandlerWithArrayStyleCallback() - { - $app = new Application(); - $app['debug'] = false; - - $app->match('/foo', function () { - throw new \Exception(); - }); - - // Array style callback for error handler - $app->error(array($this, 'exceptionHandler')); - - $request = Request::create('/foo'); - $response = $app->handle($request); - $this->assertContains('Caught Exception', $response->getContent()); - } - - protected function checkRouteResponse($app, $path, $expectedContent, $method = 'get', $message = null) - { - $request = Request::create($path, $method); - $response = $app->handle($request); - $this->assertEquals($expectedContent, $response->getContent(), $message); - - return $response; - } - - public function exceptionHandler() - { - return 'Caught Exception'; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Fixtures/Php7Controller.php b/vendor/silex/silex/tests/Silex/Tests/Fixtures/Php7Controller.php deleted file mode 100644 index c16f14e..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Fixtures/Php7Controller.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Fixtures; - -use Silex\Application; - -class Php7Controller -{ - public function typehintedAction(Application $application, string $name) - { - return 'Hello '.$application->escape($name).' in '.get_class($application); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Fixtures/manifest.json b/vendor/silex/silex/tests/Silex/Tests/Fixtures/manifest.json deleted file mode 100644 index 78c3bd6..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Fixtures/manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "app.js": "some-random-hash.js" -} \ No newline at end of file diff --git a/vendor/silex/silex/tests/Silex/Tests/FunctionalTest.php b/vendor/silex/silex/tests/Silex/Tests/FunctionalTest.php deleted file mode 100644 index c6ee335..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/FunctionalTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Route; -use Silex\ControllerCollection; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Functional test cases. - * - * @author Igor Wiedler - */ -class FunctionalTest extends TestCase -{ - public function testBind() - { - $app = new Application(); - - $app->get('/', function () { - return 'hello'; - }) - ->bind('homepage'); - - $app->get('/foo', function () { - return 'foo'; - }) - ->bind('foo_abc'); - - $app->flush(); - $routes = $app['routes']; - $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('homepage')); - $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('foo_abc')); - } - - public function testMount() - { - $mounted = new ControllerCollection(new Route()); - $mounted->get('/{name}', function ($name) { return new Response($name); }); - - $app = new Application(); - $app->mount('/hello', $mounted); - - $response = $app->handle(Request::create('/hello/Silex')); - $this->assertEquals('Silex', $response->getContent()); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/JsonTest.php b/vendor/silex/silex/tests/Silex/Tests/JsonTest.php deleted file mode 100644 index 950437c..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/JsonTest.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; - -/** - * JSON test cases. - * - * @author Igor Wiedler - */ -class JsonTest extends TestCase -{ - public function testJsonReturnsJsonResponse() - { - $app = new Application(); - - $response = $app->json(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $response = json_decode($response->getContent(), true); - $this->assertSame(array(), $response); - } - - public function testJsonUsesData() - { - $app = new Application(); - - $response = $app->json(array('foo' => 'bar')); - $this->assertSame('{"foo":"bar"}', $response->getContent()); - } - - public function testJsonUsesStatus() - { - $app = new Application(); - - $response = $app->json(array(), 202); - $this->assertSame(202, $response->getStatusCode()); - } - - public function testJsonUsesHeaders() - { - $app = new Application(); - - $response = $app->json(array(), 200, array('ETag' => 'foo')); - $this->assertSame('foo', $response->headers->get('ETag')); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/LazyDispatcherTest.php b/vendor/silex/silex/tests/Silex/Tests/LazyDispatcherTest.php deleted file mode 100644 index fcbbc62..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/LazyDispatcherTest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; - -class LazyDispatcherTest extends TestCase -{ - /** @test */ - public function beforeMiddlewareShouldNotCreateDispatcherEarly() - { - $dispatcherCreated = false; - - $app = new Application(); - $app->extend('dispatcher', function ($dispatcher, $app) use (&$dispatcherCreated) { - $dispatcherCreated = true; - - return $dispatcher; - }); - - $app->before(function () {}); - - $this->assertFalse($dispatcherCreated); - - $request = Request::create('/'); - $app->handle($request); - - $this->assertTrue($dispatcherCreated); - } - - /** @test */ - public function eventHelpersShouldDirectlyAddListenersAfterBoot() - { - $app = new Application(); - - $fired = false; - $app->get('/', function () use ($app, &$fired) { - $app->finish(function () use (&$fired) { - $fired = true; - }); - }); - - $request = Request::create('/'); - $response = $app->handle($request); - $app->terminate($request, $response); - - $this->assertTrue($fired, 'Event was not fired'); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/LazyRequestMatcherTest.php b/vendor/silex/silex/tests/Silex/Tests/LazyRequestMatcherTest.php deleted file mode 100644 index 879d46f..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/LazyRequestMatcherTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Silex\Provider\Routing\LazyRequestMatcher; - -/** - * LazyRequestMatcher test case. - * - * @author Leszek Prabucki - */ -class LazyRequestMatcherTest extends TestCase -{ - /** - * @covers \Silex\LazyRequestMatcher::getRequestMatcher - */ - public function testUserMatcherIsCreatedLazily() - { - $callCounter = 0; - $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - - $matcher = new LazyRequestMatcher(function () use ($requestMatcher, &$callCounter) { - ++$callCounter; - - return $requestMatcher; - }); - - $this->assertEquals(0, $callCounter); - $request = Request::create('path'); - $matcher->matchRequest($request); - $this->assertEquals(1, $callCounter); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Factory supplied to LazyRequestMatcher must return implementation of Symfony\Component\Routing\RequestMatcherInterface. - */ - public function testThatCanInjectRequestMatcherOnly() - { - $matcher = new LazyRequestMatcher(function () { - return 'someMatcher'; - }); - - $request = Request::create('path'); - $matcher->matchRequest($request); - } - - /** - * @covers \Silex\LazyRequestMatcher::matchRequest - */ - public function testMatchIsProxy() - { - $request = Request::create('path'); - $matcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $matcher->expects($this->once()) - ->method('matchRequest') - ->with($request) - ->will($this->returnValue('matcherReturnValue')); - - $matcher = new LazyRequestMatcher(function () use ($matcher) { - return $matcher; - }); - $result = $matcher->matchRequest($request); - - $this->assertEquals('matcherReturnValue', $result); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/LocaleTest.php b/vendor/silex/silex/tests/Silex/Tests/LocaleTest.php deleted file mode 100644 index 81bf042..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/LocaleTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\LocaleServiceProvider; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * Locale test cases. - * - * @author Fabien Potencier - */ -class LocaleTest extends TestCase -{ - public function testLocale() - { - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app->get('/', function (Request $request) { return $request->getLocale(); }); - $response = $app->handle(Request::create('/')); - $this->assertEquals('en', $response->getContent()); - - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app['locale'] = 'fr'; - $app->get('/', function (Request $request) { return $request->getLocale(); }); - $response = $app->handle(Request::create('/')); - $this->assertEquals('fr', $response->getContent()); - - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app->get('/{_locale}', function (Request $request) { return $request->getLocale(); }); - $response = $app->handle(Request::create('/es')); - $this->assertEquals('es', $response->getContent()); - } - - public function testLocaleInSubRequests() - { - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app->get('/embed/{_locale}', function (Request $request) { return $request->getLocale(); }); - $app->get('/{_locale}', function (Request $request) use ($app) { - return $request->getLocale().$app->handle(Request::create('/embed/es'), HttpKernelInterface::SUB_REQUEST)->getContent().$request->getLocale(); - }); - $response = $app->handle(Request::create('/fr')); - $this->assertEquals('fresfr', $response->getContent()); - - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app->get('/embed', function (Request $request) { return $request->getLocale(); }); - $app->get('/{_locale}', function (Request $request) use ($app) { - return $request->getLocale().$app->handle(Request::create('/embed'), HttpKernelInterface::SUB_REQUEST)->getContent().$request->getLocale(); - }); - $response = $app->handle(Request::create('/fr')); - // locale in sub-request must be "en" as this is the value if the sub-request is converted to an ESI - $this->assertEquals('frenfr', $response->getContent()); - } - - public function testLocaleWithBefore() - { - $app = new Application(); - $app->register(new LocaleServiceProvider()); - $app->before(function (Request $request) use ($app) { $request->setLocale('fr'); }); - $app->get('/embed', function (Request $request) { return $request->getLocale(); }); - $app->get('/', function (Request $request) use ($app) { - return $request->getLocale().$app->handle(Request::create('/embed'), HttpKernelInterface::SUB_REQUEST)->getContent().$request->getLocale(); - }); - $response = $app->handle(Request::create('/')); - // locale in sub-request is "en" as the before filter is only executed for the main request - $this->assertEquals('frenfr', $response->getContent()); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php b/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php deleted file mode 100644 index 6335dad..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/MiddlewareTest.php +++ /dev/null @@ -1,308 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Middleware test cases. - * - * @author Igor Wiedler - */ -class MiddlewareTest extends TestCase -{ - public function testBeforeAndAfterFilter() - { - $i = 0; - $test = $this; - - $app = new Application(); - - $app->before(function () use (&$i, $test) { - $test->assertEquals(0, $i); - ++$i; - }); - - $app->match('/foo', function () use (&$i, $test) { - $test->assertEquals(1, $i); - ++$i; - }); - - $app->after(function () use (&$i, $test) { - $test->assertEquals(2, $i); - ++$i; - }); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertEquals(3, $i); - } - - public function testAfterFilterWithResponseObject() - { - $i = 0; - - $app = new Application(); - - $app->match('/foo', function () use (&$i) { - ++$i; - - return new Response('foo'); - }); - - $app->after(function () use (&$i) { - ++$i; - }); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertEquals(2, $i); - } - - public function testMultipleFilters() - { - $i = 0; - $test = $this; - - $app = new Application(); - - $app->before(function () use (&$i, $test) { - $test->assertEquals(0, $i); - ++$i; - }); - - $app->before(function () use (&$i, $test) { - $test->assertEquals(1, $i); - ++$i; - }); - - $app->match('/foo', function () use (&$i, $test) { - $test->assertEquals(2, $i); - ++$i; - }); - - $app->after(function () use (&$i, $test) { - $test->assertEquals(3, $i); - ++$i; - }); - - $app->after(function () use (&$i, $test) { - $test->assertEquals(4, $i); - ++$i; - }); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertEquals(5, $i); - } - - public function testFiltersShouldFireOnException() - { - $i = 0; - - $app = new Application(); - - $app->before(function () use (&$i) { - ++$i; - }); - - $app->match('/foo', function () { - throw new \RuntimeException(); - }); - - $app->after(function () use (&$i) { - ++$i; - }); - - $app->error(function () { - return 'error handled'; - }); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertEquals(2, $i); - } - - public function testFiltersShouldFireOnHttpException() - { - $i = 0; - - $app = new Application(); - - $app->before(function () use (&$i) { - ++$i; - }, Application::EARLY_EVENT); - - $app->after(function () use (&$i) { - ++$i; - }); - - $app->error(function () { - return 'error handled'; - }); - - $request = Request::create('/nowhere'); - $app->handle($request); - - $this->assertEquals(2, $i); - } - - public function testBeforeFilterPreventsBeforeMiddlewaresToBeExecuted() - { - $app = new Application(); - - $app->before(function () { return new Response('app before'); }); - - $app->get('/', function () { - return new Response('test'); - })->before(function () { - return new Response('middleware before'); - }); - - $this->assertEquals('app before', $app->handle(Request::create('/'))->getContent()); - } - - public function testBeforeFilterExceptionsWhenHandlingAnException() - { - $app = new Application(); - - $app->before(function () { throw new \RuntimeException(''); }); - - // even if the before filter throws an exception, we must have the 404 - $this->assertEquals(404, $app->handle(Request::create('/'))->getStatusCode()); - } - - public function testRequestShouldBePopulatedOnBefore() - { - $app = new Application(); - - $app->before(function (Request $request) use ($app) { - $app['project'] = $request->get('project'); - }); - - $app->match('/foo/{project}', function () use ($app) { - return $app['project']; - }); - - $request = Request::create('/foo/bar'); - $this->assertEquals('bar', $app->handle($request)->getContent()); - - $request = Request::create('/foo/baz'); - $this->assertEquals('baz', $app->handle($request)->getContent()); - } - - public function testBeforeFilterAccessesRequestAndCanReturnResponse() - { - $app = new Application(); - - $app->before(function (Request $request) { - return new Response($request->get('name')); - }); - - $app->match('/', function () use ($app) { throw new \Exception('Should never be executed'); }); - - $request = Request::create('/?name=Fabien'); - $this->assertEquals('Fabien', $app->handle($request)->getContent()); - } - - public function testAfterFilterAccessRequestResponse() - { - $app = new Application(); - - $app->after(function (Request $request, Response $response) { - $response->setContent($response->getContent().'---'); - }); - - $app->match('/', function () { return new Response('foo'); }); - - $request = Request::create('/'); - $this->assertEquals('foo---', $app->handle($request)->getContent()); - } - - public function testAfterFilterCanReturnResponse() - { - $app = new Application(); - - $app->after(function (Request $request, Response $response) { - return new Response('bar'); - }); - - $app->match('/', function () { return new Response('foo'); }); - - $request = Request::create('/'); - $this->assertEquals('bar', $app->handle($request)->getContent()); - } - - public function testRouteAndApplicationMiddlewareParameterInjection() - { - $app = new Application(); - - $test = $this; - - $middlewareTarget = array(); - $applicationBeforeMiddleware = function ($request, $app) use (&$middlewareTarget, $test) { - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); - $test->assertInstanceOf('\Silex\Application', $app); - $middlewareTarget[] = 'application_before_middleware_triggered'; - }; - - $applicationAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) { - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); - $test->assertInstanceOf('\Silex\Application', $app); - $middlewareTarget[] = 'application_after_middleware_triggered'; - }; - - $applicationFinishMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) { - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); - $test->assertInstanceOf('\Silex\Application', $app); - $middlewareTarget[] = 'application_finish_middleware_triggered'; - }; - - $routeBeforeMiddleware = function ($request, $app) use (&$middlewareTarget, $test) { - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); - $test->assertInstanceOf('\Silex\Application', $app); - $middlewareTarget[] = 'route_before_middleware_triggered'; - }; - - $routeAfterMiddleware = function ($request, $response, $app) use (&$middlewareTarget, $test) { - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Request', $request); - $test->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $response); - $test->assertInstanceOf('\Silex\Application', $app); - $middlewareTarget[] = 'route_after_middleware_triggered'; - }; - - $app->before($applicationBeforeMiddleware); - $app->after($applicationAfterMiddleware); - $app->finish($applicationFinishMiddleware); - - $app->match('/', function () { - return new Response('foo'); - }) - ->before($routeBeforeMiddleware) - ->after($routeAfterMiddleware); - - $request = Request::create('/'); - $response = $app->handle($request); - $app->terminate($request, $response); - - $this->assertSame(array('application_before_middleware_triggered', 'route_before_middleware_triggered', 'route_after_middleware_triggered', 'application_after_middleware_triggered', 'application_finish_middleware_triggered'), $middlewareTarget); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php deleted file mode 100644 index 940fdca..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/AssetServiceProviderTest.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\AssetServiceProvider; - -class AssetServiceProviderTest extends TestCase -{ - public function testGenerateAssetUrl() - { - $app = new Application(); - $app->register(new AssetServiceProvider(), array( - 'assets.version' => 'v1', - 'assets.version_format' => '%s?version=%s', - 'assets.named_packages' => array( - 'css' => array('version' => 'css2', 'base_path' => '/whatever-makes-sense'), - 'images' => array('base_urls' => array('https://img.example.com')), - ), - )); - - $this->assertEquals('/foo.png?version=v1', $app['assets.packages']->getUrl('/foo.png')); - $this->assertEquals('/whatever-makes-sense/foo.css?css2', $app['assets.packages']->getUrl('foo.css', 'css')); - $this->assertEquals('https://img.example.com/foo.png', $app['assets.packages']->getUrl('/foo.png', 'images')); - } - - public function testJsonManifestVersionStrategy() - { - if (!class_exists('Symfony\Component\Asset\VersionStrategy\JsonManifestVersionStrategy')) { - $this->markTestSkipped('JsonManifestVersionStrategy class is not available.'); - - return; - } - - $app = new Application(); - $app->register(new AssetServiceProvider(), array( - 'assets.json_manifest_path' => __DIR__.'/../Fixtures/manifest.json', - )); - - $this->assertEquals('/some-random-hash.js', $app['assets.packages']->getUrl('app.js')); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php deleted file mode 100644 index 9da8b8e..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/DoctrineServiceProviderTest.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Pimple\Container; -use Silex\Application; -use Silex\Provider\DoctrineServiceProvider; - -/** - * DoctrineProvider test cases. - * - * Fabien Potencier - */ -class DoctrineServiceProviderTest extends TestCase -{ - public function testOptionsInitializer() - { - $app = new Application(); - $app->register(new DoctrineServiceProvider()); - - $this->assertEquals($app['db.default_options'], $app['db']->getParams()); - } - - public function testSingleConnection() - { - if (!in_array('sqlite', \PDO::getAvailableDrivers())) { - $this->markTestSkipped('pdo_sqlite is not available'); - } - - $app = new Application(); - $app->register(new DoctrineServiceProvider(), array( - 'db.options' => array('driver' => 'pdo_sqlite', 'memory' => true), - )); - - $db = $app['db']; - $params = $db->getParams(); - $this->assertArrayHasKey('memory', $params); - $this->assertTrue($params['memory']); - $this->assertInstanceof('Doctrine\DBAL\Driver\PDOSqlite\Driver', $db->getDriver()); - $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); - - $this->assertSame($app['dbs']['default'], $db); - } - - public function testMultipleConnections() - { - if (!in_array('sqlite', \PDO::getAvailableDrivers())) { - $this->markTestSkipped('pdo_sqlite is not available'); - } - - $app = new Application(); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - 'sqlite2' => array('driver' => 'pdo_sqlite', 'path' => sys_get_temp_dir().'/silex'), - ), - )); - - $db = $app['db']; - $params = $db->getParams(); - $this->assertArrayHasKey('memory', $params); - $this->assertTrue($params['memory']); - $this->assertInstanceof('Doctrine\DBAL\Driver\PDOSqlite\Driver', $db->getDriver()); - $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); - - $this->assertSame($app['dbs']['sqlite1'], $db); - - $db2 = $app['dbs']['sqlite2']; - $params = $db2->getParams(); - $this->assertArrayHasKey('path', $params); - $this->assertEquals(sys_get_temp_dir().'/silex', $params['path']); - } - - public function testLoggerLoading() - { - if (!in_array('sqlite', \PDO::getAvailableDrivers())) { - $this->markTestSkipped('pdo_sqlite is not available'); - } - - $app = new Application(); - $this->assertTrue(isset($app['logger'])); - $this->assertNull($app['logger']); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - ), - )); - $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); - $this->assertNull($app['db']->getConfiguration()->getSQLLogger()); - } - - public function testLoggerNotLoaded() - { - if (!in_array('sqlite', \PDO::getAvailableDrivers())) { - $this->markTestSkipped('pdo_sqlite is not available'); - } - - $app = new Container(); - $app->register(new DoctrineServiceProvider(), array( - 'dbs.options' => array( - 'sqlite1' => array('driver' => 'pdo_sqlite', 'memory' => true), - ), - )); - $this->assertEquals(22, $app['db']->fetchColumn('SELECT 22')); - $this->assertNull($app['db']->getConfiguration()->getSQLLogger()); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php deleted file mode 100644 index 981826e..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest.php +++ /dev/null @@ -1,363 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\FormServiceProvider; -use Silex\Provider\CsrfServiceProvider; -use Silex\Provider\SessionServiceProvider; -use Silex\Provider\TranslationServiceProvider; -use Silex\Provider\ValidatorServiceProvider; -use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\AbstractTypeExtension; -use Symfony\Component\Form\FormTypeGuesserChain; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; -use Symfony\Component\Translation\Exception\NotFoundResourceException; - -class FormServiceProviderTest extends TestCase -{ - public function testFormFactoryServiceIsFormFactory() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $this->assertInstanceOf('Symfony\Component\Form\FormFactory', $app['form.factory']); - } - - public function testFormRegistryServiceIsFormRegistry() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $this->assertInstanceOf('Symfony\Component\Form\FormRegistry', $app['form.registry']); - } - - public function testFormServiceProviderWillLoadTypes() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.types', function ($extensions) { - $extensions[] = new DummyFormType(); - - return $extensions; - }); - - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('dummy', 'Silex\Tests\Provider\DummyFormType') - ->getForm(); - - $this->assertInstanceOf('Symfony\Component\Form\Form', $form); - } - - public function testFormServiceProviderWillLoadTypesServices() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app['dummy'] = function () { - return new DummyFormType(); - }; - $app->extend('form.types', function ($extensions) { - $extensions[] = 'dummy'; - - return $extensions; - }); - - $form = $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('dummy', 'dummy') - ->getForm(); - - $this->assertInstanceOf('Symfony\Component\Form\Form', $form); - } - - /** - * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid form type. The silex service "dummy" does not exist. - */ - public function testNonExistentTypeService() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.types', function ($extensions) { - $extensions[] = 'dummy'; - - return $extensions; - }); - - $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('dummy', 'dummy') - ->getForm(); - } - - public function testFormServiceProviderWillLoadTypeExtensions() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.type.extensions', function ($extensions) { - $extensions[] = new DummyFormTypeExtension(); - - return $extensions; - }); - - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', array('image_path' => 'webPath')) - ->getForm(); - - $this->assertInstanceOf('Symfony\Component\Form\Form', $form); - } - - public function testFormServiceProviderWillLoadTypeExtensionsServices() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app['dummy.form.type.extension'] = function () { - return new DummyFormTypeExtension(); - }; - $app->extend('form.type.extensions', function ($extensions) { - $extensions[] = 'dummy.form.type.extension'; - - return $extensions; - }); - - $form = $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', array('image_path' => 'webPath')) - ->getForm(); - - $this->assertInstanceOf('Symfony\Component\Form\Form', $form); - } - - /** - * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid form type extension. The silex service "dummy.form.type.extension" does not exist. - */ - public function testNonExistentTypeExtensionService() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.type.extensions', function ($extensions) { - $extensions[] = 'dummy.form.type.extension'; - - return $extensions; - }); - - $app['form.factory'] - ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->add('dummy', 'dummy.form.type') - ->getForm(); - } - - public function testFormServiceProviderWillLoadTypeGuessers() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.type.guessers', function ($guessers) { - $guessers[] = new FormTypeGuesserChain(array()); - - return $guessers; - }); - - $this->assertInstanceOf('Symfony\Component\Form\FormFactory', $app['form.factory']); - } - - public function testFormServiceProviderWillLoadTypeGuessersServices() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app['dummy.form.type.guesser'] = function () { - return new FormTypeGuesserChain(array()); - }; - $app->extend('form.type.guessers', function ($guessers) { - $guessers[] = 'dummy.form.type.guesser'; - - return $guessers; - }); - - $this->assertInstanceOf('Symfony\Component\Form\FormFactory', $app['form.factory']); - } - - /** - * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid form type guesser. The silex service "dummy.form.type.guesser" does not exist. - */ - public function testNonExistentTypeGuesserService() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - - $app->extend('form.type.guessers', function ($extensions) { - $extensions[] = 'dummy.form.type.guesser'; - - return $extensions; - }); - - $factory = $app['form.factory']; - } - - public function testFormServiceProviderWillUseTranslatorIfAvailable() - { - $app = new Application(); - - $app->register(new FormServiceProvider()); - $app->register(new TranslationServiceProvider()); - $app['translator.domains'] = array( - 'messages' => array( - 'de' => array( - 'The CSRF token is invalid. Please try to resubmit the form.' => 'German translation', - ), - ), - ); - $app['locale'] = 'de'; - - $app['csrf.token_manager'] = function () { - return $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock(); - }; - - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array()) - ->getForm(); - - $form->handleRequest($req = Request::create('/', 'POST', array('form' => array( - '_token' => 'the wrong token', - )))); - - $this->assertFalse($form->isValid()); - $r = new \ReflectionMethod($form, 'getErrors'); - if (!$r->getNumberOfParameters()) { - $this->assertContains('ERROR: German translation', $form->getErrorsAsString()); - } else { - // as of 2.5 - $this->assertContains('ERROR: German translation', (string) $form->getErrors(true, false)); - } - } - - public function testFormServiceProviderWillNotAddNonexistentTranslationFiles() - { - $app = new Application(array( - 'locale' => 'nonexistent', - )); - - $app->register(new FormServiceProvider()); - $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider(), array( - 'locale_fallbacks' => array(), - )); - - $app['form.factory']; - $translator = $app['translator']; - - try { - $translator->trans('test'); - } catch (NotFoundResourceException $e) { - $this->fail('Form factory should not add a translation resource that does not exist'); - } - } - - public function testFormCsrf() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $app->register(new SessionServiceProvider()); - $app->register(new CsrfServiceProvider()); - $app['session.test'] = true; - - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())->getForm(); - - $this->assertTrue(isset($form->createView()['_token'])); - } - - public function testUserExtensionCanConfigureDefaultExtensions() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $app->register(new SessionServiceProvider()); - $app->register(new CsrfServiceProvider()); - $app['session.test'] = true; - - $app->extend('form.type.extensions', function ($extensions) { - $extensions[] = new FormServiceProviderTest\DisableCsrfExtension(); - - return $extensions; - }); - $form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())->getForm(); - - $this->assertFalse($form->getConfig()->getOption('csrf_protection')); - } -} - -if (!class_exists('Symfony\Component\Form\Deprecated\FormEvents')) { - class DummyFormType extends AbstractType - { - } -} else { - // FormTypeInterface::getName() is needed by the form component 2.8.x - class DummyFormType extends AbstractType - { - /** - * @return string The name of this type - */ - public function getName() - { - return 'dummy'; - } - } -} - -if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) { - class DummyFormTypeExtension extends AbstractTypeExtension - { - public function getExtendedType() - { - return 'Symfony\Component\Form\Extension\Core\Type\FileType'; - } - - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefined(array('image_path')); - } - } -} else { - class DummyFormTypeExtension extends AbstractTypeExtension - { - public function getExtendedType() - { - return 'Symfony\Component\Form\Extension\Core\Type\FileType'; - } - - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - if (!method_exists($resolver, 'setDefined')) { - $resolver->setOptional(array('image_path')); - } else { - $resolver->setDefined(array('image_path')); - } - } - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php b/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php deleted file mode 100644 index 8c82237..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/FormServiceProviderTest/DisableCsrfExtension.php +++ /dev/null @@ -1,22 +0,0 @@ -setDefaults(array( - 'csrf_protection' => false, - )); - } - - public function getExtendedType() - { - return FormType::class; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php deleted file mode 100644 index dca3f6a..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpCacheServiceProviderTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\HttpCacheServiceProvider; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * HttpCacheProvider test cases. - * - * @author Igor Wiedler - */ -class HttpCacheServiceProviderTest extends TestCase -{ - public function testRegister() - { - $app = new Application(); - - $app->register(new HttpCacheServiceProvider(), array( - 'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(), - )); - - $this->assertInstanceOf('Silex\Provider\HttpCache\HttpCache', $app['http_cache']); - - return $app; - } - - /** - * @depends testRegister - */ - public function testRunCallsShutdown($app) - { - $finished = false; - - $app->finish(function () use (&$finished) { - $finished = true; - }); - - $app->get('/', function () use ($app) { - return new UnsendableResponse('will do something after finish'); - }); - - $request = Request::create('/'); - $app['http_cache']->run($request); - - $this->assertTrue($finished); - } - - public function testDebugDefaultsToThatOfApp() - { - $app = new Application(); - - $app->register(new HttpCacheServiceProvider(), array( - 'http_cache.cache_dir' => sys_get_temp_dir().'/silex_http_cache_'.uniqid(), - )); - - $app['debug'] = true; - $app['http_cache']; - $this->assertTrue($app['http_cache.options']['debug']); - } -} - -class UnsendableResponse extends Response -{ - public function send() - { - // do nothing - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php deleted file mode 100644 index 6e12fcc..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/HttpFragmentServiceProviderTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\HttpCacheServiceProvider; -use Silex\Provider\HttpFragmentServiceProvider; -use Silex\Provider\TwigServiceProvider; -use Symfony\Component\HttpFoundation\Request; - -class HttpFragmentServiceProviderTest extends TestCase -{ - public function testRenderFunction() - { - $app = new Application(); - unset($app['exception_handler']); - - $app->register(new HttpFragmentServiceProvider()); - $app->register(new HttpCacheServiceProvider(), array('http_cache.cache_dir' => sys_get_temp_dir())); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( - 'hello' => '{{ render("/foo") }}{{ render_esi("/foo") }}{{ render_hinclude("/foo") }}', - 'foo' => 'foo', - ), - )); - - $app->get('/hello', function () use ($app) { - return $app['twig']->render('hello'); - }); - - $app->get('/foo', function () use ($app) { - return $app['twig']->render('foo'); - }); - - $response = $app['http_cache']->handle(Request::create('/hello')); - - $this->assertEquals('foofoo', $response->getContent()); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php deleted file mode 100644 index 4585378..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/MonologServiceProviderTest.php +++ /dev/null @@ -1,257 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use Monolog\Formatter\JsonFormatter; -use Monolog\Handler\TestHandler; -use Monolog\Logger; -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\MonologServiceProvider; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Kernel; - -/** - * MonologProvider test cases. - * - * @author Igor Wiedler - */ -class MonologServiceProviderTest extends TestCase -{ - private $currErrorHandler; - - protected function setUp() - { - $this->currErrorHandler = set_error_handler('var_dump'); - restore_error_handler(); - } - - protected function tearDown() - { - set_error_handler($this->currErrorHandler); - } - - public function testRequestLogging() - { - $app = $this->getApplication(); - - $app->get('/foo', function () use ($app) { - return 'foo'; - }); - - $this->assertFalse($app['monolog.handler']->hasInfoRecords()); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertTrue($app['monolog.handler']->hasDebug('> GET /foo')); - $this->assertTrue($app['monolog.handler']->hasDebug('< 200')); - - $records = $app['monolog.handler']->getRecords(); - if (Kernel::VERSION_ID < 30100) { - $this->assertContains('Matched route "GET_foo"', $records[0]['message']); - } else { - $this->assertContains('Matched route "{route}".', $records[0]['message']); - $this->assertSame('GET_foo', $records[0]['context']['route']); - } - } - - public function testManualLogging() - { - $app = $this->getApplication(); - - $app->get('/log', function () use ($app) { - $app['monolog']->addDebug('logging a message'); - }); - - $this->assertFalse($app['monolog.handler']->hasDebugRecords()); - - $request = Request::create('/log'); - $app->handle($request); - - $this->assertTrue($app['monolog.handler']->hasDebug('logging a message')); - } - - public function testOverrideFormatter() - { - $app = new Application(); - - $app->register(new MonologServiceProvider(), array( - 'monolog.formatter' => new JsonFormatter(), - 'monolog.logfile' => 'php://memory', - )); - - $this->assertInstanceOf('Monolog\Formatter\JsonFormatter', $app['monolog.handler']->getFormatter()); - } - - public function testErrorLogging() - { - $app = $this->getApplication(); - - $app->error(function (\Exception $e) { - return 'error handled'; - }); - - /* - * Simulate 404, logged to error level - */ - $this->assertFalse($app['monolog.handler']->hasErrorRecords()); - - $request = Request::create('/error'); - $app->handle($request); - - $pattern = "#Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\NotFoundHttpException: No route found for \"GET /error\" \(uncaught exception\) at .* line \d+#"; - $this->assertMatchingRecord($pattern, Logger::ERROR, $app['monolog.handler']); - - /* - * Simulate unhandled exception, logged to critical - */ - $app->get('/error', function () { - throw new \RuntimeException('very bad error'); - }); - - $this->assertFalse($app['monolog.handler']->hasCriticalRecords()); - - $request = Request::create('/error'); - $app->handle($request); - - $pattern = "#RuntimeException: very bad error \(uncaught exception\) at .* line \d+#"; - $this->assertMatchingRecord($pattern, Logger::CRITICAL, $app['monolog.handler']); - } - - public function testRedirectLogging() - { - $app = $this->getApplication(); - - $app->get('/foo', function () use ($app) { - return new RedirectResponse('/bar', 302); - }); - - $this->assertFalse($app['monolog.handler']->hasInfoRecords()); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertTrue($app['monolog.handler']->hasDebug('< 302 /bar')); - } - - public function testErrorLoggingGivesWayToSecurityExceptionHandling() - { - $app = $this->getApplication(); - $app['monolog.level'] = Logger::ERROR; - - $app->register(new \Silex\Provider\SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( - 'pattern' => '^/admin', - 'http' => true, - 'users' => array(), - ), - ), - )); - - $app->get('/admin', function () { - return 'SECURE!'; - }); - - $request = Request::create('/admin'); - $app->run($request); - - $this->assertEmpty($app['monolog.handler']->getRecords(), 'Expected no logging to occur'); - } - - public function testStringErrorLevel() - { - $app = $this->getApplication(); - $app['monolog.level'] = 'info'; - - $this->assertSame(Logger::INFO, $app['monolog.handler']->getLevel()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Provided logging level 'foo' does not exist. Must be a valid monolog logging level. - */ - public function testNonExistentStringErrorLevel() - { - $app = $this->getApplication(); - $app['monolog.level'] = 'foo'; - - $app['monolog.handler']->getLevel(); - } - - public function testDisableListener() - { - $app = $this->getApplication(); - unset($app['monolog.listener']); - - $app->handle(Request::create('/404')); - - $this->assertEmpty($app['monolog.handler']->getRecords(), 'Expected no logging to occur'); - } - - public function testExceptionFiltering() - { - $app = new Application(); - $app->get('/foo', function () use ($app) { - throw new NotFoundHttpException(); - }); - - $level = Logger::ERROR; - $app->register(new MonologServiceProvider(), array( - 'monolog.exception.logger_filter' => $app->protect(function () { - return Logger::DEBUG; - }), - 'monolog.handler' => function () use ($app) { - return new TestHandler($app['monolog.level']); - }, - 'monolog.level' => $level, - 'monolog.logfile' => 'php://memory', - )); - - $request = Request::create('/foo'); - $app->handle($request); - - $this->assertCount(0, $app['monolog.handler']->getRecords(), 'Expected no logging to occur'); - } - - protected function assertMatchingRecord($pattern, $level, TestHandler $handler) - { - $found = false; - $records = $handler->getRecords(); - foreach ($records as $record) { - if (preg_match($pattern, $record['message']) && $record['level'] == $level) { - $found = true; - continue; - } - } - $this->assertTrue($found, "Trying to find record matching $pattern with level $level"); - } - - protected function getApplication() - { - $app = new Application(); - - $app->register(new MonologServiceProvider(), array( - 'monolog.handler' => function () use ($app) { - $level = MonologServiceProvider::translateLevel($app['monolog.level']); - - return new TestHandler($level); - }, - 'monolog.logfile' => 'php://memory', - )); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php deleted file mode 100644 index b027497..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/RememberMeServiceProviderTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use Silex\Application; -use Silex\WebTestCase; -use Silex\Provider\RememberMeServiceProvider; -use Silex\Provider\SecurityServiceProvider; -use Silex\Provider\SessionServiceProvider; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\Security\Http\SecurityEvents; - -/** - * SecurityServiceProvider. - * - * @author Fabien Potencier - */ -class RememberMeServiceProviderTest extends WebTestCase -{ - public function testRememberMeAuthentication() - { - $app = $this->createApplication(); - - $interactiveLogin = new InteractiveLoginTriggered(); - $app->on(SecurityEvents::INTERACTIVE_LOGIN, array($interactiveLogin, 'onInteractiveLogin')); - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertFalse($interactiveLogin->triggered, 'The interactive login has not been triggered yet'); - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo', '_remember_me' => 'true')); - $client->followRedirect(); - $this->assertEquals('AUTHENTICATED_FULLY', $client->getResponse()->getContent()); - $this->assertTrue($interactiveLogin->triggered, 'The interactive login has been triggered'); - - $this->assertNotNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie is set'); - $event = false; - - $client->getCookiejar()->expire('MOCKSESSID'); - - $client->request('get', '/'); - $this->assertEquals('AUTHENTICATED_REMEMBERED', $client->getResponse()->getContent()); - $this->assertTrue($interactiveLogin->triggered, 'The interactive login has been triggered'); - - $client->request('get', '/logout'); - $client->followRedirect(); - - $this->assertNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie has been removed'); - } - - public function createApplication($authenticationMethod = 'form') - { - $app = new Application(); - - $app['debug'] = true; - unset($app['exception_handler']); - - $app->register(new SessionServiceProvider(), array( - 'session.test' => true, - )); - $app->register(new SecurityServiceProvider()); - $app->register(new RememberMeServiceProvider()); - - $app['security.firewalls'] = array( - 'http-auth' => array( - 'pattern' => '^.*$', - 'form' => true, - 'remember_me' => array(), - 'logout' => true, - 'users' => array( - 'fabien' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ); - - $app->get('/', function () use ($app) { - if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) { - return 'AUTHENTICATED_FULLY'; - } elseif ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_REMEMBERED')) { - return 'AUTHENTICATED_REMEMBERED'; - } else { - return 'AUTHENTICATED_ANONYMOUSLY'; - } - }); - - return $app; - } -} - -class InteractiveLoginTriggered -{ - public $triggered = false; - - public function onInteractiveLogin() - { - $this->triggered = true; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php deleted file mode 100644 index 2faaa68..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/RoutingServiceProviderTest.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Pimple\Container; -use Silex\Application; -use Silex\Provider\RoutingServiceProvider; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - -/** - * RoutingProvider test cases. - * - * @author Igor Wiedler - */ -class RoutingServiceProviderTest extends TestCase -{ - public function testRegister() - { - $app = new Application(); - - $app->get('/hello/{name}', function ($name) {}) - ->bind('hello'); - - $app->get('/', function () {}); - - $request = Request::create('/'); - $app->handle($request); - - $this->assertInstanceOf('Symfony\Component\Routing\Generator\UrlGenerator', $app['url_generator']); - } - - public function testUrlGeneration() - { - $app = new Application(); - - $app->get('/hello/{name}', function ($name) {}) - ->bind('hello'); - - $app->get('/', function () use ($app) { - return $app['url_generator']->generate('hello', array('name' => 'john')); - }); - - $request = Request::create('/'); - $response = $app->handle($request); - - $this->assertEquals('/hello/john', $response->getContent()); - } - - public function testAbsoluteUrlGeneration() - { - $app = new Application(); - - $app->get('/hello/{name}', function ($name) {}) - ->bind('hello'); - - $app->get('/', function () use ($app) { - return $app['url_generator']->generate('hello', array('name' => 'john'), UrlGeneratorInterface::ABSOLUTE_URL); - }); - - $request = Request::create('https://localhost:81/'); - $response = $app->handle($request); - - $this->assertEquals('https://localhost:81/hello/john', $response->getContent()); - } - - public function testUrlGenerationWithHttp() - { - $app = new Application(); - - $app->get('/insecure', function () {}) - ->bind('insecure_page') - ->requireHttp(); - - $app->get('/', function () use ($app) { - return $app['url_generator']->generate('insecure_page'); - }); - - $request = Request::create('https://localhost/'); - $response = $app->handle($request); - - $this->assertEquals('http://localhost/insecure', $response->getContent()); - } - - public function testUrlGenerationWithHttps() - { - $app = new Application(); - - $app->get('/secure', function () {}) - ->bind('secure_page') - ->requireHttps(); - - $app->get('/', function () use ($app) { - return $app['url_generator']->generate('secure_page'); - }); - - $request = Request::create('http://localhost/'); - $response = $app->handle($request); - - $this->assertEquals('https://localhost/secure', $response->getContent()); - } - - public function testControllersFactory() - { - $app = new Container(); - $app->register(new RoutingServiceProvider()); - $coll = $app['controllers_factory']; - $coll->mount('/blog', function ($blog) { - $this->assertInstanceOf('Silex\ControllerCollection', $blog); - }); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php deleted file mode 100644 index 3436c53..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest.php +++ /dev/null @@ -1,491 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use Silex\Application; -use Silex\WebTestCase; -use Silex\Provider\SecurityServiceProvider; -use Silex\Provider\SessionServiceProvider; -use Silex\Provider\ValidatorServiceProvider; -use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpFoundation\Request; - -/** - * SecurityServiceProvider. - * - * @author Fabien Potencier - */ -class SecurityServiceProviderTest extends WebTestCase -{ - /** - * @expectedException \LogicException - */ - public function testWrongAuthenticationType() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'wrong' => array( - 'foobar' => true, - 'users' => array(), - ), - ), - )); - $app->get('/', function () {}); - $app->handle(Request::create('/')); - } - - public function testFormAuthentication() - { - $app = $this->createApplication('form'); - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertEquals('ANONYMOUS', $client->getResponse()->getContent()); - - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'bar')); - $this->assertContains('Bad credentials', $app['security.last_error']($client->getRequest())); - // hack to re-close the session as the previous assertions re-opens it - $client->getRequest()->getSession()->save(); - - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo')); - $this->assertEquals('', $app['security.last_error']($client->getRequest())); - $client->getRequest()->getSession()->save(); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('http://localhost/', $client->getResponse()->getTargetUrl()); - - $client->request('get', '/'); - $this->assertEquals('fabienAUTHENTICATED', $client->getResponse()->getContent()); - $client->request('get', '/admin'); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); - - $client->request('get', '/logout'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('http://localhost/', $client->getResponse()->getTargetUrl()); - - $client->request('get', '/'); - $this->assertEquals('ANONYMOUS', $client->getResponse()->getContent()); - - $client->request('get', '/admin'); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('http://localhost/login', $client->getResponse()->getTargetUrl()); - - $client->request('post', '/login_check', array('_username' => 'admin', '_password' => 'foo')); - $this->assertEquals('', $app['security.last_error']($client->getRequest())); - $client->getRequest()->getSession()->save(); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); - $this->assertEquals('http://localhost/admin', $client->getResponse()->getTargetUrl()); - - $client->request('get', '/'); - $this->assertEquals('adminAUTHENTICATEDADMIN', $client->getResponse()->getContent()); - $client->request('get', '/admin'); - $this->assertEquals('admin', $client->getResponse()->getContent()); - } - - public function testHttpAuthentication() - { - $app = $this->createApplication('http'); - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertEquals(401, $client->getResponse()->getStatusCode()); - $this->assertEquals('Basic realm="Secured"', $client->getResponse()->headers->get('www-authenticate')); - - $client->request('get', '/', array(), array(), array('PHP_AUTH_USER' => 'dennis', 'PHP_AUTH_PW' => 'foo')); - $this->assertEquals('dennisAUTHENTICATED', $client->getResponse()->getContent()); - $client->request('get', '/admin'); - $this->assertEquals(403, $client->getResponse()->getStatusCode()); - - $client->restart(); - - $client->request('get', '/'); - $this->assertEquals(401, $client->getResponse()->getStatusCode()); - $this->assertEquals('Basic realm="Secured"', $client->getResponse()->headers->get('www-authenticate')); - - $client->request('get', '/', array(), array(), array('PHP_AUTH_USER' => 'admin', 'PHP_AUTH_PW' => 'foo')); - $this->assertEquals('adminAUTHENTICATEDADMIN', $client->getResponse()->getContent()); - $client->request('get', '/admin'); - $this->assertEquals('admin', $client->getResponse()->getContent()); - } - - public function testGuardAuthentication() - { - $app = $this->createApplication('guard'); - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertEquals(401, $client->getResponse()->getStatusCode(), 'The entry point is configured'); - $this->assertEquals('{"message":"Authentication Required"}', $client->getResponse()->getContent()); - - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'lili:not the secret')); - $this->assertEquals(403, $client->getResponse()->getStatusCode(), 'User not found'); - $this->assertEquals('{"message":"Username could not be found."}', $client->getResponse()->getContent()); - - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'victoria:not the secret')); - $this->assertEquals(403, $client->getResponse()->getStatusCode(), 'Invalid credentials'); - $this->assertEquals('{"message":"Invalid credentials."}', $client->getResponse()->getContent()); - - $client->request('get', '/', array(), array(), array('HTTP_X_AUTH_TOKEN' => 'victoria:victoriasecret')); - $this->assertEquals('victoria', $client->getResponse()->getContent()); - } - - public function testUserPasswordValidatorIsRegistered() - { - $app = new Application(); - - $app->register(new ValidatorServiceProvider()); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( - 'pattern' => '^/admin', - 'http' => true, - 'users' => array( - 'admin' => array('ROLE_ADMIN', '513aeb0121909'), - ), - ), - ), - )); - - $app->boot(); - - $this->assertInstanceOf('Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator', $app['security.validator.user_password_validator']); - } - - public function testExposedExceptions() - { - $app = $this->createApplication('form'); - $app['security.hide_user_not_found'] = false; - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertEquals('ANONYMOUS', $client->getResponse()->getContent()); - - $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'bar')); - $this->assertEquals('The presented password is invalid.', $app['security.last_error']($client->getRequest())); - $client->getRequest()->getSession()->save(); - - $client->request('post', '/login_check', array('_username' => 'unknown', '_password' => 'bar')); - $this->assertEquals('Username "unknown" does not exist.', $app['security.last_error']($client->getRequest())); - $client->getRequest()->getSession()->save(); - } - - public function testFakeRoutesAreSerializable() - { - $app = new Application(); - - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'admin' => array( - 'logout' => true, - ), - ), - )); - - $app->boot(); - $app->flush(); - - $this->assertCount(1, unserialize(serialize($app['routes']))); - } - - public function testFirewallWithMethod() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'pattern' => '/', - 'http' => true, - 'methods' => array('POST'), - ), - ), - )); - $app->match('/', function () { return 'foo'; }) - ->method('POST|GET'); - - $request = Request::create('/', 'GET'); - $response = $app->handle($request); - $this->assertEquals(200, $response->getStatusCode()); - - $request = Request::create('/', 'POST'); - $response = $app->handle($request); - $this->assertEquals(401, $response->getStatusCode()); - } - - public function testFirewallWithHost() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'pattern' => '/', - 'http' => true, - 'hosts' => 'localhost2', - ), - ), - )); - $app->get('/', function () { return 'foo'; }) - ->host('localhost2'); - - $app->get('/', function () { return 'foo'; }) - ->host('localhost1'); - - $request = Request::create('http://localhost2/'); - $response = $app->handle($request); - $this->assertEquals(401, $response->getStatusCode()); - - $request = Request::create('http://localhost1/'); - $response = $app->handle($request); - $this->assertEquals(200, $response->getStatusCode()); - } - - public function testUser() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - 'users' => array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - )); - $app->get('/', function () { return 'foo'; }); - - $request = Request::create('/'); - $app->handle($request); - $this->assertNull($app['user']); - - $request->headers->set('PHP_AUTH_USER', 'fabien'); - $request->headers->set('PHP_AUTH_PW', 'foo'); - $app->handle($request); - $this->assertInstanceOf('Symfony\Component\Security\Core\User\UserInterface', $app['user']); - $this->assertEquals('fabien', $app['user']->getUsername()); - } - - public function testUserWithNoToken() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - ), - ), - )); - - $request = Request::create('/'); - - $app->get('/', function () { return 'foo'; }); - $app->handle($request); - $this->assertNull($app['user']); - } - - public function testUserWithInvalidUser() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - ), - ), - )); - - $request = Request::create('/'); - $app->boot(); - $app['security.token_storage']->setToken(new UsernamePasswordToken('foo', 'foo', 'foo')); - - $app->get('/', function () { return 'foo'; }); - $app->handle($request); - $this->assertNull($app['user']); - } - - public function testAccessRulePathArray() - { - $app = new Application(); - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - ), - ), - 'security.access_rules' => array( - array(array( - 'path' => '^/admin', - ), 'ROLE_ADMIN'), - ), - )); - - $request = Request::create('/admin'); - $app->boot(); - $accessMap = $app['security.access_map']; - $this->assertEquals($accessMap->getPatterns($request), array( - array('ROLE_ADMIN'), - '', - )); - } - - public function createApplication($authenticationMethod = 'form') - { - $app = new Application(); - $app->register(new SessionServiceProvider()); - - $app = call_user_func(array($this, 'add'.ucfirst($authenticationMethod).'Authentication'), $app); - - $app['session.test'] = true; - - return $app; - } - - private function addFormAuthentication($app) - { - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'login' => array( - 'pattern' => '^/login$', - ), - 'default' => array( - 'pattern' => '^.*$', - 'anonymous' => true, - 'form' => array( - 'require_previous_session' => false, - ), - 'logout' => true, - 'users' => array( - // password is foo - 'fabien' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'admin' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - 'security.access_rules' => array( - array('^/admin', 'ROLE_ADMIN'), - ), - 'security.role_hierarchy' => array( - 'ROLE_ADMIN' => array('ROLE_USER'), - ), - )); - - $app->get('/login', function (Request $request) use ($app) { - $app['session']->start(); - - return $app['security.last_error']($request); - }); - - $app->get('/', function () use ($app) { - $user = $app['security.token_storage']->getToken()->getUser(); - - $content = is_object($user) ? $user->getUsername() : 'ANONYMOUS'; - - if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) { - $content .= 'AUTHENTICATED'; - } - - if ($app['security.authorization_checker']->isGranted('ROLE_ADMIN')) { - $content .= 'ADMIN'; - } - - return $content; - }); - - $app->get('/admin', function () use ($app) { - return 'admin'; - }); - - return $app; - } - - private function addHttpAuthentication($app) - { - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'http-auth' => array( - 'pattern' => '^.*$', - 'http' => true, - 'users' => array( - // password is foo - 'dennis' => array('ROLE_USER', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - 'admin' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - 'security.access_rules' => array( - array('^/admin', 'ROLE_ADMIN'), - ), - 'security.role_hierarchy' => array( - 'ROLE_ADMIN' => array('ROLE_USER'), - ), - )); - - $app->get('/', function () use ($app) { - $user = $app['security.token_storage']->getToken()->getUser(); - $content = is_object($user) ? $user->getUsername() : 'ANONYMOUS'; - - if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) { - $content .= 'AUTHENTICATED'; - } - - if ($app['security.authorization_checker']->isGranted('ROLE_ADMIN')) { - $content .= 'ADMIN'; - } - - return $content; - }); - - $app->get('/admin', function () use ($app) { - return 'admin'; - }); - - return $app; - } - - private function addGuardAuthentication($app) - { - $app['app.authenticator.token'] = function ($app) { - return new SecurityServiceProviderTest\TokenAuthenticator($app); - }; - - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'guard' => array( - 'pattern' => '^.*$', - 'form' => true, - 'guard' => array( - 'authenticators' => array( - 'app.authenticator.token', - ), - ), - 'users' => array( - 'victoria' => array('ROLE_USER', 'victoriasecret'), - ), - ), - ), - )); - - $app->get('/', function () use ($app) { - $user = $app['security.token_storage']->getToken()->getUser(); - - $content = is_object($user) ? $user->getUsername() : 'ANONYMOUS'; - - return $content; - })->bind('homepage'); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php deleted file mode 100644 index c569428..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SecurityServiceProviderTest/TokenAuthenticator.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider\SecurityServiceProviderTest; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Security\Core\User\UserInterface; -use Symfony\Component\Security\Core\User\UserProviderInterface; -use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Exception\AuthenticationException; - -/** - * This class is used to test "guard" authentication with the SecurityServiceProvider. - */ -class TokenAuthenticator extends AbstractGuardAuthenticator -{ - public function getCredentials(Request $request) - { - if (!$token = $request->headers->get('X-AUTH-TOKEN')) { - return; - } - - list($username, $secret) = explode(':', $token); - - return array( - 'username' => $username, - 'secret' => $secret, - ); - } - - public function getUser($credentials, UserProviderInterface $userProvider) - { - return $userProvider->loadUserByUsername($credentials['username']); - } - - public function checkCredentials($credentials, UserInterface $user) - { - // This is not a safe way of validating a password. - return $user->getPassword() === $credentials['secret']; - } - - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) - { - return; - } - - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) - { - $data = array( - 'message' => strtr($exception->getMessageKey(), $exception->getMessageData()), - ); - - return new JsonResponse($data, 403); - } - - public function start(Request $request, AuthenticationException $authException = null) - { - $data = array( - 'message' => 'Authentication Required', - ); - - return new JsonResponse($data, 401); - } - - public function supportsRememberMe() - { - return false; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SerializerServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SerializerServiceProviderTest.php deleted file mode 100644 index c33cea7..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SerializerServiceProviderTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\SerializerServiceProvider; - -/** - * SerializerServiceProvider test cases. - * - * @author Fabien Potencier - */ -class SerializerServiceProviderTest extends TestCase -{ - public function testRegister() - { - $app = new Application(); - - $app->register(new SerializerServiceProvider()); - - $this->assertInstanceOf("Symfony\Component\Serializer\Serializer", $app['serializer']); - $this->assertTrue($app['serializer']->supportsEncoding('xml')); - $this->assertTrue($app['serializer']->supportsEncoding('json')); - $this->assertTrue($app['serializer']->supportsDecoding('xml')); - $this->assertTrue($app['serializer']->supportsDecoding('json')); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php deleted file mode 100644 index fb7ae0c..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SessionServiceProviderTest.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use Silex\Application; -use Silex\WebTestCase; -use Silex\Provider\SessionServiceProvider; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpFoundation\Session; - -/** - * SessionProvider test cases. - * - * @author Igor Wiedler - * @author Fabien Potencier - */ -class SessionServiceProviderTest extends WebTestCase -{ - public function testRegister() - { - /* - * Smoke test - */ - $defaultStorage = $this->app['session.storage.native']; - - $client = $this->createClient(); - - $client->request('get', '/login'); - $this->assertEquals('Logged in successfully.', $client->getResponse()->getContent()); - - $client->request('get', '/account'); - $this->assertEquals('This is your account.', $client->getResponse()->getContent()); - - $client->request('get', '/logout'); - $this->assertEquals('Logged out successfully.', $client->getResponse()->getContent()); - - $client->request('get', '/account'); - $this->assertEquals('You are not logged in.', $client->getResponse()->getContent()); - } - - public function createApplication() - { - $app = new Application(); - - $app->register(new SessionServiceProvider(), array( - 'session.test' => true, - )); - - $app->get('/login', function () use ($app) { - $app['session']->set('logged_in', true); - - return 'Logged in successfully.'; - }); - - $app->get('/account', function () use ($app) { - if (!$app['session']->get('logged_in')) { - return 'You are not logged in.'; - } - - return 'This is your account.'; - }); - - $app->get('/logout', function () use ($app) { - $app['session']->invalidate(); - - return 'Logged out successfully.'; - }); - - return $app; - } - - public function testWithRoutesThatDoesNotUseSession() - { - $app = new Application(); - - $app->register(new SessionServiceProvider(), array( - 'session.test' => true, - )); - - $app->get('/', function () { - return 'A welcome page.'; - }); - - $app->get('/robots.txt', function () { - return 'Informations for robots.'; - }); - - $app['debug'] = true; - unset($app['exception_handler']); - - $client = new Client($app); - - $client->request('get', '/'); - $this->assertEquals('A welcome page.', $client->getResponse()->getContent()); - - $client->request('get', '/robots.txt'); - $this->assertEquals('Informations for robots.', $client->getResponse()->getContent()); - } - - public function testSessionRegister() - { - $app = new Application(); - - $attrs = new Session\Attribute\AttributeBag(); - $flash = new Session\Flash\FlashBag(); - $app->register(new SessionServiceProvider(), array( - 'session.attribute_bag' => $attrs, - 'session.flash_bag' => $flash, - 'session.test' => true, - )); - - $session = $app['session']; - - $this->assertSame($flash, $session->getBag('flashes')); - $this->assertSame($attrs, $session->getBag('attributes')); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php deleted file mode 100644 index c1eb2b0..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SpoolStub.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -class SpoolStub implements \Swift_Spool -{ - private $messages = array(); - public $hasFlushed = false; - - public function getMessages() - { - return $this->messages; - } - - public function start() - { - } - - public function stop() - { - } - - public function isStarted() - { - return count($this->messages) > 0; - } - - public function queueMessage(\Swift_Mime_Message $message) - { - $this->messages[] = clone $message; - } - - public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null) - { - $this->hasFlushed = true; - $this->messages = array(); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php deleted file mode 100644 index f80c225..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\SwiftmailerServiceProvider; -use Symfony\Component\HttpFoundation\Request; - -class SwiftmailerServiceProviderTest extends TestCase -{ - public function testSwiftMailerServiceIsSwiftMailer() - { - $app = new Application(); - - $app->register(new SwiftmailerServiceProvider()); - $app->boot(); - - $this->assertInstanceOf('Swift_Mailer', $app['mailer']); - } - - public function testSwiftMailerIgnoresSpoolIfDisabled() - { - $app = new Application(); - - $app->register(new SwiftmailerServiceProvider()); - $app->boot(); - - $app['swiftmailer.use_spool'] = false; - - $app['swiftmailer.spooltransport'] = function () { - throw new \Exception('Should not be instantiated'); - }; - - $this->assertInstanceOf('Swift_Mailer', $app['mailer']); - } - - public function testSwiftMailerSendsMailsOnFinish() - { - $app = new Application(); - - $app->register(new SwiftmailerServiceProvider()); - $app->boot(); - - $app['swiftmailer.spool'] = function () { - return new SpoolStub(); - }; - - $app->get('/', function () use ($app) { - $app['mailer']->send(\Swift_Message::newInstance()); - }); - - $this->assertCount(0, $app['swiftmailer.spool']->getMessages()); - - $request = Request::create('/'); - $response = $app->handle($request); - $this->assertCount(1, $app['swiftmailer.spool']->getMessages()); - - $app->terminate($request, $response); - $this->assertTrue($app['swiftmailer.spool']->hasFlushed); - $this->assertCount(0, $app['swiftmailer.spool']->getMessages()); - } - - public function testSwiftMailerAvoidsFlushesIfMailerIsUnused() - { - $app = new Application(); - - $app->register(new SwiftmailerServiceProvider()); - $app->boot(); - - $app['swiftmailer.spool'] = function () { - return new SpoolStub(); - }; - - $app->get('/', function () use ($app) { }); - - $request = Request::create('/'); - $response = $app->handle($request); - $this->assertCount(0, $app['swiftmailer.spool']->getMessages()); - - $app->terminate($request, $response); - $this->assertFalse($app['swiftmailer.spool']->hasFlushed); - } - - public function testSwiftMailerSenderAddress() - { - $app = new Application(); - - $app->register(new SwiftmailerServiceProvider()); - $app->boot(); - - $app['swiftmailer.spool'] = function () { - return new SpoolStub(); - }; - - $app['swiftmailer.sender_address'] = 'foo@example.com'; - - $app['mailer']->send(\Swift_Message::newInstance()); - - $messages = $app['swiftmailer.spool']->getMessages(); - $this->assertCount(1, $messages); - - list($message) = $messages; - $this->assertEquals('foo@example.com', $message->getReturnPath()); - } - - public function testSwiftMailerPlugins() - { - $plugin = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock(); - $plugin->expects($this->once())->method('beforeTransportStarted'); - - $app = new Application(); - $app->boot(); - - $app->register(new SwiftmailerServiceProvider()); - - $app['swiftmailer.plugins'] = function ($app) use ($plugin) { - return array($plugin); - }; - - $dispatcher = $app['swiftmailer.transport.eventdispatcher']; - $event = $dispatcher->createTransportChangeEvent(new \Swift_Transport_NullTransport($dispatcher)); - $dispatcher->dispatchEvent($event, 'beforeTransportStarted'); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php deleted file mode 100644 index b4132f9..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/TranslationServiceProviderTest.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\TranslationServiceProvider; -use Silex\Provider\LocaleServiceProvider; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * TranslationProvider test cases. - * - * @author Daniel Tschinder - */ -class TranslationServiceProviderTest extends TestCase -{ - /** - * @return Application - */ - protected function getPreparedApp() - { - $app = new Application(); - - $app->register(new LocaleServiceProvider()); - $app->register(new TranslationServiceProvider()); - $app['translator.domains'] = array( - 'messages' => array( - 'en' => array( - 'key1' => 'The translation', - 'key_only_english' => 'Foo', - 'key2' => 'One apple|%count% apples', - 'test' => array( - 'key' => 'It works', - ), - ), - 'de' => array( - 'key1' => 'The german translation', - 'key2' => 'One german apple|%count% german apples', - 'test' => array( - 'key' => 'It works in german', - ), - ), - ), - ); - - return $app; - } - - public function transChoiceProvider() - { - return array( - array('key2', 0, null, '0 apples'), - array('key2', 1, null, 'One apple'), - array('key2', 2, null, '2 apples'), - array('key2', 0, 'de', '0 german apples'), - array('key2', 1, 'de', 'One german apple'), - array('key2', 2, 'de', '2 german apples'), - array('key2', 0, 'ru', '0 apples'), // fallback - array('key2', 1, 'ru', 'One apple'), // fallback - array('key2', 2, 'ru', '2 apples'), // fallback - ); - } - - public function transProvider() - { - return array( - array('key1', null, 'The translation'), - array('key1', 'de', 'The german translation'), - array('key1', 'ru', 'The translation'), // fallback - array('test.key', null, 'It works'), - array('test.key', 'de', 'It works in german'), - array('test.key', 'ru', 'It works'), // fallback - ); - } - - /** - * @dataProvider transProvider - */ - public function testTransForDefaultLanguage($key, $locale, $expected) - { - $app = $this->getPreparedApp(); - - $result = $app['translator']->trans($key, array(), null, $locale); - - $this->assertEquals($expected, $result); - } - - /** - * @dataProvider transChoiceProvider - */ - public function testTransChoiceForDefaultLanguage($key, $number, $locale, $expected) - { - $app = $this->getPreparedApp(); - - $result = $app['translator']->transChoice($key, $number, array('%count%' => $number), null, $locale); - $this->assertEquals($expected, $result); - } - - public function testFallbacks() - { - $app = $this->getPreparedApp(); - $app['locale_fallbacks'] = array('de', 'en'); - - // fallback to english - $result = $app['translator']->trans('key_only_english', array(), null, 'ru'); - $this->assertEquals('Foo', $result); - - // fallback to german - $result = $app['translator']->trans('key1', array(), null, 'ru'); - $this->assertEquals('The german translation', $result); - } - - public function testLocale() - { - $app = $this->getPreparedApp(); - $app->get('/', function () use ($app) { return $app['translator']->getLocale(); }); - $response = $app->handle(Request::create('/')); - $this->assertEquals('en', $response->getContent()); - - $app = $this->getPreparedApp(); - $app->get('/', function () use ($app) { return $app['translator']->getLocale(); }); - $request = Request::create('/'); - $request->setLocale('fr'); - $response = $app->handle($request); - $this->assertEquals('fr', $response->getContent()); - - $app = $this->getPreparedApp(); - $app->get('/{_locale}', function () use ($app) { return $app['translator']->getLocale(); }); - $response = $app->handle(Request::create('/es')); - $this->assertEquals('es', $response->getContent()); - } - - public function testLocaleInSubRequests() - { - $app = $this->getPreparedApp(); - $app->get('/embed/{_locale}', function () use ($app) { return $app['translator']->getLocale(); }); - $app->get('/{_locale}', function () use ($app) { - return $app['translator']->getLocale(). - $app->handle(Request::create('/embed/es'), HttpKernelInterface::SUB_REQUEST)->getContent(). - $app['translator']->getLocale(); - }); - $response = $app->handle(Request::create('/fr')); - $this->assertEquals('fresfr', $response->getContent()); - - $app = $this->getPreparedApp(); - $app->get('/embed', function () use ($app) { return $app['translator']->getLocale(); }); - $app->get('/{_locale}', function () use ($app) { - return $app['translator']->getLocale(). - $app->handle(Request::create('/embed'), HttpKernelInterface::SUB_REQUEST)->getContent(). - $app['translator']->getLocale(); - }); - $response = $app->handle(Request::create('/fr')); - // locale in sub-request must be "en" as this is the value if the sub-request is converted to an ESI - $this->assertEquals('frenfr', $response->getContent()); - } - - public function testLocaleWithBefore() - { - $app = $this->getPreparedApp(); - $app->before(function (Request $request) { $request->setLocale('fr'); }, Application::EARLY_EVENT); - $app->get('/embed', function () use ($app) { return $app['translator']->getLocale(); }); - $app->get('/', function () use ($app) { - return $app['translator']->getLocale(). - $app->handle(Request::create('/embed'), HttpKernelInterface::SUB_REQUEST)->getContent(). - $app['translator']->getLocale(); - }); - $response = $app->handle(Request::create('/')); - // locale in sub-request is "en" as the before filter is only executed for the main request - $this->assertEquals('frenfr', $response->getContent()); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php deleted file mode 100644 index 1b5aef2..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/TwigServiceProviderTest.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use Fig\Link\Link; -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\CsrfServiceProvider; -use Silex\Provider\FormServiceProvider; -use Silex\Provider\TwigServiceProvider; -use Silex\Provider\AssetServiceProvider; -use Symfony\Bridge\Twig\Extension\WebLinkExtension; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\WebLink\HttpHeaderSerializer; - -/** - * TwigProvider test cases. - * - * @author Igor Wiedler - */ -class TwigServiceProviderTest extends TestCase -{ - public function testRegisterAndRender() - { - $app = new Application(); - - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => 'Hello {{ name }}!'), - )); - - $app->get('/hello/{name}', function ($name) use ($app) { - return $app['twig']->render('hello', array('name' => $name)); - }); - - $request = Request::create('/hello/john'); - $response = $app->handle($request); - $this->assertEquals('Hello john!', $response->getContent()); - } - - public function testLoaderPriority() - { - $app = new Application(); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('foo' => 'foo'), - )); - $loader = $this->getMockBuilder('\Twig_LoaderInterface')->getMock(); - $loader->expects($this->never())->method('getSourceContext'); - $app['twig.loader.filesystem'] = function ($app) use ($loader) { - return $loader; - }; - $this->assertEquals('foo', $app['twig.loader']->getSourceContext('foo')->getCode()); - } - - public function testHttpFoundationIntegration() - { - $app = new Application(); - $app['request_stack']->push(Request::create('/dir1/dir2/file')); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( - 'absolute' => '{{ absolute_url("foo.css") }}', - 'relative' => '{{ relative_path("/dir1/foo.css") }}', - ), - )); - - $this->assertEquals('http://localhost/dir1/dir2/foo.css', $app['twig']->render('absolute')); - $this->assertEquals('../foo.css', $app['twig']->render('relative')); - } - - public function testAssetIntegration() - { - $app = new Application(); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => '{{ asset("/foo.css") }}'), - )); - $app->register(new AssetServiceProvider(), array( - 'assets.version' => 1, - )); - - $this->assertEquals('/foo.css?1', $app['twig']->render('hello')); - } - - public function testGlobalVariable() - { - $app = new Application(); - $app['request_stack']->push(Request::create('/?name=Fabien')); - - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array('hello' => '{{ global.request.get("name") }}'), - )); - - $this->assertEquals('Fabien', $app['twig']->render('hello')); - } - - public function testFormFactory() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $app->register(new CsrfServiceProvider()); - $app->register(new TwigServiceProvider()); - - $this->assertInstanceOf('Twig_Environment', $app['twig'], 'Service twig is created successful.'); - $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRendererEngine', $app['twig.form.engine'], 'Service twig.form.engine is created successful.'); - $this->assertInstanceOf('Symfony\Bridge\Twig\Form\TwigRenderer', $app['twig.form.renderer'], 'Service twig.form.renderer is created successful.'); - } - - public function testFormWithoutCsrf() - { - $app = new Application(); - $app->register(new FormServiceProvider()); - $app->register(new TwigServiceProvider()); - - $this->assertInstanceOf('Twig_Environment', $app['twig']); - } - - public function testFormatParameters() - { - $app = new Application(); - - $timezone = new \DateTimeZone('Europe/Paris'); - - $app->register(new TwigServiceProvider(), array( - 'twig.date.format' => 'Y-m-d', - 'twig.date.interval_format' => '%h hours', - 'twig.date.timezone' => $timezone, - 'twig.number_format.decimals' => 2, - 'twig.number_format.decimal_point' => ',', - 'twig.number_format.thousands_separator' => ' ', - )); - - $twig = $app['twig']; - - $this->assertSame(array('Y-m-d', '%h hours'), $twig->getExtension('Twig_Extension_Core')->getDateFormat()); - $this->assertSame($timezone, $twig->getExtension('Twig_Extension_Core')->getTimezone()); - $this->assertSame(array(2, ',', ' '), $twig->getExtension('Twig_Extension_Core')->getNumberFormat()); - } - - public function testWebLinkIntegration() - { - if (!class_exists(HttpHeaderSerializer::class) || !class_exists(WebLinkExtension::class)) { - $this->markTestSkipped('Twig WebLink extension not available.'); - } - - $app = new Application(); - $app['request_stack']->push($request = Request::create('/')); - $app->register(new TwigServiceProvider(), array( - 'twig.templates' => array( - 'preload' => '{{ preload("/foo.css") }}', - ), - )); - - $this->assertEquals('/foo.css', $app['twig']->render('preload')); - - $link = new Link('preload', '/foo.css'); - $this->assertEquals(array($link), array_values($request->attributes->get('_links')->getLinks())); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php b/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php deleted file mode 100644 index 6abb264..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest.php +++ /dev/null @@ -1,206 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\TranslationServiceProvider; -use Silex\Provider\ValidatorServiceProvider; -use Silex\Provider\FormServiceProvider; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Validator\Constraints as Assert; -use Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint\Custom; -use Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint\CustomValidator; -use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; -use Symfony\Component\Validator\Validator\ValidatorInterface; - -/** - * ValidatorServiceProvider. - * - * Javier Lopez - */ -class ValidatorServiceProviderTest extends TestCase -{ - public function testRegister() - { - $app = new Application(); - $app->register(new ValidatorServiceProvider()); - $app->register(new FormServiceProvider()); - - return $app; - } - - public function testRegisterWithCustomValidators() - { - $app = new Application(); - - $app['custom.validator'] = function () { - return new CustomValidator(); - }; - - $app->register(new ValidatorServiceProvider(), array( - 'validator.validator_service_ids' => array( - 'test.custom.validator' => 'custom.validator', - ), - )); - - return $app; - } - - /** - * @depends testRegisterWithCustomValidators - */ - public function testConstraintValidatorFactory($app) - { - $this->assertInstanceOf('Silex\Provider\Validator\ConstraintValidatorFactory', $app['validator.validator_factory']); - - $validator = $app['validator.validator_factory']->getInstance(new Custom()); - $this->assertInstanceOf('Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint\CustomValidator', $validator); - } - - /** - * @depends testRegister - */ - public function testConstraintValidatorFactoryWithExpression($app) - { - $constraint = new Assert\Expression('true'); - $validator = $app['validator.validator_factory']->getInstance($constraint); - $this->assertInstanceOf('Symfony\Component\Validator\Constraints\ExpressionValidator', $validator); - } - - /** - * @depends testRegister - */ - public function testValidatorServiceIsAValidator($app) - { - $this->assertTrue($app['validator'] instanceof ValidatorInterface || $app['validator'] instanceof LegacyValidatorInterface); - } - - /** - * @depends testRegister - * @dataProvider getTestValidatorConstraintProvider - */ - public function testValidatorConstraint($email, $isValid, $nbGlobalError, $nbEmailError, $app) - { - $constraints = new Assert\Collection(array( - 'email' => array( - new Assert\NotBlank(), - new Assert\Email(), - ), - )); - - $builder = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array(), array( - 'constraints' => $constraints, - )); - - $form = $builder - ->add('email', 'Symfony\Component\Form\Extension\Core\Type\EmailType', array('label' => 'Email')) - ->getForm() - ; - - $form->submit(array('email' => $email)); - - $this->assertEquals($isValid, $form->isValid()); - $this->assertEquals($nbGlobalError, count($form->getErrors())); - $this->assertEquals($nbEmailError, count($form->offsetGet('email')->getErrors())); - } - - public function testValidatorWillNotAddNonexistentTranslationFiles() - { - $app = new Application(array( - 'locale' => 'nonexistent', - )); - - $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider(), array( - 'locale_fallbacks' => array(), - )); - - $app['validator']; - $translator = $app['translator']; - - try { - $translator->trans('test'); - } catch (NotFoundResourceException $e) { - $this->fail('Validator should not add a translation resource that does not exist'); - } - } - - public function getTestValidatorConstraintProvider() - { - // Email, form is valid, nb global error, nb email error - return array( - array('', false, 0, 1), - array('not an email', false, 0, 1), - array('email@sample.com', true, 0, 0), - ); - } - - /** - * @dataProvider getAddResourceData - */ - public function testAddResource($registerValidatorFirst) - { - $app = new Application(); - $app['locale'] = 'fr'; - - $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider()); - $app['translator'] = $app->extend('translator', function ($translator, $app) { - $translator->addResource('array', array('This value should not be blank.' => 'Pas vide'), 'fr', 'validators'); - - return $translator; - }); - - if ($registerValidatorFirst) { - $app['validator']; - } - - $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr')); - } - - public function getAddResourceData() - { - return array(array(false), array(true)); - } - - public function testAddResourceAlternate() - { - $app = new Application(); - $app['locale'] = 'fr'; - - $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider()); - $app->factory($app->extend('translator.resources', function ($resources, $app) { - $resources = array_merge($resources, array( - array('array', array('This value should not be blank.' => 'Pas vide'), 'fr', 'validators'), - )); - - return $resources; - })); - - $app['validator']; - - $this->assertEquals('Pas vide', $app['translator']->trans('This value should not be blank.', array(), 'validators', 'fr')); - } - - public function testTranslatorResourcesIsArray() - { - $app = new Application(); - $app['locale'] = 'fr'; - - $app->register(new ValidatorServiceProvider()); - $app->register(new TranslationServiceProvider()); - - $this->assertInternalType('array', $app['translator.resources']); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/Custom.php b/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/Custom.php deleted file mode 100644 index bef911a..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/Custom.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint; - -use Symfony\Component\Validator\Constraint; - -/** - * @author Alex Kalyvitis - */ -class Custom extends Constraint -{ - public $message = 'This field must be ...'; - public $table; - public $field; - - public function validatedBy() - { - return 'test.custom.validator'; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/CustomValidator.php b/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/CustomValidator.php deleted file mode 100644 index 856927d..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Provider/ValidatorServiceProviderTest/Constraint/CustomValidator.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Provider\ValidatorServiceProviderTest\Constraint; - -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ConstraintValidator; - -/** - * @author Alex Kalyvitis - */ -class CustomValidator extends ConstraintValidator -{ - public function isValid($value, Constraint $constraint) - { - // Validate... - return true; - } - - public function validate($value, Constraint $constraint) - { - return $this->isValid($value, $constraint); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityRoute.php b/vendor/silex/silex/tests/Silex/Tests/Route/SecurityRoute.php deleted file mode 100644 index 4823719..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityRoute.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Route; - -use Silex\Route; - -class SecurityRoute extends Route -{ - use Route\SecurityTrait; -} diff --git a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php b/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php deleted file mode 100644 index e984fef..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/Route/SecurityTraitTest.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests\Route; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Silex\Provider\SecurityServiceProvider; -use Symfony\Component\HttpFoundation\Request; - -/** - * SecurityTrait test cases. - * - * @author Fabien Potencier - */ -class SecurityTraitTest extends TestCase -{ - public function testSecureWithNoAuthenticatedUser() - { - $app = $this->createApplication(); - - $app->get('/', function () { return 'foo'; }) - ->secure('ROLE_ADMIN') - ; - - $request = Request::create('/'); - $response = $app->handle($request); - $this->assertEquals(401, $response->getStatusCode()); - } - - public function testSecureWithAuthorizedRoles() - { - $app = $this->createApplication(); - - $app->get('/', function () { return 'foo'; }) - ->secure('ROLE_ADMIN') - ; - - $request = Request::create('/'); - $request->headers->set('PHP_AUTH_USER', 'fabien'); - $request->headers->set('PHP_AUTH_PW', 'foo'); - $response = $app->handle($request); - $this->assertEquals(200, $response->getStatusCode()); - } - - public function testSecureWithUnauthorizedRoles() - { - $app = $this->createApplication(); - - $app->get('/', function () { return 'foo'; }) - ->secure('ROLE_SUPER_ADMIN') - ; - - $request = Request::create('/'); - $request->headers->set('PHP_AUTH_USER', 'fabien'); - $request->headers->set('PHP_AUTH_PW', 'foo'); - $response = $app->handle($request); - $this->assertEquals(403, $response->getStatusCode()); - } - - private function createApplication() - { - $app = new Application(); - $app['route_class'] = 'Silex\Tests\Route\SecurityRoute'; - $app->register(new SecurityServiceProvider(), array( - 'security.firewalls' => array( - 'default' => array( - 'http' => true, - 'users' => array( - 'fabien' => array('ROLE_ADMIN', '$2y$15$lzUNsTegNXvZW3qtfucV0erYBcEqWVeyOmjolB7R1uodsAVJ95vvu'), - ), - ), - ), - )); - - return $app; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/RouterTest.php b/vendor/silex/silex/tests/Silex/Tests/RouterTest.php deleted file mode 100644 index 0d0bf51..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/RouterTest.php +++ /dev/null @@ -1,286 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; - -/** - * Router test cases. - * - * @author Igor Wiedler - */ -class RouterTest extends TestCase -{ - public function testMapRouting() - { - $app = new Application(); - - $app->match('/foo', function () { - return 'foo'; - }); - - $app->match('/bar', function () { - return 'bar'; - }); - - $app->match('/', function () { - return 'root'; - }); - - $this->checkRouteResponse($app, '/foo', 'foo'); - $this->checkRouteResponse($app, '/bar', 'bar'); - $this->checkRouteResponse($app, '/', 'root'); - } - - public function testStatusCode() - { - $app = new Application(); - - $app->put('/created', function () { - return new Response('', 201); - }); - - $app->match('/forbidden', function () { - return new Response('', 403); - }); - - $app->match('/not_found', function () { - return new Response('', 404); - }); - - $request = Request::create('/created', 'put'); - $response = $app->handle($request); - $this->assertEquals(201, $response->getStatusCode()); - - $request = Request::create('/forbidden'); - $response = $app->handle($request); - $this->assertEquals(403, $response->getStatusCode()); - - $request = Request::create('/not_found'); - $response = $app->handle($request); - $this->assertEquals(404, $response->getStatusCode()); - } - - public function testRedirect() - { - $app = new Application(); - - $app->match('/redirect', function () { - return new RedirectResponse('/target'); - }); - - $app->match('/redirect2', function () use ($app) { - return $app->redirect('/target2'); - }); - - $request = Request::create('/redirect'); - $response = $app->handle($request); - $this->assertTrue($response->isRedirect('/target')); - - $request = Request::create('/redirect2'); - $response = $app->handle($request); - $this->assertTrue($response->isRedirect('/target2')); - } - - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function testMissingRoute() - { - $app = new Application(); - unset($app['exception_handler']); - - $request = Request::create('/baz'); - $app->handle($request); - } - - public function testMethodRouting() - { - $app = new Application(); - - $app->match('/foo', function () { - return 'foo'; - }); - - $app->match('/bar', function () { - return 'bar'; - })->method('GET|POST'); - - $app->get('/resource', function () { - return 'get resource'; - }); - - $app->post('/resource', function () { - return 'post resource'; - }); - - $app->put('/resource', function () { - return 'put resource'; - }); - - $app->patch('/resource', function () { - return 'patch resource'; - }); - - $app->delete('/resource', function () { - return 'delete resource'; - }); - - $this->checkRouteResponse($app, '/foo', 'foo'); - $this->checkRouteResponse($app, '/bar', 'bar'); - $this->checkRouteResponse($app, '/bar', 'bar', 'post'); - $this->checkRouteResponse($app, '/resource', 'get resource'); - $this->checkRouteResponse($app, '/resource', 'post resource', 'post'); - $this->checkRouteResponse($app, '/resource', 'put resource', 'put'); - $this->checkRouteResponse($app, '/resource', 'patch resource', 'patch'); - $this->checkRouteResponse($app, '/resource', 'delete resource', 'delete'); - } - - public function testRequestShouldBeStoredRegardlessOfRouting() - { - $app = new Application(); - - $app->get('/foo', function (Request $request) use ($app) { - return new Response($request->getRequestUri()); - }); - - $app->error(function ($e, Request $request, $code) use ($app) { - return new Response($request->getRequestUri()); - }); - - foreach (array('/foo', '/bar') as $path) { - $request = Request::create($path); - $response = $app->handle($request); - $this->assertContains($path, $response->getContent()); - } - } - - public function testTrailingSlashBehavior() - { - $app = new Application(); - - $app->get('/foo/', function () use ($app) { - return new Response('ok'); - }); - - $request = Request::create('/foo'); - $response = $app->handle($request); - - $this->assertEquals(301, $response->getStatusCode()); - $this->assertEquals('/foo/', $response->getTargetUrl()); - } - - public function testHostSpecification() - { - $route = new \Silex\Route(); - - $this->assertSame($route, $route->host('{locale}.example.com')); - $this->assertEquals('{locale}.example.com', $route->getHost()); - } - - public function testRequireHttpRedirect() - { - $app = new Application(); - - $app->match('/secured', function () { - return 'secured content'; - }) - ->requireHttp(); - - $request = Request::create('https://example.com/secured'); - $response = $app->handle($request); - $this->assertTrue($response->isRedirect('http://example.com/secured')); - } - - public function testRequireHttpsRedirect() - { - $app = new Application(); - - $app->match('/secured', function () { - return 'secured content'; - }) - ->requireHttps(); - - $request = Request::create('http://example.com/secured'); - $response = $app->handle($request); - $this->assertTrue($response->isRedirect('https://example.com/secured')); - } - - public function testRequireHttpsRedirectIncludesQueryString() - { - $app = new Application(); - - $app->match('/secured', function () { - return 'secured content'; - }) - ->requireHttps(); - - $request = Request::create('http://example.com/secured?query=string'); - $response = $app->handle($request); - $this->assertTrue($response->isRedirect('https://example.com/secured?query=string')); - } - - public function testConditionOnRoute() - { - $app = new Application(); - $app->match('/secured', function () { - return 'secured content'; - }) - ->when('request.isSecure() == true'); - - $request = Request::create('http://example.com/secured'); - $response = $app->handle($request); - $this->assertEquals(404, $response->getStatusCode()); - } - - public function testClassNameControllerSyntax() - { - $app = new Application(); - - $app->get('/foo', 'Silex\Tests\MyController::getFoo'); - - $this->checkRouteResponse($app, '/foo', 'foo'); - } - - public function testClassNameControllerSyntaxWithStaticMethod() - { - $app = new Application(); - - $app->get('/bar', 'Silex\Tests\MyController::getBar'); - - $this->checkRouteResponse($app, '/bar', 'bar'); - } - - protected function checkRouteResponse(Application $app, $path, $expectedContent, $method = 'get', $message = null) - { - $request = Request::create($path, $method); - $response = $app->handle($request); - $this->assertEquals($expectedContent, $response->getContent(), $message); - } -} - -class MyController -{ - public function getFoo() - { - return 'foo'; - } - - public static function getBar() - { - return 'bar'; - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverRouterTest.php b/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverRouterTest.php deleted file mode 100644 index 4bc88a4..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverRouterTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use Silex\Application; -use Silex\Provider\ServiceControllerServiceProvider; -use Symfony\Component\HttpFoundation\Request; - -/** - * Router test cases, using the ServiceControllerResolver. - */ -class ServiceControllerResolverRouterTest extends RouterTest -{ - public function testServiceNameControllerSyntax() - { - $app = new Application(); - $app->register(new ServiceControllerServiceProvider()); - - $app['service_name'] = function () { - return new MyController(); - }; - - $app->get('/bar', 'service_name:getBar'); - - $this->checkRouteResponse($app, '/bar', 'bar'); - } - - protected function checkRouteResponse(Application $app, $path, $expectedContent, $method = 'get', $message = null) - { - $request = Request::create($path, $method); - $response = $app->handle($request); - $this->assertEquals($expectedContent, $response->getContent(), $message); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php b/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php deleted file mode 100644 index 398e2ce..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/ServiceControllerResolverTest.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\ServiceControllerResolver; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; - -/** - * Unit tests for ServiceControllerResolver, see ServiceControllerResolverRouterTest for some - * integration tests. - */ -class ServiceControllerResolverTest extends Testcase -{ - private $app; - private $mockCallbackResolver; - private $mockResolver; - private $resolver; - - public function setup() - { - $this->mockResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface') - ->disableOriginalConstructor() - ->getMock(); - $this->mockCallbackResolver = $this->getMockBuilder('Silex\CallbackResolver') - ->disableOriginalConstructor() - ->getMock(); - - $this->app = new Application(); - $this->resolver = new ServiceControllerResolver($this->mockResolver, $this->mockCallbackResolver); - } - - public function testShouldResolveServiceController() - { - $this->mockCallbackResolver->expects($this->once()) - ->method('isValid') - ->will($this->returnValue(true)); - - $this->mockCallbackResolver->expects($this->once()) - ->method('convertCallback') - ->with('some_service:methodName') - ->will($this->returnValue(array('callback'))); - - $this->app['some_service'] = function () { return new \stdClass(); }; - - $req = Request::create('/'); - $req->attributes->set('_controller', 'some_service:methodName'); - - $this->assertEquals(array('callback'), $this->resolver->getController($req)); - } - - public function testShouldUnresolvedControllerNames() - { - $req = Request::create('/'); - $req->attributes->set('_controller', 'some_class::methodName'); - - $this->mockCallbackResolver->expects($this->once()) - ->method('isValid') - ->with('some_class::methodName') - ->will($this->returnValue(false)); - - $this->mockResolver->expects($this->once()) - ->method('getController') - ->with($req) - ->will($this->returnValue(123)); - - $this->assertEquals(123, $this->resolver->getController($req)); - } - - public function testShouldDelegateGetArguments() - { - $req = Request::create('/'); - $this->mockResolver->expects($this->once()) - ->method('getArguments') - ->with($req) - ->will($this->returnValue(123)); - - $this->assertEquals(123, $this->resolver->getArguments($req, function () {})); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/StreamTest.php b/vendor/silex/silex/tests/Silex/Tests/StreamTest.php deleted file mode 100644 index c494d5b..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/StreamTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use PHPUnit\Framework\TestCase; -use Silex\Application; -use Symfony\Component\HttpFoundation\Request; - -/** - * Stream test cases. - * - * @author Igor Wiedler - */ -class StreamTest extends TestCase -{ - public function testStreamReturnsStreamingResponse() - { - $app = new Application(); - - $response = $app->stream(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); - $this->assertSame(false, $response->getContent()); - } - - public function testStreamActuallyStreams() - { - $i = 0; - - $stream = function () use (&$i) { - ++$i; - }; - - $app = new Application(); - $response = $app->stream($stream); - - $this->assertEquals(0, $i); - - $request = Request::create('/stream'); - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(1, $i); - } -} diff --git a/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php b/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php deleted file mode 100644 index 474ffc3..0000000 --- a/vendor/silex/silex/tests/Silex/Tests/WebTestCaseTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Silex\Tests; - -use Silex\Application; -use Silex\WebTestCase; -use Symfony\Component\HttpFoundation\Request; - -/** - * Functional test cases. - * - * @author Igor Wiedler - */ -class WebTestCaseTest extends WebTestCase -{ - public function createApplication() - { - $app = new Application(); - - $app->match('/hello', function () { - return 'world'; - }); - - $app->match('/html', function () { - return '

    title

    '; - }); - - $app->match('/server', function (Request $request) use ($app) { - $user = $request->server->get('PHP_AUTH_USER'); - $pass = $request->server->get('PHP_AUTH_PW'); - - return "

    $user:$pass

    "; - }); - - return $app; - } - - public function testGetHello() - { - $client = $this->createClient(); - - $client->request('GET', '/hello'); - $response = $client->getResponse(); - $this->assertTrue($response->isSuccessful()); - $this->assertEquals('world', $response->getContent()); - } - - public function testCrawlerFilter() - { - $client = $this->createClient(); - - $crawler = $client->request('GET', '/html'); - $this->assertEquals('title', $crawler->filter('h1')->text()); - } - - public function testServerVariables() - { - $user = 'klaus'; - $pass = '123456'; - - $client = $this->createClient(array( - 'PHP_AUTH_USER' => $user, - 'PHP_AUTH_PW' => $pass, - )); - - $crawler = $client->request('GET', '/server'); - $this->assertEquals("$user:$pass", $crawler->filter('h1')->text()); - } -} diff --git a/vendor/symfony/debug/.gitignore b/vendor/symfony/debug/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/debug/BufferingLogger.php b/vendor/symfony/debug/BufferingLogger.php deleted file mode 100644 index a2ed75b..0000000 --- a/vendor/symfony/debug/BufferingLogger.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Psr\Log\AbstractLogger; - -/** - * A buffering logger that stacks logs for later. - * - * @author Nicolas Grekas - */ -class BufferingLogger extends AbstractLogger -{ - private $logs = array(); - - public function log($level, $message, array $context = array()) - { - $this->logs[] = array($level, $message, $context); - } - - public function cleanLogs() - { - $logs = $this->logs; - $this->logs = array(); - - return $logs; - } -} diff --git a/vendor/symfony/debug/CHANGELOG.md b/vendor/symfony/debug/CHANGELOG.md deleted file mode 100644 index a853b7a..0000000 --- a/vendor/symfony/debug/CHANGELOG.md +++ /dev/null @@ -1,59 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - -* deprecated the `ContextErrorException` class: use \ErrorException directly now - -3.2.0 ------ - -* `FlattenException::getTrace()` now returns additional type descriptions - `integer` and `float`. - - -3.0.0 ------ - -* removed classes, methods and interfaces deprecated in 2.x - -2.8.0 ------ - -* added BufferingLogger for errors that happen before a proper logger is configured -* allow throwing from `__toString()` with `return trigger_error($e, E_USER_ERROR);` -* deprecate ExceptionHandler::createResponse - -2.7.0 ------ - -* added deprecations checking for parent interfaces/classes to DebugClassLoader -* added ZTS support to symfony_debug extension -* added symfony_debug_backtrace() to symfony_debug extension - to track the backtrace of fatal errors - -2.6.0 ------ - -* generalized ErrorHandler and ExceptionHandler, - with some new methods and others deprecated -* enhanced error messages for uncaught exceptions - -2.5.0 ------ - -* added ExceptionHandler::setHandler() -* added UndefinedMethodFatalErrorHandler -* deprecated DummyException - -2.4.0 ------ - - * added a DebugClassLoader able to wrap any autoloader providing a findFile method - * improved error messages for not found classes and functions - -2.3.0 ------ - - * added the component diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php deleted file mode 100644 index e3665ae..0000000 --- a/vendor/symfony/debug/Debug.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -/** - * Registers all the debug tools. - * - * @author Fabien Potencier - */ -class Debug -{ - private static $enabled = false; - - /** - * Enables the debug tools. - * - * This method registers an error handler and an exception handler. - * - * If the Symfony ClassLoader component is available, a special - * class loader is also registered. - * - * @param int $errorReportingLevel The level of error reporting you want - * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) - */ - public static function enable($errorReportingLevel = E_ALL, $displayErrors = true) - { - if (static::$enabled) { - return; - } - - static::$enabled = true; - - if (null !== $errorReportingLevel) { - error_reporting($errorReportingLevel); - } else { - error_reporting(E_ALL); - } - - if ('cli' !== PHP_SAPI) { - ini_set('display_errors', 0); - ExceptionHandler::register(); - } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { - // CLI - display errors only if they're not already logged to STDERR - ini_set('display_errors', 1); - } - if ($displayErrors) { - ErrorHandler::register(new ErrorHandler(new BufferingLogger())); - } else { - ErrorHandler::register()->throwAt(0, true); - } - - DebugClassLoader::enable(); - } -} diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php deleted file mode 100644 index eb48baf..0000000 --- a/vendor/symfony/debug/DebugClassLoader.php +++ /dev/null @@ -1,349 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -/** - * Autoloader checking if the class is really defined in the file found. - * - * The ClassLoader will wrap all registered autoloaders - * and will throw an exception if a file is found but does - * not declare the class. - * - * @author Fabien Potencier - * @author Christophe Coevoet - * @author Nicolas Grekas - */ -class DebugClassLoader -{ - private $classLoader; - private $isFinder; - private $loaded = array(); - private static $caseCheck; - private static $final = array(); - private static $finalMethods = array(); - private static $deprecated = array(); - private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null'); - private static $darwinCache = array('/' => array('/', array())); - - public function __construct(callable $classLoader) - { - $this->classLoader = $classLoader; - $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile'); - - if (!isset(self::$caseCheck)) { - $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR); - $i = strrpos($file, DIRECTORY_SEPARATOR); - $dir = substr($file, 0, 1 + $i); - $file = substr($file, 1 + $i); - $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file); - $test = realpath($dir.$test); - - if (false === $test || false === $i) { - // filesystem is case sensitive - self::$caseCheck = 0; - } elseif (substr($test, -strlen($file)) === $file) { - // filesystem is case insensitive and realpath() normalizes the case of characters - self::$caseCheck = 1; - } elseif (false !== stripos(PHP_OS, 'darwin')) { - // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters - self::$caseCheck = 2; - } else { - // filesystem case checks failed, fallback to disabling them - self::$caseCheck = 0; - } - } - } - - /** - * Gets the wrapped class loader. - * - * @return callable The wrapped class loader - */ - public function getClassLoader() - { - return $this->classLoader; - } - - /** - * Wraps all autoloaders. - */ - public static function enable() - { - // Ensures we don't hit https://bugs.php.net/42098 - class_exists('Symfony\Component\Debug\ErrorHandler'); - class_exists('Psr\Log\LogLevel'); - - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (!is_array($function) || !$function[0] instanceof self) { - $function = array(new static($function), 'loadClass'); - } - - spl_autoload_register($function); - } - } - - /** - * Disables the wrapping. - */ - public static function disable() - { - if (!is_array($functions = spl_autoload_functions())) { - return; - } - - foreach ($functions as $function) { - spl_autoload_unregister($function); - } - - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof self) { - $function = $function[0]->getClassLoader(); - } - - spl_autoload_register($function); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * - * @return bool|null True, if loaded - * - * @throws \RuntimeException - */ - public function loadClass($class) - { - ErrorHandler::stackErrors(); - - try { - if ($this->isFinder && !isset($this->loaded[$class])) { - $this->loaded[$class] = true; - if ($file = $this->classLoader[0]->findFile($class)) { - require $file; - } - } else { - call_user_func($this->classLoader, $class); - $file = false; - } - } finally { - ErrorHandler::unstackErrors(); - } - - $exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); - - if ($class && '\\' === $class[0]) { - $class = substr($class, 1); - } - - if ($exists) { - $refl = new \ReflectionClass($class); - $name = $refl->getName(); - - if ($name !== $class && 0 === strcasecmp($name, $class)) { - throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name)); - } - - $parent = get_parent_class($class); - - // Not an interface nor a trait - if (class_exists($name, false)) { - if (preg_match('#\n \* @final(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { - self::$final[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - } - - if ($parent && isset(self::$final[$parent])) { - @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED); - } - - // Inherit @final annotations - self::$finalMethods[$name] = $parent && isset(self::$finalMethods[$parent]) ? self::$finalMethods[$parent] : array(); - - foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { - if ($method->class !== $name) { - continue; - } - - if ($parent && isset(self::$finalMethods[$parent][$method->name])) { - @trigger_error(sprintf('%s It may change without further notice as of its next major version. You should not extend it from "%s".', self::$finalMethods[$parent][$method->name], $name), E_USER_DEPRECATED); - } - - $doc = $method->getDocComment(); - if (false === $doc || false === strpos($doc, '@final')) { - continue; - } - - if (preg_match('#\n\s+\* @final(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { - $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - self::$finalMethods[$name][$method->name] = sprintf('The "%s::%s()" method is considered final%s.', $name, $method->name, $message); - } - } - } - - if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) { - @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); - } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { - self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]); - } else { - // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) { - $len = 0; - $ns = ''; - } else { - switch ($ns = substr($name, 0, $len)) { - case 'Symfony\Bridge\\': - case 'Symfony\Bundle\\': - case 'Symfony\Component\\': - $ns = 'Symfony\\'; - $len = strlen($ns); - break; - } - } - - if (!$parent || strncmp($ns, $parent, $len)) { - if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) { - @trigger_error(sprintf('The "%s" class extends "%s" that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED); - } - - $parentInterfaces = array(); - $deprecatedInterfaces = array(); - if ($parent) { - foreach (class_implements($parent) as $interface) { - $parentInterfaces[$interface] = 1; - } - } - - foreach ($refl->getInterfaceNames() as $interface) { - if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) { - $deprecatedInterfaces[] = $interface; - } - foreach (class_implements($interface) as $interface) { - $parentInterfaces[$interface] = 1; - } - } - - foreach ($deprecatedInterfaces as $interface) { - if (!isset($parentInterfaces[$interface])) { - @trigger_error(sprintf('The "%s" %s "%s" that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED); - } - } - } - } - } - - if ($file) { - if (!$exists) { - if (false !== strpos($class, '/')) { - throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); - } - - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); - } - if (self::$caseCheck) { - $real = explode('\\', $class.strrchr($file, '.')); - $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file)); - - $i = count($tail) - 1; - $j = count($real) - 1; - - while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { - --$i; - --$j; - } - - array_splice($tail, 0, $i + 1); - } - if (self::$caseCheck && $tail) { - $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail); - $tailLen = strlen($tail); - $real = $refl->getFileName(); - - if (2 === self::$caseCheck) { - // realpath() on MacOSX doesn't normalize the case of characters - - $i = 1 + strrpos($real, '/'); - $file = substr($real, $i); - $real = substr($real, 0, $i); - - if (isset(self::$darwinCache[$real])) { - $kDir = $real; - } else { - $kDir = strtolower($real); - - if (isset(self::$darwinCache[$kDir])) { - $real = self::$darwinCache[$kDir][0]; - } else { - $dir = getcwd(); - chdir($real); - $real = getcwd().'/'; - chdir($dir); - - $dir = $real; - $k = $kDir; - $i = strlen($dir) - 1; - while (!isset(self::$darwinCache[$k])) { - self::$darwinCache[$k] = array($dir, array()); - self::$darwinCache[$dir] = &self::$darwinCache[$k]; - - while ('/' !== $dir[--$i]) { - } - $k = substr($k, 0, ++$i); - $dir = substr($dir, 0, $i--); - } - } - } - - $dirFiles = self::$darwinCache[$kDir][1]; - - if (isset($dirFiles[$file])) { - $kFile = $file; - } else { - $kFile = strtolower($file); - - if (!isset($dirFiles[$kFile])) { - foreach (scandir($real, 2) as $f) { - if ('.' !== $f[0]) { - $dirFiles[$f] = $f; - if ($f === $file) { - $kFile = $k = $file; - } elseif ($f !== $k = strtolower($f)) { - $dirFiles[$k] = $f; - } - } - } - self::$darwinCache[$kDir][1] = $dirFiles; - } - } - - $real .= $dirFiles[$kFile]; - } - - if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) - && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) - ) { - throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1))); - } - } - - return true; - } - } -} diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php deleted file mode 100644 index 369ed26..0000000 --- a/vendor/symfony/debug/ErrorHandler.php +++ /dev/null @@ -1,716 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Psr\Log\LogLevel; -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\Exception\ContextErrorException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\Exception\FatalThrowableError; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\Debug\Exception\SilencedErrorContext; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; - -/** - * A generic ErrorHandler for the PHP engine. - * - * Provides five bit fields that control how errors are handled: - * - thrownErrors: errors thrown as \ErrorException - * - loggedErrors: logged errors, when not @-silenced - * - scopedErrors: errors thrown or logged with their local context - * - tracedErrors: errors logged with their stack trace - * - screamedErrors: never @-silenced errors - * - * Each error level can be logged by a dedicated PSR-3 logger object. - * Screaming only applies to logging. - * Throwing takes precedence over logging. - * Uncaught exceptions are logged as E_ERROR. - * E_DEPRECATED and E_USER_DEPRECATED levels never throw. - * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw. - * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so. - * As errors have a performance cost, repeated errors are all logged, so that the developer - * can see them and weight them as more important to fix than others of the same level. - * - * @author Nicolas Grekas - * @author Grégoire Pineau - */ -class ErrorHandler -{ - private $levels = array( - E_DEPRECATED => 'Deprecated', - E_USER_DEPRECATED => 'User Deprecated', - E_NOTICE => 'Notice', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_WARNING => 'Warning', - E_USER_WARNING => 'User Warning', - E_COMPILE_WARNING => 'Compile Warning', - E_CORE_WARNING => 'Core Warning', - E_USER_ERROR => 'User Error', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - E_COMPILE_ERROR => 'Compile Error', - E_PARSE => 'Parse Error', - E_ERROR => 'Error', - E_CORE_ERROR => 'Core Error', - ); - - private $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array(null, LogLevel::WARNING), - E_USER_NOTICE => array(null, LogLevel::WARNING), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); - - private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED - private $tracedErrors = 0x77FB; // E_ALL - E_STRICT - E_PARSE - private $screamedErrors = 0x55; // E_ERROR + E_CORE_ERROR + E_COMPILE_ERROR + E_PARSE - private $loggedErrors = 0; - private $traceReflector; - - private $isRecursive = 0; - private $isRoot = false; - private $exceptionHandler; - private $bootstrappingLogger; - - private static $reservedMemory; - private static $stackedErrors = array(); - private static $stackedErrorLevels = array(); - private static $toStringException = null; - private static $silencedErrorCache = array(); - private static $silencedErrorCount = 0; - private static $exitCode = 0; - - /** - * Registers the error handler. - * - * @param self|null $handler The handler to register - * @param bool $replace Whether to replace or not any existing handler - * - * @return self The registered error handler - */ - public static function register(self $handler = null, $replace = true) - { - if (null === self::$reservedMemory) { - self::$reservedMemory = str_repeat('x', 10240); - register_shutdown_function(__CLASS__.'::handleFatalError'); - } - - if ($handlerIsNew = null === $handler) { - $handler = new static(); - } - - if (null === $prev = set_error_handler(array($handler, 'handleError'))) { - restore_error_handler(); - // Specifying the error types earlier would expose us to https://bugs.php.net/63206 - set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); - $handler->isRoot = true; - } - - if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) { - $handler = $prev[0]; - $replace = false; - } - if ($replace || !$prev) { - $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException'))); - } else { - restore_error_handler(); - } - - $handler->throwAt(E_ALL & $handler->thrownErrors, true); - - return $handler; - } - - public function __construct(BufferingLogger $bootstrappingLogger = null) - { - if ($bootstrappingLogger) { - $this->bootstrappingLogger = $bootstrappingLogger; - $this->setDefaultLogger($bootstrappingLogger); - } - $this->traceReflector = new \ReflectionProperty('Exception', 'trace'); - $this->traceReflector->setAccessible(true); - } - - /** - * Sets a logger to non assigned errors levels. - * - * @param LoggerInterface $logger A PSR-3 logger to put as default for the given levels - * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants - * @param bool $replace Whether to replace or not any existing logger - */ - public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) - { - $loggers = array(); - - if (is_array($levels)) { - foreach ($levels as $type => $logLevel) { - if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) { - $loggers[$type] = array($logger, $logLevel); - } - } - } else { - if (null === $levels) { - $levels = E_ALL; - } - foreach ($this->loggers as $type => $log) { - if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) { - $log[0] = $logger; - $loggers[$type] = $log; - } - } - } - - $this->setLoggers($loggers); - } - - /** - * Sets a logger for each error level. - * - * @param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map - * - * @return array The previous map - * - * @throws \InvalidArgumentException - */ - public function setLoggers(array $loggers) - { - $prevLogged = $this->loggedErrors; - $prev = $this->loggers; - $flush = array(); - - foreach ($loggers as $type => $log) { - if (!isset($prev[$type])) { - throw new \InvalidArgumentException('Unknown error type: '.$type); - } - if (!is_array($log)) { - $log = array($log); - } elseif (!array_key_exists(0, $log)) { - throw new \InvalidArgumentException('No logger provided'); - } - if (null === $log[0]) { - $this->loggedErrors &= ~$type; - } elseif ($log[0] instanceof LoggerInterface) { - $this->loggedErrors |= $type; - } else { - throw new \InvalidArgumentException('Invalid logger provided'); - } - $this->loggers[$type] = $log + $prev[$type]; - - if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) { - $flush[$type] = $type; - } - } - $this->reRegister($prevLogged | $this->thrownErrors); - - if ($flush) { - foreach ($this->bootstrappingLogger->cleanLogs() as $log) { - $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : E_ERROR; - if (!isset($flush[$type])) { - $this->bootstrappingLogger->log($log[0], $log[1], $log[2]); - } elseif ($this->loggers[$type][0]) { - $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]); - } - } - } - - return $prev; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler A handler that will be called on Exception - * - * @return callable|null The previous exception handler - */ - public function setExceptionHandler(callable $handler = null) - { - $prev = $this->exceptionHandler; - $this->exceptionHandler = $handler; - - return $prev; - } - - /** - * Sets the PHP error levels that throw an exception when a PHP error occurs. - * - * @param int $levels A bit field of E_* constants for thrown errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function throwAt($levels, $replace = false) - { - $prev = $this->thrownErrors; - $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; - if (!$replace) { - $this->thrownErrors |= $prev; - } - $this->reRegister($prev | $this->loggedErrors); - - return $prev; - } - - /** - * Sets the PHP error levels for which local variables are preserved. - * - * @param int $levels A bit field of E_* constants for scoped errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function scopeAt($levels, $replace = false) - { - $prev = $this->scopedErrors; - $this->scopedErrors = (int) $levels; - if (!$replace) { - $this->scopedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the PHP error levels for which the stack trace is preserved. - * - * @param int $levels A bit field of E_* constants for traced errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function traceAt($levels, $replace = false) - { - $prev = $this->tracedErrors; - $this->tracedErrors = (int) $levels; - if (!$replace) { - $this->tracedErrors |= $prev; - } - - return $prev; - } - - /** - * Sets the error levels where the @-operator is ignored. - * - * @param int $levels A bit field of E_* constants for screamed errors - * @param bool $replace Replace or amend the previous value - * - * @return int The previous value - */ - public function screamAt($levels, $replace = false) - { - $prev = $this->screamedErrors; - $this->screamedErrors = (int) $levels; - if (!$replace) { - $this->screamedErrors |= $prev; - } - - return $prev; - } - - /** - * Re-registers as a PHP error handler if levels changed. - */ - private function reRegister($prev) - { - if ($prev !== $this->thrownErrors | $this->loggedErrors) { - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if ($handler === $this) { - restore_error_handler(); - if ($this->isRoot) { - set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); - } else { - set_error_handler(array($this, 'handleError')); - } - } - } - } - - /** - * Handles errors by filtering then logging them according to the configured bit fields. - * - * @param int $type One of the E_* constants - * @param string $message - * @param string $file - * @param int $line - * - * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself - * - * @throws \ErrorException When $this->thrownErrors requests so - * - * @internal - */ - public function handleError($type, $message, $file, $line) - { - // Level is the current error reporting level to manage silent error. - // Strong errors are not authorized to be silenced. - $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; - $log = $this->loggedErrors & $type; - $throw = $this->thrownErrors & $type & $level; - $type &= $level | $this->screamedErrors; - - if (!$type || (!$log && !$throw)) { - return $type && $log; - } - $scope = $this->scopedErrors & $type; - - if (4 < $numArgs = func_num_args()) { - $context = $scope ? (func_get_arg(4) ?: array()) : array(); - $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM - } else { - $context = array(); - $backtrace = null; - } - - if (isset($context['GLOBALS']) && $scope) { - $e = $context; // Whatever the signature of the method, - unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 - $context = $e; - } - - if (null !== $backtrace && $type & E_ERROR) { - // E_ERROR fatal errors are triggered on HHVM when - // hhvm.error_handling.call_user_handler_on_fatals=1 - // which is the way to get their backtrace. - $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace')); - - return true; - } - - $logMessage = $this->levels[$type].': '.$message; - - if (null !== self::$toStringException) { - $errorAsException = self::$toStringException; - self::$toStringException = null; - } elseif (!$throw && !($type & $level)) { - if (isset(self::$silencedErrorCache[$message])) { - $lightTrace = null; - $errorAsException = self::$silencedErrorCache[$message]; - ++$errorAsException->count; - } else { - $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : array(); - $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace); - } - - if (100 < ++self::$silencedErrorCount) { - self::$silencedErrorCache = $lightTrace = array(); - self::$silencedErrorCount = 1; - } - self::$silencedErrorCache[$message] = $errorAsException; - - if (null === $lightTrace) { - return; - } - } else { - if ($scope) { - $errorAsException = new ContextErrorException($logMessage, 0, $type, $file, $line, $context); - } else { - $errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line); - } - - // Clean the trace by removing function arguments and the first frames added by the error handler itself. - if ($throw || $this->tracedErrors & $type) { - $backtrace = $backtrace ?: $errorAsException->getTrace(); - $lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw); - $this->traceReflector->setValue($errorAsException, $lightTrace); - } else { - $this->traceReflector->setValue($errorAsException, array()); - } - } - - if ($throw) { - if (E_USER_ERROR & $type) { - for ($i = 1; isset($backtrace[$i]); ++$i) { - if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function']) - && '__toString' === $backtrace[$i]['function'] - && '->' === $backtrace[$i]['type'] - && !isset($backtrace[$i - 1]['class']) - && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function']) - ) { - // Here, we know trigger_error() has been called from __toString(). - // HHVM is fine with throwing from __toString() but PHP triggers a fatal error instead. - // A small convention allows working around the limitation: - // given a caught $e exception in __toString(), quitting the method with - // `return trigger_error($e, E_USER_ERROR);` allows this error handler - // to make $e get through the __toString() barrier. - - foreach ($context as $e) { - if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) { - if (1 === $i) { - // On HHVM - $errorAsException = $e; - break; - } - self::$toStringException = $e; - - return true; - } - } - - if (1 < $i) { - // On PHP (not on HHVM), display the original error message instead of the default one. - $this->handleException($errorAsException); - - // Stop the process by giving back the error to the native handler. - return false; - } - } - } - } - - throw $errorAsException; - } - - if ($this->isRecursive) { - $log = 0; - } elseif (self::$stackedErrorLevels) { - self::$stackedErrors[] = array( - $this->loggers[$type][0], - ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, - $logMessage, - array('exception' => $errorAsException), - ); - } else { - try { - $this->isRecursive = true; - $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG; - $this->loggers[$type][0]->log($level, $logMessage, array('exception' => $errorAsException)); - } finally { - $this->isRecursive = false; - } - } - - return $type && $log; - } - - /** - * Handles an exception by logging then forwarding it to another handler. - * - * @param \Exception|\Throwable $exception An exception to handle - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public function handleException($exception, array $error = null) - { - if (null === $error) { - self::$exitCode = 255; - } - if (!$exception instanceof \Exception) { - $exception = new FatalThrowableError($exception); - } - $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR; - - if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) { - if ($exception instanceof FatalErrorException) { - if ($exception instanceof FatalThrowableError) { - $error = array( - 'type' => $type, - 'message' => $message = $exception->getMessage(), - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - ); - } else { - $message = 'Fatal '.$exception->getMessage(); - } - } elseif ($exception instanceof \ErrorException) { - $message = 'Uncaught '.$exception->getMessage(); - } else { - $message = 'Uncaught Exception: '.$exception->getMessage(); - } - } - if ($this->loggedErrors & $type) { - try { - $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception)); - } catch (\Exception $handlerException) { - } catch (\Throwable $handlerException) { - } - } - if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) { - foreach ($this->getFatalErrorHandlers() as $handler) { - if ($e = $handler->handleError($error, $exception)) { - $exception = $e; - break; - } - } - } - if (empty($this->exceptionHandler)) { - throw $exception; // Give back $exception to the native handler - } - try { - call_user_func($this->exceptionHandler, $exception); - } catch (\Exception $handlerException) { - } catch (\Throwable $handlerException) { - } - if (isset($handlerException)) { - $this->exceptionHandler = null; - $this->handleException($handlerException); - } - } - - /** - * Shutdown registered function for handling PHP fatal errors. - * - * @param array $error An array as returned by error_get_last() - * - * @internal - */ - public static function handleFatalError(array $error = null) - { - if (null === self::$reservedMemory) { - return; - } - - self::$reservedMemory = null; - - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - - if (!$handler instanceof self) { - return; - } - - if ($exit = null === $error) { - $error = error_get_last(); - } - - try { - while (self::$stackedErrorLevels) { - static::unstackErrors(); - } - } catch (\Exception $exception) { - // Handled below - } catch (\Throwable $exception) { - // Handled below - } - - if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) { - // Let's not throw anymore but keep logging - $handler->throwAt(0, true); - $trace = isset($error['backtrace']) ? $error['backtrace'] : null; - - if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) { - $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace); - } else { - $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace); - } - } - - try { - if (isset($exception)) { - self::$exitCode = 255; - $handler->handleException($exception, $error); - } - } catch (FatalErrorException $e) { - // Ignore this re-throw - } - - if ($exit && self::$exitCode) { - $exitCode = self::$exitCode; - register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); }); - } - } - - /** - * Configures the error handler for delayed handling. - * Ensures also that non-catchable fatal errors are never silenced. - * - * As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724 - * PHP has a compile stage where it behaves unusually. To workaround it, - * we plug an error handler that only stacks errors for later. - * - * The most important feature of this is to prevent - * autoloading until unstackErrors() is called. - */ - public static function stackErrors() - { - self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); - } - - /** - * Unstacks stacked errors and forwards to the logger. - */ - public static function unstackErrors() - { - $level = array_pop(self::$stackedErrorLevels); - - if (null !== $level) { - $errorReportingLevel = error_reporting($level); - if ($errorReportingLevel !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) { - // If the user changed the error level, do not overwrite it - error_reporting($errorReportingLevel); - } - } - - if (empty(self::$stackedErrorLevels)) { - $errors = self::$stackedErrors; - self::$stackedErrors = array(); - - foreach ($errors as $error) { - $error[0]->log($error[1], $error[2], $error[3]); - } - } - } - - /** - * Gets the fatal error handlers. - * - * Override this method if you want to define more fatal error handlers. - * - * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface - */ - protected function getFatalErrorHandlers() - { - return array( - new UndefinedFunctionFatalErrorHandler(), - new UndefinedMethodFatalErrorHandler(), - new ClassNotFoundFatalErrorHandler(), - ); - } - - private function cleanTrace($backtrace, $type, $file, $line, $throw) - { - $lightTrace = $backtrace; - - for ($i = 0; isset($backtrace[$i]); ++$i) { - if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $lightTrace = array_slice($lightTrace, 1 + $i); - break; - } - } - if (!($throw || $this->scopedErrors & $type)) { - for ($i = 0; isset($lightTrace[$i]); ++$i) { - unset($lightTrace[$i]['args']); - } - } - - return $lightTrace; - } -} diff --git a/vendor/symfony/debug/Exception/ClassNotFoundException.php b/vendor/symfony/debug/Exception/ClassNotFoundException.php deleted file mode 100644 index b91bf46..0000000 --- a/vendor/symfony/debug/Exception/ClassNotFoundException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Class (or Trait or Interface) Not Found Exception. - * - * @author Konstanton Myakshin - */ -class ClassNotFoundException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/vendor/symfony/debug/Exception/ContextErrorException.php b/vendor/symfony/debug/Exception/ContextErrorException.php deleted file mode 100644 index 6561d4d..0000000 --- a/vendor/symfony/debug/Exception/ContextErrorException.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Error Exception with Variable Context. - * - * @author Christian Sciberras - * - * @deprecated since version 3.3. Instead, \ErrorException will be used directly in 4.0. - */ -class ContextErrorException extends \ErrorException -{ - private $context = array(); - - public function __construct($message, $code, $severity, $filename, $lineno, $context = array()) - { - parent::__construct($message, $code, $severity, $filename, $lineno); - $this->context = $context; - } - - /** - * @return array Array of variables that existed when the exception occurred - */ - public function getContext() - { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); - - return $this->context; - } -} diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php deleted file mode 100644 index f24a54e..0000000 --- a/vendor/symfony/debug/Exception/FatalErrorException.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Fatal Error Exception. - * - * @author Konstanton Myakshin - */ -class FatalErrorException extends \ErrorException -{ - public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null) - { - parent::__construct($message, $code, $severity, $filename, $lineno); - - if (null !== $trace) { - if (!$traceArgs) { - foreach ($trace as &$frame) { - unset($frame['args'], $frame['this'], $frame); - } - } - - $this->setTrace($trace); - } elseif (null !== $traceOffset) { - if (function_exists('xdebug_get_function_stack')) { - $trace = xdebug_get_function_stack(); - if (0 < $traceOffset) { - array_splice($trace, -$traceOffset); - } - - foreach ($trace as &$frame) { - if (!isset($frame['type'])) { - // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695 - if (isset($frame['class'])) { - $frame['type'] = '::'; - } - } elseif ('dynamic' === $frame['type']) { - $frame['type'] = '->'; - } elseif ('static' === $frame['type']) { - $frame['type'] = '::'; - } - - // XDebug also has a different name for the parameters array - if (!$traceArgs) { - unset($frame['params'], $frame['args']); - } elseif (isset($frame['params']) && !isset($frame['args'])) { - $frame['args'] = $frame['params']; - unset($frame['params']); - } - } - - unset($frame); - $trace = array_reverse($trace); - } elseif (function_exists('symfony_debug_backtrace')) { - $trace = symfony_debug_backtrace(); - if (0 < $traceOffset) { - array_splice($trace, 0, $traceOffset); - } - } else { - $trace = array(); - } - - $this->setTrace($trace); - } - } - - protected function setTrace($trace) - { - $traceReflector = new \ReflectionProperty('Exception', 'trace'); - $traceReflector->setAccessible(true); - $traceReflector->setValue($this, $trace); - } -} diff --git a/vendor/symfony/debug/Exception/FatalThrowableError.php b/vendor/symfony/debug/Exception/FatalThrowableError.php deleted file mode 100644 index 34f43b1..0000000 --- a/vendor/symfony/debug/Exception/FatalThrowableError.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Fatal Throwable Error. - * - * @author Nicolas Grekas - */ -class FatalThrowableError extends FatalErrorException -{ - public function __construct(\Throwable $e) - { - if ($e instanceof \ParseError) { - $message = 'Parse error: '.$e->getMessage(); - $severity = E_PARSE; - } elseif ($e instanceof \TypeError) { - $message = 'Type error: '.$e->getMessage(); - $severity = E_RECOVERABLE_ERROR; - } else { - $message = $e->getMessage(); - $severity = E_ERROR; - } - - \ErrorException::__construct( - $message, - $e->getCode(), - $severity, - $e->getFile(), - $e->getLine() - ); - - $this->setTrace($e->getTrace()); - } -} diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php deleted file mode 100644 index 24679dc..0000000 --- a/vendor/symfony/debug/Exception/FlattenException.php +++ /dev/null @@ -1,263 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; - -/** - * FlattenException wraps a PHP Exception to be able to serialize it. - * - * Basically, this class removes all objects from the trace. - * - * @author Fabien Potencier - */ -class FlattenException -{ - private $message; - private $code; - private $previous; - private $trace; - private $class; - private $statusCode; - private $headers; - private $file; - private $line; - - public static function create(\Exception $exception, $statusCode = null, array $headers = array()) - { - $e = new static(); - $e->setMessage($exception->getMessage()); - $e->setCode($exception->getCode()); - - if ($exception instanceof HttpExceptionInterface) { - $statusCode = $exception->getStatusCode(); - $headers = array_merge($headers, $exception->getHeaders()); - } elseif ($exception instanceof RequestExceptionInterface) { - $statusCode = 400; - } - - if (null === $statusCode) { - $statusCode = 500; - } - - $e->setStatusCode($statusCode); - $e->setHeaders($headers); - $e->setTraceFromException($exception); - $e->setClass(get_class($exception)); - $e->setFile($exception->getFile()); - $e->setLine($exception->getLine()); - - $previous = $exception->getPrevious(); - - if ($previous instanceof \Exception) { - $e->setPrevious(static::create($previous)); - } elseif ($previous instanceof \Throwable) { - $e->setPrevious(static::create(new FatalThrowableError($previous))); - } - - return $e; - } - - public function toArray() - { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( - 'message' => $exception->getMessage(), - 'class' => $exception->getClass(), - 'trace' => $exception->getTrace(), - ); - } - - return $exceptions; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function setStatusCode($code) - { - $this->statusCode = $code; - } - - public function getHeaders() - { - return $this->headers; - } - - public function setHeaders(array $headers) - { - $this->headers = $headers; - } - - public function getClass() - { - return $this->class; - } - - public function setClass($class) - { - $this->class = $class; - } - - public function getFile() - { - return $this->file; - } - - public function setFile($file) - { - $this->file = $file; - } - - public function getLine() - { - return $this->line; - } - - public function setLine($line) - { - $this->line = $line; - } - - public function getMessage() - { - return $this->message; - } - - public function setMessage($message) - { - $this->message = $message; - } - - public function getCode() - { - return $this->code; - } - - public function setCode($code) - { - $this->code = $code; - } - - public function getPrevious() - { - return $this->previous; - } - - public function setPrevious(FlattenException $previous) - { - $this->previous = $previous; - } - - public function getAllPrevious() - { - $exceptions = array(); - $e = $this; - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - return $exceptions; - } - - public function getTrace() - { - return $this->trace; - } - - public function setTraceFromException(\Exception $exception) - { - $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine()); - } - - public function setTrace($trace, $file, $line) - { - $this->trace = array(); - $this->trace[] = array( - 'namespace' => '', - 'short_class' => '', - 'class' => '', - 'type' => '', - 'function' => '', - 'file' => $file, - 'line' => $line, - 'args' => array(), - ); - foreach ($trace as $entry) { - $class = ''; - $namespace = ''; - if (isset($entry['class'])) { - $parts = explode('\\', $entry['class']); - $class = array_pop($parts); - $namespace = implode('\\', $parts); - } - - $this->trace[] = array( - 'namespace' => $namespace, - 'short_class' => $class, - 'class' => isset($entry['class']) ? $entry['class'] : '', - 'type' => isset($entry['type']) ? $entry['type'] : '', - 'function' => isset($entry['function']) ? $entry['function'] : null, - 'file' => isset($entry['file']) ? $entry['file'] : null, - 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); - } - } - - private function flattenArgs($args, $level = 0, &$count = 0) - { - $result = array(); - foreach ($args as $key => $value) { - if (++$count > 1e4) { - return array('array', '*SKIPPED over 10000 entries*'); - } - if ($value instanceof \__PHP_Incomplete_Class) { - // is_object() returns false on PHP<=7.1 - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); - } elseif (is_object($value)) { - $result[$key] = array('object', get_class($value)); - } elseif (is_array($value)) { - if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); - } else { - $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); - } - } elseif (null === $value) { - $result[$key] = array('null', null); - } elseif (is_bool($value)) { - $result[$key] = array('boolean', $value); - } elseif (is_int($value)) { - $result[$key] = array('integer', $value); - } elseif (is_float($value)) { - $result[$key] = array('float', $value); - } elseif (is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); - } else { - $result[$key] = array('string', (string) $value); - } - } - - return $result; - } - - private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value) - { - $array = new \ArrayObject($value); - - return $array['__PHP_Incomplete_Class_Name']; - } -} diff --git a/vendor/symfony/debug/Exception/OutOfMemoryException.php b/vendor/symfony/debug/Exception/OutOfMemoryException.php deleted file mode 100644 index fec1979..0000000 --- a/vendor/symfony/debug/Exception/OutOfMemoryException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Out of memory exception. - * - * @author Nicolas Grekas - */ -class OutOfMemoryException extends FatalErrorException -{ -} diff --git a/vendor/symfony/debug/Exception/SilencedErrorContext.php b/vendor/symfony/debug/Exception/SilencedErrorContext.php deleted file mode 100644 index 4be8349..0000000 --- a/vendor/symfony/debug/Exception/SilencedErrorContext.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Data Object that represents a Silenced Error. - * - * @author Grégoire Pineau - */ -class SilencedErrorContext implements \JsonSerializable -{ - public $count = 1; - - private $severity; - private $file; - private $line; - private $trace; - - public function __construct($severity, $file, $line, array $trace = array(), $count = 1) - { - $this->severity = $severity; - $this->file = $file; - $this->line = $line; - $this->trace = $trace; - $this->count = $count; - } - - public function getSeverity() - { - return $this->severity; - } - - public function getFile() - { - return $this->file; - } - - public function getLine() - { - return $this->line; - } - - public function getTrace() - { - return $this->trace; - } - - public function JsonSerialize() - { - return array( - 'severity' => $this->severity, - 'file' => $this->file, - 'line' => $this->line, - 'trace' => $this->trace, - 'count' => $this->count, - ); - } -} diff --git a/vendor/symfony/debug/Exception/UndefinedFunctionException.php b/vendor/symfony/debug/Exception/UndefinedFunctionException.php deleted file mode 100644 index a66ae2a..0000000 --- a/vendor/symfony/debug/Exception/UndefinedFunctionException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Undefined Function Exception. - * - * @author Konstanton Myakshin - */ -class UndefinedFunctionException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/vendor/symfony/debug/Exception/UndefinedMethodException.php b/vendor/symfony/debug/Exception/UndefinedMethodException.php deleted file mode 100644 index 350dc31..0000000 --- a/vendor/symfony/debug/Exception/UndefinedMethodException.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Exception; - -/** - * Undefined Method Exception. - * - * @author Grégoire Pineau - */ -class UndefinedMethodException extends FatalErrorException -{ - public function __construct($message, \ErrorException $previous) - { - parent::__construct( - $message, - $previous->getCode(), - $previous->getSeverity(), - $previous->getFile(), - $previous->getLine(), - $previous->getPrevious() - ); - $this->setTrace($previous->getTrace()); - } -} diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php deleted file mode 100644 index a82a324..0000000 --- a/vendor/symfony/debug/ExceptionHandler.php +++ /dev/null @@ -1,414 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; - -/** - * ExceptionHandler converts an exception to a Response object. - * - * It is mostly useful in debug mode to replace the default PHP/XDebug - * output with something prettier and more useful. - * - * As this class is mainly used during Kernel boot, where nothing is yet - * available, the Response content is always HTML. - * - * @author Fabien Potencier - * @author Nicolas Grekas - */ -class ExceptionHandler -{ - private $debug; - private $charset; - private $handler; - private $caughtBuffer; - private $caughtLength; - private $fileLinkFormat; - - public function __construct($debug = true, $charset = null, $fileLinkFormat = null) - { - $this->debug = $debug; - $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8'; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - } - - /** - * Registers the exception handler. - * - * @param bool $debug Enable/disable debug mode, where the stack trace is displayed - * @param string|null $charset The charset used by exception messages - * @param string|null $fileLinkFormat The IDE link template - * - * @return static - */ - public static function register($debug = true, $charset = null, $fileLinkFormat = null) - { - $handler = new static($debug, $charset, $fileLinkFormat); - - $prev = set_exception_handler(array($handler, 'handle')); - if (is_array($prev) && $prev[0] instanceof ErrorHandler) { - restore_exception_handler(); - $prev[0]->setExceptionHandler(array($handler, 'handle')); - } - - return $handler; - } - - /** - * Sets a user exception handler. - * - * @param callable $handler An handler that will be called on Exception - * - * @return callable|null The previous exception handler if any - */ - public function setHandler(callable $handler = null) - { - $old = $this->handler; - $this->handler = $handler; - - return $old; - } - - /** - * Sets the format for links to source files. - * - * @param string|FileLinkFormatter $fileLinkFormat The format for links to source files - * - * @return string The previous file link format - */ - public function setFileLinkFormat($fileLinkFormat) - { - $old = $this->fileLinkFormat; - $this->fileLinkFormat = $fileLinkFormat; - - return $old; - } - - /** - * Sends a response for the given Exception. - * - * To be as fail-safe as possible, the exception is first handled - * by our simple exception handler, then by the user exception handler. - * The latter takes precedence and any output from the former is cancelled, - * if and only if nothing bad happens in this handling path. - */ - public function handle(\Exception $exception) - { - if (null === $this->handler || $exception instanceof OutOfMemoryException) { - $this->sendPhpResponse($exception); - - return; - } - - $caughtLength = $this->caughtLength = 0; - - ob_start(function ($buffer) { - $this->caughtBuffer = $buffer; - - return ''; - }); - - $this->sendPhpResponse($exception); - while (null === $this->caughtBuffer && ob_end_flush()) { - // Empty loop, everything is in the condition - } - if (isset($this->caughtBuffer[0])) { - ob_start(function ($buffer) { - if ($this->caughtLength) { - // use substr_replace() instead of substr() for mbstring overloading resistance - $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength); - if (isset($cleanBuffer[0])) { - $buffer = $cleanBuffer; - } - } - - return $buffer; - }); - - echo $this->caughtBuffer; - $caughtLength = ob_get_length(); - } - $this->caughtBuffer = null; - - try { - call_user_func($this->handler, $exception); - $this->caughtLength = $caughtLength; - } catch (\Exception $e) { - if (!$caughtLength) { - // All handlers failed. Let PHP handle that now. - throw $exception; - } - } - } - - /** - * Sends the error associated with the given Exception as a plain PHP response. - * - * This method uses plain PHP functions like header() and echo to output - * the response. - * - * @param \Exception|FlattenException $exception An \Exception or FlattenException instance - */ - public function sendPhpResponse($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - if (!headers_sent()) { - header(sprintf('HTTP/1.0 %s', $exception->getStatusCode())); - foreach ($exception->getHeaders() as $name => $value) { - header($name.': '.$value, false); - } - header('Content-Type: text/html; charset='.$this->charset); - } - - echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); - } - - /** - * Gets the full HTML content associated with the given exception. - * - * @param \Exception|FlattenException $exception An \Exception or FlattenException instance - * - * @return string The HTML content as a string - */ - public function getHtml($exception) - { - if (!$exception instanceof FlattenException) { - $exception = FlattenException::create($exception); - } - - return $this->decorate($this->getContent($exception), $this->getStylesheet($exception)); - } - - /** - * Gets the HTML content associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The content as a string - */ - public function getContent(FlattenException $exception) - { - switch ($exception->getStatusCode()) { - case 404: - $title = 'Sorry, the page you are looking for could not be found.'; - break; - default: - $title = 'Whoops, looks like something went wrong.'; - } - - $content = ''; - if ($this->debug) { - try { - $count = count($exception->getAllPrevious()); - $total = $count + 1; - foreach ($exception->toArray() as $position => $e) { - $ind = $count - $position + 1; - $class = $this->formatClass($e['class']); - $message = nl2br($this->escapeHtml($e['message'])); - $content .= sprintf(<<<'EOF' -
    - - - -EOF - , $ind, $total, $class, $message); - foreach ($e['trace'] as $trace) { - $content .= '\n"; - } - - $content .= "\n
    -

    - (%d/%d) - %s -

    -

    %s

    -
    '; - if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); - } - if (isset($trace['file']) && isset($trace['line'])) { - $content .= $this->formatPath($trace['file'], $trace['line']); - } - $content .= "
    \n
    \n"; - } - } catch (\Exception $e) { - // something nasty happened and we cannot throw an exception anymore - if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage())); - } else { - $title = 'Whoops, looks like something went wrong.'; - } - } - } - - $symfonyGhostImageContents = $this->getSymfonyGhostAsSvg(); - - return << -
    -
    -

    $title

    -
    $symfonyGhostImageContents
    -
    -
    - - -
    - $content -
    -EOF; - } - - /** - * Gets the stylesheet associated with the given exception. - * - * @param FlattenException $exception A FlattenException instance - * - * @return string The stylesheet as a string - */ - public function getStylesheet(FlattenException $exception) - { - return <<<'EOF' - body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 45px; } - - a { cursor: pointer; text-decoration: none; } - a:hover { text-decoration: underline; } - abbr[title] { border-bottom: none; cursor: help; text-decoration: none; } - - code, pre { font: 13px/1.5 Consolas, Monaco, Menlo, "Ubuntu Mono", "Liberation Mono", monospace; } - - table, tr, th, td { background: #FFF; border-collapse: collapse; vertical-align: top; } - table { background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2); margin: 1em 0; width: 100%; } - table th, table td { border: solid #E0E0E0; border-width: 1px 0; padding: 8px 10px; } - table th { background-color: #E0E0E0; font-weight: bold; text-align: left; } - - .hidden-xs-down { display: none; } - .block { display: block; } - .break-long-words { -ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; } - .text-muted { color: #999; } - - .container { max-width: 1024px; margin: 0 auto; padding: 0 15px; } - .container::after { content: ""; display: table; clear: both; } - - .exception-summary { background: #B0413E; border-bottom: 2px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, .3); flex: 0 0 auto; margin-bottom: 30px; } - - .exception-message-wrapper { display: flex; align-items: center; min-height: 70px; } - .exception-message { flex-grow: 1; padding: 30px 0; } - .exception-message, .exception-message a { color: #FFF; font-size: 21px; font-weight: 400; margin: 0; } - .exception-message.long { font-size: 18px; } - .exception-message a { border-bottom: 1px solid rgba(255, 255, 255, 0.5); font-size: inherit; text-decoration: none; } - .exception-message a:hover { border-bottom-color: #ffffff; } - - .exception-illustration { flex-basis: 111px; flex-shrink: 0; height: 66px; margin-left: 15px; opacity: .7; } - - .trace + .trace { margin-top: 30px; } - .trace-head .trace-class { color: #222; font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; } - - .trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; } - - .trace-file-path, .trace-file-path a { color: #222; margin-top: 3px; font-size: 13px; } - .trace-class { color: #B0413E; } - .trace-type { padding: 0 2px; } - .trace-method { color: #B0413E; font-weight: bold; } - .trace-arguments { color: #777; font-weight: normal; padding-left: 2px; } - - @media (min-width: 575px) { - .hidden-xs-down { display: initial; } - } -EOF; - } - - private function decorate($content, $css) - { - return << - - - - - - - - $content - - -EOF; - } - - private function formatClass($class) - { - $parts = explode('\\', $class); - - return sprintf('%s', $class, array_pop($parts)); - } - - private function formatPath($path, $line) - { - $file = $this->escapeHtml(preg_match('#[^/\\\\]*+$#', $path, $file) ? $file[0] : $path); - $fmt = $this->fileLinkFormat; - - if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $path, '%l' => $line)) : $fmt->format($path, $line)) { - return sprintf('in %s (line %d)', $this->escapeHtml($link), $file, $line); - } - - return sprintf('in %s (line %d)', $this->escapeHtml($path), $file, $line); - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - private function formatArgs(array $args) - { - $result = array(); - foreach ($args as $key => $item) { - if ('object' === $item[0]) { - $formattedValue = sprintf('object(%s)', $this->formatClass($item[1])); - } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); - } elseif ('null' === $item[0]) { - $formattedValue = 'null'; - } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; - } elseif ('resource' === $item[0]) { - $formattedValue = 'resource'; - } else { - $formattedValue = str_replace("\n", '', $this->escapeHtml(var_export($item[1], true))); - } - - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue); - } - - return implode(', ', $result); - } - - /** - * HTML-encodes a string. - */ - private function escapeHtml($str) - { - return htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); - } - - private function getSymfonyGhostAsSvg() - { - return ''; - } -} diff --git a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php deleted file mode 100644 index 32ba9a0..0000000 --- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ /dev/null @@ -1,206 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\ClassNotFoundException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\DebugClassLoader; -use Composer\Autoload\ClassLoader as ComposerClassLoader; -use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; - -/** - * ErrorHandler for classes that do not exist. - * - * @author Fabien Potencier - */ -class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - $messageLen = strlen($error['message']); - $notFoundSuffix = '\' not found'; - $notFoundSuffixLen = strlen($notFoundSuffix); - if ($notFoundSuffixLen > $messageLen) { - return; - } - - if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; - } - - foreach (array('class', 'interface', 'trait') as $typeName) { - $prefix = ucfirst($typeName).' \''; - $prefixLen = strlen($prefix); - if (0 !== strpos($error['message'], $prefix)) { - continue; - } - - $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); - if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) { - $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1); - $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex); - $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix); - $tail = ' for another namespace?'; - } else { - $className = $fullyQualifiedClassName; - $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className); - $tail = '?'; - } - - if ($candidates = $this->getClassCandidates($className)) { - $tail = array_pop($candidates).'"?'; - if ($candidates) { - $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail; - } else { - $tail = ' for "'.$tail; - } - } - $message .= "\nDid you forget a \"use\" statement".$tail; - - return new ClassNotFoundException($message, $exception); - } - } - - /** - * Tries to guess the full namespace for a given class name. - * - * By default, it looks for PSR-0 and PSR-4 classes registered via a Symfony or a Composer - * autoloader (that should cover all common cases). - * - * @param string $class A class name (without its namespace) - * - * @return array An array of possible fully qualified class names - */ - private function getClassCandidates($class) - { - if (!is_array($functions = spl_autoload_functions())) { - return array(); - } - - // find Symfony and Composer autoloaders - $classes = array(); - - foreach ($functions as $function) { - if (!is_array($function)) { - continue; - } - // get class loaders wrapped by DebugClassLoader - if ($function[0] instanceof DebugClassLoader) { - $function = $function[0]->getClassLoader(); - - if (!is_array($function)) { - continue; - } - } - - if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader) { - foreach ($function[0]->getPrefixes() as $prefix => $paths) { - foreach ($paths as $path) { - $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix)); - } - } - } - if ($function[0] instanceof ComposerClassLoader) { - foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) { - foreach ($paths as $path) { - $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix)); - } - } - } - } - - return array_unique($classes); - } - - /** - * @param string $path - * @param string $class - * @param string $prefix - * - * @return array - */ - private function findClassInPath($path, $class, $prefix) - { - if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { - return array(); - } - - $classes = array(); - $filename = $class.'.php'; - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) { - $classes[] = $class; - } - } - - return $classes; - } - - /** - * @param string $path - * @param string $file - * @param string $prefix - * - * @return string|null - */ - private function convertFileToClass($path, $file, $prefix) - { - $candidates = array( - // namespaced class - $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), - // namespaced class (with target dir) - $prefix.$namespacedClass, - // namespaced class (with target dir and separator) - $prefix.'\\'.$namespacedClass, - // PEAR class - str_replace('\\', '_', $namespacedClass), - // PEAR class (with target dir) - str_replace('\\', '_', $prefix.$namespacedClass), - // PEAR class (with target dir and separator) - str_replace('\\', '_', $prefix.'\\'.$namespacedClass), - ); - - if ($prefix) { - $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); - } - - // We cannot use the autoloader here as most of them use require; but if the class - // is not found, the new autoloader call will require the file again leading to a - // "cannot redeclare class" error. - foreach ($candidates as $candidate) { - if ($this->classExists($candidate)) { - return $candidate; - } - } - - require_once $file; - - foreach ($candidates as $candidate) { - if ($this->classExists($candidate)) { - return $candidate; - } - } - } - - /** - * @param string $class - * - * @return bool - */ - private function classExists($class) - { - return class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false); - } -} diff --git a/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php b/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php deleted file mode 100644 index 6b87eb3..0000000 --- a/vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\FatalErrorException; - -/** - * Attempts to convert fatal errors to exceptions. - * - * @author Fabien Potencier - */ -interface FatalErrorHandlerInterface -{ - /** - * Attempts to convert an error into an exception. - * - * @param array $error An array as returned by error_get_last() - * @param FatalErrorException $exception A FatalErrorException instance - * - * @return FatalErrorException|null A FatalErrorException instance if the class is able to convert the error, null otherwise - */ - public function handleError(array $error, FatalErrorException $exception); -} diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php deleted file mode 100644 index c6f391a..0000000 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\UndefinedFunctionException; -use Symfony\Component\Debug\Exception\FatalErrorException; - -/** - * ErrorHandler for undefined functions. - * - * @author Fabien Potencier - */ -class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - $messageLen = strlen($error['message']); - $notFoundSuffix = '()'; - $notFoundSuffixLen = strlen($notFoundSuffix); - if ($notFoundSuffixLen > $messageLen) { - return; - } - - if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; - } - - $prefix = 'Call to undefined function '; - $prefixLen = strlen($prefix); - if (0 !== strpos($error['message'], $prefix)) { - return; - } - - $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); - if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) { - $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1); - $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex); - $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix); - } else { - $functionName = $fullyQualifiedFunctionName; - $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName); - } - - $candidates = array(); - foreach (get_defined_functions() as $type => $definedFunctionNames) { - foreach ($definedFunctionNames as $definedFunctionName) { - if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) { - $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1); - } else { - $definedFunctionNameBasename = $definedFunctionName; - } - - if ($definedFunctionNameBasename === $functionName) { - $candidates[] = '\\'.$definedFunctionName; - } - } - } - - if ($candidates) { - sort($candidates); - $last = array_pop($candidates).'"?'; - if ($candidates) { - $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last; - } else { - $candidates = '"'.$last; - } - $message .= "\nDid you mean to call ".$candidates; - } - - return new UndefinedFunctionException($message, $exception); - } -} diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php deleted file mode 100644 index 6fa62b6..0000000 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\FatalErrorHandler; - -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\Exception\UndefinedMethodException; - -/** - * ErrorHandler for undefined methods. - * - * @author Grégoire Pineau - */ -class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function handleError(array $error, FatalErrorException $exception) - { - preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches); - if (!$matches) { - return; - } - - $className = $matches[1]; - $methodName = $matches[2]; - - $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className); - - if (!class_exists($className) || null === $methods = get_class_methods($className)) { - // failed to get the class or its methods on which an unknown method was called (for example on an anonymous class) - return new UndefinedMethodException($message, $exception); - } - - $candidates = array(); - foreach ($methods as $definedMethodName) { - $lev = levenshtein($methodName, $definedMethodName); - if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { - $candidates[] = $definedMethodName; - } - } - - if ($candidates) { - sort($candidates); - $last = array_pop($candidates).'"?'; - if ($candidates) { - $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last; - } else { - $candidates = '"'.$last; - } - - $message .= "\nDid you mean to call ".$candidates; - } - - return new UndefinedMethodException($message, $exception); - } -} diff --git a/vendor/symfony/debug/LICENSE b/vendor/symfony/debug/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/debug/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/debug/README.md b/vendor/symfony/debug/README.md deleted file mode 100644 index a1d1617..0000000 --- a/vendor/symfony/debug/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Debug Component -=============== - -The Debug component provides tools to ease debugging PHP code. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/debug/index.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/debug/Resources/ext/README.md b/vendor/symfony/debug/Resources/ext/README.md deleted file mode 100644 index 25dccf0..0000000 --- a/vendor/symfony/debug/Resources/ext/README.md +++ /dev/null @@ -1,134 +0,0 @@ -Symfony Debug Extension for PHP 5 -================================= - -This extension publishes several functions to help building powerful debugging tools. -It is compatible with PHP 5.3, 5.4, 5.5 and 5.6; with ZTS and non-ZTS modes. -It is not required thus not provided for PHP 7. - -symfony_zval_info() -------------------- - -- exposes zval_hash/refcounts, allowing e.g. efficient exploration of arbitrary structures in PHP, -- does work with references, preventing memory copying. - -Its behavior is about the same as: - -```php - gettype($array[$key]), - 'zval_hash' => /* hashed memory address of $array[$key] */, - 'zval_refcount' => /* internal zval refcount of $array[$key] */, - 'zval_isref' => /* is_ref status of $array[$key] */, - ); - - switch ($info['type']) { - case 'object': - $info += array( - 'object_class' => get_class($array[$key]), - 'object_refcount' => /* internal object refcount of $array[$key] */, - 'object_hash' => spl_object_hash($array[$key]), - 'object_handle' => /* internal object handle $array[$key] */, - ); - break; - - case 'resource': - $info += array( - 'resource_handle' => (int) $array[$key], - 'resource_type' => get_resource_type($array[$key]), - 'resource_refcount' => /* internal resource refcount of $array[$key] */, - ); - break; - - case 'array': - $info += array( - 'array_count' => count($array[$key]), - ); - break; - - case 'string': - $info += array( - 'strlen' => strlen($array[$key]), - ); - break; - } - - return $info; -} -``` - -symfony_debug_backtrace() -------------------------- - -This function works like debug_backtrace(), except that it can fetch the full backtrace in case of fatal errors: - -```php -function foo() { fatal(); } -function bar() { foo(); } - -function sd() { var_dump(symfony_debug_backtrace()); } - -register_shutdown_function('sd'); - -bar(); - -/* Will output -Fatal error: Call to undefined function fatal() in foo.php on line 42 -array(3) { - [0]=> - array(2) { - ["function"]=> - string(2) "sd" - ["args"]=> - array(0) { - } - } - [1]=> - array(4) { - ["file"]=> - string(7) "foo.php" - ["line"]=> - int(1) - ["function"]=> - string(3) "foo" - ["args"]=> - array(0) { - } - } - [2]=> - array(4) { - ["file"]=> - string(102) "foo.php" - ["line"]=> - int(2) - ["function"]=> - string(3) "bar" - ["args"]=> - array(0) { - } - } -} -*/ -``` - -Usage ------ - -To enable the extension from source, run: - -``` - phpize - ./configure - make - sudo make install -``` diff --git a/vendor/symfony/debug/Resources/ext/config.m4 b/vendor/symfony/debug/Resources/ext/config.m4 deleted file mode 100644 index 3c56047..0000000 --- a/vendor/symfony/debug/Resources/ext/config.m4 +++ /dev/null @@ -1,63 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension symfony_debug - -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. - -dnl If your extension references something external, use with: - -dnl PHP_ARG_WITH(symfony_debug, for symfony_debug support, -dnl Make sure that the comment is aligned: -dnl [ --with-symfony_debug Include symfony_debug support]) - -dnl Otherwise use enable: - -PHP_ARG_ENABLE(symfony_debug, whether to enable symfony_debug support, -dnl Make sure that the comment is aligned: -[ --enable-symfony_debug Enable symfony_debug support]) - -if test "$PHP_SYMFONY_DEBUG" != "no"; then - dnl Write more examples of tests here... - - dnl # --with-symfony_debug -> check with-path - dnl SEARCH_PATH="/usr/local /usr" # you might want to change this - dnl SEARCH_FOR="/include/symfony_debug.h" # you most likely want to change this - dnl if test -r $PHP_SYMFONY_DEBUG/$SEARCH_FOR; then # path given as parameter - dnl SYMFONY_DEBUG_DIR=$PHP_SYMFONY_DEBUG - dnl else # search default path list - dnl AC_MSG_CHECKING([for symfony_debug files in default path]) - dnl for i in $SEARCH_PATH ; do - dnl if test -r $i/$SEARCH_FOR; then - dnl SYMFONY_DEBUG_DIR=$i - dnl AC_MSG_RESULT(found in $i) - dnl fi - dnl done - dnl fi - dnl - dnl if test -z "$SYMFONY_DEBUG_DIR"; then - dnl AC_MSG_RESULT([not found]) - dnl AC_MSG_ERROR([Please reinstall the symfony_debug distribution]) - dnl fi - - dnl # --with-symfony_debug -> add include path - dnl PHP_ADD_INCLUDE($SYMFONY_DEBUG_DIR/include) - - dnl # --with-symfony_debug -> check for lib and symbol presence - dnl LIBNAME=symfony_debug # you may want to change this - dnl LIBSYMBOL=symfony_debug # you most likely want to change this - - dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - dnl [ - dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SYMFONY_DEBUG_DIR/lib, SYMFONY_DEBUG_SHARED_LIBADD) - dnl AC_DEFINE(HAVE_SYMFONY_DEBUGLIB,1,[ ]) - dnl ],[ - dnl AC_MSG_ERROR([wrong symfony_debug lib version or lib not found]) - dnl ],[ - dnl -L$SYMFONY_DEBUG_DIR/lib -lm - dnl ]) - dnl - dnl PHP_SUBST(SYMFONY_DEBUG_SHARED_LIBADD) - - PHP_NEW_EXTENSION(symfony_debug, symfony_debug.c, $ext_shared) -fi diff --git a/vendor/symfony/debug/Resources/ext/config.w32 b/vendor/symfony/debug/Resources/ext/config.w32 deleted file mode 100644 index 487e691..0000000 --- a/vendor/symfony/debug/Resources/ext/config.w32 +++ /dev/null @@ -1,13 +0,0 @@ -// $Id$ -// vim:ft=javascript - -// If your extension references something external, use ARG_WITH -// ARG_WITH("symfony_debug", "for symfony_debug support", "no"); - -// Otherwise, use ARG_ENABLE -// ARG_ENABLE("symfony_debug", "enable symfony_debug support", "no"); - -if (PHP_SYMFONY_DEBUG != "no") { - EXTENSION("symfony_debug", "symfony_debug.c"); -} - diff --git a/vendor/symfony/debug/Resources/ext/php_symfony_debug.h b/vendor/symfony/debug/Resources/ext/php_symfony_debug.h deleted file mode 100644 index 26d0e8c..0000000 --- a/vendor/symfony/debug/Resources/ext/php_symfony_debug.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifndef PHP_SYMFONY_DEBUG_H -#define PHP_SYMFONY_DEBUG_H - -extern zend_module_entry symfony_debug_module_entry; -#define phpext_symfony_debug_ptr &symfony_debug_module_entry - -#define PHP_SYMFONY_DEBUG_VERSION "2.7" - -#ifdef PHP_WIN32 -# define PHP_SYMFONY_DEBUG_API __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define PHP_SYMFONY_DEBUG_API __attribute__ ((visibility("default"))) -#else -# define PHP_SYMFONY_DEBUG_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -ZEND_BEGIN_MODULE_GLOBALS(symfony_debug) - intptr_t req_rand_init; - void (*old_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); - zval *debug_bt; -ZEND_END_MODULE_GLOBALS(symfony_debug) - -PHP_MINIT_FUNCTION(symfony_debug); -PHP_MSHUTDOWN_FUNCTION(symfony_debug); -PHP_RINIT_FUNCTION(symfony_debug); -PHP_RSHUTDOWN_FUNCTION(symfony_debug); -PHP_MINFO_FUNCTION(symfony_debug); -PHP_GINIT_FUNCTION(symfony_debug); -PHP_GSHUTDOWN_FUNCTION(symfony_debug); - -PHP_FUNCTION(symfony_zval_info); -PHP_FUNCTION(symfony_debug_backtrace); - -static char *_symfony_debug_memory_address_hash(void * TSRMLS_DC); -static const char *_symfony_debug_zval_type(zval *); -static const char* _symfony_debug_get_resource_type(long TSRMLS_DC); -static int _symfony_debug_get_resource_refcount(long TSRMLS_DC); - -void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); - -#ifdef ZTS -#define SYMFONY_DEBUG_G(v) TSRMG(symfony_debug_globals_id, zend_symfony_debug_globals *, v) -#else -#define SYMFONY_DEBUG_G(v) (symfony_debug_globals.v) -#endif - -#endif /* PHP_SYMFONY_DEBUG_H */ diff --git a/vendor/symfony/debug/Resources/ext/symfony_debug.c b/vendor/symfony/debug/Resources/ext/symfony_debug.c deleted file mode 100644 index 0d7cb60..0000000 --- a/vendor/symfony/debug/Resources/ext/symfony_debug.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#ifdef ZTS -#include "TSRM.h" -#endif -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_symfony_debug.h" -#include "ext/standard/php_rand.h" -#include "ext/standard/php_lcg.h" -#include "ext/spl/php_spl.h" -#include "Zend/zend_gc.h" -#include "Zend/zend_builtin_functions.h" -#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ -#include "ext/standard/php_array.h" -#include "Zend/zend_interfaces.h" -#include "SAPI.h" - -#define IS_PHP_53 ZEND_EXTENSION_API_NO == 220090626 - -ZEND_DECLARE_MODULE_GLOBALS(symfony_debug) - -ZEND_BEGIN_ARG_INFO_EX(symfony_zval_arginfo, 0, 0, 2) - ZEND_ARG_INFO(0, key) - ZEND_ARG_ARRAY_INFO(0, array, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -const zend_function_entry symfony_debug_functions[] = { - PHP_FE(symfony_zval_info, symfony_zval_arginfo) - PHP_FE(symfony_debug_backtrace, NULL) - PHP_FE_END -}; - -PHP_FUNCTION(symfony_debug_backtrace) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } -#if IS_PHP_53 - zend_fetch_debug_backtrace(return_value, 1, 0 TSRMLS_CC); -#else - zend_fetch_debug_backtrace(return_value, 1, 0, 0 TSRMLS_CC); -#endif - - if (!SYMFONY_DEBUG_G(debug_bt)) { - return; - } - - php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_P(SYMFONY_DEBUG_G(debug_bt)), 0 TSRMLS_CC); -} - -PHP_FUNCTION(symfony_zval_info) -{ - zval *key = NULL, *arg = NULL; - zval **data = NULL; - HashTable *array = NULL; - long options = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zh|l", &key, &array, &options) == FAILURE) { - return; - } - - switch (Z_TYPE_P(key)) { - case IS_STRING: - if (zend_symtable_find(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&data) == FAILURE) { - return; - } - break; - case IS_LONG: - if (zend_hash_index_find(array, Z_LVAL_P(key), (void **)&data)) { - return; - } - break; - } - - arg = *data; - - array_init(return_value); - - add_assoc_string(return_value, "type", (char *)_symfony_debug_zval_type(arg), 1); - add_assoc_stringl(return_value, "zval_hash", _symfony_debug_memory_address_hash((void *)arg TSRMLS_CC), 16, 0); - add_assoc_long(return_value, "zval_refcount", Z_REFCOUNT_P(arg)); - add_assoc_bool(return_value, "zval_isref", (zend_bool)Z_ISREF_P(arg)); - - if (Z_TYPE_P(arg) == IS_OBJECT) { - char hash[33] = {0}; - - php_spl_object_hash(arg, (char *)hash TSRMLS_CC); - add_assoc_stringl(return_value, "object_class", (char *)Z_OBJCE_P(arg)->name, Z_OBJCE_P(arg)->name_length, 1); - add_assoc_long(return_value, "object_refcount", EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(arg)].bucket.obj.refcount); - add_assoc_string(return_value, "object_hash", hash, 1); - add_assoc_long(return_value, "object_handle", Z_OBJ_HANDLE_P(arg)); - } else if (Z_TYPE_P(arg) == IS_ARRAY) { - add_assoc_long(return_value, "array_count", zend_hash_num_elements(Z_ARRVAL_P(arg))); - } else if(Z_TYPE_P(arg) == IS_RESOURCE) { - add_assoc_long(return_value, "resource_handle", Z_LVAL_P(arg)); - add_assoc_string(return_value, "resource_type", (char *)_symfony_debug_get_resource_type(Z_LVAL_P(arg) TSRMLS_CC), 1); - add_assoc_long(return_value, "resource_refcount", _symfony_debug_get_resource_refcount(Z_LVAL_P(arg) TSRMLS_CC)); - } else if (Z_TYPE_P(arg) == IS_STRING) { - add_assoc_long(return_value, "strlen", Z_STRLEN_P(arg)); - } -} - -void symfony_debug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) -{ - TSRMLS_FETCH(); - zval *retval; - - switch (type) { - case E_ERROR: - case E_PARSE: - case E_CORE_ERROR: - case E_CORE_WARNING: - case E_COMPILE_ERROR: - case E_COMPILE_WARNING: - ALLOC_INIT_ZVAL(retval); -#if IS_PHP_53 - zend_fetch_debug_backtrace(retval, 1, 0 TSRMLS_CC); -#else - zend_fetch_debug_backtrace(retval, 1, 0, 0 TSRMLS_CC); -#endif - SYMFONY_DEBUG_G(debug_bt) = retval; - } - - SYMFONY_DEBUG_G(old_error_cb)(type, error_filename, error_lineno, format, args); -} - -static const char* _symfony_debug_get_resource_type(long rsid TSRMLS_DC) -{ - const char *res_type; - res_type = zend_rsrc_list_get_rsrc_type(rsid TSRMLS_CC); - - if (!res_type) { - return "Unknown"; - } - - return res_type; -} - -static int _symfony_debug_get_resource_refcount(long rsid TSRMLS_DC) -{ - zend_rsrc_list_entry *le; - - if (zend_hash_index_find(&EG(regular_list), rsid, (void **) &le)==SUCCESS) { - return le->refcount; - } - - return 0; -} - -static char *_symfony_debug_memory_address_hash(void *address TSRMLS_DC) -{ - char *result = NULL; - intptr_t address_rand; - - if (!SYMFONY_DEBUG_G(req_rand_init)) { - if (!BG(mt_rand_is_seeded)) { - php_mt_srand(GENERATE_SEED() TSRMLS_CC); - } - SYMFONY_DEBUG_G(req_rand_init) = (intptr_t)php_mt_rand(TSRMLS_C); - } - - address_rand = (intptr_t)address ^ SYMFONY_DEBUG_G(req_rand_init); - - spprintf(&result, 17, "%016zx", address_rand); - - return result; -} - -static const char *_symfony_debug_zval_type(zval *zv) -{ - switch (Z_TYPE_P(zv)) { - case IS_NULL: - return "NULL"; - break; - - case IS_BOOL: - return "boolean"; - break; - - case IS_LONG: - return "integer"; - break; - - case IS_DOUBLE: - return "double"; - break; - - case IS_STRING: - return "string"; - break; - - case IS_ARRAY: - return "array"; - break; - - case IS_OBJECT: - return "object"; - - case IS_RESOURCE: - return "resource"; - - default: - return "unknown type"; - } -} - -zend_module_entry symfony_debug_module_entry = { - STANDARD_MODULE_HEADER, - "symfony_debug", - symfony_debug_functions, - PHP_MINIT(symfony_debug), - PHP_MSHUTDOWN(symfony_debug), - PHP_RINIT(symfony_debug), - PHP_RSHUTDOWN(symfony_debug), - PHP_MINFO(symfony_debug), - PHP_SYMFONY_DEBUG_VERSION, - PHP_MODULE_GLOBALS(symfony_debug), - PHP_GINIT(symfony_debug), - PHP_GSHUTDOWN(symfony_debug), - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_SYMFONY_DEBUG -ZEND_GET_MODULE(symfony_debug) -#endif - -PHP_GINIT_FUNCTION(symfony_debug) -{ - memset(symfony_debug_globals, 0 , sizeof(*symfony_debug_globals)); -} - -PHP_GSHUTDOWN_FUNCTION(symfony_debug) -{ - -} - -PHP_MINIT_FUNCTION(symfony_debug) -{ - SYMFONY_DEBUG_G(old_error_cb) = zend_error_cb; - zend_error_cb = symfony_debug_error_cb; - - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(symfony_debug) -{ - zend_error_cb = SYMFONY_DEBUG_G(old_error_cb); - - return SUCCESS; -} - -PHP_RINIT_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(symfony_debug) -{ - return SUCCESS; -} - -PHP_MINFO_FUNCTION(symfony_debug) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "Symfony Debug support", "enabled"); - php_info_print_table_header(2, "Symfony Debug version", PHP_SYMFONY_DEBUG_VERSION); - php_info_print_table_end(); -} diff --git a/vendor/symfony/debug/Resources/ext/tests/001.phpt b/vendor/symfony/debug/Resources/ext/tests/001.phpt deleted file mode 100644 index 15e183a..0000000 --- a/vendor/symfony/debug/Resources/ext/tests/001.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -Test symfony_zval_info API ---SKIPIF-- - ---FILE-- - $int, - 'float' => $float, - 'str' => $str, - 'object' => $object, - 'array' => $array, - 'resource' => $resource, - 'null' => $null, - 'bool' => $bool, - 'refcount' => &$refcount2, -); - -var_dump(symfony_zval_info('int', $var)); -var_dump(symfony_zval_info('float', $var)); -var_dump(symfony_zval_info('str', $var)); -var_dump(symfony_zval_info('object', $var)); -var_dump(symfony_zval_info('array', $var)); -var_dump(symfony_zval_info('resource', $var)); -var_dump(symfony_zval_info('null', $var)); -var_dump(symfony_zval_info('bool', $var)); - -var_dump(symfony_zval_info('refcount', $var)); -var_dump(symfony_zval_info('not-exist', $var)); -?> ---EXPECTF-- -array(4) { - ["type"]=> - string(7) "integer" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) -} -array(4) { - ["type"]=> - string(6) "double" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) -} -array(5) { - ["type"]=> - string(6) "string" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) - ["strlen"]=> - int(6) -} -array(8) { - ["type"]=> - string(6) "object" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) - ["object_class"]=> - string(8) "stdClass" - ["object_refcount"]=> - int(1) - ["object_hash"]=> - string(32) "%s" - ["object_handle"]=> - int(%d) -} -array(5) { - ["type"]=> - string(5) "array" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) - ["array_count"]=> - int(2) -} -array(7) { - ["type"]=> - string(8) "resource" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) - ["resource_handle"]=> - int(%d) - ["resource_type"]=> - string(6) "stream" - ["resource_refcount"]=> - int(1) -} -array(4) { - ["type"]=> - string(4) "NULL" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) -} -array(4) { - ["type"]=> - string(7) "boolean" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(2) - ["zval_isref"]=> - bool(false) -} -array(4) { - ["type"]=> - string(7) "integer" - ["zval_hash"]=> - string(16) "%s" - ["zval_refcount"]=> - int(3) - ["zval_isref"]=> - bool(true) -} -NULL diff --git a/vendor/symfony/debug/Resources/ext/tests/002.phpt b/vendor/symfony/debug/Resources/ext/tests/002.phpt deleted file mode 100644 index 2bc6d71..0000000 --- a/vendor/symfony/debug/Resources/ext/tests/002.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -Test symfony_debug_backtrace in case of fatal error ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Fatal error: Call to undefined function notexist() in %s on line %d -Array -( - [0] => Array - ( - [function] => bt - [args] => Array - ( - ) - - ) - - [1] => Array - ( - [file] => %s - [line] => %d - [function] => foo - [args] => Array - ( - ) - - ) - - [2] => Array - ( - [file] => %s - [line] => %d - [function] => bar - [args] => Array - ( - ) - - ) - -) diff --git a/vendor/symfony/debug/Resources/ext/tests/002_1.phpt b/vendor/symfony/debug/Resources/ext/tests/002_1.phpt deleted file mode 100644 index 4e9e34f..0000000 --- a/vendor/symfony/debug/Resources/ext/tests/002_1.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test symfony_debug_backtrace in case of non fatal error ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Array -( - [0] => Array - ( - [file] => %s - [line] => %d - [function] => bt - [args] => Array - ( - ) - - ) - - [1] => Array - ( - [file] => %s - [line] => %d - [function] => bar - [args] => Array - ( - ) - - ) - -) diff --git a/vendor/symfony/debug/Resources/ext/tests/003.phpt b/vendor/symfony/debug/Resources/ext/tests/003.phpt deleted file mode 100644 index 2a494e2..0000000 --- a/vendor/symfony/debug/Resources/ext/tests/003.phpt +++ /dev/null @@ -1,85 +0,0 @@ ---TEST-- -Test ErrorHandler in case of fatal error ---SKIPIF-- - ---FILE-- -setExceptionHandler('print_r'); - -if (function_exists('xdebug_disable')) { - xdebug_disable(); -} - -bar(); -?> ---EXPECTF-- -Fatal error: Call to undefined function Symfony\Component\Debug\notexist() in %s on line %d -Symfony\Component\Debug\Exception\UndefinedFunctionException Object -( - [message:protected] => Attempted to call function "notexist" from namespace "Symfony\Component\Debug". - [string:Exception:private] => - [code:protected] => 0 - [file:protected] => %s - [line:protected] => %d - [trace:Exception:private] => Array - ( - [0] => Array - ( -%A [function] => Symfony\Component\Debug\foo -%A [args] => Array - ( - ) - - ) - - [1] => Array - ( -%A [function] => Symfony\Component\Debug\bar -%A [args] => Array - ( - ) - - ) -%A - ) - - [previous:Exception:private] => - [severity:protected] => 1 -) diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php deleted file mode 100644 index 7145951..0000000 --- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php +++ /dev/null @@ -1,387 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\DebugClassLoader; -use Symfony\Component\Debug\ErrorHandler; - -class DebugClassLoaderTest extends TestCase -{ - /** - * @var int Error reporting level before running tests - */ - private $errorReporting; - - private $loader; - - protected function setUp() - { - $this->errorReporting = error_reporting(E_ALL); - $this->loader = new ClassLoader(); - spl_autoload_register(array($this->loader, 'loadClass'), true, true); - DebugClassLoader::enable(); - } - - protected function tearDown() - { - DebugClassLoader::disable(); - spl_autoload_unregister(array($this->loader, 'loadClass')); - error_reporting($this->errorReporting); - } - - public function testIdempotence() - { - DebugClassLoader::enable(); - - $functions = spl_autoload_functions(); - foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof DebugClassLoader) { - $reflClass = new \ReflectionClass($function[0]); - $reflProp = $reflClass->getProperty('classLoader'); - $reflProp->setAccessible(true); - - $this->assertNotInstanceOf('Symfony\Component\Debug\DebugClassLoader', $reflProp->getValue($function[0])); - - return; - } - } - - $this->fail('DebugClassLoader did not register'); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage boo - */ - public function testThrowingClass() - { - try { - class_exists(__NAMESPACE__.'\Fixtures\Throwing'); - $this->fail('Exception expected'); - } catch (\Exception $e) { - $this->assertSame('boo', $e->getMessage()); - } - - // the second call also should throw - class_exists(__NAMESPACE__.'\Fixtures\Throwing'); - } - - public function testUnsilencing() - { - if (\PHP_VERSION_ID >= 70000) { - $this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.'); - } - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM is not handled in this test case.'); - } - - ob_start(); - - $this->iniSet('log_errors', 0); - $this->iniSet('display_errors', 1); - - // See below: this will fail with parse error - // but this should not be @-silenced. - @class_exists(__NAMESPACE__.'\TestingUnsilencing', true); - - $output = ob_get_clean(); - - $this->assertStringMatchesFormat('%aParse error%a', $output); - } - - public function testStacking() - { - // the ContextErrorException must not be loaded to test the workaround - // for https://bugs.php.net/65322. - if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) { - $this->markTestSkipped('The ContextErrorException class is already loaded.'); - } - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM is not handled in this test case.'); - } - - ErrorHandler::register(); - - try { - // Trigger autoloading + E_STRICT at compile time - // which in turn triggers $errorHandler->handle() - // that again triggers autoloading for ContextErrorException. - // Error stacking works around the bug above and everything is fine. - - eval(' - namespace '.__NAMESPACE__.'; - class ChildTestingStacking extends TestingStacking { function foo($bar) {} } - '); - $this->fail('ContextErrorException expected'); - } catch (\ErrorException $exception) { - // if an exception is thrown, the test passed - $this->assertStringStartsWith(__FILE__, $exception->getFile()); - if (\PHP_VERSION_ID < 70000) { - $this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage()); - $this->assertEquals(E_STRICT, $exception->getSeverity()); - } else { - $this->assertRegExp('/^Warning: Declaration/', $exception->getMessage()); - $this->assertEquals(E_WARNING, $exception->getSeverity()); - } - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Case mismatch between loaded and declared class names - */ - public function testNameCaseMismatch() - { - class_exists(__NAMESPACE__.'\TestingCaseMismatch', true); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Case mismatch between class and real file names - */ - public function testFileCaseMismatch() - { - if (!file_exists(__DIR__.'/Fixtures/CaseMismatch.php')) { - $this->markTestSkipped('Can only be run on case insensitive filesystems'); - } - - class_exists(__NAMESPACE__.'\Fixtures\CaseMismatch', true); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Case mismatch between loaded and declared class names - */ - public function testPsr4CaseMismatch() - { - class_exists(__NAMESPACE__.'\Fixtures\Psr4CaseMismatch', true); - } - - public function testNotPsr0() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0', true)); - } - - public function testNotPsr0Bis() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\NotPSR0bis', true)); - } - - public function testClassAlias() - { - $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\ClassAlias', true)); - } - - /** - * @dataProvider provideDeprecatedSuper - */ - public function testDeprecatedSuper($class, $super, $type) - { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_DEPRECATED); - - class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice', - ); - - $this->assertSame($xError, $lastError); - } - - public function provideDeprecatedSuper() - { - return array( - array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'), - array('DeprecatedParentClass', 'DeprecatedClass', 'extends'), - ); - } - - public function testInterfaceExtendsDeprecatedInterface() - { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); - - class_exists('Test\\'.__NAMESPACE__.'\\NonDeprecatedInterfaceClass', true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_NOTICE, - 'message' => '', - ); - - $this->assertSame($xError, $lastError); - } - - public function testDeprecatedSuperInSameNamespace() - { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); - - class_exists('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent', true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_NOTICE, - 'message' => '', - ); - - $this->assertSame($xError, $lastError); - } - - public function testReservedForPhp7() - { - if (\PHP_VERSION_ID >= 70000) { - $this->markTestSkipped('PHP7 already prevents using reserved names.'); - } - - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); - - class_exists('Test\\'.__NAMESPACE__.'\\Float', true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Test\Symfony\Component\Debug\Tests\Float" class uses the reserved name "Float", it will break on PHP 7 and higher', - ); - - $this->assertSame($xError, $lastError); - } - - public function testExtendedFinalClass() - { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); - - class_exists('Test\\'.__NAMESPACE__.'\\ExtendsFinalClass', true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".', - ); - - $this->assertSame($xError, $lastError); - } - - public function testExtendedFinalMethod() - { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); - - class_exists(__NAMESPACE__.'\\Fixtures\\ExtendedFinalMethod', true); - - error_reporting($e); - restore_error_handler(); - - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', - ); - - $this->assertSame($xError, $lastError); - } -} - -class ClassLoader -{ - public function loadClass($class) - { - } - - public function getClassMap() - { - return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); - } - - public function findFile($class) - { - $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; - - if (__NAMESPACE__.'\TestingUnsilencing' === $class) { - eval('-- parse error --'); - } elseif (__NAMESPACE__.'\TestingStacking' === $class) { - eval('namespace '.__NAMESPACE__.'; class TestingStacking { function foo() {} }'); - } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { - eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); - } elseif (__NAMESPACE__.'\Fixtures\CaseMismatch' === $class) { - return $fixtureDir.'CaseMismatch.php'; - } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { - return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; - } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { - return $fixtureDir.'reallyNotPsr0.php'; - } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { - return $fixtureDir.'notPsr0Bis.php'; - } elseif (__NAMESPACE__.'\Fixtures\DeprecatedInterface' === $class) { - return $fixtureDir.'DeprecatedInterface.php'; - } elseif (__NAMESPACE__.'\Fixtures\FinalClass' === $class) { - return $fixtureDir.'FinalClass.php'; - } elseif (__NAMESPACE__.'\Fixtures\FinalMethod' === $class) { - return $fixtureDir.'FinalMethod.php'; - } elseif (__NAMESPACE__.'\Fixtures\ExtendedFinalMethod' === $class) { - return $fixtureDir.'ExtendedFinalMethod.php'; - } elseif ('Symfony\Bridge\Debug\Tests\Fixtures\ExtendsDeprecatedParent' === $class) { - eval('namespace Symfony\Bridge\Debug\Tests\Fixtures; class ExtendsDeprecatedParent extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); - } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedParentClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedParentClass extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); - } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedInterfaceClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\DeprecatedInterface {}'); - } elseif ('Test\\'.__NAMESPACE__.'\NonDeprecatedInterfaceClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class NonDeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\NonDeprecatedInterface {}'); - } elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class Float {}'); - } elseif ('Test\\'.__NAMESPACE__.'\ExtendsFinalClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsFinalClass extends \\'.__NAMESPACE__.'\Fixtures\FinalClass {}'); - } - } -} diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php deleted file mode 100644 index a14accf..0000000 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ /dev/null @@ -1,535 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use PHPUnit\Framework\TestCase; -use Psr\Log\LogLevel; -use Symfony\Component\Debug\BufferingLogger; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\Exception\SilencedErrorContext; - -/** - * ErrorHandlerTest. - * - * @author Robert Schönthal - * @author Nicolas Grekas - */ -class ErrorHandlerTest extends TestCase -{ - public function testRegister() - { - $handler = ErrorHandler::register(); - - try { - $this->assertInstanceOf('Symfony\Component\Debug\ErrorHandler', $handler); - $this->assertSame($handler, ErrorHandler::register()); - - $newHandler = new ErrorHandler(); - - $this->assertSame($newHandler, ErrorHandler::register($newHandler, false)); - $h = set_error_handler('var_dump'); - restore_error_handler(); - $this->assertSame(array($handler, 'handleError'), $h); - - try { - $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); - $h = set_error_handler('var_dump'); - restore_error_handler(); - $this->assertSame(array($newHandler, 'handleError'), $h); - } catch (\Exception $e) { - } - - restore_error_handler(); - restore_exception_handler(); - - if (isset($e)) { - throw $e; - } - } catch (\Exception $e) { - } - - restore_error_handler(); - restore_exception_handler(); - - if (isset($e)) { - throw $e; - } - } - - public function testNotice() - { - ErrorHandler::register(); - - try { - self::triggerNotice($this); - $this->fail('ErrorException expected'); - } catch (\ErrorException $exception) { - // if an exception is thrown, the test passed - $this->assertEquals(E_NOTICE, $exception->getSeverity()); - $this->assertEquals(__FILE__, $exception->getFile()); - $this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage()); - - $trace = $exception->getTrace(); - - $this->assertEquals(__FILE__, $trace[0]['file']); - $this->assertEquals(__CLASS__, $trace[0]['class']); - $this->assertEquals('triggerNotice', $trace[0]['function']); - $this->assertEquals('::', $trace[0]['type']); - - $this->assertEquals(__FILE__, $trace[0]['file']); - $this->assertEquals(__CLASS__, $trace[1]['class']); - $this->assertEquals(__FUNCTION__, $trace[1]['function']); - $this->assertEquals('->', $trace[1]['type']); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - // dummy function to test trace in error handler. - private static function triggerNotice($that) - { - // dummy variable to check for in error handler. - $foobar = 123; - $that->assertSame('', $foo.$foo.$bar); - } - - public function testConstruct() - { - try { - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - $this->assertEquals(3 | E_RECOVERABLE_ERROR | E_USER_ERROR, $handler->throwAt(0)); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - public function testDefaultLogger() - { - try { - $handler = ErrorHandler::register(); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL)); - - $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array($logger, LogLevel::WARNING), - E_USER_NOTICE => array($logger, LogLevel::CRITICAL), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); - $this->assertSame($loggers, $handler->setLoggers(array())); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - public function testHandleError() - { - try { - $handler = ErrorHandler::register(); - $handler->throwAt(0, true); - $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(3, true); - try { - $handler->handleError(4, 'foo', 'foo.php', 12, array()); - } catch (\ErrorException $e) { - $this->assertSame('Parse Error: foo', $e->getMessage()); - $this->assertSame(4, $e->getSeverity()); - $this->assertSame('foo.php', $e->getFile()); - $this->assertSame(12, $e->getLine()); - } - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(E_USER_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $handler = ErrorHandler::register(); - $handler->throwAt(E_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $warnArgCheck = function ($logLevel, $message, $context) { - $this->assertEquals('info', $logLevel); - $this->assertEquals('User Deprecated: foo', $message); - $this->assertArrayHasKey('exception', $context); - $exception = $context['exception']; - $this->assertInstanceOf(\ErrorException::class, $exception); - $this->assertSame('User Deprecated: foo', $exception->getMessage()); - $this->assertSame(E_USER_DEPRECATED, $exception->getSeverity()); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($warnArgCheck)) - ; - - $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_USER_DEPRECATED); - $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); - - restore_error_handler(); - restore_exception_handler(); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $line = null; - $logArgCheck = function ($level, $message, $context) use (&$line) { - $this->assertEquals('Notice: Undefined variable: undefVar', $message); - $this->assertArrayHasKey('exception', $context); - $exception = $context['exception']; - $this->assertInstanceOf(SilencedErrorContext::class, $exception); - $this->assertSame(E_NOTICE, $exception->getSeverity()); - $this->assertSame(__FILE__, $exception->getFile()); - $this->assertSame($line, $exception->getLine()); - $this->assertNotEmpty($exception->getTrace()); - $this->assertSame(1, $exception->count); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler = ErrorHandler::register(); - $handler->setDefaultLogger($logger, E_NOTICE); - $handler->screamAt(E_NOTICE); - unset($undefVar); - $line = __LINE__ + 1; - @$undefVar++; - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - public function testHandleUserError() - { - try { - $handler = ErrorHandler::register(); - $handler->throwAt(0, true); - - $e = null; - $x = new \Exception('Foo'); - - try { - $f = new Fixtures\ToStringThrower($x); - $f .= ''; // Trigger $f->__toString() - } catch (\Exception $e) { - } - - $this->assertSame($x, $e); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - public function testHandleDeprecation() - { - $logArgCheck = function ($level, $message, $context) { - $this->assertEquals(LogLevel::INFO, $level); - $this->assertArrayHasKey('exception', $context); - $exception = $context['exception']; - $this->assertInstanceOf(\ErrorException::class, $exception); - $this->assertSame('User Deprecated: Foo deprecation', $exception->getMessage()); - }; - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler = new ErrorHandler(); - $handler->setDefaultLogger($logger); - @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); - } - - public function testHandleException() - { - try { - $handler = ErrorHandler::register(); - - $exception = new \Exception('foo'); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $logArgCheck = function ($level, $message, $context) { - $this->assertSame('Uncaught Exception: foo', $message); - $this->assertArrayHasKey('exception', $context); - $this->assertInstanceOf(\Exception::class, $context['exception']); - }; - - $logger - ->expects($this->exactly(2)) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler->setDefaultLogger($logger, E_ERROR); - - try { - $handler->handleException($exception); - $this->fail('Exception expected'); - } catch (\Exception $e) { - $this->assertSame($exception, $e); - } - - $handler->setExceptionHandler(function ($e) use ($exception) { - $this->assertSame($exception, $e); - }); - - $handler->handleException($exception); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - public function testErrorStacking() - { - try { - $handler = ErrorHandler::register(); - $handler->screamAt(E_USER_WARNING); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $logger - ->expects($this->exactly(2)) - ->method('log') - ->withConsecutive( - array($this->equalTo(LogLevel::WARNING), $this->equalTo('Dummy log')), - array($this->equalTo(LogLevel::DEBUG), $this->equalTo('User Warning: Silenced warning')) - ) - ; - - $handler->setDefaultLogger($logger, array(E_USER_WARNING => LogLevel::WARNING)); - - ErrorHandler::stackErrors(); - @trigger_error('Silenced warning', E_USER_WARNING); - $logger->log(LogLevel::WARNING, 'Dummy log'); - ErrorHandler::unstackErrors(); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } - - public function testBootstrappingLogger() - { - $bootLogger = new BufferingLogger(); - $handler = new ErrorHandler($bootLogger); - - $loggers = array( - E_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_USER_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_NOTICE => array($bootLogger, LogLevel::WARNING), - E_USER_NOTICE => array($bootLogger, LogLevel::WARNING), - E_STRICT => array($bootLogger, LogLevel::WARNING), - E_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_WARNING => array($bootLogger, LogLevel::WARNING), - E_COMPILE_WARNING => array($bootLogger, LogLevel::WARNING), - E_CORE_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_COMPILE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_PARSE => array($bootLogger, LogLevel::CRITICAL), - E_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_CORE_ERROR => array($bootLogger, LogLevel::CRITICAL), - ); - - $this->assertSame($loggers, $handler->setLoggers(array())); - - $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, array()); - - $logs = $bootLogger->cleanLogs(); - - $this->assertCount(1, $logs); - $log = $logs[0]; - $this->assertSame('info', $log[0]); - $this->assertSame('Deprecated: Foo message', $log[1]); - $this->assertArrayHasKey('exception', $log[2]); - $exception = $log[2]['exception']; - $this->assertInstanceOf(\ErrorException::class, $exception); - $this->assertSame('Deprecated: Foo message', $exception->getMessage()); - $this->assertSame(__FILE__, $exception->getFile()); - $this->assertSame(123, $exception->getLine()); - $this->assertSame(E_DEPRECATED, $exception->getSeverity()); - - $bootLogger->log(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); - - $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $mockLogger->expects($this->once()) - ->method('log') - ->with(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); - - $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING))); - } - - public function testSettingLoggerWhenExceptionIsBuffered() - { - $bootLogger = new BufferingLogger(); - $handler = new ErrorHandler($bootLogger); - - $exception = new \Exception('Foo message'); - - $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $mockLogger->expects($this->once()) - ->method('log') - ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', array('exception' => $exception)); - - $handler->setExceptionHandler(function () use ($handler, $mockLogger) { - $handler->setDefaultLogger($mockLogger); - }); - - $handler->handleException($exception); - } - - public function testHandleFatalError() - { - try { - $handler = ErrorHandler::register(); - - $error = array( - 'type' => E_PARSE, - 'message' => 'foo', - 'file' => 'bar', - 'line' => 123, - ); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $logArgCheck = function ($level, $message, $context) { - $this->assertEquals('Fatal Parse Error: foo', $message); - $this->assertArrayHasKey('exception', $context); - $this->assertInstanceOf(\Exception::class, $context['exception']); - }; - - $logger - ->expects($this->once()) - ->method('log') - ->will($this->returnCallback($logArgCheck)) - ; - - $handler->setDefaultLogger($logger, E_PARSE); - - $handler->handleFatalError($error); - - restore_error_handler(); - restore_exception_handler(); - } catch (\Exception $e) { - restore_error_handler(); - restore_exception_handler(); - - throw $e; - } - } - - /** - * @requires PHP 7 - */ - public function testHandleErrorException() - { - $exception = new \Error("Class 'Foo' not found"); - - $handler = new ErrorHandler(); - $handler->setExceptionHandler(function () use (&$args) { - $args = func_get_args(); - }); - - $handler->handleException($exception); - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]); - $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage()); - } - - public function testHandleFatalErrorOnHHVM() - { - try { - $handler = ErrorHandler::register(); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger - ->expects($this->once()) - ->method('log') - ->with( - $this->equalTo(LogLevel::CRITICAL), - $this->equalTo('Fatal Error: foo') - ) - ; - - $handler->setDefaultLogger($logger, E_ERROR); - - $error = array( - 'type' => E_ERROR + 0x1000000, // This error level is used by HHVM for fatal errors - 'message' => 'foo', - 'file' => 'bar', - 'line' => 123, - 'context' => array(123), - 'backtrace' => array(456), - ); - - call_user_func_array(array($handler, 'handleError'), $error); - $handler->handleFatalError($error); - } finally { - restore_error_handler(); - restore_exception_handler(); - } - } -} diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php deleted file mode 100644 index e7762bd..0000000 --- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php +++ /dev/null @@ -1,301 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests\Exception; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; -use Symfony\Component\HttpKernel\Exception\ConflictHttpException; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\HttpKernel\Exception\GoneHttpException; -use Symfony\Component\HttpKernel\Exception\LengthRequiredHttpException; -use Symfony\Component\HttpKernel\Exception\PreconditionFailedHttpException; -use Symfony\Component\HttpKernel\Exception\PreconditionRequiredHttpException; -use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; -use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; -use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; - -class FlattenExceptionTest extends TestCase -{ - public function testStatusCode() - { - $flattened = FlattenException::create(new \RuntimeException(), 403); - $this->assertEquals('403', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new \RuntimeException()); - $this->assertEquals('500', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new NotFoundHttpException()); - $this->assertEquals('404', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"')); - $this->assertEquals('401', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new BadRequestHttpException()); - $this->assertEquals('400', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new NotAcceptableHttpException()); - $this->assertEquals('406', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new ConflictHttpException()); - $this->assertEquals('409', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); - $this->assertEquals('405', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new AccessDeniedHttpException()); - $this->assertEquals('403', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new GoneHttpException()); - $this->assertEquals('410', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new LengthRequiredHttpException()); - $this->assertEquals('411', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new PreconditionFailedHttpException()); - $this->assertEquals('412', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new PreconditionRequiredHttpException()); - $this->assertEquals('428', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new ServiceUnavailableHttpException()); - $this->assertEquals('503', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new TooManyRequestsHttpException()); - $this->assertEquals('429', $flattened->getStatusCode()); - - $flattened = FlattenException::create(new UnsupportedMediaTypeHttpException()); - $this->assertEquals('415', $flattened->getStatusCode()); - - if (class_exists(SuspiciousOperationException::class)) { - $flattened = FlattenException::create(new SuspiciousOperationException()); - $this->assertEquals('400', $flattened->getStatusCode()); - } - } - - public function testHeadersForHttpException() - { - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); - $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); - - $flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"')); - $this->assertEquals(array('WWW-Authenticate' => 'Basic realm="My Realm"'), $flattened->getHeaders()); - - $flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); - - $flattened = FlattenException::create(new ServiceUnavailableHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); - - $flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); - - $flattened = FlattenException::create(new TooManyRequestsHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); - } - - /** - * @dataProvider flattenDataProvider - */ - public function testFlattenHttpException(\Exception $exception, $statusCode) - { - $flattened = FlattenException::create($exception); - $flattened2 = FlattenException::create($exception); - - $flattened->setPrevious($flattened2); - - $this->assertEquals($exception->getMessage(), $flattened->getMessage(), 'The message is copied from the original exception.'); - $this->assertEquals($exception->getCode(), $flattened->getCode(), 'The code is copied from the original exception.'); - $this->assertInstanceOf($flattened->getClass(), $exception, 'The class is set to the class of the original exception'); - } - - /** - * @dataProvider flattenDataProvider - */ - public function testPrevious(\Exception $exception, $statusCode) - { - $flattened = FlattenException::create($exception); - $flattened2 = FlattenException::create($exception); - - $flattened->setPrevious($flattened2); - - $this->assertSame($flattened2, $flattened->getPrevious()); - - $this->assertSame(array($flattened2), $flattened->getAllPrevious()); - } - - /** - * @requires PHP 7.0 - */ - public function testPreviousError() - { - $exception = new \Exception('test', 123, new \ParseError('Oh noes!', 42)); - - $flattened = FlattenException::create($exception)->getPrevious(); - - $this->assertEquals($flattened->getMessage(), 'Parse error: Oh noes!', 'The message is copied from the original exception.'); - $this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.'); - $this->assertEquals($flattened->getClass(), 'Symfony\Component\Debug\Exception\FatalThrowableError', 'The class is set to the class of the original exception'); - } - - /** - * @dataProvider flattenDataProvider - */ - public function testLine(\Exception $exception) - { - $flattened = FlattenException::create($exception); - $this->assertSame($exception->getLine(), $flattened->getLine()); - } - - /** - * @dataProvider flattenDataProvider - */ - public function testFile(\Exception $exception) - { - $flattened = FlattenException::create($exception); - $this->assertSame($exception->getFile(), $flattened->getFile()); - } - - /** - * @dataProvider flattenDataProvider - */ - public function testToArray(\Exception $exception, $statusCode) - { - $flattened = FlattenException::create($exception); - $flattened->setTrace(array(), 'foo.php', 123); - - $this->assertEquals(array( - array( - 'message' => 'test', - 'class' => 'Exception', - 'trace' => array(array( - 'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123, - 'args' => array(), - )), - ), - ), $flattened->toArray()); - } - - public function flattenDataProvider() - { - return array( - array(new \Exception('test', 123), 500), - ); - } - - public function testArguments() - { - $dh = opendir(__DIR__); - $fh = tmpfile(); - - $incomplete = unserialize('O:14:"BogusTestClass":0:{}'); - - $exception = $this->createException(array( - (object) array('foo' => 1), - new NotFoundHttpException(), - $incomplete, - $dh, - $fh, - function () {}, - array(1, 2), - array('foo' => 123), - null, - true, - false, - 0, - 0.0, - '0', - '', - INF, - NAN, - )); - - $flattened = FlattenException::create($exception); - $trace = $flattened->getTrace(); - $args = $trace[1]['args']; - $array = $args[0][1]; - - closedir($dh); - fclose($fh); - - $i = 0; - $this->assertSame(array('object', 'stdClass'), $array[$i++]); - $this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]); - $this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]); - $this->assertSame(array('resource', defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]); - $this->assertSame(array('resource', 'stream'), $array[$i++]); - - $args = $array[$i++]; - $this->assertSame($args[0], 'object'); - $this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.'); - - $this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]); - $this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]); - $this->assertSame(array('null', null), $array[$i++]); - $this->assertSame(array('boolean', true), $array[$i++]); - $this->assertSame(array('boolean', false), $array[$i++]); - $this->assertSame(array('integer', 0), $array[$i++]); - $this->assertSame(array('float', 0.0), $array[$i++]); - $this->assertSame(array('string', '0'), $array[$i++]); - $this->assertSame(array('string', ''), $array[$i++]); - $this->assertSame(array('float', INF), $array[$i++]); - - // assertEquals() does not like NAN values. - $this->assertEquals($array[$i][0], 'float'); - $this->assertTrue(is_nan($array[$i++][1])); - } - - public function testRecursionInArguments() - { - $a = array('foo', array(2, &$a)); - $exception = $this->createException($a); - - $flattened = FlattenException::create($exception); - $trace = $flattened->getTrace(); - $this->assertContains('*DEEP NESTED ARRAY*', serialize($trace)); - } - - public function testTooBigArray() - { - $a = array(); - for ($i = 0; $i < 20; ++$i) { - for ($j = 0; $j < 50; ++$j) { - for ($k = 0; $k < 10; ++$k) { - $a[$i][$j][$k] = 'value'; - } - } - } - $a[20] = 'value'; - $a[21] = 'value1'; - $exception = $this->createException($a); - - $flattened = FlattenException::create($exception); - $trace = $flattened->getTrace(); - - $this->assertSame($trace[1]['args'][0], array('array', array('array', '*SKIPPED over 10000 entries*'))); - - $serializeTrace = serialize($trace); - - $this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace); - $this->assertNotContains('*value1*', $serializeTrace); - } - - private function createException($foo) - { - return new \Exception(); - } -} diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php deleted file mode 100644 index 0285eff..0000000 --- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; - -require_once __DIR__.'/HeaderMock.php'; - -class ExceptionHandlerTest extends TestCase -{ - protected function setUp() - { - testHeader(); - } - - protected function tearDown() - { - testHeader(); - } - - public function testDebug() - { - $handler = new ExceptionHandler(false); - - ob_start(); - $handler->sendPhpResponse(new \RuntimeException('Foo')); - $response = ob_get_clean(); - - $this->assertContains('Whoops, looks like something went wrong.', $response); - $this->assertNotContains('
    ', $response); - - $handler = new ExceptionHandler(true); - - ob_start(); - $handler->sendPhpResponse(new \RuntimeException('Foo')); - $response = ob_get_clean(); - - $this->assertContains('Whoops, looks like something went wrong.', $response); - $this->assertContains('
    ', $response); - } - - public function testStatusCode() - { - $handler = new ExceptionHandler(false, 'iso8859-1'); - - ob_start(); - $handler->sendPhpResponse(new NotFoundHttpException('Foo')); - $response = ob_get_clean(); - - $this->assertContains('Sorry, the page you are looking for could not be found.', $response); - - $expectedHeaders = array( - array('HTTP/1.0 404', true, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); - - $this->assertSame($expectedHeaders, testHeader()); - } - - public function testHeaders() - { - $handler = new ExceptionHandler(false, 'iso8859-1'); - - ob_start(); - $handler->sendPhpResponse(new MethodNotAllowedHttpException(array('POST'))); - $response = ob_get_clean(); - - $expectedHeaders = array( - array('HTTP/1.0 405', true, null), - array('Allow: POST', false, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); - - $this->assertSame($expectedHeaders, testHeader()); - } - - public function testNestedExceptions() - { - $handler = new ExceptionHandler(true); - ob_start(); - $handler->sendPhpResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar'))); - $response = ob_get_clean(); - - $this->assertStringMatchesFormat('%A

    Foo

    %A

    Bar

    %A', $response); - } - - public function testHandle() - { - $exception = new \Exception('foo'); - - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); - $handler - ->expects($this->exactly(2)) - ->method('sendPhpResponse'); - - $handler->handle($exception); - - $handler->setHandler(function ($e) use ($exception) { - $this->assertSame($exception, $e); - }); - - $handler->handle($exception); - } - - public function testHandleOutOfMemoryException() - { - $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); - - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); - $handler - ->expects($this->once()) - ->method('sendPhpResponse'); - - $handler->setHandler(function ($e) { - $this->fail('OutOfMemoryException should bypass the handler'); - }); - - $handler->handle($exception); - } -} diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php deleted file mode 100644 index 65c80fc..0000000 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ /dev/null @@ -1,176 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests\FatalErrorHandler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; -use Symfony\Component\Debug\DebugClassLoader; -use Composer\Autoload\ClassLoader as ComposerClassLoader; - -class ClassNotFoundFatalErrorHandlerTest extends TestCase -{ - public static function setUpBeforeClass() - { - foreach (spl_autoload_functions() as $function) { - if (!is_array($function)) { - continue; - } - - // get class loaders wrapped by DebugClassLoader - if ($function[0] instanceof DebugClassLoader) { - $function = $function[0]->getClassLoader(); - } - - if ($function[0] instanceof ComposerClassLoader) { - $function[0]->add('Symfony_Component_Debug_Tests_Fixtures', dirname(dirname(dirname(dirname(dirname(__DIR__)))))); - break; - } - } - } - - /** - * @dataProvider provideClassNotFoundData - */ - public function testHandleClassNotFound($error, $translatedMessage, $autoloader = null) - { - if ($autoloader) { - // Unregister all autoloaders to ensure the custom provided - // autoloader is the only one to be used during the test run. - $autoloaders = spl_autoload_functions(); - array_map('spl_autoload_unregister', $autoloaders); - spl_autoload_register($autoloader); - } - - $handler = new ClassNotFoundFatalErrorHandler(); - - $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); - - if ($autoloader) { - spl_autoload_unregister($autoloader); - array_map('spl_autoload_register', $autoloaders); - } - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception); - $this->assertSame($translatedMessage, $exception->getMessage()); - $this->assertSame($error['type'], $exception->getSeverity()); - $this->assertSame($error['file'], $exception->getFile()); - $this->assertSame($error['line'], $exception->getLine()); - } - - public function provideClassNotFoundData() - { - $autoloader = new ComposerClassLoader(); - $autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception')); - - $debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass')); - - return array( - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'WhizBangFactory\' not found', - ), - "Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found', - ), - "Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'UndefinedFunctionException\' not found', - ), - "Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'PEARClass\' not found', - ), - "Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($autoloader, 'loadClass'), - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($debugClassLoader, 'loadClass'), - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), - "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", - function ($className) { /* do nothing here */ }, - ), - ); - } - - public function testCannotRedeclareClass() - { - if (!file_exists(__DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP')) { - $this->markTestSkipped('Can only be run on case insensitive filesystems'); - } - - require_once __DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP'; - - $error = array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Class \'Foo\\Bar\\RequiredTwice\' not found', - ); - - $handler = new ClassNotFoundFatalErrorHandler(); - $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception); - } -} diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php deleted file mode 100644 index 1dc2120..0000000 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests\FatalErrorHandler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; - -class UndefinedFunctionFatalErrorHandlerTest extends TestCase -{ - /** - * @dataProvider provideUndefinedFunctionData - */ - public function testUndefinedFunction($error, $translatedMessage) - { - $handler = new UndefinedFunctionFatalErrorHandler(); - $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception); - // class names are case insensitive and PHP/HHVM do not return the same - $this->assertSame(strtolower($translatedMessage), strtolower($exception->getMessage())); - $this->assertSame($error['type'], $exception->getSeverity()); - $this->assertSame($error['file'], $exception->getFile()); - $this->assertSame($error['line'], $exception->getLine()); - } - - public function provideUndefinedFunctionData() - { - return array( - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined function test_namespaced_function()', - ), - "Attempted to call function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined function Foo\\Bar\\Baz\\test_namespaced_function()', - ), - "Attempted to call function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined function foo()', - ), - 'Attempted to call function "foo" from the global namespace.', - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined function Foo\\Bar\\Baz\\foo()', - ), - 'Attempted to call function "foo" from namespace "Foo\Bar\Baz".', - ), - ); - } -} - -function test_namespaced_function() -{ -} diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php deleted file mode 100644 index 739e5b2..0000000 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests\FatalErrorHandler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; - -class UndefinedMethodFatalErrorHandlerTest extends TestCase -{ - /** - * @dataProvider provideUndefinedMethodData - */ - public function testUndefinedMethod($error, $translatedMessage) - { - $handler = new UndefinedMethodFatalErrorHandler(); - $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); - - $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception); - $this->assertSame($translatedMessage, $exception->getMessage()); - $this->assertSame($error['type'], $exception->getSeverity()); - $this->assertSame($error['file'], $exception->getFile()); - $this->assertSame($error['line'], $exception->getLine()); - } - - public function provideUndefinedMethodData() - { - return array( - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::what()', - ), - 'Attempted to call an undefined method named "what" of class "SplObjectStorage".', - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::walid()', - ), - "Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", - ), - array( - array( - 'type' => 1, - 'line' => 12, - 'file' => 'foo.php', - 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', - ), - "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", - ), - array( - array( - 'type' => 1, - 'message' => 'Call to undefined method class@anonymous::test()', - 'file' => '/home/possum/work/symfony/test.php', - 'line' => 11, - ), - 'Attempted to call an undefined method named "test" of class "class@anonymous".', - ), - ); - } -} diff --git a/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php b/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php deleted file mode 100644 index 9d6dbaa..0000000 --- a/vendor/symfony/debug/Tests/Fixtures/ClassAlias.php +++ /dev/null @@ -1,3 +0,0 @@ -exception = $e; - } - - public function __toString() - { - try { - throw $this->exception; - } catch (\Exception $e) { - // Using user_error() here is on purpose so we do not forget - // that this alias also should work alongside with trigger_error(). - return user_error($e, E_USER_ERROR); - } - } -} diff --git a/vendor/symfony/debug/Tests/Fixtures/casemismatch.php b/vendor/symfony/debug/Tests/Fixtures/casemismatch.php deleted file mode 100644 index 691d660..0000000 --- a/vendor/symfony/debug/Tests/Fixtures/casemismatch.php +++ /dev/null @@ -1,7 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug; - -function headers_sent() -{ - return false; -} - -function header($str, $replace = true, $status = null) -{ - Tests\testHeader($str, $replace, $status); -} - -namespace Symfony\Component\Debug\Tests; - -function testHeader() -{ - static $headers = array(); - - if (!$h = func_get_args()) { - $h = $headers; - $headers = array(); - - return $h; - } - - $headers[] = func_get_args(); -} diff --git a/vendor/symfony/debug/Tests/MockExceptionHandler.php b/vendor/symfony/debug/Tests/MockExceptionHandler.php deleted file mode 100644 index 2d6ce56..0000000 --- a/vendor/symfony/debug/Tests/MockExceptionHandler.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Debug\Tests; - -use Symfony\Component\Debug\ExceptionHandler; - -class MockExceptionHandler extends ExceptionHandler -{ - public $e; - - public function handle(\Exception $e) - { - $this->e = $e; - } -} diff --git a/vendor/symfony/debug/composer.json b/vendor/symfony/debug/composer.json deleted file mode 100644 index 38323dd..0000000 --- a/vendor/symfony/debug/composer.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "symfony/debug", - "type": "library", - "description": "Symfony Debug Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Debug\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/debug/phpunit.xml.dist b/vendor/symfony/debug/phpunit.xml.dist deleted file mode 100644 index 12e5861..0000000 --- a/vendor/symfony/debug/phpunit.xml.dist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - ./Tests/ - - - ./Resources/ext/tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - diff --git a/vendor/symfony/event-dispatcher/.gitignore b/vendor/symfony/event-dispatcher/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/event-dispatcher/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/event-dispatcher/CHANGELOG.md b/vendor/symfony/event-dispatcher/CHANGELOG.md deleted file mode 100644 index 736bd84..0000000 --- a/vendor/symfony/event-dispatcher/CHANGELOG.md +++ /dev/null @@ -1,37 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - - * The ContainerAwareEventDispatcher class has been deprecated. Use EventDispatcher with closure factories instead. - -3.0.0 ------ - - * The method `getListenerPriority($eventName, $listener)` has been added to the - `EventDispatcherInterface`. - * The methods `Event::setDispatcher()`, `Event::getDispatcher()`, `Event::setName()` - and `Event::getName()` have been removed. - The event dispatcher and the event name are passed to the listener call. - -2.5.0 ------ - - * added Debug\TraceableEventDispatcher (originally in HttpKernel) - * changed Debug\TraceableEventDispatcherInterface to extend EventDispatcherInterface - * added RegisterListenersPass (originally in HttpKernel) - -2.1.0 ------ - - * added TraceableEventDispatcherInterface - * added ContainerAwareEventDispatcher - * added a reference to the EventDispatcher on the Event - * added a reference to the Event name on the event - * added fluid interface to the dispatch() method which now returns the Event - object - * added GenericEvent event class - * added the possibility for subscribers to subscribe several times for the - same event - * added ImmutableEventDispatcher diff --git a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php deleted file mode 100644 index bfbccf9..0000000 --- a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php +++ /dev/null @@ -1,209 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Lazily loads listeners and subscribers from the dependency injection - * container. - * - * @author Fabien Potencier - * @author Bernhard Schussek - * @author Jordan Alliot - * - * @deprecated since 3.3, to be removed in 4.0. Use EventDispatcher with closure factories instead. - */ -class ContainerAwareEventDispatcher extends EventDispatcher -{ - /** - * The container from where services are loaded. - * - * @var ContainerInterface - */ - private $container; - - /** - * The service IDs of the event listeners and subscribers. - * - * @var array - */ - private $listenerIds = array(); - - /** - * The services registered as listeners. - * - * @var array - */ - private $listeners = array(); - - /** - * @param ContainerInterface $container A ContainerInterface instance - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - - $class = get_class($this); - if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) { - $class = get_parent_class($class); - } - if (__CLASS__ !== $class) { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); - } - } - - /** - * Adds a service as event listener. - * - * @param string $eventName Event for which the listener is added - * @param array $callback The service ID of the listener service & the method - * name that has to be called - * @param int $priority The higher this value, the earlier an event listener - * will be triggered in the chain. - * Defaults to 0. - * - * @throws \InvalidArgumentException - */ - public function addListenerService($eventName, $callback, $priority = 0) - { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); - - if (!is_array($callback) || 2 !== count($callback)) { - throw new \InvalidArgumentException('Expected an array("service", "method") argument'); - } - - $this->listenerIds[$eventName][] = array($callback[0], $callback[1], $priority); - } - - public function removeListener($eventName, $listener) - { - $this->lazyLoad($eventName); - - if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) { - $key = $serviceId.'.'.$method; - if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) { - unset($this->listeners[$eventName][$key]); - if (empty($this->listeners[$eventName])) { - unset($this->listeners[$eventName]); - } - unset($this->listenerIds[$eventName][$i]); - if (empty($this->listenerIds[$eventName])) { - unset($this->listenerIds[$eventName]); - } - } - } - } - - parent::removeListener($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - if (null === $eventName) { - return $this->listenerIds || $this->listeners || parent::hasListeners(); - } - - if (isset($this->listenerIds[$eventName])) { - return true; - } - - return parent::hasListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - if (null === $eventName) { - foreach ($this->listenerIds as $serviceEventName => $args) { - $this->lazyLoad($serviceEventName); - } - } else { - $this->lazyLoad($eventName); - } - - return parent::getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function getListenerPriority($eventName, $listener) - { - $this->lazyLoad($eventName); - - return parent::getListenerPriority($eventName, $listener); - } - - /** - * Adds a service as event subscriber. - * - * @param string $serviceId The service ID of the subscriber service - * @param string $class The service's class name (which must implement EventSubscriberInterface) - */ - public function addSubscriberService($serviceId, $class) - { - @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); - - foreach ($class::getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->listenerIds[$eventName][] = array($serviceId, $params, 0); - } elseif (is_string($params[0])) { - $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0); - } else { - foreach ($params as $listener) { - $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0); - } - } - } - } - - public function getContainer() - { - @trigger_error('The '.__METHOD__.'() method is deprecated since version 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED); - - return $this->container; - } - - /** - * Lazily loads listeners for this event from the dependency injection - * container. - * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - */ - protected function lazyLoad($eventName) - { - if (isset($this->listenerIds[$eventName])) { - foreach ($this->listenerIds[$eventName] as list($serviceId, $method, $priority)) { - $listener = $this->container->get($serviceId); - - $key = $serviceId.'.'.$method; - if (!isset($this->listeners[$eventName][$key])) { - $this->addListener($eventName, array($listener, $method), $priority); - } elseif ($this->listeners[$eventName][$key] !== $listener) { - parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method)); - $this->addListener($eventName, array($listener, $method), $priority); - } - - $this->listeners[$eventName][$key] = $listener; - } - } - } -} diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php deleted file mode 100644 index 3f1035e..0000000 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\Stopwatch\Stopwatch; -use Psr\Log\LoggerInterface; - -/** - * Collects some data about event listeners. - * - * This event dispatcher delegates the dispatching to another one. - * - * @author Fabien Potencier - */ -class TraceableEventDispatcher implements TraceableEventDispatcherInterface -{ - protected $logger; - protected $stopwatch; - - private $called; - private $dispatcher; - private $wrappedListeners; - - /** - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null) - { - $this->dispatcher = $dispatcher; - $this->stopwatch = $stopwatch; - $this->logger = $logger; - $this->called = array(); - $this->wrappedListeners = array(); - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - $this->dispatcher->addListener($eventName, $listener, $priority); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->dispatcher->addSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener) { - $listener = $wrappedListener; - unset($this->wrappedListeners[$eventName][$index]); - break; - } - } - } - - return $this->dispatcher->removeListener($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - return $this->dispatcher->removeSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function getListenerPriority($eventName, $listener) - { - // we might have wrapped listeners for the event (if called while dispatching) - // in that case get the priority by wrapper - if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener) { - return $this->dispatcher->getListenerPriority($eventName, $wrappedListener); - } - } - } - - return $this->dispatcher->getListenerPriority($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - return $this->dispatcher->hasListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - if (null === $event) { - $event = new Event(); - } - - if (null !== $this->logger && $event->isPropagationStopped()) { - $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); - } - - $this->preProcess($eventName); - $this->preDispatch($eventName, $event); - - $e = $this->stopwatch->start($eventName, 'section'); - - $this->dispatcher->dispatch($eventName, $event); - - if ($e->isStarted()) { - $e->stop(); - } - - $this->postDispatch($eventName, $event); - $this->postProcess($eventName); - - return $event; - } - - /** - * {@inheritdoc} - */ - public function getCalledListeners() - { - $called = array(); - foreach ($this->called as $eventName => $listeners) { - foreach ($listeners as $listener) { - $called[$eventName.'.'.$listener->getPretty()] = $listener->getInfo($eventName); - } - } - - return $called; - } - - /** - * {@inheritdoc} - */ - public function getNotCalledListeners() - { - try { - $allListeners = $this->getListeners(); - } catch (\Exception $e) { - if (null !== $this->logger) { - $this->logger->info('An exception was thrown while getting the uncalled listeners.', array('exception' => $e)); - } - - // unable to retrieve the uncalled listeners - return array(); - } - - $notCalled = array(); - foreach ($allListeners as $eventName => $listeners) { - foreach ($listeners as $listener) { - $called = false; - if (isset($this->called[$eventName])) { - foreach ($this->called[$eventName] as $l) { - if ($l->getWrappedListener() === $listener) { - $called = true; - - break; - } - } - } - - if (!$called) { - if (!$listener instanceof WrappedListener) { - $listener = new WrappedListener($listener, null, $this->stopwatch, $this); - } - $notCalled[$eventName.'.'.$listener->getPretty()] = $listener->getInfo($eventName); - } - } - } - - uasort($notCalled, array($this, 'sortListenersByPriority')); - - return $notCalled; - } - - /** - * Proxies all method calls to the original event dispatcher. - * - * @param string $method The method name - * @param array $arguments The method arguments - * - * @return mixed - */ - public function __call($method, $arguments) - { - return call_user_func_array(array($this->dispatcher, $method), $arguments); - } - - /** - * Called before dispatching the event. - * - * @param string $eventName The event name - * @param Event $event The event - */ - protected function preDispatch($eventName, Event $event) - { - } - - /** - * Called after dispatching the event. - * - * @param string $eventName The event name - * @param Event $event The event - */ - protected function postDispatch($eventName, Event $event) - { - } - - private function preProcess($eventName) - { - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - $priority = $this->getListenerPriority($eventName, $listener); - $wrappedListener = new WrappedListener($listener, null, $this->stopwatch, $this); - $this->wrappedListeners[$eventName][] = $wrappedListener; - $this->dispatcher->removeListener($eventName, $listener); - $this->dispatcher->addListener($eventName, $wrappedListener, $priority); - } - } - - private function postProcess($eventName) - { - unset($this->wrappedListeners[$eventName]); - $skipped = false; - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - if (!$listener instanceof WrappedListener) { // #12845: a new listener was added during dispatch. - continue; - } - // Unwrap listener - $priority = $this->getListenerPriority($eventName, $listener); - $this->dispatcher->removeListener($eventName, $listener); - $this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority); - - if (null !== $this->logger) { - $context = array('event' => $eventName, 'listener' => $listener->getPretty()); - } - - if ($listener->wasCalled()) { - if (null !== $this->logger) { - $this->logger->debug('Notified event "{event}" to listener "{listener}".', $context); - } - - if (!isset($this->called[$eventName])) { - $this->called[$eventName] = new \SplObjectStorage(); - } - - $this->called[$eventName]->attach($listener); - } - - if (null !== $this->logger && $skipped) { - $this->logger->debug('Listener "{listener}" was not called for event "{event}".', $context); - } - - if ($listener->stoppedPropagation()) { - if (null !== $this->logger) { - $this->logger->debug('Listener "{listener}" stopped propagation of the event "{event}".', $context); - } - - $skipped = true; - } - } - } - - private function sortListenersByPriority($a, $b) - { - if (is_int($a['priority']) && !is_int($b['priority'])) { - return 1; - } - - if (!is_int($a['priority']) && is_int($b['priority'])) { - return -1; - } - - if ($a['priority'] === $b['priority']) { - return 0; - } - - if ($a['priority'] > $b['priority']) { - return -1; - } - - return 1; - } -} diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php deleted file mode 100644 index 5483e81..0000000 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * @author Fabien Potencier - */ -interface TraceableEventDispatcherInterface extends EventDispatcherInterface -{ - /** - * Gets the called listeners. - * - * @return array An array of called listeners - */ - public function getCalledListeners(); - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - */ - public function getNotCalledListeners(); -} diff --git a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php deleted file mode 100644 index f7b0273..0000000 --- a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\VarDumper\Caster\ClassStub; - -/** - * @author Fabien Potencier - */ -class WrappedListener -{ - private $listener; - private $name; - private $called; - private $stoppedPropagation; - private $stopwatch; - private $dispatcher; - private $pretty; - private $stub; - private static $hasClassStub; - - public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null) - { - $this->listener = $listener; - $this->name = $name; - $this->stopwatch = $stopwatch; - $this->dispatcher = $dispatcher; - $this->called = false; - $this->stoppedPropagation = false; - - if (is_array($listener)) { - $this->name = is_object($listener[0]) ? get_class($listener[0]) : $listener[0]; - $this->pretty = $this->name.'::'.$listener[1]; - } elseif ($listener instanceof \Closure) { - $this->pretty = $this->name = 'closure'; - } elseif (is_string($listener)) { - $this->pretty = $this->name = $listener; - } else { - $this->name = get_class($listener); - $this->pretty = $this->name.'::__invoke'; - } - - if (null !== $name) { - $this->name = $name; - } - - if (null === self::$hasClassStub) { - self::$hasClassStub = class_exists(ClassStub::class); - } - } - - public function getWrappedListener() - { - return $this->listener; - } - - public function wasCalled() - { - return $this->called; - } - - public function stoppedPropagation() - { - return $this->stoppedPropagation; - } - - public function getPretty() - { - return $this->pretty; - } - - public function getInfo($eventName) - { - if (null === $this->stub) { - $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()'; - } - - return array( - 'event' => $eventName, - 'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null, - 'pretty' => $this->pretty, - 'stub' => $this->stub, - ); - } - - public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher) - { - $this->called = true; - - $e = $this->stopwatch->start($this->name, 'event_listener'); - - call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher); - - if ($e->isStarted()) { - $e->stop(); - } - - if ($event->isPropagationStopped()) { - $this->stoppedPropagation = true; - } - } -} diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php deleted file mode 100644 index 887a7ec..0000000 --- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\DependencyInjection; - -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Compiler pass to register tagged services for an event dispatcher. - */ -class RegisterListenersPass implements CompilerPassInterface -{ - /** - * @var string - */ - protected $dispatcherService; - - /** - * @var string - */ - protected $listenerTag; - - /** - * @var string - */ - protected $subscriberTag; - - /** - * @param string $dispatcherService Service name of the event dispatcher in processed container - * @param string $listenerTag Tag name used for listener - * @param string $subscriberTag Tag name used for subscribers - */ - public function __construct($dispatcherService = 'event_dispatcher', $listenerTag = 'kernel.event_listener', $subscriberTag = 'kernel.event_subscriber') - { - $this->dispatcherService = $dispatcherService; - $this->listenerTag = $listenerTag; - $this->subscriberTag = $subscriberTag; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition($this->dispatcherService) && !$container->hasAlias($this->dispatcherService)) { - return; - } - - $definition = $container->findDefinition($this->dispatcherService); - - foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) { - foreach ($events as $event) { - $priority = isset($event['priority']) ? $event['priority'] : 0; - - if (!isset($event['event'])) { - throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag)); - } - - if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback(array( - '/(?<=\b)[a-z]/i', - '/[^a-z0-9]/i', - ), function ($matches) { return strtoupper($matches[0]); }, $event['event']); - $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); - } - - $definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority)); - } - } - - $extractingDispatcher = new ExtractingEventDispatcher(); - - foreach ($container->findTaggedServiceIds($this->subscriberTag, true) as $id => $attributes) { - $def = $container->getDefinition($id); - - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $container->getParameterBag()->resolveValue($def->getClass()); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - - if (!is_subclass_of($class, $interface)) { - if (!class_exists($class, false)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } - - throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface)); - } - $container->addObjectResource($class); - - ExtractingEventDispatcher::$subscriber = $class; - $extractingDispatcher->addSubscriber($extractingDispatcher); - foreach ($extractingDispatcher->listeners as $args) { - $args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]); - $definition->addMethodCall('addListener', $args); - } - $extractingDispatcher->listeners = array(); - } - } -} - -/** - * @internal - */ -class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface -{ - public $listeners = array(); - - public static $subscriber; - - public function addListener($eventName, $listener, $priority = 0) - { - $this->listeners[] = array($eventName, $listener[1], $priority); - } - - public static function getSubscribedEvents() - { - $callback = array(self::$subscriber, 'getSubscribedEvents'); - - return $callback(); - } -} diff --git a/vendor/symfony/event-dispatcher/Event.php b/vendor/symfony/event-dispatcher/Event.php deleted file mode 100644 index 9c56b2f..0000000 --- a/vendor/symfony/event-dispatcher/Event.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - */ -class Event -{ - /** - * @var bool Whether no further event listeners should be triggered - */ - private $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - * - * @see Event::stopPropagation() - * - * @return bool Whether propagation was already stopped for this event - */ - public function isPropagationStopped() - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - public function stopPropagation() - { - $this->propagationStopped = true; - } -} diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php deleted file mode 100644 index 4630b01..0000000 --- a/vendor/symfony/event-dispatcher/EventDispatcher.php +++ /dev/null @@ -1,236 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Fabien Potencier - * @author Jordi Boggiano - * @author Jordan Alliot - * @author Nicolas Grekas - */ -class EventDispatcher implements EventDispatcherInterface -{ - private $listeners = array(); - private $sorted = array(); - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - if (null === $event) { - $event = new Event(); - } - - if ($listeners = $this->getListeners($eventName)) { - $this->doDispatch($listeners, $eventName, $event); - } - - return $event; - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - if (null !== $eventName) { - if (empty($this->listeners[$eventName])) { - return array(); - } - - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - - return $this->sorted[$eventName]; - } - - foreach ($this->listeners as $eventName => $eventListeners) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - } - - return array_filter($this->sorted); - } - - /** - * {@inheritdoc} - */ - public function getListenerPriority($eventName, $listener) - { - if (empty($this->listeners[$eventName])) { - return; - } - - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { - $listener[0] = $listener[0](); - } - - foreach ($this->listeners[$eventName] as $priority => $listeners) { - foreach ($listeners as $k => $v) { - if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { - $v[0] = $v[0](); - $this->listeners[$eventName][$priority][$k] = $v; - } - if ($v === $listener) { - return $priority; - } - } - } - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - if (null !== $eventName) { - return !empty($this->listeners[$eventName]); - } - - foreach ($this->listeners as $eventListeners) { - if ($eventListeners) { - return true; - } - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - $this->listeners[$eventName][$priority][] = $listener; - unset($this->sorted[$eventName]); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - if (empty($this->listeners[$eventName])) { - return; - } - - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { - $listener[0] = $listener[0](); - } - - foreach ($this->listeners[$eventName] as $priority => $listeners) { - foreach ($listeners as $k => $v) { - if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { - $v[0] = $v[0](); - } - if ($v === $listener) { - unset($listeners[$k], $this->sorted[$eventName]); - } else { - $listeners[$k] = $v; - } - } - - if ($listeners) { - $this->listeners[$eventName][$priority] = $listeners; - } else { - unset($this->listeners[$eventName][$priority]); - } - } - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { - $this->addListener($eventName, array($subscriber, $params)); - } elseif (is_string($params[0])) { - $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0); - } else { - foreach ($params as $listener) { - $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); - } - } - } - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_array($params) && is_array($params[0])) { - foreach ($params as $listener) { - $this->removeListener($eventName, array($subscriber, $listener[0])); - } - } else { - $this->removeListener($eventName, array($subscriber, is_string($params) ? $params : $params[0])); - } - } - } - - /** - * Triggers the listeners of an event. - * - * This method can be overridden to add functionality that is executed - * for each listener. - * - * @param callable[] $listeners The event listeners - * @param string $eventName The name of the event to dispatch - * @param Event $event The event object to pass to the event handlers/listeners - */ - protected function doDispatch($listeners, $eventName, Event $event) - { - foreach ($listeners as $listener) { - if ($event->isPropagationStopped()) { - break; - } - call_user_func($listener, $event, $eventName, $this); - } - } - - /** - * Sorts the internal list of listeners for the given event by priority. - * - * @param string $eventName The name of the event - */ - private function sortListeners($eventName) - { - krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = array(); - - foreach ($this->listeners[$eventName] as $priority => $listeners) { - foreach ($listeners as $k => $listener) { - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { - $listener[0] = $listener[0](); - $this->listeners[$eventName][$priority][$k] = $listener; - } - $this->sorted[$eventName][] = $listener; - } - } - } -} diff --git a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php deleted file mode 100644 index 6e0b11f..0000000 --- a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Bernhard Schussek - */ -interface EventDispatcherInterface -{ - /** - * Dispatches an event to all registered listeners. - * - * @param string $eventName The name of the event to dispatch. The name of - * the event is the name of the method that is - * invoked on listeners. - * @param Event $event the event to pass to the event handlers/listeners - * If not supplied, an empty Event instance is created - * - * @return Event - */ - public function dispatch($eventName, Event $event = null); - - /** - * Adds an event listener that listens on the specified events. - * - * @param string $eventName The event to listen on - * @param callable $listener The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - */ - public function addListener($eventName, $listener, $priority = 0); - - /** - * Adds an event subscriber. - * - * The subscriber is asked for all the events he is - * interested in and added as a listener for these events. - * - * @param EventSubscriberInterface $subscriber The subscriber - */ - public function addSubscriber(EventSubscriberInterface $subscriber); - - /** - * Removes an event listener from the specified events. - * - * @param string $eventName The event to remove a listener from - * @param callable $listener The listener to remove - */ - public function removeListener($eventName, $listener); - - /** - * Removes an event subscriber. - * - * @param EventSubscriberInterface $subscriber The subscriber - */ - public function removeSubscriber(EventSubscriberInterface $subscriber); - - /** - * Gets the listeners of a specific event or all listeners sorted by descending priority. - * - * @param string $eventName The name of the event - * - * @return array The event listeners for the specified event, or all event listeners by event name - */ - public function getListeners($eventName = null); - - /** - * Gets the listener priority for a specific event. - * - * Returns null if the event or the listener does not exist. - * - * @param string $eventName The name of the event - * @param callable $listener The listener - * - * @return int|null The event listener priority - */ - public function getListenerPriority($eventName, $listener); - - /** - * Checks whether an event has any registered listeners. - * - * @param string $eventName The name of the event - * - * @return bool true if the specified event has any listeners, false otherwise - */ - public function hasListeners($eventName = null); -} diff --git a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php deleted file mode 100644 index 8af7789..0000000 --- a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * An EventSubscriber knows himself what events he is interested in. - * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes - * {@link getSubscribedEvents} and registers the subscriber as a listener for all - * returned events. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - */ -interface EventSubscriberInterface -{ - /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) - * - * @return array The event names to listen to - */ - public static function getSubscribedEvents(); -} diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php deleted file mode 100644 index a7520a0..0000000 --- a/vendor/symfony/event-dispatcher/GenericEvent.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * Event encapsulation class. - * - * Encapsulates events thus decoupling the observer from the subject they encapsulate. - * - * @author Drak - */ -class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate -{ - /** - * Event subject. - * - * @var mixed usually object or callable - */ - protected $subject; - - /** - * Array of arguments. - * - * @var array - */ - protected $arguments; - - /** - * Encapsulate an event with $subject and $args. - * - * @param mixed $subject The subject of the event, usually an object - * @param array $arguments Arguments to store in the event - */ - public function __construct($subject = null, array $arguments = array()) - { - $this->subject = $subject; - $this->arguments = $arguments; - } - - /** - * Getter for subject property. - * - * @return mixed $subject The observer subject - */ - public function getSubject() - { - return $this->subject; - } - - /** - * Get argument by key. - * - * @param string $key Key - * - * @return mixed Contents of array key - * - * @throws \InvalidArgumentException if key is not found - */ - public function getArgument($key) - { - if ($this->hasArgument($key)) { - return $this->arguments[$key]; - } - - throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); - } - - /** - * Add argument to event. - * - * @param string $key Argument name - * @param mixed $value Value - * - * @return $this - */ - public function setArgument($key, $value) - { - $this->arguments[$key] = $value; - - return $this; - } - - /** - * Getter for all arguments. - * - * @return array - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * Set args property. - * - * @param array $args Arguments - * - * @return $this - */ - public function setArguments(array $args = array()) - { - $this->arguments = $args; - - return $this; - } - - /** - * Has argument. - * - * @param string $key Key of arguments array - * - * @return bool - */ - public function hasArgument($key) - { - return array_key_exists($key, $this->arguments); - } - - /** - * ArrayAccess for argument getter. - * - * @param string $key Array key - * - * @return mixed - * - * @throws \InvalidArgumentException if key does not exist in $this->args - */ - public function offsetGet($key) - { - return $this->getArgument($key); - } - - /** - * ArrayAccess for argument setter. - * - * @param string $key Array key to set - * @param mixed $value Value - */ - public function offsetSet($key, $value) - { - $this->setArgument($key, $value); - } - - /** - * ArrayAccess for unset argument. - * - * @param string $key Array key - */ - public function offsetUnset($key) - { - if ($this->hasArgument($key)) { - unset($this->arguments[$key]); - } - } - - /** - * ArrayAccess has argument. - * - * @param string $key Array key - * - * @return bool - */ - public function offsetExists($key) - { - return $this->hasArgument($key); - } - - /** - * IteratorAggregate for iterating over the object like an array. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->arguments); - } -} diff --git a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php b/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php deleted file mode 100644 index 7f2be8d..0000000 --- a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * A read-only proxy for an event dispatcher. - * - * @author Bernhard Schussek - */ -class ImmutableEventDispatcher implements EventDispatcherInterface -{ - /** - * The proxied dispatcher. - * - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * Creates an unmodifiable proxy for an event dispatcher. - * - * @param EventDispatcherInterface $dispatcher The proxied event dispatcher - */ - public function __construct(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - return $this->dispatcher->dispatch($eventName, $event); - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function getListenerPriority($eventName, $listener) - { - return $this->dispatcher->getListenerPriority($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - return $this->dispatcher->hasListeners($eventName); - } -} diff --git a/vendor/symfony/event-dispatcher/LICENSE b/vendor/symfony/event-dispatcher/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/event-dispatcher/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/event-dispatcher/README.md b/vendor/symfony/event-dispatcher/README.md deleted file mode 100644 index 185c3fe..0000000 --- a/vendor/symfony/event-dispatcher/README.md +++ /dev/null @@ -1,15 +0,0 @@ -EventDispatcher Component -========================= - -The EventDispatcher component provides tools that allow your application -components to communicate with each other by dispatching events and listening to -them. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/event_dispatcher/index.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php deleted file mode 100644 index 9443f21..0000000 --- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php +++ /dev/null @@ -1,442 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -abstract class AbstractEventDispatcherTest extends TestCase -{ - /* Some pseudo events */ - const preFoo = 'pre.foo'; - const postFoo = 'post.foo'; - const preBar = 'pre.bar'; - const postBar = 'post.bar'; - - /** - * @var EventDispatcher - */ - private $dispatcher; - - private $listener; - - protected function setUp() - { - $this->dispatcher = $this->createEventDispatcher(); - $this->listener = new TestEventListener(); - } - - protected function tearDown() - { - $this->dispatcher = null; - $this->listener = null; - } - - abstract protected function createEventDispatcher(); - - public function testInitialState() - { - $this->assertEquals(array(), $this->dispatcher->getListeners()); - $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); - $this->assertFalse($this->dispatcher->hasListeners(self::postFoo)); - } - - public function testAddListener() - { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); - $this->assertTrue($this->dispatcher->hasListeners()); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); - $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo)); - $this->assertCount(1, $this->dispatcher->getListeners(self::postFoo)); - $this->assertCount(2, $this->dispatcher->getListeners()); - } - - public function testGetListenersSortsByPriority() - { - $listener1 = new TestEventListener(); - $listener2 = new TestEventListener(); - $listener3 = new TestEventListener(); - $listener1->name = '1'; - $listener2->name = '2'; - $listener3->name = '3'; - - $this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10); - $this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10); - $this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo')); - - $expected = array( - array($listener2, 'preFoo'), - array($listener3, 'preFoo'), - array($listener1, 'preFoo'), - ); - - $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo')); - } - - public function testGetAllListenersSortsByPriority() - { - $listener1 = new TestEventListener(); - $listener2 = new TestEventListener(); - $listener3 = new TestEventListener(); - $listener4 = new TestEventListener(); - $listener5 = new TestEventListener(); - $listener6 = new TestEventListener(); - - $this->dispatcher->addListener('pre.foo', $listener1, -10); - $this->dispatcher->addListener('pre.foo', $listener2); - $this->dispatcher->addListener('pre.foo', $listener3, 10); - $this->dispatcher->addListener('post.foo', $listener4, -10); - $this->dispatcher->addListener('post.foo', $listener5); - $this->dispatcher->addListener('post.foo', $listener6, 10); - - $expected = array( - 'pre.foo' => array($listener3, $listener2, $listener1), - 'post.foo' => array($listener6, $listener5, $listener4), - ); - - $this->assertSame($expected, $this->dispatcher->getListeners()); - } - - public function testGetListenerPriority() - { - $listener1 = new TestEventListener(); - $listener2 = new TestEventListener(); - - $this->dispatcher->addListener('pre.foo', $listener1, -10); - $this->dispatcher->addListener('pre.foo', $listener2); - - $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1)); - $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2)); - $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2)); - $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {})); - } - - public function testDispatch() - { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); - $this->dispatcher->dispatch(self::preFoo); - $this->assertTrue($this->listener->preFooInvoked); - $this->assertFalse($this->listener->postFooInvoked); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch('noevent')); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(self::preFoo)); - $event = new Event(); - $return = $this->dispatcher->dispatch(self::preFoo, $event); - $this->assertSame($event, $return); - } - - public function testDispatchForClosure() - { - $invoked = 0; - $listener = function () use (&$invoked) { - ++$invoked; - }; - $this->dispatcher->addListener('pre.foo', $listener); - $this->dispatcher->addListener('post.foo', $listener); - $this->dispatcher->dispatch(self::preFoo); - $this->assertEquals(1, $invoked); - } - - public function testStopEventPropagation() - { - $otherListener = new TestEventListener(); - - // postFoo() stops the propagation, so only one listener should - // be executed - // Manually set priority to enforce $this->listener to be called first - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10); - $this->dispatcher->addListener('post.foo', array($otherListener, 'preFoo')); - $this->dispatcher->dispatch(self::postFoo); - $this->assertTrue($this->listener->postFooInvoked); - $this->assertFalse($otherListener->postFooInvoked); - } - - public function testDispatchByPriority() - { - $invoked = array(); - $listener1 = function () use (&$invoked) { - $invoked[] = '1'; - }; - $listener2 = function () use (&$invoked) { - $invoked[] = '2'; - }; - $listener3 = function () use (&$invoked) { - $invoked[] = '3'; - }; - $this->dispatcher->addListener('pre.foo', $listener1, -10); - $this->dispatcher->addListener('pre.foo', $listener2); - $this->dispatcher->addListener('pre.foo', $listener3, 10); - $this->dispatcher->dispatch(self::preFoo); - $this->assertEquals(array('3', '2', '1'), $invoked); - } - - public function testRemoveListener() - { - $this->dispatcher->addListener('pre.bar', $this->listener); - $this->assertTrue($this->dispatcher->hasListeners(self::preBar)); - $this->dispatcher->removeListener('pre.bar', $this->listener); - $this->assertFalse($this->dispatcher->hasListeners(self::preBar)); - $this->dispatcher->removeListener('notExists', $this->listener); - } - - public function testAddSubscriber() - { - $eventSubscriber = new TestEventSubscriber(); - $this->dispatcher->addSubscriber($eventSubscriber); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); - } - - public function testAddSubscriberWithPriorities() - { - $eventSubscriber = new TestEventSubscriber(); - $this->dispatcher->addSubscriber($eventSubscriber); - - $eventSubscriber = new TestEventSubscriberWithPriorities(); - $this->dispatcher->addSubscriber($eventSubscriber); - - $listeners = $this->dispatcher->getListeners('pre.foo'); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertCount(2, $listeners); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\Tests\TestEventSubscriberWithPriorities', $listeners[0][0]); - } - - public function testAddSubscriberWithMultipleListeners() - { - $eventSubscriber = new TestEventSubscriberWithMultipleListeners(); - $this->dispatcher->addSubscriber($eventSubscriber); - - $listeners = $this->dispatcher->getListeners('pre.foo'); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertCount(2, $listeners); - $this->assertEquals('preFoo2', $listeners[0][1]); - } - - public function testRemoveSubscriber() - { - $eventSubscriber = new TestEventSubscriber(); - $this->dispatcher->addSubscriber($eventSubscriber); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); - $this->dispatcher->removeSubscriber($eventSubscriber); - $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); - $this->assertFalse($this->dispatcher->hasListeners(self::postFoo)); - } - - public function testRemoveSubscriberWithPriorities() - { - $eventSubscriber = new TestEventSubscriberWithPriorities(); - $this->dispatcher->addSubscriber($eventSubscriber); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->dispatcher->removeSubscriber($eventSubscriber); - $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); - } - - public function testRemoveSubscriberWithMultipleListeners() - { - $eventSubscriber = new TestEventSubscriberWithMultipleListeners(); - $this->dispatcher->addSubscriber($eventSubscriber); - $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); - $this->assertCount(2, $this->dispatcher->getListeners(self::preFoo)); - $this->dispatcher->removeSubscriber($eventSubscriber); - $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); - } - - public function testEventReceivesTheDispatcherInstanceAsArgument() - { - $listener = new TestWithDispatcher(); - $this->dispatcher->addListener('test', array($listener, 'foo')); - $this->assertNull($listener->name); - $this->assertNull($listener->dispatcher); - $this->dispatcher->dispatch('test'); - $this->assertEquals('test', $listener->name); - $this->assertSame($this->dispatcher, $listener->dispatcher); - } - - /** - * @see https://bugs.php.net/bug.php?id=62976 - * - * This bug affects: - * - The PHP 5.3 branch for versions < 5.3.18 - * - The PHP 5.4 branch for versions < 5.4.8 - * - The PHP 5.5 branch is not affected - */ - public function testWorkaroundForPhpBug62976() - { - $dispatcher = $this->createEventDispatcher(); - $dispatcher->addListener('bug.62976', new CallableClass()); - $dispatcher->removeListener('bug.62976', function () {}); - $this->assertTrue($dispatcher->hasListeners('bug.62976')); - } - - public function testHasListenersWhenAddedCallbackListenerIsRemoved() - { - $listener = function () {}; - $this->dispatcher->addListener('foo', $listener); - $this->dispatcher->removeListener('foo', $listener); - $this->assertFalse($this->dispatcher->hasListeners()); - } - - public function testGetListenersWhenAddedCallbackListenerIsRemoved() - { - $listener = function () {}; - $this->dispatcher->addListener('foo', $listener); - $this->dispatcher->removeListener('foo', $listener); - $this->assertSame(array(), $this->dispatcher->getListeners()); - } - - public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled() - { - $this->assertFalse($this->dispatcher->hasListeners('foo')); - $this->assertFalse($this->dispatcher->hasListeners()); - } - - public function testHasListenersIsLazy() - { - $called = 0; - $listener = array(function () use (&$called) { ++$called; }, 'onFoo'); - $this->dispatcher->addListener('foo', $listener); - $this->assertTrue($this->dispatcher->hasListeners()); - $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->assertSame(0, $called); - } - - public function testDispatchLazyListener() - { - $called = 0; - $factory = function () use (&$called) { - ++$called; - - return new TestWithDispatcher(); - }; - $this->dispatcher->addListener('foo', array($factory, 'foo')); - $this->assertSame(0, $called); - $this->dispatcher->dispatch('foo', new Event()); - $this->dispatcher->dispatch('foo', new Event()); - $this->assertSame(1, $called); - } - - public function testRemoveFindsLazyListeners() - { - $test = new TestWithDispatcher(); - $factory = function () use ($test) { return $test; }; - - $this->dispatcher->addListener('foo', array($factory, 'foo')); - $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($test, 'foo')); - $this->assertFalse($this->dispatcher->hasListeners('foo')); - - $this->dispatcher->addListener('foo', array($test, 'foo')); - $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); - $this->assertFalse($this->dispatcher->hasListeners('foo')); - } - - public function testPriorityFindsLazyListeners() - { - $test = new TestWithDispatcher(); - $factory = function () use ($test) { return $test; }; - - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', array($test, 'foo'))); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); - - $this->dispatcher->addListener('foo', array($test, 'foo'), 5); - $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', array($factory, 'foo'))); - } - - public function testGetLazyListeners() - { - $test = new TestWithDispatcher(); - $factory = function () use ($test) { return $test; }; - - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(array(array($test, 'foo')), $this->dispatcher->getListeners('foo')); - - $this->dispatcher->removeListener('foo', array($test, 'foo')); - $this->dispatcher->addListener('bar', array($factory, 'foo'), 3); - $this->assertSame(array('bar' => array(array($test, 'foo'))), $this->dispatcher->getListeners()); - } -} - -class CallableClass -{ - public function __invoke() - { - } -} - -class TestEventListener -{ - public $preFooInvoked = false; - public $postFooInvoked = false; - - /* Listener methods */ - - public function preFoo(Event $e) - { - $this->preFooInvoked = true; - } - - public function postFoo(Event $e) - { - $this->postFooInvoked = true; - - $e->stopPropagation(); - } -} - -class TestWithDispatcher -{ - public $name; - public $dispatcher; - - public function foo(Event $e, $name, $dispatcher) - { - $this->name = $name; - $this->dispatcher = $dispatcher; - } -} - -class TestEventSubscriber implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo'); - } -} - -class TestEventSubscriberWithPriorities implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array( - 'pre.foo' => array('preFoo', 10), - 'post.foo' => array('postFoo'), - ); - } -} - -class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array('pre.foo' => array( - array('preFoo1'), - array('preFoo2', 10), - )); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php deleted file mode 100644 index 1805561..0000000 --- a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ /dev/null @@ -1,210 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * @group legacy - */ -class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest -{ - protected function createEventDispatcher() - { - $container = new Container(); - - return new ContainerAwareEventDispatcher($container); - } - - public function testAddAListenerService() - { - $event = new Event(); - - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $service - ->expects($this->once()) - ->method('onEvent') - ->with($event) - ; - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); - - $dispatcher->dispatch('onEvent', $event); - } - - public function testAddASubscriberService() - { - $event = new Event(); - - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\SubscriberService')->getMock(); - - $service - ->expects($this->once()) - ->method('onEvent') - ->with($event) - ; - - $service - ->expects($this->once()) - ->method('onEventWithPriority') - ->with($event) - ; - - $service - ->expects($this->once()) - ->method('onEventNested') - ->with($event) - ; - - $container = new Container(); - $container->set('service.subscriber', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addSubscriberService('service.subscriber', 'Symfony\Component\EventDispatcher\Tests\SubscriberService'); - - $dispatcher->dispatch('onEvent', $event); - $dispatcher->dispatch('onEventWithPriority', $event); - $dispatcher->dispatch('onEventNested', $event); - } - - public function testPreventDuplicateListenerService() - { - $event = new Event(); - - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $service - ->expects($this->once()) - ->method('onEvent') - ->with($event) - ; - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 5); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 10); - - $dispatcher->dispatch('onEvent', $event); - } - - public function testHasListenersOnLazyLoad() - { - $event = new Event(); - - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); - - $service - ->expects($this->once()) - ->method('onEvent') - ->with($event) - ; - - $this->assertTrue($dispatcher->hasListeners()); - - if ($dispatcher->hasListeners('onEvent')) { - $dispatcher->dispatch('onEvent'); - } - } - - public function testGetListenersOnLazyLoad() - { - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); - - $listeners = $dispatcher->getListeners(); - - $this->assertTrue(isset($listeners['onEvent'])); - - $this->assertCount(1, $dispatcher->getListeners('onEvent')); - } - - public function testRemoveAfterDispatch() - { - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); - - $dispatcher->dispatch('onEvent', new Event()); - $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent')); - $this->assertFalse($dispatcher->hasListeners('onEvent')); - } - - public function testRemoveBeforeDispatch() - { - $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock(); - - $container = new Container(); - $container->set('service.listener', $service); - - $dispatcher = new ContainerAwareEventDispatcher($container); - $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent')); - - $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent')); - $this->assertFalse($dispatcher->hasListeners('onEvent')); - } -} - -class Service -{ - public function onEvent(Event $e) - { - } -} - -class SubscriberService implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array( - 'onEvent' => 'onEvent', - 'onEventWithPriority' => array('onEventWithPriority', 10), - 'onEventNested' => array(array('onEventNested')), - ); - } - - public function onEvent(Event $e) - { - } - - public function onEventWithPriority(Event $e) - { - } - - public function onEventNested(Event $e) - { - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php deleted file mode 100644 index a1cf670..0000000 --- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ /dev/null @@ -1,242 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests\Debug; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\Stopwatch\Stopwatch; - -class TraceableEventDispatcherTest extends TestCase -{ - public function testAddRemoveListener() - { - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - - $tdispatcher->addListener('foo', $listener = function () {}); - $listeners = $dispatcher->getListeners('foo'); - $this->assertCount(1, $listeners); - $this->assertSame($listener, $listeners[0]); - - $tdispatcher->removeListener('foo', $listener); - $this->assertCount(0, $dispatcher->getListeners('foo')); - } - - public function testGetListeners() - { - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - - $tdispatcher->addListener('foo', $listener = function () {}); - $this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo')); - } - - public function testHasListeners() - { - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - - $this->assertFalse($dispatcher->hasListeners('foo')); - $this->assertFalse($tdispatcher->hasListeners('foo')); - - $tdispatcher->addListener('foo', $listener = function () {}); - $this->assertTrue($dispatcher->hasListeners('foo')); - $this->assertTrue($tdispatcher->hasListeners('foo')); - } - - public function testGetListenerPriority() - { - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - - $tdispatcher->addListener('foo', function () {}, 123); - - $listeners = $dispatcher->getListeners('foo'); - $this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0])); - - // Verify that priority is preserved when listener is removed and re-added - // in preProcess() and postProcess(). - $tdispatcher->dispatch('foo', new Event()); - $listeners = $dispatcher->getListeners('foo'); - $this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0])); - } - - public function testGetListenerPriorityWhileDispatching() - { - $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $priorityWhileDispatching = null; - - $listener = function () use ($tdispatcher, &$priorityWhileDispatching, &$listener) { - $priorityWhileDispatching = $tdispatcher->getListenerPriority('bar', $listener); - }; - - $tdispatcher->addListener('bar', $listener, 5); - $tdispatcher->dispatch('bar'); - $this->assertSame(5, $priorityWhileDispatching); - } - - public function testAddRemoveSubscriber() - { - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - - $subscriber = new EventSubscriber(); - - $tdispatcher->addSubscriber($subscriber); - $listeners = $dispatcher->getListeners('foo'); - $this->assertCount(1, $listeners); - $this->assertSame(array($subscriber, 'call'), $listeners[0]); - - $tdispatcher->removeSubscriber($subscriber); - $this->assertCount(0, $dispatcher->getListeners('foo')); - } - - public function testGetCalledListeners() - { - $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $tdispatcher->addListener('foo', function () {}, 5); - - $listeners = $tdispatcher->getNotCalledListeners(); - $this->assertArrayHasKey('stub', $listeners['foo.closure']); - unset($listeners['foo.closure']['stub']); - $this->assertEquals(array(), $tdispatcher->getCalledListeners()); - $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); - - $tdispatcher->dispatch('foo'); - - $listeners = $tdispatcher->getCalledListeners(); - $this->assertArrayHasKey('stub', $listeners['foo.closure']); - unset($listeners['foo.closure']['stub']); - $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); - $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); - } - - public function testGetCalledListenersNested() - { - $tdispatcher = null; - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) { - $tdispatcher = $dispatcher; - $dispatcher->dispatch('bar'); - }); - $dispatcher->addListener('bar', function (Event $event) {}); - $dispatcher->dispatch('foo'); - $this->assertSame($dispatcher, $tdispatcher); - $this->assertCount(2, $dispatcher->getCalledListeners()); - } - - public function testLogger() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); - $tdispatcher->addListener('foo', $listener1 = function () {}); - $tdispatcher->addListener('foo', $listener2 = function () {}); - - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - - $tdispatcher->dispatch('foo'); - } - - public function testLoggerWithStoppedEvent() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); - $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); }); - $tdispatcher->addListener('foo', $listener2 = function () {}); - - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', array('event' => 'foo', 'listener' => 'closure')); - - $tdispatcher->dispatch('foo'); - } - - public function testDispatchCallListeners() - { - $called = array(); - - $dispatcher = new EventDispatcher(); - $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo1'; }, 10); - $tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo2'; }, 20); - - $tdispatcher->dispatch('foo'); - - $this->assertSame(array('foo2', 'foo1'), $called); - } - - public function testDispatchNested() - { - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $loop = 1; - $dispatchedEvents = 0; - $dispatcher->addListener('foo', $listener1 = function () use ($dispatcher, &$loop) { - ++$loop; - if (2 == $loop) { - $dispatcher->dispatch('foo'); - } - }); - $dispatcher->addListener('foo', function () use (&$dispatchedEvents) { - ++$dispatchedEvents; - }); - - $dispatcher->dispatch('foo'); - - $this->assertSame(2, $dispatchedEvents); - } - - public function testDispatchReusedEventNested() - { - $nestedCall = false; - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $dispatcher->addListener('foo', function (Event $e) use ($dispatcher) { - $dispatcher->dispatch('bar', $e); - }); - $dispatcher->addListener('bar', function (Event $e) use (&$nestedCall) { - $nestedCall = true; - }); - - $this->assertFalse($nestedCall); - $dispatcher->dispatch('foo'); - $this->assertTrue($nestedCall); - } - - public function testListenerCanRemoveItselfWhenExecuted() - { - $eventDispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $listener1 = function ($event, $eventName, EventDispatcherInterface $dispatcher) use (&$listener1) { - $dispatcher->removeListener('foo', $listener1); - }; - $eventDispatcher->addListener('foo', $listener1); - $eventDispatcher->addListener('foo', function () {}); - $eventDispatcher->dispatch('foo'); - - $this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed'); - } -} - -class EventSubscriber implements EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array('foo' => 'call'); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php deleted file mode 100644 index d46d8c5..0000000 --- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ /dev/null @@ -1,167 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; - -class RegisterListenersPassTest extends TestCase -{ - /** - * Tests that event subscribers not implementing EventSubscriberInterface - * trigger an exception. - * - * @expectedException \InvalidArgumentException - */ - public function testEventSubscriberWithoutInterface() - { - // one service, not implementing any interface - $services = array( - 'my_event_subscriber' => array(0 => array()), - ); - - $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock(); - $definition->expects($this->atLeastOnce()) - ->method('getClass') - ->will($this->returnValue('stdClass')); - - $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock(); - $builder->expects($this->any()) - ->method('hasDefinition') - ->will($this->returnValue(true)); - - // We don't test kernel.event_listener here - $builder->expects($this->atLeastOnce()) - ->method('findTaggedServiceIds') - ->will($this->onConsecutiveCalls(array(), $services)); - - $builder->expects($this->atLeastOnce()) - ->method('getDefinition') - ->will($this->returnValue($definition)); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($builder); - } - - public function testValidEventSubscriber() - { - $services = array( - 'my_event_subscriber' => array(0 => array()), - ); - - $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock(); - $definition->expects($this->atLeastOnce()) - ->method('getClass') - ->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')); - - $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock(); - $builder->expects($this->any()) - ->method('hasDefinition') - ->will($this->returnValue(true)); - - // We don't test kernel.event_listener here - $builder->expects($this->atLeastOnce()) - ->method('findTaggedServiceIds') - ->will($this->onConsecutiveCalls(array(), $services)); - - $builder->expects($this->atLeastOnce()) - ->method('getDefinition') - ->will($this->returnValue($definition)); - - $builder->expects($this->atLeastOnce()) - ->method('findDefinition') - ->will($this->returnValue($definition)); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($builder); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The service "foo" tagged "kernel.event_listener" must not be abstract. - */ - public function testAbstractEventListener() - { - $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', array()); - $container->register('event_dispatcher', 'stdClass'); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($container); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The service "foo" tagged "kernel.event_subscriber" must not be abstract. - */ - public function testAbstractEventSubscriber() - { - $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array()); - $container->register('event_dispatcher', 'stdClass'); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($container); - } - - public function testEventSubscriberResolvableClassName() - { - $container = new ContainerBuilder(); - - $container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); - $container->register('event_dispatcher', 'stdClass'); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($container); - - $definition = $container->getDefinition('event_dispatcher'); - $expectedCalls = array( - array( - 'addListener', - array( - 'event', - array(new ServiceClosureArgument(new Reference('foo')), 'onEvent'), - 0, - ), - ), - ); - $this->assertEquals($expectedCalls, $definition->getMethodCalls()); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class" - */ - public function testEventSubscriberUnresolvableClassName() - { - $container = new ContainerBuilder(); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); - $container->register('event_dispatcher', 'stdClass'); - - $registerListenersPass = new RegisterListenersPass(); - $registerListenersPass->process($container); - } -} - -class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubscriberInterface -{ - public static function getSubscribedEvents() - { - return array( - 'event' => 'onEvent', - ); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php deleted file mode 100644 index 5faa5c8..0000000 --- a/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use Symfony\Component\EventDispatcher\EventDispatcher; - -class EventDispatcherTest extends AbstractEventDispatcherTest -{ - protected function createEventDispatcher() - { - return new EventDispatcher(); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/EventTest.php b/vendor/symfony/event-dispatcher/Tests/EventTest.php deleted file mode 100644 index 5be2ea0..0000000 --- a/vendor/symfony/event-dispatcher/Tests/EventTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\Event; - -/** - * Test class for Event. - */ -class EventTest extends TestCase -{ - /** - * @var \Symfony\Component\EventDispatcher\Event - */ - protected $event; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - $this->event = new Event(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - $this->event = null; - } - - public function testIsPropagationStopped() - { - $this->assertFalse($this->event->isPropagationStopped()); - } - - public function testStopPropagationAndIsPropagationStopped() - { - $this->event->stopPropagation(); - $this->assertTrue($this->event->isPropagationStopped()); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php deleted file mode 100644 index c84d3ac..0000000 --- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\GenericEvent; - -/** - * Test class for Event. - */ -class GenericEventTest extends TestCase -{ - /** - * @var GenericEvent - */ - private $event; - - private $subject; - - /** - * Prepares the environment before running a test. - */ - protected function setUp() - { - parent::setUp(); - - $this->subject = new \stdClass(); - $this->event = new GenericEvent($this->subject, array('name' => 'Event')); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->subject = null; - $this->event = null; - - parent::tearDown(); - } - - public function testConstruct() - { - $this->assertEquals($this->event, new GenericEvent($this->subject, array('name' => 'Event'))); - } - - /** - * Tests Event->getArgs(). - */ - public function testGetArguments() - { - // test getting all - $this->assertSame(array('name' => 'Event'), $this->event->getArguments()); - } - - public function testSetArguments() - { - $result = $this->event->setArguments(array('foo' => 'bar')); - $this->assertAttributeSame(array('foo' => 'bar'), 'arguments', $this->event); - $this->assertSame($this->event, $result); - } - - public function testSetArgument() - { - $result = $this->event->setArgument('foo2', 'bar2'); - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); - $this->assertEquals($this->event, $result); - } - - public function testGetArgument() - { - // test getting key - $this->assertEquals('Event', $this->event->getArgument('name')); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testGetArgException() - { - $this->event->getArgument('nameNotExist'); - } - - public function testOffsetGet() - { - // test getting key - $this->assertEquals('Event', $this->event['name']); - - // test getting invalid arg - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); - $this->assertFalse($this->event['nameNotExist']); - } - - public function testOffsetSet() - { - $this->event['foo2'] = 'bar2'; - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); - } - - public function testOffsetUnset() - { - unset($this->event['name']); - $this->assertAttributeSame(array(), 'arguments', $this->event); - } - - public function testOffsetIsset() - { - $this->assertTrue(isset($this->event['name'])); - $this->assertFalse(isset($this->event['nameNotExist'])); - } - - public function testHasArgument() - { - $this->assertTrue($this->event->hasArgument('name')); - $this->assertFalse($this->event->hasArgument('nameNotExist')); - } - - public function testGetSubject() - { - $this->assertSame($this->subject, $this->event->getSubject()); - } - - public function testHasIterator() - { - $data = array(); - foreach ($this->event as $key => $value) { - $data[$key] = $value; - } - $this->assertEquals(array('name' => 'Event'), $data); - } -} diff --git a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php deleted file mode 100644 index 04f2861..0000000 --- a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; - -/** - * @author Bernhard Schussek - */ -class ImmutableEventDispatcherTest extends TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $innerDispatcher; - - /** - * @var ImmutableEventDispatcher - */ - private $dispatcher; - - protected function setUp() - { - $this->innerDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher); - } - - public function testDispatchDelegates() - { - $event = new Event(); - - $this->innerDispatcher->expects($this->once()) - ->method('dispatch') - ->with('event', $event) - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->dispatch('event', $event)); - } - - public function testGetListenersDelegates() - { - $this->innerDispatcher->expects($this->once()) - ->method('getListeners') - ->with('event') - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->getListeners('event')); - } - - public function testHasListenersDelegates() - { - $this->innerDispatcher->expects($this->once()) - ->method('hasListeners') - ->with('event') - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->hasListeners('event')); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testAddListenerDisallowed() - { - $this->dispatcher->addListener('event', function () { return 'foo'; }); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testAddSubscriberDisallowed() - { - $subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock(); - - $this->dispatcher->addSubscriber($subscriber); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRemoveListenerDisallowed() - { - $this->dispatcher->removeListener('event', function () { return 'foo'; }); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRemoveSubscriberDisallowed() - { - $subscriber = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventSubscriberInterface')->getMock(); - - $this->dispatcher->removeSubscriber($subscriber); - } -} diff --git a/vendor/symfony/event-dispatcher/composer.json b/vendor/symfony/event-dispatcher/composer.json deleted file mode 100644 index 994e8ca..0000000 --- a/vendor/symfony/event-dispatcher/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "symfony/event-dispatcher", - "type": "library", - "description": "Symfony EventDispatcher Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/event-dispatcher/phpunit.xml.dist b/vendor/symfony/event-dispatcher/phpunit.xml.dist deleted file mode 100644 index b3ad1bd..0000000 --- a/vendor/symfony/event-dispatcher/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/vendor/symfony/http-foundation/.gitignore b/vendor/symfony/http-foundation/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/http-foundation/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php deleted file mode 100644 index 99be676..0000000 --- a/vendor/symfony/http-foundation/AcceptHeader.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents an Accept-* header. - * - * An accept header is compound with a list of items, - * sorted by descending quality. - * - * @author Jean-François Simon - */ -class AcceptHeader -{ - /** - * @var AcceptHeaderItem[] - */ - private $items = array(); - - /** - * @var bool - */ - private $sorted = true; - - /** - * @param AcceptHeaderItem[] $items - */ - public function __construct(array $items) - { - foreach ($items as $item) { - $this->add($item); - } - } - - /** - * Builds an AcceptHeader instance from a string. - * - * @param string $headerValue - * - * @return self - */ - public static function fromString($headerValue) - { - $index = 0; - - return new self(array_map(function ($itemValue) use (&$index) { - $item = AcceptHeaderItem::fromString($itemValue); - $item->setIndex($index++); - - return $item; - }, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE))); - } - - /** - * Returns header value's string representation. - * - * @return string - */ - public function __toString() - { - return implode(',', $this->items); - } - - /** - * Tests if header has given value. - * - * @param string $value - * - * @return bool - */ - public function has($value) - { - return isset($this->items[$value]); - } - - /** - * Returns given value's item, if exists. - * - * @param string $value - * - * @return AcceptHeaderItem|null - */ - public function get($value) - { - return isset($this->items[$value]) ? $this->items[$value] : null; - } - - /** - * Adds an item. - * - * @param AcceptHeaderItem $item - * - * @return $this - */ - public function add(AcceptHeaderItem $item) - { - $this->items[$item->getValue()] = $item; - $this->sorted = false; - - return $this; - } - - /** - * Returns all items. - * - * @return AcceptHeaderItem[] - */ - public function all() - { - $this->sort(); - - return $this->items; - } - - /** - * Filters items on their value using given regex. - * - * @param string $pattern - * - * @return self - */ - public function filter($pattern) - { - return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) { - return preg_match($pattern, $item->getValue()); - })); - } - - /** - * Returns first item. - * - * @return AcceptHeaderItem|null - */ - public function first() - { - $this->sort(); - - return !empty($this->items) ? reset($this->items) : null; - } - - /** - * Sorts items by descending quality. - */ - private function sort() - { - if (!$this->sorted) { - uasort($this->items, function ($a, $b) { - $qA = $a->getQuality(); - $qB = $b->getQuality(); - - if ($qA === $qB) { - return $a->getIndex() > $b->getIndex() ? 1 : -1; - } - - return $qA > $qB ? -1 : 1; - }); - - $this->sorted = true; - } - } -} diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php deleted file mode 100644 index e07a48a..0000000 --- a/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ /dev/null @@ -1,224 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents an Accept-* header item. - * - * @author Jean-François Simon - */ -class AcceptHeaderItem -{ - /** - * @var string - */ - private $value; - - /** - * @var float - */ - private $quality = 1.0; - - /** - * @var int - */ - private $index = 0; - - /** - * @var array - */ - private $attributes = array(); - - /** - * @param string $value - * @param array $attributes - */ - public function __construct($value, array $attributes = array()) - { - $this->value = $value; - foreach ($attributes as $name => $value) { - $this->setAttribute($name, $value); - } - } - - /** - * Builds an AcceptHeaderInstance instance from a string. - * - * @param string $itemValue - * - * @return self - */ - public static function fromString($itemValue) - { - $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - $value = array_shift($bits); - $attributes = array(); - - $lastNullAttribute = null; - foreach ($bits as $bit) { - if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) && ('"' === $start || '\'' === $start)) { - $attributes[$lastNullAttribute] = substr($bit, 1, -1); - } elseif ('=' === $end) { - $lastNullAttribute = $bit = substr($bit, 0, -1); - $attributes[$bit] = null; - } else { - $parts = explode('=', $bit); - $attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : ''; - } - } - - return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ('"' === $start || '\'' === $start) ? substr($value, 1, -1) : $value, $attributes); - } - - /** - * Returns header value's string representation. - * - * @return string - */ - public function __toString() - { - $string = $this->value.($this->quality < 1 ? ';q='.$this->quality : ''); - if (count($this->attributes) > 0) { - $string .= ';'.implode(';', array_map(function ($name, $value) { - return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value); - }, array_keys($this->attributes), $this->attributes)); - } - - return $string; - } - - /** - * Set the item value. - * - * @param string $value - * - * @return $this - */ - public function setValue($value) - { - $this->value = $value; - - return $this; - } - - /** - * Returns the item value. - * - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Set the item quality. - * - * @param float $quality - * - * @return $this - */ - public function setQuality($quality) - { - $this->quality = $quality; - - return $this; - } - - /** - * Returns the item quality. - * - * @return float - */ - public function getQuality() - { - return $this->quality; - } - - /** - * Set the item index. - * - * @param int $index - * - * @return $this - */ - public function setIndex($index) - { - $this->index = $index; - - return $this; - } - - /** - * Returns the item index. - * - * @return int - */ - public function getIndex() - { - return $this->index; - } - - /** - * Tests if an attribute exists. - * - * @param string $name - * - * @return bool - */ - public function hasAttribute($name) - { - return isset($this->attributes[$name]); - } - - /** - * Returns an attribute by its name. - * - * @param string $name - * @param mixed $default - * - * @return mixed - */ - public function getAttribute($name, $default = null) - { - return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; - } - - /** - * Returns all attributes. - * - * @return array - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * Set an attribute. - * - * @param string $name - * @param string $value - * - * @return $this - */ - public function setAttribute($name, $value) - { - if ('q' === $name) { - $this->quality = (float) $value; - } else { - $this->attributes[$name] = (string) $value; - } - - return $this; - } -} diff --git a/vendor/symfony/http-foundation/ApacheRequest.php b/vendor/symfony/http-foundation/ApacheRequest.php deleted file mode 100644 index 84803eb..0000000 --- a/vendor/symfony/http-foundation/ApacheRequest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request represents an HTTP request from an Apache server. - * - * @author Fabien Potencier - */ -class ApacheRequest extends Request -{ - /** - * {@inheritdoc} - */ - protected function prepareRequestUri() - { - return $this->server->get('REQUEST_URI'); - } - - /** - * {@inheritdoc} - */ - protected function prepareBaseUrl() - { - $baseUrl = $this->server->get('SCRIPT_NAME'); - - if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) { - // assume mod_rewrite - return rtrim(dirname($baseUrl), '/\\'); - } - - return $baseUrl; - } -} diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php deleted file mode 100644 index 4394863..0000000 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ /dev/null @@ -1,359 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\File\File; -use Symfony\Component\HttpFoundation\File\Exception\FileException; - -/** - * BinaryFileResponse represents an HTTP response delivering a file. - * - * @author Niklas Fiekas - * @author stealth35 - * @author Igor Wiedler - * @author Jordan Alliot - * @author Sergey Linnik - */ -class BinaryFileResponse extends Response -{ - protected static $trustXSendfileTypeHeader = false; - - /** - * @var File - */ - protected $file; - protected $offset; - protected $maxlen; - protected $deleteFileAfterSend = false; - - /** - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * @param bool $autoEtag Whether the ETag header should be automatically set - * @param bool $autoLastModified Whether the Last-Modified header should be automatically set - */ - public function __construct($file, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - parent::__construct(null, $status, $headers); - - $this->setFile($file, $contentDisposition, $autoEtag, $autoLastModified); - - if ($public) { - $this->setPublic(); - } - } - - /** - * @param \SplFileInfo|string $file The file to stream - * @param int $status The response status code - * @param array $headers An array of response headers - * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename - * @param bool $autoEtag Whether the ETag header should be automatically set - * @param bool $autoLastModified Whether the Last-Modified header should be automatically set - * - * @return static - */ - public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); - } - - /** - * Sets the file to stream. - * - * @param \SplFileInfo|string $file The file to stream - * @param string $contentDisposition - * @param bool $autoEtag - * @param bool $autoLastModified - * - * @return $this - * - * @throws FileException - */ - public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) - { - if (!$file instanceof File) { - if ($file instanceof \SplFileInfo) { - $file = new File($file->getPathname()); - } else { - $file = new File((string) $file); - } - } - - if (!$file->isReadable()) { - throw new FileException('File must be readable.'); - } - - $this->file = $file; - - if ($autoEtag) { - $this->setAutoEtag(); - } - - if ($autoLastModified) { - $this->setAutoLastModified(); - } - - if ($contentDisposition) { - $this->setContentDisposition($contentDisposition); - } - - return $this; - } - - /** - * Gets the file. - * - * @return File The file to stream - */ - public function getFile() - { - return $this->file; - } - - /** - * Automatically sets the Last-Modified header according the file modification date. - */ - public function setAutoLastModified() - { - $this->setLastModified(\DateTime::createFromFormat('U', $this->file->getMTime())); - - return $this; - } - - /** - * Automatically sets the ETag header according to the checksum of the file. - */ - public function setAutoEtag() - { - $this->setEtag(sha1_file($this->file->getPathname())); - - return $this; - } - - /** - * Sets the Content-Disposition header with the given filename. - * - * @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT - * @param string $filename Optionally use this UTF-8 encoded filename instead of the real name of the file - * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename - * - * @return $this - */ - public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') - { - if ('' === $filename) { - $filename = $this->file->getFilename(); - } - - if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { - $encoding = mb_detect_encoding($filename, null, true) ?: '8bit'; - - for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { - $char = mb_substr($filename, $i, 1, $encoding); - - if ('%' === $char || ord($char) < 32 || ord($char) > 126) { - $filenameFallback .= '_'; - } else { - $filenameFallback .= $char; - } - } - } - - $dispositionHeader = $this->headers->makeDisposition($disposition, $filename, $filenameFallback); - $this->headers->set('Content-Disposition', $dispositionHeader); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function prepare(Request $request) - { - if (!$this->headers->has('Content-Type')) { - $this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream'); - } - - if ('HTTP/1.0' !== $request->server->get('SERVER_PROTOCOL')) { - $this->setProtocolVersion('1.1'); - } - - $this->ensureIEOverSSLCompatibility($request); - - $this->offset = 0; - $this->maxlen = -1; - - if (false === $fileSize = $this->file->getSize()) { - return $this; - } - $this->headers->set('Content-Length', $fileSize); - - if (!$this->headers->has('Accept-Ranges')) { - // Only accept ranges on safe HTTP methods - $this->headers->set('Accept-Ranges', $request->isMethodSafe(false) ? 'bytes' : 'none'); - } - - if (self::$trustXSendfileTypeHeader && $request->headers->has('X-Sendfile-Type')) { - // Use X-Sendfile, do not send any content. - $type = $request->headers->get('X-Sendfile-Type'); - $path = $this->file->getRealPath(); - // Fall back to scheme://path for stream wrapped locations. - if (false === $path) { - $path = $this->file->getPathname(); - } - if ('x-accel-redirect' === strtolower($type)) { - // Do X-Accel-Mapping substitutions. - // @link http://wiki.nginx.org/X-accel#X-Accel-Redirect - foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) { - $mapping = explode('=', $mapping, 2); - - if (2 === count($mapping)) { - $pathPrefix = trim($mapping[0]); - $location = trim($mapping[1]); - - if (substr($path, 0, strlen($pathPrefix)) === $pathPrefix) { - $path = $location.substr($path, strlen($pathPrefix)); - break; - } - } - } - } - $this->headers->set($type, $path); - $this->maxlen = 0; - } elseif ($request->headers->has('Range')) { - // Process the range headers. - if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) { - $range = $request->headers->get('Range'); - - list($start, $end) = explode('-', substr($range, 6), 2) + array(0); - - $end = ('' === $end) ? $fileSize - 1 : (int) $end; - - if ('' === $start) { - $start = $fileSize - $end; - $end = $fileSize - 1; - } else { - $start = (int) $start; - } - - if ($start <= $end) { - if ($start < 0 || $end > $fileSize - 1) { - $this->setStatusCode(416); - $this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize)); - } elseif (0 !== $start || $end !== $fileSize - 1) { - $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; - $this->offset = $start; - - $this->setStatusCode(206); - $this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize)); - $this->headers->set('Content-Length', $end - $start + 1); - } - } - } - } - - return $this; - } - - private function hasValidIfRangeHeader($header) - { - if ($this->getEtag() === $header) { - return true; - } - - if (null === $lastModified = $this->getLastModified()) { - return false; - } - - return $lastModified->format('D, d M Y H:i:s').' GMT' === $header; - } - - /** - * Sends the file. - * - * {@inheritdoc} - */ - public function sendContent() - { - if (!$this->isSuccessful()) { - return parent::sendContent(); - } - - if (0 === $this->maxlen) { - return $this; - } - - $out = fopen('php://output', 'wb'); - $file = fopen($this->file->getPathname(), 'rb'); - - stream_copy_to_stream($file, $out, $this->maxlen, $this->offset); - - fclose($out); - fclose($file); - - if ($this->deleteFileAfterSend) { - unlink($this->file->getPathname()); - } - - return $this; - } - - /** - * {@inheritdoc} - * - * @throws \LogicException when the content is not null - */ - public function setContent($content) - { - if (null !== $content) { - throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.'); - } - } - - /** - * {@inheritdoc} - * - * @return false - */ - public function getContent() - { - return false; - } - - /** - * Trust X-Sendfile-Type header. - */ - public static function trustXSendfileTypeHeader() - { - self::$trustXSendfileTypeHeader = true; - } - - /** - * If this is set to true, the file will be unlinked after the request is send - * Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used. - * - * @param bool $shouldDelete - * - * @return $this - */ - public function deleteFileAfterSend($shouldDelete) - { - $this->deleteFileAfterSend = $shouldDelete; - - return $this; - } -} diff --git a/vendor/symfony/http-foundation/CHANGELOG.md b/vendor/symfony/http-foundation/CHANGELOG.md deleted file mode 100644 index e1fdf77..0000000 --- a/vendor/symfony/http-foundation/CHANGELOG.md +++ /dev/null @@ -1,149 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - - * the `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument, - see http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info, - * deprecated the `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods, - * added `File\Stream`, to be passed to `BinaryFileResponse` when the size of the served file is unknown, - disabling `Range` and `Content-Length` handling, switching to chunked encoding instead - * added the `Cookie::fromString()` method that allows to create a cookie from a - raw header string - -3.1.0 ------ - - * Added support for creating `JsonResponse` with a string of JSON data - -3.0.0 ------ - - * The precedence of parameters returned from `Request::get()` changed from "GET, PATH, BODY" to "PATH, GET, BODY" - -2.8.0 ------ - - * Finding deep items in `ParameterBag::get()` is deprecated since version 2.8 and - will be removed in 3.0. - -2.6.0 ------ - - * PdoSessionHandler changes - - implemented different session locking strategies to prevent loss of data by concurrent access to the same session - - [BC BREAK] save session data in a binary column without base64_encode - - [BC BREAK] added lifetime column to the session table which allows to have different lifetimes for each session - - implemented lazy connections that are only opened when a session is used by either passing a dsn string - explicitly or falling back to session.save_path ini setting - - added a createTable method that initializes a correctly defined table depending on the database vendor - -2.5.0 ------ - - * added `JsonResponse::setEncodingOptions()` & `JsonResponse::getEncodingOptions()` for easier manipulation - of the options used while encoding data to JSON format. - -2.4.0 ------ - - * added RequestStack - * added Request::getEncodings() - * added accessors methods to session handlers - -2.3.0 ------ - - * added support for ranges of IPs in trusted proxies - * `UploadedFile::isValid` now returns false if the file was not uploaded via HTTP (in a non-test mode) - * Improved error-handling of `\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler` - to ensure the supplied PDO handler throws Exceptions on error (as the class expects). Added related test cases - to verify that Exceptions are properly thrown when the PDO queries fail. - -2.2.0 ------ - - * fixed the Request::create() precedence (URI information always take precedence now) - * added Request::getTrustedProxies() - * deprecated Request::isProxyTrusted() - * [BC BREAK] JsonResponse does not turn a top level empty array to an object anymore, use an ArrayObject to enforce objects - * added a IpUtils class to check if an IP belongs to a CIDR - * added Request::getRealMethod() to get the "real" HTTP method (getMethod() returns the "intended" HTTP method) - * disabled _method request parameter support by default (call Request::enableHttpMethodParameterOverride() to - enable it, and Request::getHttpMethodParameterOverride() to check if it is supported) - * Request::splitHttpAcceptHeader() method is deprecated and will be removed in 2.3 - * Deprecated Flashbag::count() and \Countable interface, will be removed in 2.3 - -2.1.0 ------ - - * added Request::getSchemeAndHttpHost() and Request::getUserInfo() - * added a fluent interface to the Response class - * added Request::isProxyTrusted() - * added JsonResponse - * added a getTargetUrl method to RedirectResponse - * added support for streamed responses - * made Response::prepare() method the place to enforce HTTP specification - * [BC BREAK] moved management of the locale from the Session class to the Request class - * added a generic access to the PHP built-in filter mechanism: ParameterBag::filter() - * made FileBinaryMimeTypeGuesser command configurable - * added Request::getUser() and Request::getPassword() - * added support for the PATCH method in Request - * removed the ContentTypeMimeTypeGuesser class as it is deprecated and never used on PHP 5.3 - * added ResponseHeaderBag::makeDisposition() (implements RFC 6266) - * made mimetype to extension conversion configurable - * [BC BREAK] Moved all session related classes and interfaces into own namespace, as - `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. - Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. - * SessionHandlers must implement `\SessionHandlerInterface` or extend from the - `Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class. - * Added internal storage driver proxy mechanism for forward compatibility with - PHP 5.4 `\SessionHandler` class. - * Added session handlers for custom Memcache, Memcached and Null session save handlers. - * [BC BREAK] Removed `NativeSessionStorage` and replaced with `NativeFileSessionHandler`. - * [BC BREAK] `SessionStorageInterface` methods removed: `write()`, `read()` and - `remove()`. Added `getBag()`, `registerBag()`. The `NativeSessionStorage` class - is a mediator for the session storage internals including the session handlers - which do the real work of participating in the internal PHP session workflow. - * [BC BREAK] Introduced mock implementations of `SessionStorage` to enable unit - and functional testing without starting real PHP sessions. Removed - `ArraySessionStorage`, and replaced with `MockArraySessionStorage` for unit - tests; removed `FilesystemSessionStorage`, and replaced with`MockFileSessionStorage` - for functional tests. These do not interact with global session ini - configuration values, session functions or `$_SESSION` superglobal. This means - they can be configured directly allowing multiple instances to work without - conflicting in the same PHP process. - * [BC BREAK] Removed the `close()` method from the `Session` class, as this is - now redundant. - * Deprecated the following methods from the Session class: `setFlash()`, `setFlashes()` - `getFlash()`, `hasFlash()`, and `removeFlash()`. Use `getFlashBag()` instead - which returns a `FlashBagInterface`. - * `Session->clear()` now only clears session attributes as before it cleared - flash messages and attributes. `Session->getFlashBag()->all()` clears flashes now. - * Session data is now managed by `SessionBagInterface` to better encapsulate - session data. - * Refactored session attribute and flash messages system to their own - `SessionBagInterface` implementations. - * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This - implementation is ESI compatible. - * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire - behaviour of messages auto expiring after one page page load. Messages must - be retrieved by `get()` or `all()`. - * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate - attributes storage behaviour from 2.0.x (default). - * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for - namespace session attributes. - * Flash API can stores messages in an array so there may be multiple messages - per flash type. The old `Session` class API remains without BC break as it - will allow single messages as before. - * Added basic session meta-data to the session to record session create time, - last updated time, and the lifetime of the session cookie that was provided - to the client. - * Request::getClientIp() method doesn't take a parameter anymore but bases - itself on the trustProxy parameter. - * Added isMethod() to Request object. - * [BC BREAK] The methods `getPathInfo()`, `getBaseUrl()` and `getBasePath()` of - a `Request` now all return a raw value (vs a urldecoded value before). Any call - to one of these methods must be checked and wrapped in a `rawurldecode()` if - needed. diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php deleted file mode 100644 index 4519a6a..0000000 --- a/vendor/symfony/http-foundation/Cookie.php +++ /dev/null @@ -1,289 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Represents a cookie. - * - * @author Johannes M. Schmitt - */ -class Cookie -{ - protected $name; - protected $value; - protected $domain; - protected $expire; - protected $path; - protected $secure; - protected $httpOnly; - private $raw; - private $sameSite; - - const SAMESITE_LAX = 'lax'; - const SAMESITE_STRICT = 'strict'; - - /** - * Creates cookie from raw header string. - * - * @param string $cookie - * @param bool $decode - * - * @return static - */ - public static function fromString($cookie, $decode = false) - { - $data = array( - 'expires' => 0, - 'path' => '/', - 'domain' => null, - 'secure' => false, - 'httponly' => false, - 'raw' => !$decode, - 'samesite' => null, - ); - foreach (explode(';', $cookie) as $part) { - if (false === strpos($part, '=')) { - $key = trim($part); - $value = true; - } else { - list($key, $value) = explode('=', trim($part), 2); - $key = trim($key); - $value = trim($value); - } - if (!isset($data['name'])) { - $data['name'] = $decode ? urldecode($key) : $key; - $data['value'] = true === $value ? null : ($decode ? urldecode($value) : $value); - continue; - } - switch ($key = strtolower($key)) { - case 'name': - case 'value': - break; - case 'max-age': - $data['expires'] = time() + (int) $value; - break; - default: - $data[$key] = $value; - break; - } - } - - return new static($data['name'], $data['value'], $data['expires'], $data['path'], $data['domain'], $data['secure'], $data['httponly'], $data['raw'], $data['samesite']); - } - - /** - * @param string $name The name of the cookie - * @param string|null $value The value of the cookie - * @param int|string|\DateTimeInterface $expire The time the cookie expires - * @param string $path The path on the server in which the cookie will be available on - * @param string|null $domain The domain that the cookie is available to - * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client - * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol - * @param bool $raw Whether the cookie value should be sent with no url encoding - * @param string|null $sameSite Whether the cookie will be available for cross-site requests - * - * @throws \InvalidArgumentException - */ - public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null) - { - // from PHP source code - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); - } - - if (empty($name)) { - throw new \InvalidArgumentException('The cookie name cannot be empty.'); - } - - // convert expiration time to a Unix timestamp - if ($expire instanceof \DateTimeInterface) { - $expire = $expire->format('U'); - } elseif (!is_numeric($expire)) { - $expire = strtotime($expire); - - if (false === $expire) { - throw new \InvalidArgumentException('The cookie expiration time is not valid.'); - } - } - - $this->name = $name; - $this->value = $value; - $this->domain = $domain; - $this->expire = 0 < $expire ? (int) $expire : 0; - $this->path = empty($path) ? '/' : $path; - $this->secure = (bool) $secure; - $this->httpOnly = (bool) $httpOnly; - $this->raw = (bool) $raw; - - if (null !== $sameSite) { - $sameSite = strtolower($sameSite); - } - - if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { - throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.'); - } - - $this->sameSite = $sameSite; - } - - /** - * Returns the cookie as a string. - * - * @return string The cookie - */ - public function __toString() - { - $str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'='; - - if ('' === (string) $this->getValue()) { - $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001'; - } else { - $str .= $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue()); - - if (0 !== $this->getExpiresTime()) { - $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; max-age='.$this->getMaxAge(); - } - } - - if ($this->getPath()) { - $str .= '; path='.$this->getPath(); - } - - if ($this->getDomain()) { - $str .= '; domain='.$this->getDomain(); - } - - if (true === $this->isSecure()) { - $str .= '; secure'; - } - - if (true === $this->isHttpOnly()) { - $str .= '; httponly'; - } - - if (null !== $this->getSameSite()) { - $str .= '; samesite='.$this->getSameSite(); - } - - return $str; - } - - /** - * Gets the name of the cookie. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Gets the value of the cookie. - * - * @return string|null - */ - public function getValue() - { - return $this->value; - } - - /** - * Gets the domain that the cookie is available to. - * - * @return string|null - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Gets the time the cookie expires. - * - * @return int - */ - public function getExpiresTime() - { - return $this->expire; - } - - /** - * Gets the max-age attribute. - * - * @return int - */ - public function getMaxAge() - { - return 0 !== $this->expire ? $this->expire - time() : 0; - } - - /** - * Gets the path on the server in which the cookie will be available on. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client. - * - * @return bool - */ - public function isSecure() - { - return $this->secure; - } - - /** - * Checks whether the cookie will be made accessible only through the HTTP protocol. - * - * @return bool - */ - public function isHttpOnly() - { - return $this->httpOnly; - } - - /** - * Whether this cookie is about to be cleared. - * - * @return bool - */ - public function isCleared() - { - return $this->expire < time(); - } - - /** - * Checks if the cookie value should be sent with no url encoding. - * - * @return bool - */ - public function isRaw() - { - return $this->raw; - } - - /** - * Gets the SameSite attribute. - * - * @return string|null - */ - public function getSameSite() - { - return $this->sameSite; - } -} diff --git a/vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php b/vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php deleted file mode 100644 index 5fcf5b4..0000000 --- a/vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Exception; - -/** - * The HTTP request contains headers with conflicting information. - * - * @author Magnus Nordlander - */ -class ConflictingHeadersException extends \UnexpectedValueException implements RequestExceptionInterface -{ -} diff --git a/vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php b/vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php deleted file mode 100644 index 478d0dc..0000000 --- a/vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Exception; - -/** - * Interface for Request exceptions. - * - * Exceptions implementing this interface should trigger an HTTP 400 response in the application code. - */ -interface RequestExceptionInterface -{ -} diff --git a/vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php b/vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php deleted file mode 100644 index ae7a5f1..0000000 --- a/vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Exception; - -/** - * Raised when a user has performed an operation that should be considered - * suspicious from a security perspective. - */ -class SuspiciousOperationException extends \UnexpectedValueException implements RequestExceptionInterface -{ -} diff --git a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php deleted file mode 100644 index e9c8441..0000000 --- a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; - -/** - * ExpressionRequestMatcher uses an expression to match a Request. - * - * @author Fabien Potencier - */ -class ExpressionRequestMatcher extends RequestMatcher -{ - private $language; - private $expression; - - public function setExpression(ExpressionLanguage $language, $expression) - { - $this->language = $language; - $this->expression = $expression; - } - - public function matches(Request $request) - { - if (!$this->language) { - throw new \LogicException('Unable to match the request as the expression language is not available.'); - } - - return $this->language->evaluate($this->expression, array( - 'request' => $request, - 'method' => $request->getMethod(), - 'path' => rawurldecode($request->getPathInfo()), - 'host' => $request->getHost(), - 'ip' => $request->getClientIp(), - 'attributes' => $request->attributes->all(), - )) && parent::matches($request); - } -} diff --git a/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php b/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php deleted file mode 100644 index 3b8e41d..0000000 --- a/vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when the access on a file was denied. - * - * @author Bernhard Schussek - */ -class AccessDeniedException extends FileException -{ - /** - * @param string $path The path to the accessed file - */ - public function __construct($path) - { - parent::__construct(sprintf('The file %s could not be accessed', $path)); - } -} diff --git a/vendor/symfony/http-foundation/File/Exception/FileException.php b/vendor/symfony/http-foundation/File/Exception/FileException.php deleted file mode 100644 index fad5133..0000000 --- a/vendor/symfony/http-foundation/File/Exception/FileException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred in the component File. - * - * @author Bernhard Schussek - */ -class FileException extends \RuntimeException -{ -} diff --git a/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php b/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php deleted file mode 100644 index bfcc37e..0000000 --- a/vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when a file was not found. - * - * @author Bernhard Schussek - */ -class FileNotFoundException extends FileException -{ - /** - * @param string $path The path to the file that was not found - */ - public function __construct($path) - { - parent::__construct(sprintf('The file "%s" does not exist', $path)); - } -} diff --git a/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php b/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php deleted file mode 100644 index 0444b87..0000000 --- a/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -class UnexpectedTypeException extends FileException -{ - public function __construct($value, $expectedType) - { - parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); - } -} diff --git a/vendor/symfony/http-foundation/File/Exception/UploadException.php b/vendor/symfony/http-foundation/File/Exception/UploadException.php deleted file mode 100644 index 7074e76..0000000 --- a/vendor/symfony/http-foundation/File/Exception/UploadException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\Exception; - -/** - * Thrown when an error occurred during file upload. - * - * @author Bernhard Schussek - */ -class UploadException extends FileException -{ -} diff --git a/vendor/symfony/http-foundation/File/File.php b/vendor/symfony/http-foundation/File/File.php deleted file mode 100644 index e2a6768..0000000 --- a/vendor/symfony/http-foundation/File/File.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; -use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; - -/** - * A file in the file system. - * - * @author Bernhard Schussek - */ -class File extends \SplFileInfo -{ - /** - * Constructs a new file from the given path. - * - * @param string $path The path to the file - * @param bool $checkPath Whether to check the path or not - * - * @throws FileNotFoundException If the given path is not a file - */ - public function __construct($path, $checkPath = true) - { - if ($checkPath && !is_file($path)) { - throw new FileNotFoundException($path); - } - - parent::__construct($path); - } - - /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * This method uses the mime type as guessed by getMimeType() - * to guess the file extension. - * - * @return string|null The guessed extension or null if it cannot be guessed - * - * @see ExtensionGuesser - * @see getMimeType() - */ - public function guessExtension() - { - $type = $this->getMimeType(); - $guesser = ExtensionGuesser::getInstance(); - - return $guesser->guess($type); - } - - /** - * Returns the mime type of the file. - * - * The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(), - * mime_content_type() and the system binary "file" (in this order), depending on - * which of those are available. - * - * @return string|null The guessed mime type (e.g. "application/pdf") - * - * @see MimeTypeGuesser - */ - public function getMimeType() - { - $guesser = MimeTypeGuesser::getInstance(); - - return $guesser->guess($this->getPathname()); - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return self A File object representing the new file - * - * @throws FileException if the target file could not be created - */ - public function move($directory, $name = null) - { - $target = $this->getTargetFile($directory, $name); - - if (!@rename($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); - } - - @chmod($target, 0666 & ~umask()); - - return $target; - } - - protected function getTargetFile($directory, $name = null) - { - if (!is_dir($directory)) { - if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) { - throw new FileException(sprintf('Unable to create the "%s" directory', $directory)); - } - } elseif (!is_writable($directory)) { - throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); - } - - $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); - - return new self($target, false); - } - - /** - * Returns locale independent base name of the given path. - * - * @param string $name The new file name - * - * @return string containing - */ - protected function getName($name) - { - $originalName = str_replace('\\', '/', $name); - $pos = strrpos($originalName, '/'); - $originalName = false === $pos ? $originalName : substr($originalName, $pos + 1); - - return $originalName; - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php deleted file mode 100644 index 921751f..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * A singleton mime type to file extension guesser. - * - * A default guesser is provided. - * You can register custom guessers by calling the register() - * method on the singleton instance: - * - * $guesser = ExtensionGuesser::getInstance(); - * $guesser->register(new MyCustomExtensionGuesser()); - * - * The last registered guesser is preferred over previously registered ones. - */ -class ExtensionGuesser implements ExtensionGuesserInterface -{ - /** - * The singleton instance. - * - * @var ExtensionGuesser - */ - private static $instance = null; - - /** - * All registered ExtensionGuesserInterface instances. - * - * @var array - */ - protected $guessers = array(); - - /** - * Returns the singleton instance. - * - * @return self - */ - public static function getInstance() - { - if (null === self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Registers all natively provided extension guessers. - */ - private function __construct() - { - $this->register(new MimeTypeExtensionGuesser()); - } - - /** - * Registers a new extension guesser. - * - * When guessing, this guesser is preferred over previously registered ones. - * - * @param ExtensionGuesserInterface $guesser - */ - public function register(ExtensionGuesserInterface $guesser) - { - array_unshift($this->guessers, $guesser); - } - - /** - * Tries to guess the extension. - * - * The mime type is passed to each registered mime type guesser in reverse order - * of their registration (last registered is queried first). Once a guesser - * returns a value that is not NULL, this method terminates and returns the - * value. - * - * @param string $mimeType The mime type - * - * @return string The guessed extension or NULL, if none could be guessed - */ - public function guess($mimeType) - { - foreach ($this->guessers as $guesser) { - if (null !== $extension = $guesser->guess($mimeType)) { - return $extension; - } - } - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php deleted file mode 100644 index d19a0e5..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * Guesses the file extension corresponding to a given mime type. - */ -interface ExtensionGuesserInterface -{ - /** - * Makes a best guess for a file extension, given a mime type. - * - * @param string $mimeType The mime type - * - * @return string The guessed extension or NULL, if none could be guessed - */ - public function guess($mimeType); -} diff --git a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php deleted file mode 100644 index c2ac676..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type with the binary "file" (only available on *nix). - * - * @author Bernhard Schussek - */ -class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface -{ - private $cmd; - - /** - * The $cmd pattern must contain a "%s" string that will be replaced - * with the file name to guess. - * - * The command output must start with the mime type of the file. - * - * @param string $cmd The command to run to get the mime type of a file - */ - public function __construct($cmd = 'file -b --mime %s 2>/dev/null') - { - $this->cmd = $cmd; - } - - /** - * Returns whether this guesser is supported on the current OS. - * - * @return bool - */ - public static function isSupported() - { - return '\\' !== DIRECTORY_SEPARATOR && function_exists('passthru') && function_exists('escapeshellarg'); - } - - /** - * {@inheritdoc} - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return; - } - - ob_start(); - - // need to use --mime instead of -i. see #6641 - passthru(sprintf($this->cmd, escapeshellarg($path)), $return); - if ($return > 0) { - ob_end_clean(); - - return; - } - - $type = trim(ob_get_clean()); - - if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { - // it's not a type, but an error message - return; - } - - return $match[1]; - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php deleted file mode 100644 index 9b42835..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type using the PECL extension FileInfo. - * - * @author Bernhard Schussek - */ -class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface -{ - private $magicFile; - - /** - * @param string $magicFile A magic file to use with the finfo instance - * - * @see http://www.php.net/manual/en/function.finfo-open.php - */ - public function __construct($magicFile = null) - { - $this->magicFile = $magicFile; - } - - /** - * Returns whether this guesser is supported on the current OS/PHP setup. - * - * @return bool - */ - public static function isSupported() - { - return function_exists('finfo_open'); - } - - /** - * {@inheritdoc} - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!self::isSupported()) { - return; - } - - if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { - return; - } - - return $finfo->file($path); - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php deleted file mode 100644 index e327f83..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php +++ /dev/null @@ -1,809 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -/** - * Provides a best-guess mapping of mime type to file extension. - */ -class MimeTypeExtensionGuesser implements ExtensionGuesserInterface -{ - /** - * A map of mime types and their default extensions. - * - * This list has been placed under the public domain by the Apache HTTPD project. - * This list has been updated from upstream on 2013-04-23. - * - * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types - * - * @var array - */ - protected $defaultExtensions = array( - 'application/andrew-inset' => 'ez', - 'application/applixware' => 'aw', - 'application/atom+xml' => 'atom', - 'application/atomcat+xml' => 'atomcat', - 'application/atomsvc+xml' => 'atomsvc', - 'application/ccxml+xml' => 'ccxml', - 'application/cdmi-capability' => 'cdmia', - 'application/cdmi-container' => 'cdmic', - 'application/cdmi-domain' => 'cdmid', - 'application/cdmi-object' => 'cdmio', - 'application/cdmi-queue' => 'cdmiq', - 'application/cu-seeme' => 'cu', - 'application/davmount+xml' => 'davmount', - 'application/docbook+xml' => 'dbk', - 'application/dssc+der' => 'dssc', - 'application/dssc+xml' => 'xdssc', - 'application/ecmascript' => 'ecma', - 'application/emma+xml' => 'emma', - 'application/epub+zip' => 'epub', - 'application/exi' => 'exi', - 'application/font-tdpfr' => 'pfr', - 'application/gml+xml' => 'gml', - 'application/gpx+xml' => 'gpx', - 'application/gxf' => 'gxf', - 'application/hyperstudio' => 'stk', - 'application/inkml+xml' => 'ink', - 'application/ipfix' => 'ipfix', - 'application/java-archive' => 'jar', - 'application/java-serialized-object' => 'ser', - 'application/java-vm' => 'class', - 'application/javascript' => 'js', - 'application/json' => 'json', - 'application/jsonml+json' => 'jsonml', - 'application/lost+xml' => 'lostxml', - 'application/mac-binhex40' => 'hqx', - 'application/mac-compactpro' => 'cpt', - 'application/mads+xml' => 'mads', - 'application/marc' => 'mrc', - 'application/marcxml+xml' => 'mrcx', - 'application/mathematica' => 'ma', - 'application/mathml+xml' => 'mathml', - 'application/mbox' => 'mbox', - 'application/mediaservercontrol+xml' => 'mscml', - 'application/metalink+xml' => 'metalink', - 'application/metalink4+xml' => 'meta4', - 'application/mets+xml' => 'mets', - 'application/mods+xml' => 'mods', - 'application/mp21' => 'm21', - 'application/mp4' => 'mp4s', - 'application/msword' => 'doc', - 'application/mxf' => 'mxf', - 'application/octet-stream' => 'bin', - 'application/oda' => 'oda', - 'application/oebps-package+xml' => 'opf', - 'application/ogg' => 'ogx', - 'application/omdoc+xml' => 'omdoc', - 'application/onenote' => 'onetoc', - 'application/oxps' => 'oxps', - 'application/patch-ops-error+xml' => 'xer', - 'application/pdf' => 'pdf', - 'application/pgp-encrypted' => 'pgp', - 'application/pgp-signature' => 'asc', - 'application/pics-rules' => 'prf', - 'application/pkcs10' => 'p10', - 'application/pkcs7-mime' => 'p7m', - 'application/pkcs7-signature' => 'p7s', - 'application/pkcs8' => 'p8', - 'application/pkix-attr-cert' => 'ac', - 'application/pkix-cert' => 'cer', - 'application/pkix-crl' => 'crl', - 'application/pkix-pkipath' => 'pkipath', - 'application/pkixcmp' => 'pki', - 'application/pls+xml' => 'pls', - 'application/postscript' => 'ai', - 'application/prs.cww' => 'cww', - 'application/pskc+xml' => 'pskcxml', - 'application/rdf+xml' => 'rdf', - 'application/reginfo+xml' => 'rif', - 'application/relax-ng-compact-syntax' => 'rnc', - 'application/resource-lists+xml' => 'rl', - 'application/resource-lists-diff+xml' => 'rld', - 'application/rls-services+xml' => 'rs', - 'application/rpki-ghostbusters' => 'gbr', - 'application/rpki-manifest' => 'mft', - 'application/rpki-roa' => 'roa', - 'application/rsd+xml' => 'rsd', - 'application/rss+xml' => 'rss', - 'application/rtf' => 'rtf', - 'application/sbml+xml' => 'sbml', - 'application/scvp-cv-request' => 'scq', - 'application/scvp-cv-response' => 'scs', - 'application/scvp-vp-request' => 'spq', - 'application/scvp-vp-response' => 'spp', - 'application/sdp' => 'sdp', - 'application/set-payment-initiation' => 'setpay', - 'application/set-registration-initiation' => 'setreg', - 'application/shf+xml' => 'shf', - 'application/smil+xml' => 'smi', - 'application/sparql-query' => 'rq', - 'application/sparql-results+xml' => 'srx', - 'application/srgs' => 'gram', - 'application/srgs+xml' => 'grxml', - 'application/sru+xml' => 'sru', - 'application/ssdl+xml' => 'ssdl', - 'application/ssml+xml' => 'ssml', - 'application/tei+xml' => 'tei', - 'application/thraud+xml' => 'tfi', - 'application/timestamped-data' => 'tsd', - 'application/vnd.3gpp.pic-bw-large' => 'plb', - 'application/vnd.3gpp.pic-bw-small' => 'psb', - 'application/vnd.3gpp.pic-bw-var' => 'pvb', - 'application/vnd.3gpp2.tcap' => 'tcap', - 'application/vnd.3m.post-it-notes' => 'pwn', - 'application/vnd.accpac.simply.aso' => 'aso', - 'application/vnd.accpac.simply.imp' => 'imp', - 'application/vnd.acucobol' => 'acu', - 'application/vnd.acucorp' => 'atc', - 'application/vnd.adobe.air-application-installer-package+zip' => 'air', - 'application/vnd.adobe.formscentral.fcdt' => 'fcdt', - 'application/vnd.adobe.fxp' => 'fxp', - 'application/vnd.adobe.xdp+xml' => 'xdp', - 'application/vnd.adobe.xfdf' => 'xfdf', - 'application/vnd.ahead.space' => 'ahead', - 'application/vnd.airzip.filesecure.azf' => 'azf', - 'application/vnd.airzip.filesecure.azs' => 'azs', - 'application/vnd.amazon.ebook' => 'azw', - 'application/vnd.americandynamics.acc' => 'acc', - 'application/vnd.amiga.ami' => 'ami', - 'application/vnd.android.package-archive' => 'apk', - 'application/vnd.anser-web-certificate-issue-initiation' => 'cii', - 'application/vnd.anser-web-funds-transfer-initiation' => 'fti', - 'application/vnd.antix.game-component' => 'atx', - 'application/vnd.apple.installer+xml' => 'mpkg', - 'application/vnd.apple.mpegurl' => 'm3u8', - 'application/vnd.aristanetworks.swi' => 'swi', - 'application/vnd.astraea-software.iota' => 'iota', - 'application/vnd.audiograph' => 'aep', - 'application/vnd.blueice.multipass' => 'mpm', - 'application/vnd.bmi' => 'bmi', - 'application/vnd.businessobjects' => 'rep', - 'application/vnd.chemdraw+xml' => 'cdxml', - 'application/vnd.chipnuts.karaoke-mmd' => 'mmd', - 'application/vnd.cinderella' => 'cdy', - 'application/vnd.claymore' => 'cla', - 'application/vnd.cloanto.rp9' => 'rp9', - 'application/vnd.clonk.c4group' => 'c4g', - 'application/vnd.cluetrust.cartomobile-config' => 'c11amc', - 'application/vnd.cluetrust.cartomobile-config-pkg' => 'c11amz', - 'application/vnd.commonspace' => 'csp', - 'application/vnd.contact.cmsg' => 'cdbcmsg', - 'application/vnd.cosmocaller' => 'cmc', - 'application/vnd.crick.clicker' => 'clkx', - 'application/vnd.crick.clicker.keyboard' => 'clkk', - 'application/vnd.crick.clicker.palette' => 'clkp', - 'application/vnd.crick.clicker.template' => 'clkt', - 'application/vnd.crick.clicker.wordbank' => 'clkw', - 'application/vnd.criticaltools.wbs+xml' => 'wbs', - 'application/vnd.ctc-posml' => 'pml', - 'application/vnd.cups-ppd' => 'ppd', - 'application/vnd.curl.car' => 'car', - 'application/vnd.curl.pcurl' => 'pcurl', - 'application/vnd.dart' => 'dart', - 'application/vnd.data-vision.rdz' => 'rdz', - 'application/vnd.dece.data' => 'uvf', - 'application/vnd.dece.ttml+xml' => 'uvt', - 'application/vnd.dece.unspecified' => 'uvx', - 'application/vnd.dece.zip' => 'uvz', - 'application/vnd.denovo.fcselayout-link' => 'fe_launch', - 'application/vnd.dna' => 'dna', - 'application/vnd.dolby.mlp' => 'mlp', - 'application/vnd.dpgraph' => 'dpg', - 'application/vnd.dreamfactory' => 'dfac', - 'application/vnd.ds-keypoint' => 'kpxx', - 'application/vnd.dvb.ait' => 'ait', - 'application/vnd.dvb.service' => 'svc', - 'application/vnd.dynageo' => 'geo', - 'application/vnd.ecowin.chart' => 'mag', - 'application/vnd.enliven' => 'nml', - 'application/vnd.epson.esf' => 'esf', - 'application/vnd.epson.msf' => 'msf', - 'application/vnd.epson.quickanime' => 'qam', - 'application/vnd.epson.salt' => 'slt', - 'application/vnd.epson.ssf' => 'ssf', - 'application/vnd.eszigno3+xml' => 'es3', - 'application/vnd.ezpix-album' => 'ez2', - 'application/vnd.ezpix-package' => 'ez3', - 'application/vnd.fdf' => 'fdf', - 'application/vnd.fdsn.mseed' => 'mseed', - 'application/vnd.fdsn.seed' => 'seed', - 'application/vnd.flographit' => 'gph', - 'application/vnd.fluxtime.clip' => 'ftc', - 'application/vnd.framemaker' => 'fm', - 'application/vnd.frogans.fnc' => 'fnc', - 'application/vnd.frogans.ltf' => 'ltf', - 'application/vnd.fsc.weblaunch' => 'fsc', - 'application/vnd.fujitsu.oasys' => 'oas', - 'application/vnd.fujitsu.oasys2' => 'oa2', - 'application/vnd.fujitsu.oasys3' => 'oa3', - 'application/vnd.fujitsu.oasysgp' => 'fg5', - 'application/vnd.fujitsu.oasysprs' => 'bh2', - 'application/vnd.fujixerox.ddd' => 'ddd', - 'application/vnd.fujixerox.docuworks' => 'xdw', - 'application/vnd.fujixerox.docuworks.binder' => 'xbd', - 'application/vnd.fuzzysheet' => 'fzs', - 'application/vnd.genomatix.tuxedo' => 'txd', - 'application/vnd.geogebra.file' => 'ggb', - 'application/vnd.geogebra.tool' => 'ggt', - 'application/vnd.geometry-explorer' => 'gex', - 'application/vnd.geonext' => 'gxt', - 'application/vnd.geoplan' => 'g2w', - 'application/vnd.geospace' => 'g3w', - 'application/vnd.gmx' => 'gmx', - 'application/vnd.google-earth.kml+xml' => 'kml', - 'application/vnd.google-earth.kmz' => 'kmz', - 'application/vnd.grafeq' => 'gqf', - 'application/vnd.groove-account' => 'gac', - 'application/vnd.groove-help' => 'ghf', - 'application/vnd.groove-identity-message' => 'gim', - 'application/vnd.groove-injector' => 'grv', - 'application/vnd.groove-tool-message' => 'gtm', - 'application/vnd.groove-tool-template' => 'tpl', - 'application/vnd.groove-vcard' => 'vcg', - 'application/vnd.hal+xml' => 'hal', - 'application/vnd.handheld-entertainment+xml' => 'zmm', - 'application/vnd.hbci' => 'hbci', - 'application/vnd.hhe.lesson-player' => 'les', - 'application/vnd.hp-hpgl' => 'hpgl', - 'application/vnd.hp-hpid' => 'hpid', - 'application/vnd.hp-hps' => 'hps', - 'application/vnd.hp-jlyt' => 'jlt', - 'application/vnd.hp-pcl' => 'pcl', - 'application/vnd.hp-pclxl' => 'pclxl', - 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', - 'application/vnd.ibm.minipay' => 'mpy', - 'application/vnd.ibm.modcap' => 'afp', - 'application/vnd.ibm.rights-management' => 'irm', - 'application/vnd.ibm.secure-container' => 'sc', - 'application/vnd.iccprofile' => 'icc', - 'application/vnd.igloader' => 'igl', - 'application/vnd.immervision-ivp' => 'ivp', - 'application/vnd.immervision-ivu' => 'ivu', - 'application/vnd.insors.igm' => 'igm', - 'application/vnd.intercon.formnet' => 'xpw', - 'application/vnd.intergeo' => 'i2g', - 'application/vnd.intu.qbo' => 'qbo', - 'application/vnd.intu.qfx' => 'qfx', - 'application/vnd.ipunplugged.rcprofile' => 'rcprofile', - 'application/vnd.irepository.package+xml' => 'irp', - 'application/vnd.is-xpr' => 'xpr', - 'application/vnd.isac.fcs' => 'fcs', - 'application/vnd.jam' => 'jam', - 'application/vnd.jcp.javame.midlet-rms' => 'rms', - 'application/vnd.jisp' => 'jisp', - 'application/vnd.joost.joda-archive' => 'joda', - 'application/vnd.kahootz' => 'ktz', - 'application/vnd.kde.karbon' => 'karbon', - 'application/vnd.kde.kchart' => 'chrt', - 'application/vnd.kde.kformula' => 'kfo', - 'application/vnd.kde.kivio' => 'flw', - 'application/vnd.kde.kontour' => 'kon', - 'application/vnd.kde.kpresenter' => 'kpr', - 'application/vnd.kde.kspread' => 'ksp', - 'application/vnd.kde.kword' => 'kwd', - 'application/vnd.kenameaapp' => 'htke', - 'application/vnd.kidspiration' => 'kia', - 'application/vnd.kinar' => 'kne', - 'application/vnd.koan' => 'skp', - 'application/vnd.kodak-descriptor' => 'sse', - 'application/vnd.las.las+xml' => 'lasxml', - 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', - 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', - 'application/vnd.lotus-1-2-3' => '123', - 'application/vnd.lotus-approach' => 'apr', - 'application/vnd.lotus-freelance' => 'pre', - 'application/vnd.lotus-notes' => 'nsf', - 'application/vnd.lotus-organizer' => 'org', - 'application/vnd.lotus-screencam' => 'scm', - 'application/vnd.lotus-wordpro' => 'lwp', - 'application/vnd.macports.portpkg' => 'portpkg', - 'application/vnd.mcd' => 'mcd', - 'application/vnd.medcalcdata' => 'mc1', - 'application/vnd.mediastation.cdkey' => 'cdkey', - 'application/vnd.mfer' => 'mwf', - 'application/vnd.mfmp' => 'mfm', - 'application/vnd.micrografx.flo' => 'flo', - 'application/vnd.micrografx.igx' => 'igx', - 'application/vnd.mif' => 'mif', - 'application/vnd.mobius.daf' => 'daf', - 'application/vnd.mobius.dis' => 'dis', - 'application/vnd.mobius.mbk' => 'mbk', - 'application/vnd.mobius.mqy' => 'mqy', - 'application/vnd.mobius.msl' => 'msl', - 'application/vnd.mobius.plc' => 'plc', - 'application/vnd.mobius.txf' => 'txf', - 'application/vnd.mophun.application' => 'mpn', - 'application/vnd.mophun.certificate' => 'mpc', - 'application/vnd.mozilla.xul+xml' => 'xul', - 'application/vnd.ms-artgalry' => 'cil', - 'application/vnd.ms-cab-compressed' => 'cab', - 'application/vnd.ms-excel' => 'xls', - 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', - 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', - 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', - 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', - 'application/vnd.ms-fontobject' => 'eot', - 'application/vnd.ms-htmlhelp' => 'chm', - 'application/vnd.ms-ims' => 'ims', - 'application/vnd.ms-lrm' => 'lrm', - 'application/vnd.ms-officetheme' => 'thmx', - 'application/vnd.ms-pki.seccat' => 'cat', - 'application/vnd.ms-pki.stl' => 'stl', - 'application/vnd.ms-powerpoint' => 'ppt', - 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', - 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', - 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', - 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', - 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', - 'application/vnd.ms-project' => 'mpp', - 'application/vnd.ms-word.document.macroenabled.12' => 'docm', - 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', - 'application/vnd.ms-works' => 'wps', - 'application/vnd.ms-wpl' => 'wpl', - 'application/vnd.ms-xpsdocument' => 'xps', - 'application/vnd.mseq' => 'mseq', - 'application/vnd.musician' => 'mus', - 'application/vnd.muvee.style' => 'msty', - 'application/vnd.mynfc' => 'taglet', - 'application/vnd.neurolanguage.nlu' => 'nlu', - 'application/vnd.nitf' => 'ntf', - 'application/vnd.noblenet-directory' => 'nnd', - 'application/vnd.noblenet-sealer' => 'nns', - 'application/vnd.noblenet-web' => 'nnw', - 'application/vnd.nokia.n-gage.data' => 'ngdat', - 'application/vnd.nokia.n-gage.symbian.install' => 'n-gage', - 'application/vnd.nokia.radio-preset' => 'rpst', - 'application/vnd.nokia.radio-presets' => 'rpss', - 'application/vnd.novadigm.edm' => 'edm', - 'application/vnd.novadigm.edx' => 'edx', - 'application/vnd.novadigm.ext' => 'ext', - 'application/vnd.oasis.opendocument.chart' => 'odc', - 'application/vnd.oasis.opendocument.chart-template' => 'otc', - 'application/vnd.oasis.opendocument.database' => 'odb', - 'application/vnd.oasis.opendocument.formula' => 'odf', - 'application/vnd.oasis.opendocument.formula-template' => 'odft', - 'application/vnd.oasis.opendocument.graphics' => 'odg', - 'application/vnd.oasis.opendocument.graphics-template' => 'otg', - 'application/vnd.oasis.opendocument.image' => 'odi', - 'application/vnd.oasis.opendocument.image-template' => 'oti', - 'application/vnd.oasis.opendocument.presentation' => 'odp', - 'application/vnd.oasis.opendocument.presentation-template' => 'otp', - 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', - 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', - 'application/vnd.oasis.opendocument.text' => 'odt', - 'application/vnd.oasis.opendocument.text-master' => 'odm', - 'application/vnd.oasis.opendocument.text-template' => 'ott', - 'application/vnd.oasis.opendocument.text-web' => 'oth', - 'application/vnd.olpc-sugar' => 'xo', - 'application/vnd.oma.dd2+xml' => 'dd2', - 'application/vnd.openofficeorg.extension' => 'oxt', - 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', - 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', - 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', - 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', - 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', - 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', - 'application/vnd.osgeo.mapguide.package' => 'mgp', - 'application/vnd.osgi.dp' => 'dp', - 'application/vnd.osgi.subsystem' => 'esa', - 'application/vnd.palm' => 'pdb', - 'application/vnd.pawaafile' => 'paw', - 'application/vnd.pg.format' => 'str', - 'application/vnd.pg.osasli' => 'ei6', - 'application/vnd.picsel' => 'efif', - 'application/vnd.pmi.widget' => 'wg', - 'application/vnd.pocketlearn' => 'plf', - 'application/vnd.powerbuilder6' => 'pbd', - 'application/vnd.previewsystems.box' => 'box', - 'application/vnd.proteus.magazine' => 'mgz', - 'application/vnd.publishare-delta-tree' => 'qps', - 'application/vnd.pvi.ptid1' => 'ptid', - 'application/vnd.quark.quarkxpress' => 'qxd', - 'application/vnd.realvnc.bed' => 'bed', - 'application/vnd.recordare.musicxml' => 'mxl', - 'application/vnd.recordare.musicxml+xml' => 'musicxml', - 'application/vnd.rig.cryptonote' => 'cryptonote', - 'application/vnd.rim.cod' => 'cod', - 'application/vnd.rn-realmedia' => 'rm', - 'application/vnd.rn-realmedia-vbr' => 'rmvb', - 'application/vnd.route66.link66+xml' => 'link66', - 'application/vnd.sailingtracker.track' => 'st', - 'application/vnd.seemail' => 'see', - 'application/vnd.sema' => 'sema', - 'application/vnd.semd' => 'semd', - 'application/vnd.semf' => 'semf', - 'application/vnd.shana.informed.formdata' => 'ifm', - 'application/vnd.shana.informed.formtemplate' => 'itp', - 'application/vnd.shana.informed.interchange' => 'iif', - 'application/vnd.shana.informed.package' => 'ipk', - 'application/vnd.simtech-mindmapper' => 'twd', - 'application/vnd.smaf' => 'mmf', - 'application/vnd.smart.teacher' => 'teacher', - 'application/vnd.solent.sdkm+xml' => 'sdkm', - 'application/vnd.spotfire.dxp' => 'dxp', - 'application/vnd.spotfire.sfs' => 'sfs', - 'application/vnd.stardivision.calc' => 'sdc', - 'application/vnd.stardivision.draw' => 'sda', - 'application/vnd.stardivision.impress' => 'sdd', - 'application/vnd.stardivision.math' => 'smf', - 'application/vnd.stardivision.writer' => 'sdw', - 'application/vnd.stardivision.writer-global' => 'sgl', - 'application/vnd.stepmania.package' => 'smzip', - 'application/vnd.stepmania.stepchart' => 'sm', - 'application/vnd.sun.xml.calc' => 'sxc', - 'application/vnd.sun.xml.calc.template' => 'stc', - 'application/vnd.sun.xml.draw' => 'sxd', - 'application/vnd.sun.xml.draw.template' => 'std', - 'application/vnd.sun.xml.impress' => 'sxi', - 'application/vnd.sun.xml.impress.template' => 'sti', - 'application/vnd.sun.xml.math' => 'sxm', - 'application/vnd.sun.xml.writer' => 'sxw', - 'application/vnd.sun.xml.writer.global' => 'sxg', - 'application/vnd.sun.xml.writer.template' => 'stw', - 'application/vnd.sus-calendar' => 'sus', - 'application/vnd.svd' => 'svd', - 'application/vnd.symbian.install' => 'sis', - 'application/vnd.syncml+xml' => 'xsm', - 'application/vnd.syncml.dm+wbxml' => 'bdm', - 'application/vnd.syncml.dm+xml' => 'xdm', - 'application/vnd.tao.intent-module-archive' => 'tao', - 'application/vnd.tcpdump.pcap' => 'pcap', - 'application/vnd.tmobile-livetv' => 'tmo', - 'application/vnd.trid.tpt' => 'tpt', - 'application/vnd.triscape.mxs' => 'mxs', - 'application/vnd.trueapp' => 'tra', - 'application/vnd.ufdl' => 'ufd', - 'application/vnd.uiq.theme' => 'utz', - 'application/vnd.umajin' => 'umj', - 'application/vnd.unity' => 'unityweb', - 'application/vnd.uoml+xml' => 'uoml', - 'application/vnd.vcx' => 'vcx', - 'application/vnd.visio' => 'vsd', - 'application/vnd.visionary' => 'vis', - 'application/vnd.vsf' => 'vsf', - 'application/vnd.wap.wbxml' => 'wbxml', - 'application/vnd.wap.wmlc' => 'wmlc', - 'application/vnd.wap.wmlscriptc' => 'wmlsc', - 'application/vnd.webturbo' => 'wtb', - 'application/vnd.wolfram.player' => 'nbp', - 'application/vnd.wordperfect' => 'wpd', - 'application/vnd.wqd' => 'wqd', - 'application/vnd.wt.stf' => 'stf', - 'application/vnd.xara' => 'xar', - 'application/vnd.xfdl' => 'xfdl', - 'application/vnd.yamaha.hv-dic' => 'hvd', - 'application/vnd.yamaha.hv-script' => 'hvs', - 'application/vnd.yamaha.hv-voice' => 'hvp', - 'application/vnd.yamaha.openscoreformat' => 'osf', - 'application/vnd.yamaha.openscoreformat.osfpvg+xml' => 'osfpvg', - 'application/vnd.yamaha.smaf-audio' => 'saf', - 'application/vnd.yamaha.smaf-phrase' => 'spf', - 'application/vnd.yellowriver-custom-menu' => 'cmp', - 'application/vnd.zul' => 'zir', - 'application/vnd.zzazz.deck+xml' => 'zaz', - 'application/voicexml+xml' => 'vxml', - 'application/widget' => 'wgt', - 'application/winhlp' => 'hlp', - 'application/wsdl+xml' => 'wsdl', - 'application/wspolicy+xml' => 'wspolicy', - 'application/x-7z-compressed' => '7z', - 'application/x-abiword' => 'abw', - 'application/x-ace-compressed' => 'ace', - 'application/x-apple-diskimage' => 'dmg', - 'application/x-authorware-bin' => 'aab', - 'application/x-authorware-map' => 'aam', - 'application/x-authorware-seg' => 'aas', - 'application/x-bcpio' => 'bcpio', - 'application/x-bittorrent' => 'torrent', - 'application/x-blorb' => 'blb', - 'application/x-bzip' => 'bz', - 'application/x-bzip2' => 'bz2', - 'application/x-cbr' => 'cbr', - 'application/x-cdlink' => 'vcd', - 'application/x-cfs-compressed' => 'cfs', - 'application/x-chat' => 'chat', - 'application/x-chess-pgn' => 'pgn', - 'application/x-conference' => 'nsc', - 'application/x-cpio' => 'cpio', - 'application/x-csh' => 'csh', - 'application/x-debian-package' => 'deb', - 'application/x-dgc-compressed' => 'dgc', - 'application/x-director' => 'dir', - 'application/x-doom' => 'wad', - 'application/x-dtbncx+xml' => 'ncx', - 'application/x-dtbook+xml' => 'dtb', - 'application/x-dtbresource+xml' => 'res', - 'application/x-dvi' => 'dvi', - 'application/x-envoy' => 'evy', - 'application/x-eva' => 'eva', - 'application/x-font-bdf' => 'bdf', - 'application/x-font-ghostscript' => 'gsf', - 'application/x-font-linux-psf' => 'psf', - 'application/x-font-otf' => 'otf', - 'application/x-font-pcf' => 'pcf', - 'application/x-font-snf' => 'snf', - 'application/x-font-ttf' => 'ttf', - 'application/x-font-type1' => 'pfa', - 'application/x-font-woff' => 'woff', - 'application/x-freearc' => 'arc', - 'application/x-futuresplash' => 'spl', - 'application/x-gca-compressed' => 'gca', - 'application/x-glulx' => 'ulx', - 'application/x-gnumeric' => 'gnumeric', - 'application/x-gramps-xml' => 'gramps', - 'application/x-gtar' => 'gtar', - 'application/x-hdf' => 'hdf', - 'application/x-install-instructions' => 'install', - 'application/x-iso9660-image' => 'iso', - 'application/x-java-jnlp-file' => 'jnlp', - 'application/x-latex' => 'latex', - 'application/x-lzh-compressed' => 'lzh', - 'application/x-mie' => 'mie', - 'application/x-mobipocket-ebook' => 'prc', - 'application/x-ms-application' => 'application', - 'application/x-ms-shortcut' => 'lnk', - 'application/x-ms-wmd' => 'wmd', - 'application/x-ms-wmz' => 'wmz', - 'application/x-ms-xbap' => 'xbap', - 'application/x-msaccess' => 'mdb', - 'application/x-msbinder' => 'obd', - 'application/x-mscardfile' => 'crd', - 'application/x-msclip' => 'clp', - 'application/x-msdownload' => 'exe', - 'application/x-msmediaview' => 'mvb', - 'application/x-msmetafile' => 'wmf', - 'application/x-msmoney' => 'mny', - 'application/x-mspublisher' => 'pub', - 'application/x-msschedule' => 'scd', - 'application/x-msterminal' => 'trm', - 'application/x-mswrite' => 'wri', - 'application/x-netcdf' => 'nc', - 'application/x-nzb' => 'nzb', - 'application/x-pkcs12' => 'p12', - 'application/x-pkcs7-certificates' => 'p7b', - 'application/x-pkcs7-certreqresp' => 'p7r', - 'application/x-rar-compressed' => 'rar', - 'application/x-rar' => 'rar', - 'application/x-research-info-systems' => 'ris', - 'application/x-sh' => 'sh', - 'application/x-shar' => 'shar', - 'application/x-shockwave-flash' => 'swf', - 'application/x-silverlight-app' => 'xap', - 'application/x-sql' => 'sql', - 'application/x-stuffit' => 'sit', - 'application/x-stuffitx' => 'sitx', - 'application/x-subrip' => 'srt', - 'application/x-sv4cpio' => 'sv4cpio', - 'application/x-sv4crc' => 'sv4crc', - 'application/x-t3vm-image' => 't3', - 'application/x-tads' => 'gam', - 'application/x-tar' => 'tar', - 'application/x-tcl' => 'tcl', - 'application/x-tex' => 'tex', - 'application/x-tex-tfm' => 'tfm', - 'application/x-texinfo' => 'texinfo', - 'application/x-tgif' => 'obj', - 'application/x-ustar' => 'ustar', - 'application/x-wais-source' => 'src', - 'application/x-x509-ca-cert' => 'der', - 'application/x-xfig' => 'fig', - 'application/x-xliff+xml' => 'xlf', - 'application/x-xpinstall' => 'xpi', - 'application/x-xz' => 'xz', - 'application/x-zmachine' => 'z1', - 'application/xaml+xml' => 'xaml', - 'application/xcap-diff+xml' => 'xdf', - 'application/xenc+xml' => 'xenc', - 'application/xhtml+xml' => 'xhtml', - 'application/xml' => 'xml', - 'application/xml-dtd' => 'dtd', - 'application/xop+xml' => 'xop', - 'application/xproc+xml' => 'xpl', - 'application/xslt+xml' => 'xslt', - 'application/xspf+xml' => 'xspf', - 'application/xv+xml' => 'mxml', - 'application/yang' => 'yang', - 'application/yin+xml' => 'yin', - 'application/zip' => 'zip', - 'audio/adpcm' => 'adp', - 'audio/basic' => 'au', - 'audio/midi' => 'mid', - 'audio/mp4' => 'mp4a', - 'audio/mpeg' => 'mpga', - 'audio/ogg' => 'oga', - 'audio/s3m' => 's3m', - 'audio/silk' => 'sil', - 'audio/vnd.dece.audio' => 'uva', - 'audio/vnd.digital-winds' => 'eol', - 'audio/vnd.dra' => 'dra', - 'audio/vnd.dts' => 'dts', - 'audio/vnd.dts.hd' => 'dtshd', - 'audio/vnd.lucent.voice' => 'lvp', - 'audio/vnd.ms-playready.media.pya' => 'pya', - 'audio/vnd.nuera.ecelp4800' => 'ecelp4800', - 'audio/vnd.nuera.ecelp7470' => 'ecelp7470', - 'audio/vnd.nuera.ecelp9600' => 'ecelp9600', - 'audio/vnd.rip' => 'rip', - 'audio/webm' => 'weba', - 'audio/x-aac' => 'aac', - 'audio/x-aiff' => 'aif', - 'audio/x-caf' => 'caf', - 'audio/x-flac' => 'flac', - 'audio/x-matroska' => 'mka', - 'audio/x-mpegurl' => 'm3u', - 'audio/x-ms-wax' => 'wax', - 'audio/x-ms-wma' => 'wma', - 'audio/x-pn-realaudio' => 'ram', - 'audio/x-pn-realaudio-plugin' => 'rmp', - 'audio/x-wav' => 'wav', - 'audio/xm' => 'xm', - 'chemical/x-cdx' => 'cdx', - 'chemical/x-cif' => 'cif', - 'chemical/x-cmdf' => 'cmdf', - 'chemical/x-cml' => 'cml', - 'chemical/x-csml' => 'csml', - 'chemical/x-xyz' => 'xyz', - 'image/bmp' => 'bmp', - 'image/x-ms-bmp' => 'bmp', - 'image/cgm' => 'cgm', - 'image/g3fax' => 'g3', - 'image/gif' => 'gif', - 'image/ief' => 'ief', - 'image/jpeg' => 'jpeg', - 'image/pjpeg' => 'jpeg', - 'image/ktx' => 'ktx', - 'image/png' => 'png', - 'image/prs.btif' => 'btif', - 'image/sgi' => 'sgi', - 'image/svg+xml' => 'svg', - 'image/tiff' => 'tiff', - 'image/vnd.adobe.photoshop' => 'psd', - 'image/vnd.dece.graphic' => 'uvi', - 'image/vnd.dvb.subtitle' => 'sub', - 'image/vnd.djvu' => 'djvu', - 'image/vnd.dwg' => 'dwg', - 'image/vnd.dxf' => 'dxf', - 'image/vnd.fastbidsheet' => 'fbs', - 'image/vnd.fpx' => 'fpx', - 'image/vnd.fst' => 'fst', - 'image/vnd.fujixerox.edmics-mmr' => 'mmr', - 'image/vnd.fujixerox.edmics-rlc' => 'rlc', - 'image/vnd.ms-modi' => 'mdi', - 'image/vnd.ms-photo' => 'wdp', - 'image/vnd.net-fpx' => 'npx', - 'image/vnd.wap.wbmp' => 'wbmp', - 'image/vnd.xiff' => 'xif', - 'image/webp' => 'webp', - 'image/x-3ds' => '3ds', - 'image/x-cmu-raster' => 'ras', - 'image/x-cmx' => 'cmx', - 'image/x-freehand' => 'fh', - 'image/x-icon' => 'ico', - 'image/x-mrsid-image' => 'sid', - 'image/x-pcx' => 'pcx', - 'image/x-pict' => 'pic', - 'image/x-portable-anymap' => 'pnm', - 'image/x-portable-bitmap' => 'pbm', - 'image/x-portable-graymap' => 'pgm', - 'image/x-portable-pixmap' => 'ppm', - 'image/x-rgb' => 'rgb', - 'image/x-tga' => 'tga', - 'image/x-xbitmap' => 'xbm', - 'image/x-xpixmap' => 'xpm', - 'image/x-xwindowdump' => 'xwd', - 'message/rfc822' => 'eml', - 'model/iges' => 'igs', - 'model/mesh' => 'msh', - 'model/vnd.collada+xml' => 'dae', - 'model/vnd.dwf' => 'dwf', - 'model/vnd.gdl' => 'gdl', - 'model/vnd.gtw' => 'gtw', - 'model/vnd.mts' => 'mts', - 'model/vnd.vtu' => 'vtu', - 'model/vrml' => 'wrl', - 'model/x3d+binary' => 'x3db', - 'model/x3d+vrml' => 'x3dv', - 'model/x3d+xml' => 'x3d', - 'text/cache-manifest' => 'appcache', - 'text/calendar' => 'ics', - 'text/css' => 'css', - 'text/csv' => 'csv', - 'text/html' => 'html', - 'text/n3' => 'n3', - 'text/plain' => 'txt', - 'text/prs.lines.tag' => 'dsc', - 'text/richtext' => 'rtx', - 'text/rtf' => 'rtf', - 'text/sgml' => 'sgml', - 'text/tab-separated-values' => 'tsv', - 'text/troff' => 't', - 'text/turtle' => 'ttl', - 'text/uri-list' => 'uri', - 'text/vcard' => 'vcard', - 'text/vnd.curl' => 'curl', - 'text/vnd.curl.dcurl' => 'dcurl', - 'text/vnd.curl.scurl' => 'scurl', - 'text/vnd.curl.mcurl' => 'mcurl', - 'text/vnd.dvb.subtitle' => 'sub', - 'text/vnd.fly' => 'fly', - 'text/vnd.fmi.flexstor' => 'flx', - 'text/vnd.graphviz' => 'gv', - 'text/vnd.in3d.3dml' => '3dml', - 'text/vnd.in3d.spot' => 'spot', - 'text/vnd.sun.j2me.app-descriptor' => 'jad', - 'text/vnd.wap.wml' => 'wml', - 'text/vnd.wap.wmlscript' => 'wmls', - 'text/vtt' => 'vtt', - 'text/x-asm' => 's', - 'text/x-c' => 'c', - 'text/x-fortran' => 'f', - 'text/x-pascal' => 'p', - 'text/x-java-source' => 'java', - 'text/x-opml' => 'opml', - 'text/x-nfo' => 'nfo', - 'text/x-setext' => 'etx', - 'text/x-sfv' => 'sfv', - 'text/x-uuencode' => 'uu', - 'text/x-vcalendar' => 'vcs', - 'text/x-vcard' => 'vcf', - 'video/3gpp' => '3gp', - 'video/3gpp2' => '3g2', - 'video/h261' => 'h261', - 'video/h263' => 'h263', - 'video/h264' => 'h264', - 'video/jpeg' => 'jpgv', - 'video/jpm' => 'jpm', - 'video/mj2' => 'mj2', - 'video/mp4' => 'mp4', - 'video/mpeg' => 'mpeg', - 'video/ogg' => 'ogv', - 'video/quicktime' => 'qt', - 'video/vnd.dece.hd' => 'uvh', - 'video/vnd.dece.mobile' => 'uvm', - 'video/vnd.dece.pd' => 'uvp', - 'video/vnd.dece.sd' => 'uvs', - 'video/vnd.dece.video' => 'uvv', - 'video/vnd.dvb.file' => 'dvb', - 'video/vnd.fvt' => 'fvt', - 'video/vnd.mpegurl' => 'mxu', - 'video/vnd.ms-playready.media.pyv' => 'pyv', - 'video/vnd.uvvu.mp4' => 'uvu', - 'video/vnd.vivo' => 'viv', - 'video/webm' => 'webm', - 'video/x-f4v' => 'f4v', - 'video/x-fli' => 'fli', - 'video/x-flv' => 'flv', - 'video/x-m4v' => 'm4v', - 'video/x-matroska' => 'mkv', - 'video/x-mng' => 'mng', - 'video/x-ms-asf' => 'asf', - 'video/x-ms-vob' => 'vob', - 'video/x-ms-wm' => 'wm', - 'video/x-ms-wmv' => 'wmv', - 'video/x-ms-wmx' => 'wmx', - 'video/x-ms-wvx' => 'wvx', - 'video/x-msvideo' => 'avi', - 'video/x-sgi-movie' => 'movie', - 'video/x-smv' => 'smv', - 'x-conference/x-cooltalk' => 'ice', - ); - - /** - * {@inheritdoc} - */ - public function guess($mimeType) - { - return isset($this->defaultExtensions[$mimeType]) ? $this->defaultExtensions[$mimeType] : null; - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php deleted file mode 100644 index 69c803b..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * A singleton mime type guesser. - * - * By default, all mime type guessers provided by the framework are installed - * (if available on the current OS/PHP setup). - * - * You can register custom guessers by calling the register() method on the - * singleton instance. Custom guessers are always called before any default ones. - * - * $guesser = MimeTypeGuesser::getInstance(); - * $guesser->register(new MyCustomMimeTypeGuesser()); - * - * If you want to change the order of the default guessers, just re-register your - * preferred one as a custom one. The last registered guesser is preferred over - * previously registered ones. - * - * Re-registering a built-in guesser also allows you to configure it: - * - * $guesser = MimeTypeGuesser::getInstance(); - * $guesser->register(new FileinfoMimeTypeGuesser('/path/to/magic/file')); - * - * @author Bernhard Schussek - */ -class MimeTypeGuesser implements MimeTypeGuesserInterface -{ - /** - * The singleton instance. - * - * @var MimeTypeGuesser - */ - private static $instance = null; - - /** - * All registered MimeTypeGuesserInterface instances. - * - * @var array - */ - protected $guessers = array(); - - /** - * Returns the singleton instance. - * - * @return self - */ - public static function getInstance() - { - if (null === self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Resets the singleton instance. - */ - public static function reset() - { - self::$instance = null; - } - - /** - * Registers all natively provided mime type guessers. - */ - private function __construct() - { - if (FileBinaryMimeTypeGuesser::isSupported()) { - $this->register(new FileBinaryMimeTypeGuesser()); - } - - if (FileinfoMimeTypeGuesser::isSupported()) { - $this->register(new FileinfoMimeTypeGuesser()); - } - } - - /** - * Registers a new mime type guesser. - * - * When guessing, this guesser is preferred over previously registered ones. - * - * @param MimeTypeGuesserInterface $guesser - */ - public function register(MimeTypeGuesserInterface $guesser) - { - array_unshift($this->guessers, $guesser); - } - - /** - * Tries to guess the mime type of the given file. - * - * The file is passed to each registered mime type guesser in reverse order - * of their registration (last registered is queried first). Once a guesser - * returns a value that is not NULL, this method terminates and returns the - * value. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws \LogicException - * @throws FileNotFoundException - * @throws AccessDeniedException - */ - public function guess($path) - { - if (!is_file($path)) { - throw new FileNotFoundException($path); - } - - if (!is_readable($path)) { - throw new AccessDeniedException($path); - } - - if (!$this->guessers) { - $msg = 'Unable to guess the mime type as no guessers are available'; - if (!FileinfoMimeTypeGuesser::isSupported()) { - $msg .= ' (Did you enable the php_fileinfo extension?)'; - } - throw new \LogicException($msg); - } - - foreach ($this->guessers as $guesser) { - if (null !== $mimeType = $guesser->guess($path)) { - return $mimeType; - } - } - } -} diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php deleted file mode 100644 index f8c3ad2..0000000 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File\MimeType; - -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; - -/** - * Guesses the mime type of a file. - * - * @author Bernhard Schussek - */ -interface MimeTypeGuesserInterface -{ - /** - * Guesses the mime type of the file with the given path. - * - * @param string $path The path to the file - * - * @return string The mime type or NULL, if none could be guessed - * - * @throws FileNotFoundException If the file does not exist - * @throws AccessDeniedException If the file could not be read - */ - public function guess($path); -} diff --git a/vendor/symfony/http-foundation/File/Stream.php b/vendor/symfony/http-foundation/File/Stream.php deleted file mode 100644 index 69ae74c..0000000 --- a/vendor/symfony/http-foundation/File/Stream.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -/** - * A PHP stream of unknown size. - * - * @author Nicolas Grekas - */ -class Stream extends File -{ - /** - * {@inheritdoc} - */ - public function getSize() - { - return false; - } -} diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php deleted file mode 100644 index 9a2d284..0000000 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ /dev/null @@ -1,296 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\File; - -use Symfony\Component\HttpFoundation\File\Exception\FileException; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; - -/** - * A file uploaded through a form. - * - * @author Bernhard Schussek - * @author Florian Eckerstorfer - * @author Fabien Potencier - */ -class UploadedFile extends File -{ - /** - * Whether the test mode is activated. - * - * Local files are used in test mode hence the code should not enforce HTTP uploads. - * - * @var bool - */ - private $test = false; - - /** - * The original name of the uploaded file. - * - * @var string - */ - private $originalName; - - /** - * The mime type provided by the uploader. - * - * @var string - */ - private $mimeType; - - /** - * The file size provided by the uploader. - * - * @var int|null - */ - private $size; - - /** - * The UPLOAD_ERR_XXX constant provided by the uploader. - * - * @var int - */ - private $error; - - /** - * Accepts the information of the uploaded file as provided by the PHP global $_FILES. - * - * The file object is only created when the uploaded file is valid (i.e. when the - * isValid() method returns true). Otherwise the only methods that could be called - * on an UploadedFile instance are: - * - * * getClientOriginalName, - * * getClientMimeType, - * * isValid, - * * getError. - * - * Calling any other method on an non-valid instance will cause an unpredictable result. - * - * @param string $path The full temporary path to the file - * @param string $originalName The original file name - * @param string|null $mimeType The type of the file as provided by PHP; null defaults to application/octet-stream - * @param int|null $size The file size - * @param int|null $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants); null defaults to UPLOAD_ERR_OK - * @param bool $test Whether the test mode is active - * - * @throws FileException If file_uploads is disabled - * @throws FileNotFoundException If the file does not exist - */ - public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false) - { - $this->originalName = $this->getName($originalName); - $this->mimeType = $mimeType ?: 'application/octet-stream'; - $this->size = $size; - $this->error = $error ?: UPLOAD_ERR_OK; - $this->test = (bool) $test; - - parent::__construct($path, UPLOAD_ERR_OK === $this->error); - } - - /** - * Returns the original file name. - * - * It is extracted from the request from which the file has been uploaded. - * Then it should not be considered as a safe value. - * - * @return string|null The original name - */ - public function getClientOriginalName() - { - return $this->originalName; - } - - /** - * Returns the original file extension. - * - * It is extracted from the original file name that was uploaded. - * Then it should not be considered as a safe value. - * - * @return string The extension - */ - public function getClientOriginalExtension() - { - return pathinfo($this->originalName, PATHINFO_EXTENSION); - } - - /** - * Returns the file mime type. - * - * The client mime type is extracted from the request from which the file - * was uploaded, so it should not be considered as a safe value. - * - * For a trusted mime type, use getMimeType() instead (which guesses the mime - * type based on the file content). - * - * @return string|null The mime type - * - * @see getMimeType() - */ - public function getClientMimeType() - { - return $this->mimeType; - } - - /** - * Returns the extension based on the client mime type. - * - * If the mime type is unknown, returns null. - * - * This method uses the mime type as guessed by getClientMimeType() - * to guess the file extension. As such, the extension returned - * by this method cannot be trusted. - * - * For a trusted extension, use guessExtension() instead (which guesses - * the extension based on the guessed mime type for the file). - * - * @return string|null The guessed extension or null if it cannot be guessed - * - * @see guessExtension() - * @see getClientMimeType() - */ - public function guessClientExtension() - { - $type = $this->getClientMimeType(); - $guesser = ExtensionGuesser::getInstance(); - - return $guesser->guess($type); - } - - /** - * Returns the file size. - * - * It is extracted from the request from which the file has been uploaded. - * Then it should not be considered as a safe value. - * - * @return int|null The file size - */ - public function getClientSize() - { - return $this->size; - } - - /** - * Returns the upload error. - * - * If the upload was successful, the constant UPLOAD_ERR_OK is returned. - * Otherwise one of the other UPLOAD_ERR_XXX constants is returned. - * - * @return int The upload error - */ - public function getError() - { - return $this->error; - } - - /** - * Returns whether the file was uploaded successfully. - * - * @return bool True if the file has been uploaded with HTTP and no error occurred - */ - public function isValid() - { - $isOk = UPLOAD_ERR_OK === $this->error; - - return $this->test ? $isOk : $isOk && is_uploaded_file($this->getPathname()); - } - - /** - * Moves the file to a new location. - * - * @param string $directory The destination folder - * @param string $name The new file name - * - * @return File A File object representing the new file - * - * @throws FileException if, for any reason, the file could not have been moved - */ - public function move($directory, $name = null) - { - if ($this->isValid()) { - if ($this->test) { - return parent::move($directory, $name); - } - - $target = $this->getTargetFile($directory, $name); - - if (!@move_uploaded_file($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); - } - - @chmod($target, 0666 & ~umask()); - - return $target; - } - - throw new FileException($this->getErrorMessage()); - } - - /** - * Returns the maximum size of an uploaded file as configured in php.ini. - * - * @return int The maximum size of an uploaded file in bytes - */ - public static function getMaxFilesize() - { - $iniMax = strtolower(ini_get('upload_max_filesize')); - - if ('' === $iniMax) { - return PHP_INT_MAX; - } - - $max = ltrim($iniMax, '+'); - if (0 === strpos($max, '0x')) { - $max = intval($max, 16); - } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); - } else { - $max = (int) $max; - } - - switch (substr($iniMax, -1)) { - case 't': $max *= 1024; - // no break - case 'g': $max *= 1024; - // no break - case 'm': $max *= 1024; - // no break - case 'k': $max *= 1024; - } - - return $max; - } - - /** - * Returns an informative upload error message. - * - * @return string The error message regarding the specified error code - */ - public function getErrorMessage() - { - static $errors = array( - UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', - UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', - UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', - UPLOAD_ERR_NO_FILE => 'No file was uploaded.', - UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', - UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', - UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', - ); - - $errorCode = $this->error; - $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; - $message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.'; - - return sprintf($message, $this->getClientOriginalName(), $maxFilesize); - } -} diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php deleted file mode 100644 index 722ec2a..0000000 --- a/vendor/symfony/http-foundation/FileBag.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\File\UploadedFile; - -/** - * FileBag is a container for uploaded files. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - */ -class FileBag extends ParameterBag -{ - private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); - - /** - * @param array $parameters An array of HTTP files - */ - public function __construct(array $parameters = array()) - { - $this->replace($parameters); - } - - /** - * {@inheritdoc} - */ - public function replace(array $files = array()) - { - $this->parameters = array(); - $this->add($files); - } - - /** - * {@inheritdoc} - */ - public function set($key, $value) - { - if (!is_array($value) && !$value instanceof UploadedFile) { - throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); - } - - parent::set($key, $this->convertFileInformation($value)); - } - - /** - * {@inheritdoc} - */ - public function add(array $files = array()) - { - foreach ($files as $key => $file) { - $this->set($key, $file); - } - } - - /** - * Converts uploaded files to UploadedFile instances. - * - * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information - * - * @return UploadedFile[]|UploadedFile|null A (multi-dimensional) array of UploadedFile instances - */ - protected function convertFileInformation($file) - { - if ($file instanceof UploadedFile) { - return $file; - } - - $file = $this->fixPhpFilesArray($file); - if (is_array($file)) { - $keys = array_keys($file); - sort($keys); - - if ($keys == self::$fileKeys) { - if (UPLOAD_ERR_NO_FILE == $file['error']) { - $file = null; - } else { - $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); - } - } else { - $file = array_filter(array_map(array($this, 'convertFileInformation'), $file)); - } - } - - return $file; - } - - /** - * Fixes a malformed PHP $_FILES array. - * - * PHP has a bug that the format of the $_FILES array differs, depending on - * whether the uploaded file fields had normal field names or array-like - * field names ("normal" vs. "parent[child]"). - * - * This method fixes the array to look like the "normal" $_FILES array. - * - * It's safe to pass an already converted array, in which case this method - * just returns the original array unmodified. - * - * @param array $data - * - * @return array - */ - protected function fixPhpFilesArray($data) - { - if (!is_array($data)) { - return $data; - } - - $keys = array_keys($data); - sort($keys); - - if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { - return $data; - } - - $files = $data; - foreach (self::$fileKeys as $k) { - unset($files[$k]); - } - - foreach ($data['name'] as $key => $name) { - $files[$key] = $this->fixPhpFilesArray(array( - 'error' => $data['error'][$key], - 'name' => $name, - 'type' => $data['type'][$key], - 'tmp_name' => $data['tmp_name'][$key], - 'size' => $data['size'][$key], - )); - } - - return $files; - } -} diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php deleted file mode 100644 index e0b51ad..0000000 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ /dev/null @@ -1,323 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * HeaderBag is a container for HTTP headers. - * - * @author Fabien Potencier - */ -class HeaderBag implements \IteratorAggregate, \Countable -{ - protected $headers = array(); - protected $cacheControl = array(); - - /** - * @param array $headers An array of HTTP headers - */ - public function __construct(array $headers = array()) - { - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns the headers as a string. - * - * @return string The headers - */ - public function __toString() - { - if (!$headers = $this->all()) { - return ''; - } - - ksort($headers); - $max = max(array_map('strlen', array_keys($headers))) + 1; - $content = ''; - foreach ($headers as $name => $values) { - $name = implode('-', array_map('ucfirst', explode('-', $name))); - foreach ($values as $value) { - $content .= sprintf("%-{$max}s %s\r\n", $name.':', $value); - } - } - - return $content; - } - - /** - * Returns the headers. - * - * @return array An array of headers - */ - public function all() - { - return $this->headers; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - */ - public function keys() - { - return array_keys($this->all()); - } - - /** - * Replaces the current HTTP headers by a new set. - * - * @param array $headers An array of HTTP headers - */ - public function replace(array $headers = array()) - { - $this->headers = array(); - $this->add($headers); - } - - /** - * Adds new headers the current HTTP headers set. - * - * @param array $headers An array of HTTP headers - */ - public function add(array $headers) - { - foreach ($headers as $key => $values) { - $this->set($key, $values); - } - } - - /** - * Returns a header value by name. - * - * @param string $key The header name - * @param mixed $default The default value - * @param bool $first Whether to return the first value or all header values - * - * @return string|array The first header value if $first is true, an array of values otherwise - */ - public function get($key, $default = null, $first = true) - { - $key = str_replace('_', '-', strtolower($key)); - $headers = $this->all(); - - if (!array_key_exists($key, $headers)) { - if (null === $default) { - return $first ? null : array(); - } - - return $first ? $default : array($default); - } - - if ($first) { - return count($headers[$key]) ? $headers[$key][0] : $default; - } - - return $headers[$key]; - } - - /** - * Sets a header by name. - * - * @param string $key The key - * @param string|array $values The value or an array of values - * @param bool $replace Whether to replace the actual value or not (true by default) - */ - public function set($key, $values, $replace = true) - { - $key = str_replace('_', '-', strtolower($key)); - - $values = array_values((array) $values); - - if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = $values; - } else { - $this->headers[$key] = array_merge($this->headers[$key], $values); - } - - if ('cache-control' === $key) { - $this->cacheControl = $this->parseCacheControl($values[0]); - } - } - - /** - * Returns true if the HTTP header is defined. - * - * @param string $key The HTTP header - * - * @return bool true if the parameter exists, false otherwise - */ - public function has($key) - { - return array_key_exists(str_replace('_', '-', strtolower($key)), $this->all()); - } - - /** - * Returns true if the given HTTP header contains the given value. - * - * @param string $key The HTTP header name - * @param string $value The HTTP value - * - * @return bool true if the value is contained in the header, false otherwise - */ - public function contains($key, $value) - { - return in_array($value, $this->get($key, null, false)); - } - - /** - * Removes a header. - * - * @param string $key The HTTP header name - */ - public function remove($key) - { - $key = str_replace('_', '-', strtolower($key)); - - unset($this->headers[$key]); - - if ('cache-control' === $key) { - $this->cacheControl = array(); - } - } - - /** - * Returns the HTTP header value converted to a date. - * - * @param string $key The parameter key - * @param \DateTime $default The default value - * - * @return null|\DateTime The parsed DateTime or the default value if the header does not exist - * - * @throws \RuntimeException When the HTTP header is not parseable - */ - public function getDate($key, \DateTime $default = null) - { - if (null === $value = $this->get($key)) { - return $default; - } - - if (false === $date = \DateTime::createFromFormat(DATE_RFC2822, $value)) { - throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value)); - } - - return $date; - } - - /** - * Adds a custom Cache-Control directive. - * - * @param string $key The Cache-Control directive name - * @param mixed $value The Cache-Control directive value - */ - public function addCacheControlDirective($key, $value = true) - { - $this->cacheControl[$key] = $value; - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - /** - * Returns true if the Cache-Control directive is defined. - * - * @param string $key The Cache-Control directive - * - * @return bool true if the directive exists, false otherwise - */ - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl); - } - - /** - * Returns a Cache-Control directive value by name. - * - * @param string $key The directive name - * - * @return mixed|null The directive value if defined, null otherwise - */ - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null; - } - - /** - * Removes a Cache-Control directive. - * - * @param string $key The Cache-Control directive - */ - public function removeCacheControlDirective($key) - { - unset($this->cacheControl[$key]); - - $this->set('Cache-Control', $this->getCacheControlHeader()); - } - - /** - * Returns an iterator for headers. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->headers); - } - - /** - * Returns the number of headers. - * - * @return int The number of headers - */ - public function count() - { - return count($this->headers); - } - - protected function getCacheControlHeader() - { - $parts = array(); - ksort($this->cacheControl); - foreach ($this->cacheControl as $key => $value) { - if (true === $value) { - $parts[] = $key; - } else { - if (preg_match('#[^a-zA-Z0-9._-]#', $value)) { - $value = '"'.$value.'"'; - } - - $parts[] = "$key=$value"; - } - } - - return implode(', ', $parts); - } - - /** - * Parses a Cache-Control HTTP header. - * - * @param string $header The value of the Cache-Control HTTP header - * - * @return array An array representing the attribute values - */ - protected function parseCacheControl($header) - { - $cacheControl = array(); - preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $cacheControl[strtolower($match[1])] = isset($match[3]) ? $match[3] : (isset($match[2]) ? $match[2] : true); - } - - return $cacheControl; - } -} diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php deleted file mode 100644 index dc6d3ec..0000000 --- a/vendor/symfony/http-foundation/IpUtils.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Http utility functions. - * - * @author Fabien Potencier - */ -class IpUtils -{ - private static $checkedIps = array(); - - /** - * This class should not be instantiated. - */ - private function __construct() - { - } - - /** - * Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets. - * - * @param string $requestIp IP to check - * @param string|array $ips List of IPs or subnets (can be a string if only a single one) - * - * @return bool Whether the IP is valid - */ - public static function checkIp($requestIp, $ips) - { - if (!is_array($ips)) { - $ips = array($ips); - } - - $method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4'; - - foreach ($ips as $ip) { - if (self::$method($requestIp, $ip)) { - return true; - } - } - - return false; - } - - /** - * Compares two IPv4 addresses. - * In case a subnet is given, it checks if it contains the request IP. - * - * @param string $requestIp IPv4 address to check - * @param string $ip IPv4 address or subnet in CIDR notation - * - * @return bool Whether the request IP matches the IP, or whether the request IP is within the CIDR subnet - */ - public static function checkIp4($requestIp, $ip) - { - $cacheKey = $requestIp.'-'.$ip; - if (isset(self::$checkedIps[$cacheKey])) { - return self::$checkedIps[$cacheKey]; - } - - if (!filter_var($requestIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { - return self::$checkedIps[$cacheKey] = false; - } - - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ('0' === $netmask) { - return self::$checkedIps[$cacheKey] = filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); - } - - if ($netmask < 0 || $netmask > 32) { - return self::$checkedIps[$cacheKey] = false; - } - } else { - $address = $ip; - $netmask = 32; - } - - return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); - } - - /** - * Compares two IPv6 addresses. - * In case a subnet is given, it checks if it contains the request IP. - * - * @author David Soria Parra - * - * @see https://github.com/dsp/v6tools - * - * @param string $requestIp IPv6 address to check - * @param string $ip IPv6 address or subnet in CIDR notation - * - * @return bool Whether the IP is valid - * - * @throws \RuntimeException When IPV6 support is not enabled - */ - public static function checkIp6($requestIp, $ip) - { - $cacheKey = $requestIp.'-'.$ip; - if (isset(self::$checkedIps[$cacheKey])) { - return self::$checkedIps[$cacheKey]; - } - - if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { - throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); - } - - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 128) { - return self::$checkedIps[$cacheKey] = false; - } - } else { - $address = $ip; - $netmask = 128; - } - - $bytesAddr = unpack('n*', @inet_pton($address)); - $bytesTest = unpack('n*', @inet_pton($requestIp)); - - if (!$bytesAddr || !$bytesTest) { - return self::$checkedIps[$cacheKey] = false; - } - - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) { - $left = $netmask - 16 * ($i - 1); - $left = ($left <= 16) ? $left : 16; - $mask = ~(0xffff >> $left) & 0xffff; - if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { - return self::$checkedIps[$cacheKey] = false; - } - } - - return self::$checkedIps[$cacheKey] = true; - } -} diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php deleted file mode 100644 index 137ac33..0000000 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ /dev/null @@ -1,220 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Response represents an HTTP response in JSON format. - * - * Note that this class does not force the returned JSON content to be an - * object. It is however recommended that you do return an object as it - * protects yourself against XSSI and JSON-JavaScript Hijacking. - * - * @see https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside - * - * @author Igor Wiedler - */ -class JsonResponse extends Response -{ - protected $data; - protected $callback; - - // Encode <, >, ', &, and " characters in the JSON, making it also safe to be embedded into HTML. - // 15 === JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT - const DEFAULT_ENCODING_OPTIONS = 15; - - protected $encodingOptions = self::DEFAULT_ENCODING_OPTIONS; - - /** - * @param mixed $data The response data - * @param int $status The response status code - * @param array $headers An array of response headers - * @param bool $json If the data is already a JSON string - */ - public function __construct($data = null, $status = 200, $headers = array(), $json = false) - { - parent::__construct('', $status, $headers); - - if (null === $data) { - $data = new \ArrayObject(); - } - - $json ? $this->setJson($data) : $this->setData($data); - } - - /** - * Factory method for chainability. - * - * Example: - * - * return JsonResponse::create($data, 200) - * ->setSharedMaxAge(300); - * - * @param mixed $data The json response data - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return static - */ - public static function create($data = null, $status = 200, $headers = array()) - { - return new static($data, $status, $headers); - } - - /** - * Make easier the creation of JsonResponse from raw json. - */ - public static function fromJsonString($data = null, $status = 200, $headers = array()) - { - return new static($data, $status, $headers, true); - } - - /** - * Sets the JSONP callback. - * - * @param string|null $callback The JSONP callback or null to use none - * - * @return $this - * - * @throws \InvalidArgumentException When the callback name is not valid - */ - public function setCallback($callback = null) - { - if (null !== $callback) { - // partially taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ - // partially taken from https://github.com/willdurand/JsonpCallbackValidator - // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details. - // (c) William Durand - $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u'; - $reserved = array( - 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while', - 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export', - 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false', - ); - $parts = explode('.', $callback); - foreach ($parts as $part) { - if (!preg_match($pattern, $part) || in_array($part, $reserved, true)) { - throw new \InvalidArgumentException('The callback name is not valid.'); - } - } - } - - $this->callback = $callback; - - return $this->update(); - } - - /** - * Sets a raw string containing a JSON document to be sent. - * - * @param string $json - * - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setJson($json) - { - $this->data = $json; - - return $this->update(); - } - - /** - * Sets the data to be sent as JSON. - * - * @param mixed $data - * - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setData($data = array()) - { - if (defined('HHVM_VERSION')) { - // HHVM does not trigger any warnings and let exceptions - // thrown from a JsonSerializable object pass through. - // If only PHP did the same... - $data = json_encode($data, $this->encodingOptions); - } else { - if (!interface_exists('JsonSerializable', false)) { - set_error_handler(function () { return false; }); - try { - $data = @json_encode($data, $this->encodingOptions); - } finally { - restore_error_handler(); - } - } else { - try { - $data = json_encode($data, $this->encodingOptions); - } catch (\Exception $e) { - if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { - throw $e->getPrevious() ?: $e; - } - throw $e; - } - } - } - - if (JSON_ERROR_NONE !== json_last_error()) { - throw new \InvalidArgumentException(json_last_error_msg()); - } - - return $this->setJson($data); - } - - /** - * Returns options used while encoding data to JSON. - * - * @return int - */ - public function getEncodingOptions() - { - return $this->encodingOptions; - } - - /** - * Sets options used while encoding data to JSON. - * - * @param int $encodingOptions - * - * @return $this - */ - public function setEncodingOptions($encodingOptions) - { - $this->encodingOptions = (int) $encodingOptions; - - return $this->setData(json_decode($this->data)); - } - - /** - * Updates the content and headers according to the JSON data and callback. - * - * @return $this - */ - protected function update() - { - if (null !== $this->callback) { - // Not using application/javascript for compatibility reasons with older browsers. - $this->headers->set('Content-Type', 'text/javascript'); - - return $this->setContent(sprintf('/**/%s(%s);', $this->callback, $this->data)); - } - - // Only set the header when there is none or when it equals 'text/javascript' (from a previous update with callback) - // in order to not overwrite a custom definition. - if (!$this->headers->has('Content-Type') || 'text/javascript' === $this->headers->get('Content-Type')) { - $this->headers->set('Content-Type', 'application/json'); - } - - return $this->setContent($this->data); - } -} diff --git a/vendor/symfony/http-foundation/LICENSE b/vendor/symfony/http-foundation/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/http-foundation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php deleted file mode 100644 index 3d27891..0000000 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ /dev/null @@ -1,236 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ParameterBag is a container for key/value pairs. - * - * @author Fabien Potencier - */ -class ParameterBag implements \IteratorAggregate, \Countable -{ - /** - * Parameter storage. - * - * @var array - */ - protected $parameters; - - /** - * @param array $parameters An array of parameters - */ - public function __construct(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Returns the parameters. - * - * @return array An array of parameters - */ - public function all() - { - return $this->parameters; - } - - /** - * Returns the parameter keys. - * - * @return array An array of parameter keys - */ - public function keys() - { - return array_keys($this->parameters); - } - - /** - * Replaces the current parameters by a new set. - * - * @param array $parameters An array of parameters - */ - public function replace(array $parameters = array()) - { - $this->parameters = $parameters; - } - - /** - * Adds parameters. - * - * @param array $parameters An array of parameters - */ - public function add(array $parameters = array()) - { - $this->parameters = array_replace($this->parameters, $parameters); - } - - /** - * Returns a parameter by name. - * - * @param string $key The key - * @param mixed $default The default value if the parameter key does not exist - * - * @return mixed - */ - public function get($key, $default = null) - { - return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; - } - - /** - * Sets a parameter by name. - * - * @param string $key The key - * @param mixed $value The value - */ - public function set($key, $value) - { - $this->parameters[$key] = $value; - } - - /** - * Returns true if the parameter is defined. - * - * @param string $key The key - * - * @return bool true if the parameter exists, false otherwise - */ - public function has($key) - { - return array_key_exists($key, $this->parameters); - } - - /** - * Removes a parameter. - * - * @param string $key The key - */ - public function remove($key) - { - unset($this->parameters[$key]); - } - - /** - * Returns the alphabetic characters of the parameter value. - * - * @param string $key The parameter key - * @param string $default The default value if the parameter key does not exist - * - * @return string The filtered value - */ - public function getAlpha($key, $default = '') - { - return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default)); - } - - /** - * Returns the alphabetic characters and digits of the parameter value. - * - * @param string $key The parameter key - * @param string $default The default value if the parameter key does not exist - * - * @return string The filtered value - */ - public function getAlnum($key, $default = '') - { - return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default)); - } - - /** - * Returns the digits of the parameter value. - * - * @param string $key The parameter key - * @param string $default The default value if the parameter key does not exist - * - * @return string The filtered value - */ - public function getDigits($key, $default = '') - { - // we need to remove - and + because they're allowed in the filter - return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); - } - - /** - * Returns the parameter value converted to integer. - * - * @param string $key The parameter key - * @param int $default The default value if the parameter key does not exist - * - * @return int The filtered value - */ - public function getInt($key, $default = 0) - { - return (int) $this->get($key, $default); - } - - /** - * Returns the parameter value converted to boolean. - * - * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist - * - * @return bool The filtered value - */ - public function getBoolean($key, $default = false) - { - return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN); - } - - /** - * Filter key. - * - * @param string $key Key - * @param mixed $default Default = null - * @param int $filter FILTER_* constant - * @param mixed $options Filter options - * - * @see http://php.net/manual/en/function.filter-var.php - * - * @return mixed - */ - public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array()) - { - $value = $this->get($key, $default); - - // Always turn $options into an array - this allows filter_var option shortcuts. - if (!is_array($options) && $options) { - $options = array('flags' => $options); - } - - // Add a convenience check for arrays. - if (is_array($value) && !isset($options['flags'])) { - $options['flags'] = FILTER_REQUIRE_ARRAY; - } - - return filter_var($value, $filter, $options); - } - - /** - * Returns an iterator for parameters. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->parameters); - } - - /** - * Returns the number of parameters. - * - * @return int The number of parameters - */ - public function count() - { - return count($this->parameters); - } -} diff --git a/vendor/symfony/http-foundation/README.md b/vendor/symfony/http-foundation/README.md deleted file mode 100644 index 8907f0b..0000000 --- a/vendor/symfony/http-foundation/README.md +++ /dev/null @@ -1,14 +0,0 @@ -HttpFoundation Component -======================== - -The HttpFoundation component defines an object-oriented layer for the HTTP -specification. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/http_foundation/index.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php deleted file mode 100644 index cb1c58e..0000000 --- a/vendor/symfony/http-foundation/RedirectResponse.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RedirectResponse represents an HTTP response doing a redirect. - * - * @author Fabien Potencier - */ -class RedirectResponse extends Response -{ - protected $targetUrl; - - /** - * Creates a redirect response so that it conforms to the rules defined for a redirect status code. - * - * @param string $url The URL to redirect to. The URL should be a full URL, with schema etc., - * but practically every browser redirects on paths only as well - * @param int $status The status code (302 by default) - * @param array $headers The headers (Location is always set to the given URL) - * - * @throws \InvalidArgumentException - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3 - */ - public function __construct($url, $status = 302, $headers = array()) - { - parent::__construct('', $status, $headers); - - $this->setTargetUrl($url); - - if (!$this->isRedirect()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); - } - - if (301 == $status && !array_key_exists('cache-control', $headers)) { - $this->headers->remove('cache-control'); - } - } - - /** - * {@inheritdoc} - */ - public static function create($url = '', $status = 302, $headers = array()) - { - return new static($url, $status, $headers); - } - - /** - * Returns the target URL. - * - * @return string target URL - */ - public function getTargetUrl() - { - return $this->targetUrl; - } - - /** - * Sets the redirect target of this response. - * - * @param string $url The URL to redirect to - * - * @return $this - * - * @throws \InvalidArgumentException - */ - public function setTargetUrl($url) - { - if (empty($url)) { - throw new \InvalidArgumentException('Cannot redirect to an empty URL.'); - } - - $this->targetUrl = $url; - - $this->setContent( - sprintf(' - - - - - - Redirecting to %1$s - - - Redirecting to %1$s. - -', htmlspecialchars($url, ENT_QUOTES, 'UTF-8'))); - - $this->headers->set('Location', $url); - - return $this; - } -} diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php deleted file mode 100644 index 28e78c0..0000000 --- a/vendor/symfony/http-foundation/Request.php +++ /dev/null @@ -1,2112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; -use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; -use Symfony\Component\HttpFoundation\Session\SessionInterface; - -/** - * Request represents an HTTP request. - * - * The methods dealing with URL accept / return a raw path (% encoded): - * * getBasePath - * * getBaseUrl - * * getPathInfo - * * getRequestUri - * * getUri - * * getUriForPath - * - * @author Fabien Potencier - */ -class Request -{ - const HEADER_FORWARDED = 0b00001; // When using RFC 7239 - const HEADER_X_FORWARDED_FOR = 0b00010; - const HEADER_X_FORWARDED_HOST = 0b00100; - const HEADER_X_FORWARDED_PROTO = 0b01000; - const HEADER_X_FORWARDED_PORT = 0b10000; - const HEADER_X_FORWARDED_ALL = 0b11110; // All "X-Forwarded-*" headers - const HEADER_X_FORWARDED_AWS_ELB = 0b11010; // AWS ELB doesn't send X-Forwarded-Host - - /** @deprecated since version 3.3, to be removed in 4.0 */ - const HEADER_CLIENT_IP = self::HEADER_X_FORWARDED_FOR; - /** @deprecated since version 3.3, to be removed in 4.0 */ - const HEADER_CLIENT_HOST = self::HEADER_X_FORWARDED_HOST; - /** @deprecated since version 3.3, to be removed in 4.0 */ - const HEADER_CLIENT_PROTO = self::HEADER_X_FORWARDED_PROTO; - /** @deprecated since version 3.3, to be removed in 4.0 */ - const HEADER_CLIENT_PORT = self::HEADER_X_FORWARDED_PORT; - - const METHOD_HEAD = 'HEAD'; - const METHOD_GET = 'GET'; - const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; - const METHOD_PATCH = 'PATCH'; - const METHOD_DELETE = 'DELETE'; - const METHOD_PURGE = 'PURGE'; - const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_TRACE = 'TRACE'; - const METHOD_CONNECT = 'CONNECT'; - - /** - * @var string[] - */ - protected static $trustedProxies = array(); - - /** - * @var string[] - */ - protected static $trustedHostPatterns = array(); - - /** - * @var string[] - */ - protected static $trustedHosts = array(); - - /** - * Names for headers that can be trusted when - * using trusted proxies. - * - * The FORWARDED header is the standard as of rfc7239. - * - * The other headers are non-standard, but widely used - * by popular reverse proxies (like Apache mod_proxy or Amazon EC2). - * - * @deprecated since version 3.3, to be removed in 4.0 - */ - protected static $trustedHeaders = array( - self::HEADER_FORWARDED => 'FORWARDED', - self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', - self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', - self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', - self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', - ); - - protected static $httpMethodParameterOverride = false; - - /** - * Custom parameters. - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - */ - public $attributes; - - /** - * Request body parameters ($_POST). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - */ - public $request; - - /** - * Query string parameters ($_GET). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - */ - public $query; - - /** - * Server and execution environment parameters ($_SERVER). - * - * @var \Symfony\Component\HttpFoundation\ServerBag - */ - public $server; - - /** - * Uploaded files ($_FILES). - * - * @var \Symfony\Component\HttpFoundation\FileBag - */ - public $files; - - /** - * Cookies ($_COOKIE). - * - * @var \Symfony\Component\HttpFoundation\ParameterBag - */ - public $cookies; - - /** - * Headers (taken from the $_SERVER). - * - * @var \Symfony\Component\HttpFoundation\HeaderBag - */ - public $headers; - - /** - * @var string - */ - protected $content; - - /** - * @var array - */ - protected $languages; - - /** - * @var array - */ - protected $charsets; - - /** - * @var array - */ - protected $encodings; - - /** - * @var array - */ - protected $acceptableContentTypes; - - /** - * @var string - */ - protected $pathInfo; - - /** - * @var string - */ - protected $requestUri; - - /** - * @var string - */ - protected $baseUrl; - - /** - * @var string - */ - protected $basePath; - - /** - * @var string - */ - protected $method; - - /** - * @var string - */ - protected $format; - - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - protected $session; - - /** - * @var string - */ - protected $locale; - - /** - * @var string - */ - protected $defaultLocale = 'en'; - - /** - * @var array - */ - protected static $formats; - - protected static $requestFactory; - - private $isHostValid = true; - private $isClientIpsValid = true; - private $isForwardedValid = true; - - private static $trustedHeaderSet = -1; - - /** @deprecated since version 3.3, to be removed in 4.0 */ - private static $trustedHeaderNames = array( - self::HEADER_FORWARDED => 'FORWARDED', - self::HEADER_CLIENT_IP => 'X_FORWARDED_FOR', - self::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST', - self::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO', - self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', - ); - - private static $forwardedParams = array( - self::HEADER_X_FORWARDED_FOR => 'for', - self::HEADER_X_FORWARDED_HOST => 'host', - self::HEADER_X_FORWARDED_PROTO => 'proto', - self::HEADER_X_FORWARDED_PORT => 'host', - ); - - /** - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string|resource $content The raw body data - */ - public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); - } - - /** - * Sets the parameters for this request. - * - * This method also re-initializes all properties. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string|resource $content The raw body data - */ - public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - $this->request = new ParameterBag($request); - $this->query = new ParameterBag($query); - $this->attributes = new ParameterBag($attributes); - $this->cookies = new ParameterBag($cookies); - $this->files = new FileBag($files); - $this->server = new ServerBag($server); - $this->headers = new HeaderBag($this->server->getHeaders()); - - $this->content = $content; - $this->languages = null; - $this->charsets = null; - $this->encodings = null; - $this->acceptableContentTypes = null; - $this->pathInfo = null; - $this->requestUri = null; - $this->baseUrl = null; - $this->basePath = null; - $this->method = null; - $this->format = null; - } - - /** - * Creates a new request with values from PHP's super globals. - * - * @return static - */ - public static function createFromGlobals() - { - // With the php's bug #66606, the php's built-in web server - // stores the Content-Type and Content-Length header values in - // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields. - $server = $_SERVER; - if ('cli-server' === PHP_SAPI) { - if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { - $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH']; - } - if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) { - $server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE']; - } - } - - $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server); - - if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) - ) { - parse_str($request->getContent(), $data); - $request->request = new ParameterBag($data); - } - - return $request; - } - - /** - * Creates a Request based on a given URI and configuration. - * - * The information contained in the URI always take precedence - * over the other information (server and parameters). - * - * @param string $uri The URI - * @param string $method The HTTP method - * @param array $parameters The query (GET) or request (POST) parameters - * @param array $cookies The request cookies ($_COOKIE) - * @param array $files The request files ($_FILES) - * @param array $server The server parameters ($_SERVER) - * @param string $content The raw body data - * - * @return static - */ - public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) - { - $server = array_replace(array( - 'SERVER_NAME' => 'localhost', - 'SERVER_PORT' => 80, - 'HTTP_HOST' => 'localhost', - 'HTTP_USER_AGENT' => 'Symfony/3.X', - 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', - 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', - 'REMOTE_ADDR' => '127.0.0.1', - 'SCRIPT_NAME' => '', - 'SCRIPT_FILENAME' => '', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'REQUEST_TIME' => time(), - ), $server); - - $server['PATH_INFO'] = ''; - $server['REQUEST_METHOD'] = strtoupper($method); - - $components = parse_url($uri); - if (isset($components['host'])) { - $server['SERVER_NAME'] = $components['host']; - $server['HTTP_HOST'] = $components['host']; - } - - if (isset($components['scheme'])) { - if ('https' === $components['scheme']) { - $server['HTTPS'] = 'on'; - $server['SERVER_PORT'] = 443; - } else { - unset($server['HTTPS']); - $server['SERVER_PORT'] = 80; - } - } - - if (isset($components['port'])) { - $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; - } - - if (isset($components['user'])) { - $server['PHP_AUTH_USER'] = $components['user']; - } - - if (isset($components['pass'])) { - $server['PHP_AUTH_PW'] = $components['pass']; - } - - if (!isset($components['path'])) { - $components['path'] = '/'; - } - - switch (strtoupper($method)) { - case 'POST': - case 'PUT': - case 'DELETE': - if (!isset($server['CONTENT_TYPE'])) { - $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; - } - // no break - case 'PATCH': - $request = $parameters; - $query = array(); - break; - default: - $request = array(); - $query = $parameters; - break; - } - - $queryString = ''; - if (isset($components['query'])) { - parse_str(html_entity_decode($components['query']), $qs); - - if ($query) { - $query = array_replace($qs, $query); - $queryString = http_build_query($query, '', '&'); - } else { - $query = $qs; - $queryString = $components['query']; - } - } elseif ($query) { - $queryString = http_build_query($query, '', '&'); - } - - $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : ''); - $server['QUERY_STRING'] = $queryString; - - return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content); - } - - /** - * Sets a callable able to create a Request instance. - * - * This is mainly useful when you need to override the Request class - * to keep BC with an existing system. It should not be used for any - * other purpose. - * - * @param callable|null $callable A PHP callable - */ - public static function setFactory($callable) - { - self::$requestFactory = $callable; - } - - /** - * Clones a request and overrides some of its parameters. - * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * - * @return static - */ - public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) - { - $dup = clone $this; - if (null !== $query) { - $dup->query = new ParameterBag($query); - } - if (null !== $request) { - $dup->request = new ParameterBag($request); - } - if (null !== $attributes) { - $dup->attributes = new ParameterBag($attributes); - } - if (null !== $cookies) { - $dup->cookies = new ParameterBag($cookies); - } - if (null !== $files) { - $dup->files = new FileBag($files); - } - if (null !== $server) { - $dup->server = new ServerBag($server); - $dup->headers = new HeaderBag($dup->server->getHeaders()); - } - $dup->languages = null; - $dup->charsets = null; - $dup->encodings = null; - $dup->acceptableContentTypes = null; - $dup->pathInfo = null; - $dup->requestUri = null; - $dup->baseUrl = null; - $dup->basePath = null; - $dup->method = null; - $dup->format = null; - - if (!$dup->get('_format') && $this->get('_format')) { - $dup->attributes->set('_format', $this->get('_format')); - } - - if (!$dup->getRequestFormat(null)) { - $dup->setRequestFormat($this->getRequestFormat(null)); - } - - return $dup; - } - - /** - * Clones the current request. - * - * Note that the session is not cloned as duplicated requests - * are most of the time sub-requests of the main one. - */ - public function __clone() - { - $this->query = clone $this->query; - $this->request = clone $this->request; - $this->attributes = clone $this->attributes; - $this->cookies = clone $this->cookies; - $this->files = clone $this->files; - $this->server = clone $this->server; - $this->headers = clone $this->headers; - } - - /** - * Returns the request as a string. - * - * @return string The request - */ - public function __toString() - { - try { - $content = $this->getContent(); - } catch (\LogicException $e) { - return trigger_error($e, E_USER_ERROR); - } - - return - sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n". - $this->headers."\r\n". - $content; - } - - /** - * Overrides the PHP global variables according to this request instance. - * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. - * $_FILES is never overridden, see rfc1867 - */ - public function overrideGlobals() - { - $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&'))); - - $_GET = $this->query->all(); - $_POST = $this->request->all(); - $_SERVER = $this->server->all(); - $_COOKIE = $this->cookies->all(); - - foreach ($this->headers->all() as $key => $value) { - $key = strtoupper(str_replace('-', '_', $key)); - if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { - $_SERVER[$key] = implode(', ', $value); - } else { - $_SERVER['HTTP_'.$key] = implode(', ', $value); - } - } - - $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); - - $requestOrder = ini_get('request_order') ?: ini_get('variables_order'); - $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; - - $_REQUEST = array(); - foreach (str_split($requestOrder) as $order) { - $_REQUEST = array_merge($_REQUEST, $request[$order]); - } - } - - /** - * Sets a list of trusted proxies. - * - * You should only list the reverse proxies that you manage directly. - * - * @param array $proxies A list of trusted proxies - * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies - * - * @throws \InvalidArgumentException When $trustedHeaderSet is invalid - */ - public static function setTrustedProxies(array $proxies/*, int $trustedHeaderSet*/) - { - self::$trustedProxies = $proxies; - - if (2 > func_num_args()) { - @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since version 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED); - - return; - } - $trustedHeaderSet = (int) func_get_arg(1); - - foreach (self::$trustedHeaderNames as $header => $name) { - self::$trustedHeaders[$header] = $header & $trustedHeaderSet ? $name : null; - } - self::$trustedHeaderSet = $trustedHeaderSet; - } - - /** - * Gets the list of trusted proxies. - * - * @return array An array of trusted proxies - */ - public static function getTrustedProxies() - { - return self::$trustedProxies; - } - - /** - * Gets the set of trusted headers from trusted proxies. - * - * @return int A bit field of Request::HEADER_* that defines which headers are trusted from your proxies - */ - public static function getTrustedHeaderSet() - { - return self::$trustedHeaderSet; - } - - /** - * Sets a list of trusted host patterns. - * - * You should only list the hosts you manage using regexs. - * - * @param array $hostPatterns A list of trusted host patterns - */ - public static function setTrustedHosts(array $hostPatterns) - { - self::$trustedHostPatterns = array_map(function ($hostPattern) { - return sprintf('#%s#i', $hostPattern); - }, $hostPatterns); - // we need to reset trusted hosts on trusted host patterns change - self::$trustedHosts = array(); - } - - /** - * Gets the list of trusted host patterns. - * - * @return array An array of trusted host patterns - */ - public static function getTrustedHosts() - { - return self::$trustedHostPatterns; - } - - /** - * Sets the name for trusted headers. - * - * The following header keys are supported: - * - * * Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp()) - * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost()) - * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort()) - * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure()) - * * Request::HEADER_FORWARDED: defaults to Forwarded (see RFC 7239) - * - * Setting an empty value allows to disable the trusted header for the given key. - * - * @param string $key The header key - * @param string $value The header name - * - * @throws \InvalidArgumentException - * - * @deprecated since version 3.3, to be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead. - */ - public static function setTrustedHeaderName($key, $value) - { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.', __METHOD__), E_USER_DEPRECATED); - - if ('forwarded' === $key) { - $key = self::HEADER_FORWARDED; - } elseif ('client_ip' === $key) { - $key = self::HEADER_CLIENT_IP; - } elseif ('client_host' === $key) { - $key = self::HEADER_CLIENT_HOST; - } elseif ('client_proto' === $key) { - $key = self::HEADER_CLIENT_PROTO; - } elseif ('client_port' === $key) { - $key = self::HEADER_CLIENT_PORT; - } elseif (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to set the trusted header name for key "%s".', $key)); - } - - self::$trustedHeaders[$key] = $value; - - if (null !== $value) { - self::$trustedHeaderNames[$key] = $value; - self::$trustedHeaderSet |= $key; - } else { - self::$trustedHeaderSet &= ~$key; - } - } - - /** - * Gets the trusted proxy header name. - * - * @param string $key The header key - * - * @return string The header name - * - * @throws \InvalidArgumentException - * - * @deprecated since version 3.3, to be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead. - */ - public static function getTrustedHeaderName($key) - { - if (2 > func_num_args() || func_get_arg(1)) { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); - } - - if (!array_key_exists($key, self::$trustedHeaders)) { - throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key)); - } - - return self::$trustedHeaders[$key]; - } - - /** - * Normalizes a query string. - * - * It builds a normalized query string, where keys/value pairs are alphabetized, - * have consistent escaping and unneeded delimiters are removed. - * - * @param string $qs Query string - * - * @return string A normalized query string for the Request - */ - public static function normalizeQueryString($qs) - { - if ('' == $qs) { - return ''; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $param) { - if ('' === $param || '=' === $param[0]) { - // Ignore useless delimiters, e.g. "x=y&". - // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. - // PHP also does not include them when building _GET. - continue; - } - - $keyValuePair = explode('=', $param, 2); - - // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). - // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to - // RFC 3986 with rawurlencode. - $parts[] = isset($keyValuePair[1]) ? - rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : - rawurlencode(urldecode($keyValuePair[0])); - $order[] = urldecode($keyValuePair[0]); - } - - array_multisort($order, SORT_ASC, $parts); - - return implode('&', $parts); - } - - /** - * Enables support for the _method request parameter to determine the intended HTTP method. - * - * Be warned that enabling this feature might lead to CSRF issues in your code. - * Check that you are using CSRF tokens when required. - * If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered - * and used to send a "PUT" or "DELETE" request via the _method request parameter. - * If these methods are not protected against CSRF, this presents a possible vulnerability. - * - * The HTTP method can only be overridden when the real HTTP method is POST. - */ - public static function enableHttpMethodParameterOverride() - { - self::$httpMethodParameterOverride = true; - } - - /** - * Checks whether support for the _method request parameter is enabled. - * - * @return bool True when the _method request parameter is enabled, false otherwise - */ - public static function getHttpMethodParameterOverride() - { - return self::$httpMethodParameterOverride; - } - - /** - * Gets a "parameter" value from any bag. - * - * This method is mainly useful for libraries that want to provide some flexibility. If you don't need the - * flexibility in controllers, it is better to explicitly get request parameters from the appropriate - * public property instead (attributes, query, request). - * - * Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY - * - * @param string $key the key - * @param mixed $default the default value if the parameter key does not exist - * - * @return mixed - */ - public function get($key, $default = null) - { - if ($this !== $result = $this->attributes->get($key, $this)) { - return $result; - } - - if ($this !== $result = $this->query->get($key, $this)) { - return $result; - } - - if ($this !== $result = $this->request->get($key, $this)) { - return $result; - } - - return $default; - } - - /** - * Gets the Session. - * - * @return SessionInterface|null The session - */ - public function getSession() - { - return $this->session; - } - - /** - * Whether the request contains a Session which was started in one of the - * previous requests. - * - * @return bool - */ - public function hasPreviousSession() - { - // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - return $this->hasSession() && $this->cookies->has($this->session->getName()); - } - - /** - * Whether the request contains a Session object. - * - * This method does not give any information about the state of the session object, - * like whether the session is started or not. It is just a way to check if this Request - * is associated with a Session instance. - * - * @return bool true when the Request contains a Session object, false otherwise - */ - public function hasSession() - { - return null !== $this->session; - } - - /** - * Sets the Session. - * - * @param SessionInterface $session The Session - */ - public function setSession(SessionInterface $session) - { - $this->session = $session; - } - - /** - * Returns the client IP addresses. - * - * In the returned array the most trusted IP address is first, and the - * least trusted one last. The "real" client IP address is the last one, - * but this is also the least trusted one. Trusted proxies are stripped. - * - * Use this method carefully; you should use getClientIp() instead. - * - * @return array The client IP addresses - * - * @see getClientIp() - */ - public function getClientIps() - { - $ip = $this->server->get('REMOTE_ADDR'); - - if (!$this->isFromTrustedProxy()) { - return array($ip); - } - - return $this->getTrustedValues(self::HEADER_CLIENT_IP, $ip) ?: array($ip); - } - - /** - * Returns the client IP address. - * - * This method can read the client IP address from the "X-Forwarded-For" header - * when trusted proxies were set via "setTrustedProxies()". The "X-Forwarded-For" - * header value is a comma+space separated list of IP addresses, the left-most - * being the original client, and each successive proxy that passed the request - * adding the IP address where it received the request from. - * - * If your reverse proxy uses a different header name than "X-Forwarded-For", - * ("Client-Ip" for instance), configure it via the $trustedHeaderSet - * argument of the Request::setTrustedProxies() method instead. - * - * @return string|null The client IP address - * - * @see getClientIps() - * @see http://en.wikipedia.org/wiki/X-Forwarded-For - */ - public function getClientIp() - { - $ipAddresses = $this->getClientIps(); - - return $ipAddresses[0]; - } - - /** - * Returns current script name. - * - * @return string - */ - public function getScriptName() - { - return $this->server->get('SCRIPT_NAME', $this->server->get('ORIG_SCRIPT_NAME', '')); - } - - /** - * Returns the path being requested relative to the executed script. - * - * The path info always starts with a /. - * - * Suppose this request is instantiated from /mysite on localhost: - * - * * http://localhost/mysite returns an empty string - * * http://localhost/mysite/about returns '/about' - * * http://localhost/mysite/enco%20ded returns '/enco%20ded' - * * http://localhost/mysite/about?var=1 returns '/about' - * - * @return string The raw path (i.e. not urldecoded) - */ - public function getPathInfo() - { - if (null === $this->pathInfo) { - $this->pathInfo = $this->preparePathInfo(); - } - - return $this->pathInfo; - } - - /** - * Returns the root path from which this request is executed. - * - * Suppose that an index.php file instantiates this request object: - * - * * http://localhost/index.php returns an empty string - * * http://localhost/index.php/page returns an empty string - * * http://localhost/web/index.php returns '/web' - * * http://localhost/we%20b/index.php returns '/we%20b' - * - * @return string The raw path (i.e. not urldecoded) - */ - public function getBasePath() - { - if (null === $this->basePath) { - $this->basePath = $this->prepareBasePath(); - } - - return $this->basePath; - } - - /** - * Returns the root URL from which this request is executed. - * - * The base URL never ends with a /. - * - * This is similar to getBasePath(), except that it also includes the - * script filename (e.g. index.php) if one exists. - * - * @return string The raw URL (i.e. not urldecoded) - */ - public function getBaseUrl() - { - if (null === $this->baseUrl) { - $this->baseUrl = $this->prepareBaseUrl(); - } - - return $this->baseUrl; - } - - /** - * Gets the request's scheme. - * - * @return string - */ - public function getScheme() - { - return $this->isSecure() ? 'https' : 'http'; - } - - /** - * Returns the port on which the request is made. - * - * This method can read the client port from the "X-Forwarded-Port" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Port" header must contain the client port. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Port", - * configure it via via the $trustedHeaderSet argument of the - * Request::setTrustedProxies() method instead. - * - * @return int|string can be a string if fetched from the server bag - */ - public function getPort() - { - if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_PORT)) { - $host = $host[0]; - } elseif ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) { - $host = $host[0]; - } elseif (!$host = $this->headers->get('HOST')) { - return $this->server->get('SERVER_PORT'); - } - - if ('[' === $host[0]) { - $pos = strpos($host, ':', strrpos($host, ']')); - } else { - $pos = strrpos($host, ':'); - } - - if (false !== $pos) { - return (int) substr($host, $pos + 1); - } - - return 'https' === $this->getScheme() ? 443 : 80; - } - - /** - * Returns the user. - * - * @return string|null - */ - public function getUser() - { - return $this->headers->get('PHP_AUTH_USER'); - } - - /** - * Returns the password. - * - * @return string|null - */ - public function getPassword() - { - return $this->headers->get('PHP_AUTH_PW'); - } - - /** - * Gets the user info. - * - * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server - */ - public function getUserInfo() - { - $userinfo = $this->getUser(); - - $pass = $this->getPassword(); - if ('' != $pass) { - $userinfo .= ":$pass"; - } - - return $userinfo; - } - - /** - * Returns the HTTP host being requested. - * - * The port name will be appended to the host if it's non-standard. - * - * @return string - */ - public function getHttpHost() - { - $scheme = $this->getScheme(); - $port = $this->getPort(); - - if (('http' == $scheme && 80 == $port) || ('https' == $scheme && 443 == $port)) { - return $this->getHost(); - } - - return $this->getHost().':'.$port; - } - - /** - * Returns the requested URI (path and query string). - * - * @return string The raw URI (i.e. not URI decoded) - */ - public function getRequestUri() - { - if (null === $this->requestUri) { - $this->requestUri = $this->prepareRequestUri(); - } - - return $this->requestUri; - } - - /** - * Gets the scheme and HTTP host. - * - * If the URL was called with basic authentication, the user - * and the password are not added to the generated string. - * - * @return string The scheme and HTTP host - */ - public function getSchemeAndHttpHost() - { - return $this->getScheme().'://'.$this->getHttpHost(); - } - - /** - * Generates a normalized URI (URL) for the Request. - * - * @return string A normalized URI (URL) for the Request - * - * @see getQueryString() - */ - public function getUri() - { - if (null !== $qs = $this->getQueryString()) { - $qs = '?'.$qs; - } - - return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; - } - - /** - * Generates a normalized URI for the given path. - * - * @param string $path A path to use instead of the current one - * - * @return string The normalized URI for the path - */ - public function getUriForPath($path) - { - return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; - } - - /** - * Returns the path as relative reference from the current Request path. - * - * Only the URIs path component (no schema, host etc.) is relevant and must be given. - * Both paths must be absolute and not contain relative parts. - * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives. - * Furthermore, they can be used to reduce the link size in documents. - * - * Example target paths, given a base path of "/a/b/c/d": - * - "/a/b/c/d" -> "" - * - "/a/b/c/" -> "./" - * - "/a/b/" -> "../" - * - "/a/b/c/other" -> "other" - * - "/a/x/y" -> "../../x/y" - * - * @param string $path The target path - * - * @return string The relative target path - */ - public function getRelativeUriForPath($path) - { - // be sure that we are dealing with an absolute path - if (!isset($path[0]) || '/' !== $path[0]) { - return $path; - } - - if ($path === $basePath = $this->getPathInfo()) { - return ''; - } - - $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path); - array_pop($sourceDirs); - $targetFile = array_pop($targetDirs); - - foreach ($sourceDirs as $i => $dir) { - if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) { - unset($sourceDirs[$i], $targetDirs[$i]); - } else { - break; - } - } - - $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); - - // A reference to the same base directory or an empty subdirectory must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name - // (see http://tools.ietf.org/html/rfc3986#section-4.2). - return !isset($path[0]) || '/' === $path[0] - || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos) - ? "./$path" : $path; - } - - /** - * Generates the normalized query string for the Request. - * - * It builds a normalized query string, where keys/value pairs are alphabetized - * and have consistent escaping. - * - * @return string|null A normalized query string for the Request - */ - public function getQueryString() - { - $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); - - return '' === $qs ? null : $qs; - } - - /** - * Checks whether the request is secure or not. - * - * This method can read the client protocol from the "X-Forwarded-Proto" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http". - * - * If your reverse proxy uses a different header name than "X-Forwarded-Proto" - * ("SSL_HTTPS" for instance), configure it via the $trustedHeaderSet - * argument of the Request::setTrustedProxies() method instead. - * - * @return bool - */ - public function isSecure() - { - if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) { - return in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true); - } - - $https = $this->server->get('HTTPS'); - - return !empty($https) && 'off' !== strtolower($https); - } - - /** - * Returns the host name. - * - * This method can read the client host name from the "X-Forwarded-Host" header - * when trusted proxies were set via "setTrustedProxies()". - * - * The "X-Forwarded-Host" header must contain the client host name. - * - * If your reverse proxy uses a different header name than "X-Forwarded-Host", - * configure it via the $trustedHeaderSet argument of the - * Request::setTrustedProxies() method instead. - * - * @return string - * - * @throws SuspiciousOperationException when the host name is invalid or not trusted - */ - public function getHost() - { - if ($this->isFromTrustedProxy() && $host = $this->getTrustedValues(self::HEADER_CLIENT_HOST)) { - $host = $host[0]; - } elseif (!$host = $this->headers->get('HOST')) { - if (!$host = $this->server->get('SERVER_NAME')) { - $host = $this->server->get('SERVER_ADDR', ''); - } - } - - // trim and remove port number from host - // host is lowercase as per RFC 952/2181 - $host = strtolower(preg_replace('/:\d+$/', '', trim($host))); - - // as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user) - // check that it does not contain forbidden characters (see RFC 952 and RFC 2181) - // use preg_replace() instead of preg_match() to prevent DoS attacks with long host names - if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) { - if (!$this->isHostValid) { - return ''; - } - $this->isHostValid = false; - - throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host)); - } - - if (count(self::$trustedHostPatterns) > 0) { - // to avoid host header injection attacks, you should provide a list of trusted host patterns - - if (in_array($host, self::$trustedHosts)) { - return $host; - } - - foreach (self::$trustedHostPatterns as $pattern) { - if (preg_match($pattern, $host)) { - self::$trustedHosts[] = $host; - - return $host; - } - } - - if (!$this->isHostValid) { - return ''; - } - $this->isHostValid = false; - - throw new SuspiciousOperationException(sprintf('Untrusted Host "%s".', $host)); - } - - return $host; - } - - /** - * Sets the request method. - * - * @param string $method - */ - public function setMethod($method) - { - $this->method = null; - $this->server->set('REQUEST_METHOD', $method); - } - - /** - * Gets the request "intended" method. - * - * If the X-HTTP-Method-Override header is set, and if the method is a POST, - * then it is used to determine the "real" intended HTTP method. - * - * The _method request parameter can also be used to determine the HTTP method, - * but only if enableHttpMethodParameterOverride() has been called. - * - * The method is always an uppercased string. - * - * @return string The request method - * - * @see getRealMethod() - */ - public function getMethod() - { - if (null === $this->method) { - $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); - - if ('POST' === $this->method) { - if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) { - $this->method = strtoupper($method); - } elseif (self::$httpMethodParameterOverride) { - $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST'))); - } - } - } - - return $this->method; - } - - /** - * Gets the "real" request method. - * - * @return string The request method - * - * @see getMethod() - */ - public function getRealMethod() - { - return strtoupper($this->server->get('REQUEST_METHOD', 'GET')); - } - - /** - * Gets the mime type associated with the format. - * - * @param string $format The format - * - * @return string The associated mime type (null if not found) - */ - public function getMimeType($format) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - return isset(static::$formats[$format]) ? static::$formats[$format][0] : null; - } - - /** - * Gets the mime types associated with the format. - * - * @param string $format The format - * - * @return array The associated mime types - */ - public static function getMimeTypes($format) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - return isset(static::$formats[$format]) ? static::$formats[$format] : array(); - } - - /** - * Gets the format associated with the mime type. - * - * @param string $mimeType The associated mime type - * - * @return string|null The format (null if not found) - */ - public function getFormat($mimeType) - { - $canonicalMimeType = null; - if (false !== $pos = strpos($mimeType, ';')) { - $canonicalMimeType = substr($mimeType, 0, $pos); - } - - if (null === static::$formats) { - static::initializeFormats(); - } - - foreach (static::$formats as $format => $mimeTypes) { - if (in_array($mimeType, (array) $mimeTypes)) { - return $format; - } - if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) { - return $format; - } - } - } - - /** - * Associates a format with mime types. - * - * @param string $format The format - * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) - */ - public function setFormat($format, $mimeTypes) - { - if (null === static::$formats) { - static::initializeFormats(); - } - - static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); - } - - /** - * Gets the request format. - * - * Here is the process to determine the format: - * - * * format defined by the user (with setRequestFormat()) - * * _format request attribute - * * $default - * - * @param string $default The default format - * - * @return string The request format - */ - public function getRequestFormat($default = 'html') - { - if (null === $this->format) { - $this->format = $this->attributes->get('_format'); - } - - return null === $this->format ? $default : $this->format; - } - - /** - * Sets the request format. - * - * @param string $format The request format - */ - public function setRequestFormat($format) - { - $this->format = $format; - } - - /** - * Gets the format associated with the request. - * - * @return string|null The format (null if no content type is present) - */ - public function getContentType() - { - return $this->getFormat($this->headers->get('CONTENT_TYPE')); - } - - /** - * Sets the default locale. - * - * @param string $locale - */ - public function setDefaultLocale($locale) - { - $this->defaultLocale = $locale; - - if (null === $this->locale) { - $this->setPhpDefaultLocale($locale); - } - } - - /** - * Get the default locale. - * - * @return string - */ - public function getDefaultLocale() - { - return $this->defaultLocale; - } - - /** - * Sets the locale. - * - * @param string $locale - */ - public function setLocale($locale) - { - $this->setPhpDefaultLocale($this->locale = $locale); - } - - /** - * Get the locale. - * - * @return string - */ - public function getLocale() - { - return null === $this->locale ? $this->defaultLocale : $this->locale; - } - - /** - * Checks if the request method is of specified type. - * - * @param string $method Uppercase request method (GET, POST etc) - * - * @return bool - */ - public function isMethod($method) - { - return $this->getMethod() === strtoupper($method); - } - - /** - * Checks whether or not the method is safe. - * - * @see https://tools.ietf.org/html/rfc7231#section-4.2.1 - * - * @param bool $andCacheable Adds the additional condition that the method should be cacheable. True by default. - * - * @return bool - */ - public function isMethodSafe(/* $andCacheable = true */) - { - if (!func_num_args() || func_get_arg(0)) { - // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature) - // then setting $andCacheable to false should be deprecated in 4.1 - @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); - - return in_array($this->getMethod(), array('GET', 'HEAD')); - } - - return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); - } - - /** - * Checks whether or not the method is idempotent. - * - * @return bool - */ - public function isMethodIdempotent() - { - return in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE')); - } - - /** - * Checks whether the method is cacheable or not. - * - * @see https://tools.ietf.org/html/rfc7231#section-4.2.3 - * - * @return bool - */ - public function isMethodCacheable() - { - return in_array($this->getMethod(), array('GET', 'HEAD')); - } - - /** - * Returns the request body content. - * - * @param bool $asResource If true, a resource will be returned - * - * @return string|resource The request body content or a resource to read the body stream - * - * @throws \LogicException - */ - public function getContent($asResource = false) - { - $currentContentIsResource = is_resource($this->content); - if (\PHP_VERSION_ID < 50600 && false === $this->content) { - throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.'); - } - - if (true === $asResource) { - if ($currentContentIsResource) { - rewind($this->content); - - return $this->content; - } - - // Content passed in parameter (test) - if (is_string($this->content)) { - $resource = fopen('php://temp', 'r+'); - fwrite($resource, $this->content); - rewind($resource); - - return $resource; - } - - $this->content = false; - - return fopen('php://input', 'rb'); - } - - if ($currentContentIsResource) { - rewind($this->content); - - return stream_get_contents($this->content); - } - - if (null === $this->content || false === $this->content) { - $this->content = file_get_contents('php://input'); - } - - return $this->content; - } - - /** - * Gets the Etags. - * - * @return array The entity tags - */ - public function getETags() - { - return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); - } - - /** - * @return bool - */ - public function isNoCache() - { - return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); - } - - /** - * Returns the preferred language. - * - * @param array $locales An array of ordered available locales - * - * @return string|null The preferred locale - */ - public function getPreferredLanguage(array $locales = null) - { - $preferredLanguages = $this->getLanguages(); - - if (empty($locales)) { - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null; - } - - if (!$preferredLanguages) { - return $locales[0]; - } - - $extendedPreferredLanguages = array(); - foreach ($preferredLanguages as $language) { - $extendedPreferredLanguages[] = $language; - if (false !== $position = strpos($language, '_')) { - $superLanguage = substr($language, 0, $position); - if (!in_array($superLanguage, $preferredLanguages)) { - $extendedPreferredLanguages[] = $superLanguage; - } - } - } - - $preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales)); - - return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0]; - } - - /** - * Gets a list of languages acceptable by the client browser. - * - * @return array Languages ordered in the user browser preferences - */ - public function getLanguages() - { - if (null !== $this->languages) { - return $this->languages; - } - - $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); - $this->languages = array(); - foreach ($languages as $lang => $acceptHeaderItem) { - if (false !== strpos($lang, '-')) { - $codes = explode('-', $lang); - if ('i' === $codes[0]) { - // Language not listed in ISO 639 that are not variants - // of any listed language, which can be registered with the - // i-prefix, such as i-cherokee - if (count($codes) > 1) { - $lang = $codes[1]; - } - } else { - for ($i = 0, $max = count($codes); $i < $max; ++$i) { - if (0 === $i) { - $lang = strtolower($codes[0]); - } else { - $lang .= '_'.strtoupper($codes[$i]); - } - } - } - } - - $this->languages[] = $lang; - } - - return $this->languages; - } - - /** - * Gets a list of charsets acceptable by the client browser. - * - * @return array List of charsets in preferable order - */ - public function getCharsets() - { - if (null !== $this->charsets) { - return $this->charsets; - } - - return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all()); - } - - /** - * Gets a list of encodings acceptable by the client browser. - * - * @return array List of encodings in preferable order - */ - public function getEncodings() - { - if (null !== $this->encodings) { - return $this->encodings; - } - - return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all()); - } - - /** - * Gets a list of content types acceptable by the client browser. - * - * @return array List of content types in preferable order - */ - public function getAcceptableContentTypes() - { - if (null !== $this->acceptableContentTypes) { - return $this->acceptableContentTypes; - } - - return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all()); - } - - /** - * Returns true if the request is a XMLHttpRequest. - * - * It works if your JavaScript library sets an X-Requested-With HTTP header. - * It is known to work with common JavaScript frameworks: - * - * @see http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript - * - * @return bool true if the request is an XMLHttpRequest, false otherwise - */ - public function isXmlHttpRequest() - { - return 'XMLHttpRequest' == $this->headers->get('X-Requested-With'); - } - - /* - * The following methods are derived from code of the Zend Framework (1.10dev - 2010-01-24) - * - * Code subject to the new BSD license (http://framework.zend.com/license/new-bsd). - * - * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) - */ - - protected function prepareRequestUri() - { - $requestUri = ''; - - if ($this->headers->has('X_ORIGINAL_URL')) { - // IIS with Microsoft Rewrite Module - $requestUri = $this->headers->get('X_ORIGINAL_URL'); - $this->headers->remove('X_ORIGINAL_URL'); - $this->server->remove('HTTP_X_ORIGINAL_URL'); - $this->server->remove('UNENCODED_URL'); - $this->server->remove('IIS_WasUrlRewritten'); - } elseif ($this->headers->has('X_REWRITE_URL')) { - // IIS with ISAPI_Rewrite - $requestUri = $this->headers->get('X_REWRITE_URL'); - $this->headers->remove('X_REWRITE_URL'); - } elseif ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { - // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) - $requestUri = $this->server->get('UNENCODED_URL'); - $this->server->remove('UNENCODED_URL'); - $this->server->remove('IIS_WasUrlRewritten'); - } elseif ($this->server->has('REQUEST_URI')) { - $requestUri = $this->server->get('REQUEST_URI'); - // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path - $schemeAndHttpHost = $this->getSchemeAndHttpHost(); - if (0 === strpos($requestUri, $schemeAndHttpHost)) { - $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); - } - } elseif ($this->server->has('ORIG_PATH_INFO')) { - // IIS 5.0, PHP as CGI - $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ('' != $this->server->get('QUERY_STRING')) { - $requestUri .= '?'.$this->server->get('QUERY_STRING'); - } - $this->server->remove('ORIG_PATH_INFO'); - } - - // normalize the request URI to ease creating sub-requests from this request - $this->server->set('REQUEST_URI', $requestUri); - - return $requestUri; - } - - /** - * Prepares the base URL. - * - * @return string - */ - protected function prepareBaseUrl() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - - if (basename($this->server->get('SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('SCRIPT_NAME'); - } elseif (basename($this->server->get('PHP_SELF')) === $filename) { - $baseUrl = $this->server->get('PHP_SELF'); - } elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) { - $baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); // 1and1 shared hosting compatibility - } else { - // Backtrack up the script_filename to find the portion matching - // php_self - $path = $this->server->get('PHP_SELF', ''); - $file = $this->server->get('SCRIPT_FILENAME', ''); - $segs = explode('/', trim($file, '/')); - $segs = array_reverse($segs); - $index = 0; - $last = count($segs); - $baseUrl = ''; - do { - $seg = $segs[$index]; - $baseUrl = '/'.$seg.$baseUrl; - ++$index; - } while ($last > $index && (false !== $pos = strpos($path, $baseUrl)) && 0 != $pos); - } - - // Does the baseUrl have anything in common with the request_uri? - $requestUri = $this->getRequestUri(); - - if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) { - // full $baseUrl matches - return $prefix; - } - - if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/'.DIRECTORY_SEPARATOR).'/')) { - // directory portion of $baseUrl matches - return rtrim($prefix, '/'.DIRECTORY_SEPARATOR); - } - - $truncatedRequestUri = $requestUri; - if (false !== $pos = strpos($requestUri, '?')) { - $truncatedRequestUri = substr($requestUri, 0, $pos); - } - - $basename = basename($baseUrl); - if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) { - // no match whatsoever; set it blank - return ''; - } - - // If using mod_rewrite or ISAPI_Rewrite strip the script filename - // out of baseUrl. $pos !== 0 makes sure it is not matching a value - // from PATH_INFO or QUERY_STRING - if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) { - $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); - } - - return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR); - } - - /** - * Prepares the base path. - * - * @return string base path - */ - protected function prepareBasePath() - { - $filename = basename($this->server->get('SCRIPT_FILENAME')); - $baseUrl = $this->getBaseUrl(); - if (empty($baseUrl)) { - return ''; - } - - if (basename($baseUrl) === $filename) { - $basePath = dirname($baseUrl); - } else { - $basePath = $baseUrl; - } - - if ('\\' === DIRECTORY_SEPARATOR) { - $basePath = str_replace('\\', '/', $basePath); - } - - return rtrim($basePath, '/'); - } - - /** - * Prepares the path info. - * - * @return string path info - */ - protected function preparePathInfo() - { - $baseUrl = $this->getBaseUrl(); - - if (null === ($requestUri = $this->getRequestUri())) { - return '/'; - } - - // Remove the query string from REQUEST_URI - if ($pos = strpos($requestUri, '?')) { - $requestUri = substr($requestUri, 0, $pos); - } - - $pathInfo = substr($requestUri, strlen($baseUrl)); - if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) { - // If substr() returns false then PATH_INFO is set to an empty string - return '/'; - } elseif (null === $baseUrl) { - return $requestUri; - } - - return (string) $pathInfo; - } - - /** - * Initializes HTTP request formats. - */ - protected static function initializeFormats() - { - static::$formats = array( - 'html' => array('text/html', 'application/xhtml+xml'), - 'txt' => array('text/plain'), - 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), - 'css' => array('text/css'), - 'json' => array('application/json', 'application/x-json'), - 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), - 'rdf' => array('application/rdf+xml'), - 'atom' => array('application/atom+xml'), - 'rss' => array('application/rss+xml'), - 'form' => array('application/x-www-form-urlencoded'), - ); - } - - /** - * Sets the default PHP locale. - * - * @param string $locale - */ - private function setPhpDefaultLocale($locale) - { - // if either the class Locale doesn't exist, or an exception is thrown when - // setting the default locale, the intl module is not installed, and - // the call can be ignored: - try { - if (class_exists('Locale', false)) { - \Locale::setDefault($locale); - } - } catch (\Exception $e) { - } - } - - /* - * Returns the prefix as encoded in the string when the string starts with - * the given prefix, false otherwise. - * - * @param string $string The urlencoded string - * @param string $prefix The prefix not encoded - * - * @return string|false The prefix as it is encoded in $string, or false - */ - private function getUrlencodedPrefix($string, $prefix) - { - if (0 !== strpos(rawurldecode($string), $prefix)) { - return false; - } - - $len = strlen($prefix); - - if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) { - return $match[0]; - } - - return false; - } - - private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) - { - if (self::$requestFactory) { - $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); - - if (!$request instanceof self) { - throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.'); - } - - return $request; - } - - return new static($query, $request, $attributes, $cookies, $files, $server, $content); - } - - /** - * Indicates whether this request originated from a trusted proxy. - * - * This can be useful to determine whether or not to trust the - * contents of a proxy-specific header. - * - * @return bool true if the request came from a trusted proxy, false otherwise - */ - public function isFromTrustedProxy() - { - return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); - } - - private function getTrustedValues($type, $ip = null) - { - $clientValues = array(); - $forwardedValues = array(); - - if (self::$trustedHeaders[$type] && $this->headers->has(self::$trustedHeaders[$type])) { - foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) { - $clientValues[] = (self::HEADER_CLIENT_PORT === $type ? '0.0.0.0:' : '').trim($v); - } - } - - if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { - $forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); - $forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array(); - } - - if (null !== $ip) { - $clientValues = $this->normalizeAndFilterClientIps($clientValues, $ip); - $forwardedValues = $this->normalizeAndFilterClientIps($forwardedValues, $ip); - } - - if ($forwardedValues === $clientValues || !$clientValues) { - return $forwardedValues; - } - - if (!$forwardedValues) { - return $clientValues; - } - - if (!$this->isForwardedValid) { - return null !== $ip ? array('0.0.0.0', $ip) : array(); - } - $this->isForwardedValid = false; - - throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::$trustedHeaders[self::HEADER_FORWARDED], self::$trustedHeaders[$type])); - } - - private function normalizeAndFilterClientIps(array $clientIps, $ip) - { - if (!$clientIps) { - return array(); - } - $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from - $firstTrustedIp = null; - - foreach ($clientIps as $key => $clientIp) { - // Remove port (unfortunately, it does happen) - if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) { - $clientIps[$key] = $clientIp = $match[1]; - } - - if (!filter_var($clientIp, FILTER_VALIDATE_IP)) { - unset($clientIps[$key]); - - continue; - } - - if (IpUtils::checkIp($clientIp, self::$trustedProxies)) { - unset($clientIps[$key]); - - // Fallback to this when the client IP falls into the range of trusted proxies - if (null === $firstTrustedIp) { - $firstTrustedIp = $clientIp; - } - } - } - - // Now the IP chain contains only untrusted proxies and the client IP - return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp); - } -} diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php deleted file mode 100644 index 076d077..0000000 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RequestMatcher compares a pre-defined set of checks against a Request instance. - * - * @author Fabien Potencier - */ -class RequestMatcher implements RequestMatcherInterface -{ - /** - * @var string|null - */ - private $path; - - /** - * @var string|null - */ - private $host; - - /** - * @var string[] - */ - private $methods = array(); - - /** - * @var string[] - */ - private $ips = array(); - - /** - * @var array - */ - private $attributes = array(); - - /** - * @var string[] - */ - private $schemes = array(); - - /** - * @param string|null $path - * @param string|null $host - * @param string|string[]|null $methods - * @param string|string[]|null $ips - * @param array $attributes - * @param string|string[]|null $schemes - */ - public function __construct($path = null, $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null) - { - $this->matchPath($path); - $this->matchHost($host); - $this->matchMethod($methods); - $this->matchIps($ips); - $this->matchScheme($schemes); - - foreach ($attributes as $k => $v) { - $this->matchAttribute($k, $v); - } - } - - /** - * Adds a check for the HTTP scheme. - * - * @param string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes - */ - public function matchScheme($scheme) - { - $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array(); - } - - /** - * Adds a check for the URL host name. - * - * @param string|null $regexp A Regexp - */ - public function matchHost($regexp) - { - $this->host = $regexp; - } - - /** - * Adds a check for the URL path info. - * - * @param string|null $regexp A Regexp - */ - public function matchPath($regexp) - { - $this->path = $regexp; - } - - /** - * Adds a check for the client IP. - * - * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 - */ - public function matchIp($ip) - { - $this->matchIps($ip); - } - - /** - * Adds a check for the client IP. - * - * @param string|string[]|null $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 - */ - public function matchIps($ips) - { - $this->ips = null !== $ips ? (array) $ips : array(); - } - - /** - * Adds a check for the HTTP method. - * - * @param string|string[]|null $method An HTTP method or an array of HTTP methods - */ - public function matchMethod($method) - { - $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array(); - } - - /** - * Adds a check for request attribute. - * - * @param string $key The request attribute name - * @param string $regexp A Regexp - */ - public function matchAttribute($key, $regexp) - { - $this->attributes[$key] = $regexp; - } - - /** - * {@inheritdoc} - */ - public function matches(Request $request) - { - if ($this->schemes && !in_array($request->getScheme(), $this->schemes, true)) { - return false; - } - - if ($this->methods && !in_array($request->getMethod(), $this->methods, true)) { - return false; - } - - foreach ($this->attributes as $key => $pattern) { - if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) { - return false; - } - } - - if (null !== $this->path && !preg_match('{'.$this->path.'}', rawurldecode($request->getPathInfo()))) { - return false; - } - - if (null !== $this->host && !preg_match('{'.$this->host.'}i', $request->getHost())) { - return false; - } - - if (IpUtils::checkIp($request->getClientIp(), $this->ips)) { - return true; - } - - // Note to future implementors: add additional checks above the - // foreach above or else your check might not be run! - return 0 === count($this->ips); - } -} diff --git a/vendor/symfony/http-foundation/RequestMatcherInterface.php b/vendor/symfony/http-foundation/RequestMatcherInterface.php deleted file mode 100644 index 066e7e8..0000000 --- a/vendor/symfony/http-foundation/RequestMatcherInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * RequestMatcherInterface is an interface for strategies to match a Request. - * - * @author Fabien Potencier - */ -interface RequestMatcherInterface -{ - /** - * Decides whether the rule(s) implemented by the strategy matches the supplied request. - * - * @param Request $request The request to check for a match - * - * @return bool true if the request matches, false otherwise - */ - public function matches(Request $request); -} diff --git a/vendor/symfony/http-foundation/RequestStack.php b/vendor/symfony/http-foundation/RequestStack.php deleted file mode 100644 index 3d9cfd0..0000000 --- a/vendor/symfony/http-foundation/RequestStack.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Request stack that controls the lifecycle of requests. - * - * @author Benjamin Eberlei - */ -class RequestStack -{ - /** - * @var Request[] - */ - private $requests = array(); - - /** - * Pushes a Request on the stack. - * - * This method should generally not be called directly as the stack - * management should be taken care of by the application itself. - */ - public function push(Request $request) - { - $this->requests[] = $request; - } - - /** - * Pops the current request from the stack. - * - * This operation lets the current request go out of scope. - * - * This method should generally not be called directly as the stack - * management should be taken care of by the application itself. - * - * @return Request|null - */ - public function pop() - { - if (!$this->requests) { - return; - } - - return array_pop($this->requests); - } - - /** - * @return Request|null - */ - public function getCurrentRequest() - { - return end($this->requests) ?: null; - } - - /** - * Gets the master Request. - * - * Be warned that making your code aware of the master request - * might make it un-compatible with other features of your framework - * like ESI support. - * - * @return Request|null - */ - public function getMasterRequest() - { - if (!$this->requests) { - return; - } - - return $this->requests[0]; - } - - /** - * Returns the parent request of the current. - * - * Be warned that making your code aware of the parent request - * might make it un-compatible with other features of your framework - * like ESI support. - * - * If current Request is the master request, it returns null. - * - * @return Request|null - */ - public function getParentRequest() - { - $pos = count($this->requests) - 2; - - if (!isset($this->requests[$pos])) { - return; - } - - return $this->requests[$pos]; - } -} diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php deleted file mode 100644 index ced0afa..0000000 --- a/vendor/symfony/http-foundation/Response.php +++ /dev/null @@ -1,1286 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * Response represents an HTTP response. - * - * @author Fabien Potencier - */ -class Response -{ - const HTTP_CONTINUE = 100; - const HTTP_SWITCHING_PROTOCOLS = 101; - const HTTP_PROCESSING = 102; // RFC2518 - const HTTP_OK = 200; - const HTTP_CREATED = 201; - const HTTP_ACCEPTED = 202; - const HTTP_NON_AUTHORITATIVE_INFORMATION = 203; - const HTTP_NO_CONTENT = 204; - const HTTP_RESET_CONTENT = 205; - const HTTP_PARTIAL_CONTENT = 206; - const HTTP_MULTI_STATUS = 207; // RFC4918 - const HTTP_ALREADY_REPORTED = 208; // RFC5842 - const HTTP_IM_USED = 226; // RFC3229 - const HTTP_MULTIPLE_CHOICES = 300; - const HTTP_MOVED_PERMANENTLY = 301; - const HTTP_FOUND = 302; - const HTTP_SEE_OTHER = 303; - const HTTP_NOT_MODIFIED = 304; - const HTTP_USE_PROXY = 305; - const HTTP_RESERVED = 306; - const HTTP_TEMPORARY_REDIRECT = 307; - const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238 - const HTTP_BAD_REQUEST = 400; - const HTTP_UNAUTHORIZED = 401; - const HTTP_PAYMENT_REQUIRED = 402; - const HTTP_FORBIDDEN = 403; - const HTTP_NOT_FOUND = 404; - const HTTP_METHOD_NOT_ALLOWED = 405; - const HTTP_NOT_ACCEPTABLE = 406; - const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; - const HTTP_REQUEST_TIMEOUT = 408; - const HTTP_CONFLICT = 409; - const HTTP_GONE = 410; - const HTTP_LENGTH_REQUIRED = 411; - const HTTP_PRECONDITION_FAILED = 412; - const HTTP_REQUEST_ENTITY_TOO_LARGE = 413; - const HTTP_REQUEST_URI_TOO_LONG = 414; - const HTTP_UNSUPPORTED_MEDIA_TYPE = 415; - const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; - const HTTP_EXPECTATION_FAILED = 417; - const HTTP_I_AM_A_TEAPOT = 418; // RFC2324 - const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540 - const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 - const HTTP_LOCKED = 423; // RFC4918 - const HTTP_FAILED_DEPENDENCY = 424; // RFC4918 - const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817 - const HTTP_UPGRADE_REQUIRED = 426; // RFC2817 - const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585 - const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585 - const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585 - const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; - const HTTP_INTERNAL_SERVER_ERROR = 500; - const HTTP_NOT_IMPLEMENTED = 501; - const HTTP_BAD_GATEWAY = 502; - const HTTP_SERVICE_UNAVAILABLE = 503; - const HTTP_GATEWAY_TIMEOUT = 504; - const HTTP_VERSION_NOT_SUPPORTED = 505; - const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295 - const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918 - const HTTP_LOOP_DETECTED = 508; // RFC5842 - const HTTP_NOT_EXTENDED = 510; // RFC2774 - const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585 - - /** - * @var \Symfony\Component\HttpFoundation\ResponseHeaderBag - */ - public $headers; - - /** - * @var string - */ - protected $content; - - /** - * @var string - */ - protected $version; - - /** - * @var int - */ - protected $statusCode; - - /** - * @var string - */ - protected $statusText; - - /** - * @var string - */ - protected $charset; - - /** - * Status codes translation table. - * - * The list of codes is complete according to the - * {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry} - * (last updated 2016-03-01). - * - * Unless otherwise noted, the status code is defined in RFC2616. - * - * @var array - */ - public static $statusTexts = array( - 100 => 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', // RFC2518 - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-Status', // RFC4918 - 208 => 'Already Reported', // RFC5842 - 226 => 'IM Used', // RFC3229 - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', // RFC7238 - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Payload Too Large', - 414 => 'URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Range Not Satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', // RFC2324 - 421 => 'Misdirected Request', // RFC7540 - 422 => 'Unprocessable Entity', // RFC4918 - 423 => 'Locked', // RFC4918 - 424 => 'Failed Dependency', // RFC4918 - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 - 426 => 'Upgrade Required', // RFC2817 - 428 => 'Precondition Required', // RFC6585 - 429 => 'Too Many Requests', // RFC6585 - 431 => 'Request Header Fields Too Large', // RFC6585 - 451 => 'Unavailable For Legal Reasons', // RFC7725 - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates', // RFC2295 - 507 => 'Insufficient Storage', // RFC4918 - 508 => 'Loop Detected', // RFC5842 - 510 => 'Not Extended', // RFC2774 - 511 => 'Network Authentication Required', // RFC6585 - ); - - /** - * @param mixed $content The response content, see setContent() - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @throws \InvalidArgumentException When the HTTP status code is not valid - */ - public function __construct($content = '', $status = 200, $headers = array()) - { - $this->headers = new ResponseHeaderBag($headers); - $this->setContent($content); - $this->setStatusCode($status); - $this->setProtocolVersion('1.0'); - - /* RFC2616 - 14.18 says all Responses need to have a Date */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } - } - - /** - * Factory method for chainability. - * - * Example: - * - * return Response::create($body, 200) - * ->setSharedMaxAge(300); - * - * @param mixed $content The response content, see setContent() - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return static - */ - public static function create($content = '', $status = 200, $headers = array()) - { - return new static($content, $status, $headers); - } - - /** - * Returns the Response as an HTTP string. - * - * The string representation of the Response is the same as the - * one that will be sent to the client only if the prepare() method - * has been called before. - * - * @return string The Response as an HTTP string - * - * @see prepare() - */ - public function __toString() - { - return - sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n". - $this->headers."\r\n". - $this->getContent(); - } - - /** - * Clones the current Response instance. - */ - public function __clone() - { - $this->headers = clone $this->headers; - } - - /** - * Prepares the Response before it is sent to the client. - * - * This method tweaks the Response to ensure that it is - * compliant with RFC 2616. Most of the changes are based on - * the Request that is "associated" with this Response. - * - * @param Request $request A Request instance - * - * @return $this - */ - public function prepare(Request $request) - { - $headers = $this->headers; - - if ($this->isInformational() || $this->isEmpty()) { - $this->setContent(null); - $headers->remove('Content-Type'); - $headers->remove('Content-Length'); - } else { - // Content-type based on the Request - if (!$headers->has('Content-Type')) { - $format = $request->getRequestFormat(); - if (null !== $format && $mimeType = $request->getMimeType($format)) { - $headers->set('Content-Type', $mimeType); - } - } - - // Fix Content-Type - $charset = $this->charset ?: 'UTF-8'; - if (!$headers->has('Content-Type')) { - $headers->set('Content-Type', 'text/html; charset='.$charset); - } elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) { - // add the charset - $headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset); - } - - // Fix Content-Length - if ($headers->has('Transfer-Encoding')) { - $headers->remove('Content-Length'); - } - - if ($request->isMethod('HEAD')) { - // cf. RFC2616 14.13 - $length = $headers->get('Content-Length'); - $this->setContent(null); - if ($length) { - $headers->set('Content-Length', $length); - } - } - } - - // Fix protocol - if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) { - $this->setProtocolVersion('1.1'); - } - - // Check if we need to send extra expire info headers - if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) { - $this->headers->set('pragma', 'no-cache'); - $this->headers->set('expires', -1); - } - - $this->ensureIEOverSSLCompatibility($request); - - return $this; - } - - /** - * Sends HTTP headers. - * - * @return $this - */ - public function sendHeaders() - { - // headers have already been sent by the developer - if (headers_sent()) { - return $this; - } - - /* RFC2616 - 14.18 says all Responses need to have a Date */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } - - // headers - foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) { - foreach ($values as $value) { - header($name.': '.$value, false, $this->statusCode); - } - } - - // status - header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); - - // cookies - foreach ($this->headers->getCookies() as $cookie) { - if ($cookie->isRaw()) { - setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } else { - setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); - } - } - - return $this; - } - - /** - * Sends content for the current web response. - * - * @return $this - */ - public function sendContent() - { - echo $this->content; - - return $this; - } - - /** - * Sends HTTP headers and content. - * - * @return $this - */ - public function send() - { - $this->sendHeaders(); - $this->sendContent(); - - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } elseif ('cli' !== PHP_SAPI) { - static::closeOutputBuffers(0, true); - } - - return $this; - } - - /** - * Sets the response content. - * - * Valid types are strings, numbers, null, and objects that implement a __toString() method. - * - * @param mixed $content Content that can be cast to string - * - * @return $this - * - * @throws \UnexpectedValueException - */ - public function setContent($content) - { - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) { - throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content))); - } - - $this->content = (string) $content; - - return $this; - } - - /** - * Gets the current response content. - * - * @return string Content - */ - public function getContent() - { - return $this->content; - } - - /** - * Sets the HTTP protocol version (1.0 or 1.1). - * - * @param string $version The HTTP protocol version - * - * @return $this - * - * @final since version 3.2 - */ - public function setProtocolVersion($version) - { - $this->version = $version; - - return $this; - } - - /** - * Gets the HTTP protocol version. - * - * @return string The HTTP protocol version - * - * @final since version 3.2 - */ - public function getProtocolVersion() - { - return $this->version; - } - - /** - * Sets the response status code. - * - * If the status text is null it will be automatically populated for the known - * status codes and left empty otherwise. - * - * @param int $code HTTP status code - * @param mixed $text HTTP status text - * - * @return $this - * - * @throws \InvalidArgumentException When the HTTP status code is not valid - * - * @final since version 3.2 - */ - public function setStatusCode($code, $text = null) - { - $this->statusCode = $code = (int) $code; - if ($this->isInvalid()) { - throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); - } - - if (null === $text) { - $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status'; - - return $this; - } - - if (false === $text) { - $this->statusText = ''; - - return $this; - } - - $this->statusText = $text; - - return $this; - } - - /** - * Retrieves the status code for the current web response. - * - * @return int Status code - * - * @final since version 3.2 - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Sets the response charset. - * - * @param string $charset Character set - * - * @return $this - * - * @final since version 3.2 - */ - public function setCharset($charset) - { - $this->charset = $charset; - - return $this; - } - - /** - * Retrieves the response charset. - * - * @return string Character set - * - * @final since version 3.2 - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Returns true if the response is worth caching under any circumstance. - * - * Responses marked "private" with an explicit Cache-Control directive are - * considered uncacheable. - * - * Responses with neither a freshness lifetime (Expires, max-age) nor cache - * validator (Last-Modified, ETag) are considered uncacheable. - * - * @return bool true if the response is worth caching, false otherwise - * - * @final since version 3.3 - */ - public function isCacheable() - { - if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { - return false; - } - - if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) { - return false; - } - - return $this->isValidateable() || $this->isFresh(); - } - - /** - * Returns true if the response is "fresh". - * - * Fresh responses may be served from cache without any interaction with the - * origin. A response is considered fresh when it includes a Cache-Control/max-age - * indicator or Expires header and the calculated age is less than the freshness lifetime. - * - * @return bool true if the response is fresh, false otherwise - * - * @final since version 3.3 - */ - public function isFresh() - { - return $this->getTtl() > 0; - } - - /** - * Returns true if the response includes headers that can be used to validate - * the response with the origin server using a conditional GET request. - * - * @return bool true if the response is validateable, false otherwise - * - * @final since version 3.3 - */ - public function isValidateable() - { - return $this->headers->has('Last-Modified') || $this->headers->has('ETag'); - } - - /** - * Marks the response as "private". - * - * It makes the response ineligible for serving other clients. - * - * @return $this - * - * @final since version 3.2 - */ - public function setPrivate() - { - $this->headers->removeCacheControlDirective('public'); - $this->headers->addCacheControlDirective('private'); - - return $this; - } - - /** - * Marks the response as "public". - * - * It makes the response eligible for serving other clients. - * - * @return $this - * - * @final since version 3.2 - */ - public function setPublic() - { - $this->headers->addCacheControlDirective('public'); - $this->headers->removeCacheControlDirective('private'); - - return $this; - } - - /** - * Returns true if the response must be revalidated by caches. - * - * This method indicates that the response must not be served stale by a - * cache in any circumstance without first revalidating with the origin. - * When present, the TTL of the response should not be overridden to be - * greater than the value provided by the origin. - * - * @return bool true if the response must be revalidated by a cache, false otherwise - * - * @final since version 3.3 - */ - public function mustRevalidate() - { - return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate'); - } - - /** - * Returns the Date header as a DateTime instance. - * - * @return \DateTime A \DateTime instance - * - * @throws \RuntimeException When the header is not parseable - * - * @final since version 3.2 - */ - public function getDate() - { - /* - RFC2616 - 14.18 says all Responses need to have a Date. - Make sure we provide one even if it the header - has been removed in the meantime. - */ - if (!$this->headers->has('Date')) { - $this->setDate(\DateTime::createFromFormat('U', time())); - } - - return $this->headers->getDate('Date'); - } - - /** - * Sets the Date header. - * - * @param \DateTime $date A \DateTime instance - * - * @return $this - * - * @final since version 3.2 - */ - public function setDate(\DateTime $date) - { - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT'); - - return $this; - } - - /** - * Returns the age of the response. - * - * @return int The age of the response in seconds - * - * @final since version 3.2 - */ - public function getAge() - { - if (null !== $age = $this->headers->get('Age')) { - return (int) $age; - } - - return max(time() - $this->getDate()->format('U'), 0); - } - - /** - * Marks the response stale by setting the Age header to be equal to the maximum age of the response. - * - * @return $this - */ - public function expire() - { - if ($this->isFresh()) { - $this->headers->set('Age', $this->getMaxAge()); - } - - return $this; - } - - /** - * Returns the value of the Expires header as a DateTime instance. - * - * @return \DateTime|null A DateTime instance or null if the header does not exist - * - * @final since version 3.2 - */ - public function getExpires() - { - try { - return $this->headers->getDate('Expires'); - } catch (\RuntimeException $e) { - // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past - return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); - } - } - - /** - * Sets the Expires HTTP header with a DateTime instance. - * - * Passing null as value will remove the header. - * - * @param \DateTime|null $date A \DateTime instance or null to remove the header - * - * @return $this - * - * @final since version 3.2 - */ - public function setExpires(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Expires'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT'); - } - - return $this; - } - - /** - * Returns the number of seconds after the time specified in the response's Date - * header when the response should no longer be considered fresh. - * - * First, it checks for a s-maxage directive, then a max-age directive, and then it falls - * back on an expires header. It returns null when no maximum age can be established. - * - * @return int|null Number of seconds - * - * @final since version 3.2 - */ - public function getMaxAge() - { - if ($this->headers->hasCacheControlDirective('s-maxage')) { - return (int) $this->headers->getCacheControlDirective('s-maxage'); - } - - if ($this->headers->hasCacheControlDirective('max-age')) { - return (int) $this->headers->getCacheControlDirective('max-age'); - } - - if (null !== $this->getExpires()) { - return $this->getExpires()->format('U') - $this->getDate()->format('U'); - } - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh. - * - * This methods sets the Cache-Control max-age directive. - * - * @param int $value Number of seconds - * - * @return $this - * - * @final since version 3.2 - */ - public function setMaxAge($value) - { - $this->headers->addCacheControlDirective('max-age', $value); - - return $this; - } - - /** - * Sets the number of seconds after which the response should no longer be considered fresh by shared caches. - * - * This methods sets the Cache-Control s-maxage directive. - * - * @param int $value Number of seconds - * - * @return $this - * - * @final since version 3.2 - */ - public function setSharedMaxAge($value) - { - $this->setPublic(); - $this->headers->addCacheControlDirective('s-maxage', $value); - - return $this; - } - - /** - * Returns the response's time-to-live in seconds. - * - * It returns null when no freshness information is present in the response. - * - * When the responses TTL is <= 0, the response may not be served from cache without first - * revalidating with the origin. - * - * @return int|null The TTL in seconds - * - * @final since version 3.2 - */ - public function getTtl() - { - if (null !== $maxAge = $this->getMaxAge()) { - return $maxAge - $this->getAge(); - } - } - - /** - * Sets the response's time-to-live for shared caches. - * - * This method adjusts the Cache-Control/s-maxage directive. - * - * @param int $seconds Number of seconds - * - * @return $this - * - * @final since version 3.2 - */ - public function setTtl($seconds) - { - $this->setSharedMaxAge($this->getAge() + $seconds); - - return $this; - } - - /** - * Sets the response's time-to-live for private/client caches. - * - * This method adjusts the Cache-Control/max-age directive. - * - * @param int $seconds Number of seconds - * - * @return $this - * - * @final since version 3.2 - */ - public function setClientTtl($seconds) - { - $this->setMaxAge($this->getAge() + $seconds); - - return $this; - } - - /** - * Returns the Last-Modified HTTP header as a DateTime instance. - * - * @return \DateTime|null A DateTime instance or null if the header does not exist - * - * @throws \RuntimeException When the HTTP header is not parseable - * - * @final since version 3.2 - */ - public function getLastModified() - { - return $this->headers->getDate('Last-Modified'); - } - - /** - * Sets the Last-Modified HTTP header with a DateTime instance. - * - * Passing null as value will remove the header. - * - * @param \DateTime|null $date A \DateTime instance or null to remove the header - * - * @return $this - * - * @final since version 3.2 - */ - public function setLastModified(\DateTime $date = null) - { - if (null === $date) { - $this->headers->remove('Last-Modified'); - } else { - $date = clone $date; - $date->setTimezone(new \DateTimeZone('UTC')); - $this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT'); - } - - return $this; - } - - /** - * Returns the literal value of the ETag HTTP header. - * - * @return string|null The ETag HTTP header or null if it does not exist - * - * @final since version 3.2 - */ - public function getEtag() - { - return $this->headers->get('ETag'); - } - - /** - * Sets the ETag value. - * - * @param string|null $etag The ETag unique identifier or null to remove the header - * @param bool $weak Whether you want a weak ETag or not - * - * @return $this - * - * @final since version 3.2 - */ - public function setEtag($etag = null, $weak = false) - { - if (null === $etag) { - $this->headers->remove('Etag'); - } else { - if (0 !== strpos($etag, '"')) { - $etag = '"'.$etag.'"'; - } - - $this->headers->set('ETag', (true === $weak ? 'W/' : '').$etag); - } - - return $this; - } - - /** - * Sets the response's cache headers (validation and/or expiration). - * - * Available options are: etag, last_modified, max_age, s_maxage, private, and public. - * - * @param array $options An array of cache options - * - * @return $this - * - * @throws \InvalidArgumentException - * - * @final since version 3.3 - */ - public function setCache(array $options) - { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'))) { - throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); - } - - if (isset($options['etag'])) { - $this->setEtag($options['etag']); - } - - if (isset($options['last_modified'])) { - $this->setLastModified($options['last_modified']); - } - - if (isset($options['max_age'])) { - $this->setMaxAge($options['max_age']); - } - - if (isset($options['s_maxage'])) { - $this->setSharedMaxAge($options['s_maxage']); - } - - if (isset($options['public'])) { - if ($options['public']) { - $this->setPublic(); - } else { - $this->setPrivate(); - } - } - - if (isset($options['private'])) { - if ($options['private']) { - $this->setPrivate(); - } else { - $this->setPublic(); - } - } - - return $this; - } - - /** - * Modifies the response so that it conforms to the rules defined for a 304 status code. - * - * This sets the status, removes the body, and discards any headers - * that MUST NOT be included in 304 responses. - * - * @return $this - * - * @see http://tools.ietf.org/html/rfc2616#section-10.3.5 - * - * @final since version 3.3 - */ - public function setNotModified() - { - $this->setStatusCode(304); - $this->setContent(null); - - // remove headers that MUST NOT be included with 304 Not Modified responses - foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { - $this->headers->remove($header); - } - - return $this; - } - - /** - * Returns true if the response includes a Vary header. - * - * @return bool true if the response includes a Vary header, false otherwise - * - * @final since version 3.2 - */ - public function hasVary() - { - return null !== $this->headers->get('Vary'); - } - - /** - * Returns an array of header names given in the Vary header. - * - * @return array An array of Vary names - * - * @final since version 3.2 - */ - public function getVary() - { - if (!$vary = $this->headers->get('Vary', null, false)) { - return array(); - } - - $ret = array(); - foreach ($vary as $item) { - $ret = array_merge($ret, preg_split('/[\s,]+/', $item)); - } - - return $ret; - } - - /** - * Sets the Vary header. - * - * @param string|array $headers - * @param bool $replace Whether to replace the actual value or not (true by default) - * - * @return $this - * - * @final since version 3.2 - */ - public function setVary($headers, $replace = true) - { - $this->headers->set('Vary', $headers, $replace); - - return $this; - } - - /** - * Determines if the Response validators (ETag, Last-Modified) match - * a conditional value specified in the Request. - * - * If the Response is not modified, it sets the status code to 304 and - * removes the actual content by calling the setNotModified() method. - * - * @param Request $request A Request instance - * - * @return bool true if the Response validators match the Request, false otherwise - * - * @final since version 3.3 - */ - public function isNotModified(Request $request) - { - if (!$request->isMethodCacheable()) { - return false; - } - - $notModified = false; - $lastModified = $this->headers->get('Last-Modified'); - $modifiedSince = $request->headers->get('If-Modified-Since'); - - if ($etags = $request->getETags()) { - $notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags); - } - - if ($modifiedSince && $lastModified) { - $notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified); - } - - if ($notModified) { - $this->setNotModified(); - } - - return $notModified; - } - - /** - * Is response invalid? - * - * @return bool - * - * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - * - * @final since version 3.2 - */ - public function isInvalid() - { - return $this->statusCode < 100 || $this->statusCode >= 600; - } - - /** - * Is response informative? - * - * @return bool - * - * @final since version 3.3 - */ - public function isInformational() - { - return $this->statusCode >= 100 && $this->statusCode < 200; - } - - /** - * Is response successful? - * - * @return bool - * - * @final since version 3.2 - */ - public function isSuccessful() - { - return $this->statusCode >= 200 && $this->statusCode < 300; - } - - /** - * Is the response a redirect? - * - * @return bool - * - * @final since version 3.2 - */ - public function isRedirection() - { - return $this->statusCode >= 300 && $this->statusCode < 400; - } - - /** - * Is there a client error? - * - * @return bool - * - * @final since version 3.2 - */ - public function isClientError() - { - return $this->statusCode >= 400 && $this->statusCode < 500; - } - - /** - * Was there a server side error? - * - * @return bool - * - * @final since version 3.3 - */ - public function isServerError() - { - return $this->statusCode >= 500 && $this->statusCode < 600; - } - - /** - * Is the response OK? - * - * @return bool - * - * @final since version 3.2 - */ - public function isOk() - { - return 200 === $this->statusCode; - } - - /** - * Is the response forbidden? - * - * @return bool - * - * @final since version 3.2 - */ - public function isForbidden() - { - return 403 === $this->statusCode; - } - - /** - * Is the response a not found error? - * - * @return bool - * - * @final since version 3.2 - */ - public function isNotFound() - { - return 404 === $this->statusCode; - } - - /** - * Is the response a redirect of some form? - * - * @param string $location - * - * @return bool - * - * @final since version 3.2 - */ - public function isRedirect($location = null) - { - return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); - } - - /** - * Is the response empty? - * - * @return bool - * - * @final since version 3.2 - */ - public function isEmpty() - { - return in_array($this->statusCode, array(204, 304)); - } - - /** - * Cleans or flushes output buffers up to target level. - * - * Resulting level can be greater than target level if a non-removable buffer has been encountered. - * - * @param int $targetLevel The target output buffering level - * @param bool $flush Whether to flush or clean the buffers - * - * @final since version 3.3 - */ - public static function closeOutputBuffers($targetLevel, $flush) - { - $status = ob_get_status(true); - $level = count($status); - // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3 - $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; - - while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) { - if ($flush) { - ob_end_flush(); - } else { - ob_end_clean(); - } - } - } - - /** - * Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9. - * - * @see http://support.microsoft.com/kb/323308 - * - * @final since version 3.3 - */ - protected function ensureIEOverSSLCompatibility(Request $request) - { - if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) && true === $request->isSecure()) { - if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) { - $this->headers->remove('Cache-Control'); - } - } - } -} diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php deleted file mode 100644 index 7b91e4f..0000000 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ /dev/null @@ -1,339 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ResponseHeaderBag is a container for Response HTTP headers. - * - * @author Fabien Potencier - */ -class ResponseHeaderBag extends HeaderBag -{ - const COOKIES_FLAT = 'flat'; - const COOKIES_ARRAY = 'array'; - - const DISPOSITION_ATTACHMENT = 'attachment'; - const DISPOSITION_INLINE = 'inline'; - - /** - * @var array - */ - protected $computedCacheControl = array(); - - /** - * @var array - */ - protected $cookies = array(); - - /** - * @var array - */ - protected $headerNames = array(); - - /** - * @param array $headers An array of HTTP headers - */ - public function __construct(array $headers = array()) - { - parent::__construct($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('Cache-Control', ''); - } - } - - /** - * Returns the headers, with original capitalizations. - * - * @return array An array of headers - */ - public function allPreserveCase() - { - $headers = array(); - foreach ($this->all() as $name => $value) { - $headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value; - } - - return $headers; - } - - public function allPreserveCaseWithoutCookies() - { - $headers = $this->allPreserveCase(); - if (isset($this->headerNames['set-cookie'])) { - unset($headers[$this->headerNames['set-cookie']]); - } - - return $headers; - } - - /** - * {@inheritdoc} - */ - public function replace(array $headers = array()) - { - $this->headerNames = array(); - - parent::replace($headers); - - if (!isset($this->headers['cache-control'])) { - $this->set('Cache-Control', ''); - } - } - - /** - * {@inheritdoc} - */ - public function all() - { - $headers = parent::all(); - foreach ($this->getCookies() as $cookie) { - $headers['set-cookie'][] = (string) $cookie; - } - - return $headers; - } - - /** - * {@inheritdoc} - */ - public function set($key, $values, $replace = true) - { - $uniqueKey = str_replace('_', '-', strtolower($key)); - - if ('set-cookie' === $uniqueKey) { - if ($replace) { - $this->cookies = array(); - } - foreach ((array) $values as $cookie) { - $this->setCookie(Cookie::fromString($cookie)); - } - $this->headerNames[$uniqueKey] = $key; - - return; - } - - $this->headerNames[$uniqueKey] = $key; - - parent::set($key, $values, $replace); - - // ensure the cache-control header has sensible defaults - if (in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'))) { - $computed = $this->computeCacheControlValue(); - $this->headers['cache-control'] = array($computed); - $this->headerNames['cache-control'] = 'Cache-Control'; - $this->computedCacheControl = $this->parseCacheControl($computed); - } - } - - /** - * {@inheritdoc} - */ - public function remove($key) - { - $uniqueKey = str_replace('_', '-', strtolower($key)); - unset($this->headerNames[$uniqueKey]); - - if ('set-cookie' === $uniqueKey) { - $this->cookies = array(); - - return; - } - - parent::remove($key); - - if ('cache-control' === $uniqueKey) { - $this->computedCacheControl = array(); - } - } - - /** - * {@inheritdoc} - */ - public function hasCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl); - } - - /** - * {@inheritdoc} - */ - public function getCacheControlDirective($key) - { - return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null; - } - - /** - * Sets a cookie. - * - * @param Cookie $cookie - */ - public function setCookie(Cookie $cookie) - { - $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; - $this->headerNames['set-cookie'] = 'Set-Cookie'; - } - - /** - * Removes a cookie from the array, but does not unset it in the browser. - * - * @param string $name - * @param string $path - * @param string $domain - */ - public function removeCookie($name, $path = '/', $domain = null) - { - if (null === $path) { - $path = '/'; - } - - unset($this->cookies[$domain][$path][$name]); - - if (empty($this->cookies[$domain][$path])) { - unset($this->cookies[$domain][$path]); - - if (empty($this->cookies[$domain])) { - unset($this->cookies[$domain]); - } - } - - if (empty($this->cookies)) { - unset($this->headerNames['set-cookie']); - } - } - - /** - * Returns an array with all cookies. - * - * @param string $format - * - * @return array - * - * @throws \InvalidArgumentException When the $format is invalid - */ - public function getCookies($format = self::COOKIES_FLAT) - { - if (!in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { - throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); - } - - if (self::COOKIES_ARRAY === $format) { - return $this->cookies; - } - - $flattenedCookies = array(); - foreach ($this->cookies as $path) { - foreach ($path as $cookies) { - foreach ($cookies as $cookie) { - $flattenedCookies[] = $cookie; - } - } - } - - return $flattenedCookies; - } - - /** - * Clears a cookie in the browser. - * - * @param string $name - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httpOnly - */ - public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true) - { - $this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly)); - } - - /** - * Generates a HTTP Content-Disposition field-value. - * - * @param string $disposition One of "inline" or "attachment" - * @param string $filename A unicode string - * @param string $filenameFallback A string containing only ASCII characters that - * is semantically equivalent to $filename. If the filename is already ASCII, - * it can be omitted, or just copied from $filename - * - * @return string A string suitable for use as a Content-Disposition field-value - * - * @throws \InvalidArgumentException - * - * @see RFC 6266 - */ - public function makeDisposition($disposition, $filename, $filenameFallback = '') - { - if (!in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { - throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); - } - - if ('' == $filenameFallback) { - $filenameFallback = $filename; - } - - // filenameFallback is not ASCII. - if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) { - throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.'); - } - - // percent characters aren't safe in fallback. - if (false !== strpos($filenameFallback, '%')) { - throw new \InvalidArgumentException('The filename fallback cannot contain the "%" character.'); - } - - // path separators aren't allowed in either. - if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { - throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); - } - - $output = sprintf('%s; filename="%s"', $disposition, str_replace('"', '\\"', $filenameFallback)); - - if ($filename !== $filenameFallback) { - $output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); - } - - return $output; - } - - /** - * Returns the calculated value of the cache-control header. - * - * This considers several other headers and calculates or modifies the - * cache-control header to a sensible, conservative value. - * - * @return string - */ - protected function computeCacheControlValue() - { - if (!$this->cacheControl && !$this->has('ETag') && !$this->has('Last-Modified') && !$this->has('Expires')) { - return 'no-cache, private'; - } - - if (!$this->cacheControl) { - // conservative by default - return 'private, must-revalidate'; - } - - $header = $this->getCacheControlHeader(); - if (isset($this->cacheControl['public']) || isset($this->cacheControl['private'])) { - return $header; - } - - // public if s-maxage is defined, private otherwise - if (!isset($this->cacheControl['s-maxage'])) { - return $header.', private'; - } - - return $header; - } -} diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php deleted file mode 100644 index 19d2022..0000000 --- a/vendor/symfony/http-foundation/ServerBag.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * ServerBag is a container for HTTP headers from the $_SERVER variable. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * @author Robert Kiss - */ -class ServerBag extends ParameterBag -{ - /** - * Gets the HTTP headers. - * - * @return array - */ - public function getHeaders() - { - $headers = array(); - $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true); - foreach ($this->parameters as $key => $value) { - if (0 === strpos($key, 'HTTP_')) { - $headers[substr($key, 5)] = $value; - } - // CONTENT_* are not prefixed with HTTP_ - elseif (isset($contentHeaders[$key])) { - $headers[$key] = $value; - } - } - - if (isset($this->parameters['PHP_AUTH_USER'])) { - $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER']; - $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; - } else { - /* - * php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default - * For this workaround to work, add these lines to your .htaccess file: - * RewriteCond %{HTTP:Authorization} ^(.+)$ - * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - * - * A sample .htaccess file: - * RewriteEngine On - * RewriteCond %{HTTP:Authorization} ^(.+)$ - * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - * RewriteCond %{REQUEST_FILENAME} !-f - * RewriteRule ^(.*)$ app.php [QSA,L] - */ - - $authorizationHeader = null; - if (isset($this->parameters['HTTP_AUTHORIZATION'])) { - $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION']; - } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) { - $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION']; - } - - if (null !== $authorizationHeader) { - if (0 === stripos($authorizationHeader, 'basic ')) { - // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic - $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2); - if (2 == count($exploded)) { - list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; - } - } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) { - // In some circumstances PHP_AUTH_DIGEST needs to be set - $headers['PHP_AUTH_DIGEST'] = $authorizationHeader; - $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader; - } elseif (0 === stripos($authorizationHeader, 'bearer ')) { - /* - * XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables, - * I'll just set $headers['AUTHORIZATION'] here. - * http://php.net/manual/en/reserved.variables.server.php - */ - $headers['AUTHORIZATION'] = $authorizationHeader; - } - } - } - - if (isset($headers['AUTHORIZATION'])) { - return $headers; - } - - // PHP_AUTH_USER/PHP_AUTH_PW - if (isset($headers['PHP_AUTH_USER'])) { - $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); - } elseif (isset($headers['PHP_AUTH_DIGEST'])) { - $headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST']; - } - - return $headers; - } -} diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php deleted file mode 100644 index 57c2971..0000000 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -/** - * This class relates to session attribute storage. - */ -class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable -{ - private $name = 'attributes'; - - /** - * @var string - */ - private $storageKey; - - /** - * @var array - */ - protected $attributes = array(); - - /** - * @param string $storageKey The key used to store attributes in the session - */ - public function __construct($storageKey = '_sf2_attributes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$attributes) - { - $this->attributes = &$attributes; - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $this->attributes[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function all() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->attributes = array(); - foreach ($attributes as $key => $value) { - $this->set($key, $value); - } - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - $retval = null; - if (array_key_exists($name, $this->attributes)) { - $retval = $this->attributes[$name]; - unset($this->attributes[$name]); - } - - return $retval; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $return = $this->attributes; - $this->attributes = array(); - - return $return; - } - - /** - * Returns an iterator for attributes. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->attributes); - } - - /** - * Returns the number of attributes. - * - * @return int The number of attributes - */ - public function count() - { - return count($this->attributes); - } -} diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php deleted file mode 100644 index 0d8d179..0000000 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * Attributes store. - * - * @author Drak - */ -interface AttributeBagInterface extends SessionBagInterface -{ - /** - * Checks if an attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - */ - public function has($name); - - /** - * Returns an attribute. - * - * @param string $name The attribute name - * @param mixed $default The default value if not found - * - * @return mixed - */ - public function get($name, $default = null); - - /** - * Sets an attribute. - * - * @param string $name - * @param mixed $value - */ - public function set($name, $value); - - /** - * Returns attributes. - * - * @return array Attributes - */ - public function all(); - - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ - public function replace(array $attributes); - - /** - * Removes an attribute. - * - * @param string $name - * - * @return mixed The removed value or null when it does not exist - */ - public function remove($name); -} diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php deleted file mode 100644 index e149801..0000000 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Attribute; - -/** - * This class provides structured storage of session attributes using - * a name spacing character in the key. - * - * @author Drak - */ -class NamespacedAttributeBag extends AttributeBag -{ - /** - * Namespace character. - * - * @var string - */ - private $namespaceCharacter; - - /** - * @param string $storageKey Session storage key - * @param string $namespaceCharacter Namespace character to use in keys - */ - public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter = '/') - { - $this->namespaceCharacter = $namespaceCharacter; - parent::__construct($storageKey); - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is - $attributes = $this->resolveAttributePath($name); - $name = $this->resolveKey($name); - - if (null === $attributes) { - return false; - } - - return array_key_exists($name, $attributes); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - // reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is - $attributes = $this->resolveAttributePath($name); - $name = $this->resolveKey($name); - - if (null === $attributes) { - return $default; - } - - return array_key_exists($name, $attributes) ? $attributes[$name] : $default; - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $attributes = &$this->resolveAttributePath($name, true); - $name = $this->resolveKey($name); - $attributes[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - $retval = null; - $attributes = &$this->resolveAttributePath($name); - $name = $this->resolveKey($name); - if (null !== $attributes && array_key_exists($name, $attributes)) { - $retval = $attributes[$name]; - unset($attributes[$name]); - } - - return $retval; - } - - /** - * Resolves a path in attributes property and returns it as a reference. - * - * This method allows structured namespacing of session attributes. - * - * @param string $name Key name - * @param bool $writeContext Write context, default false - * - * @return array - */ - protected function &resolveAttributePath($name, $writeContext = false) - { - $array = &$this->attributes; - $name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name; - - // Check if there is anything to do, else return - if (!$name) { - return $array; - } - - $parts = explode($this->namespaceCharacter, $name); - if (count($parts) < 2) { - if (!$writeContext) { - return $array; - } - - $array[$parts[0]] = array(); - - return $array; - } - - unset($parts[count($parts) - 1]); - - foreach ($parts as $part) { - if (null !== $array && !array_key_exists($part, $array)) { - $array[$part] = $writeContext ? array() : null; - } - - $array = &$array[$part]; - } - - return $array; - } - - /** - * Resolves the key from the name. - * - * This is the last part in a dot separated string. - * - * @param string $name - * - * @return string - */ - protected function resolveKey($name) - { - if (false !== $pos = strrpos($name, $this->namespaceCharacter)) { - $name = substr($name, $pos + 1); - } - - return $name; - } -} diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php deleted file mode 100644 index 8110aee..0000000 --- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -/** - * AutoExpireFlashBag flash message container. - * - * @author Drak - */ -class AutoExpireFlashBag implements FlashBagInterface -{ - private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ - private $flashes = array('display' => array(), 'new' => array()); - - /** - * The storage key for flashes in the session. - * - * @var string - */ - private $storageKey; - - /** - * @param string $storageKey The key used to store flashes in the session - */ - public function __construct($storageKey = '_sf2_flashes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$flashes) - { - $this->flashes = &$flashes; - - // The logic: messages from the last request will be stored in new, so we move them to previous - // This request we will show what is in 'display'. What is placed into 'new' this time round will - // be moved to display next time round. - $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); - $this->flashes['new'] = array(); - } - - /** - * {@inheritdoc} - */ - public function add($type, $message) - { - $this->flashes['new'][$type][] = $message; - } - - /** - * {@inheritdoc} - */ - public function peek($type, array $default = array()) - { - return $this->has($type) ? $this->flashes['display'][$type] : $default; - } - - /** - * {@inheritdoc} - */ - public function peekAll() - { - return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); - } - - /** - * {@inheritdoc} - */ - public function get($type, array $default = array()) - { - $return = $default; - - if (!$this->has($type)) { - return $return; - } - - if (isset($this->flashes['display'][$type])) { - $return = $this->flashes['display'][$type]; - unset($this->flashes['display'][$type]); - } - - return $return; - } - - /** - * {@inheritdoc} - */ - public function all() - { - $return = $this->flashes['display']; - $this->flashes = array('new' => array(), 'display' => array()); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function setAll(array $messages) - { - $this->flashes['new'] = $messages; - } - - /** - * {@inheritdoc} - */ - public function set($type, $messages) - { - $this->flashes['new'][$type] = (array) $messages; - } - - /** - * {@inheritdoc} - */ - public function has($type) - { - return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type]; - } - - /** - * {@inheritdoc} - */ - public function keys() - { - return array_keys($this->flashes['display']); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return $this->all(); - } -} diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php deleted file mode 100644 index a86dc6c..0000000 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -/** - * FlashBag flash message container. - * - * @author Drak - */ -class FlashBag implements FlashBagInterface -{ - private $name = 'flashes'; - - /** - * Flash messages. - * - * @var array - */ - private $flashes = array(); - - /** - * The storage key for flashes in the session. - * - * @var string - */ - private $storageKey; - - /** - * @param string $storageKey The key used to store flashes in the session - */ - public function __construct($storageKey = '_sf2_flashes') - { - $this->storageKey = $storageKey; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$flashes) - { - $this->flashes = &$flashes; - } - - /** - * {@inheritdoc} - */ - public function add($type, $message) - { - $this->flashes[$type][] = $message; - } - - /** - * {@inheritdoc} - */ - public function peek($type, array $default = array()) - { - return $this->has($type) ? $this->flashes[$type] : $default; - } - - /** - * {@inheritdoc} - */ - public function peekAll() - { - return $this->flashes; - } - - /** - * {@inheritdoc} - */ - public function get($type, array $default = array()) - { - if (!$this->has($type)) { - return $default; - } - - $return = $this->flashes[$type]; - - unset($this->flashes[$type]); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function all() - { - $return = $this->peekAll(); - $this->flashes = array(); - - return $return; - } - - /** - * {@inheritdoc} - */ - public function set($type, $messages) - { - $this->flashes[$type] = (array) $messages; - } - - /** - * {@inheritdoc} - */ - public function setAll(array $messages) - { - $this->flashes = $messages; - } - - /** - * {@inheritdoc} - */ - public function has($type) - { - return array_key_exists($type, $this->flashes) && $this->flashes[$type]; - } - - /** - * {@inheritdoc} - */ - public function keys() - { - return array_keys($this->flashes); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - return $this->all(); - } -} diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php deleted file mode 100644 index 25f3d57..0000000 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Flash; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * FlashBagInterface. - * - * @author Drak - */ -interface FlashBagInterface extends SessionBagInterface -{ - /** - * Adds a flash message for type. - * - * @param string $type - * @param string $message - */ - public function add($type, $message); - - /** - * Registers a message for a given type. - * - * @param string $type - * @param string|array $message - */ - public function set($type, $message); - - /** - * Gets flash messages for a given type. - * - * @param string $type Message category type - * @param array $default Default value if $type does not exist - * - * @return array - */ - public function peek($type, array $default = array()); - - /** - * Gets all flash messages. - * - * @return array - */ - public function peekAll(); - - /** - * Gets and clears flash from the stack. - * - * @param string $type - * @param array $default Default value if $type does not exist - * - * @return array - */ - public function get($type, array $default = array()); - - /** - * Gets and clears flashes from the stack. - * - * @return array - */ - public function all(); - - /** - * Sets all flash messages. - * - * @param array $messages - */ - public function setAll(array $messages); - - /** - * Has flash messages for a given type? - * - * @param string $type - * - * @return bool - */ - public function has($type); - - /** - * Returns a list of all defined types. - * - * @return array - */ - public function keys(); -} diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php deleted file mode 100644 index f063651..0000000 --- a/vendor/symfony/http-foundation/Session/Session.php +++ /dev/null @@ -1,257 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * @author Fabien Potencier - * @author Drak - */ -class Session implements SessionInterface, \IteratorAggregate, \Countable -{ - /** - * Storage driver. - * - * @var SessionStorageInterface - */ - protected $storage; - - /** - * @var string - */ - private $flashName; - - /** - * @var string - */ - private $attributeName; - - /** - * @param SessionStorageInterface $storage A SessionStorageInterface instance - * @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag) - * @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag) - */ - public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null) - { - $this->storage = $storage ?: new NativeSessionStorage(); - - $attributes = $attributes ?: new AttributeBag(); - $this->attributeName = $attributes->getName(); - $this->registerBag($attributes); - - $flashes = $flashes ?: new FlashBag(); - $this->flashName = $flashes->getName(); - $this->registerBag($flashes); - } - - /** - * {@inheritdoc} - */ - public function start() - { - return $this->storage->start(); - } - - /** - * {@inheritdoc} - */ - public function has($name) - { - return $this->getAttributeBag()->has($name); - } - - /** - * {@inheritdoc} - */ - public function get($name, $default = null) - { - return $this->getAttributeBag()->get($name, $default); - } - - /** - * {@inheritdoc} - */ - public function set($name, $value) - { - $this->getAttributeBag()->set($name, $value); - } - - /** - * {@inheritdoc} - */ - public function all() - { - return $this->getAttributeBag()->all(); - } - - /** - * {@inheritdoc} - */ - public function replace(array $attributes) - { - $this->getAttributeBag()->replace($attributes); - } - - /** - * {@inheritdoc} - */ - public function remove($name) - { - return $this->getAttributeBag()->remove($name); - } - - /** - * {@inheritdoc} - */ - public function clear() - { - $this->storage->getBag($this->attributeName)->clear(); - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->storage->isStarted(); - } - - /** - * Returns an iterator for attributes. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() - { - return new \ArrayIterator($this->getAttributeBag()->all()); - } - - /** - * Returns the number of attributes. - * - * @return int The number of attributes - */ - public function count() - { - return count($this->getAttributeBag()->all()); - } - - /** - * {@inheritdoc} - */ - public function invalidate($lifetime = null) - { - $this->storage->clear(); - - return $this->migrate(true, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function migrate($destroy = false, $lifetime = null) - { - return $this->storage->regenerate($destroy, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $this->storage->save(); - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->storage->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - $this->storage->setId($id); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->storage->getName(); - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->storage->setName($name); - } - - /** - * {@inheritdoc} - */ - public function getMetadataBag() - { - return $this->storage->getMetadataBag(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->storage->registerBag($bag); - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - return $this->storage->getBag($name); - } - - /** - * Gets the flashbag interface. - * - * @return FlashBagInterface - */ - public function getFlashBag() - { - return $this->getBag($this->flashName); - } - - /** - * Gets the attributebag interface. - * - * Note that this method was added to help with IDE autocompletion. - * - * @return AttributeBagInterface - */ - private function getAttributeBag() - { - return $this->storage->getBag($this->attributeName); - } -} diff --git a/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/vendor/symfony/http-foundation/Session/SessionBagInterface.php deleted file mode 100644 index aca18aa..0000000 --- a/vendor/symfony/http-foundation/Session/SessionBagInterface.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -/** - * Session Bag store. - * - * @author Drak - */ -interface SessionBagInterface -{ - /** - * Gets this bag's name. - * - * @return string - */ - public function getName(); - - /** - * Initializes the Bag. - * - * @param array $array - */ - public function initialize(array &$array); - - /** - * Gets the storage key for this bag. - * - * @return string - */ - public function getStorageKey(); - - /** - * Clears out data from bag. - * - * @return mixed Whatever data was contained - */ - public function clear(); -} diff --git a/vendor/symfony/http-foundation/Session/SessionInterface.php b/vendor/symfony/http-foundation/Session/SessionInterface.php deleted file mode 100644 index 172c9b4..0000000 --- a/vendor/symfony/http-foundation/Session/SessionInterface.php +++ /dev/null @@ -1,182 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - -/** - * Interface for the session. - * - * @author Drak - */ -interface SessionInterface -{ - /** - * Starts the session storage. - * - * @return bool True if session started - * - * @throws \RuntimeException if session fails to start - */ - public function start(); - - /** - * Returns the session ID. - * - * @return string The session ID - */ - public function getId(); - - /** - * Sets the session ID. - * - * @param string $id - */ - public function setId($id); - - /** - * Returns the session name. - * - * @return mixed The session name - */ - public function getName(); - - /** - * Sets the session name. - * - * @param string $name - */ - public function setName($name); - - /** - * Invalidates the current session. - * - * Clears all session attributes and flashes and regenerates the - * session and deletes the old session from persistence. - * - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session invalidated, false if error - */ - public function invalidate($lifetime = null); - - /** - * Migrates the current session to a new session id while maintaining all - * session attributes. - * - * @param bool $destroy Whether to delete the old session or leave it to garbage collection - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session migrated, false if error - */ - public function migrate($destroy = false, $lifetime = null); - - /** - * Force the session to be saved and closed. - * - * This method is generally not required for real sessions as - * the session will be automatically saved at the end of - * code execution. - */ - public function save(); - - /** - * Checks if an attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - */ - public function has($name); - - /** - * Returns an attribute. - * - * @param string $name The attribute name - * @param mixed $default The default value if not found - * - * @return mixed - */ - public function get($name, $default = null); - - /** - * Sets an attribute. - * - * @param string $name - * @param mixed $value - */ - public function set($name, $value); - - /** - * Returns attributes. - * - * @return array Attributes - */ - public function all(); - - /** - * Sets attributes. - * - * @param array $attributes Attributes - */ - public function replace(array $attributes); - - /** - * Removes an attribute. - * - * @param string $name - * - * @return mixed The removed value or null when it does not exist - */ - public function remove($name); - - /** - * Clears all attributes. - */ - public function clear(); - - /** - * Checks if the session was started. - * - * @return bool - */ - public function isStarted(); - - /** - * Registers a SessionBagInterface with the session. - * - * @param SessionBagInterface $bag - */ - public function registerBag(SessionBagInterface $bag); - - /** - * Gets a bag instance by name. - * - * @param string $name - * - * @return SessionBagInterface - */ - public function getBag($name); - - /** - * Gets session meta. - * - * @return MetadataBag - */ - public function getMetadataBag(); -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php deleted file mode 100644 index d31aa76..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * @author Drak - */ -class MemcacheSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Memcache Memcache driver - */ - private $memcache; - - /** - * @var int Time to live in seconds - */ - private $ttl; - - /** - * @var string Key prefix for shared environments - */ - private $prefix; - - /** - * List of available options: - * * prefix: The prefix to use for the memcache keys in order to avoid collision - * * expiretime: The time to live in seconds - * - * @param \Memcache $memcache A \Memcache instance - * @param array $options An associative array of Memcache options - * - * @throws \InvalidArgumentException When unsupported options are passed - */ - public function __construct(\Memcache $memcache, array $options = array()) - { - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); - } - - $this->memcache = $memcache; - $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; - $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return $this->memcache->get($this->prefix.$sessionId) ?: ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return $this->memcache->set($this->prefix.$sessionId, $data, 0, time() + $this->ttl); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - $this->memcache->delete($this->prefix.$sessionId); - - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // not required here because memcache will auto expire the records anyhow. - return true; - } - - /** - * Return a Memcache instance. - * - * @return \Memcache - */ - protected function getMemcache() - { - return $this->memcache; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php deleted file mode 100644 index 3bbde54..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Memcached based session storage handler based on the Memcached class - * provided by the PHP memcached extension. - * - * @see http://php.net/memcached - * - * @author Drak - */ -class MemcachedSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Memcached Memcached driver - */ - private $memcached; - - /** - * @var int Time to live in seconds - */ - private $ttl; - - /** - * @var string Key prefix for shared environments - */ - private $prefix; - - /** - * List of available options: - * * prefix: The prefix to use for the memcached keys in order to avoid collision - * * expiretime: The time to live in seconds - * - * @param \Memcached $memcached A \Memcached instance - * @param array $options An associative array of Memcached options - * - * @throws \InvalidArgumentException When unsupported options are passed - */ - public function __construct(\Memcached $memcached, array $options = array()) - { - $this->memcached = $memcached; - - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); - } - - $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; - $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return $this->memcached->get($this->prefix.$sessionId) ?: ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - $result = $this->memcached->delete($this->prefix.$sessionId); - - return $result || \Memcached::RES_NOTFOUND == $this->memcached->getResultCode(); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // not required here because memcached will auto expire the records anyhow. - return true; - } - - /** - * Return a Memcached instance. - * - * @return \Memcached - */ - protected function getMemcached() - { - return $this->memcached; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php deleted file mode 100644 index f140939..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ /dev/null @@ -1,228 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * @author Markus Bachmann - */ -class MongoDbSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \Mongo|\MongoClient|\MongoDB\Client - */ - private $mongo; - - /** - * @var \MongoCollection - */ - private $collection; - - /** - * @var array - */ - private $options; - - /** - * List of available options: - * * database: The name of the database [required] - * * collection: The name of the collection [required] - * * id_field: The field name for storing the session id [default: _id] - * * data_field: The field name for storing the session data [default: data] - * * time_field: The field name for storing the timestamp [default: time] - * * expiry_field: The field name for storing the expiry-timestamp [default: expires_at] - * - * It is strongly recommended to put an index on the `expiry_field` for - * garbage-collection. Alternatively it's possible to automatically expire - * the sessions in the database as described below: - * - * A TTL collections can be used on MongoDB 2.2+ to cleanup expired sessions - * automatically. Such an index can for example look like this: - * - * db..ensureIndex( - * { "": 1 }, - * { "expireAfterSeconds": 0 } - * ) - * - * More details on: http://docs.mongodb.org/manual/tutorial/expire-data/ - * - * If you use such an index, you can drop `gc_probability` to 0 since - * no garbage-collection is required. - * - * @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance - * @param array $options An associative array of field options - * - * @throws \InvalidArgumentException When MongoClient or Mongo instance not provided - * @throws \InvalidArgumentException When "database" or "collection" not provided - */ - public function __construct($mongo, array $options) - { - if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { - throw new \InvalidArgumentException('MongoClient or Mongo instance required'); - } - - if (!isset($options['database']) || !isset($options['collection'])) { - throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler'); - } - - $this->mongo = $mongo; - - $this->options = array_merge(array( - 'id_field' => '_id', - 'data_field' => 'data', - 'time_field' => 'time', - 'expiry_field' => 'expires_at', - ), $options); - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' : 'remove'; - - $this->getCollection()->$methodName(array( - $this->options['id_field'] => $sessionId, - )); - - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteMany' : 'remove'; - - $this->getCollection()->$methodName(array( - $this->options['expiry_field'] => array('$lt' => $this->createDateTime()), - )); - - return true; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); - - $fields = array( - $this->options['time_field'] => $this->createDateTime(), - $this->options['expiry_field'] => $expiry, - ); - - $options = array('upsert' => true); - - if ($this->mongo instanceof \MongoDB\Client) { - $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY); - } else { - $fields[$this->options['data_field']] = new \MongoBinData($data, \MongoBinData::BYTE_ARRAY); - $options['multiple'] = false; - } - - $methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' : 'update'; - - $this->getCollection()->$methodName( - array($this->options['id_field'] => $sessionId), - array('$set' => $fields), - $options - ); - - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - $dbData = $this->getCollection()->findOne(array( - $this->options['id_field'] => $sessionId, - $this->options['expiry_field'] => array('$gte' => $this->createDateTime()), - )); - - if (null === $dbData) { - return ''; - } - - if ($dbData[$this->options['data_field']] instanceof \MongoDB\BSON\Binary) { - return $dbData[$this->options['data_field']]->getData(); - } - - return $dbData[$this->options['data_field']]->bin; - } - - /** - * Return a "MongoCollection" instance. - * - * @return \MongoCollection - */ - private function getCollection() - { - if (null === $this->collection) { - $this->collection = $this->mongo->selectCollection($this->options['database'], $this->options['collection']); - } - - return $this->collection; - } - - /** - * Return a Mongo instance. - * - * @return \Mongo|\MongoClient|\MongoDB\Client - */ - protected function getMongo() - { - return $this->mongo; - } - - /** - * Create a date object using the class appropriate for the current mongo connection. - * - * Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime - * - * @param int $seconds An integer representing UTC seconds since Jan 1 1970. Defaults to now. - * - * @return \MongoDate|\MongoDB\BSON\UTCDateTime - */ - private function createDateTime($seconds = null) - { - if (null === $seconds) { - $seconds = time(); - } - - if ($this->mongo instanceof \MongoDB\Client) { - return new \MongoDB\BSON\UTCDateTime($seconds * 1000); - } - - return new \MongoDate($seconds); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php deleted file mode 100644 index d6ad937..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Native session handler using PHP's built in file storage. - * - * @author Drak - */ -class NativeFileSessionHandler extends NativeSessionHandler -{ - /** - * @param string $savePath Path of directory to save session files - * Default null will leave setting as defined by PHP. - * '/path', 'N;/path', or 'N;octal-mode;/path - * - * @see http://php.net/session.configuration.php#ini.session.save-path for further details. - * - * @throws \InvalidArgumentException On invalid $savePath - */ - public function __construct($savePath = null) - { - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - $baseDir = $savePath; - - if ($count = substr_count($savePath, ';')) { - if ($count > 2) { - throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath)); - } - - // characters after last ';' are the path - $baseDir = ltrim(strrchr($savePath, ';'), ';'); - } - - if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) { - throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir)); - } - - ini_set('session.save_path', $savePath); - ini_set('session.save_handler', 'files'); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php deleted file mode 100644 index 4ae410f..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Adds SessionHandler functionality if available. - * - * @see http://php.net/sessionhandler - */ -class NativeSessionHandler extends \SessionHandler -{ -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php deleted file mode 100644 index 1516d43..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NullSessionHandler. - * - * Can be used in unit testing or in a situations where persisted sessions are not desired. - * - * @author Drak - */ -class NullSessionHandler implements \SessionHandlerInterface -{ - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return ''; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return true; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php deleted file mode 100644 index 5cdac63..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ /dev/null @@ -1,740 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Session handler using a PDO connection to read and write data. - * - * It works with MySQL, PostgreSQL, Oracle, SQL Server and SQLite and implements - * different locking strategies to handle concurrent access to the same session. - * Locking is necessary to prevent loss of data due to race conditions and to keep - * the session data consistent between read() and write(). With locking, requests - * for the same session will wait until the other one finished writing. For this - * reason it's best practice to close a session as early as possible to improve - * concurrency. PHPs internal files session handler also implements locking. - * - * Attention: Since SQLite does not support row level locks but locks the whole database, - * it means only one session can be accessed at a time. Even different sessions would wait - * for another to finish. So saving session in SQLite should only be considered for - * development or prototypes. - * - * Session data is a binary string that can contain non-printable characters like the null byte. - * For this reason it must be saved in a binary column in the database like BLOB in MySQL. - * Saving it in a character column could corrupt the data. You can use createTable() - * to initialize a correctly defined table. - * - * @see http://php.net/sessionhandlerinterface - * - * @author Fabien Potencier - * @author Michael Williams - * @author Tobias Schultze - */ -class PdoSessionHandler implements \SessionHandlerInterface -{ - /** - * No locking is done. This means sessions are prone to loss of data due to - * race conditions of concurrent requests to the same session. The last session - * write will win in this case. It might be useful when you implement your own - * logic to deal with this like an optimistic approach. - */ - const LOCK_NONE = 0; - - /** - * Creates an application-level lock on a session. The disadvantage is that the - * lock is not enforced by the database and thus other, unaware parts of the - * application could still concurrently modify the session. The advantage is it - * does not require a transaction. - * This mode is not available for SQLite and not yet implemented for oci and sqlsrv. - */ - const LOCK_ADVISORY = 1; - - /** - * Issues a real row lock. Since it uses a transaction between opening and - * closing a session, you have to be careful when you use same database connection - * that you also use for your application logic. This mode is the default because - * it's the only reliable solution across DBMSs. - */ - const LOCK_TRANSACTIONAL = 2; - - /** - * @var \PDO|null PDO instance or null when not connected yet - */ - private $pdo; - - /** - * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled - */ - private $dsn = false; - - /** - * @var string Database driver - */ - private $driver; - - /** - * @var string Table name - */ - private $table = 'sessions'; - - /** - * @var string Column for session id - */ - private $idCol = 'sess_id'; - - /** - * @var string Column for session data - */ - private $dataCol = 'sess_data'; - - /** - * @var string Column for lifetime - */ - private $lifetimeCol = 'sess_lifetime'; - - /** - * @var string Column for timestamp - */ - private $timeCol = 'sess_time'; - - /** - * @var string Username when lazy-connect - */ - private $username = ''; - - /** - * @var string Password when lazy-connect - */ - private $password = ''; - - /** - * @var array Connection options when lazy-connect - */ - private $connectionOptions = array(); - - /** - * @var int The strategy for locking, see constants - */ - private $lockMode = self::LOCK_TRANSACTIONAL; - - /** - * It's an array to support multiple reads before closing which is manual, non-standard usage. - * - * @var \PDOStatement[] An array of statements to release advisory locks - */ - private $unlockStatements = array(); - - /** - * @var bool True when the current session exists but expired according to session.gc_maxlifetime - */ - private $sessionExpired = false; - - /** - * @var bool Whether a transaction is active - */ - private $inTransaction = false; - - /** - * @var bool Whether gc() has been called - */ - private $gcCalled = false; - - /** - * You can either pass an existing database connection as PDO instance or - * pass a DSN string that will be used to lazy-connect to the database - * when the session is actually used. Furthermore it's possible to pass null - * which will then use the session.save_path ini setting as PDO DSN parameter. - * - * List of available options: - * * db_table: The name of the table [default: sessions] - * * db_id_col: The column where to store the session id [default: sess_id] - * * db_data_col: The column where to store the session data [default: sess_data] - * * db_lifetime_col: The column where to store the lifetime [default: sess_lifetime] - * * db_time_col: The column where to store the timestamp [default: sess_time] - * * db_username: The username when lazy-connect [default: ''] - * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] - * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL] - * - * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or null - * @param array $options An associative array of options - * - * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION - */ - public function __construct($pdoOrDsn = null, array $options = array()) - { - if ($pdoOrDsn instanceof \PDO) { - if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { - throw new \InvalidArgumentException(sprintf('"%s" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))', __CLASS__)); - } - - $this->pdo = $pdoOrDsn; - $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - } else { - $this->dsn = $pdoOrDsn; - } - - $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table; - $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol; - $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol; - $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol; - $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol; - $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username; - $this->password = isset($options['db_password']) ? $options['db_password'] : $this->password; - $this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions; - $this->lockMode = isset($options['lock_mode']) ? $options['lock_mode'] : $this->lockMode; - } - - /** - * Creates the table to store sessions which can be called once for setup. - * - * Session ID is saved in a column of maximum length 128 because that is enough even - * for a 512 bit configured session.hash_function like Whirlpool. Session data is - * saved in a BLOB. One could also use a shorter inlined varbinary column - * if one was sure the data fits into it. - * - * @throws \PDOException When the table already exists - * @throws \DomainException When an unsupported PDO driver is used - */ - public function createTable() - { - // connect if we are not yet - $this->getConnection(); - - switch ($this->driver) { - case 'mysql': - // We use varbinary for the ID column because it prevents unwanted conversions: - // - character set conversions between server and client - // - trailing space removal - // - case-insensitivity - // - language processing like é == e - $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol MEDIUMINT NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB"; - break; - case 'sqlite': - $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'pgsql': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'oci': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - case 'sqlsrv': - $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)"; - break; - default: - throw new \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver)); - } - - try { - $this->pdo->exec($sql); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - - /** - * Returns true when the current session exists but expired according to session.gc_maxlifetime. - * - * Can be used to distinguish between a new session and one that expired due to inactivity. - * - * @return bool Whether current session expired - */ - public function isSessionExpired() - { - return $this->sessionExpired; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - if (null === $this->pdo) { - $this->connect($this->dsn ?: $savePath); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - try { - return $this->doRead($sessionId); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - // We delay gc() to close() so that it is executed outside the transactional and blocking read-write process. - // This way, pruning expired sessions does not block them from being started while the current session is used. - $this->gcCalled = true; - - return true; - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - // delete the record associated with this id - $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; - - try { - $stmt = $this->pdo->prepare($sql); - $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - $maxlifetime = (int) ini_get('session.gc_maxlifetime'); - - try { - // We use a single MERGE SQL query when supported by the database. - $mergeStmt = $this->getMergeStatement($sessionId, $data, $maxlifetime); - if (null !== $mergeStmt) { - $mergeStmt->execute(); - - return true; - } - - $updateStmt = $this->pdo->prepare( - "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id" - ); - $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $updateStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $updateStmt->execute(); - - // When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in - // duplicate key errors when the same session is written simultaneously (given the LOCK_NONE behavior). - // We can just catch such an error and re-execute the update. This is similar to a serializable - // transaction with retry logic on serialization failures but without the overhead and without possible - // false positives due to longer gap locking. - if (!$updateStmt->rowCount()) { - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $insertStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Handle integrity violation SQLSTATE 23000 (or a subclass like 23505 in Postgres) for duplicate keys - if (0 === strpos($e->getCode(), '23')) { - $updateStmt->execute(); - } else { - throw $e; - } - } - } - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - $this->commit(); - - while ($unlockStmt = array_shift($this->unlockStatements)) { - $unlockStmt->execute(); - } - - if ($this->gcCalled) { - $this->gcCalled = false; - - // delete the session records that have expired - $sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time"; - - $stmt = $this->pdo->prepare($sql); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - } - - if (false !== $this->dsn) { - $this->pdo = null; // only close lazy-connection - } - - return true; - } - - /** - * Lazy-connects to the database. - * - * @param string $dsn DSN string - */ - private function connect($dsn) - { - $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions); - $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - } - - /** - * Helper method to begin a transaction. - * - * Since SQLite does not support row level locks, we have to acquire a reserved lock - * on the database immediately. Because of https://bugs.php.net/42766 we have to create - * such a transaction manually which also means we cannot use PDO::commit or - * PDO::rollback or PDO::inTransaction for SQLite. - * - * Also MySQLs default isolation, REPEATABLE READ, causes deadlock for different sessions - * due to http://www.mysqlperformanceblog.com/2013/12/12/one-more-innodb-gap-lock-to-avoid/ . - * So we change it to READ COMMITTED. - */ - private function beginTransaction() - { - if (!$this->inTransaction) { - if ('sqlite' === $this->driver) { - $this->pdo->exec('BEGIN IMMEDIATE TRANSACTION'); - } else { - if ('mysql' === $this->driver) { - $this->pdo->exec('SET TRANSACTION ISOLATION LEVEL READ COMMITTED'); - } - $this->pdo->beginTransaction(); - } - $this->inTransaction = true; - } - } - - /** - * Helper method to commit a transaction. - */ - private function commit() - { - if ($this->inTransaction) { - try { - // commit read-write transaction which also releases the lock - if ('sqlite' === $this->driver) { - $this->pdo->exec('COMMIT'); - } else { - $this->pdo->commit(); - } - $this->inTransaction = false; - } catch (\PDOException $e) { - $this->rollback(); - - throw $e; - } - } - } - - /** - * Helper method to rollback a transaction. - */ - private function rollback() - { - // We only need to rollback if we are in a transaction. Otherwise the resulting - // error would hide the real problem why rollback was called. We might not be - // in a transaction when not using the transactional locking behavior or when - // two callbacks (e.g. destroy and write) are invoked that both fail. - if ($this->inTransaction) { - if ('sqlite' === $this->driver) { - $this->pdo->exec('ROLLBACK'); - } else { - $this->pdo->rollBack(); - } - $this->inTransaction = false; - } - } - - /** - * Reads the session data in respect to the different locking strategies. - * - * We need to make sure we do not return session data that is already considered garbage according - * to the session.gc_maxlifetime setting because gc() is called after read() and only sometimes. - * - * @param string $sessionId Session ID - * - * @return string The session data - */ - private function doRead($sessionId) - { - $this->sessionExpired = false; - - if (self::LOCK_ADVISORY === $this->lockMode) { - $this->unlockStatements[] = $this->doAdvisoryLock($sessionId); - } - - $selectSql = $this->getSelectSql(); - $selectStmt = $this->pdo->prepare($selectSql); - $selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - - do { - $selectStmt->execute(); - $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); - - if ($sessionRows) { - if ($sessionRows[0][1] + $sessionRows[0][2] < time()) { - $this->sessionExpired = true; - - return ''; - } - - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; - } - - if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { - // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block - // until other connections to the session are committed. - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', 0, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Catch duplicate key error because other connection created the session already. - // It would only not be the case when the other connection destroyed the session. - if (0 === strpos($e->getCode(), '23')) { - // Retrieve finished session data written by concurrent connection by restarting the loop. - // We have to start a new transaction as a failed query will mark the current transaction as - // aborted in PostgreSQL and disallow further queries within it. - $this->rollback(); - $this->beginTransaction(); - continue; - } - - throw $e; - } - } - - return ''; - } while (true); - } - - /** - * Executes an application-level lock on the database. - * - * @param string $sessionId Session ID - * - * @return \PDOStatement The statement that needs to be executed later to release the lock - * - * @throws \DomainException When an unsupported PDO driver is used - * - * @todo implement missing advisory locks - * - for oci using DBMS_LOCK.REQUEST - * - for sqlsrv using sp_getapplock with LockOwner = Session - */ - private function doAdvisoryLock($sessionId) - { - switch ($this->driver) { - case 'mysql': - // should we handle the return value? 0 on timeout, null on error - // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout - $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); - $stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)'); - $releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); - - return $releaseStmt; - case 'pgsql': - // Obtaining an exclusive session level advisory lock requires an integer key. - // When session.sid_bits_per_character > 4, the session id can contain non-hex-characters. - // So we cannot just use hexdec(). - if (4 === \PHP_INT_SIZE) { - $sessionInt1 = $this->convertStringToInt($sessionId); - $sessionInt2 = $this->convertStringToInt(substr($sessionId, 4, 4)); - - $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key1, :key2)'); - $stmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); - $stmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key1, :key2)'); - $releaseStmt->bindValue(':key1', $sessionInt1, \PDO::PARAM_INT); - $releaseStmt->bindValue(':key2', $sessionInt2, \PDO::PARAM_INT); - } else { - $sessionBigInt = $this->convertStringToInt($sessionId); - - $stmt = $this->pdo->prepare('SELECT pg_advisory_lock(:key)'); - $stmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); - $stmt->execute(); - - $releaseStmt = $this->pdo->prepare('SELECT pg_advisory_unlock(:key)'); - $releaseStmt->bindValue(':key', $sessionBigInt, \PDO::PARAM_INT); - } - - return $releaseStmt; - case 'sqlite': - throw new \DomainException('SQLite does not support advisory locks.'); - default: - throw new \DomainException(sprintf('Advisory locks are currently not implemented for PDO driver "%s".', $this->driver)); - } - } - - /** - * Encodes the first 4 (when PHP_INT_SIZE == 4) or 8 characters of the string as an integer. - * - * Keep in mind, PHP integers are signed. - * - * @param string $string - * - * @return int - */ - private function convertStringToInt($string) - { - if (4 === \PHP_INT_SIZE) { - return (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); - } - - $int1 = (ord($string[7]) << 24) + (ord($string[6]) << 16) + (ord($string[5]) << 8) + ord($string[4]); - $int2 = (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); - - return $int2 + ($int1 << 32); - } - - /** - * Return a locking or nonlocking SQL query to read session information. - * - * @return string The SQL string - * - * @throws \DomainException When an unsupported PDO driver is used - */ - private function getSelectSql() - { - if (self::LOCK_TRANSACTIONAL === $this->lockMode) { - $this->beginTransaction(); - - switch ($this->driver) { - case 'mysql': - case 'oci': - case 'pgsql': - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id FOR UPDATE"; - case 'sqlsrv': - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WITH (UPDLOCK, ROWLOCK) WHERE $this->idCol = :id"; - case 'sqlite': - // we already locked when starting transaction - break; - default: - throw new \DomainException(sprintf('Transactional locks are currently not implemented for PDO driver "%s".', $this->driver)); - } - } - - return "SELECT $this->dataCol, $this->lifetimeCol, $this->timeCol FROM $this->table WHERE $this->idCol = :id"; - } - - /** - * Returns a merge/upsert (i.e. insert or update) statement when supported by the database for writing session data. - * - * @param string $sessionId Session ID - * @param string $data Encoded session data - * @param int $maxlifetime session.gc_maxlifetime - * - * @return \PDOStatement|null The merge statement or null when not supported - */ - private function getMergeStatement($sessionId, $data, $maxlifetime) - { - $mergeSql = null; - switch (true) { - case 'mysql' === $this->driver: - $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; - break; - case 'oci' === $this->driver: - // DUAL is Oracle specific dummy table - $mergeSql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; - break; - case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): - // MERGE is only available since SQL Server 2008 and must be terminated by semicolon - // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx - $mergeSql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;"; - break; - case 'sqlite' === $this->driver: - $mergeSql = "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; - break; - case 'pgsql' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '9.5', '>='): - $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; - break; - } - - if (null !== $mergeSql) { - $mergeStmt = $this->pdo->prepare($mergeSql); - - if ('sqlsrv' === $this->driver || 'oci' === $this->driver) { - $mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(5, time(), \PDO::PARAM_INT); - $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); - } else { - $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); - } - - return $mergeStmt; - } - } - - /** - * Return a PDO instance. - * - * @return \PDO - */ - protected function getConnection() - { - if (null === $this->pdo) { - $this->connect($this->dsn ?: ini_get('session.save_path')); - } - - return $this->pdo; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php deleted file mode 100644 index d49c36c..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Wraps another SessionHandlerInterface to only write the session when it has been modified. - * - * @author Adrien Brault - */ -class WriteCheckSessionHandler implements \SessionHandlerInterface -{ - /** - * @var \SessionHandlerInterface - */ - private $wrappedSessionHandler; - - /** - * @var array sessionId => session - */ - private $readSessions; - - public function __construct(\SessionHandlerInterface $wrappedSessionHandler) - { - $this->wrappedSessionHandler = $wrappedSessionHandler; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return $this->wrappedSessionHandler->close(); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return $this->wrappedSessionHandler->destroy($sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return $this->wrappedSessionHandler->gc($maxlifetime); - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return $this->wrappedSessionHandler->open($savePath, $sessionName); - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - $session = $this->wrappedSessionHandler->read($sessionId); - - $this->readSessions[$sessionId] = $session; - - return $session; - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) { - return true; - } - - return $this->wrappedSessionHandler->write($sessionId, $data); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php deleted file mode 100644 index 6f59af4..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ /dev/null @@ -1,168 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * Metadata container. - * - * Adds metadata to the session. - * - * @author Drak - */ -class MetadataBag implements SessionBagInterface -{ - const CREATED = 'c'; - const UPDATED = 'u'; - const LIFETIME = 'l'; - - /** - * @var string - */ - private $name = '__metadata'; - - /** - * @var string - */ - private $storageKey; - - /** - * @var array - */ - protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0); - - /** - * Unix timestamp. - * - * @var int - */ - private $lastUsed; - - /** - * @var int - */ - private $updateThreshold; - - /** - * @param string $storageKey The key used to store bag in the session - * @param int $updateThreshold The time to wait between two UPDATED updates - */ - public function __construct($storageKey = '_sf2_meta', $updateThreshold = 0) - { - $this->storageKey = $storageKey; - $this->updateThreshold = $updateThreshold; - } - - /** - * {@inheritdoc} - */ - public function initialize(array &$array) - { - $this->meta = &$array; - - if (isset($array[self::CREATED])) { - $this->lastUsed = $this->meta[self::UPDATED]; - - $timeStamp = time(); - if ($timeStamp - $array[self::UPDATED] >= $this->updateThreshold) { - $this->meta[self::UPDATED] = $timeStamp; - } - } else { - $this->stampCreated(); - } - } - - /** - * Gets the lifetime that the session cookie was set with. - * - * @return int - */ - public function getLifetime() - { - return $this->meta[self::LIFETIME]; - } - - /** - * Stamps a new session's metadata. - * - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - */ - public function stampNew($lifetime = null) - { - $this->stampCreated($lifetime); - } - - /** - * {@inheritdoc} - */ - public function getStorageKey() - { - return $this->storageKey; - } - - /** - * Gets the created timestamp metadata. - * - * @return int Unix timestamp - */ - public function getCreated() - { - return $this->meta[self::CREATED]; - } - - /** - * Gets the last used metadata. - * - * @return int Unix timestamp - */ - public function getLastUsed() - { - return $this->lastUsed; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // nothing to do - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name. - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - private function stampCreated($lifetime = null) - { - $timeStamp = time(); - $this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp; - $this->meta[self::LIFETIME] = (null === $lifetime) ? ini_get('session.cookie_lifetime') : $lifetime; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php deleted file mode 100644 index 0349a43..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ /dev/null @@ -1,266 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * MockArraySessionStorage mocks the session for unit tests. - * - * No PHP session is actually started since a session can be initialized - * and shutdown only once per PHP execution cycle. - * - * When doing functional testing, you should use MockFileSessionStorage instead. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * @author Drak - */ -class MockArraySessionStorage implements SessionStorageInterface -{ - /** - * @var string - */ - protected $id = ''; - - /** - * @var string - */ - protected $name; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var array - */ - protected $data = array(); - - /** - * @var MetadataBag - */ - protected $metadataBag; - - /** - * @var array|SessionBagInterface[] - */ - protected $bags = array(); - - /** - * @param string $name Session name - * @param MetadataBag $metaBag MetadataBag instance - */ - public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null) - { - $this->name = $name; - $this->setMetadataBag($metaBag); - } - - /** - * Sets the session data. - * - * @param array $array - */ - public function setSessionData(array $array) - { - $this->data = $array; - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (empty($this->id)) { - $this->id = $this->generateId(); - } - - $this->loadSession(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - if (!$this->started) { - $this->start(); - } - - $this->metadataBag->stampNew($lifetime); - $this->id = $this->generateId(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->id; - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - if ($this->started) { - throw new \LogicException('Cannot set session ID after the session has started.'); - } - - $this->id = $id; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function save() - { - if (!$this->started || $this->closed) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); - } - // nothing to do since we don't persist the session data - $this->closed = false; - $this->started = false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // clear out the session - $this->data = array(); - - // reconnect the bags to the session - $this->loadSession(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - $this->bags[$bag->getName()] = $bag; - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); - } - - if (!$this->started) { - $this->start(); - } - - return $this->bags[$name]; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->started; - } - - /** - * Sets the MetadataBag. - * - * @param MetadataBag $bag - */ - public function setMetadataBag(MetadataBag $bag = null) - { - if (null === $bag) { - $bag = new MetadataBag(); - } - - $this->metadataBag = $bag; - } - - /** - * Gets the MetadataBag. - * - * @return MetadataBag - */ - public function getMetadataBag() - { - return $this->metadataBag; - } - - /** - * Generates a session ID. - * - * This doesn't need to be particularly cryptographically secure since this is just - * a mock. - * - * @return string - */ - protected function generateId() - { - return hash('sha256', uniqid('ss_mock_', true)); - } - - protected function loadSession() - { - $bags = array_merge($this->bags, array($this->metadataBag)); - - foreach ($bags as $bag) { - $key = $bag->getStorageKey(); - $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array(); - $bag->initialize($this->data[$key]); - } - - $this->started = true; - $this->closed = false; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php deleted file mode 100644 index 8c1bf73..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -/** - * MockFileSessionStorage is used to mock sessions for - * functional testing when done in a single PHP process. - * - * No PHP session is actually started since a session can be initialized - * and shutdown only once per PHP execution cycle and this class does - * not pollute any session related globals, including session_*() functions - * or session.* PHP ini directives. - * - * @author Drak - */ -class MockFileSessionStorage extends MockArraySessionStorage -{ - /** - * @var string - */ - private $savePath; - - /** - * @param string $savePath Path of directory to save session files - * @param string $name Session name - * @param MetadataBag $metaBag MetadataBag instance - */ - public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null) - { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - if (!is_dir($savePath) && !@mkdir($savePath, 0777, true) && !is_dir($savePath)) { - throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $savePath)); - } - - $this->savePath = $savePath; - - parent::__construct($name, $metaBag); - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (!$this->id) { - $this->id = $this->generateId(); - } - - $this->read(); - - $this->started = true; - - return true; - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - if (!$this->started) { - $this->start(); - } - - if ($destroy) { - $this->destroy(); - } - - return parent::regenerate($destroy, $lifetime); - } - - /** - * {@inheritdoc} - */ - public function save() - { - if (!$this->started) { - throw new \RuntimeException('Trying to save a session that was not started yet or was already closed'); - } - - file_put_contents($this->getFilePath(), serialize($this->data)); - - // this is needed for Silex, where the session object is re-used across requests - // in functional tests. In Symfony, the container is rebooted, so we don't have - // this issue - $this->started = false; - } - - /** - * Deletes a session from persistent storage. - * Deliberately leaves session data in memory intact. - */ - private function destroy() - { - if (is_file($this->getFilePath())) { - unlink($this->getFilePath()); - } - } - - /** - * Calculate path to file. - * - * @return string File path - */ - private function getFilePath() - { - return $this->savePath.'/'.$this->id.'.mocksess'; - } - - /** - * Reads session from storage and loads session. - */ - private function read() - { - $filePath = $this->getFilePath(); - $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); - - $this->loadSession(); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php deleted file mode 100644 index 8f4ebef..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ /dev/null @@ -1,421 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\Debug\Exception\ContextErrorException; -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; - -/** - * This provides a base class for session attribute storage. - * - * @author Drak - */ -class NativeSessionStorage implements SessionStorageInterface -{ - /** - * Array of SessionBagInterface. - * - * @var SessionBagInterface[] - */ - protected $bags; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var AbstractProxy - */ - protected $saveHandler; - - /** - * @var MetadataBag - */ - protected $metadataBag; - - /** - * Depending on how you want the storage driver to behave you probably - * want to override this constructor entirely. - * - * List of options for $options array with their defaults. - * - * @see http://php.net/session.configuration for options - * but we omit 'session.' from the beginning of the keys for convenience. - * - * ("auto_start", is not supported as it tells PHP to start a session before - * PHP starts to execute user-land code. Setting during runtime has no effect). - * - * cache_limiter, "" (use "0" to prevent headers from being sent entirely). - * cookie_domain, "" - * cookie_httponly, "" - * cookie_lifetime, "0" - * cookie_path, "/" - * cookie_secure, "" - * entropy_file, "" - * entropy_length, "0" - * gc_divisor, "100" - * gc_maxlifetime, "1440" - * gc_probability, "1" - * hash_bits_per_character, "4" - * hash_function, "0" - * name, "PHPSESSID" - * referer_check, "" - * serialize_handler, "php" - * use_strict_mode, "0" - * use_cookies, "1" - * use_only_cookies, "1" - * use_trans_sid, "0" - * upload_progress.enabled, "1" - * upload_progress.cleanup, "1" - * upload_progress.prefix, "upload_progress_" - * upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS" - * upload_progress.freq, "1%" - * upload_progress.min-freq, "1" - * url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset=" - * sid_length, "32" - * sid_bits_per_character, "5" - * trans_sid_hosts, $_SERVER['HTTP_HOST'] - * trans_sid_tags, "a=href,area=href,frame=src,form=" - * - * @param array $options Session configuration options - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag - */ - public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) - { - session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used) - ini_set('session.use_cookies', 1); - - session_register_shutdown(); - - $this->setMetadataBag($metaBag); - $this->setOptions($options); - $this->setSaveHandler($handler); - } - - /** - * Gets the save handler instance. - * - * @return AbstractProxy - */ - public function getSaveHandler() - { - return $this->saveHandler; - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - if (\PHP_SESSION_ACTIVE === session_status()) { - throw new \RuntimeException('Failed to start the session: already started by PHP.'); - } - - if (ini_get('session.use_cookies') && headers_sent($file, $line)) { - throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); - } - - // ok to try and start the session - if (!session_start()) { - throw new \RuntimeException('Failed to start the session'); - } - - $this->loadSession(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function getId() - { - return $this->saveHandler->getId(); - } - - /** - * {@inheritdoc} - */ - public function setId($id) - { - $this->saveHandler->setId($id); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->saveHandler->getName(); - } - - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->saveHandler->setName($name); - } - - /** - * {@inheritdoc} - */ - public function regenerate($destroy = false, $lifetime = null) - { - // Cannot regenerate the session ID for non-active sessions. - if (\PHP_SESSION_ACTIVE !== session_status()) { - return false; - } - - if (null !== $lifetime) { - ini_set('session.cookie_lifetime', $lifetime); - } - - if ($destroy) { - $this->metadataBag->stampNew(); - } - - $isRegenerated = session_regenerate_id($destroy); - - // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it. - // @see https://bugs.php.net/bug.php?id=70013 - $this->loadSession(); - - return $isRegenerated; - } - - /** - * {@inheritdoc} - */ - public function save() - { - // Register custom error handler to catch a possible failure warning during session write - set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { - throw new ContextErrorException($errstr, $errno, E_WARNING, $errfile, $errline, $errcontext); - }, E_WARNING); - - try { - session_write_close(); - restore_error_handler(); - } catch (ContextErrorException $e) { - // The default PHP error message is not very helpful, as it does not give any information on the current save handler. - // Therefore, we catch this error and trigger a warning with a better error message - $handler = $this->getSaveHandler(); - if ($handler instanceof SessionHandlerProxy) { - $handler = $handler->getHandler(); - } - - restore_error_handler(); - trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', get_class($handler)), E_USER_WARNING); - } - - $this->closed = true; - $this->started = false; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // clear out the session - $_SESSION = array(); - - // reconnect the bags to the session - $this->loadSession(); - } - - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) - { - if ($this->started) { - throw new \LogicException('Cannot register a bag when the session is already started.'); - } - - $this->bags[$bag->getName()] = $bag; - } - - /** - * {@inheritdoc} - */ - public function getBag($name) - { - if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); - } - - if ($this->saveHandler->isActive() && !$this->started) { - $this->loadSession(); - } elseif (!$this->started) { - $this->start(); - } - - return $this->bags[$name]; - } - - /** - * Sets the MetadataBag. - * - * @param MetadataBag $metaBag - */ - public function setMetadataBag(MetadataBag $metaBag = null) - { - if (null === $metaBag) { - $metaBag = new MetadataBag(); - } - - $this->metadataBag = $metaBag; - } - - /** - * Gets the MetadataBag. - * - * @return MetadataBag - */ - public function getMetadataBag() - { - return $this->metadataBag; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return $this->started; - } - - /** - * Sets session.* ini variables. - * - * For convenience we omit 'session.' from the beginning of the keys. - * Explicitly ignores other ini keys. - * - * @param array $options Session ini directives array(key => value) - * - * @see http://php.net/session.configuration - */ - public function setOptions(array $options) - { - $validOptions = array_flip(array( - 'cache_limiter', 'cookie_domain', 'cookie_httponly', - 'cookie_lifetime', 'cookie_path', 'cookie_secure', - 'entropy_file', 'entropy_length', 'gc_divisor', - 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', - 'hash_function', 'name', 'referer_check', - 'serialize_handler', 'use_strict_mode', 'use_cookies', - 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled', - 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', - 'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags', - 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags', - )); - - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set('session.'.$key, $value); - } - } - } - - /** - * Registers session save handler as a PHP session handler. - * - * To use internal PHP session save handlers, override this method using ini_set with - * session.save_handler and session.save_path e.g. - * - * ini_set('session.save_handler', 'files'); - * ini_set('session.save_path', '/tmp'); - * - * or pass in a NativeSessionHandler instance which configures session.save_handler in the - * constructor, for a template see NativeFileSessionHandler or use handlers in - * composer package drak/native-session - * - * @see http://php.net/session-set-save-handler - * @see http://php.net/sessionhandlerinterface - * @see http://php.net/sessionhandler - * @see http://github.com/drak/NativeSession - * - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $saveHandler - * - * @throws \InvalidArgumentException - */ - public function setSaveHandler($saveHandler = null) - { - if (!$saveHandler instanceof AbstractProxy && - !$saveHandler instanceof NativeSessionHandler && - !$saveHandler instanceof \SessionHandlerInterface && - null !== $saveHandler) { - throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.'); - } - - // Wrap $saveHandler in proxy and prevent double wrapping of proxy - if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { - $saveHandler = new SessionHandlerProxy($saveHandler); - } elseif (!$saveHandler instanceof AbstractProxy) { - $saveHandler = new SessionHandlerProxy(new \SessionHandler()); - } - $this->saveHandler = $saveHandler; - - if ($this->saveHandler instanceof \SessionHandlerInterface) { - session_set_save_handler($this->saveHandler, false); - } - } - - /** - * Load the session with attributes. - * - * After starting the session, PHP retrieves the session from whatever handlers - * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). - * PHP takes the return value from the read() handler, unserializes it - * and populates $_SESSION with the result automatically. - * - * @param array|null $session - */ - protected function loadSession(array &$session = null) - { - if (null === $session) { - $session = &$_SESSION; - } - - $bags = array_merge($this->bags, array($this->metadataBag)); - - foreach ($bags as $bag) { - $key = $bag->getStorageKey(); - $session[$key] = isset($session[$key]) ? $session[$key] : array(); - $bag->initialize($session[$key]); - } - - $this->started = true; - $this->closed = false; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php deleted file mode 100644 index 9420d08..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; - -/** - * Allows session to be started by PHP and managed by Symfony. - * - * @author Drak - */ -class PhpBridgeSessionStorage extends NativeSessionStorage -{ - /** - * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler - * @param MetadataBag $metaBag MetadataBag - */ - public function __construct($handler = null, MetadataBag $metaBag = null) - { - $this->setMetadataBag($metaBag); - $this->setSaveHandler($handler); - } - - /** - * {@inheritdoc} - */ - public function start() - { - if ($this->started) { - return true; - } - - $this->loadSession(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function clear() - { - // clear out the bags and nothing else that may be set - // since the purpose of this driver is to share a handler - foreach ($this->bags as $bag) { - $bag->clear(); - } - - // reconnect the bags to the session - $this->loadSession(); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php deleted file mode 100644 index a747865..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * AbstractProxy. - * - * @author Drak - */ -abstract class AbstractProxy -{ - /** - * Flag if handler wraps an internal PHP session handler (using \SessionHandler). - * - * @var bool - */ - protected $wrapper = false; - - /** - * @var string - */ - protected $saveHandlerName; - - /** - * Gets the session.save_handler name. - * - * @return string - */ - public function getSaveHandlerName() - { - return $this->saveHandlerName; - } - - /** - * Is this proxy handler and instance of \SessionHandlerInterface. - * - * @return bool - */ - public function isSessionHandlerInterface() - { - return $this instanceof \SessionHandlerInterface; - } - - /** - * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. - * - * @return bool - */ - public function isWrapper() - { - return $this->wrapper; - } - - /** - * Has a session started? - * - * @return bool - */ - public function isActive() - { - return \PHP_SESSION_ACTIVE === session_status(); - } - - /** - * Gets the session ID. - * - * @return string - */ - public function getId() - { - return session_id(); - } - - /** - * Sets the session ID. - * - * @param string $id - * - * @throws \LogicException - */ - public function setId($id) - { - if ($this->isActive()) { - throw new \LogicException('Cannot change the ID of an active session'); - } - - session_id($id); - } - - /** - * Gets the session name. - * - * @return string - */ - public function getName() - { - return session_name(); - } - - /** - * Sets the session name. - * - * @param string $name - * - * @throws \LogicException - */ - public function setName($name) - { - if ($this->isActive()) { - throw new \LogicException('Cannot change the name of an active session'); - } - - session_name($name); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php deleted file mode 100644 index 21ed1ad..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/NativeProxy.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * This proxy is built-in session handlers in PHP 5.3.x - * - * @author Drak - */ -class NativeProxy extends AbstractProxy -{ - public function __construct() - { - // this makes an educated guess as to what the handler is since it should already be set. - $this->saveHandlerName = ini_get('session.save_handler'); - } - - /** - * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. - * - * @return bool False - */ - public function isWrapper() - { - return false; - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php deleted file mode 100644 index be39f6b..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; - -/** - * @author Drak - */ -class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface -{ - /** - * @var \SessionHandlerInterface - */ - protected $handler; - - /** - * @param \SessionHandlerInterface $handler - */ - public function __construct(\SessionHandlerInterface $handler) - { - $this->handler = $handler; - $this->wrapper = ($handler instanceof \SessionHandler); - $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user'; - } - - /** - * @return \SessionHandlerInterface - */ - public function getHandler() - { - return $this->handler; - } - - // \SessionHandlerInterface - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return (bool) $this->handler->open($savePath, $sessionName); - } - - /** - * {@inheritdoc} - */ - public function close() - { - return (bool) $this->handler->close(); - } - - /** - * {@inheritdoc} - */ - public function read($sessionId) - { - return (string) $this->handler->read($sessionId); - } - - /** - * {@inheritdoc} - */ - public function write($sessionId, $data) - { - return (bool) $this->handler->write($sessionId, $data); - } - - /** - * {@inheritdoc} - */ - public function destroy($sessionId) - { - return (bool) $this->handler->destroy($sessionId); - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - return (bool) $this->handler->gc($maxlifetime); - } -} diff --git a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php deleted file mode 100644 index 097583d..0000000 --- a/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; - -/** - * StorageInterface. - * - * @author Fabien Potencier - * @author Drak - */ -interface SessionStorageInterface -{ - /** - * Starts the session. - * - * @return bool True if started - * - * @throws \RuntimeException if something goes wrong starting the session - */ - public function start(); - - /** - * Checks if the session is started. - * - * @return bool True if started, false otherwise - */ - public function isStarted(); - - /** - * Returns the session ID. - * - * @return string The session ID or empty - */ - public function getId(); - - /** - * Sets the session ID. - * - * @param string $id - */ - public function setId($id); - - /** - * Returns the session name. - * - * @return mixed The session name - */ - public function getName(); - - /** - * Sets the session name. - * - * @param string $name - */ - public function setName($name); - - /** - * Regenerates id that represents this storage. - * - * This method must invoke session_regenerate_id($destroy) unless - * this interface is used for a storage object designed for unit - * or functional testing where a real PHP session would interfere - * with testing. - * - * Note regenerate+destroy should not clear the session data in memory - * only delete the session data from persistent storage. - * - * Care: When regenerating the session ID no locking is involved in PHP's - * session design. See https://bugs.php.net/bug.php?id=61470 for a discussion. - * So you must make sure the regenerated session is saved BEFORE sending the - * headers with the new ID. Symfony's HttpKernel offers a listener for this. - * See Symfony\Component\HttpKernel\EventListener\SaveSessionListener. - * Otherwise session data could get lost again for concurrent requests with the - * new ID. One result could be that you get logged out after just logging in. - * - * @param bool $destroy Destroy session when regenerating? - * @param int $lifetime Sets the cookie lifetime for the session cookie. A null value - * will leave the system settings unchanged, 0 sets the cookie - * to expire with browser session. Time is in seconds, and is - * not a Unix timestamp. - * - * @return bool True if session regenerated, false if error - * - * @throws \RuntimeException If an error occurs while regenerating this storage - */ - public function regenerate($destroy = false, $lifetime = null); - - /** - * Force the session to be saved and closed. - * - * This method must invoke session_write_close() unless this interface is - * used for a storage object design for unit or functional testing where - * a real PHP session would interfere with testing, in which case - * it should actually persist the session data if required. - * - * @throws \RuntimeException if the session is saved without being started, or if the session - * is already closed - */ - public function save(); - - /** - * Clear all session data in memory. - */ - public function clear(); - - /** - * Gets a SessionBagInterface by name. - * - * @param string $name - * - * @return SessionBagInterface - * - * @throws \InvalidArgumentException If the bag does not exist - */ - public function getBag($name); - - /** - * Registers a SessionBagInterface for use. - * - * @param SessionBagInterface $bag - */ - public function registerBag(SessionBagInterface $bag); - - /** - * @return MetadataBag - */ - public function getMetadataBag(); -} diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php deleted file mode 100644 index 3cbbfc5..0000000 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation; - -/** - * StreamedResponse represents a streamed HTTP response. - * - * A StreamedResponse uses a callback for its content. - * - * The callback should use the standard PHP functions like echo - * to stream the response back to the client. The flush() method - * can also be used if needed. - * - * @see flush() - * - * @author Fabien Potencier - */ -class StreamedResponse extends Response -{ - protected $callback; - protected $streamed; - private $headersSent; - - /** - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - */ - public function __construct(callable $callback = null, $status = 200, $headers = array()) - { - parent::__construct(null, $status, $headers); - - if (null !== $callback) { - $this->setCallback($callback); - } - $this->streamed = false; - $this->headersSent = false; - } - - /** - * Factory method for chainability. - * - * @param callable|null $callback A valid PHP callback or null to set it later - * @param int $status The response status code - * @param array $headers An array of response headers - * - * @return static - */ - public static function create($callback = null, $status = 200, $headers = array()) - { - return new static($callback, $status, $headers); - } - - /** - * Sets the PHP callback associated with this Response. - * - * @param callable $callback A valid PHP callback - */ - public function setCallback(callable $callback) - { - $this->callback = $callback; - } - - /** - * {@inheritdoc} - * - * This method only sends the headers once. - */ - public function sendHeaders() - { - if ($this->headersSent) { - return; - } - - $this->headersSent = true; - - parent::sendHeaders(); - } - - /** - * {@inheritdoc} - * - * This method only sends the content once. - */ - public function sendContent() - { - if ($this->streamed) { - return; - } - - $this->streamed = true; - - if (null === $this->callback) { - throw new \LogicException('The Response callback must not be null.'); - } - - call_user_func($this->callback); - } - - /** - * {@inheritdoc} - * - * @throws \LogicException when the content is not null - */ - public function setContent($content) - { - if (null !== $content) { - throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); - } - } - - /** - * {@inheritdoc} - * - * @return false - */ - public function getContent() - { - return false; - } -} diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php deleted file mode 100644 index cb43bb3..0000000 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\AcceptHeaderItem; - -class AcceptHeaderItemTest extends TestCase -{ - /** - * @dataProvider provideFromStringData - */ - public function testFromString($string, $value, array $attributes) - { - $item = AcceptHeaderItem::fromString($string); - $this->assertEquals($value, $item->getValue()); - $this->assertEquals($attributes, $item->getAttributes()); - } - - public function provideFromStringData() - { - return array( - array( - 'text/html', - 'text/html', array(), - ), - array( - '"this;should,not=matter"', - 'this;should,not=matter', array(), - ), - array( - "text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true", - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), - ), - array( - '"this;should,not=matter";charset=utf-8', - 'this;should,not=matter', array('charset' => 'utf-8'), - ), - ); - } - - /** - * @dataProvider provideToStringData - */ - public function testToString($value, array $attributes, $string) - { - $item = new AcceptHeaderItem($value, $attributes); - $this->assertEquals($string, (string) $item); - } - - public function provideToStringData() - { - return array( - array( - 'text/html', array(), - 'text/html', - ), - array( - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), - 'text/plain;charset=utf-8;param="this;should,not=matter";footnotes=true', - ), - ); - } - - public function testValue() - { - $item = new AcceptHeaderItem('value', array()); - $this->assertEquals('value', $item->getValue()); - - $item->setValue('new value'); - $this->assertEquals('new value', $item->getValue()); - - $item->setValue(1); - $this->assertEquals('1', $item->getValue()); - } - - public function testQuality() - { - $item = new AcceptHeaderItem('value', array()); - $this->assertEquals(1.0, $item->getQuality()); - - $item->setQuality(0.5); - $this->assertEquals(0.5, $item->getQuality()); - - $item->setAttribute('q', 0.75); - $this->assertEquals(0.75, $item->getQuality()); - $this->assertFalse($item->hasAttribute('q')); - } - - public function testAttribute() - { - $item = new AcceptHeaderItem('value', array()); - $this->assertEquals(array(), $item->getAttributes()); - $this->assertFalse($item->hasAttribute('test')); - $this->assertNull($item->getAttribute('test')); - $this->assertEquals('default', $item->getAttribute('test', 'default')); - - $item->setAttribute('test', 'value'); - $this->assertEquals(array('test' => 'value'), $item->getAttributes()); - $this->assertTrue($item->hasAttribute('test')); - $this->assertEquals('value', $item->getAttribute('test')); - $this->assertEquals('value', $item->getAttribute('test', 'default')); - } -} diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php deleted file mode 100644 index 9929eac..0000000 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\AcceptHeader; -use Symfony\Component\HttpFoundation\AcceptHeaderItem; - -class AcceptHeaderTest extends TestCase -{ - public function testFirst() - { - $header = AcceptHeader::fromString('text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c'); - $this->assertSame('text/html', $header->first()->getValue()); - } - - /** - * @dataProvider provideFromStringData - */ - public function testFromString($string, array $items) - { - $header = AcceptHeader::fromString($string); - $parsed = array_values($header->all()); - // reset index since the fixtures don't have them set - foreach ($parsed as $item) { - $item->setIndex(0); - } - $this->assertEquals($items, $parsed); - } - - public function provideFromStringData() - { - return array( - array('', array()), - array('gzip', array(new AcceptHeaderItem('gzip'))), - array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))), - ); - } - - /** - * @dataProvider provideToStringData - */ - public function testToString(array $items, $string) - { - $header = new AcceptHeader($items); - $this->assertEquals($string, (string) $header); - } - - public function provideToStringData() - { - return array( - array(array(), ''), - array(array(new AcceptHeaderItem('gzip')), 'gzip'), - array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'), - array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'), - ); - } - - /** - * @dataProvider provideFilterData - */ - public function testFilter($string, $filter, array $values) - { - $header = AcceptHeader::fromString($string)->filter($filter); - $this->assertEquals($values, array_keys($header->all())); - } - - public function provideFilterData() - { - return array( - array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')), - ); - } - - /** - * @dataProvider provideSortingData - */ - public function testSorting($string, array $values) - { - $header = AcceptHeader::fromString($string); - $this->assertEquals($values, array_keys($header->all())); - } - - public function provideSortingData() - { - return array( - 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')), - ); - } -} diff --git a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php deleted file mode 100644 index 157ab90..0000000 --- a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ApacheRequest; - -class ApacheRequestTest extends TestCase -{ - /** - * @dataProvider provideServerVars - */ - public function testUriMethods($server, $expectedRequestUri, $expectedBaseUrl, $expectedPathInfo) - { - $request = new ApacheRequest(); - $request->server->replace($server); - - $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); - $this->assertEquals($expectedBaseUrl, $request->getBaseUrl(), '->getBaseUrl() is correct'); - $this->assertEquals($expectedPathInfo, $request->getPathInfo(), '->getPathInfo() is correct'); - } - - public function provideServerVars() - { - return array( - array( - array( - 'REQUEST_URI' => '/foo/app_dev.php/bar', - 'SCRIPT_NAME' => '/foo/app_dev.php', - 'PATH_INFO' => '/bar', - ), - '/foo/app_dev.php/bar', - '/foo/app_dev.php', - '/bar', - ), - array( - array( - 'REQUEST_URI' => '/foo/bar', - 'SCRIPT_NAME' => '/foo/app_dev.php', - ), - '/foo/bar', - '/foo', - '/bar', - ), - array( - array( - 'REQUEST_URI' => '/app_dev.php/foo/bar', - 'SCRIPT_NAME' => '/app_dev.php', - 'PATH_INFO' => '/foo/bar', - ), - '/app_dev.php/foo/bar', - '/app_dev.php', - '/foo/bar', - ), - array( - array( - 'REQUEST_URI' => '/foo/bar', - 'SCRIPT_NAME' => '/app_dev.php', - ), - '/foo/bar', - '', - '/foo/bar', - ), - array( - array( - 'REQUEST_URI' => '/app_dev.php', - 'SCRIPT_NAME' => '/app_dev.php', - ), - '/app_dev.php', - '/app_dev.php', - '/', - ), - array( - array( - 'REQUEST_URI' => '/', - 'SCRIPT_NAME' => '/app_dev.php', - ), - '/', - '', - '/', - ), - ); - } -} diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php deleted file mode 100644 index 1b9e589..0000000 --- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php +++ /dev/null @@ -1,352 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use Symfony\Component\HttpFoundation\BinaryFileResponse; -use Symfony\Component\HttpFoundation\File\Stream; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; -use Symfony\Component\HttpFoundation\Tests\File\FakeFile; - -class BinaryFileResponseTest extends ResponseTestCase -{ - public function testConstruction() - { - $file = __DIR__.'/../README.md'; - $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true); - $this->assertEquals(404, $response->getStatusCode()); - $this->assertEquals('Foo', $response->headers->get('X-Header')); - $this->assertTrue($response->headers->has('ETag')); - $this->assertTrue($response->headers->has('Last-Modified')); - $this->assertFalse($response->headers->has('Content-Disposition')); - - $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE); - $this->assertEquals(404, $response->getStatusCode()); - $this->assertFalse($response->headers->has('ETag')); - $this->assertEquals('inline; filename="README.md"', $response->headers->get('Content-Disposition')); - } - - public function testConstructWithNonAsciiFilename() - { - touch(sys_get_temp_dir().'/fööö.html'); - - $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment'); - - @unlink(sys_get_temp_dir().'/fööö.html'); - - $this->assertSame('fööö.html', $response->getFile()->getFilename()); - } - - /** - * @expectedException \LogicException - */ - public function testSetContent() - { - $response = new BinaryFileResponse(__FILE__); - $response->setContent('foo'); - } - - public function testGetContent() - { - $response = new BinaryFileResponse(__FILE__); - $this->assertFalse($response->getContent()); - } - - public function testSetContentDispositionGeneratesSafeFallbackFilename() - { - $response = new BinaryFileResponse(__FILE__); - $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'föö.html'); - - $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition')); - } - - public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename() - { - $response = new BinaryFileResponse(__FILE__); - - $iso88591EncodedFilename = utf8_decode('föö.html'); - $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename); - - // the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one) - $this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition')); - } - - /** - * @dataProvider provideRanges - */ - public function testRequests($requestRange, $offset, $length, $responseRange) - { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); - - // do a request to get the ETag - $request = Request::create('/'); - $response->prepare($request); - $etag = $response->headers->get('ETag'); - - // prepare a request for a range of the testing file - $request = Request::create('/'); - $request->headers->set('If-Range', $etag); - $request->headers->set('Range', $requestRange); - - $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r'); - fseek($file, $offset); - $data = fread($file, $length); - fclose($file); - - $this->expectOutputString($data); - $response = clone $response; - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(206, $response->getStatusCode()); - $this->assertEquals($responseRange, $response->headers->get('Content-Range')); - $this->assertSame($length, $response->headers->get('Content-Length')); - } - - /** - * @dataProvider provideRanges - */ - public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange) - { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); - - // do a request to get the LastModified - $request = Request::create('/'); - $response->prepare($request); - $lastModified = $response->headers->get('Last-Modified'); - - // prepare a request for a range of the testing file - $request = Request::create('/'); - $request->headers->set('If-Range', $lastModified); - $request->headers->set('Range', $requestRange); - - $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r'); - fseek($file, $offset); - $data = fread($file, $length); - fclose($file); - - $this->expectOutputString($data); - $response = clone $response; - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(206, $response->getStatusCode()); - $this->assertEquals($responseRange, $response->headers->get('Content-Range')); - } - - public function provideRanges() - { - return array( - array('bytes=1-4', 1, 4, 'bytes 1-4/35'), - array('bytes=-5', 30, 5, 'bytes 30-34/35'), - array('bytes=30-', 30, 5, 'bytes 30-34/35'), - array('bytes=30-30', 30, 1, 'bytes 30-30/35'), - array('bytes=30-34', 30, 5, 'bytes 30-34/35'), - ); - } - - public function testRangeRequestsWithoutLastModifiedDate() - { - // prevent auto last modified - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false); - - // prepare a request for a range of the testing file - $request = Request::create('/'); - $request->headers->set('If-Range', date('D, d M Y H:i:s').' GMT'); - $request->headers->set('Range', 'bytes=1-4'); - - $this->expectOutputString(file_get_contents(__DIR__.'/File/Fixtures/test.gif')); - $response = clone $response; - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(200, $response->getStatusCode()); - $this->assertNull($response->headers->get('Content-Range')); - } - - /** - * @dataProvider provideFullFileRanges - */ - public function testFullFileRequests($requestRange) - { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); - - // prepare a request for a range of the testing file - $request = Request::create('/'); - $request->headers->set('Range', $requestRange); - - $file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r'); - $data = fread($file, 35); - fclose($file); - - $this->expectOutputString($data); - $response = clone $response; - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(200, $response->getStatusCode()); - } - - public function provideFullFileRanges() - { - return array( - array('bytes=0-'), - array('bytes=0-34'), - array('bytes=-35'), - // Syntactical invalid range-request should also return the full resource - array('bytes=20-10'), - array('bytes=50-40'), - ); - } - - /** - * @dataProvider provideInvalidRanges - */ - public function testInvalidRequests($requestRange) - { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); - - // prepare a request for a range of the testing file - $request = Request::create('/'); - $request->headers->set('Range', $requestRange); - - $response = clone $response; - $response->prepare($request); - $response->sendContent(); - - $this->assertEquals(416, $response->getStatusCode()); - $this->assertEquals('bytes */35', $response->headers->get('Content-Range')); - } - - public function provideInvalidRanges() - { - return array( - array('bytes=-40'), - array('bytes=30-40'), - ); - } - - /** - * @dataProvider provideXSendfileFiles - */ - public function testXSendfile($file) - { - $request = Request::create('/'); - $request->headers->set('X-Sendfile-Type', 'X-Sendfile'); - - BinaryFileResponse::trustXSendfileTypeHeader(); - $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream')); - $response->prepare($request); - - $this->expectOutputString(''); - $response->sendContent(); - - $this->assertContains('README.md', $response->headers->get('X-Sendfile')); - } - - public function provideXSendfileFiles() - { - return array( - array(__DIR__.'/../README.md'), - array('file://'.__DIR__.'/../README.md'), - ); - } - - /** - * @dataProvider getSampleXAccelMappings - */ - public function testXAccelMapping($realpath, $mapping, $virtual) - { - $request = Request::create('/'); - $request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect'); - $request->headers->set('X-Accel-Mapping', $mapping); - - $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test'); - - BinaryFileResponse::trustXSendfileTypeHeader(); - $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream')); - $reflection = new \ReflectionObject($response); - $property = $reflection->getProperty('file'); - $property->setAccessible(true); - $property->setValue($response, $file); - - $response->prepare($request); - $this->assertEquals($virtual, $response->headers->get('X-Accel-Redirect')); - } - - public function testDeleteFileAfterSend() - { - $request = Request::create('/'); - - $path = __DIR__.'/File/Fixtures/to_delete'; - touch($path); - $realPath = realpath($path); - $this->assertFileExists($realPath); - - $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream')); - $response->deleteFileAfterSend(true); - - $response->prepare($request); - $response->sendContent(); - - $this->assertFileNotExists($path); - } - - public function testAcceptRangeOnUnsafeMethods() - { - $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); - $response->prepare($request); - - $this->assertEquals('none', $response->headers->get('Accept-Ranges')); - } - - public function testAcceptRangeNotOverriden() - { - $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); - $response->headers->set('Accept-Ranges', 'foo'); - $response->prepare($request); - - $this->assertEquals('foo', $response->headers->get('Accept-Ranges')); - } - - public function getSampleXAccelMappings() - { - return array( - array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'), - array('/home/foo/bar.txt', '/var/www/=/files/,/home/foo/=/baz/', '/baz/bar.txt'), - ); - } - - public function testStream() - { - $request = Request::create('/'); - $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain')); - $response->prepare($request); - - $this->assertNull($response->headers->get('Content-Length')); - } - - protected function provideResponse() - { - return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream')); - } - - public static function tearDownAfterClass() - { - $path = __DIR__.'/../Fixtures/to_delete'; - if (file_exists($path)) { - @unlink($path); - } - } -} diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php deleted file mode 100644 index 070b7dd..0000000 --- a/vendor/symfony/http-foundation/Tests/CookieTest.php +++ /dev/null @@ -1,223 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Cookie; - -/** - * CookieTest. - * - * @author John Kary - * @author Hugo Hamon - * - * @group time-sensitive - */ -class CookieTest extends TestCase -{ - public function invalidNames() - { - return array( - array(''), - array(',MyName'), - array(';MyName'), - array(' MyName'), - array("\tMyName"), - array("\rMyName"), - array("\nMyName"), - array("\013MyName"), - array("\014MyName"), - ); - } - - /** - * @dataProvider invalidNames - * @expectedException \InvalidArgumentException - */ - public function testInstantiationThrowsExceptionIfCookieNameContainsInvalidCharacters($name) - { - new Cookie($name); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testInvalidExpiration() - { - new Cookie('MyCookie', 'foo', 'bar'); - } - - public function testNegativeExpirationIsNotPossible() - { - $cookie = new Cookie('foo', 'bar', -100); - - $this->assertSame(0, $cookie->getExpiresTime()); - } - - public function testGetValue() - { - $value = 'MyValue'; - $cookie = new Cookie('MyCookie', $value); - - $this->assertSame($value, $cookie->getValue(), '->getValue() returns the proper value'); - } - - public function testGetPath() - { - $cookie = new Cookie('foo', 'bar'); - - $this->assertSame('/', $cookie->getPath(), '->getPath() returns / as the default path'); - } - - public function testGetExpiresTime() - { - $cookie = new Cookie('foo', 'bar'); - - $this->assertEquals(0, $cookie->getExpiresTime(), '->getExpiresTime() returns the default expire date'); - - $cookie = new Cookie('foo', 'bar', $expire = time() + 3600); - - $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date'); - } - - public function testGetExpiresTimeIsCastToInt() - { - $cookie = new Cookie('foo', 'bar', 3600.9); - - $this->assertSame(3600, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date as an integer'); - } - - public function testConstructorWithDateTime() - { - $expire = new \DateTime(); - $cookie = new Cookie('foo', 'bar', $expire); - - $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date'); - } - - /** - * @requires PHP 5.5 - */ - public function testConstructorWithDateTimeImmutable() - { - $expire = new \DateTimeImmutable(); - $cookie = new Cookie('foo', 'bar', $expire); - - $this->assertEquals($expire->format('U'), $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date'); - } - - public function testGetExpiresTimeWithStringValue() - { - $value = '+1 day'; - $cookie = new Cookie('foo', 'bar', $value); - $expire = strtotime($value); - - $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1); - } - - public function testGetDomain() - { - $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com'); - - $this->assertEquals('.myfoodomain.com', $cookie->getDomain(), '->getDomain() returns the domain name on which the cookie is valid'); - } - - public function testIsSecure() - { - $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', true); - - $this->assertTrue($cookie->isSecure(), '->isSecure() returns whether the cookie is transmitted over HTTPS'); - } - - public function testIsHttpOnly() - { - $cookie = new Cookie('foo', 'bar', 0, '/', '.myfoodomain.com', false, true); - - $this->assertTrue($cookie->isHttpOnly(), '->isHttpOnly() returns whether the cookie is only transmitted over HTTP'); - } - - public function testCookieIsNotCleared() - { - $cookie = new Cookie('foo', 'bar', time() + 3600 * 24); - - $this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet'); - } - - public function testCookieIsCleared() - { - $cookie = new Cookie('foo', 'bar', time() - 20); - - $this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired'); - } - - public function testToString() - { - $cookie = new Cookie('foo', 'bar', $expire = strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true); - $this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() returns string representation of the cookie'); - - $cookie = new Cookie('foo', 'bar with white spaces', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true); - $this->assertEquals('foo=bar%20with%20white%20spaces; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)'); - - $cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com'); - $this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', $expire = time() - 31536001).'; max-age='.($expire - time()).'; path=/admin/; domain=.myfoodomain.com; httponly', (string) $cookie, '->__toString() returns string representation of a cleared cookie if value is NULL'); - - $cookie = new Cookie('foo', 'bar', 0, '/', ''); - $this->assertEquals('foo=bar; path=/; httponly', (string) $cookie); - } - - public function testRawCookie() - { - $cookie = new Cookie('foo', 'b a r', 0, '/', null, false, false); - $this->assertFalse($cookie->isRaw()); - $this->assertEquals('foo=b%20a%20r; path=/', (string) $cookie); - - $cookie = new Cookie('foo', 'b+a+r', 0, '/', null, false, false, true); - $this->assertTrue($cookie->isRaw()); - $this->assertEquals('foo=b+a+r; path=/', (string) $cookie); - } - - public function testGetMaxAge() - { - $cookie = new Cookie('foo', 'bar'); - $this->assertEquals(0, $cookie->getMaxAge()); - - $cookie = new Cookie('foo', 'bar', $expire = time() + 100); - $this->assertEquals($expire - time(), $cookie->getMaxAge()); - - $cookie = new Cookie('foo', 'bar', $expire = time() - 100); - $this->assertEquals($expire - time(), $cookie->getMaxAge()); - } - - public function testFromString() - { - $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly'); - $this->assertEquals(new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true, true, true), $cookie); - - $cookie = Cookie::fromString('foo=bar', true); - $this->assertEquals(new Cookie('foo', 'bar', 0, '/', null, false, false), $cookie); - } - - public function testFromStringWithHttpOnly() - { - $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly'); - $this->assertTrue($cookie->isHttpOnly()); - - $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure'); - $this->assertFalse($cookie->isHttpOnly()); - } - - public function testSameSiteAttributeIsCaseInsensitive() - { - $cookie = new Cookie('foo', 'bar', 0, '/', null, false, true, false, 'Lax'); - $this->assertEquals('lax', $cookie->getSameSite()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php deleted file mode 100644 index 1152e46..0000000 --- a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\HttpFoundation\ExpressionRequestMatcher; -use Symfony\Component\HttpFoundation\Request; - -class ExpressionRequestMatcherTest extends TestCase -{ - /** - * @expectedException \LogicException - */ - public function testWhenNoExpressionIsSet() - { - $expressionRequestMatcher = new ExpressionRequestMatcher(); - $expressionRequestMatcher->matches(new Request()); - } - - /** - * @dataProvider provideExpressions - */ - public function testMatchesWhenParentMatchesIsTrue($expression, $expected) - { - $request = Request::create('/foo'); - $expressionRequestMatcher = new ExpressionRequestMatcher(); - - $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression); - $this->assertSame($expected, $expressionRequestMatcher->matches($request)); - } - - /** - * @dataProvider provideExpressions - */ - public function testMatchesWhenParentMatchesIsFalse($expression) - { - $request = Request::create('/foo'); - $request->attributes->set('foo', 'foo'); - $expressionRequestMatcher = new ExpressionRequestMatcher(); - $expressionRequestMatcher->matchAttribute('foo', 'bar'); - - $expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression); - $this->assertFalse($expressionRequestMatcher->matches($request)); - } - - public function provideExpressions() - { - return array( - array('request.getMethod() == method', true), - array('request.getPathInfo() == path', true), - array('request.getHost() == host', true), - array('request.getClientIp() == ip', true), - array('request.attributes.all() == attributes', true), - array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true), - array('request.getMethod() != method', false), - array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false), - ); - } -} diff --git a/vendor/symfony/http-foundation/Tests/File/FakeFile.php b/vendor/symfony/http-foundation/Tests/File/FakeFile.php deleted file mode 100644 index c415989..0000000 --- a/vendor/symfony/http-foundation/Tests/File/FakeFile.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\File; - -use Symfony\Component\HttpFoundation\File\File as OrigFile; - -class FakeFile extends OrigFile -{ - private $realpath; - - public function __construct($realpath, $path) - { - $this->realpath = $realpath; - parent::__construct($path, false); - } - - public function isReadable() - { - return true; - } - - public function getRealpath() - { - return $this->realpath; - } - - public function getSize() - { - return 42; - } - - public function getMTime() - { - return time(); - } -} diff --git a/vendor/symfony/http-foundation/Tests/File/FileTest.php b/vendor/symfony/http-foundation/Tests/File/FileTest.php deleted file mode 100644 index dbd9c44..0000000 --- a/vendor/symfony/http-foundation/Tests/File/FileTest.php +++ /dev/null @@ -1,180 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\File; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\File\File; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; - -class FileTest extends TestCase -{ - protected $file; - - public function testGetMimeTypeUsesMimeTypeGuessers() - { - $file = new File(__DIR__.'/Fixtures/test.gif'); - $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif'); - - MimeTypeGuesser::getInstance()->register($guesser); - - $this->assertEquals('image/gif', $file->getMimeType()); - } - - public function testGuessExtensionWithoutGuesser() - { - $file = new File(__DIR__.'/Fixtures/directory/.empty'); - - $this->assertNull($file->guessExtension()); - } - - public function testGuessExtensionIsBasedOnMimeType() - { - $file = new File(__DIR__.'/Fixtures/test'); - $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif'); - - MimeTypeGuesser::getInstance()->register($guesser); - - $this->assertEquals('gif', $file->guessExtension()); - } - - /** - * @requires extension fileinfo - */ - public function testGuessExtensionWithReset() - { - $file = new File(__DIR__.'/Fixtures/other-file.example'); - $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif'); - MimeTypeGuesser::getInstance()->register($guesser); - - $this->assertEquals('gif', $file->guessExtension()); - - MimeTypeGuesser::reset(); - - $this->assertNull($file->guessExtension()); - } - - public function testConstructWhenFileNotExists() - { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); - - new File(__DIR__.'/Fixtures/not_here'); - } - - public function testMove() - { - $path = __DIR__.'/Fixtures/test.copy.gif'; - $targetDir = __DIR__.'/Fixtures/directory'; - $targetPath = $targetDir.'/test.copy.gif'; - @unlink($path); - @unlink($targetPath); - copy(__DIR__.'/Fixtures/test.gif', $path); - - $file = new File($path); - $movedFile = $file->move($targetDir); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile); - - $this->assertFileExists($targetPath); - $this->assertFileNotExists($path); - $this->assertEquals(realpath($targetPath), $movedFile->getRealPath()); - - @unlink($targetPath); - } - - public function testMoveWithNewName() - { - $path = __DIR__.'/Fixtures/test.copy.gif'; - $targetDir = __DIR__.'/Fixtures/directory'; - $targetPath = $targetDir.'/test.newname.gif'; - @unlink($path); - @unlink($targetPath); - copy(__DIR__.'/Fixtures/test.gif', $path); - - $file = new File($path); - $movedFile = $file->move($targetDir, 'test.newname.gif'); - - $this->assertFileExists($targetPath); - $this->assertFileNotExists($path); - $this->assertEquals(realpath($targetPath), $movedFile->getRealPath()); - - @unlink($targetPath); - } - - public function getFilenameFixtures() - { - return array( - array('original.gif', 'original.gif'), - array('..\\..\\original.gif', 'original.gif'), - array('../../original.gif', 'original.gif'), - array('файлfile.gif', 'файлfile.gif'), - array('..\\..\\файлfile.gif', 'файлfile.gif'), - array('../../файлfile.gif', 'файлfile.gif'), - ); - } - - /** - * @dataProvider getFilenameFixtures - */ - public function testMoveWithNonLatinName($filename, $sanitizedFilename) - { - $path = __DIR__.'/Fixtures/'.$sanitizedFilename; - $targetDir = __DIR__.'/Fixtures/directory/'; - $targetPath = $targetDir.$sanitizedFilename; - @unlink($path); - @unlink($targetPath); - copy(__DIR__.'/Fixtures/test.gif', $path); - - $file = new File($path); - $movedFile = $file->move($targetDir, $filename); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\File\File', $movedFile); - - $this->assertFileExists($targetPath); - $this->assertFileNotExists($path); - $this->assertEquals(realpath($targetPath), $movedFile->getRealPath()); - - @unlink($targetPath); - } - - public function testMoveToAnUnexistentDirectory() - { - $sourcePath = __DIR__.'/Fixtures/test.copy.gif'; - $targetDir = __DIR__.'/Fixtures/directory/sub'; - $targetPath = $targetDir.'/test.copy.gif'; - @unlink($sourcePath); - @unlink($targetPath); - @rmdir($targetDir); - copy(__DIR__.'/Fixtures/test.gif', $sourcePath); - - $file = new File($sourcePath); - $movedFile = $file->move($targetDir); - - $this->assertFileExists($targetPath); - $this->assertFileNotExists($sourcePath); - $this->assertEquals(realpath($targetPath), $movedFile->getRealPath()); - - @unlink($sourcePath); - @unlink($targetPath); - @rmdir($targetDir); - } - - protected function createMockGuesser($path, $mimeType) - { - $guesser = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface')->getMock(); - $guesser - ->expects($this->once()) - ->method('guess') - ->with($this->equalTo($path)) - ->will($this->returnValue($mimeType)) - ; - - return $guesser; - } -} diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension b/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension deleted file mode 100644 index 4d1ae35..0000000 --- a/vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension +++ /dev/null @@ -1 +0,0 @@ -f \ No newline at end of file diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty b/vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example b/vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/test b/vendor/symfony/http-foundation/Tests/File/Fixtures/test deleted file mode 100644 index b636f4b8df536b0a85e7cea1a6cf3f0bd3179b96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35 jcmZ?wbh9u|WMp7uXkcLY4+c66KmZb9U}AD%WUvMRyAlZ1 diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif b/vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif deleted file mode 100644 index b636f4b8df536b0a85e7cea1a6cf3f0bd3179b96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35 jcmZ?wbh9u|WMp7uXkcLY4+c66KmZb9U}AD%WUvMRyAlZ1 diff --git a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php deleted file mode 100644 index b3f1f02..0000000 --- a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\File\MimeType; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; -use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser; - -/** - * @requires extension fileinfo - */ -class MimeTypeTest extends TestCase -{ - protected $path; - - public function testGuessImageWithoutExtension() - { - $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test')); - } - - public function testGuessImageWithDirectory() - { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); - - MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory'); - } - - public function testGuessImageWithFileBinaryMimeTypeGuesser() - { - $guesser = MimeTypeGuesser::getInstance(); - $guesser->register(new FileBinaryMimeTypeGuesser()); - $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test')); - } - - public function testGuessImageWithKnownExtension() - { - $this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test.gif')); - } - - public function testGuessFileWithUnknownExtension() - { - $this->assertEquals('application/octet-stream', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/.unknownextension')); - } - - public function testGuessWithIncorrectPath() - { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); - MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here'); - } - - public function testGuessWithNonReadablePath() - { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Can not verify chmod operations on Windows'); - } - - if (!getenv('USER') || 'root' === getenv('USER')) { - $this->markTestSkipped('This test will fail if run under superuser'); - } - - $path = __DIR__.'/../Fixtures/to_delete'; - touch($path); - @chmod($path, 0333); - - if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException'); - MimeTypeGuesser::getInstance()->guess($path); - } else { - $this->markTestSkipped('Can not verify chmod operations, change of file permissions failed'); - } - } - - public static function tearDownAfterClass() - { - $path = __DIR__.'/../Fixtures/to_delete'; - if (file_exists($path)) { - @chmod($path, 0666); - @unlink($path); - } - } -} diff --git a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php deleted file mode 100644 index 36f122f..0000000 --- a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php +++ /dev/null @@ -1,273 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\File; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\File\UploadedFile; - -class UploadedFileTest extends TestCase -{ - protected function setUp() - { - if (!ini_get('file_uploads')) { - $this->markTestSkipped('file_uploads is disabled in php.ini'); - } - } - - public function testConstructWhenFileNotExists() - { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); - - new UploadedFile( - __DIR__.'/Fixtures/not_here', - 'original.gif', - null - ); - } - - public function testFileUploadsWithNoMimeType() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - null, - filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK - ); - - $this->assertEquals('application/octet-stream', $file->getClientMimeType()); - - if (extension_loaded('fileinfo')) { - $this->assertEquals('image/gif', $file->getMimeType()); - } - } - - public function testFileUploadsWithUnknownMimeType() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/.unknownextension', - 'original.gif', - null, - filesize(__DIR__.'/Fixtures/.unknownextension'), - UPLOAD_ERR_OK - ); - - $this->assertEquals('application/octet-stream', $file->getClientMimeType()); - } - - public function testGuessClientExtension() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals('gif', $file->guessClientExtension()); - } - - public function testGuessClientExtensionWithIncorrectMimeType() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/jpeg', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals('jpeg', $file->guessClientExtension()); - } - - public function testErrorIsOkByDefault() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals(UPLOAD_ERR_OK, $file->getError()); - } - - public function testGetClientOriginalName() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals('original.gif', $file->getClientOriginalName()); - } - - public function testGetClientOriginalExtension() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals('gif', $file->getClientOriginalExtension()); - } - - /** - * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileException - */ - public function testMoveLocalFileIsNotAllowed() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK - ); - - $movedFile = $file->move(__DIR__.'/Fixtures/directory'); - } - - public function testMoveLocalFileIsAllowedInTestMode() - { - $path = __DIR__.'/Fixtures/test.copy.gif'; - $targetDir = __DIR__.'/Fixtures/directory'; - $targetPath = $targetDir.'/test.copy.gif'; - @unlink($path); - @unlink($targetPath); - copy(__DIR__.'/Fixtures/test.gif', $path); - - $file = new UploadedFile( - $path, - 'original.gif', - 'image/gif', - filesize($path), - UPLOAD_ERR_OK, - true - ); - - $movedFile = $file->move(__DIR__.'/Fixtures/directory'); - - $this->assertFileExists($targetPath); - $this->assertFileNotExists($path); - $this->assertEquals(realpath($targetPath), $movedFile->getRealPath()); - - @unlink($targetPath); - } - - public function testGetClientOriginalNameSanitizeFilename() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - '../../original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals('original.gif', $file->getClientOriginalName()); - } - - public function testGetSize() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - 'image/gif', - filesize(__DIR__.'/Fixtures/test.gif'), - null - ); - - $this->assertEquals(filesize(__DIR__.'/Fixtures/test.gif'), $file->getSize()); - - $file = new UploadedFile( - __DIR__.'/Fixtures/test', - 'original.gif', - 'image/gif' - ); - - $this->assertEquals(filesize(__DIR__.'/Fixtures/test'), $file->getSize()); - } - - public function testGetExtension() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - null - ); - - $this->assertEquals('gif', $file->getExtension()); - } - - public function testIsValid() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - null, - filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK, - true - ); - - $this->assertTrue($file->isValid()); - } - - /** - * @dataProvider uploadedFileErrorProvider - */ - public function testIsInvalidOnUploadError($error) - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - null, - filesize(__DIR__.'/Fixtures/test.gif'), - $error - ); - - $this->assertFalse($file->isValid()); - } - - public function uploadedFileErrorProvider() - { - return array( - array(UPLOAD_ERR_INI_SIZE), - array(UPLOAD_ERR_FORM_SIZE), - array(UPLOAD_ERR_PARTIAL), - array(UPLOAD_ERR_NO_TMP_DIR), - array(UPLOAD_ERR_EXTENSION), - ); - } - - public function testIsInvalidIfNotHttpUpload() - { - $file = new UploadedFile( - __DIR__.'/Fixtures/test.gif', - 'original.gif', - null, - filesize(__DIR__.'/Fixtures/test.gif'), - UPLOAD_ERR_OK - ); - - $this->assertFalse($file->isValid()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php deleted file mode 100644 index 7d2902d..0000000 --- a/vendor/symfony/http-foundation/Tests/FileBagTest.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\FileBag; - -/** - * FileBagTest. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - */ -class FileBagTest extends TestCase -{ - /** - * @expectedException \InvalidArgumentException - */ - public function testFileMustBeAnArrayOrUploadedFile() - { - new FileBag(array('file' => 'foo')); - } - - public function testShouldConvertsUploadedFiles() - { - $tmpFile = $this->createTempFile(); - $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - - $bag = new FileBag(array('file' => array( - 'name' => basename($tmpFile), - 'type' => 'text/plain', - 'tmp_name' => $tmpFile, - 'error' => 0, - 'size' => 100, - ))); - - $this->assertEquals($file, $bag->get('file')); - } - - public function testShouldSetEmptyUploadedFilesToNull() - { - $bag = new FileBag(array('file' => array( - 'name' => '', - 'type' => '', - 'tmp_name' => '', - 'error' => UPLOAD_ERR_NO_FILE, - 'size' => 0, - ))); - - $this->assertNull($bag->get('file')); - } - - public function testShouldRemoveEmptyUploadedFilesForMultiUpload() - { - $bag = new FileBag(array('file' => array( - 'name' => array(''), - 'type' => array(''), - 'tmp_name' => array(''), - 'error' => array(UPLOAD_ERR_NO_FILE), - 'size' => array(0), - ))); - - $this->assertSame(array(), $bag->get('file')); - } - - public function testShouldConvertUploadedFilesWithPhpBug() - { - $tmpFile = $this->createTempFile(); - $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - - $bag = new FileBag(array( - 'child' => array( - 'name' => array( - 'file' => basename($tmpFile), - ), - 'type' => array( - 'file' => 'text/plain', - ), - 'tmp_name' => array( - 'file' => $tmpFile, - ), - 'error' => array( - 'file' => 0, - ), - 'size' => array( - 'file' => 100, - ), - ), - )); - - $files = $bag->all(); - $this->assertEquals($file, $files['child']['file']); - } - - public function testShouldConvertNestedUploadedFilesWithPhpBug() - { - $tmpFile = $this->createTempFile(); - $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - - $bag = new FileBag(array( - 'child' => array( - 'name' => array( - 'sub' => array('file' => basename($tmpFile)), - ), - 'type' => array( - 'sub' => array('file' => 'text/plain'), - ), - 'tmp_name' => array( - 'sub' => array('file' => $tmpFile), - ), - 'error' => array( - 'sub' => array('file' => 0), - ), - 'size' => array( - 'sub' => array('file' => 100), - ), - ), - )); - - $files = $bag->all(); - $this->assertEquals($file, $files['child']['sub']['file']); - } - - public function testShouldNotConvertNestedUploadedFiles() - { - $tmpFile = $this->createTempFile(); - $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0); - $bag = new FileBag(array('image' => array('file' => $file))); - - $files = $bag->all(); - $this->assertEquals($file, $files['image']['file']); - } - - protected function createTempFile() - { - return tempnam(sys_get_temp_dir().'/form_test', 'FormTest'); - } - - protected function setUp() - { - mkdir(sys_get_temp_dir().'/form_test', 0777, true); - } - - protected function tearDown() - { - foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) { - unlink($file); - } - - rmdir(sys_get_temp_dir().'/form_test'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php deleted file mode 100644 index 1acf593..0000000 --- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php +++ /dev/null @@ -1,205 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\HeaderBag; - -class HeaderBagTest extends TestCase -{ - public function testConstructor() - { - $bag = new HeaderBag(array('foo' => 'bar')); - $this->assertTrue($bag->has('foo')); - } - - public function testToStringNull() - { - $bag = new HeaderBag(); - $this->assertEquals('', $bag->__toString()); - } - - public function testToStringNotNull() - { - $bag = new HeaderBag(array('foo' => 'bar')); - $this->assertEquals("Foo: bar\r\n", $bag->__toString()); - } - - public function testKeys() - { - $bag = new HeaderBag(array('foo' => 'bar')); - $keys = $bag->keys(); - $this->assertEquals('foo', $keys[0]); - } - - public function testGetDate() - { - $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200')); - $headerDate = $bag->getDate('foo'); - $this->assertInstanceOf('DateTime', $headerDate); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetDateException() - { - $bag = new HeaderBag(array('foo' => 'Tue')); - $headerDate = $bag->getDate('foo'); - } - - public function testGetCacheControlHeader() - { - $bag = new HeaderBag(); - $bag->addCacheControlDirective('public', '#a'); - $this->assertTrue($bag->hasCacheControlDirective('public')); - $this->assertEquals('#a', $bag->getCacheControlDirective('public')); - } - - public function testAll() - { - $bag = new HeaderBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input'); - - $bag = new HeaderBag(array('FOO' => 'BAR')); - $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case'); - } - - public function testReplace() - { - $bag = new HeaderBag(array('foo' => 'bar')); - - $bag->replace(array('NOPE' => 'BAR')); - $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument'); - $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); - } - - public function testGet() - { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); - $this->assertEquals('bar', $bag->get('foo'), '->get return current value'); - $this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive'); - $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array'); - - // defaults - $this->assertNull($bag->get('none'), '->get unknown values returns null'); - $this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default'); - $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array'); - - $bag->set('foo', 'bor', false); - $this->assertEquals('bar', $bag->get('foo'), '->get return first value'); - $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array'); - } - - public function testSetAssociativeArray() - { - $bag = new HeaderBag(); - $bag->set('foo', array('bad-assoc-index' => 'value')); - $this->assertSame('value', $bag->get('foo')); - $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); - } - - public function testContains() - { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); - $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value'); - $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value'); - $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value'); - $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value'); - - // Multiple values - $bag->set('foo', 'bor', false); - $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value'); - $this->assertTrue($bag->contains('foo', 'bor'), '->contains second value'); - $this->assertFalse($bag->contains('foo', 'nope'), '->contains unknown value'); - } - - public function testCacheControlDirectiveAccessors() - { - $bag = new HeaderBag(); - $bag->addCacheControlDirective('public'); - - $this->assertTrue($bag->hasCacheControlDirective('public')); - $this->assertTrue($bag->getCacheControlDirective('public')); - $this->assertEquals('public', $bag->get('cache-control')); - - $bag->addCacheControlDirective('max-age', 10); - $this->assertTrue($bag->hasCacheControlDirective('max-age')); - $this->assertEquals(10, $bag->getCacheControlDirective('max-age')); - $this->assertEquals('max-age=10, public', $bag->get('cache-control')); - - $bag->removeCacheControlDirective('max-age'); - $this->assertFalse($bag->hasCacheControlDirective('max-age')); - } - - public function testCacheControlDirectiveParsing() - { - $bag = new HeaderBag(array('cache-control' => 'public, max-age=10')); - $this->assertTrue($bag->hasCacheControlDirective('public')); - $this->assertTrue($bag->getCacheControlDirective('public')); - - $this->assertTrue($bag->hasCacheControlDirective('max-age')); - $this->assertEquals(10, $bag->getCacheControlDirective('max-age')); - - $bag->addCacheControlDirective('s-maxage', 100); - $this->assertEquals('max-age=10, public, s-maxage=100', $bag->get('cache-control')); - } - - public function testCacheControlDirectiveParsingQuotedZero() - { - $bag = new HeaderBag(array('cache-control' => 'max-age="0"')); - $this->assertTrue($bag->hasCacheControlDirective('max-age')); - $this->assertEquals(0, $bag->getCacheControlDirective('max-age')); - } - - public function testCacheControlDirectiveOverrideWithReplace() - { - $bag = new HeaderBag(array('cache-control' => 'private, max-age=100')); - $bag->replace(array('cache-control' => 'public, max-age=10')); - $this->assertTrue($bag->hasCacheControlDirective('public')); - $this->assertTrue($bag->getCacheControlDirective('public')); - - $this->assertTrue($bag->hasCacheControlDirective('max-age')); - $this->assertEquals(10, $bag->getCacheControlDirective('max-age')); - } - - public function testCacheControlClone() - { - $headers = array('foo' => 'bar'); - $bag1 = new HeaderBag($headers); - $bag2 = new HeaderBag($bag1->all()); - - $this->assertEquals($bag1->all(), $bag2->all()); - } - - public function testGetIterator() - { - $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm'); - $headerBag = new HeaderBag($headers); - - $i = 0; - foreach ($headerBag as $key => $val) { - ++$i; - $this->assertEquals(array($headers[$key]), $val); - } - - $this->assertEquals(count($headers), $i); - } - - public function testCount() - { - $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); - $headerBag = new HeaderBag($headers); - - $this->assertEquals(count($headers), count($headerBag)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php deleted file mode 100644 index 297ee3d..0000000 --- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\IpUtils; - -class IpUtilsTest extends TestCase -{ - /** - * @dataProvider getIpv4Data - */ - public function testIpv4($matches, $remoteAddr, $cidr) - { - $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr)); - } - - public function getIpv4Data() - { - return array( - array(true, '192.168.1.1', '192.168.1.1'), - array(true, '192.168.1.1', '192.168.1.1/1'), - array(true, '192.168.1.1', '192.168.1.0/24'), - array(false, '192.168.1.1', '1.2.3.4/1'), - array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet - array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')), - array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')), - array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')), - array(true, '1.2.3.4', '0.0.0.0/0'), - array(true, '1.2.3.4', '192.168.1.0/0'), - array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation - array(false, 'an_invalid_ip', '192.168.1.0/24'), - ); - } - - /** - * @dataProvider getIpv6Data - */ - public function testIpv6($matches, $remoteAddr, $cidr) - { - if (!defined('AF_INET6')) { - $this->markTestSkipped('Only works when PHP is compiled without the option "disable-ipv6".'); - } - - $this->assertSame($matches, IpUtils::checkIp($remoteAddr, $cidr)); - } - - public function getIpv6Data() - { - return array( - array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), - array(true, '0:0:0:0:0:0:0:1', '::1'), - array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')), - array(false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'), - ); - } - - /** - * @expectedException \RuntimeException - * @requires extension sockets - */ - public function testAnIpv6WithOptionDisabledIpv6() - { - if (defined('AF_INET6')) { - $this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".'); - } - - IpUtils::checkIp('2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php deleted file mode 100644 index 201839f..0000000 --- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php +++ /dev/null @@ -1,257 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\JsonResponse; - -class JsonResponseTest extends TestCase -{ - public function testConstructorEmptyCreatesJsonObject() - { - $response = new JsonResponse(); - $this->assertSame('{}', $response->getContent()); - } - - public function testConstructorWithArrayCreatesJsonArray() - { - $response = new JsonResponse(array(0, 1, 2, 3)); - $this->assertSame('[0,1,2,3]', $response->getContent()); - } - - public function testConstructorWithAssocArrayCreatesJsonObject() - { - $response = new JsonResponse(array('foo' => 'bar')); - $this->assertSame('{"foo":"bar"}', $response->getContent()); - } - - public function testConstructorWithSimpleTypes() - { - $response = new JsonResponse('foo'); - $this->assertSame('"foo"', $response->getContent()); - - $response = new JsonResponse(0); - $this->assertSame('0', $response->getContent()); - - $response = new JsonResponse(0.1); - $this->assertSame('0.1', $response->getContent()); - - $response = new JsonResponse(true); - $this->assertSame('true', $response->getContent()); - } - - public function testConstructorWithCustomStatus() - { - $response = new JsonResponse(array(), 202); - $this->assertSame(202, $response->getStatusCode()); - } - - public function testConstructorAddsContentTypeHeader() - { - $response = new JsonResponse(); - $this->assertSame('application/json', $response->headers->get('Content-Type')); - } - - public function testConstructorWithCustomHeaders() - { - $response = new JsonResponse(array(), 200, array('ETag' => 'foo')); - $this->assertSame('application/json', $response->headers->get('Content-Type')); - $this->assertSame('foo', $response->headers->get('ETag')); - } - - public function testConstructorWithCustomContentType() - { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); - - $response = new JsonResponse(array(), 200, $headers); - $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); - } - - public function testSetJson() - { - $response = new JsonResponse('1', 200, array(), true); - $this->assertEquals('1', $response->getContent()); - - $response = new JsonResponse('[1]', 200, array(), true); - $this->assertEquals('[1]', $response->getContent()); - - $response = new JsonResponse(null, 200, array()); - $response->setJson('true'); - $this->assertEquals('true', $response->getContent()); - } - - public function testCreate() - { - $response = JsonResponse::create(array('foo' => 'bar'), 204); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertEquals('{"foo":"bar"}', $response->getContent()); - $this->assertEquals(204, $response->getStatusCode()); - } - - public function testStaticCreateEmptyJsonObject() - { - $response = JsonResponse::create(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('{}', $response->getContent()); - } - - public function testStaticCreateJsonArray() - { - $response = JsonResponse::create(array(0, 1, 2, 3)); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('[0,1,2,3]', $response->getContent()); - } - - public function testStaticCreateJsonObject() - { - $response = JsonResponse::create(array('foo' => 'bar')); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('{"foo":"bar"}', $response->getContent()); - } - - public function testStaticCreateWithSimpleTypes() - { - $response = JsonResponse::create('foo'); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('"foo"', $response->getContent()); - - $response = JsonResponse::create(0); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('0', $response->getContent()); - - $response = JsonResponse::create(0.1); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('0.1', $response->getContent()); - - $response = JsonResponse::create(true); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); - $this->assertSame('true', $response->getContent()); - } - - public function testStaticCreateWithCustomStatus() - { - $response = JsonResponse::create(array(), 202); - $this->assertSame(202, $response->getStatusCode()); - } - - public function testStaticCreateAddsContentTypeHeader() - { - $response = JsonResponse::create(); - $this->assertSame('application/json', $response->headers->get('Content-Type')); - } - - public function testStaticCreateWithCustomHeaders() - { - $response = JsonResponse::create(array(), 200, array('ETag' => 'foo')); - $this->assertSame('application/json', $response->headers->get('Content-Type')); - $this->assertSame('foo', $response->headers->get('ETag')); - } - - public function testStaticCreateWithCustomContentType() - { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); - - $response = JsonResponse::create(array(), 200, $headers); - $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); - } - - public function testSetCallback() - { - $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback'); - - $this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent()); - $this->assertEquals('text/javascript', $response->headers->get('Content-Type')); - } - - public function testJsonEncodeFlags() - { - $response = new JsonResponse('<>\'&"'); - - $this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"', $response->getContent()); - } - - public function testGetEncodingOptions() - { - $response = new JsonResponse(); - - $this->assertEquals(JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, $response->getEncodingOptions()); - } - - public function testSetEncodingOptions() - { - $response = new JsonResponse(); - $response->setData(array(array(1, 2, 3))); - - $this->assertEquals('[[1,2,3]]', $response->getContent()); - - $response->setEncodingOptions(JSON_FORCE_OBJECT); - - $this->assertEquals('{"0":{"0":1,"1":2,"2":3}}', $response->getContent()); - } - - public function testItAcceptsJsonAsString() - { - $response = JsonResponse::fromJsonString('{"foo":"bar"}'); - $this->assertSame('{"foo":"bar"}', $response->getContent()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSetCallbackInvalidIdentifier() - { - $response = new JsonResponse('foo'); - $response->setCallback('+invalid'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSetContent() - { - JsonResponse::create("\xB1\x31"); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage This error is expected - */ - public function testSetContentJsonSerializeError() - { - if (!interface_exists('JsonSerializable', false)) { - $this->markTestSkipped('JsonSerializable is required.'); - } - - $serializable = new JsonSerializableObject(); - - JsonResponse::create($serializable); - } - - public function testSetComplexCallback() - { - $response = JsonResponse::create(array('foo' => 'bar')); - $response->setCallback('ಠ_ಠ["foo"].bar[0]'); - - $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent()); - } -} - -if (interface_exists('JsonSerializable', false)) { - class JsonSerializableObject implements \JsonSerializable - { - public function jsonSerialize() - { - throw new \Exception('This error is expected'); - } - } -} diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php deleted file mode 100644 index 5311a0d..0000000 --- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ParameterBag; - -class ParameterBagTest extends TestCase -{ - public function testConstructor() - { - $this->testAll(); - } - - public function testAll() - { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input'); - } - - public function testKeys() - { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo'), $bag->keys()); - } - - public function testAdd() - { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); - } - - public function testRemove() - { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); - $bag->remove('bar'); - $this->assertEquals(array('foo' => 'bar'), $bag->all()); - } - - public function testReplace() - { - $bag = new ParameterBag(array('foo' => 'bar')); - - $bag->replace(array('FOO' => 'BAR')); - $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument'); - $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); - } - - public function testGet() - { - $bag = new ParameterBag(array('foo' => 'bar', 'null' => null)); - - $this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter'); - $this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined'); - $this->assertNull($bag->get('null', 'default'), '->get() returns null if null is set'); - } - - public function testGetDoesNotUseDeepByDefault() - { - $bag = new ParameterBag(array('foo' => array('bar' => 'moo'))); - - $this->assertNull($bag->get('foo[bar]')); - } - - public function testSet() - { - $bag = new ParameterBag(array()); - - $bag->set('foo', 'bar'); - $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter'); - - $bag->set('foo', 'baz'); - $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter'); - } - - public function testHas() - { - $bag = new ParameterBag(array('foo' => 'bar')); - - $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); - $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined'); - } - - public function testGetAlpha() - { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); - - $this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters'); - $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined'); - } - - public function testGetAlnum() - { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); - - $this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters'); - $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined'); - } - - public function testGetDigits() - { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); - - $this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string'); - $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined'); - } - - public function testGetInt() - { - $bag = new ParameterBag(array('digits' => '0123')); - - $this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer'); - $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined'); - } - - public function testFilter() - { - $bag = new ParameterBag(array( - 'digits' => '0123ab', - 'email' => 'example@example.com', - 'url' => 'http://example.com/foo', - 'dec' => '256', - 'hex' => '0x100', - 'array' => array('bang'), - )); - - $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found'); - - $this->assertEquals('0123', $bag->filter('digits', '', FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters'); - - $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email'); - - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path'); - - // This test is repeated for code-coverage - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path'); - - $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array( - 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); - - $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array( - 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); - - $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array'); - } - - public function testGetIterator() - { - $parameters = array('foo' => 'bar', 'hello' => 'world'); - $bag = new ParameterBag($parameters); - - $i = 0; - foreach ($bag as $key => $val) { - ++$i; - $this->assertEquals($parameters[$key], $val); - } - - $this->assertEquals(count($parameters), $i); - } - - public function testCount() - { - $parameters = array('foo' => 'bar', 'hello' => 'world'); - $bag = new ParameterBag($parameters); - - $this->assertEquals(count($parameters), count($bag)); - } - - public function testGetBoolean() - { - $parameters = array('string_true' => 'true', 'string_false' => 'false'); - $bag = new ParameterBag($parameters); - - $this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true'); - $this->assertFalse($bag->getBoolean('string_false'), '->getBoolean() gets the string false as boolean false'); - $this->assertFalse($bag->getBoolean('unknown'), '->getBoolean() returns false if a parameter is not defined'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php deleted file mode 100644 index d389e83..0000000 --- a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\RedirectResponse; - -class RedirectResponseTest extends TestCase -{ - public function testGenerateMetaRedirect() - { - $response = new RedirectResponse('foo.bar'); - - $this->assertEquals(1, preg_match( - '##', - preg_replace(array('/\s+/', '/\'/'), array(' ', '"'), $response->getContent()) - )); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRedirectResponseConstructorNullUrl() - { - $response = new RedirectResponse(null); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRedirectResponseConstructorWrongStatusCode() - { - $response = new RedirectResponse('foo.bar', 404); - } - - public function testGenerateLocationHeader() - { - $response = new RedirectResponse('foo.bar'); - - $this->assertTrue($response->headers->has('Location')); - $this->assertEquals('foo.bar', $response->headers->get('Location')); - } - - public function testGetTargetUrl() - { - $response = new RedirectResponse('foo.bar'); - - $this->assertEquals('foo.bar', $response->getTargetUrl()); - } - - public function testSetTargetUrl() - { - $response = new RedirectResponse('foo.bar'); - $response->setTargetUrl('baz.beep'); - - $this->assertEquals('baz.beep', $response->getTargetUrl()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSetTargetUrlNull() - { - $response = new RedirectResponse('foo.bar'); - $response->setTargetUrl(null); - } - - public function testCreate() - { - $response = RedirectResponse::create('foo', 301); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response); - $this->assertEquals(301, $response->getStatusCode()); - } - - public function testCacheHeaders() - { - $response = new RedirectResponse('foo.bar', 301); - $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); - - $response = new RedirectResponse('foo.bar', 301, array('cache-control' => 'max-age=86400')); - $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); - $this->assertTrue($response->headers->hasCacheControlDirective('max-age')); - - $response = new RedirectResponse('foo.bar', 302); - $this->assertTrue($response->headers->hasCacheControlDirective('no-cache')); - } -} diff --git a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php deleted file mode 100644 index b5d8004..0000000 --- a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\RequestMatcher; -use Symfony\Component\HttpFoundation\Request; - -class RequestMatcherTest extends TestCase -{ - /** - * @dataProvider getMethodData - */ - public function testMethod($requestMethod, $matcherMethod, $isMatch) - { - $matcher = new RequestMatcher(); - $matcher->matchMethod($matcherMethod); - $request = Request::create('', $requestMethod); - $this->assertSame($isMatch, $matcher->matches($request)); - - $matcher = new RequestMatcher(null, null, $matcherMethod); - $request = Request::create('', $requestMethod); - $this->assertSame($isMatch, $matcher->matches($request)); - } - - public function getMethodData() - { - return array( - array('get', 'get', true), - array('get', array('get', 'post'), true), - array('get', 'post', false), - array('get', 'GET', true), - array('get', array('GET', 'POST'), true), - array('get', 'POST', false), - ); - } - - public function testScheme() - { - $httpRequest = $request = $request = Request::create(''); - $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array('HTTPS' => 'on')); - - $matcher = new RequestMatcher(); - $matcher->matchScheme('https'); - $this->assertFalse($matcher->matches($httpRequest)); - $this->assertTrue($matcher->matches($httpsRequest)); - - $matcher->matchScheme('http'); - $this->assertFalse($matcher->matches($httpsRequest)); - $this->assertTrue($matcher->matches($httpRequest)); - - $matcher = new RequestMatcher(); - $this->assertTrue($matcher->matches($httpsRequest)); - $this->assertTrue($matcher->matches($httpRequest)); - } - - /** - * @dataProvider getHostData - */ - public function testHost($pattern, $isMatch) - { - $matcher = new RequestMatcher(); - $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => 'foo.example.com')); - - $matcher->matchHost($pattern); - $this->assertSame($isMatch, $matcher->matches($request)); - - $matcher = new RequestMatcher(null, $pattern); - $this->assertSame($isMatch, $matcher->matches($request)); - } - - public function getHostData() - { - return array( - array('.*\.example\.com', true), - array('\.example\.com$', true), - array('^.*\.example\.com$', true), - array('.*\.sensio\.com', false), - array('.*\.example\.COM', true), - array('\.example\.COM$', true), - array('^.*\.example\.COM$', true), - array('.*\.sensio\.COM', false), - ); - } - - public function testPath() - { - $matcher = new RequestMatcher(); - - $request = Request::create('/admin/foo'); - - $matcher->matchPath('/admin/.*'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchPath('/admin'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchPath('^/admin/.*$'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchMethod('/blog/.*'); - $this->assertFalse($matcher->matches($request)); - } - - public function testPathWithLocaleIsNotSupported() - { - $matcher = new RequestMatcher(); - $request = Request::create('/en/login'); - $request->setLocale('en'); - - $matcher->matchPath('^/{_locale}/login$'); - $this->assertFalse($matcher->matches($request)); - } - - public function testPathWithEncodedCharacters() - { - $matcher = new RequestMatcher(); - $request = Request::create('/admin/fo%20o'); - $matcher->matchPath('^/admin/fo o*$'); - $this->assertTrue($matcher->matches($request)); - } - - public function testAttributes() - { - $matcher = new RequestMatcher(); - - $request = Request::create('/admin/foo'); - $request->attributes->set('foo', 'foo_bar'); - - $matcher->matchAttribute('foo', 'foo_.*'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchAttribute('foo', 'foo'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchAttribute('foo', '^foo_bar$'); - $this->assertTrue($matcher->matches($request)); - - $matcher->matchAttribute('foo', 'babar'); - $this->assertFalse($matcher->matches($request)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/RequestStackTest.php b/vendor/symfony/http-foundation/Tests/RequestStackTest.php deleted file mode 100644 index a84fb26..0000000 --- a/vendor/symfony/http-foundation/Tests/RequestStackTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; - -class RequestStackTest extends TestCase -{ - public function testGetCurrentRequest() - { - $requestStack = new RequestStack(); - $this->assertNull($requestStack->getCurrentRequest()); - - $request = Request::create('/foo'); - - $requestStack->push($request); - $this->assertSame($request, $requestStack->getCurrentRequest()); - - $this->assertSame($request, $requestStack->pop()); - $this->assertNull($requestStack->getCurrentRequest()); - - $this->assertNull($requestStack->pop()); - } - - public function testGetMasterRequest() - { - $requestStack = new RequestStack(); - $this->assertNull($requestStack->getMasterRequest()); - - $masterRequest = Request::create('/foo'); - $subRequest = Request::create('/bar'); - - $requestStack->push($masterRequest); - $requestStack->push($subRequest); - - $this->assertSame($masterRequest, $requestStack->getMasterRequest()); - } - - public function testGetParentRequest() - { - $requestStack = new RequestStack(); - $this->assertNull($requestStack->getParentRequest()); - - $masterRequest = Request::create('/foo'); - - $requestStack->push($masterRequest); - $this->assertNull($requestStack->getParentRequest()); - - $firstSubRequest = Request::create('/bar'); - - $requestStack->push($firstSubRequest); - $this->assertSame($masterRequest, $requestStack->getParentRequest()); - - $secondSubRequest = Request::create('/baz'); - - $requestStack->push($secondSubRequest); - $this->assertSame($firstSubRequest, $requestStack->getParentRequest()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php deleted file mode 100644 index b36fbb7..0000000 --- a/vendor/symfony/http-foundation/Tests/RequestTest.php +++ /dev/null @@ -1,2207 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Request; - -class RequestTest extends TestCase -{ - protected function tearDown() - { - // reset - Request::setTrustedProxies(array(), -1); - } - - public function testInitialize() - { - $request = new Request(); - - $request->initialize(array('foo' => 'bar')); - $this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument'); - - $request->initialize(array(), array('foo' => 'bar')); - $this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument'); - - $request->initialize(array(), array(), array('foo' => 'bar')); - $this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument'); - - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar')); - $this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument'); - } - - public function testGetLocale() - { - $request = new Request(); - $request->setLocale('pl'); - $locale = $request->getLocale(); - $this->assertEquals('pl', $locale); - } - - public function testGetUser() - { - $request = Request::create('http://user_test:password_test@test.com/'); - $user = $request->getUser(); - - $this->assertEquals('user_test', $user); - } - - public function testGetPassword() - { - $request = Request::create('http://user_test:password_test@test.com/'); - $password = $request->getPassword(); - - $this->assertEquals('password_test', $password); - } - - public function testIsNoCache() - { - $request = new Request(); - $isNoCache = $request->isNoCache(); - - $this->assertFalse($isNoCache); - } - - public function testGetContentType() - { - $request = new Request(); - $contentType = $request->getContentType(); - - $this->assertNull($contentType); - } - - public function testSetDefaultLocale() - { - $request = new Request(); - $request->setDefaultLocale('pl'); - $locale = $request->getLocale(); - - $this->assertEquals('pl', $locale); - } - - public function testCreate() - { - $request = Request::create('http://test.com/foo?bar=baz'); - $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('bar=baz', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz')); - $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('bar=baz', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); - $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('bar=baz', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('https://test.com/foo?bar=baz'); - $this->assertEquals('https://test.com/foo?bar=baz', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('bar=baz', $request->getQueryString()); - $this->assertEquals(443, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertTrue($request->isSecure()); - - $request = Request::create('test.com:90/foo'); - $this->assertEquals('http://test.com:90/foo', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('test.com', $request->getHost()); - $this->assertEquals('test.com:90', $request->getHttpHost()); - $this->assertEquals(90, $request->getPort()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('https://test.com:90/foo'); - $this->assertEquals('https://test.com:90/foo', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('test.com', $request->getHost()); - $this->assertEquals('test.com:90', $request->getHttpHost()); - $this->assertEquals(90, $request->getPort()); - $this->assertTrue($request->isSecure()); - - $request = Request::create('https://127.0.0.1:90/foo'); - $this->assertEquals('https://127.0.0.1:90/foo', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('127.0.0.1', $request->getHost()); - $this->assertEquals('127.0.0.1:90', $request->getHttpHost()); - $this->assertEquals(90, $request->getPort()); - $this->assertTrue($request->isSecure()); - - $request = Request::create('https://[::1]:90/foo'); - $this->assertEquals('https://[::1]:90/foo', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('[::1]', $request->getHost()); - $this->assertEquals('[::1]:90', $request->getHttpHost()); - $this->assertEquals(90, $request->getPort()); - $this->assertTrue($request->isSecure()); - - $request = Request::create('https://[::1]/foo'); - $this->assertEquals('https://[::1]/foo', $request->getUri()); - $this->assertEquals('/foo', $request->getPathInfo()); - $this->assertEquals('[::1]', $request->getHost()); - $this->assertEquals('[::1]', $request->getHttpHost()); - $this->assertEquals(443, $request->getPort()); - $this->assertTrue($request->isSecure()); - - $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}'; - $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json); - $this->assertEquals($json, $request->getContent()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com'); - $this->assertEquals('http://test.com/', $request->getUri()); - $this->assertEquals('/', $request->getPathInfo()); - $this->assertEquals('', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com?test=1'); - $this->assertEquals('http://test.com/?test=1', $request->getUri()); - $this->assertEquals('/', $request->getPathInfo()); - $this->assertEquals('test=1', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com:90/?test=1'); - $this->assertEquals('http://test.com:90/?test=1', $request->getUri()); - $this->assertEquals('/', $request->getPathInfo()); - $this->assertEquals('test=1', $request->getQueryString()); - $this->assertEquals(90, $request->getPort()); - $this->assertEquals('test.com:90', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://username:password@test.com'); - $this->assertEquals('http://test.com/', $request->getUri()); - $this->assertEquals('/', $request->getPathInfo()); - $this->assertEquals('', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertEquals('username', $request->getUser()); - $this->assertEquals('password', $request->getPassword()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://username@test.com'); - $this->assertEquals('http://test.com/', $request->getUri()); - $this->assertEquals('/', $request->getPathInfo()); - $this->assertEquals('', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertEquals('username', $request->getUser()); - $this->assertSame('', $request->getPassword()); - $this->assertFalse($request->isSecure()); - - $request = Request::create('http://test.com/?foo'); - $this->assertEquals('/?foo', $request->getRequestUri()); - $this->assertEquals(array('foo' => ''), $request->query->all()); - - // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory - $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), - array( - 'DOCUMENT_ROOT' => '/var/www/www.test.com', - 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php', - 'SCRIPT_NAME' => '/app/app.php', - 'PHP_SELF' => '/app/app.php/apparthotel-1234', - )); - $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri()); - $this->assertEquals('/apparthotel-1234', $request->getPathInfo()); - $this->assertEquals('', $request->getQueryString()); - $this->assertEquals(80, $request->getPort()); - $this->assertEquals('test.com', $request->getHttpHost()); - $this->assertFalse($request->isSecure()); - } - - public function testCreateCheckPrecedence() - { - // server is used by default - $request = Request::create('/', 'DELETE', array(), array(), array(), array( - 'HTTP_HOST' => 'example.com', - 'HTTPS' => 'on', - 'SERVER_PORT' => 443, - 'PHP_AUTH_USER' => 'fabien', - 'PHP_AUTH_PW' => 'pa$$', - 'QUERY_STRING' => 'foo=bar', - 'CONTENT_TYPE' => 'application/json', - )); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(443, $request->getPort()); - $this->assertTrue($request->isSecure()); - $this->assertEquals('fabien', $request->getUser()); - $this->assertEquals('pa$$', $request->getPassword()); - $this->assertEquals('', $request->getQueryString()); - $this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE')); - - // URI has precedence over server - $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array( - 'HTTP_HOST' => 'example.com', - 'HTTPS' => 'on', - 'SERVER_PORT' => 443, - )); - $this->assertEquals('example.net', $request->getHost()); - $this->assertEquals(8080, $request->getPort()); - $this->assertFalse($request->isSecure()); - $this->assertEquals('thomas', $request->getUser()); - $this->assertEquals('pokemon', $request->getPassword()); - $this->assertEquals('foo=bar', $request->getQueryString()); - } - - public function testDuplicate() - { - $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar')); - $dup = $request->duplicate(); - - $this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters'); - $this->assertEquals($request->request->all(), $dup->request->all(), '->duplicate() duplicates a request an copy the current request parameters'); - $this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes'); - $this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers'); - - $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar')); - - $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); - $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); - } - - public function testDuplicateWithFormat() - { - $request = new Request(array(), array(), array('_format' => 'json')); - $dup = $request->duplicate(); - - $this->assertEquals('json', $dup->getRequestFormat()); - $this->assertEquals('json', $dup->attributes->get('_format')); - - $request = new Request(); - $request->setRequestFormat('xml'); - $dup = $request->duplicate(); - - $this->assertEquals('xml', $dup->getRequestFormat()); - } - - /** - * @dataProvider getFormatToMimeTypeMapProviderWithAdditionalNullFormat - */ - public function testGetFormatFromMimeType($format, $mimeTypes) - { - $request = new Request(); - foreach ($mimeTypes as $mime) { - $this->assertEquals($format, $request->getFormat($mime)); - } - $request->setFormat($format, $mimeTypes); - foreach ($mimeTypes as $mime) { - $this->assertEquals($format, $request->getFormat($mime)); - - if (null !== $format) { - $this->assertEquals($mimeTypes[0], $request->getMimeType($format)); - } - } - } - - public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat() - { - return array_merge( - array(array(null, array(null, 'unexistent-mime-type'))), - $this->getFormatToMimeTypeMapProvider() - ); - } - - public function testGetFormatFromMimeTypeWithParameters() - { - $request = new Request(); - $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8')); - } - - /** - * @dataProvider getFormatToMimeTypeMapProvider - */ - public function testGetMimeTypeFromFormat($format, $mimeTypes) - { - $request = new Request(); - $this->assertEquals($mimeTypes[0], $request->getMimeType($format)); - } - - /** - * @dataProvider getFormatToMimeTypeMapProvider - */ - public function testGetMimeTypesFromFormat($format, $mimeTypes) - { - $this->assertEquals($mimeTypes, Request::getMimeTypes($format)); - } - - public function testGetMimeTypesFromInexistentFormat() - { - $request = new Request(); - $this->assertNull($request->getMimeType('foo')); - $this->assertEquals(array(), Request::getMimeTypes('foo')); - } - - public function testGetFormatWithCustomMimeType() - { - $request = new Request(); - $request->setFormat('custom', 'application/vnd.foo.api;myversion=2.3'); - $this->assertEquals('custom', $request->getFormat('application/vnd.foo.api;myversion=2.3')); - } - - public function getFormatToMimeTypeMapProvider() - { - return array( - array('txt', array('text/plain')), - array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')), - array('css', array('text/css')), - array('json', array('application/json', 'application/x-json')), - array('xml', array('text/xml', 'application/xml', 'application/x-xml')), - array('rdf', array('application/rdf+xml')), - array('atom', array('application/atom+xml')), - ); - } - - public function testGetUri() - { - $server = array(); - - // Standard Request on non default PORT - // http://host:8080/index.php/path/info?query=string - - $server['HTTP_HOST'] = 'host:8080'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '8080'; - - $server['QUERY_STRING'] = 'query=string'; - $server['REQUEST_URI'] = '/index.php/path/info?query=string'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['PATH_INFO'] = '/path/info'; - $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info'; - $server['PHP_SELF'] = '/index_dev.php/path/info'; - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - - $request = new Request(); - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port'); - - // Use std port number - $server['HTTP_HOST'] = 'host'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port'); - - // Without HOST HEADER - unset($server['HTTP_HOST']); - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER'); - - // Request with URL REWRITING (hide index.php) - // RewriteCond %{REQUEST_FILENAME} !-f - // RewriteRule ^(.*)$ index.php [QSA,L] - // http://host:8080/path/info?query=string - $server = array(); - $server['HTTP_HOST'] = 'host:8080'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '8080'; - - $server['REDIRECT_QUERY_STRING'] = 'query=string'; - $server['REDIRECT_URL'] = '/path/info'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['QUERY_STRING'] = 'query=string'; - $server['REQUEST_URI'] = '/path/info?toto=test&1=1'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['PHP_SELF'] = '/index.php'; - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite'); - - // Use std port number - // http://host/path/info?query=string - $server['HTTP_HOST'] = 'host'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port'); - - // Without HOST HEADER - unset($server['HTTP_HOST']); - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER'); - - // With encoded characters - - $server = array( - 'HTTP_HOST' => 'host:8080', - 'SERVER_NAME' => 'servername', - 'SERVER_PORT' => '8080', - 'QUERY_STRING' => 'query=string', - 'REQUEST_URI' => '/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', - 'SCRIPT_NAME' => '/ba se/index_dev.php', - 'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo', - 'PHP_SELF' => '/ba se/index_dev.php/path/info', - 'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php', - ); - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals( - 'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', - $request->getUri() - ); - - // with user info - - $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); - - $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); - } - - public function testGetUriForPath() - { - $request = Request::create('http://test.com/foo?bar=baz'); - $this->assertEquals('http://test.com/some/path', $request->getUriForPath('/some/path')); - - $request = Request::create('http://test.com:90/foo?bar=baz'); - $this->assertEquals('http://test.com:90/some/path', $request->getUriForPath('/some/path')); - - $request = Request::create('https://test.com/foo?bar=baz'); - $this->assertEquals('https://test.com/some/path', $request->getUriForPath('/some/path')); - - $request = Request::create('https://test.com:90/foo?bar=baz'); - $this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path')); - - $server = array(); - - // Standard Request on non default PORT - // http://host:8080/index.php/path/info?query=string - - $server['HTTP_HOST'] = 'host:8080'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '8080'; - - $server['QUERY_STRING'] = 'query=string'; - $server['REQUEST_URI'] = '/index.php/path/info?query=string'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['PATH_INFO'] = '/path/info'; - $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info'; - $server['PHP_SELF'] = '/index_dev.php/path/info'; - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - - $request = new Request(); - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port'); - - // Use std port number - $server['HTTP_HOST'] = 'host'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port'); - - // Without HOST HEADER - unset($server['HTTP_HOST']); - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER'); - - // Request with URL REWRITING (hide index.php) - // RewriteCond %{REQUEST_FILENAME} !-f - // RewriteRule ^(.*)$ index.php [QSA,L] - // http://host:8080/path/info?query=string - $server = array(); - $server['HTTP_HOST'] = 'host:8080'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '8080'; - - $server['REDIRECT_QUERY_STRING'] = 'query=string'; - $server['REDIRECT_URL'] = '/path/info'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['QUERY_STRING'] = 'query=string'; - $server['REQUEST_URI'] = '/path/info?toto=test&1=1'; - $server['SCRIPT_NAME'] = '/index.php'; - $server['PHP_SELF'] = '/index.php'; - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite'); - - // Use std port number - // http://host/path/info?query=string - $server['HTTP_HOST'] = 'host'; - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port'); - - // Without HOST HEADER - unset($server['HTTP_HOST']); - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '80'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); - $this->assertEquals('servername', $request->getHttpHost()); - - // with user info - - $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); - - $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); - } - - /** - * @dataProvider getRelativeUriForPathData() - */ - public function testGetRelativeUriForPath($expected, $pathinfo, $path) - { - $this->assertEquals($expected, Request::create($pathinfo)->getRelativeUriForPath($path)); - } - - public function getRelativeUriForPathData() - { - return array( - array('me.png', '/foo', '/me.png'), - array('../me.png', '/foo/bar', '/me.png'), - array('me.png', '/foo/bar', '/foo/me.png'), - array('../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'), - array('../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'), - array('baz/me.png', '/foo/bar/b', 'baz/me.png'), - ); - } - - public function testGetUserInfo() - { - $request = new Request(); - - $server = array('PHP_AUTH_USER' => 'fabien'); - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('fabien', $request->getUserInfo()); - - $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('0', $request->getUserInfo()); - - $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('0:0', $request->getUserInfo()); - } - - public function testGetSchemeAndHttpHost() - { - $request = new Request(); - - $server = array(); - $server['SERVER_NAME'] = 'servername'; - $server['SERVER_PORT'] = '90'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - - $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - - $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - - $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - } - - /** - * @dataProvider getQueryStringNormalizationData - */ - public function testGetQueryString($query, $expectedQuery, $msg) - { - $request = new Request(); - - $request->server->set('QUERY_STRING', $query); - $this->assertSame($expectedQuery, $request->getQueryString(), $msg); - } - - public function getQueryStringNormalizationData() - { - return array( - array('foo', 'foo', 'works with valueless parameters'), - array('foo=', 'foo=', 'includes a dangling equal sign'), - array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), - array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), - - // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). - // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. - array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), - - array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), - array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), - array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), - array('0', '0', 'allows "0"'), - array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), - array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), - array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), - array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), - - // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. - // PHP also does not include them when building _GET. - array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), - ); - } - - public function testGetQueryStringReturnsNull() - { - $request = new Request(); - - $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string'); - - $request->server->set('QUERY_STRING', ''); - $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); - } - - public function testGetHost() - { - $request = new Request(); - - $request->initialize(array('foo' => 'bar')); - $this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized'); - - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com')); - $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header'); - - // Host header with port number - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080')); - $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number'); - - // Server values - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com')); - $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name'); - - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com')); - $this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME '); - } - - public function testGetPort() - { - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'https', - 'HTTP_X_FORWARDED_PORT' => '443', - )); - $port = $request->getPort(); - - $this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.'); - - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'https', - 'HTTP_X_FORWARDED_PORT' => '8443', - )); - $this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.'); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.'); - - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'https', - )); - $this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.'); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.'); - - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'http', - )); - $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.'); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.'); - - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'On', - )); - $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.'); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.'); - - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => '1', - )); - $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.'); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.'); - - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'something-else', - )); - $port = $request->getPort(); - $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetHostWithFakeHttpHostValue() - { - $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string')); - $request->getHost(); - } - - public function testGetSetMethod() - { - $request = new Request(); - - $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns GET if no method is defined'); - - $request->setMethod('get'); - $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns an uppercased string'); - - $request->setMethod('PURGE'); - $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method even if it is not a standard one'); - - $request->setMethod('POST'); - $this->assertEquals('POST', $request->getMethod(), '->getMethod() returns the method POST if no _method is defined'); - - $request->setMethod('POST'); - $request->request->set('_method', 'purge'); - $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled'); - - $request = new Request(); - $request->setMethod('POST'); - $request->request->set('_method', 'purge'); - - $this->assertFalse(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be disabled by default'); - - Request::enableHttpMethodParameterOverride(); - - $this->assertTrue(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be enabled now but it is not'); - - $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); - $this->disableHttpMethodParameterOverride(); - - $request = new Request(); - $request->setMethod('POST'); - $request->query->set('_method', 'purge'); - $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled'); - - $request = new Request(); - $request->setMethod('POST'); - $request->query->set('_method', 'purge'); - Request::enableHttpMethodParameterOverride(); - $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); - $this->disableHttpMethodParameterOverride(); - - $request = new Request(); - $request->setMethod('POST'); - $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); - $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST'); - - $request = new Request(); - $request->setMethod('POST'); - $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); - $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override if defined and POST'); - } - - /** - * @dataProvider getClientIpsProvider - */ - public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) - { - $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies); - - $this->assertEquals($expected[0], $request->getClientIp()); - } - - /** - * @dataProvider getClientIpsProvider - */ - public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) - { - $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies); - - $this->assertEquals($expected, $request->getClientIps()); - } - - /** - * @dataProvider getClientIpsForwardedProvider - */ - public function testGetClientIpsForwarded($expected, $remoteAddr, $httpForwarded, $trustedProxies) - { - $request = $this->getRequestInstanceForClientIpsForwardedTests($remoteAddr, $httpForwarded, $trustedProxies); - - $this->assertEquals($expected, $request->getClientIps()); - } - - public function getClientIpsForwardedProvider() - { - // $expected $remoteAddr $httpForwarded $trustedProxies - return array( - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null), - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')), - array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')), - array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for=2620:0:1cfe:face:b00c::3', array('::1')), - array(array('2001:db8:cafe::17'), '::1', 'for="[2001:db8:cafe::17]:4711', array('::1')), - ); - } - - public function getClientIpsProvider() - { - // $expected $remoteAddr $httpForwardedFor $trustedProxies - return array( - // simple IPv4 - array(array('88.88.88.88'), '88.88.88.88', null, null), - // trust the IPv4 remote addr - array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')), - - // simple IPv6 - array(array('::1'), '::1', null, null), - // trust the IPv6 remote addr - array(array('::1'), '::1', null, array('::1')), - - // forwarded for with remote IPv4 addr not trusted - array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null), - // forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1')), - // forwarded for with remote IPv4 and all FF addrs trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')), - // forwarded for with remote IPv4 range trusted - array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')), - - // forwarded for with remote IPv6 addr not trusted - array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null), - // forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), - // forwarded for with remote IPv6 range trusted - array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')), - - // multiple forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')), - // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted - array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')), - // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')), - // multiple forwarded for with remote IPv4 addr and all reverse proxies trusted - array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')), - - // multiple forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), - // multiple forwarded for with remote IPv6 addr and some reverse proxies trusted - array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')), - // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')), - - // client IP with port - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')), - - // invalid forwarded IP is ignored - array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', array('127.0.0.1')), - ); - } - - /** - * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException - * @dataProvider getClientIpsWithConflictingHeadersProvider - */ - public function testGetClientIpsWithConflictingHeaders($httpForwarded, $httpXForwardedFor) - { - $request = new Request(); - - $server = array( - 'REMOTE_ADDR' => '88.88.88.88', - 'HTTP_FORWARDED' => $httpForwarded, - 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); - - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED); - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $request->getClientIps(); - } - - public function getClientIpsWithConflictingHeadersProvider() - { - // $httpForwarded $httpXForwardedFor - return array( - array('for=87.65.43.21', '192.0.2.60'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'), - array('for=192.0.2.60', '192.0.2.60,87.65.43.21'), - array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'), - ); - } - - /** - * @dataProvider getClientIpsWithAgreeingHeadersProvider - */ - public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwardedFor, $expectedIps) - { - $request = new Request(); - - $server = array( - 'REMOTE_ADDR' => '88.88.88.88', - 'HTTP_FORWARDED' => $httpForwarded, - 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); - - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL); - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $clientIps = $request->getClientIps(); - - $this->assertSame($expectedIps, $clientIps); - } - - public function getClientIpsWithAgreeingHeadersProvider() - { - // $httpForwarded $httpXForwardedFor - return array( - array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')), - array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')), - array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')), - array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')), - ); - } - - public function testGetContentWorksTwiceInDefaultMode() - { - $req = new Request(); - $this->assertEquals('', $req->getContent()); - $this->assertEquals('', $req->getContent()); - } - - public function testGetContentReturnsResource() - { - $req = new Request(); - $retval = $req->getContent(true); - $this->assertInternalType('resource', $retval); - $this->assertEquals('', fread($retval, 1)); - $this->assertTrue(feof($retval)); - } - - public function testGetContentReturnsResourceWhenContentSetInConstructor() - { - $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent'); - $resource = $req->getContent(true); - - $this->assertInternalType('resource', $resource); - $this->assertEquals('MyContent', stream_get_contents($resource)); - } - - public function testContentAsResource() - { - $resource = fopen('php://memory', 'r+'); - fwrite($resource, 'My other content'); - rewind($resource); - - $req = new Request(array(), array(), array(), array(), array(), array(), $resource); - $this->assertEquals('My other content', stream_get_contents($req->getContent(true))); - $this->assertEquals('My other content', $req->getContent()); - } - - /** - * @expectedException \LogicException - * @dataProvider getContentCantBeCalledTwiceWithResourcesProvider - */ - public function testGetContentCantBeCalledTwiceWithResources($first, $second) - { - if (\PHP_VERSION_ID >= 50600) { - $this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.'); - } - - $req = new Request(); - $req->getContent($first); - $req->getContent($second); - } - - public function getContentCantBeCalledTwiceWithResourcesProvider() - { - return array( - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); - } - - /** - * @dataProvider getContentCanBeCalledTwiceWithResourcesProvider - * @requires PHP 5.6 - */ - public function testGetContentCanBeCalledTwiceWithResources($first, $second) - { - $req = new Request(); - $a = $req->getContent($first); - $b = $req->getContent($second); - - if ($first) { - $a = stream_get_contents($a); - } - - if ($second) { - $b = stream_get_contents($b); - } - - $this->assertSame($a, $b); - } - - public function getContentCanBeCalledTwiceWithResourcesProvider() - { - return array( - 'Fetch then fetch' => array(false, false), - 'Fetch then resource' => array(false, true), - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); - } - - public function provideOverloadedMethods() - { - return array( - array('PUT'), - array('DELETE'), - array('PATCH'), - array('put'), - array('delete'), - array('patch'), - ); - } - - /** - * @dataProvider provideOverloadedMethods - */ - public function testCreateFromGlobals($method) - { - $normalizedMethod = strtoupper($method); - - $_GET['foo1'] = 'bar1'; - $_POST['foo2'] = 'bar2'; - $_COOKIE['foo3'] = 'bar3'; - $_FILES['foo4'] = array('bar4'); - $_SERVER['foo5'] = 'bar5'; - - $request = Request::createFromGlobals(); - $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET'); - $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST'); - $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE'); - $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); - $this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER'); - - unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']); - - $_SERVER['REQUEST_METHOD'] = $method; - $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; - $request = RequestContentProxy::createFromGlobals(); - $this->assertEquals($normalizedMethod, $request->getMethod()); - $this->assertEquals('mycontent', $request->request->get('content')); - - unset($_SERVER['REQUEST_METHOD'], $_SERVER['CONTENT_TYPE']); - - Request::createFromGlobals(); - Request::enableHttpMethodParameterOverride(); - $_POST['_method'] = $method; - $_POST['foo6'] = 'bar6'; - $_SERVER['REQUEST_METHOD'] = 'PoSt'; - $request = Request::createFromGlobals(); - $this->assertEquals($normalizedMethod, $request->getMethod()); - $this->assertEquals('POST', $request->getRealMethod()); - $this->assertEquals('bar6', $request->request->get('foo6')); - - unset($_POST['_method'], $_POST['foo6'], $_SERVER['REQUEST_METHOD']); - $this->disableHttpMethodParameterOverride(); - } - - public function testOverrideGlobals() - { - $request = new Request(); - $request->initialize(array('foo' => 'bar')); - - // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it - $server = $_SERVER; - - $request->overrideGlobals(); - - $this->assertEquals(array('foo' => 'bar'), $_GET); - - $request->initialize(array(), array('foo' => 'bar')); - $request->overrideGlobals(); - - $this->assertEquals(array('foo' => 'bar'), $_POST); - - $this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); - - $request->headers->set('X_FORWARDED_PROTO', 'https'); - - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); - $this->assertFalse($request->isSecure()); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $this->assertTrue($request->isSecure()); - - $request->overrideGlobals(); - - $this->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); - - $request->headers->set('CONTENT_TYPE', 'multipart/form-data'); - $request->headers->set('CONTENT_LENGTH', 12345); - - $request->overrideGlobals(); - - $this->assertArrayHasKey('CONTENT_TYPE', $_SERVER); - $this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER); - - $request->initialize(array('foo' => 'bar', 'baz' => 'foo')); - $request->query->remove('baz'); - - $request->overrideGlobals(); - - $this->assertEquals(array('foo' => 'bar'), $_GET); - $this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']); - $this->assertEquals('foo=bar', $request->server->get('QUERY_STRING')); - - // restore initial $_SERVER array - $_SERVER = $server; - } - - public function testGetScriptName() - { - $request = new Request(); - $this->assertEquals('', $request->getScriptName()); - - $server = array(); - $server['SCRIPT_NAME'] = '/index.php'; - - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('/index.php', $request->getScriptName()); - - $server = array(); - $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('/frontend.php', $request->getScriptName()); - - $server = array(); - $server['SCRIPT_NAME'] = '/index.php'; - $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('/index.php', $request->getScriptName()); - } - - public function testGetBasePath() - { - $request = new Request(); - $this->assertEquals('', $request->getBasePath()); - - $server = array(); - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - $this->assertEquals('', $request->getBasePath()); - - $server = array(); - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $server['SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('', $request->getBasePath()); - - $server = array(); - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $server['PHP_SELF'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('', $request->getBasePath()); - - $server = array(); - $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $server['ORIG_SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('', $request->getBasePath()); - } - - public function testGetPathInfo() - { - $request = new Request(); - $this->assertEquals('/', $request->getPathInfo()); - - $server = array(); - $server['REQUEST_URI'] = '/path/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('/path/info', $request->getPathInfo()); - - $server = array(); - $server['REQUEST_URI'] = '/path%20test/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); - - $this->assertEquals('/path%20test/info', $request->getPathInfo()); - } - - public function testGetParameterPrecedence() - { - $request = new Request(); - $request->attributes->set('foo', 'attr'); - $request->query->set('foo', 'query'); - $request->request->set('foo', 'body'); - - $this->assertSame('attr', $request->get('foo')); - - $request->attributes->remove('foo'); - $this->assertSame('query', $request->get('foo')); - - $request->query->remove('foo'); - $this->assertSame('body', $request->get('foo')); - - $request->request->remove('foo'); - $this->assertNull($request->get('foo')); - } - - public function testGetPreferredLanguage() - { - $request = new Request(); - $this->assertNull($request->getPreferredLanguage()); - $this->assertNull($request->getPreferredLanguage(array())); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr'))); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en'))); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr'))); - $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr'))); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us'))); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.8'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); - } - - public function testIsXmlHttpRequest() - { - $request = new Request(); - $this->assertFalse($request->isXmlHttpRequest()); - - $request->headers->set('X-Requested-With', 'XMLHttpRequest'); - $this->assertTrue($request->isXmlHttpRequest()); - - $request->headers->remove('X-Requested-With'); - $this->assertFalse($request->isXmlHttpRequest()); - } - - /** - * @requires extension intl - */ - public function testIntlLocale() - { - $request = new Request(); - - $request->setDefaultLocale('fr'); - $this->assertEquals('fr', $request->getLocale()); - $this->assertEquals('fr', \Locale::getDefault()); - - $request->setLocale('en'); - $this->assertEquals('en', $request->getLocale()); - $this->assertEquals('en', \Locale::getDefault()); - - $request->setDefaultLocale('de'); - $this->assertEquals('en', $request->getLocale()); - $this->assertEquals('en', \Locale::getDefault()); - } - - public function testGetCharsets() - { - $request = new Request(); - $this->assertEquals(array(), $request->getCharsets()); - $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array(), $request->getCharsets()); // testing caching - - $request = new Request(); - $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets()); - - $request = new Request(); - $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'); - $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets()); - } - - public function testGetEncodings() - { - $request = new Request(); - $this->assertEquals(array(), $request->getEncodings()); - $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array(), $request->getEncodings()); // testing caching - - $request = new Request(); - $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings()); - - $request = new Request(); - $request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7'); - $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings()); - } - - public function testGetAcceptableContentTypes() - { - $request = new Request(); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); - $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching - - $request = new Request(); - $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes()); - } - - public function testGetLanguages() - { - $request = new Request(); - $this->assertEquals(array(), $request->getLanguages()); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, en, en-us'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues - - $request = new Request(); - $request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6'); - $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues - - $request = new Request(); - $request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6'); - $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages()); - } - - public function testGetRequestFormat() - { - $request = new Request(); - $this->assertEquals('html', $request->getRequestFormat()); - - // Ensure that setting different default values over time is possible, - // aka. setRequestFormat determines the state. - $this->assertEquals('json', $request->getRequestFormat('json')); - $this->assertEquals('html', $request->getRequestFormat('html')); - - $request = new Request(); - $this->assertNull($request->getRequestFormat(null)); - - $request = new Request(); - $this->assertNull($request->setRequestFormat('foo')); - $this->assertEquals('foo', $request->getRequestFormat(null)); - - $request = new Request(array('_format' => 'foo')); - $this->assertEquals('html', $request->getRequestFormat()); - } - - public function testHasSession() - { - $request = new Request(); - - $this->assertFalse($request->hasSession()); - $request->setSession(new Session(new MockArraySessionStorage())); - $this->assertTrue($request->hasSession()); - } - - public function testGetSession() - { - $request = new Request(); - - $request->setSession(new Session(new MockArraySessionStorage())); - $this->assertTrue($request->hasSession()); - - $session = $request->getSession(); - $this->assertObjectHasAttribute('storage', $session); - $this->assertObjectHasAttribute('flashName', $session); - $this->assertObjectHasAttribute('attributeName', $session); - } - - public function testHasPreviousSession() - { - $request = new Request(); - - $this->assertFalse($request->hasPreviousSession()); - $request->cookies->set('MOCKSESSID', 'foo'); - $this->assertFalse($request->hasPreviousSession()); - $request->setSession(new Session(new MockArraySessionStorage())); - $this->assertTrue($request->hasPreviousSession()); - } - - public function testToString() - { - $request = new Request(); - - $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - - $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString()); - } - - public function testIsMethod() - { - $request = new Request(); - $request->setMethod('POST'); - $this->assertTrue($request->isMethod('POST')); - $this->assertTrue($request->isMethod('post')); - $this->assertFalse($request->isMethod('GET')); - $this->assertFalse($request->isMethod('get')); - - $request->setMethod('GET'); - $this->assertTrue($request->isMethod('GET')); - $this->assertTrue($request->isMethod('get')); - $this->assertFalse($request->isMethod('POST')); - $this->assertFalse($request->isMethod('post')); - } - - /** - * @dataProvider getBaseUrlData - */ - public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo) - { - $request = Request::create($uri, 'GET', array(), array(), array(), $server); - - $this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl'); - $this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo'); - } - - public function getBaseUrlData() - { - return array( - array( - '/fruit/strawberry/1234index.php/blah', - array( - 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php', - 'SCRIPT_NAME' => '/fruit/index.php', - 'PHP_SELF' => '/fruit/index.php', - ), - '/fruit', - '/strawberry/1234index.php/blah', - ), - array( - '/fruit/strawberry/1234index.php/blah', - array( - 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php', - 'SCRIPT_NAME' => '/index.php', - 'PHP_SELF' => '/index.php', - ), - '', - '/fruit/strawberry/1234index.php/blah', - ), - array( - '/foo%20bar/', - array( - 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', - 'SCRIPT_NAME' => '/foo bar/app.php', - 'PHP_SELF' => '/foo bar/app.php', - ), - '/foo%20bar', - '/', - ), - array( - '/foo%20bar/home', - array( - 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', - 'SCRIPT_NAME' => '/foo bar/app.php', - 'PHP_SELF' => '/foo bar/app.php', - ), - '/foo%20bar', - '/home', - ), - array( - '/foo%20bar/app.php/home', - array( - 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', - 'SCRIPT_NAME' => '/foo bar/app.php', - 'PHP_SELF' => '/foo bar/app.php', - ), - '/foo%20bar/app.php', - '/home', - ), - array( - '/foo%20bar/app.php/home%3Dbaz', - array( - 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', - 'SCRIPT_NAME' => '/foo bar/app.php', - 'PHP_SELF' => '/foo bar/app.php', - ), - '/foo%20bar/app.php', - '/home%3Dbaz', - ), - array( - '/foo/bar+baz', - array( - 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', - 'SCRIPT_NAME' => '/foo/app.php', - 'PHP_SELF' => '/foo/app.php', - ), - '/foo', - '/bar+baz', - ), - ); - } - - /** - * @dataProvider urlencodedStringPrefixData - */ - public function testUrlencodedStringPrefix($string, $prefix, $expect) - { - $request = new Request(); - - $me = new \ReflectionMethod($request, 'getUrlencodedPrefix'); - $me->setAccessible(true); - - $this->assertSame($expect, $me->invoke($request, $string, $prefix)); - } - - public function urlencodedStringPrefixData() - { - return array( - array('foo', 'foo', 'foo'), - array('fo%6f', 'foo', 'fo%6f'), - array('foo/bar', 'foo', 'foo'), - array('fo%6f/bar', 'foo', 'fo%6f'), - array('f%6f%6f/bar', 'foo', 'f%6f%6f'), - array('%66%6F%6F/bar', 'foo', '%66%6F%6F'), - array('fo+o/bar', 'fo+o', 'fo+o'), - array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), - ); - } - - private function disableHttpMethodParameterOverride() - { - $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request'); - $property = $class->getProperty('httpMethodParameterOverride'); - $property->setAccessible(true); - $property->setValue(false); - } - - private function getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies) - { - $request = new Request(); - - $server = array('REMOTE_ADDR' => $remoteAddr); - if (null !== $httpForwardedFor) { - $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor; - } - - if ($trustedProxies) { - Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL); - } - - $request->initialize(array(), array(), array(), array(), array(), $server); - - return $request; - } - - private function getRequestInstanceForClientIpsForwardedTests($remoteAddr, $httpForwarded, $trustedProxies) - { - $request = new Request(); - - $server = array('REMOTE_ADDR' => $remoteAddr); - - if (null !== $httpForwarded) { - $server['HTTP_FORWARDED'] = $httpForwarded; - } - - if ($trustedProxies) { - Request::setTrustedProxies($trustedProxies, Request::HEADER_FORWARDED); - } - - $request->initialize(array(), array(), array(), array(), array(), $server); - - return $request; - } - - public function testTrustedProxiesXForwardedFor() - { - $request = Request::create('http://example.com/'); - $request->server->set('REMOTE_ADDR', '3.3.3.3'); - $request->headers->set('X_FORWARDED_FOR', '1.1.1.1, 2.2.2.2'); - $request->headers->set('X_FORWARDED_HOST', 'foo.example.com:1234, real.example.com:8080'); - $request->headers->set('X_FORWARDED_PROTO', 'https'); - $request->headers->set('X_FORWARDED_PORT', 443); - - // no trusted proxies - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_X_FORWARDED_ALL); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); - $this->assertEquals('1.1.1.1', $request->getClientIp()); - $this->assertEquals('foo.example.com', $request->getHost()); - $this->assertEquals(443, $request->getPort()); - $this->assertTrue($request->isSecure()); - - // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); - $request->headers->set('X_FORWARDED_PROTO', 'ssl'); - $this->assertTrue($request->isSecure()); - - $request->headers->set('X_FORWARDED_PROTO', 'https, http'); - $this->assertTrue($request->isSecure()); - } - - /** - * @group legacy - * @expectedDeprecation The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since version 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead. - */ - public function testLegacyTrustedProxies() - { - $request = Request::create('http://example.com/'); - $request->server->set('REMOTE_ADDR', '3.3.3.3'); - $request->headers->set('X_FORWARDED_FOR', '1.1.1.1, 2.2.2.2'); - $request->headers->set('X_FORWARDED_HOST', 'foo.example.com, real.example.com:8080'); - $request->headers->set('X_FORWARDED_PROTO', 'https'); - $request->headers->set('X_FORWARDED_PORT', 443); - $request->headers->set('X_MY_FOR', '3.3.3.3, 4.4.4.4'); - $request->headers->set('X_MY_HOST', 'my.example.com'); - $request->headers->set('X_MY_PROTO', 'http'); - $request->headers->set('X_MY_PORT', 81); - - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); - - // custom header names - Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_MY_FOR'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_MY_HOST'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_MY_PORT'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_MY_PROTO'); - $this->assertEquals('4.4.4.4', $request->getClientIp()); - $this->assertEquals('my.example.com', $request->getHost()); - $this->assertEquals(81, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // disabling via empty header names - Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, null); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, null); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, null); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - //reset - Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'FORWARDED'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_FORWARDED_FOR'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_FORWARDED_HOST'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO'); - } - - public function testTrustedProxiesForwarded() - { - $request = Request::create('http://example.com/'); - $request->server->set('REMOTE_ADDR', '3.3.3.3'); - $request->headers->set('FORWARDED', 'for=1.1.1.1, host=foo.example.com:8080, proto=https, for=2.2.2.2, host=real.example.com:8080'); - - // no trusted proxies - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_FORWARDED); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); - $this->assertEquals('1.1.1.1', $request->getClientIp()); - $this->assertEquals('foo.example.com', $request->getHost()); - $this->assertEquals(8080, $request->getPort()); - $this->assertTrue($request->isSecure()); - - // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_FORWARDED); - $this->assertEquals('3.3.3.3', $request->getClientIp()); - $this->assertEquals('example.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - $this->assertFalse($request->isSecure()); - - // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); - $request->headers->set('FORWARDED', 'proto=ssl'); - $this->assertTrue($request->isSecure()); - - $request->headers->set('FORWARDED', 'proto=https, proto=http'); - $this->assertTrue($request->isSecure()); - } - - /** - * @group legacy - * @expectedException \InvalidArgumentException - */ - public function testSetTrustedProxiesInvalidHeaderName() - { - Request::create('http://example.com/'); - Request::setTrustedHeaderName('bogus name', 'X_MY_FOR'); - } - - /** - * @group legacy - * @expectedException \InvalidArgumentException - */ - public function testGetTrustedProxiesInvalidHeaderName() - { - Request::create('http://example.com/'); - Request::getTrustedHeaderName('bogus name'); - } - - /** - * @dataProvider iisRequestUriProvider - */ - public function testIISRequestUri($headers, $server, $expectedRequestUri) - { - $request = new Request(); - $request->headers->replace($headers); - $request->server->replace($server); - - $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); - - $subRequestUri = '/bar/foo'; - $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all()); - $this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request'); - } - - public function iisRequestUriProvider() - { - return array( - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array(), - '/foo/bar', - ), - array( - array( - 'X_REWRITE_URL' => '/foo/bar', - ), - array(), - '/foo/bar', - ), - array( - array(), - array( - 'IIS_WasUrlRewritten' => '1', - 'UNENCODED_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array( - 'HTTP_X_ORIGINAL_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array( - 'IIS_WasUrlRewritten' => '1', - 'UNENCODED_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array( - 'HTTP_X_ORIGINAL_URL' => '/foo/bar', - 'IIS_WasUrlRewritten' => '1', - 'UNENCODED_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array(), - array( - 'ORIG_PATH_INFO' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array(), - array( - 'ORIG_PATH_INFO' => '/foo/bar', - 'QUERY_STRING' => 'foo=bar', - ), - '/foo/bar?foo=bar', - ), - ); - } - - public function testTrustedHosts() - { - // create a request - $request = Request::create('/'); - - // no trusted host set -> no host check - $request->headers->set('host', 'evil.com'); - $this->assertEquals('evil.com', $request->getHost()); - - // add a trusted domain and all its subdomains - Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$')); - - // untrusted host - $request->headers->set('host', 'evil.com'); - try { - $request->getHost(); - $this->fail('Request::getHost() should throw an exception when host is not trusted.'); - } catch (SuspiciousOperationException $e) { - $this->assertEquals('Untrusted Host "evil.com".', $e->getMessage()); - } - - // trusted hosts - $request->headers->set('host', 'trusted.com'); - $this->assertEquals('trusted.com', $request->getHost()); - $this->assertEquals(80, $request->getPort()); - - $request->server->set('HTTPS', true); - $request->headers->set('host', 'trusted.com'); - $this->assertEquals('trusted.com', $request->getHost()); - $this->assertEquals(443, $request->getPort()); - $request->server->set('HTTPS', false); - - $request->headers->set('host', 'trusted.com:8000'); - $this->assertEquals('trusted.com', $request->getHost()); - $this->assertEquals(8000, $request->getPort()); - - $request->headers->set('host', 'subdomain.trusted.com'); - $this->assertEquals('subdomain.trusted.com', $request->getHost()); - - // reset request for following tests - Request::setTrustedHosts(array()); - } - - public function testFactory() - { - Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) { - return new NewRequest(); - }); - - $this->assertEquals('foo', Request::create('/')->getFoo()); - - Request::setFactory(null); - } - - /** - * @dataProvider getLongHostNames - */ - public function testVeryLongHosts($host) - { - $start = microtime(true); - - $request = Request::create('/'); - $request->headers->set('host', $host); - $this->assertEquals($host, $request->getHost()); - $this->assertLessThan(5, microtime(true) - $start); - } - - /** - * @dataProvider getHostValidities - */ - public function testHostValidity($host, $isValid, $expectedHost = null, $expectedPort = null) - { - $request = Request::create('/'); - $request->headers->set('host', $host); - - if ($isValid) { - $this->assertSame($expectedHost ?: $host, $request->getHost()); - if ($expectedPort) { - $this->assertSame($expectedPort, $request->getPort()); - } - } else { - if (method_exists($this, 'expectException')) { - $this->expectException(SuspiciousOperationException::class); - $this->expectExceptionMessage('Invalid Host'); - } else { - $this->setExpectedException(SuspiciousOperationException::class, 'Invalid Host'); - } - - $request->getHost(); - } - } - - public function getHostValidities() - { - return array( - array('.a', false), - array('a..', false), - array('a.', true), - array("\xE9", false), - array('[::1]', true), - array('[::1]:80', true, '[::1]', 80), - array(str_repeat('.', 101), false), - ); - } - - public function getLongHostNames() - { - return array( - array('a'.str_repeat('.a', 40000)), - array(str_repeat(':', 101)), - ); - } - - /** - * @dataProvider methodIdempotentProvider - */ - public function testMethodIdempotent($method, $idempotent) - { - $request = new Request(); - $request->setMethod($method); - $this->assertEquals($idempotent, $request->isMethodIdempotent()); - } - - public function methodIdempotentProvider() - { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', true), - array('PATCH', false), - array('DELETE', true), - array('PURGE', true), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); - } - - /** - * @dataProvider methodSafeProvider - */ - public function testMethodSafe($method, $safe) - { - $request = new Request(); - $request->setMethod($method); - $this->assertEquals($safe, $request->isMethodSafe(false)); - } - - public function methodSafeProvider() - { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); - } - - /** - * @group legacy - * @expectedDeprecation Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since version 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead. - */ - public function testMethodSafeChecksCacheable() - { - $request = new Request(); - $request->setMethod('OPTIONS'); - $this->assertFalse($request->isMethodSafe()); - } - - /** - * @dataProvider methodCacheableProvider - */ - public function testMethodCacheable($method, $chacheable) - { - $request = new Request(); - $request->setMethod($method); - $this->assertEquals($chacheable, $request->isMethodCacheable()); - } - - public function methodCacheableProvider() - { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', false), - array('TRACE', false), - array('CONNECT', false), - ); - } - - /** - * @group legacy - */ - public function testGetTrustedHeaderName() - { - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL); - - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); - $this->assertSame('X_FORWARDED_FOR', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); - $this->assertSame('X_FORWARDED_HOST', Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST)); - $this->assertSame('X_FORWARDED_PORT', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); - $this->assertSame('X_FORWARDED_PROTO', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); - - $this->assertSame('FORWARDED', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - - Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'A'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'B'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'C'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'D'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'E'); - - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); - - $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_X_FORWARDED_ALL); - - $this->assertNull(Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); - $this->assertSame('B', Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)); - $this->assertSame('C', Request::getTrustedHeaderName(Request::HEADER_CLIENT_HOST)); - $this->assertSame('D', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PORT)); - $this->assertSame('E', Request::getTrustedHeaderName(Request::HEADER_CLIENT_PROTO)); - - Request::setTrustedProxies(array('8.8.8.8'), Request::HEADER_FORWARDED); - - $this->assertSame('A', Request::getTrustedHeaderName(Request::HEADER_FORWARDED)); - - //reset - Request::setTrustedHeaderName(Request::HEADER_FORWARDED, 'FORWARDED'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_FORWARDED_FOR'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_FORWARDED_HOST'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT'); - Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO'); - } -} - -class RequestContentProxy extends Request -{ - public function getContent($asResource = false) - { - return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent')); - } -} - -class NewRequest extends Request -{ - public function getFoo() - { - return 'foo'; - } -} diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php deleted file mode 100644 index 4136567..0000000 --- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php +++ /dev/null @@ -1,339 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; -use Symfony\Component\HttpFoundation\Cookie; - -/** - * @group time-sensitive - */ -class ResponseHeaderBagTest extends TestCase -{ - /** - * @dataProvider provideAllPreserveCase - */ - public function testAllPreserveCase($headers, $expected) - { - $bag = new ResponseHeaderBag($headers); - - $this->assertEquals($expected, $bag->allPreserveCase(), '->allPreserveCase() gets all input keys in original case'); - } - - public function provideAllPreserveCase() - { - return array( - array( - array('fOo' => 'BAR'), - array('fOo' => array('BAR'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('ETag' => 'xyzzy'), - array('ETag' => array('xyzzy'), 'Cache-Control' => array('private, must-revalidate')), - ), - array( - array('Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ=='), - array('Content-MD5' => array('Q2hlY2sgSW50ZWdyaXR5IQ=='), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('P3P' => 'CP="CAO PSA OUR"'), - array('P3P' => array('CP="CAO PSA OUR"'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('WWW-Authenticate' => 'Basic realm="WallyWorld"'), - array('WWW-Authenticate' => array('Basic realm="WallyWorld"'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('X-UA-Compatible' => 'IE=edge,chrome=1'), - array('X-UA-Compatible' => array('IE=edge,chrome=1'), 'Cache-Control' => array('no-cache, private')), - ), - array( - array('X-XSS-Protection' => '1; mode=block'), - array('X-XSS-Protection' => array('1; mode=block'), 'Cache-Control' => array('no-cache, private')), - ), - ); - } - - public function testCacheControlHeader() - { - $bag = new ResponseHeaderBag(array()); - $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - - $bag = new ResponseHeaderBag(array('Cache-Control' => 'public')); - $this->assertEquals('public', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('public')); - - $bag = new ResponseHeaderBag(array('ETag' => 'abcde')); - $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('private')); - $this->assertTrue($bag->hasCacheControlDirective('must-revalidate')); - $this->assertFalse($bag->hasCacheControlDirective('max-age')); - - $bag = new ResponseHeaderBag(array('Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT')); - $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array( - 'Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT', - 'Cache-Control' => 'max-age=3600', - )); - $this->assertEquals('max-age=3600, private', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('Last-Modified' => 'abcde')); - $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('Etag' => 'abcde', 'Last-Modified' => 'abcde')); - $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('cache-control' => 'max-age=100')); - $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('cache-control' => 's-maxage=100')); - $this->assertEquals('s-maxage=100', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('cache-control' => 'private, max-age=100')); - $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100')); - $this->assertEquals('max-age=100, public', $bag->get('Cache-Control')); - - $bag = new ResponseHeaderBag(); - $bag->set('Last-Modified', 'abcde'); - $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - } - - public function testCacheControlClone() - { - $headers = array('foo' => 'bar'); - $bag1 = new ResponseHeaderBag($headers); - $bag2 = new ResponseHeaderBag($bag1->allPreserveCase()); - $this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase()); - } - - public function testToStringIncludesCookieHeaders() - { - $bag = new ResponseHeaderBag(array()); - $bag->setCookie(new Cookie('foo', 'bar')); - - $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag); - - $bag->clearCookie('foo'); - - $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; httponly', $bag); - } - - public function testClearCookieSecureNotHttpOnly() - { - $bag = new ResponseHeaderBag(array()); - - $bag->clearCookie('foo', '/', null, true, false); - - $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; secure', $bag); - } - - public function testReplace() - { - $bag = new ResponseHeaderBag(array()); - $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - - $bag->replace(array('Cache-Control' => 'public')); - $this->assertEquals('public', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('public')); - } - - public function testReplaceWithRemove() - { - $bag = new ResponseHeaderBag(array()); - $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - - $bag->remove('Cache-Control'); - $bag->replace(array()); - $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); - $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - } - - public function testCookiesWithSameNames() - { - $bag = new ResponseHeaderBag(); - $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/foo', 'foo.bar')); - $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/bar', 'foo.bar')); - $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/bar', 'bar.foo')); - $bag->setCookie(new Cookie('foo', 'bar')); - - $this->assertCount(4, $bag->getCookies()); - $this->assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag->get('set-cookie')); - $this->assertEquals(array( - 'foo=bar; path=/path/foo; domain=foo.bar; httponly', - 'foo=bar; path=/path/bar; domain=foo.bar; httponly', - 'foo=bar; path=/path/bar; domain=bar.foo; httponly', - 'foo=bar; path=/; httponly', - ), $bag->get('set-cookie', null, false)); - - $this->assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly', $bag); - $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly', $bag); - $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=bar.foo; httponly', $bag); - $this->assertSetCookieHeader('foo=bar; path=/; httponly', $bag); - - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - - $this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo'])); - $this->assertTrue(isset($cookies['foo.bar']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['bar.foo']['/path/bar']['foo'])); - $this->assertTrue(isset($cookies['']['/']['foo'])); - } - - public function testRemoveCookie() - { - $bag = new ResponseHeaderBag(); - $this->assertFalse($bag->has('set-cookie')); - - $bag->setCookie(new Cookie('foo', 'bar', 0, '/path/foo', 'foo.bar')); - $bag->setCookie(new Cookie('bar', 'foo', 0, '/path/bar', 'foo.bar')); - $this->assertTrue($bag->has('set-cookie')); - - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['foo.bar']['/path/foo'])); - - $bag->removeCookie('foo', '/path/foo', 'foo.bar'); - $this->assertTrue($bag->has('set-cookie')); - - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar']['/path/foo'])); - - $bag->removeCookie('bar', '/path/bar', 'foo.bar'); - $this->assertFalse($bag->has('set-cookie')); - - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['foo.bar'])); - } - - public function testRemoveCookieWithNullRemove() - { - $bag = new ResponseHeaderBag(); - $bag->setCookie(new Cookie('foo', 'bar', 0)); - $bag->setCookie(new Cookie('bar', 'foo', 0)); - - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertTrue(isset($cookies['']['/'])); - - $bag->removeCookie('foo', null); - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['']['/']['foo'])); - - $bag->removeCookie('bar', null); - $cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY); - $this->assertFalse(isset($cookies['']['/']['bar'])); - } - - public function testSetCookieHeader() - { - $bag = new ResponseHeaderBag(); - $bag->set('set-cookie', 'foo=bar'); - $this->assertEquals(array(new Cookie('foo', 'bar', 0, '/', null, false, false, true)), $bag->getCookies()); - - $bag->set('set-cookie', 'foo2=bar2', false); - $this->assertEquals(array( - new Cookie('foo', 'bar', 0, '/', null, false, false, true), - new Cookie('foo2', 'bar2', 0, '/', null, false, false, true), - ), $bag->getCookies()); - - $bag->remove('set-cookie'); - $this->assertEquals(array(), $bag->getCookies()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testGetCookiesWithInvalidArgument() - { - $bag = new ResponseHeaderBag(); - - $bag->getCookies('invalid_argument'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testMakeDispositionInvalidDisposition() - { - $headers = new ResponseHeaderBag(); - - $headers->makeDisposition('invalid', 'foo.html'); - } - - /** - * @dataProvider provideMakeDisposition - */ - public function testMakeDisposition($disposition, $filename, $filenameFallback, $expected) - { - $headers = new ResponseHeaderBag(); - - $this->assertEquals($expected, $headers->makeDisposition($disposition, $filename, $filenameFallback)); - } - - public function testToStringDoesntMessUpHeaders() - { - $headers = new ResponseHeaderBag(); - - $headers->set('Location', 'http://www.symfony.com'); - $headers->set('Content-type', 'text/html'); - - (string) $headers; - - $allHeaders = $headers->allPreserveCase(); - $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']); - $this->assertEquals(array('text/html'), $allHeaders['Content-type']); - } - - public function provideMakeDisposition() - { - return array( - array('attachment', 'foo.html', 'foo.html', 'attachment; filename="foo.html"'), - array('attachment', 'foo.html', '', 'attachment; filename="foo.html"'), - array('attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'), - array('attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'), - array('attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'), - array('attachment', 'föö.html', 'foo.html', 'attachment; filename="foo.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html'), - ); - } - - /** - * @dataProvider provideMakeDispositionFail - * @expectedException \InvalidArgumentException - */ - public function testMakeDispositionFail($disposition, $filename) - { - $headers = new ResponseHeaderBag(); - - $headers->makeDisposition($disposition, $filename); - } - - public function provideMakeDispositionFail() - { - return array( - array('attachment', 'foo%20bar.html'), - array('attachment', 'foo/bar.html'), - array('attachment', '/foo.html'), - array('attachment', 'foo\bar.html'), - array('attachment', '\foo.html'), - array('attachment', 'föö.html'), - ); - } - - private function assertSetCookieHeader($expected, ResponseHeaderBag $actual) - { - $this->assertRegExp('#^Set-Cookie:\s+'.preg_quote($expected, '#').'$#m', str_replace("\r\n", "\n", (string) $actual)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php deleted file mode 100644 index 62b8c65..0000000 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ /dev/null @@ -1,981 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * @group time-sensitive - */ -class ResponseTest extends ResponseTestCase -{ - public function testCreate() - { - $response = Response::create('foo', 301, array('Foo' => 'bar')); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); - $this->assertEquals(301, $response->getStatusCode()); - $this->assertEquals('bar', $response->headers->get('foo')); - } - - public function testToString() - { - $response = new Response(); - $response = explode("\r\n", $response); - $this->assertEquals('HTTP/1.0 200 OK', $response[0]); - $this->assertEquals('Cache-Control: no-cache, private', $response[1]); - } - - public function testClone() - { - $response = new Response(); - $responseClone = clone $response; - $this->assertEquals($response, $responseClone); - } - - public function testSendHeaders() - { - $response = new Response(); - $headers = $response->sendHeaders(); - $this->assertObjectHasAttribute('headers', $headers); - $this->assertObjectHasAttribute('content', $headers); - $this->assertObjectHasAttribute('version', $headers); - $this->assertObjectHasAttribute('statusCode', $headers); - $this->assertObjectHasAttribute('statusText', $headers); - $this->assertObjectHasAttribute('charset', $headers); - } - - public function testSend() - { - $response = new Response(); - $responseSend = $response->send(); - $this->assertObjectHasAttribute('headers', $responseSend); - $this->assertObjectHasAttribute('content', $responseSend); - $this->assertObjectHasAttribute('version', $responseSend); - $this->assertObjectHasAttribute('statusCode', $responseSend); - $this->assertObjectHasAttribute('statusText', $responseSend); - $this->assertObjectHasAttribute('charset', $responseSend); - } - - public function testGetCharset() - { - $response = new Response(); - $charsetOrigin = 'UTF-8'; - $response->setCharset($charsetOrigin); - $charset = $response->getCharset(); - $this->assertEquals($charsetOrigin, $charset); - } - - public function testIsCacheable() - { - $response = new Response(); - $this->assertFalse($response->isCacheable()); - } - - public function testIsCacheableWithErrorCode() - { - $response = new Response('', 500); - $this->assertFalse($response->isCacheable()); - } - - public function testIsCacheableWithNoStoreDirective() - { - $response = new Response(); - $response->headers->set('cache-control', 'private'); - $this->assertFalse($response->isCacheable()); - } - - public function testIsCacheableWithSetTtl() - { - $response = new Response(); - $response->setTtl(10); - $this->assertTrue($response->isCacheable()); - } - - public function testMustRevalidate() - { - $response = new Response(); - $this->assertFalse($response->mustRevalidate()); - } - - public function testMustRevalidateWithMustRevalidateCacheControlHeader() - { - $response = new Response(); - $response->headers->set('cache-control', 'must-revalidate'); - - $this->assertTrue($response->mustRevalidate()); - } - - public function testMustRevalidateWithProxyRevalidateCacheControlHeader() - { - $response = new Response(); - $response->headers->set('cache-control', 'proxy-revalidate'); - - $this->assertTrue($response->mustRevalidate()); - } - - public function testSetNotModified() - { - $response = new Response(); - $modified = $response->setNotModified(); - $this->assertObjectHasAttribute('headers', $modified); - $this->assertObjectHasAttribute('content', $modified); - $this->assertObjectHasAttribute('version', $modified); - $this->assertObjectHasAttribute('statusCode', $modified); - $this->assertObjectHasAttribute('statusText', $modified); - $this->assertObjectHasAttribute('charset', $modified); - $this->assertEquals(304, $modified->getStatusCode()); - } - - public function testIsSuccessful() - { - $response = new Response(); - $this->assertTrue($response->isSuccessful()); - } - - public function testIsNotModified() - { - $response = new Response(); - $modified = $response->isNotModified(new Request()); - $this->assertFalse($modified); - } - - public function testIsNotModifiedNotSafe() - { - $request = Request::create('/homepage', 'POST'); - - $response = new Response(); - $this->assertFalse($response->isNotModified($request)); - } - - public function testIsNotModifiedLastModified() - { - $before = 'Sun, 25 Aug 2013 18:32:31 GMT'; - $modified = 'Sun, 25 Aug 2013 18:33:31 GMT'; - $after = 'Sun, 25 Aug 2013 19:33:31 GMT'; - - $request = new Request(); - $request->headers->set('If-Modified-Since', $modified); - - $response = new Response(); - - $response->headers->set('Last-Modified', $modified); - $this->assertTrue($response->isNotModified($request)); - - $response->headers->set('Last-Modified', $before); - $this->assertTrue($response->isNotModified($request)); - - $response->headers->set('Last-Modified', $after); - $this->assertFalse($response->isNotModified($request)); - - $response->headers->set('Last-Modified', ''); - $this->assertFalse($response->isNotModified($request)); - } - - public function testIsNotModifiedEtag() - { - $etagOne = 'randomly_generated_etag'; - $etagTwo = 'randomly_generated_etag_2'; - - $request = new Request(); - $request->headers->set('if_none_match', sprintf('%s, %s, %s', $etagOne, $etagTwo, 'etagThree')); - - $response = new Response(); - - $response->headers->set('ETag', $etagOne); - $this->assertTrue($response->isNotModified($request)); - - $response->headers->set('ETag', $etagTwo); - $this->assertTrue($response->isNotModified($request)); - - $response->headers->set('ETag', ''); - $this->assertFalse($response->isNotModified($request)); - } - - public function testIsNotModifiedLastModifiedAndEtag() - { - $before = 'Sun, 25 Aug 2013 18:32:31 GMT'; - $modified = 'Sun, 25 Aug 2013 18:33:31 GMT'; - $after = 'Sun, 25 Aug 2013 19:33:31 GMT'; - $etag = 'randomly_generated_etag'; - - $request = new Request(); - $request->headers->set('if_none_match', sprintf('%s, %s', $etag, 'etagThree')); - $request->headers->set('If-Modified-Since', $modified); - - $response = new Response(); - - $response->headers->set('ETag', $etag); - $response->headers->set('Last-Modified', $after); - $this->assertFalse($response->isNotModified($request)); - - $response->headers->set('ETag', 'non-existent-etag'); - $response->headers->set('Last-Modified', $before); - $this->assertFalse($response->isNotModified($request)); - - $response->headers->set('ETag', $etag); - $response->headers->set('Last-Modified', $modified); - $this->assertTrue($response->isNotModified($request)); - } - - public function testIsNotModifiedIfModifiedSinceAndEtagWithoutLastModified() - { - $modified = 'Sun, 25 Aug 2013 18:33:31 GMT'; - $etag = 'randomly_generated_etag'; - - $request = new Request(); - $request->headers->set('if_none_match', sprintf('%s, %s', $etag, 'etagThree')); - $request->headers->set('If-Modified-Since', $modified); - - $response = new Response(); - - $response->headers->set('ETag', $etag); - $this->assertTrue($response->isNotModified($request)); - - $response->headers->set('ETag', 'non-existent-etag'); - $this->assertFalse($response->isNotModified($request)); - } - - public function testIsValidateable() - { - $response = new Response('', 200, array('Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); - $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present'); - - $response = new Response('', 200, array('ETag' => '"12345"')); - $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if ETag is present'); - - $response = new Response(); - $this->assertFalse($response->isValidateable(), '->isValidateable() returns false when no validator is present'); - } - - public function testGetDate() - { - $oneHourAgo = $this->createDateTimeOneHourAgo(); - $response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822))); - $date = $response->getDate(); - $this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present'); - - $response = new Response(); - $date = $response->getDate(); - $this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present'); - - $response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); - $now = $this->createDateTimeNow(); - $response->headers->set('Date', $now->format(DATE_RFC2822)); - $date = $response->getDate(); - $this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the date when the header has been modified'); - - $response = new Response('', 200); - $now = $this->createDateTimeNow(); - $response->headers->remove('Date'); - $date = $response->getDate(); - $this->assertEquals($now->getTimestamp(), $date->getTimestamp(), '->getDate() returns the current Date when the header has previously been removed'); - } - - public function testGetMaxAge() - { - $response = new Response(); - $response->headers->set('Cache-Control', 's-maxage=600, max-age=0'); - $this->assertEquals(600, $response->getMaxAge(), '->getMaxAge() uses s-maxage cache control directive when present'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=600'); - $this->assertEquals(600, $response->getMaxAge(), '->getMaxAge() falls back to max-age when no s-maxage directive present'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'must-revalidate'); - $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822)); - $this->assertEquals(3600, $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'must-revalidate'); - $response->headers->set('Expires', -1); - $this->assertEquals('Sat, 01 Jan 00 00:00:00 +0000', $response->getExpires()->format(DATE_RFC822)); - - $response = new Response(); - $this->assertNull($response->getMaxAge(), '->getMaxAge() returns null if no freshness information available'); - } - - public function testSetSharedMaxAge() - { - $response = new Response(); - $response->setSharedMaxAge(20); - - $cacheControl = $response->headers->get('Cache-Control'); - $this->assertEquals('public, s-maxage=20', $cacheControl); - } - - public function testIsPrivate() - { - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=100'); - $response->setPrivate(); - $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true'); - $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'public, max-age=100'); - $response->setPrivate(); - $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'), '->isPrivate() adds the private Cache-Control directive when set to true'); - $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate() adds the private Cache-Control directive when set to true'); - $this->assertFalse($response->headers->hasCacheControlDirective('public'), '->isPrivate() removes the public Cache-Control directive'); - } - - public function testExpire() - { - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=100'); - $response->expire(); - $this->assertEquals(100, $response->headers->get('Age'), '->expire() sets the Age to max-age when present'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=100, s-maxage=500'); - $response->expire(); - $this->assertEquals(500, $response->headers->get('Age'), '->expire() sets the Age to s-maxage when both max-age and s-maxage are present'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=5, s-maxage=500'); - $response->headers->set('Age', '1000'); - $response->expire(); - $this->assertEquals(1000, $response->headers->get('Age'), '->expire() does nothing when the response is already stale/expired'); - - $response = new Response(); - $response->expire(); - $this->assertFalse($response->headers->has('Age'), '->expire() does nothing when the response does not include freshness information'); - - $response = new Response(); - $response->headers->set('Expires', -1); - $response->expire(); - $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired'); - } - - public function testGetTtl() - { - $response = new Response(); - $this->assertNull($response->getTtl(), '->getTtl() returns null when no Expires or Cache-Control headers are present'); - - $response = new Response(); - $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822)); - $this->assertEquals(3600, $response->getTtl(), '->getTtl() uses the Expires header when no max-age is present'); - - $response = new Response(); - $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)); - $this->assertLessThan(0, $response->getTtl(), '->getTtl() returns negative values when Expires is in past'); - - $response = new Response(); - $response->headers->set('Expires', $response->getDate()->format(DATE_RFC2822)); - $response->headers->set('Age', 0); - $this->assertSame(0, $response->getTtl(), '->getTtl() correctly handles zero'); - - $response = new Response(); - $response->headers->set('Cache-Control', 'max-age=60'); - $this->assertEquals(60, $response->getTtl(), '->getTtl() uses Cache-Control max-age when present'); - } - - public function testSetClientTtl() - { - $response = new Response(); - $response->setClientTtl(10); - - $this->assertEquals($response->getMaxAge(), $response->getAge() + 10); - } - - public function testGetSetProtocolVersion() - { - $response = new Response(); - - $this->assertEquals('1.0', $response->getProtocolVersion()); - - $response->setProtocolVersion('1.1'); - - $this->assertEquals('1.1', $response->getProtocolVersion()); - } - - public function testGetVary() - { - $response = new Response(); - $this->assertEquals(array(), $response->getVary(), '->getVary() returns an empty array if no Vary header is present'); - - $response = new Response(); - $response->headers->set('Vary', 'Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary(), '->getVary() parses a single header name value'); - - $response = new Response(); - $response->headers->set('Vary', 'Accept-Language User-Agent X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by spaces'); - - $response = new Response(); - $response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas'); - - $vary = array('Accept-Language', 'User-Agent', 'X-foo'); - - $response = new Response(); - $response->headers->set('Vary', $vary); - $this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays'); - - $response = new Response(); - $response->headers->set('Vary', 'Accept-Language, User-Agent, X-foo'); - $this->assertEquals($vary, $response->getVary(), '->getVary() parses multiple header name values in arrays'); - } - - public function testSetVary() - { - $response = new Response(); - $response->setVary('Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary()); - - $response->setVary('Accept-Language, User-Agent'); - $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default'); - - $response->setVary('X-Foo', false); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false'); - } - - public function testDefaultContentType() - { - $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock(); - $headerMock->expects($this->at(0)) - ->method('set') - ->with('Content-Type', 'text/html'); - $headerMock->expects($this->at(1)) - ->method('set') - ->with('Content-Type', 'text/html; charset=UTF-8'); - - $response = new Response('foo'); - $response->headers = $headerMock; - - $response->prepare(new Request()); - } - - public function testContentTypeCharset() - { - $response = new Response(); - $response->headers->set('Content-Type', 'text/css'); - - // force fixContentType() to be called - $response->prepare(new Request()); - - $this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type')); - } - - public function testPrepareDoesNothingIfContentTypeIsSet() - { - $response = new Response('foo'); - $response->headers->set('Content-Type', 'text/plain'); - - $response->prepare(new Request()); - - $this->assertEquals('text/plain; charset=UTF-8', $response->headers->get('content-type')); - } - - public function testPrepareDoesNothingIfRequestFormatIsNotDefined() - { - $response = new Response('foo'); - - $response->prepare(new Request()); - - $this->assertEquals('text/html; charset=UTF-8', $response->headers->get('content-type')); - } - - public function testPrepareSetContentType() - { - $response = new Response('foo'); - $request = Request::create('/'); - $request->setRequestFormat('json'); - - $response->prepare($request); - - $this->assertEquals('application/json', $response->headers->get('content-type')); - } - - public function testPrepareRemovesContentForHeadRequests() - { - $response = new Response('foo'); - $request = Request::create('/', 'HEAD'); - - $length = 12345; - $response->headers->set('Content-Length', $length); - $response->prepare($request); - - $this->assertEquals('', $response->getContent()); - $this->assertEquals($length, $response->headers->get('Content-Length'), 'Content-Length should be as if it was GET; see RFC2616 14.13'); - } - - public function testPrepareRemovesContentForInformationalResponse() - { - $response = new Response('foo'); - $request = Request::create('/'); - - $response->setContent('content'); - $response->setStatusCode(101); - $response->prepare($request); - $this->assertEquals('', $response->getContent()); - $this->assertFalse($response->headers->has('Content-Type')); - $this->assertFalse($response->headers->has('Content-Type')); - - $response->setContent('content'); - $response->setStatusCode(304); - $response->prepare($request); - $this->assertEquals('', $response->getContent()); - $this->assertFalse($response->headers->has('Content-Type')); - $this->assertFalse($response->headers->has('Content-Length')); - } - - public function testPrepareRemovesContentLength() - { - $response = new Response('foo'); - $request = Request::create('/'); - - $response->headers->set('Content-Length', 12345); - $response->prepare($request); - $this->assertEquals(12345, $response->headers->get('Content-Length')); - - $response->headers->set('Transfer-Encoding', 'chunked'); - $response->prepare($request); - $this->assertFalse($response->headers->has('Content-Length')); - } - - public function testPrepareSetsPragmaOnHttp10Only() - { - $request = Request::create('/', 'GET'); - $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0'); - - $response = new Response('foo'); - $response->prepare($request); - $this->assertEquals('no-cache', $response->headers->get('pragma')); - $this->assertEquals('-1', $response->headers->get('expires')); - - $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); - $response = new Response('foo'); - $response->prepare($request); - $this->assertFalse($response->headers->has('pragma')); - $this->assertFalse($response->headers->has('expires')); - } - - public function testSetCache() - { - $response = new Response(); - //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public') - try { - $response->setCache(array('wrong option' => 'value')); - $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported'); - $this->assertContains('"wrong option"', $e->getMessage()); - } - - $options = array('etag' => '"whatever"'); - $response->setCache($options); - $this->assertEquals($response->getEtag(), '"whatever"'); - - $now = $this->createDateTimeNow(); - $options = array('last_modified' => $now); - $response->setCache($options); - $this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp()); - - $options = array('max_age' => 100); - $response->setCache($options); - $this->assertEquals($response->getMaxAge(), 100); - - $options = array('s_maxage' => 200); - $response->setCache($options); - $this->assertEquals($response->getMaxAge(), 200); - - $this->assertTrue($response->headers->hasCacheControlDirective('public')); - $this->assertFalse($response->headers->hasCacheControlDirective('private')); - - $response->setCache(array('public' => true)); - $this->assertTrue($response->headers->hasCacheControlDirective('public')); - $this->assertFalse($response->headers->hasCacheControlDirective('private')); - - $response->setCache(array('public' => false)); - $this->assertFalse($response->headers->hasCacheControlDirective('public')); - $this->assertTrue($response->headers->hasCacheControlDirective('private')); - - $response->setCache(array('private' => true)); - $this->assertFalse($response->headers->hasCacheControlDirective('public')); - $this->assertTrue($response->headers->hasCacheControlDirective('private')); - - $response->setCache(array('private' => false)); - $this->assertTrue($response->headers->hasCacheControlDirective('public')); - $this->assertFalse($response->headers->hasCacheControlDirective('private')); - } - - public function testSendContent() - { - $response = new Response('test response rendering', 200); - - ob_start(); - $response->sendContent(); - $string = ob_get_clean(); - $this->assertContains('test response rendering', $string); - } - - public function testSetPublic() - { - $response = new Response(); - $response->setPublic(); - - $this->assertTrue($response->headers->hasCacheControlDirective('public')); - $this->assertFalse($response->headers->hasCacheControlDirective('private')); - } - - public function testSetExpires() - { - $response = new Response(); - $response->setExpires(null); - - $this->assertNull($response->getExpires(), '->setExpires() remove the header when passed null'); - - $now = $this->createDateTimeNow(); - $response->setExpires($now); - - $this->assertEquals($response->getExpires()->getTimestamp(), $now->getTimestamp()); - } - - public function testSetLastModified() - { - $response = new Response(); - $response->setLastModified($this->createDateTimeNow()); - $this->assertNotNull($response->getLastModified()); - - $response->setLastModified(null); - $this->assertNull($response->getLastModified()); - } - - public function testIsInvalid() - { - $response = new Response(); - - try { - $response->setStatusCode(99); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertTrue($response->isInvalid()); - } - - try { - $response->setStatusCode(650); - $this->fail(); - } catch (\InvalidArgumentException $e) { - $this->assertTrue($response->isInvalid()); - } - - $response = new Response('', 200); - $this->assertFalse($response->isInvalid()); - } - - /** - * @dataProvider getStatusCodeFixtures - */ - public function testSetStatusCode($code, $text, $expectedText) - { - $response = new Response(); - - $response->setStatusCode($code, $text); - - $statusText = new \ReflectionProperty($response, 'statusText'); - $statusText->setAccessible(true); - - $this->assertEquals($expectedText, $statusText->getValue($response)); - } - - public function getStatusCodeFixtures() - { - return array( - array('200', null, 'OK'), - array('200', false, ''), - array('200', 'foo', 'foo'), - array('199', null, 'unknown status'), - array('199', false, ''), - array('199', 'foo', 'foo'), - ); - } - - public function testIsInformational() - { - $response = new Response('', 100); - $this->assertTrue($response->isInformational()); - - $response = new Response('', 200); - $this->assertFalse($response->isInformational()); - } - - public function testIsRedirectRedirection() - { - foreach (array(301, 302, 303, 307) as $code) { - $response = new Response('', $code); - $this->assertTrue($response->isRedirection()); - $this->assertTrue($response->isRedirect()); - } - - $response = new Response('', 304); - $this->assertTrue($response->isRedirection()); - $this->assertFalse($response->isRedirect()); - - $response = new Response('', 200); - $this->assertFalse($response->isRedirection()); - $this->assertFalse($response->isRedirect()); - - $response = new Response('', 404); - $this->assertFalse($response->isRedirection()); - $this->assertFalse($response->isRedirect()); - - $response = new Response('', 301, array('Location' => '/good-uri')); - $this->assertFalse($response->isRedirect('/bad-uri')); - $this->assertTrue($response->isRedirect('/good-uri')); - } - - public function testIsNotFound() - { - $response = new Response('', 404); - $this->assertTrue($response->isNotFound()); - - $response = new Response('', 200); - $this->assertFalse($response->isNotFound()); - } - - public function testIsEmpty() - { - foreach (array(204, 304) as $code) { - $response = new Response('', $code); - $this->assertTrue($response->isEmpty()); - } - - $response = new Response('', 200); - $this->assertFalse($response->isEmpty()); - } - - public function testIsForbidden() - { - $response = new Response('', 403); - $this->assertTrue($response->isForbidden()); - - $response = new Response('', 200); - $this->assertFalse($response->isForbidden()); - } - - public function testIsOk() - { - $response = new Response('', 200); - $this->assertTrue($response->isOk()); - - $response = new Response('', 404); - $this->assertFalse($response->isOk()); - } - - public function testIsServerOrClientError() - { - $response = new Response('', 404); - $this->assertTrue($response->isClientError()); - $this->assertFalse($response->isServerError()); - - $response = new Response('', 500); - $this->assertFalse($response->isClientError()); - $this->assertTrue($response->isServerError()); - } - - public function testHasVary() - { - $response = new Response(); - $this->assertFalse($response->hasVary()); - - $response->setVary('User-Agent'); - $this->assertTrue($response->hasVary()); - } - - public function testSetEtag() - { - $response = new Response('', 200, array('ETag' => '"12345"')); - $response->setEtag(); - - $this->assertNull($response->headers->get('Etag'), '->setEtag() removes Etags when call with null'); - } - - /** - * @dataProvider validContentProvider - */ - public function testSetContent($content) - { - $response = new Response(); - $response->setContent($content); - $this->assertEquals((string) $content, $response->getContent()); - } - - /** - * @expectedException \UnexpectedValueException - * @dataProvider invalidContentProvider - */ - public function testSetContentInvalid($content) - { - $response = new Response(); - $response->setContent($content); - } - - public function testSettersAreChainable() - { - $response = new Response(); - - $setters = array( - 'setProtocolVersion' => '1.0', - 'setCharset' => 'UTF-8', - 'setPublic' => null, - 'setPrivate' => null, - 'setDate' => $this->createDateTimeNow(), - 'expire' => null, - 'setMaxAge' => 1, - 'setSharedMaxAge' => 1, - 'setTtl' => 1, - 'setClientTtl' => 1, - ); - - foreach ($setters as $setter => $arg) { - $this->assertEquals($response, $response->{$setter}($arg)); - } - } - - public function testNoDeprecationsAreTriggered() - { - new DefaultResponse(); - $this->getMockBuilder(Response::class)->getMock(); - - // we just need to ensure that subclasses of Response can be created without any deprecations - // being triggered if the subclass does not override any final methods - $this->addToAssertionCount(1); - } - - public function validContentProvider() - { - return array( - 'obj' => array(new StringableObject()), - 'string' => array('Foo'), - 'int' => array(2), - ); - } - - public function invalidContentProvider() - { - return array( - 'obj' => array(new \stdClass()), - 'array' => array(array()), - 'bool' => array(true, '1'), - ); - } - - protected function createDateTimeOneHourAgo() - { - return $this->createDateTimeNow()->sub(new \DateInterval('PT1H')); - } - - protected function createDateTimeOneHourLater() - { - return $this->createDateTimeNow()->add(new \DateInterval('PT1H')); - } - - protected function createDateTimeNow() - { - $date = new \DateTime(); - - return $date->setTimestamp(time()); - } - - protected function provideResponse() - { - return new Response(); - } - - /** - * @see http://github.com/zendframework/zend-diactoros for the canonical source repository - * - * @author Fábio Pacheco - * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) - * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License - */ - public function ianaCodesReasonPhrasesProvider() - { - if (!in_array('https', stream_get_wrappers(), true)) { - $this->markTestSkipped('The "https" wrapper is not available'); - } - - $ianaHttpStatusCodes = new \DOMDocument(); - - libxml_set_streams_context(stream_context_create(array( - 'http' => array( - 'method' => 'GET', - 'timeout' => 30, - ), - ))); - - $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); - if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { - self::fail('Invalid IANA\'s HTTP status code list.'); - } - - $ianaCodesReasonPhrases = array(); - - $xpath = new \DomXPath($ianaHttpStatusCodes); - $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); - - $records = $xpath->query('//ns:record'); - foreach ($records as $record) { - $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; - $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; - - if (in_array($description, array('Unassigned', '(Unused)'), true)) { - continue; - } - - if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) { - for ($value = $matches[1]; $value <= $matches[2]; ++$value) { - $ianaCodesReasonPhrases[] = array($value, $description); - } - } else { - $ianaCodesReasonPhrases[] = array($value, $description); - } - } - - return $ianaCodesReasonPhrases; - } - - /** - * @dataProvider ianaCodesReasonPhrasesProvider - */ - public function testReasonPhraseDefaultsAgainstIana($code, $reasonPhrase) - { - $this->assertEquals($reasonPhrase, Response::$statusTexts[$code]); - } -} - -class StringableObject -{ - public function __toString() - { - return 'Foo'; - } -} - -class DefaultResponse extends Response -{ -} - -class ExtendedResponse extends Response -{ - public function setLastModified(\DateTime $date = null) - { - } - - public function getDate() - { - } -} diff --git a/vendor/symfony/http-foundation/Tests/ResponseTestCase.php b/vendor/symfony/http-foundation/Tests/ResponseTestCase.php deleted file mode 100644 index 4ead34c..0000000 --- a/vendor/symfony/http-foundation/Tests/ResponseTestCase.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; - -abstract class ResponseTestCase extends TestCase -{ - public function testNoCacheControlHeaderOnAttachmentUsingHTTPSAndMSIE() - { - // Check for HTTPS and IE 8 - $request = new Request(); - $request->server->set('HTTPS', true); - $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertFalse($response->headers->has('Cache-Control')); - - // Check for IE 10 and HTTPS - $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - - // Check for IE 9 and HTTPS - $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)'); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - - // Check for IE 9 and HTTP - $request->server->set('HTTPS', false); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - - // Check for IE 8 and HTTP - $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - - // Check for non-IE and HTTPS - $request->server->set('HTTPS', true); - $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17'); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - - // Check for non-IE and HTTP - $request->server->set('HTTPS', false); - - $response = $this->provideResponse(); - $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); - $response->prepare($request); - - $this->assertTrue($response->headers->has('Cache-Control')); - } - - abstract protected function provideResponse(); -} diff --git a/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/vendor/symfony/http-foundation/Tests/ServerBagTest.php deleted file mode 100644 index c1d9d12..0000000 --- a/vendor/symfony/http-foundation/Tests/ServerBagTest.php +++ /dev/null @@ -1,170 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ServerBag; - -/** - * ServerBagTest. - * - * @author Bulat Shakirzyanov - */ -class ServerBagTest extends TestCase -{ - public function testShouldExtractHeadersFromServerArray() - { - $server = array( - 'SOME_SERVER_VARIABLE' => 'value', - 'SOME_SERVER_VARIABLE2' => 'value', - 'ROOT' => 'value', - 'HTTP_CONTENT_TYPE' => 'text/html', - 'HTTP_CONTENT_LENGTH' => '0', - 'HTTP_ETAG' => 'asdf', - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => 'bar', - ); - - $bag = new ServerBag($server); - - $this->assertEquals(array( - 'CONTENT_TYPE' => 'text/html', - 'CONTENT_LENGTH' => '0', - 'ETAG' => 'asdf', - 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); - } - - public function testHttpPasswordIsOptional() - { - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo')); - - $this->assertEquals(array( - 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); - } - - public function testHttpBasicAuthWithPhpCgi() - { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'))); - - $this->assertEquals(array( - 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); - } - - public function testHttpBasicAuthWithPhpCgiBogus() - { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar'))); - - // Username and passwords should not be set as the header is bogus - $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); - } - - public function testHttpBasicAuthWithPhpCgiRedirect() - { - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'))); - - $this->assertEquals(array( - 'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'), - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'pass:word', - ), $bag->getHeaders()); - } - - public function testHttpBasicAuthWithPhpCgiEmptyPassword() - { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:'))); - - $this->assertEquals(array( - 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); - } - - public function testHttpDigestAuthWithPhpCgi() - { - $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); - - $this->assertEquals(array( - 'AUTHORIZATION' => $digest, - 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); - } - - public function testHttpDigestAuthWithPhpCgiBogus() - { - $digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); - - // Username and passwords should not be set as the header is bogus - $headers = $bag->getHeaders(); - $this->assertFalse(isset($headers['PHP_AUTH_USER'])); - $this->assertFalse(isset($headers['PHP_AUTH_PW'])); - } - - public function testHttpDigestAuthWithPhpCgiRedirect() - { - $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $digest)); - - $this->assertEquals(array( - 'AUTHORIZATION' => $digest, - 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); - } - - public function testOAuthBearerAuth() - { - $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent)); - - $this->assertEquals(array( - 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); - } - - public function testOAuthBearerAuthWithRedirect() - { - $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $headerContent)); - - $this->assertEquals(array( - 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); - } - - /** - * @see https://github.com/symfony/symfony/issues/17345 - */ - public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet() - { - $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent)); - - $this->assertEquals(array( - 'AUTHORIZATION' => $headerContent, - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php deleted file mode 100644 index 8c148b5..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php +++ /dev/null @@ -1,189 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; - -/** - * Tests AttributeBag. - * - * @author Drak - */ -class AttributeBagTest extends TestCase -{ - /** - * @var array - */ - private $array; - - /** - * @var AttributeBag - */ - private $bag; - - protected function setUp() - { - $this->array = array( - 'hello' => 'world', - 'always' => 'be happy', - 'user.login' => 'drak', - 'csrf.token' => array( - 'a' => '1234', - 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( - 'first' => 'cod', - 'second' => 'sole', - ), - ), - ); - $this->bag = new AttributeBag('_sf2'); - $this->bag->initialize($this->array); - } - - protected function tearDown() - { - $this->bag = null; - $this->array = array(); - } - - public function testInitialize() - { - $bag = new AttributeBag(); - $bag->initialize($this->array); - $this->assertEquals($this->array, $bag->all()); - $array = array('should' => 'change'); - $bag->initialize($array); - $this->assertEquals($array, $bag->all()); - } - - public function testGetStorageKey() - { - $this->assertEquals('_sf2', $this->bag->getStorageKey()); - $attributeBag = new AttributeBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); - } - - public function testGetSetName() - { - $this->assertEquals('attributes', $this->bag->getName()); - $this->bag->setName('foo'); - $this->assertEquals('foo', $this->bag->getName()); - } - - /** - * @dataProvider attributesProvider - */ - public function testHas($key, $value, $exists) - { - $this->assertEquals($exists, $this->bag->has($key)); - } - - /** - * @dataProvider attributesProvider - */ - public function testGet($key, $value, $expected) - { - $this->assertEquals($value, $this->bag->get($key)); - } - - public function testGetDefaults() - { - $this->assertNull($this->bag->get('user2.login')); - $this->assertEquals('default', $this->bag->get('user2.login', 'default')); - } - - /** - * @dataProvider attributesProvider - */ - public function testSet($key, $value, $expected) - { - $this->bag->set($key, $value); - $this->assertEquals($value, $this->bag->get($key)); - } - - public function testAll() - { - $this->assertEquals($this->array, $this->bag->all()); - - $this->bag->set('hello', 'fabien'); - $array = $this->array; - $array['hello'] = 'fabien'; - $this->assertEquals($array, $this->bag->all()); - } - - public function testReplace() - { - $array = array(); - $array['name'] = 'jack'; - $array['foo.bar'] = 'beep'; - $this->bag->replace($array); - $this->assertEquals($array, $this->bag->all()); - $this->assertNull($this->bag->get('hello')); - $this->assertNull($this->bag->get('always')); - $this->assertNull($this->bag->get('user.login')); - } - - public function testRemove() - { - $this->assertEquals('world', $this->bag->get('hello')); - $this->bag->remove('hello'); - $this->assertNull($this->bag->get('hello')); - - $this->assertEquals('be happy', $this->bag->get('always')); - $this->bag->remove('always'); - $this->assertNull($this->bag->get('always')); - - $this->assertEquals('drak', $this->bag->get('user.login')); - $this->bag->remove('user.login'); - $this->assertNull($this->bag->get('user.login')); - } - - public function testClear() - { - $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); - } - - public function attributesProvider() - { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); - } - - public function testGetIterator() - { - $i = 0; - foreach ($this->bag as $key => $val) { - $this->assertEquals($this->array[$key], $val); - ++$i; - } - - $this->assertEquals(count($this->array), $i); - } - - public function testCount() - { - $this->assertEquals(count($this->array), count($this->bag)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php deleted file mode 100644 index d9d9eb7..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag; - -/** - * Tests NamespacedAttributeBag. - * - * @author Drak - */ -class NamespacedAttributeBagTest extends TestCase -{ - /** - * @var array - */ - private $array; - - /** - * @var NamespacedAttributeBag - */ - private $bag; - - protected function setUp() - { - $this->array = array( - 'hello' => 'world', - 'always' => 'be happy', - 'user.login' => 'drak', - 'csrf.token' => array( - 'a' => '1234', - 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( - 'first' => 'cod', - 'second' => 'sole', - ), - ), - ); - $this->bag = new NamespacedAttributeBag('_sf2', '/'); - $this->bag->initialize($this->array); - } - - protected function tearDown() - { - $this->bag = null; - $this->array = array(); - } - - public function testInitialize() - { - $bag = new NamespacedAttributeBag(); - $bag->initialize($this->array); - $this->assertEquals($this->array, $this->bag->all()); - $array = array('should' => 'not stick'); - $bag->initialize($array); - - // should have remained the same - $this->assertEquals($this->array, $this->bag->all()); - } - - public function testGetStorageKey() - { - $this->assertEquals('_sf2', $this->bag->getStorageKey()); - $attributeBag = new NamespacedAttributeBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); - } - - /** - * @dataProvider attributesProvider - */ - public function testHas($key, $value, $exists) - { - $this->assertEquals($exists, $this->bag->has($key)); - } - - /** - * @dataProvider attributesProvider - */ - public function testGet($key, $value, $expected) - { - $this->assertEquals($value, $this->bag->get($key)); - } - - public function testGetDefaults() - { - $this->assertNull($this->bag->get('user2.login')); - $this->assertEquals('default', $this->bag->get('user2.login', 'default')); - } - - /** - * @dataProvider attributesProvider - */ - public function testSet($key, $value, $expected) - { - $this->bag->set($key, $value); - $this->assertEquals($value, $this->bag->get($key)); - } - - public function testAll() - { - $this->assertEquals($this->array, $this->bag->all()); - - $this->bag->set('hello', 'fabien'); - $array = $this->array; - $array['hello'] = 'fabien'; - $this->assertEquals($array, $this->bag->all()); - } - - public function testReplace() - { - $array = array(); - $array['name'] = 'jack'; - $array['foo.bar'] = 'beep'; - $this->bag->replace($array); - $this->assertEquals($array, $this->bag->all()); - $this->assertNull($this->bag->get('hello')); - $this->assertNull($this->bag->get('always')); - $this->assertNull($this->bag->get('user.login')); - } - - public function testRemove() - { - $this->assertEquals('world', $this->bag->get('hello')); - $this->bag->remove('hello'); - $this->assertNull($this->bag->get('hello')); - - $this->assertEquals('be happy', $this->bag->get('always')); - $this->bag->remove('always'); - $this->assertNull($this->bag->get('always')); - - $this->assertEquals('drak', $this->bag->get('user.login')); - $this->bag->remove('user.login'); - $this->assertNull($this->bag->get('user.login')); - } - - public function testRemoveExistingNamespacedAttribute() - { - $this->assertSame('cod', $this->bag->remove('category/fishing/first')); - } - - public function testRemoveNonexistingNamespacedAttribute() - { - $this->assertNull($this->bag->remove('foo/bar/baz')); - } - - public function testClear() - { - $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); - } - - public function attributesProvider() - { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('csrf.token/a', '1234', true), - array('csrf.token/b', '4321', true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true), - array('category/fishing/missing/first', null, false), - array('category/fishing/first', 'cod', true), - array('category/fishing/second', 'sole', true), - array('category/fishing/missing/second', null, false), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php deleted file mode 100644 index 4eb200a..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Flash; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag; - -/** - * AutoExpireFlashBagTest. - * - * @author Drak - */ -class AutoExpireFlashBagTest extends TestCase -{ - /** - * @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag - */ - private $bag; - - /** - * @var array - */ - protected $array = array(); - - protected function setUp() - { - parent::setUp(); - $this->bag = new FlashBag(); - $this->array = array('new' => array('notice' => array('A previous flash message'))); - $this->bag->initialize($this->array); - } - - protected function tearDown() - { - $this->bag = null; - parent::tearDown(); - } - - public function testInitialize() - { - $bag = new FlashBag(); - $array = array('new' => array('notice' => array('A previous flash message'))); - $bag->initialize($array); - $this->assertEquals(array('A previous flash message'), $bag->peek('notice')); - $array = array('new' => array( - 'notice' => array('Something else'), - 'error' => array('a'), - )); - $bag->initialize($array); - $this->assertEquals(array('Something else'), $bag->peek('notice')); - $this->assertEquals(array('a'), $bag->peek('error')); - } - - public function testGetStorageKey() - { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); - $attributeBag = new FlashBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); - } - - public function testGetSetName() - { - $this->assertEquals('flashes', $this->bag->getName()); - $this->bag->setName('foo'); - $this->assertEquals('foo', $this->bag->getName()); - } - - public function testPeek() - { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - } - - public function testSet() - { - $this->bag->set('notice', 'Foo'); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - } - - public function testHas() - { - $this->assertFalse($this->bag->has('nothing')); - $this->assertTrue($this->bag->has('notice')); - } - - public function testKeys() - { - $this->assertEquals(array('notice'), $this->bag->keys()); - } - - public function testPeekAll() - { - $array = array( - 'new' => array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), - ); - - $this->bag->initialize($array); - $this->assertEquals(array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), $this->bag->peekAll() - ); - - $this->assertEquals(array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), $this->bag->peekAll() - ); - } - - public function testGet() - { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); - } - - public function testSetAll() - { - $this->bag->setAll(array('a' => 'first', 'b' => 'second')); - $this->assertFalse($this->bag->has('a')); - $this->assertFalse($this->bag->has('b')); - } - - public function testAll() - { - $this->bag->set('notice', 'Foo'); - $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('A previous flash message'), - ), $this->bag->all() - ); - - $this->assertEquals(array(), $this->bag->all()); - } - - public function testClear() - { - $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php deleted file mode 100644 index f0aa6a6..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Flash; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; - -/** - * FlashBagTest. - * - * @author Drak - */ -class FlashBagTest extends TestCase -{ - /** - * @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface - */ - private $bag; - - /** - * @var array - */ - protected $array = array(); - - protected function setUp() - { - parent::setUp(); - $this->bag = new FlashBag(); - $this->array = array('notice' => array('A previous flash message')); - $this->bag->initialize($this->array); - } - - protected function tearDown() - { - $this->bag = null; - parent::tearDown(); - } - - public function testInitialize() - { - $bag = new FlashBag(); - $bag->initialize($this->array); - $this->assertEquals($this->array, $bag->peekAll()); - $array = array('should' => array('change')); - $bag->initialize($array); - $this->assertEquals($array, $bag->peekAll()); - } - - public function testGetStorageKey() - { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); - $attributeBag = new FlashBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); - } - - public function testGetSetName() - { - $this->assertEquals('flashes', $this->bag->getName()); - $this->bag->setName('foo'); - $this->assertEquals('foo', $this->bag->getName()); - } - - public function testPeek() - { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - } - - public function testGet() - { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); - } - - public function testAll() - { - $this->bag->set('notice', 'Foo'); - $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), ), $this->bag->all() - ); - - $this->assertEquals(array(), $this->bag->all()); - } - - public function testSet() - { - $this->bag->set('notice', 'Foo'); - $this->bag->set('notice', 'Bar'); - $this->assertEquals(array('Bar'), $this->bag->peek('notice')); - } - - public function testHas() - { - $this->assertFalse($this->bag->has('nothing')); - $this->assertTrue($this->bag->has('notice')); - } - - public function testKeys() - { - $this->assertEquals(array('notice'), $this->bag->keys()); - } - - public function testPeekAll() - { - $this->bag->set('notice', 'Foo'); - $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() - ); - $this->assertTrue($this->bag->has('notice')); - $this->assertTrue($this->bag->has('error')); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() - ); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php deleted file mode 100644 index fa93507..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ /dev/null @@ -1,224 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; - -/** - * SessionTest. - * - * @author Fabien Potencier - * @author Robert Schönthal - * @author Drak - */ -class SessionTest extends TestCase -{ - /** - * @var \Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface - */ - protected $storage; - - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - protected $session; - - protected function setUp() - { - $this->storage = new MockArraySessionStorage(); - $this->session = new Session($this->storage, new AttributeBag(), new FlashBag()); - } - - protected function tearDown() - { - $this->storage = null; - $this->session = null; - } - - public function testStart() - { - $this->assertEquals('', $this->session->getId()); - $this->assertTrue($this->session->start()); - $this->assertNotEquals('', $this->session->getId()); - } - - public function testIsStarted() - { - $this->assertFalse($this->session->isStarted()); - $this->session->start(); - $this->assertTrue($this->session->isStarted()); - } - - public function testSetId() - { - $this->assertEquals('', $this->session->getId()); - $this->session->setId('0123456789abcdef'); - $this->session->start(); - $this->assertEquals('0123456789abcdef', $this->session->getId()); - } - - public function testSetName() - { - $this->assertEquals('MOCKSESSID', $this->session->getName()); - $this->session->setName('session.test.com'); - $this->session->start(); - $this->assertEquals('session.test.com', $this->session->getName()); - } - - public function testGet() - { - // tests defaults - $this->assertNull($this->session->get('foo')); - $this->assertEquals(1, $this->session->get('foo', 1)); - } - - /** - * @dataProvider setProvider - */ - public function testSet($key, $value) - { - $this->session->set($key, $value); - $this->assertEquals($value, $this->session->get($key)); - } - - /** - * @dataProvider setProvider - */ - public function testHas($key, $value) - { - $this->session->set($key, $value); - $this->assertTrue($this->session->has($key)); - $this->assertFalse($this->session->has($key.'non_value')); - } - - public function testReplace() - { - $this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome')); - $this->assertEquals(array('happiness' => 'be good', 'symfony' => 'awesome'), $this->session->all()); - $this->session->replace(array()); - $this->assertEquals(array(), $this->session->all()); - } - - /** - * @dataProvider setProvider - */ - public function testAll($key, $value, $result) - { - $this->session->set($key, $value); - $this->assertEquals($result, $this->session->all()); - } - - /** - * @dataProvider setProvider - */ - public function testClear($key, $value) - { - $this->session->set('hi', 'fabien'); - $this->session->set($key, $value); - $this->session->clear(); - $this->assertEquals(array(), $this->session->all()); - } - - public function setProvider() - { - return array( - array('foo', 'bar', array('foo' => 'bar')), - array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')), - array('great', 'symfony is great', array('great' => 'symfony is great')), - ); - } - - /** - * @dataProvider setProvider - */ - public function testRemove($key, $value) - { - $this->session->set('hi.world', 'have a nice day'); - $this->session->set($key, $value); - $this->session->remove($key); - $this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all()); - } - - public function testInvalidate() - { - $this->session->set('invalidate', 123); - $this->session->invalidate(); - $this->assertEquals(array(), $this->session->all()); - } - - public function testMigrate() - { - $this->session->set('migrate', 321); - $this->session->migrate(); - $this->assertEquals(321, $this->session->get('migrate')); - } - - public function testMigrateDestroy() - { - $this->session->set('migrate', 333); - $this->session->migrate(true); - $this->assertEquals(333, $this->session->get('migrate')); - } - - public function testSave() - { - $this->session->start(); - $this->session->save(); - - $this->assertFalse($this->session->isStarted()); - } - - public function testGetId() - { - $this->assertEquals('', $this->session->getId()); - $this->session->start(); - $this->assertNotEquals('', $this->session->getId()); - } - - public function testGetFlashBag() - { - $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface', $this->session->getFlashBag()); - } - - public function testGetIterator() - { - $attributes = array('hello' => 'world', 'symfony' => 'rocks'); - foreach ($attributes as $key => $val) { - $this->session->set($key, $val); - } - - $i = 0; - foreach ($this->session as $key => $val) { - $this->assertEquals($attributes[$key], $val); - ++$i; - } - - $this->assertEquals(count($attributes), $i); - } - - public function testGetCount() - { - $this->session->set('hello', 'world'); - $this->session->set('symfony', 'rocks'); - - $this->assertCount(2, $this->session); - } - - public function testGetMeta() - { - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\MetadataBag', $this->session->getMetadataBag()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php deleted file mode 100644 index 06193c8..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler; - -/** - * @requires extension memcache - * @group time-sensitive - */ -class MemcacheSessionHandlerTest extends TestCase -{ - const PREFIX = 'prefix_'; - const TTL = 1000; - /** - * @var MemcacheSessionHandler - */ - protected $storage; - - protected $memcache; - - protected function setUp() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); - } - - parent::setUp(); - $this->memcache = $this->getMockBuilder('Memcache')->getMock(); - $this->storage = new MemcacheSessionHandler( - $this->memcache, - array('prefix' => self::PREFIX, 'expiretime' => self::TTL) - ); - } - - protected function tearDown() - { - $this->memcache = null; - $this->storage = null; - parent::tearDown(); - } - - public function testOpenSession() - { - $this->assertTrue($this->storage->open('', '')); - } - - public function testCloseSession() - { - $this->assertTrue($this->storage->close()); - } - - public function testReadSession() - { - $this->memcache - ->expects($this->once()) - ->method('get') - ->with(self::PREFIX.'id') - ; - - $this->assertEquals('', $this->storage->read('id')); - } - - public function testWriteSession() - { - $this->memcache - ->expects($this->once()) - ->method('set') - ->with(self::PREFIX.'id', 'data', 0, $this->equalTo(time() + self::TTL, 2)) - ->will($this->returnValue(true)) - ; - - $this->assertTrue($this->storage->write('id', 'data')); - } - - public function testDestroySession() - { - $this->memcache - ->expects($this->once()) - ->method('delete') - ->with(self::PREFIX.'id') - ->will($this->returnValue(true)) - ; - - $this->assertTrue($this->storage->destroy('id')); - } - - public function testGcSession() - { - $this->assertTrue($this->storage->gc(123)); - } - - /** - * @dataProvider getOptionFixtures - */ - public function testSupportedOptions($options, $supported) - { - try { - new MemcacheSessionHandler($this->memcache, $options); - $this->assertTrue($supported); - } catch (\InvalidArgumentException $e) { - $this->assertFalse($supported); - } - } - - public function getOptionFixtures() - { - return array( - array(array('prefix' => 'session'), true), - array(array('expiretime' => 100), true), - array(array('prefix' => 'session', 'expiretime' => 200), true), - array(array('expiretime' => 100, 'foo' => 'bar'), false), - ); - } - - public function testGetConnection() - { - $method = new \ReflectionMethod($this->storage, 'getMemcache'); - $method->setAccessible(true); - - $this->assertInstanceOf('\Memcache', $method->invoke($this->storage)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php deleted file mode 100644 index 2e7be35..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler; - -/** - * @requires extension memcached - * @group time-sensitive - */ -class MemcachedSessionHandlerTest extends TestCase -{ - const PREFIX = 'prefix_'; - const TTL = 1000; - - /** - * @var MemcachedSessionHandler - */ - protected $storage; - - protected $memcached; - - protected function setUp() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); - } - - parent::setUp(); - - if (version_compare(phpversion('memcached'), '2.2.0', '>=') && version_compare(phpversion('memcached'), '3.0.0b1', '<')) { - $this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower, or 3.0.0b1 or higher'); - } - - $this->memcached = $this->getMockBuilder('Memcached')->getMock(); - $this->storage = new MemcachedSessionHandler( - $this->memcached, - array('prefix' => self::PREFIX, 'expiretime' => self::TTL) - ); - } - - protected function tearDown() - { - $this->memcached = null; - $this->storage = null; - parent::tearDown(); - } - - public function testOpenSession() - { - $this->assertTrue($this->storage->open('', '')); - } - - public function testCloseSession() - { - $this->assertTrue($this->storage->close()); - } - - public function testReadSession() - { - $this->memcached - ->expects($this->once()) - ->method('get') - ->with(self::PREFIX.'id') - ; - - $this->assertEquals('', $this->storage->read('id')); - } - - public function testWriteSession() - { - $this->memcached - ->expects($this->once()) - ->method('set') - ->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2)) - ->will($this->returnValue(true)) - ; - - $this->assertTrue($this->storage->write('id', 'data')); - } - - public function testDestroySession() - { - $this->memcached - ->expects($this->once()) - ->method('delete') - ->with(self::PREFIX.'id') - ->will($this->returnValue(true)) - ; - - $this->assertTrue($this->storage->destroy('id')); - } - - public function testGcSession() - { - $this->assertTrue($this->storage->gc(123)); - } - - /** - * @dataProvider getOptionFixtures - */ - public function testSupportedOptions($options, $supported) - { - try { - new MemcachedSessionHandler($this->memcached, $options); - $this->assertTrue($supported); - } catch (\InvalidArgumentException $e) { - $this->assertFalse($supported); - } - } - - public function getOptionFixtures() - { - return array( - array(array('prefix' => 'session'), true), - array(array('expiretime' => 100), true), - array(array('prefix' => 'session', 'expiretime' => 200), true), - array(array('expiretime' => 100, 'foo' => 'bar'), false), - ); - } - - public function testGetConnection() - { - $method = new \ReflectionMethod($this->storage, 'getMemcached'); - $method->setAccessible(true); - - $this->assertInstanceOf('\Memcached', $method->invoke($this->storage)); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php deleted file mode 100644 index b5fee8e..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ /dev/null @@ -1,332 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler; - -/** - * @author Markus Bachmann - * @group time-sensitive - */ -class MongoDbSessionHandlerTest extends TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $mongo; - private $storage; - public $options; - - protected function setUp() - { - parent::setUp(); - - if (extension_loaded('mongodb')) { - if (!class_exists('MongoDB\Client')) { - $this->markTestSkipped('The mongodb/mongodb package is required.'); - } - } elseif (!extension_loaded('mongo')) { - $this->markTestSkipped('The Mongo or MongoDB extension is required.'); - } - - if (phpversion('mongodb')) { - $mongoClass = 'MongoDB\Client'; - } else { - $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; - } - - $this->mongo = $this->getMockBuilder($mongoClass) - ->disableOriginalConstructor() - ->getMock(); - - $this->options = array( - 'id_field' => '_id', - 'data_field' => 'data', - 'time_field' => 'time', - 'expiry_field' => 'expires_at', - 'database' => 'sf2-test', - 'collection' => 'session-test', - ); - - $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForInvalidMongo() - { - new MongoDbSessionHandler(new \stdClass(), $this->options); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testConstructorShouldThrowExceptionForMissingOptions() - { - new MongoDbSessionHandler($this->mongo, array()); - } - - public function testOpenMethodAlwaysReturnTrue() - { - $this->assertTrue($this->storage->open('test', 'test'), 'The "open" method should always return true'); - } - - public function testCloseMethodAlwaysReturnTrue() - { - $this->assertTrue($this->storage->close(), 'The "close" method should always return true'); - } - - public function testRead() - { - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - // defining the timeout before the actual method call - // allows to test for "greater than" values in the $criteria - $testTimeout = time() + 1; - - $collection->expects($this->once()) - ->method('findOne') - ->will($this->returnCallback(function ($criteria) use ($testTimeout) { - $this->assertArrayHasKey($this->options['id_field'], $criteria); - $this->assertEquals($criteria[$this->options['id_field']], 'foo'); - - $this->assertArrayHasKey($this->options['expiry_field'], $criteria); - $this->assertArrayHasKey('$gte', $criteria[$this->options['expiry_field']]); - - if (phpversion('mongodb')) { - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$gte']); - $this->assertGreaterThanOrEqual(round((string) $criteria[$this->options['expiry_field']]['$gte'] / 1000), $testTimeout); - } else { - $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']); - $this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout); - } - - $fields = array( - $this->options['id_field'] => 'foo', - ); - - if (phpversion('mongodb')) { - $fields[$this->options['data_field']] = new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY); - $fields[$this->options['id_field']] = new \MongoDB\BSON\UTCDateTime(time() * 1000); - } else { - $fields[$this->options['data_field']] = new \MongoBinData('bar', \MongoBinData::BYTE_ARRAY); - $fields[$this->options['id_field']] = new \MongoDate(); - } - - return $fields; - })); - - $this->assertEquals('bar', $this->storage->read('foo')); - } - - public function testWrite() - { - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - $data = array(); - - $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; - - $collection->expects($this->once()) - ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { - $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); - - if (phpversion('mongodb')) { - $this->assertEquals(array('upsert' => true), $options); - } else { - $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); - } - - $data = $updateData['$set']; - })); - - $expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime'); - $this->assertTrue($this->storage->write('foo', 'bar')); - - if (phpversion('mongodb')) { - $this->assertEquals('bar', $data[$this->options['data_field']]->getData()); - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]); - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]); - $this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000)); - } else { - $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); - $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); - $this->assertGreaterThanOrEqual($expectedExpiry, $data[$this->options['expiry_field']]->sec); - } - } - - public function testWriteWhenUsingExpiresField() - { - $this->options = array( - 'id_field' => '_id', - 'data_field' => 'data', - 'time_field' => 'time', - 'database' => 'sf2-test', - 'collection' => 'session-test', - 'expiry_field' => 'expiresAt', - ); - - $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); - - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - $data = array(); - - $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; - - $collection->expects($this->once()) - ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { - $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); - - if (phpversion('mongodb')) { - $this->assertEquals(array('upsert' => true), $options); - } else { - $this->assertEquals(array('upsert' => true, 'multiple' => false), $options); - } - - $data = $updateData['$set']; - })); - - $this->assertTrue($this->storage->write('foo', 'bar')); - - if (phpversion('mongodb')) { - $this->assertEquals('bar', $data[$this->options['data_field']]->getData()); - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]); - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]); - } else { - $this->assertEquals('bar', $data[$this->options['data_field']]->bin); - $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); - $this->assertInstanceOf('MongoDate', $data[$this->options['expiry_field']]); - } - } - - public function testReplaceSessionData() - { - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - $data = array(); - - $methodName = phpversion('mongodb') ? 'updateOne' : 'update'; - - $collection->expects($this->exactly(2)) - ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { - $data = $updateData; - })); - - $this->storage->write('foo', 'bar'); - $this->storage->write('foo', 'foobar'); - - if (phpversion('mongodb')) { - $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->getData()); - } else { - $this->assertEquals('foobar', $data['$set'][$this->options['data_field']]->bin); - } - } - - public function testDestroy() - { - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove'; - - $collection->expects($this->once()) - ->method($methodName) - ->with(array($this->options['id_field'] => 'foo')); - - $this->assertTrue($this->storage->destroy('foo')); - } - - public function testGc() - { - $collection = $this->createMongoCollectionMock(); - - $this->mongo->expects($this->once()) - ->method('selectCollection') - ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); - - $methodName = phpversion('mongodb') ? 'deleteMany' : 'remove'; - - $collection->expects($this->once()) - ->method($methodName) - ->will($this->returnCallback(function ($criteria) { - if (phpversion('mongodb')) { - $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']); - $this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000)); - } else { - $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']); - $this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec); - } - })); - - $this->assertTrue($this->storage->gc(1)); - } - - public function testGetConnection() - { - $method = new \ReflectionMethod($this->storage, 'getMongo'); - $method->setAccessible(true); - - if (phpversion('mongodb')) { - $mongoClass = 'MongoDB\Client'; - } else { - $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; - } - - $this->assertInstanceOf($mongoClass, $method->invoke($this->storage)); - } - - private function createMongoCollectionMock() - { - $collectionClass = 'MongoCollection'; - if (phpversion('mongodb')) { - $collectionClass = 'MongoDB\Collection'; - } - - $collection = $this->getMockBuilder($collectionClass) - ->disableOriginalConstructor() - ->getMock(); - - return $collection; - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php deleted file mode 100644 index a6264e5..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeFileSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class NativeFileSessionHandlerTest extends TestCase -{ - public function testConstruct() - { - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); - - $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - - $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } - - /** - * @dataProvider savePathDataProvider - */ - public function testConstructSavePath($savePath, $expectedSavePath, $path) - { - $handler = new NativeFileSessionHandler($savePath); - $this->assertEquals($expectedSavePath, ini_get('session.save_path')); - $this->assertTrue(is_dir(realpath($path))); - - rmdir($path); - } - - public function savePathDataProvider() - { - $base = sys_get_temp_dir(); - - return array( - array("$base/foo", "$base/foo", "$base/foo"), - array("5;$base/foo", "5;$base/foo", "$base/foo"), - array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"), - ); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testConstructException() - { - $handler = new NativeFileSessionHandler('something;invalid;with;too-many-args'); - } - - public function testConstructDefault() - { - $path = ini_get('session.save_path'); - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); - - $this->assertEquals($path, ini_get('session.save_path')); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php deleted file mode 100644 index 5486b2d..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; - -/** - * Test class for NativeSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class NativeSessionHandlerTest extends TestCase -{ - public function testConstruct() - { - $handler = new NativeSessionHandler(); - - $this->assertTrue($handler instanceof \SessionHandler); - $this->assertTrue($handler instanceof NativeSessionHandler); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php deleted file mode 100644 index 718fd0f..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; - -/** - * Test class for NullSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class NullSessionHandlerTest extends TestCase -{ - public function testSaveHandlers() - { - $storage = $this->getStorage(); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - public function testSession() - { - session_id('nullsessionstorage'); - $storage = $this->getStorage(); - $session = new Session($storage); - $this->assertNull($session->get('something')); - $session->set('something', 'unique'); - $this->assertEquals('unique', $session->get('something')); - } - - public function testNothingIsPersisted() - { - session_id('nullsessionstorage'); - $storage = $this->getStorage(); - $session = new Session($storage); - $session->start(); - $this->assertEquals('nullsessionstorage', $session->getId()); - $this->assertNull($session->get('something')); - } - - public function getStorage() - { - return new NativeSessionStorage(array(), new NullSessionHandler()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php deleted file mode 100644 index a47120f..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ /dev/null @@ -1,370 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; - -/** - * @requires extension pdo_sqlite - * @group time-sensitive - */ -class PdoSessionHandlerTest extends TestCase -{ - private $dbFile; - - protected function tearDown() - { - // make sure the temporary database file is deleted when it has been created (even when a test fails) - if ($this->dbFile) { - @unlink($this->dbFile); - } - parent::tearDown(); - } - - protected function getPersistentSqliteDsn() - { - $this->dbFile = tempnam(sys_get_temp_dir(), 'sf2_sqlite_sessions'); - - return 'sqlite:'.$this->dbFile; - } - - protected function getMemorySqlitePdo() - { - $pdo = new \PDO('sqlite::memory:'); - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - $storage = new PdoSessionHandler($pdo); - $storage->createTable(); - - return $pdo; - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testWrongPdoErrMode() - { - $pdo = $this->getMemorySqlitePdo(); - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); - - $storage = new PdoSessionHandler($pdo); - } - - /** - * @expectedException \RuntimeException - */ - public function testInexistentTable() - { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), array('db_table' => 'inexistent_table')); - $storage->open('', 'sid'); - $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - } - - /** - * @expectedException \RuntimeException - */ - public function testCreateTableTwice() - { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - $storage->createTable(); - } - - public function testWithLazyDsnConnection() - { - $dsn = $this->getPersistentSqliteDsn(); - - $storage = new PdoSessionHandler($dsn); - $storage->createTable(); - $storage->open('', 'sid'); - $data = $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - $this->assertSame('', $data, 'New session returns empty string data'); - - $storage->open('', 'sid'); - $data = $storage->read('id'); - $storage->close(); - $this->assertSame('data', $data, 'Written value can be read back correctly'); - } - - public function testWithLazySavePathConnection() - { - $dsn = $this->getPersistentSqliteDsn(); - - // Open is called with what ini_set('session.save_path', $dsn) would mean - $storage = new PdoSessionHandler(null); - $storage->open($dsn, 'sid'); - $storage->createTable(); - $data = $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - $this->assertSame('', $data, 'New session returns empty string data'); - - $storage->open($dsn, 'sid'); - $data = $storage->read('id'); - $storage->close(); - $this->assertSame('data', $data, 'Written value can be read back correctly'); - } - - public function testReadWriteReadWithNullByte() - { - $sessionData = 'da'."\0".'ta'; - - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - $storage->open('', 'sid'); - $readData = $storage->read('id'); - $storage->write('id', $sessionData); - $storage->close(); - $this->assertSame('', $readData, 'New session returns empty string data'); - - $storage->open('', 'sid'); - $readData = $storage->read('id'); - $storage->close(); - $this->assertSame($sessionData, $readData, 'Written value can be read back correctly'); - } - - public function testReadConvertsStreamToString() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); - } - - $pdo = new MockPdo('pgsql'); - $pdo->prepareResult = $this->getMockBuilder('PDOStatement')->getMock(); - - $content = 'foobar'; - $stream = $this->createStream($content); - - $pdo->prepareResult->expects($this->once())->method('fetchAll') - ->will($this->returnValue(array(array($stream, 42, time())))); - - $storage = new PdoSessionHandler($pdo); - $result = $storage->read('foo'); - - $this->assertSame($content, $result); - } - - public function testReadLockedConvertsStreamToString() - { - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); - } - - $pdo = new MockPdo('pgsql'); - $selectStmt = $this->getMockBuilder('PDOStatement')->getMock(); - $insertStmt = $this->getMockBuilder('PDOStatement')->getMock(); - - $pdo->prepareResult = function ($statement) use ($selectStmt, $insertStmt) { - return 0 === strpos($statement, 'INSERT') ? $insertStmt : $selectStmt; - }; - - $content = 'foobar'; - $stream = $this->createStream($content); - $exception = null; - - $selectStmt->expects($this->atLeast(2))->method('fetchAll') - ->will($this->returnCallback(function () use (&$exception, $stream) { - return $exception ? array(array($stream, 42, time())) : array(); - })); - - $insertStmt->expects($this->once())->method('execute') - ->will($this->returnCallback(function () use (&$exception) { - throw $exception = new \PDOException('', '23'); - })); - - $storage = new PdoSessionHandler($pdo); - $result = $storage->read('foo'); - - $this->assertSame($content, $result); - } - - public function testReadingRequiresExactlySameId() - { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - $storage->open('', 'sid'); - $storage->write('id', 'data'); - $storage->write('test', 'data'); - $storage->write('space ', 'data'); - $storage->close(); - - $storage->open('', 'sid'); - $readDataCaseSensitive = $storage->read('ID'); - $readDataNoCharFolding = $storage->read('tést'); - $readDataKeepSpace = $storage->read('space '); - $readDataExtraSpace = $storage->read('space '); - $storage->close(); - - $this->assertSame('', $readDataCaseSensitive, 'Retrieval by ID should be case-sensitive (collation setting)'); - $this->assertSame('', $readDataNoCharFolding, 'Retrieval by ID should not do character folding (collation setting)'); - $this->assertSame('data', $readDataKeepSpace, 'Retrieval by ID requires spaces as-is'); - $this->assertSame('', $readDataExtraSpace, 'Retrieval by ID requires spaces as-is'); - } - - /** - * Simulates session_regenerate_id(true) which will require an INSERT or UPDATE (replace). - */ - public function testWriteDifferentSessionIdThanRead() - { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - $storage->open('', 'sid'); - $storage->read('id'); - $storage->destroy('id'); - $storage->write('new_id', 'data_of_new_session_id'); - $storage->close(); - - $storage->open('', 'sid'); - $data = $storage->read('new_id'); - $storage->close(); - - $this->assertSame('data_of_new_session_id', $data, 'Data of regenerated session id is available'); - } - - public function testWrongUsageStillWorks() - { - // wrong method sequence that should no happen, but still works - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - $storage->write('id', 'data'); - $storage->write('other_id', 'other_data'); - $storage->destroy('inexistent'); - $storage->open('', 'sid'); - $data = $storage->read('id'); - $otherData = $storage->read('other_id'); - $storage->close(); - - $this->assertSame('data', $data); - $this->assertSame('other_data', $otherData); - } - - public function testSessionDestroy() - { - $pdo = $this->getMemorySqlitePdo(); - $storage = new PdoSessionHandler($pdo); - - $storage->open('', 'sid'); - $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn()); - - $storage->open('', 'sid'); - $storage->read('id'); - $storage->destroy('id'); - $storage->close(); - $this->assertEquals(0, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn()); - - $storage->open('', 'sid'); - $data = $storage->read('id'); - $storage->close(); - $this->assertSame('', $data, 'Destroyed session returns empty string'); - } - - public function testSessionGC() - { - $previousLifeTime = ini_set('session.gc_maxlifetime', 1000); - $pdo = $this->getMemorySqlitePdo(); - $storage = new PdoSessionHandler($pdo); - - $storage->open('', 'sid'); - $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - - $storage->open('', 'sid'); - $storage->read('gc_id'); - ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read - $storage->write('gc_id', 'data'); - $storage->close(); - $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called'); - - $storage->open('', 'sid'); - $data = $storage->read('gc_id'); - $storage->gc(-1); - $storage->close(); - - ini_set('session.gc_maxlifetime', $previousLifeTime); - - $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet'); - $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned'); - } - - public function testGetConnection() - { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo()); - - $method = new \ReflectionMethod($storage, 'getConnection'); - $method->setAccessible(true); - - $this->assertInstanceOf('\PDO', $method->invoke($storage)); - } - - public function testGetConnectionConnectsIfNeeded() - { - $storage = new PdoSessionHandler('sqlite::memory:'); - - $method = new \ReflectionMethod($storage, 'getConnection'); - $method->setAccessible(true); - - $this->assertInstanceOf('\PDO', $method->invoke($storage)); - } - - private function createStream($content) - { - $stream = tmpfile(); - fwrite($stream, $content); - fseek($stream, 0); - - return $stream; - } -} - -class MockPdo extends \PDO -{ - public $prepareResult; - private $driverName; - private $errorMode; - - public function __construct($driverName = null, $errorMode = null) - { - $this->driverName = $driverName; - $this->errorMode = null !== $errorMode ?: \PDO::ERRMODE_EXCEPTION; - } - - public function getAttribute($attribute) - { - if (\PDO::ATTR_ERRMODE === $attribute) { - return $this->errorMode; - } - - if (\PDO::ATTR_DRIVER_NAME === $attribute) { - return $this->driverName; - } - - return parent::getAttribute($attribute); - } - - public function prepare($statement, $driverOptions = array()) - { - return is_callable($this->prepareResult) - ? call_user_func($this->prepareResult, $statement, $driverOptions) - : $this->prepareResult; - } - - public function beginTransaction() - { - } - - public function rollBack() - { - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php deleted file mode 100644 index 5e41a47..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler; - -/** - * @author Adrien Brault - */ -class WriteCheckSessionHandlerTest extends TestCase -{ - public function test() - { - $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); - $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); - - $wrappedSessionHandlerMock - ->expects($this->once()) - ->method('close') - ->with() - ->will($this->returnValue(true)) - ; - - $this->assertTrue($writeCheckSessionHandler->close()); - } - - public function testWrite() - { - $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); - $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); - - $wrappedSessionHandlerMock - ->expects($this->once()) - ->method('write') - ->with('foo', 'bar') - ->will($this->returnValue(true)) - ; - - $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar')); - } - - public function testSkippedWrite() - { - $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); - $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); - - $wrappedSessionHandlerMock - ->expects($this->once()) - ->method('read') - ->with('foo') - ->will($this->returnValue('bar')) - ; - - $wrappedSessionHandlerMock - ->expects($this->never()) - ->method('write') - ; - - $this->assertEquals('bar', $writeCheckSessionHandler->read('foo')); - $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar')); - } - - public function testNonSkippedWrite() - { - $wrappedSessionHandlerMock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); - $writeCheckSessionHandler = new WriteCheckSessionHandler($wrappedSessionHandlerMock); - - $wrappedSessionHandlerMock - ->expects($this->once()) - ->method('read') - ->with('foo') - ->will($this->returnValue('bar')) - ; - - $wrappedSessionHandlerMock - ->expects($this->once()) - ->method('write') - ->with('foo', 'baZZZ') - ->will($this->returnValue(true)) - ; - - $this->assertEquals('bar', $writeCheckSessionHandler->read('foo')); - $this->assertTrue($writeCheckSessionHandler->write('foo', 'baZZZ')); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php deleted file mode 100644 index 159e621..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - -/** - * Test class for MetadataBag. - * - * @group time-sensitive - */ -class MetadataBagTest extends TestCase -{ - /** - * @var MetadataBag - */ - protected $bag; - - /** - * @var array - */ - protected $array = array(); - - protected function setUp() - { - parent::setUp(); - $this->bag = new MetadataBag(); - $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0); - $this->bag->initialize($this->array); - } - - protected function tearDown() - { - $this->array = array(); - $this->bag = null; - parent::tearDown(); - } - - public function testInitialize() - { - $sessionMetadata = array(); - - $bag1 = new MetadataBag(); - $bag1->initialize($sessionMetadata); - $this->assertGreaterThanOrEqual(time(), $bag1->getCreated()); - $this->assertEquals($bag1->getCreated(), $bag1->getLastUsed()); - - sleep(1); - $bag2 = new MetadataBag(); - $bag2->initialize($sessionMetadata); - $this->assertEquals($bag1->getCreated(), $bag2->getCreated()); - $this->assertEquals($bag1->getLastUsed(), $bag2->getLastUsed()); - $this->assertEquals($bag2->getCreated(), $bag2->getLastUsed()); - - sleep(1); - $bag3 = new MetadataBag(); - $bag3->initialize($sessionMetadata); - $this->assertEquals($bag1->getCreated(), $bag3->getCreated()); - $this->assertGreaterThan($bag2->getLastUsed(), $bag3->getLastUsed()); - $this->assertNotEquals($bag3->getCreated(), $bag3->getLastUsed()); - } - - public function testGetSetName() - { - $this->assertEquals('__metadata', $this->bag->getName()); - $this->bag->setName('foo'); - $this->assertEquals('foo', $this->bag->getName()); - } - - public function testGetStorageKey() - { - $this->assertEquals('_sf2_meta', $this->bag->getStorageKey()); - } - - public function testGetLifetime() - { - $bag = new MetadataBag(); - $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000); - $bag->initialize($array); - $this->assertEquals(1000, $bag->getLifetime()); - } - - public function testGetCreated() - { - $this->assertEquals(1234567, $this->bag->getCreated()); - } - - public function testGetLastUsed() - { - $this->assertLessThanOrEqual(time(), $this->bag->getLastUsed()); - } - - public function testClear() - { - $this->bag->clear(); - - // the clear method has no side effects, we just want to ensure it doesn't trigger any exceptions - $this->addToAssertionCount(1); - } - - public function testSkipLastUsedUpdate() - { - $bag = new MetadataBag('', 30); - $timeStamp = time(); - - $created = $timeStamp - 15; - $sessionMetadata = array( - MetadataBag::CREATED => $created, - MetadataBag::UPDATED => $created, - MetadataBag::LIFETIME => 1000, - ); - $bag->initialize($sessionMetadata); - - $this->assertEquals($created, $sessionMetadata[MetadataBag::UPDATED]); - } - - public function testDoesNotSkipLastUsedUpdate() - { - $bag = new MetadataBag('', 30); - $timeStamp = time(); - - $created = $timeStamp - 45; - $sessionMetadata = array( - MetadataBag::CREATED => $created, - MetadataBag::UPDATED => $created, - MetadataBag::LIFETIME => 1000, - ); - $bag->initialize($sessionMetadata); - - $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php deleted file mode 100644 index 82df554..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; - -/** - * Test class for MockArraySessionStorage. - * - * @author Drak - */ -class MockArraySessionStorageTest extends TestCase -{ - /** - * @var MockArraySessionStorage - */ - private $storage; - - /** - * @var AttributeBag - */ - private $attributes; - - /** - * @var FlashBag - */ - private $flashes; - - private $data; - - protected function setUp() - { - $this->attributes = new AttributeBag(); - $this->flashes = new FlashBag(); - - $this->data = array( - $this->attributes->getStorageKey() => array('foo' => 'bar'), - $this->flashes->getStorageKey() => array('notice' => 'hello'), - ); - - $this->storage = new MockArraySessionStorage(); - $this->storage->registerBag($this->flashes); - $this->storage->registerBag($this->attributes); - $this->storage->setSessionData($this->data); - } - - protected function tearDown() - { - $this->data = null; - $this->flashes = null; - $this->attributes = null; - $this->storage = null; - } - - public function testStart() - { - $this->assertEquals('', $this->storage->getId()); - $this->storage->start(); - $id = $this->storage->getId(); - $this->assertNotEquals('', $id); - $this->storage->start(); - $this->assertEquals($id, $this->storage->getId()); - } - - public function testRegenerate() - { - $this->storage->start(); - $id = $this->storage->getId(); - $this->storage->regenerate(); - $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); - - $id = $this->storage->getId(); - $this->storage->regenerate(true); - $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); - } - - public function testGetId() - { - $this->assertEquals('', $this->storage->getId()); - $this->storage->start(); - $this->assertNotEquals('', $this->storage->getId()); - } - - public function testClearClearsBags() - { - $this->storage->clear(); - - $this->assertSame(array(), $this->storage->getBag('attributes')->all()); - $this->assertSame(array(), $this->storage->getBag('flashes')->peekAll()); - } - - public function testClearStartsSession() - { - $this->storage->clear(); - - $this->assertTrue($this->storage->isStarted()); - } - - public function testClearWithNoBagsStartsSession() - { - $storage = new MockArraySessionStorage(); - - $storage->clear(); - - $this->assertTrue($storage->isStarted()); - } - - /** - * @expectedException \RuntimeException - */ - public function testUnstartedSave() - { - $this->storage->save(); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php deleted file mode 100644 index 53accd3..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; - -/** - * Test class for MockFileSessionStorage. - * - * @author Drak - */ -class MockFileSessionStorageTest extends TestCase -{ - /** - * @var string - */ - private $sessionDir; - - /** - * @var MockFileSessionStorage - */ - protected $storage; - - protected function setUp() - { - $this->sessionDir = sys_get_temp_dir().'/sf2test'; - $this->storage = $this->getStorage(); - } - - protected function tearDown() - { - $this->sessionDir = null; - $this->storage = null; - array_map('unlink', glob($this->sessionDir.'/*.session')); - if (is_dir($this->sessionDir)) { - rmdir($this->sessionDir); - } - } - - public function testStart() - { - $this->assertEquals('', $this->storage->getId()); - $this->assertTrue($this->storage->start()); - $id = $this->storage->getId(); - $this->assertNotEquals('', $this->storage->getId()); - $this->assertTrue($this->storage->start()); - $this->assertEquals($id, $this->storage->getId()); - } - - public function testRegenerate() - { - $this->storage->start(); - $this->storage->getBag('attributes')->set('regenerate', 1234); - $this->storage->regenerate(); - $this->assertEquals(1234, $this->storage->getBag('attributes')->get('regenerate')); - $this->storage->regenerate(true); - $this->assertEquals(1234, $this->storage->getBag('attributes')->get('regenerate')); - } - - public function testGetId() - { - $this->assertEquals('', $this->storage->getId()); - $this->storage->start(); - $this->assertNotEquals('', $this->storage->getId()); - } - - public function testSave() - { - $this->storage->start(); - $id = $this->storage->getId(); - $this->assertNotEquals('108', $this->storage->getBag('attributes')->get('new')); - $this->assertFalse($this->storage->getBag('flashes')->has('newkey')); - $this->storage->getBag('attributes')->set('new', '108'); - $this->storage->getBag('flashes')->set('newkey', 'test'); - $this->storage->save(); - - $storage = $this->getStorage(); - $storage->setId($id); - $storage->start(); - $this->assertEquals('108', $storage->getBag('attributes')->get('new')); - $this->assertTrue($storage->getBag('flashes')->has('newkey')); - $this->assertEquals(array('test'), $storage->getBag('flashes')->peek('newkey')); - } - - public function testMultipleInstances() - { - $storage1 = $this->getStorage(); - $storage1->start(); - $storage1->getBag('attributes')->set('foo', 'bar'); - $storage1->save(); - - $storage2 = $this->getStorage(); - $storage2->setId($storage1->getId()); - $storage2->start(); - $this->assertEquals('bar', $storage2->getBag('attributes')->get('foo'), 'values persist between instances'); - } - - /** - * @expectedException \RuntimeException - */ - public function testSaveWithoutStart() - { - $storage1 = $this->getStorage(); - $storage1->save(); - } - - private function getStorage() - { - $storage = new MockFileSessionStorage($this->sessionDir); - $storage->registerBag(new FlashBag()); - $storage->registerBag(new AttributeBag()); - - return $storage; - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php deleted file mode 100644 index 818c63a..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ /dev/null @@ -1,247 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; - -/** - * Test class for NativeSessionStorage. - * - * @author Drak - * - * These tests require separate processes. - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class NativeSessionStorageTest extends TestCase -{ - private $savePath; - - protected function setUp() - { - $this->iniSet('session.save_handler', 'files'); - $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test'); - if (!is_dir($this->savePath)) { - mkdir($this->savePath); - } - } - - protected function tearDown() - { - session_write_close(); - array_map('unlink', glob($this->savePath.'/*')); - if (is_dir($this->savePath)) { - rmdir($this->savePath); - } - - $this->savePath = null; - } - - /** - * @param array $options - * - * @return NativeSessionStorage - */ - protected function getStorage(array $options = array()) - { - $storage = new NativeSessionStorage($options); - $storage->registerBag(new AttributeBag()); - - return $storage; - } - - public function testBag() - { - $storage = $this->getStorage(); - $bag = new FlashBag(); - $storage->registerBag($bag); - $this->assertSame($bag, $storage->getBag($bag->getName())); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRegisterBagException() - { - $storage = $this->getStorage(); - $storage->getBag('non_existing'); - } - - /** - * @expectedException \LogicException - */ - public function testRegisterBagForAStartedSessionThrowsException() - { - $storage = $this->getStorage(); - $storage->start(); - $storage->registerBag(new AttributeBag()); - } - - public function testGetId() - { - $storage = $this->getStorage(); - $this->assertSame('', $storage->getId(), 'Empty ID before starting session'); - - $storage->start(); - $id = $storage->getId(); - $this->assertInternalType('string', $id); - $this->assertNotSame('', $id); - - $storage->save(); - $this->assertSame($id, $storage->getId(), 'ID stays after saving session'); - } - - public function testRegenerate() - { - $storage = $this->getStorage(); - $storage->start(); - $id = $storage->getId(); - $storage->getBag('attributes')->set('lucky', 7); - $storage->regenerate(); - $this->assertNotEquals($id, $storage->getId()); - $this->assertEquals(7, $storage->getBag('attributes')->get('lucky')); - } - - public function testRegenerateDestroy() - { - $storage = $this->getStorage(); - $storage->start(); - $id = $storage->getId(); - $storage->getBag('attributes')->set('legs', 11); - $storage->regenerate(true); - $this->assertNotEquals($id, $storage->getId()); - $this->assertEquals(11, $storage->getBag('attributes')->get('legs')); - } - - public function testSessionGlobalIsUpToDateAfterIdRegeneration() - { - $storage = $this->getStorage(); - $storage->start(); - $storage->getBag('attributes')->set('lucky', 7); - $storage->regenerate(); - $storage->getBag('attributes')->set('lucky', 42); - - $this->assertEquals(42, $_SESSION['_sf2_attributes']['lucky']); - } - - public function testRegenerationFailureDoesNotFlagStorageAsStarted() - { - $storage = $this->getStorage(); - $this->assertFalse($storage->regenerate()); - $this->assertFalse($storage->isStarted()); - } - - public function testDefaultSessionCacheLimiter() - { - $this->iniSet('session.cache_limiter', 'nocache'); - - $storage = new NativeSessionStorage(); - $this->assertEquals('', ini_get('session.cache_limiter')); - } - - public function testExplicitSessionCacheLimiter() - { - $this->iniSet('session.cache_limiter', 'nocache'); - - $storage = new NativeSessionStorage(array('cache_limiter' => 'public')); - $this->assertEquals('public', ini_get('session.cache_limiter')); - } - - public function testCookieOptions() - { - $options = array( - 'cookie_lifetime' => 123456, - 'cookie_path' => '/my/cookie/path', - 'cookie_domain' => 'symfony.example.com', - 'cookie_secure' => true, - 'cookie_httponly' => false, - ); - - $this->getStorage($options); - $temp = session_get_cookie_params(); - $gco = array(); - - foreach ($temp as $key => $value) { - $gco['cookie_'.$key] = $value; - } - - $this->assertEquals($options, $gco); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSetSaveHandlerException() - { - $storage = $this->getStorage(); - $storage->setSaveHandler(new \stdClass()); - } - - public function testSetSaveHandler() - { - $this->iniSet('session.save_handler', 'files'); - $storage = $this->getStorage(); - $storage->setSaveHandler(); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(null); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler())); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NativeSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - $storage->setSaveHandler(new NullSessionHandler()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); - } - - /** - * @expectedException \RuntimeException - */ - public function testStarted() - { - $storage = $this->getStorage(); - - $this->assertFalse($storage->getSaveHandler()->isActive()); - $this->assertFalse($storage->isStarted()); - - session_start(); - $this->assertTrue(isset($_SESSION)); - $this->assertTrue($storage->getSaveHandler()->isActive()); - - // PHP session might have started, but the storage driver has not, so false is correct here - $this->assertFalse($storage->isStarted()); - - $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); - $storage->start(); - } - - public function testRestart() - { - $storage = $this->getStorage(); - $storage->start(); - $id = $storage->getId(); - $storage->getBag('attributes')->set('lucky', 7); - $storage->save(); - $storage->start(); - $this->assertSame($id, $storage->getId(), 'Same session ID after restarting'); - $this->assertSame(7, $storage->getBag('attributes')->get('lucky'), 'Data still available'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php deleted file mode 100644 index b8b9838..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; - -/** - * Test class for PhpSessionStorage. - * - * @author Drak - * - * These tests require separate processes. - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class PhpBridgeSessionStorageTest extends TestCase -{ - private $savePath; - - protected function setUp() - { - $this->iniSet('session.save_handler', 'files'); - $this->iniSet('session.save_path', $this->savePath = sys_get_temp_dir().'/sf2test'); - if (!is_dir($this->savePath)) { - mkdir($this->savePath); - } - } - - protected function tearDown() - { - session_write_close(); - array_map('unlink', glob($this->savePath.'/*')); - if (is_dir($this->savePath)) { - rmdir($this->savePath); - } - - $this->savePath = null; - } - - /** - * @return PhpBridgeSessionStorage - */ - protected function getStorage() - { - $storage = new PhpBridgeSessionStorage(); - $storage->registerBag(new AttributeBag()); - - return $storage; - } - - public function testPhpSession() - { - $storage = $this->getStorage(); - - $this->assertFalse($storage->getSaveHandler()->isActive()); - $this->assertFalse($storage->isStarted()); - - session_start(); - $this->assertTrue(isset($_SESSION)); - // in PHP 5.4 we can reliably detect a session started - $this->assertTrue($storage->getSaveHandler()->isActive()); - // PHP session might have started, but the storage driver has not, so false is correct here - $this->assertFalse($storage->isStarted()); - - $key = $storage->getMetadataBag()->getStorageKey(); - $this->assertFalse(isset($_SESSION[$key])); - $storage->start(); - $this->assertTrue(isset($_SESSION[$key])); - } - - public function testClear() - { - $storage = $this->getStorage(); - session_start(); - $_SESSION['drak'] = 'loves symfony'; - $storage->getBag('attributes')->set('symfony', 'greatness'); - $key = $storage->getBag('attributes')->getStorageKey(); - $this->assertEquals($_SESSION[$key], array('symfony' => 'greatness')); - $this->assertEquals($_SESSION['drak'], 'loves symfony'); - $storage->clear(); - $this->assertEquals($_SESSION[$key], array()); - $this->assertEquals($_SESSION['drak'], 'loves symfony'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php deleted file mode 100644 index ef1da13..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; - -// Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to -// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73 -class ConcreteProxy extends AbstractProxy -{ -} - -class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface -{ - public function open($savePath, $sessionName) - { - } - - public function close() - { - } - - public function read($id) - { - } - - public function write($id, $data) - { - } - - public function destroy($id) - { - } - - public function gc($maxlifetime) - { - } -} - -/** - * Test class for AbstractProxy. - * - * @author Drak - */ -class AbstractProxyTest extends TestCase -{ - /** - * @var AbstractProxy - */ - protected $proxy; - - protected function setUp() - { - $this->proxy = new ConcreteProxy(); - } - - protected function tearDown() - { - $this->proxy = null; - } - - public function testGetSaveHandlerName() - { - $this->assertNull($this->proxy->getSaveHandlerName()); - } - - public function testIsSessionHandlerInterface() - { - $this->assertFalse($this->proxy->isSessionHandlerInterface()); - $sh = new ConcreteSessionHandlerInterfaceProxy(); - $this->assertTrue($sh->isSessionHandlerInterface()); - } - - public function testIsWrapper() - { - $this->assertFalse($this->proxy->isWrapper()); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testIsActive() - { - $this->assertFalse($this->proxy->isActive()); - session_start(); - $this->assertTrue($this->proxy->isActive()); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testName() - { - $this->assertEquals(session_name(), $this->proxy->getName()); - $this->proxy->setName('foo'); - $this->assertEquals('foo', $this->proxy->getName()); - $this->assertEquals(session_name(), $this->proxy->getName()); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @expectedException \LogicException - */ - public function testNameException() - { - session_start(); - $this->proxy->setName('foo'); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testId() - { - $this->assertEquals(session_id(), $this->proxy->getId()); - $this->proxy->setId('foo'); - $this->assertEquals('foo', $this->proxy->getId()); - $this->assertEquals(session_id(), $this->proxy->getId()); - } - - /** - * @runInSeparateProcess - * @preserveGlobalState disabled - * @expectedException \LogicException - */ - public function testIdException() - { - session_start(); - $this->proxy->setId('foo'); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php deleted file mode 100644 index 8ec3053..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/NativeProxyTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy; - -/** - * Test class for NativeProxy. - * - * @author Drak - */ -class NativeProxyTest extends TestCase -{ - public function testIsWrapper() - { - $proxy = new NativeProxy(); - $this->assertFalse($proxy->isWrapper()); - } - - public function testGetSaveHandlerName() - { - $name = ini_get('session.save_handler'); - $proxy = new NativeProxy(); - $this->assertEquals($name, $proxy->getSaveHandlerName()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php deleted file mode 100644 index 6828253..0000000 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; - -/** - * Tests for SessionHandlerProxy class. - * - * @author Drak - * - * @runTestsInSeparateProcesses - * @preserveGlobalState disabled - */ -class SessionHandlerProxyTest extends TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_Matcher - */ - private $mock; - - /** - * @var SessionHandlerProxy - */ - private $proxy; - - protected function setUp() - { - $this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock(); - $this->proxy = new SessionHandlerProxy($this->mock); - } - - protected function tearDown() - { - $this->mock = null; - $this->proxy = null; - } - - public function testOpenTrue() - { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(true)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertFalse($this->proxy->isActive()); - } - - public function testOpenFalse() - { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(false)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertFalse($this->proxy->isActive()); - } - - public function testClose() - { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(true)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); - } - - public function testCloseFalse() - { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(false)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); - } - - public function testRead() - { - $this->mock->expects($this->once()) - ->method('read'); - - $this->proxy->read('id'); - } - - public function testWrite() - { - $this->mock->expects($this->once()) - ->method('write'); - - $this->proxy->write('id', 'data'); - } - - public function testDestroy() - { - $this->mock->expects($this->once()) - ->method('destroy'); - - $this->proxy->destroy('id'); - } - - public function testGc() - { - $this->mock->expects($this->once()) - ->method('gc'); - - $this->proxy->gc(86400); - } -} diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php deleted file mode 100644 index 1e35eb8..0000000 --- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\StreamedResponse; - -class StreamedResponseTest extends TestCase -{ - public function testConstructor() - { - $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain')); - - $this->assertEquals(404, $response->getStatusCode()); - $this->assertEquals('text/plain', $response->headers->get('Content-Type')); - } - - public function testPrepareWith11Protocol() - { - $response = new StreamedResponse(function () { echo 'foo'; }); - $request = Request::create('/'); - $request->server->set('SERVER_PROTOCOL', 'HTTP/1.1'); - - $response->prepare($request); - - $this->assertEquals('1.1', $response->getProtocolVersion()); - $this->assertNotEquals('chunked', $response->headers->get('Transfer-Encoding'), 'Apache assumes responses with a Transfer-Encoding header set to chunked to already be encoded.'); - } - - public function testPrepareWith10Protocol() - { - $response = new StreamedResponse(function () { echo 'foo'; }); - $request = Request::create('/'); - $request->server->set('SERVER_PROTOCOL', 'HTTP/1.0'); - - $response->prepare($request); - - $this->assertEquals('1.0', $response->getProtocolVersion()); - $this->assertNull($response->headers->get('Transfer-Encoding')); - } - - public function testPrepareWithHeadRequest() - { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123')); - $request = Request::create('/', 'HEAD'); - - $response->prepare($request); - - $this->assertSame('123', $response->headers->get('Content-Length')); - } - - public function testPrepareWithCacheHeaders() - { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public')); - $request = Request::create('/', 'GET'); - - $response->prepare($request); - $this->assertEquals('max-age=600, public', $response->headers->get('Cache-Control')); - } - - public function testSendContent() - { - $called = 0; - - $response = new StreamedResponse(function () use (&$called) { ++$called; }); - - $response->sendContent(); - $this->assertEquals(1, $called); - - $response->sendContent(); - $this->assertEquals(1, $called); - } - - /** - * @expectedException \LogicException - */ - public function testSendContentWithNonCallable() - { - $response = new StreamedResponse(null); - $response->sendContent(); - } - - /** - * @expectedException \LogicException - */ - public function testSetContent() - { - $response = new StreamedResponse(function () { echo 'foo'; }); - $response->setContent('foo'); - } - - public function testGetContent() - { - $response = new StreamedResponse(function () { echo 'foo'; }); - $this->assertFalse($response->getContent()); - } - - public function testCreate() - { - $response = StreamedResponse::create(function () {}, 204); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); - $this->assertEquals(204, $response->getStatusCode()); - } -} diff --git a/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng b/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng deleted file mode 100644 index 73708ca..0000000 --- a/vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng b/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng deleted file mode 100644 index b9c3ca9..0000000 --- a/vendor/symfony/http-foundation/Tests/schema/iana-registry.rng +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uri - - - - rfc - - - (rfc|bcp|std)\d+ - - - - - rfc-errata - - - - draft - - - (draft|RFC)(-[a-zA-Z0-9]+)+ - - - - - registry - - - - person - - - - text - - - note - - - - unicode - - - ucd\d+\.\d+\.\d+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))? - - - - - - - - - - - - - 0x[0-9]{8} - - - - - - [0-1]+ - - - - - - - - - - - - - - - - - - - - - - legacy - mib - template - json - - - - - - - - - - diff --git a/vendor/symfony/http-foundation/composer.json b/vendor/symfony/http-foundation/composer.json deleted file mode 100644 index a964975..0000000 --- a/vendor/symfony/http-foundation/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "symfony/http-foundation", - "type": "library", - "description": "Symfony HttpFoundation Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "symfony/expression-language": "~2.8|~3.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/http-foundation/phpunit.xml.dist b/vendor/symfony/http-foundation/phpunit.xml.dist deleted file mode 100644 index c1d61f8..0000000 --- a/vendor/symfony/http-foundation/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/vendor/symfony/http-kernel/.gitignore b/vendor/symfony/http-kernel/.gitignore deleted file mode 100644 index 94a6a25..0000000 --- a/vendor/symfony/http-kernel/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor/ -composer.lock -phpunit.xml -Tests/Fixtures/cache/ -Tests/Fixtures/logs/ diff --git a/vendor/symfony/http-kernel/Bundle/Bundle.php b/vendor/symfony/http-kernel/Bundle/Bundle.php deleted file mode 100644 index 0b0ea08..0000000 --- a/vendor/symfony/http-kernel/Bundle/Bundle.php +++ /dev/null @@ -1,231 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerAwareTrait; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\Console\Application; -use Symfony\Component\Finder\Finder; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; - -/** - * An implementation of BundleInterface that adds a few conventions - * for DependencyInjection extensions and Console commands. - * - * @author Fabien Potencier - */ -abstract class Bundle implements BundleInterface -{ - use ContainerAwareTrait; - - protected $name; - protected $extension; - protected $path; - private $namespace; - - /** - * Boots the Bundle. - */ - public function boot() - { - } - - /** - * Shutdowns the Bundle. - */ - public function shutdown() - { - } - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * This method can be overridden to register compilation passes, - * other extensions, ... - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - public function build(ContainerBuilder $container) - { - } - - /** - * Returns the bundle's container extension. - * - * @return ExtensionInterface|null The container extension - * - * @throws \LogicException - */ - public function getContainerExtension() - { - if (null === $this->extension) { - $extension = $this->createContainerExtension(); - - if (null !== $extension) { - if (!$extension instanceof ExtensionInterface) { - throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', get_class($extension))); - } - - // check naming convention - $basename = preg_replace('/Bundle$/', '', $this->getName()); - $expectedAlias = Container::underscore($basename); - - if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', - $expectedAlias, $extension->getAlias() - )); - } - - $this->extension = $extension; - } else { - $this->extension = false; - } - } - - if ($this->extension) { - return $this->extension; - } - } - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - */ - public function getNamespace() - { - if (null === $this->namespace) { - $this->parseClassName(); - } - - return $this->namespace; - } - - /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path - */ - public function getPath() - { - if (null === $this->path) { - $reflected = new \ReflectionObject($this); - $this->path = dirname($reflected->getFileName()); - } - - return $this->path; - } - - /** - * Returns the bundle parent name. - * - * @return string|null The Bundle parent name it overrides or null if no parent - */ - public function getParent() - { - } - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - */ - final public function getName() - { - if (null === $this->name) { - $this->parseClassName(); - } - - return $this->name; - } - - /** - * Finds and registers Commands. - * - * Override this method if your bundle commands do not follow the conventions: - * - * * Commands are in the 'Command' sub-directory - * * Commands extend Symfony\Component\Console\Command\Command - * - * @param Application $application An Application instance - */ - public function registerCommands(Application $application) - { - if (!is_dir($dir = $this->getPath().'/Command')) { - return; - } - - if (!class_exists('Symfony\Component\Finder\Finder')) { - throw new \RuntimeException('You need the symfony/finder component to register bundle commands.'); - } - - $finder = new Finder(); - $finder->files()->name('*Command.php')->in($dir); - - $prefix = $this->getNamespace().'\\Command'; - foreach ($finder as $file) { - $ns = $prefix; - if ($relativePath = $file->getRelativePath()) { - $ns .= '\\'.str_replace('/', '\\', $relativePath); - } - $class = $ns.'\\'.$file->getBasename('.php'); - if ($this->container) { - $commandIds = $this->container->hasParameter('console.command.ids') ? $this->container->getParameter('console.command.ids') : array(); - $alias = 'console.command.'.strtolower(str_replace('\\', '_', $class)); - if (isset($commandIds[$alias]) || $this->container->has($alias)) { - continue; - } - } - $r = new \ReflectionClass($class); - if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { - $application->add($r->newInstance()); - } - } - } - - /** - * Returns the bundle's container extension class. - * - * @return string - */ - protected function getContainerExtensionClass() - { - $basename = preg_replace('/Bundle$/', '', $this->getName()); - - return $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension'; - } - - /** - * Creates the bundle's container extension. - * - * @return ExtensionInterface|null - */ - protected function createContainerExtension() - { - if (class_exists($class = $this->getContainerExtensionClass())) { - return new $class(); - } - } - - private function parseClassName() - { - $pos = strrpos(static::class, '\\'); - $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos); - if (null === $this->name) { - $this->name = false === $pos ? static::class : substr(static::class, $pos + 1); - } - } -} diff --git a/vendor/symfony/http-kernel/Bundle/BundleInterface.php b/vendor/symfony/http-kernel/Bundle/BundleInterface.php deleted file mode 100644 index 25eea1d..0000000 --- a/vendor/symfony/http-kernel/Bundle/BundleInterface.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Bundle; - -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; - -/** - * BundleInterface. - * - * @author Fabien Potencier - */ -interface BundleInterface extends ContainerAwareInterface -{ - /** - * Boots the Bundle. - */ - public function boot(); - - /** - * Shutdowns the Bundle. - */ - public function shutdown(); - - /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - public function build(ContainerBuilder $container); - - /** - * Returns the container extension that should be implicitly loaded. - * - * @return ExtensionInterface|null The default extension or null if there is none - */ - public function getContainerExtension(); - - /** - * Returns the bundle name that this bundle overrides. - * - * Despite its name, this method does not imply any parent/child relationship - * between the bundles, just a way to extend and override an existing - * bundle. - * - * @return string The Bundle name it overrides or null if no parent - */ - public function getParent(); - - /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name - */ - public function getName(); - - /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace - */ - public function getNamespace(); - - /** - * Gets the Bundle directory path. - * - * The path should always be returned as a Unix path (with /). - * - * @return string The Bundle absolute path - */ - public function getPath(); -} diff --git a/vendor/symfony/http-kernel/CHANGELOG.md b/vendor/symfony/http-kernel/CHANGELOG.md deleted file mode 100644 index 061f61d..0000000 --- a/vendor/symfony/http-kernel/CHANGELOG.md +++ /dev/null @@ -1,134 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - - * added `kernel.project_dir` and `Kernel::getProjectDir()` - * deprecated `kernel.root_dir` and `Kernel::getRootDir()` - * deprecated `Kernel::getEnvParameters()` - * deprecated the special `SYMFONY__` environment variables - * added the possibility to change the query string parameter used by `UriSigner` - * deprecated `LazyLoadingFragmentHandler::addRendererService()` - * deprecated `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` - * deprecated `Psr6CacheClearer::addPool()` - -3.2.0 ------ - - * deprecated `DataCollector::varToString()`, use `cloneVar()` instead - * changed surrogate capability name in `AbstractSurrogate::addSurrogateCapability` to 'symfony' - * Added `ControllerArgumentValueResolverPass` - -3.1.0 ------ - * deprecated passing objects as URI attributes to the ESI and SSI renderers - * deprecated `ControllerResolver::getArguments()` - * added `Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface` - * added `Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface` as argument to `HttpKernel` - * added `Symfony\Component\HttpKernel\Controller\ArgumentResolver` - * added `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::getMethod()` - * added `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::getRedirect()` - * added the `kernel.controller_arguments` event, triggered after controller arguments have been resolved - -3.0.0 ------ - - * removed `Symfony\Component\HttpKernel\Kernel::init()` - * removed `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle()` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle()` - * removed `Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher::setProfiler()` - * removed `Symfony\Component\HttpKernel\EventListener\FragmentListener::getLocalIpAddresses()` - * removed `Symfony\Component\HttpKernel\EventListener\LocaleListener::setRequest()` - * removed `Symfony\Component\HttpKernel\EventListener\RouterListener::setRequest()` - * removed `Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest()` - * removed `Symfony\Component\HttpKernel\Fragment\FragmentHandler::setRequest()` - * removed `Symfony\Component\HttpKernel\HttpCache\Esi::hasSurrogateEsiCapability()` - * removed `Symfony\Component\HttpKernel\HttpCache\Esi::addSurrogateEsiCapability()` - * removed `Symfony\Component\HttpKernel\HttpCache\Esi::needsEsiParsing()` - * removed `Symfony\Component\HttpKernel\HttpCache\HttpCache::getEsi()` - * removed `Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel` - * removed `Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass` - * removed `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` - * removed `Symfony\Component\HttpKernel\EventListener\EsiListener` - * removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategy` - * removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategyInterface` - * removed `Symfony\Component\HttpKernel\Log\LoggerInterface` - * removed `Symfony\Component\HttpKernel\Log\NullLogger` - * removed `Symfony\Component\HttpKernel\Profiler::import()` - * removed `Symfony\Component\HttpKernel\Profiler::export()` - -2.8.0 ------ - - * deprecated `Profiler::import` and `Profiler::export` - -2.7.0 ------ - - * added the HTTP status code to profiles - -2.6.0 ------ - - * deprecated `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener`, use `Symfony\Component\HttpKernel\EventListener\DebugHandlersListener` instead - * deprecated unused method `Symfony\Component\HttpKernel\Kernel::isClassInActiveBundle` and `Symfony\Component\HttpKernel\KernelInterface::isClassInActiveBundle` - -2.5.0 ------ - - * deprecated `Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass`, use `Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass` instead - -2.4.0 ------ - - * added event listeners for the session - * added the KernelEvents::FINISH_REQUEST event - -2.3.0 ------ - - * [BC BREAK] renamed `Symfony\Component\HttpKernel\EventListener\DeprecationLoggerListener` to `Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener` and changed its constructor - * deprecated `Symfony\Component\HttpKernel\Debug\ErrorHandler`, `Symfony\Component\HttpKernel\Debug\ExceptionHandler`, - `Symfony\Component\HttpKernel\Exception\FatalErrorException` and `Symfony\Component\HttpKernel\Exception\FlattenException` - * deprecated `Symfony\Component\HttpKernel\Kernel::init()` - * added the possibility to specify an id an extra attributes to hinclude tags - * added the collect of data if a controller is a Closure in the Request collector - * pass exceptions from the ExceptionListener to the logger using the logging context to allow for more - detailed messages - -2.2.0 ------ - - * [BC BREAK] the path info for sub-request is now always _fragment (or whatever you configured instead of the default) - * added Symfony\Component\HttpKernel\EventListener\FragmentListener - * added Symfony\Component\HttpKernel\UriSigner - * added Symfony\Component\HttpKernel\FragmentRenderer and rendering strategies (in Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface) - * added Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel - * added ControllerReference to create reference of Controllers (used in the FragmentRenderer class) - * [BC BREAK] renamed TimeDataCollector::getTotalTime() to - TimeDataCollector::getDuration() - * updated the MemoryDataCollector to include the memory used in the - kernel.terminate event listeners - * moved the Stopwatch classes to a new component - * added TraceableControllerResolver - * added TraceableEventDispatcher (removed ContainerAwareTraceableEventDispatcher) - * added support for WinCache opcode cache in ConfigDataCollector - -2.1.0 ------ - - * [BC BREAK] the charset is now configured via the Kernel::getCharset() method - * [BC BREAK] the current locale for the user is not stored anymore in the session - * added the HTTP method to the profiler storage - * updated all listeners to implement EventSubscriberInterface - * added TimeDataCollector - * added ContainerAwareTraceableEventDispatcher - * moved TraceableEventDispatcherInterface to the EventDispatcher component - * added RouterListener, LocaleListener, and StreamedResponseListener - * added CacheClearerInterface (and ChainCacheClearer) - * added a kernel.terminate event (via TerminableInterface and PostResponseEvent) - * added a Stopwatch class - * added WarmableInterface - * improved extensibility between bundles - * added profiler storages for Memcache(d), File-based, MongoDB, Redis - * moved Filesystem class to its own component diff --git a/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php b/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php deleted file mode 100644 index 675c584..0000000 --- a/vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -/** - * CacheClearerInterface. - * - * @author Dustin Dobervich - */ -interface CacheClearerInterface -{ - /** - * Clears any caches necessary. - * - * @param string $cacheDir The cache directory - */ - public function clear($cacheDir); -} diff --git a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php deleted file mode 100644 index c749c7c..0000000 --- a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -/** - * ChainCacheClearer. - * - * @author Dustin Dobervich - */ -class ChainCacheClearer implements CacheClearerInterface -{ - /** - * @var array - */ - protected $clearers; - - /** - * Constructs a new instance of ChainCacheClearer. - * - * @param array $clearers The initial clearers - */ - public function __construct(array $clearers = array()) - { - $this->clearers = $clearers; - } - - /** - * {@inheritdoc} - */ - public function clear($cacheDir) - { - foreach ($this->clearers as $clearer) { - $clearer->clear($cacheDir); - } - } - - /** - * Adds a cache clearer to the aggregate. - * - * @param CacheClearerInterface $clearer - */ - public function add(CacheClearerInterface $clearer) - { - $this->clearers[] = $clearer; - } -} diff --git a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php deleted file mode 100644 index 2336b18..0000000 --- a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheClearer; - -use Psr\Cache\CacheItemPoolInterface; - -/** - * @author Nicolas Grekas - */ -class Psr6CacheClearer implements CacheClearerInterface -{ - private $pools = array(); - - public function __construct(array $pools = array()) - { - $this->pools = $pools; - } - - public function addPool(CacheItemPoolInterface $pool) - { - @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED); - - $this->pools[] = $pool; - } - - public function hasPool($name) - { - return isset($this->pools[$name]); - } - - public function clearPool($name) - { - if (!isset($this->pools[$name])) { - throw new \InvalidArgumentException(sprintf('Cache pool not found: %s.', $name)); - } - - return $this->pools[$name]->clear(); - } - - /** - * {@inheritdoc} - */ - public function clear($cacheDir) - { - foreach ($this->pools as $pool) { - $pool->clear(); - } - } -} diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php deleted file mode 100644 index dba35a6..0000000 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Abstract cache warmer that knows how to write a file to the cache. - * - * @author Fabien Potencier - */ -abstract class CacheWarmer implements CacheWarmerInterface -{ - protected function writeCacheFile($file, $content) - { - $tmpFile = @tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - @chmod($file, 0666 & ~umask()); - - return; - } - - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); - } -} diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php deleted file mode 100644 index e5f4e4f..0000000 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Aggregates several cache warmers into a single one. - * - * @author Fabien Potencier - */ -class CacheWarmerAggregate implements CacheWarmerInterface -{ - protected $warmers = array(); - protected $optionalsEnabled = false; - - public function __construct(array $warmers = array()) - { - foreach ($warmers as $warmer) { - $this->add($warmer); - } - } - - public function enableOptionalWarmers() - { - $this->optionalsEnabled = true; - } - - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir) - { - foreach ($this->warmers as $warmer) { - if (!$this->optionalsEnabled && $warmer->isOptional()) { - continue; - } - - $warmer->warmUp($cacheDir); - } - } - - /** - * Checks whether this warmer is optional or not. - * - * @return bool always false - */ - public function isOptional() - { - return false; - } - - public function setWarmers(array $warmers) - { - $this->warmers = array(); - foreach ($warmers as $warmer) { - $this->add($warmer); - } - } - - public function add(CacheWarmerInterface $warmer) - { - $this->warmers[] = $warmer; - } -} diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php deleted file mode 100644 index 8fece5e..0000000 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Interface for classes able to warm up the cache. - * - * @author Fabien Potencier - */ -interface CacheWarmerInterface extends WarmableInterface -{ - /** - * Checks whether this warmer is optional or not. - * - * Optional warmers can be ignored on certain conditions. - * - * A warmer should return true if the cache can be - * generated incrementally and on-demand. - * - * @return bool true if the warmer is optional, false otherwise - */ - public function isOptional(); -} diff --git a/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php b/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php deleted file mode 100644 index 25d8ee8..0000000 --- a/vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\CacheWarmer; - -/** - * Interface for classes that support warming their cache. - * - * @author Fabien Potencier - */ -interface WarmableInterface -{ - /** - * Warms up the cache. - * - * @param string $cacheDir The cache directory - */ - public function warmUp($cacheDir); -} diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php deleted file mode 100644 index c10b243..0000000 --- a/vendor/symfony/http-kernel/Client.php +++ /dev/null @@ -1,204 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\BrowserKit\Client as BaseClient; -use Symfony\Component\BrowserKit\Request as DomRequest; -use Symfony\Component\BrowserKit\Response as DomResponse; -use Symfony\Component\BrowserKit\History; -use Symfony\Component\BrowserKit\CookieJar; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Client simulates a browser and makes requests to a Kernel object. - * - * @author Fabien Potencier - * - * @method Request|null getRequest() A Request instance - * @method Response|null getResponse() A Response instance - */ -class Client extends BaseClient -{ - protected $kernel; - - /** - * @param HttpKernelInterface $kernel An HttpKernel instance - * @param array $server The server parameters (equivalent of $_SERVER) - * @param History $history A History instance to store the browser history - * @param CookieJar $cookieJar A CookieJar instance to store the cookies - */ - public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) - { - // These class properties must be set before calling the parent constructor, as it may depend on it. - $this->kernel = $kernel; - $this->followRedirects = false; - - parent::__construct($server, $history, $cookieJar); - } - - /** - * Makes a request. - * - * @param Request $request A Request instance - * - * @return Response A Response instance - */ - protected function doRequest($request) - { - $response = $this->kernel->handle($request); - - if ($this->kernel instanceof TerminableInterface) { - $this->kernel->terminate($request, $response); - } - - return $response; - } - - /** - * Returns the script to execute when the request must be insulated. - * - * @param Request $request A Request instance - * - * @return string - */ - protected function getScript($request) - { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); - $errorReporting = error_reporting(); - - $requires = ''; - foreach (get_declared_classes() as $class) { - if (0 === strpos($class, 'ComposerAutoloaderInit')) { - $r = new \ReflectionClass($class); - $file = dirname(dirname($r->getFileName())).'/autoload.php'; - if (file_exists($file)) { - $requires .= "require_once '".str_replace("'", "\\'", $file)."';\n"; - } - } - } - - if (!$requires) { - throw new \RuntimeException('Composer autoloader not found.'); - } - - $code = <<getHandleScript(); - } - - protected function getHandleScript() - { - return <<<'EOF' -$response = $kernel->handle($request); - -if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) { - $kernel->terminate($request, $response); -} - -echo serialize($response); -EOF; - } - - /** - * Converts the BrowserKit request to a HttpKernel request. - * - * @param DomRequest $request A DomRequest instance - * - * @return Request A Request instance - */ - protected function filterRequest(DomRequest $request) - { - $httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent()); - - foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) { - $httpRequest->files->set($key, $value); - } - - return $httpRequest; - } - - /** - * Filters an array of files. - * - * This method created test instances of UploadedFile so that the move() - * method can be called on those instances. - * - * If the size of a file is greater than the allowed size (from php.ini) then - * an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE. - * - * @see UploadedFile - * - * @param array $files An array of files - * - * @return array An array with all uploaded files marked as already moved - */ - protected function filterFiles(array $files) - { - $filtered = array(); - foreach ($files as $key => $value) { - if (is_array($value)) { - $filtered[$key] = $this->filterFiles($value); - } elseif ($value instanceof UploadedFile) { - if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { - $filtered[$key] = new UploadedFile( - '', - $value->getClientOriginalName(), - $value->getClientMimeType(), - 0, - UPLOAD_ERR_INI_SIZE, - true - ); - } else { - $filtered[$key] = new UploadedFile( - $value->getPathname(), - $value->getClientOriginalName(), - $value->getClientMimeType(), - $value->getClientSize(), - $value->getError(), - true - ); - } - } - } - - return $filtered; - } - - /** - * Converts the HttpKernel response to a BrowserKit response. - * - * @param Response $response A Response instance - * - * @return DomResponse A DomResponse instance - */ - protected function filterResponse($response) - { - // this is needed to support StreamedResponse - ob_start(); - $response->sendContent(); - $content = ob_get_clean(); - - return new DomResponse($content, $response->getStatusCode(), $response->headers->all()); - } -} diff --git a/vendor/symfony/http-kernel/Config/EnvParametersResource.php b/vendor/symfony/http-kernel/Config/EnvParametersResource.php deleted file mode 100644 index e7f4871..0000000 --- a/vendor/symfony/http-kernel/Config/EnvParametersResource.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Config; - -use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; - -/** - * EnvParametersResource represents resources stored in prefixed environment variables. - * - * @author Chris Wilkinson - */ -class EnvParametersResource implements SelfCheckingResourceInterface, \Serializable -{ - /** - * @var string - */ - private $prefix; - - /** - * @var string - */ - private $variables; - - /** - * @param string $prefix - */ - public function __construct($prefix) - { - $this->prefix = $prefix; - $this->variables = $this->findVariables(); - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return serialize($this->getResource()); - } - - /** - * @return array An array with two keys: 'prefix' for the prefix used and 'variables' containing all the variables watched by this resource - */ - public function getResource() - { - return array('prefix' => $this->prefix, 'variables' => $this->variables); - } - - /** - * {@inheritdoc} - */ - public function isFresh($timestamp) - { - return $this->findVariables() === $this->variables; - } - - public function serialize() - { - return serialize(array('prefix' => $this->prefix, 'variables' => $this->variables)); - } - - public function unserialize($serialized) - { - if (\PHP_VERSION_ID >= 70000) { - $unserialized = unserialize($serialized, array('allowed_classes' => false)); - } else { - $unserialized = unserialize($serialized); - } - - $this->prefix = $unserialized['prefix']; - $this->variables = $unserialized['variables']; - } - - private function findVariables() - { - $variables = array(); - - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, $this->prefix)) { - $variables[$key] = $value; - } - } - - ksort($variables); - - return $variables; - } -} diff --git a/vendor/symfony/http-kernel/Config/FileLocator.php b/vendor/symfony/http-kernel/Config/FileLocator.php deleted file mode 100644 index fb1f913..0000000 --- a/vendor/symfony/http-kernel/Config/FileLocator.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Config; - -use Symfony\Component\Config\FileLocator as BaseFileLocator; -use Symfony\Component\HttpKernel\KernelInterface; - -/** - * FileLocator uses the KernelInterface to locate resources in bundles. - * - * @author Fabien Potencier - */ -class FileLocator extends BaseFileLocator -{ - private $kernel; - private $path; - - /** - * @param KernelInterface $kernel A KernelInterface instance - * @param null|string $path The path the global resource directory - * @param array $paths An array of paths where to look for resources - */ - public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) - { - $this->kernel = $kernel; - if (null !== $path) { - $this->path = $path; - $paths[] = $path; - } - - parent::__construct($paths); - } - - /** - * {@inheritdoc} - */ - public function locate($file, $currentPath = null, $first = true) - { - if (isset($file[0]) && '@' === $file[0]) { - return $this->kernel->locateResource($file, $this->path, $first); - } - - return parent::locate($file, $currentPath, $first); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php deleted file mode 100644 index 2c17125..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\SessionValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface; - -/** - * Responsible for resolving the arguments passed to an action. - * - * @author Iltar van der Berg - */ -final class ArgumentResolver implements ArgumentResolverInterface -{ - private $argumentMetadataFactory; - - /** - * @var iterable|ArgumentValueResolverInterface[] - */ - private $argumentValueResolvers; - - public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, $argumentValueResolvers = array()) - { - $this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory(); - $this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers(); - } - - /** - * {@inheritdoc} - */ - public function getArguments(Request $request, $controller) - { - $arguments = array(); - - foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) { - foreach ($this->argumentValueResolvers as $resolver) { - if (!$resolver->supports($request, $metadata)) { - continue; - } - - $resolved = $resolver->resolve($request, $metadata); - - if (!$resolved instanceof \Generator) { - throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', get_class($resolver))); - } - - foreach ($resolved as $append) { - $arguments[] = $append; - } - - // continue to the next controller argument - continue 2; - } - - $representative = $controller; - - if (is_array($representative)) { - $representative = sprintf('%s::%s()', get_class($representative[0]), $representative[1]); - } elseif (is_object($representative)) { - $representative = get_class($representative); - } - - throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName())); - } - - return $arguments; - } - - public static function getDefaultArgumentValueResolvers() - { - return array( - new RequestAttributeValueResolver(), - new RequestValueResolver(), - new SessionValueResolver(), - new DefaultValueResolver(), - new VariadicValueResolver(), - ); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php deleted file mode 100644 index e58fd3a..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields the default value defined in the action signature when no value has been given. - * - * @author Iltar van der Berg - */ -final class DefaultValueResolver implements ArgumentValueResolverInterface -{ - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $argument->hasDefaultValue() ? $argument->getDefaultValue() : null; - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php deleted file mode 100644 index 05be372..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields a non-variadic argument's value from the request attributes. - * - * @author Iltar van der Berg - */ -final class RequestAttributeValueResolver implements ArgumentValueResolverInterface -{ - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return !$argument->isVariadic() && $request->attributes->has($argument->getName()); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $request->attributes->get($argument->getName()); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php deleted file mode 100644 index 2a5060a..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields the same instance as the request object passed along. - * - * @author Iltar van der Berg - */ -final class RequestValueResolver implements ArgumentValueResolverInterface -{ - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $request; - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php deleted file mode 100644 index b1da6a9..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Psr\Container\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields a service keyed by _controller and argument name. - * - * @author Nicolas Grekas - */ -final class ServiceValueResolver implements ArgumentValueResolverInterface -{ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return is_string($controller = $request->attributes->get('_controller')) && $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $this->container->get($request->attributes->get('_controller'))->get($argument->getName()); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php deleted file mode 100644 index 9e656d2..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields the Session. - * - * @author Iltar van der Berg - */ -final class SessionValueResolver implements ArgumentValueResolverInterface -{ - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - $type = $argument->getType(); - if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) { - return false; - } - - return $request->getSession() instanceof $type; - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - yield $request->getSession(); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php deleted file mode 100644 index 56ae5f1..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Yields a variadic argument's values from the request attributes. - * - * @author Iltar van der Berg - */ -final class VariadicValueResolver implements ArgumentValueResolverInterface -{ - /** - * {@inheritdoc} - */ - public function supports(Request $request, ArgumentMetadata $argument) - { - return $argument->isVariadic() && $request->attributes->has($argument->getName()); - } - - /** - * {@inheritdoc} - */ - public function resolve(Request $request, ArgumentMetadata $argument) - { - $values = $request->attributes->get($argument->getName()); - - if (!is_array($values)) { - throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), gettype($values))); - } - - foreach ($values as $value) { - yield $value; - } - } -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php b/vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php deleted file mode 100644 index 5c51230..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; - -/** - * An ArgumentResolverInterface instance knows how to determine the - * arguments for a specific action. - * - * @author Fabien Potencier - */ -interface ArgumentResolverInterface -{ - /** - * Returns the arguments to pass to the controller. - * - * @param Request $request - * @param callable $controller - * - * @return array An array of arguments to pass to the controller - * - * @throws \RuntimeException When no value could be provided for a required argument - */ - public function getArguments(Request $request, $controller); -} diff --git a/vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php b/vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php deleted file mode 100644 index fd7b09e..0000000 --- a/vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Responsible for resolving the value of an argument based on its metadata. - * - * @author Iltar van der Berg - */ -interface ArgumentValueResolverInterface -{ - /** - * Whether this resolver can resolve the value for the given ArgumentMetadata. - * - * @param Request $request - * @param ArgumentMetadata $argument - * - * @return bool - */ - public function supports(Request $request, ArgumentMetadata $argument); - - /** - * Returns the possible value(s). - * - * @param Request $request - * @param ArgumentMetadata $argument - * - * @return \Generator - */ - public function resolve(Request $request, ArgumentMetadata $argument); -} diff --git a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php deleted file mode 100644 index fbcecad..0000000 --- a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * A controller resolver searching for a controller in a psr-11 container when using the "service:method" notation. - * - * @author Fabien Potencier - * @author Maxime Steinhausser - */ -class ContainerControllerResolver extends ControllerResolver -{ - protected $container; - - public function __construct(ContainerInterface $container, LoggerInterface $logger = null) - { - $this->container = $container; - - parent::__construct($logger); - } - - /** - * {@inheritdoc} - */ - public function getController(Request $request) - { - $controller = parent::getController($request); - - if (is_array($controller) && isset($controller[0]) && is_string($controller[0]) && $this->container->has($controller[0])) { - $controller[0] = $this->instantiateController($controller[0]); - } - - return $controller; - } - - /** - * Returns a callable for the given controller. - * - * @param string $controller A Controller string - * - * @return mixed A PHP callable - * - * @throws \LogicException When the name could not be parsed - * @throws \InvalidArgumentException When the controller class does not exist - */ - protected function createController($controller) - { - if (false !== strpos($controller, '::')) { - return parent::createController($controller); - } - - if (1 == substr_count($controller, ':')) { - // controller in the "service:method" notation - list($service, $method) = explode(':', $controller, 2); - - return array($this->container->get($service), $method); - } - - if ($this->container->has($controller) && method_exists($service = $this->container->get($controller), '__invoke')) { - // invokable controller in the "service" notation - return $service; - } - - throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller)); - } - - /** - * {@inheritdoc} - */ - protected function instantiateController($class) - { - if ($this->container->has($class)) { - return $this->container->get($class); - } - - return parent::instantiateController($class); - } -} diff --git a/vendor/symfony/http-kernel/Controller/ControllerReference.php b/vendor/symfony/http-kernel/Controller/ControllerReference.php deleted file mode 100644 index fae4e7f..0000000 --- a/vendor/symfony/http-kernel/Controller/ControllerReference.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; - -/** - * Acts as a marker and a data holder for a Controller. - * - * Some methods in Symfony accept both a URI (as a string) or a controller as - * an argument. In the latter case, instead of passing an array representing - * the controller, you can use an instance of this class. - * - * @author Fabien Potencier - * - * @see FragmentRendererInterface - */ -class ControllerReference -{ - public $controller; - public $attributes = array(); - public $query = array(); - - /** - * @param string $controller The controller name - * @param array $attributes An array of parameters to add to the Request attributes - * @param array $query An array of parameters to add to the Request query string - */ - public function __construct($controller, array $attributes = array(), array $query = array()) - { - $this->controller = $controller; - $this->attributes = $attributes; - $this->query = $query; - } -} diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php deleted file mode 100644 index 7d93cc5..0000000 --- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ /dev/null @@ -1,261 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * This implementation uses the '_controller' request attribute to determine - * the controller to execute and uses the request attributes to determine - * the controller method arguments. - * - * @author Fabien Potencier - */ -class ControllerResolver implements ArgumentResolverInterface, ControllerResolverInterface -{ - private $logger; - - /** - * If the ...$arg functionality is available. - * - * Requires at least PHP 5.6.0 or HHVM 3.9.1 - * - * @var bool - */ - private $supportsVariadic; - - /** - * If scalar types exists. - * - * @var bool - */ - private $supportsScalarTypes; - - /** - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(LoggerInterface $logger = null) - { - $this->logger = $logger; - - $this->supportsVariadic = method_exists('ReflectionParameter', 'isVariadic'); - $this->supportsScalarTypes = method_exists('ReflectionParameter', 'getType'); - } - - /** - * {@inheritdoc} - * - * This method looks for a '_controller' request attribute that represents - * the controller name (a string like ClassName::MethodName). - */ - public function getController(Request $request) - { - if (!$controller = $request->attributes->get('_controller')) { - if (null !== $this->logger) { - $this->logger->warning('Unable to look for the controller as the "_controller" parameter is missing.'); - } - - return false; - } - - if (is_array($controller)) { - return $controller; - } - - if (is_object($controller)) { - if (method_exists($controller, '__invoke')) { - return $controller; - } - - throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', get_class($controller), $request->getPathInfo())); - } - - if (false === strpos($controller, ':')) { - if (method_exists($controller, '__invoke')) { - return $this->instantiateController($controller); - } elseif (function_exists($controller)) { - return $controller; - } - } - - $callable = $this->createController($controller); - - if (!is_callable($callable)) { - throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($callable))); - } - - return $callable; - } - - /** - * {@inheritdoc} - * - * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0. Implement the ArgumentResolverInterface and inject it in the HttpKernel instead. - */ - public function getArguments(Request $request, $controller) - { - @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); - - if (is_array($controller)) { - $r = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { - $r = new \ReflectionObject($controller); - $r = $r->getMethod('__invoke'); - } else { - $r = new \ReflectionFunction($controller); - } - - return $this->doGetArguments($request, $controller, $r->getParameters()); - } - - /** - * @param Request $request - * @param callable $controller - * @param \ReflectionParameter[] $parameters - * - * @return array The arguments to use when calling the action - * - * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0. Implement the ArgumentResolverInterface and inject it in the HttpKernel instead. - */ - protected function doGetArguments(Request $request, $controller, array $parameters) - { - @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); - - $attributes = $request->attributes->all(); - $arguments = array(); - foreach ($parameters as $param) { - if (array_key_exists($param->name, $attributes)) { - if ($this->supportsVariadic && $param->isVariadic() && is_array($attributes[$param->name])) { - $arguments = array_merge($arguments, array_values($attributes[$param->name])); - } else { - $arguments[] = $attributes[$param->name]; - } - } elseif ($param->getClass() && $param->getClass()->isInstance($request)) { - $arguments[] = $request; - } elseif ($param->isDefaultValueAvailable()) { - $arguments[] = $param->getDefaultValue(); - } elseif ($this->supportsScalarTypes && $param->hasType() && $param->allowsNull()) { - $arguments[] = null; - } else { - if (is_array($controller)) { - $repr = sprintf('%s::%s()', get_class($controller[0]), $controller[1]); - } elseif (is_object($controller)) { - $repr = get_class($controller); - } else { - $repr = $controller; - } - - throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->name)); - } - } - - return $arguments; - } - - /** - * Returns a callable for the given controller. - * - * @param string $controller A Controller string - * - * @return callable A PHP callable - * - * @throws \InvalidArgumentException - */ - protected function createController($controller) - { - if (false === strpos($controller, '::')) { - throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller)); - } - - list($class, $method) = explode('::', $controller, 2); - - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - return array($this->instantiateController($class), $method); - } - - /** - * Returns an instantiated controller. - * - * @param string $class A class name - * - * @return object - */ - protected function instantiateController($class) - { - return new $class(); - } - - private function getControllerError($callable) - { - if (is_string($callable)) { - if (false !== strpos($callable, '::')) { - $callable = explode('::', $callable); - } - - if (class_exists($callable) && !method_exists($callable, '__invoke')) { - return sprintf('Class "%s" does not have a method "__invoke".', $callable); - } - - if (!function_exists($callable)) { - return sprintf('Function "%s" does not exist.', $callable); - } - } - - if (!is_array($callable)) { - return sprintf('Invalid type for controller given, expected string or array, got "%s".', gettype($callable)); - } - - if (2 !== count($callable)) { - return sprintf('Invalid format for controller, expected array(controller, method) or controller::method.'); - } - - list($controller, $method) = $callable; - - if (is_string($controller) && !class_exists($controller)) { - return sprintf('Class "%s" does not exist.', $controller); - } - - $className = is_object($controller) ? get_class($controller) : $controller; - - if (method_exists($controller, $method)) { - return sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className); - } - - $collection = get_class_methods($controller); - - $alternatives = array(); - - foreach ($collection as $item) { - $lev = levenshtein($method, $item); - - if ($lev <= strlen($method) / 3 || false !== strpos($item, $method)) { - $alternatives[] = $item; - } - } - - asort($alternatives); - - $message = sprintf('Expected method "%s" on class "%s"', $method, $className); - - if (count($alternatives) > 0) { - $message .= sprintf(', did you mean "%s"?', implode('", "', $alternatives)); - } else { - $message .= sprintf('. Available methods: "%s".', implode('", "', $collection)); - } - - return $message; - } -} diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php b/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php deleted file mode 100644 index 0dd7cce..0000000 --- a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\HttpFoundation\Request; - -/** - * A ControllerResolverInterface implementation knows how to determine the - * controller to execute based on a Request object. - * - * It can also determine the arguments to pass to the Controller. - * - * A Controller can be any valid PHP callable. - * - * @author Fabien Potencier - */ -interface ControllerResolverInterface -{ - /** - * Returns the Controller instance associated with a Request. - * - * As several resolvers can exist for a single application, a resolver must - * return false when it is not able to determine the controller. - * - * The resolver must only throw an exception when it should be able to load - * controller but cannot because of some errors made by the developer. - * - * @param Request $request A Request instance - * - * @return callable|false A PHP callable representing the Controller, - * or false if this resolver is not able to determine the controller - * - * @throws \LogicException If the controller can't be found - */ - public function getController(Request $request); - - /** - * Returns the arguments to pass to the controller. - * - * @param Request $request A Request instance - * @param callable $controller A PHP callable - * - * @return array An array of arguments to pass to the controller - * - * @throws \RuntimeException When value for argument given is not provided - * - * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0. Please use the {@see ArgumentResolverInterface} instead. - */ - public function getArguments(Request $request, $controller); -} diff --git a/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php b/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php deleted file mode 100644 index 6fb0fa6..0000000 --- a/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\HttpFoundation\Request; - -/** - * @author Fabien Potencier - */ -class TraceableArgumentResolver implements ArgumentResolverInterface -{ - private $resolver; - private $stopwatch; - - public function __construct(ArgumentResolverInterface $resolver, Stopwatch $stopwatch) - { - $this->resolver = $resolver; - $this->stopwatch = $stopwatch; - } - - /** - * {@inheritdoc} - */ - public function getArguments(Request $request, $controller) - { - $e = $this->stopwatch->start('controller.get_arguments'); - - $ret = $this->resolver->getArguments($request, $controller); - - $e->stop(); - - return $ret; - } -} diff --git a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php deleted file mode 100644 index e7471b4..0000000 --- a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Controller; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\HttpFoundation\Request; - -/** - * @author Fabien Potencier - */ -class TraceableControllerResolver implements ControllerResolverInterface, ArgumentResolverInterface -{ - private $resolver; - private $stopwatch; - private $argumentResolver; - - /** - * @param ControllerResolverInterface $resolver A ControllerResolverInterface instance - * @param Stopwatch $stopwatch A Stopwatch instance - * @param ArgumentResolverInterface $argumentResolver Only required for BC - */ - public function __construct(ControllerResolverInterface $resolver, Stopwatch $stopwatch, ArgumentResolverInterface $argumentResolver = null) - { - $this->resolver = $resolver; - $this->stopwatch = $stopwatch; - $this->argumentResolver = $argumentResolver; - - // BC - if (null === $this->argumentResolver) { - $this->argumentResolver = $resolver; - } - - if (!$this->argumentResolver instanceof TraceableArgumentResolver) { - $this->argumentResolver = new TraceableArgumentResolver($this->argumentResolver, $this->stopwatch); - } - } - - /** - * {@inheritdoc} - */ - public function getController(Request $request) - { - $e = $this->stopwatch->start('controller.get_callable'); - - $ret = $this->resolver->getController($request); - - $e->stop(); - - return $ret; - } - - /** - * {@inheritdoc} - * - * @deprecated This method is deprecated as of 3.1 and will be removed in 4.0. - */ - public function getArguments(Request $request, $controller) - { - @trigger_error(sprintf('The %s method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED); - - $ret = $this->argumentResolver->getArguments($request, $controller); - - return $ret; - } -} diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php deleted file mode 100644 index 32316a8..0000000 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\ControllerMetadata; - -/** - * Responsible for storing metadata of an argument. - * - * @author Iltar van der Berg - */ -class ArgumentMetadata -{ - private $name; - private $type; - private $isVariadic; - private $hasDefaultValue; - private $defaultValue; - private $isNullable; - - /** - * @param string $name - * @param string $type - * @param bool $isVariadic - * @param bool $hasDefaultValue - * @param mixed $defaultValue - * @param bool $isNullable - */ - public function __construct($name, $type, $isVariadic, $hasDefaultValue, $defaultValue, $isNullable = false) - { - $this->name = $name; - $this->type = $type; - $this->isVariadic = $isVariadic; - $this->hasDefaultValue = $hasDefaultValue; - $this->defaultValue = $defaultValue; - $this->isNullable = $isNullable || null === $type || ($hasDefaultValue && null === $defaultValue); - } - - /** - * Returns the name as given in PHP, $foo would yield "foo". - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Returns the type of the argument. - * - * The type is the PHP class in 5.5+ and additionally the basic type in PHP 7.0+. - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Returns whether the argument is defined as "...$variadic". - * - * @return bool - */ - public function isVariadic() - { - return $this->isVariadic; - } - - /** - * Returns whether the argument has a default value. - * - * Implies whether an argument is optional. - * - * @return bool - */ - public function hasDefaultValue() - { - return $this->hasDefaultValue; - } - - /** - * Returns whether the argument accepts null values. - * - * @return bool - */ - public function isNullable() - { - return $this->isNullable; - } - - /** - * Returns the default value of the argument. - * - * @throws \LogicException if no default value is present; {@see self::hasDefaultValue()} - * - * @return mixed - */ - public function getDefaultValue() - { - if (!$this->hasDefaultValue) { - throw new \LogicException(sprintf('Argument $%s does not have a default value. Use %s::hasDefaultValue() to avoid this exception.', $this->name, __CLASS__)); - } - - return $this->defaultValue; - } -} diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php deleted file mode 100644 index d1e7af2..0000000 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\ControllerMetadata; - -/** - * Builds {@see ArgumentMetadata} objects based on the given Controller. - * - * @author Iltar van der Berg - */ -final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface -{ - /** - * If the ...$arg functionality is available. - * - * Requires at least PHP 5.6.0 or HHVM 3.9.1 - * - * @var bool - */ - private $supportsVariadic; - - /** - * If the reflection supports the getType() method to resolve types. - * - * Requires at least PHP 7.0.0 or HHVM 3.11.0 - * - * @var bool - */ - private $supportsParameterType; - - public function __construct() - { - $this->supportsVariadic = method_exists('ReflectionParameter', 'isVariadic'); - $this->supportsParameterType = method_exists('ReflectionParameter', 'getType'); - } - - /** - * {@inheritdoc} - */ - public function createArgumentMetadata($controller) - { - $arguments = array(); - - if (is_array($controller)) { - $reflection = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { - $reflection = (new \ReflectionObject($controller))->getMethod('__invoke'); - } else { - $reflection = new \ReflectionFunction($controller); - } - - foreach ($reflection->getParameters() as $param) { - $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull()); - } - - return $arguments; - } - - /** - * Returns whether an argument is variadic. - * - * @param \ReflectionParameter $parameter - * - * @return bool - */ - private function isVariadic(\ReflectionParameter $parameter) - { - return $this->supportsVariadic && $parameter->isVariadic(); - } - - /** - * Determines whether an argument has a default value. - * - * @param \ReflectionParameter $parameter - * - * @return bool - */ - private function hasDefaultValue(\ReflectionParameter $parameter) - { - return $parameter->isDefaultValueAvailable(); - } - - /** - * Returns a default value if available. - * - * @param \ReflectionParameter $parameter - * - * @return mixed|null - */ - private function getDefaultValue(\ReflectionParameter $parameter) - { - return $this->hasDefaultValue($parameter) ? $parameter->getDefaultValue() : null; - } - - /** - * Returns an associated type to the given parameter if available. - * - * @param \ReflectionParameter $parameter - * - * @return null|string - */ - private function getType(\ReflectionParameter $parameter) - { - if ($this->supportsParameterType) { - if (!$type = $parameter->getType()) { - return; - } - $typeName = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); - if ('array' === $typeName && !$type->isBuiltin()) { - // Special case for HHVM with variadics - return; - } - - return $typeName; - } - - if (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $info)) { - return $info[1]; - } - } -} diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php deleted file mode 100644 index 6ea179d..0000000 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\ControllerMetadata; - -/** - * Builds method argument data. - * - * @author Iltar van der Berg - */ -interface ArgumentMetadataFactoryInterface -{ - /** - * @param mixed $controller The controller to resolve the arguments for - * - * @return ArgumentMetadata[] - */ - public function createArgumentMetadata($controller); -} diff --git a/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php b/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php deleted file mode 100644 index b8405d5..0000000 --- a/vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * AjaxDataCollector. - * - * @author Bart van den Burg - */ -class AjaxDataCollector extends DataCollector -{ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // all collecting is done client side - } - - public function getName() - { - return 'ajax'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php deleted file mode 100644 index 9653421..0000000 --- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ /dev/null @@ -1,326 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\VarDumper\Caster\LinkStub; - -/** - * @author Fabien Potencier - */ -class ConfigDataCollector extends DataCollector implements LateDataCollectorInterface -{ - /** - * @var KernelInterface - */ - private $kernel; - private $name; - private $version; - private $hasVarDumper; - - /** - * @param string $name The name of the application using the web profiler - * @param string $version The version of the application using the web profiler - */ - public function __construct($name = null, $version = null) - { - $this->name = $name; - $this->version = $version; - $this->hasVarDumper = class_exists(LinkStub::class); - } - - /** - * Sets the Kernel associated with this Request. - * - * @param KernelInterface $kernel A KernelInterface instance - */ - public function setKernel(KernelInterface $kernel = null) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'app_name' => $this->name, - 'app_version' => $this->version, - 'token' => $response->headers->get('X-Debug-Token'), - 'symfony_version' => Kernel::VERSION, - 'symfony_state' => 'unknown', - 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', - 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', - 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', - 'php_version' => PHP_VERSION, - 'php_architecture' => PHP_INT_SIZE * 8, - 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', - 'php_timezone' => date_default_timezone_get(), - 'xdebug_enabled' => extension_loaded('xdebug'), - 'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'), - 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), - 'bundles' => array(), - 'sapi_name' => PHP_SAPI, - ); - - if (isset($this->kernel)) { - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $this->hasVarDumper ? new LinkStub($bundle->getPath()) : $bundle->getPath(); - } - - $this->data['symfony_state'] = $this->determineSymfonyState(); - $this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION); - $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE); - $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE); - $this->data['symfony_eom'] = $eom->format('F Y'); - $this->data['symfony_eol'] = $eol->format('F Y'); - } - - if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) { - $this->data['php_version'] = $matches[1]; - $this->data['php_version_extra'] = $matches[2]; - } - } - - public function lateCollect() - { - $this->data = $this->cloneVar($this->data); - } - - public function getApplicationName() - { - return $this->data['app_name']; - } - - public function getApplicationVersion() - { - return $this->data['app_version']; - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->data['token']; - } - - /** - * Gets the Symfony version. - * - * @return string The Symfony version - */ - public function getSymfonyVersion() - { - return $this->data['symfony_version']; - } - - /** - * Returns the state of the current Symfony release. - * - * @return string One of: unknown, dev, stable, eom, eol - */ - public function getSymfonyState() - { - return $this->data['symfony_state']; - } - - /** - * Returns the minor Symfony version used (without patch numbers of extra - * suffix like "RC", "beta", etc.). - * - * @return string - */ - public function getSymfonyMinorVersion() - { - return $this->data['symfony_minor_version']; - } - - /** - * Returns the human redable date when this Symfony version ends its - * maintenance period. - * - * @return string - */ - public function getSymfonyEom() - { - return $this->data['symfony_eom']; - } - - /** - * Returns the human redable date when this Symfony version reaches its - * "end of life" and won't receive bugs or security fixes. - * - * @return string - */ - public function getSymfonyEol() - { - return $this->data['symfony_eol']; - } - - /** - * Gets the PHP version. - * - * @return string The PHP version - */ - public function getPhpVersion() - { - return $this->data['php_version']; - } - - /** - * Gets the PHP version extra part. - * - * @return string|null The extra part - */ - public function getPhpVersionExtra() - { - return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null; - } - - /** - * @return int The PHP architecture as number of bits (e.g. 32 or 64) - */ - public function getPhpArchitecture() - { - return $this->data['php_architecture']; - } - - /** - * @return string - */ - public function getPhpIntlLocale() - { - return $this->data['php_intl_locale']; - } - - /** - * @return string - */ - public function getPhpTimezone() - { - return $this->data['php_timezone']; - } - - /** - * Gets the application name. - * - * @return string The application name - */ - public function getAppName() - { - return $this->data['name']; - } - - /** - * Gets the environment. - * - * @return string The environment - */ - public function getEnv() - { - return $this->data['env']; - } - - /** - * Returns true if the debug is enabled. - * - * @return bool true if debug is enabled, false otherwise - */ - public function isDebug() - { - return $this->data['debug']; - } - - /** - * Returns true if the XDebug is enabled. - * - * @return bool true if XDebug is enabled, false otherwise - */ - public function hasXDebug() - { - return $this->data['xdebug_enabled']; - } - - /** - * Returns true if APCu is enabled. - * - * @return bool true if APCu is enabled, false otherwise - */ - public function hasApcu() - { - return $this->data['apcu_enabled']; - } - - /** - * Returns true if Zend OPcache is enabled. - * - * @return bool true if Zend OPcache is enabled, false otherwise - */ - public function hasZendOpcache() - { - return $this->data['zend_opcache_enabled']; - } - - public function getBundles() - { - return $this->data['bundles']; - } - - /** - * Gets the PHP SAPI name. - * - * @return string The environment - */ - public function getSapiName() - { - return $this->data['sapi_name']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'config'; - } - - /** - * Tries to retrieve information about the current Symfony version. - * - * @return string One of: dev, stable, eom, eol - */ - private function determineSymfonyState() - { - $now = new \DateTime(); - $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month'); - $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month'); - - if ($now > $eol) { - $versionState = 'eol'; - } elseif ($now > $eom) { - $versionState = 'eom'; - } elseif ('' !== Kernel::EXTRA_VERSION) { - $versionState = 'dev'; - } else { - $versionState = 'stable'; - } - - return $versionState; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php deleted file mode 100644 index 845c2c1..0000000 --- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter; -use Symfony\Component\VarDumper\Caster\CutStub; -use Symfony\Component\VarDumper\Cloner\ClonerInterface; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\Stub; -use Symfony\Component\VarDumper\Cloner\VarCloner; - -/** - * DataCollector. - * - * Children of this class must store the collected data in the data property. - * - * @author Fabien Potencier - * @author Bernhard Schussek - */ -abstract class DataCollector implements DataCollectorInterface, \Serializable -{ - protected $data = array(); - - /** - * @var ValueExporter - */ - private $valueExporter; - - /** - * @var ClonerInterface - */ - private $cloner; - - public function serialize() - { - return serialize($this->data); - } - - public function unserialize($data) - { - $this->data = unserialize($data); - } - - /** - * Converts the variable into a serializable Data instance. - * - * This array can be displayed in the template using - * the VarDumper component. - * - * @param mixed $var - * - * @return Data - */ - protected function cloneVar($var) - { - if ($var instanceof Data) { - return $var; - } - if (null === $this->cloner) { - if (class_exists(CutStub::class)) { - $this->cloner = new VarCloner(); - $this->cloner->setMaxItems(-1); - $this->cloner->addCasters($this->getCasters()); - } else { - @trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since version 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED); - $this->cloner = false; - } - } - if (false === $this->cloner) { - if (null === $this->valueExporter) { - $this->valueExporter = new ValueExporter(); - } - - return $this->valueExporter->exportValue($var); - } - - return $this->cloner->cloneVar($var); - } - - /** - * Converts a PHP variable to a string. - * - * @param mixed $var A PHP variable - * - * @return string The string representation of the variable - * - * @deprecated since version 3.2, to be removed in 4.0. Use cloneVar() instead. - */ - protected function varToString($var) - { - @trigger_error(sprintf('The %s() method is deprecated since version 3.2 and will be removed in 4.0. Use cloneVar() instead.', __METHOD__), E_USER_DEPRECATED); - - if (null === $this->valueExporter) { - $this->valueExporter = new ValueExporter(); - } - - return $this->valueExporter->exportValue($var); - } - - /** - * @return callable[] The casters to add to the cloner - */ - protected function getCasters() - { - return array( - '*' => function ($v, array $a, Stub $s, $isNested) { - if (!$v instanceof Stub) { - foreach ($a as $k => $v) { - if (is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) { - $a[$k] = new CutStub($v); - } - } - } - - return $a; - }, - ); - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php b/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php deleted file mode 100644 index 2820ad5..0000000 --- a/vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * DataCollectorInterface. - * - * @author Fabien Potencier - */ -interface DataCollectorInterface -{ - /** - * Collects data for the given Request and Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An Exception instance - */ - public function collect(Request $request, Response $response, \Exception $exception = null); - - /** - * Returns the name of the collector. - * - * @return string The collector name - */ - public function getName(); -} diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php deleted file mode 100644 index b50386c..0000000 --- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ /dev/null @@ -1,303 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -use Twig\Template; - -/** - * @author Nicolas Grekas - */ -class DumpDataCollector extends DataCollector implements DataDumperInterface -{ - private $stopwatch; - private $fileLinkFormat; - private $dataCount = 0; - private $isCollected = true; - private $clonesCount = 0; - private $clonesIndex = 0; - private $rootRefs; - private $charset; - private $requestStack; - private $dumper; - private $dumperIsInjected; - - public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null, RequestStack $requestStack = null, DataDumperInterface $dumper = null) - { - $this->stopwatch = $stopwatch; - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - $this->charset = $charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'; - $this->requestStack = $requestStack; - $this->dumper = $dumper; - $this->dumperIsInjected = null !== $dumper; - - // All clones share these properties by reference: - $this->rootRefs = array( - &$this->data, - &$this->dataCount, - &$this->isCollected, - &$this->clonesCount, - ); - } - - public function __clone() - { - $this->clonesIndex = ++$this->clonesCount; - } - - public function dump(Data $data) - { - if ($this->stopwatch) { - $this->stopwatch->start('dump'); - } - if ($this->isCollected) { - $this->isCollected = false; - } - - $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 7); - - $file = $trace[0]['file']; - $line = $trace[0]['line']; - $name = false; - $fileExcerpt = false; - - for ($i = 1; $i < 7; ++$i) { - if (isset($trace[$i]['class'], $trace[$i]['function']) - && 'dump' === $trace[$i]['function'] - && 'Symfony\Component\VarDumper\VarDumper' === $trace[$i]['class'] - ) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - while (++$i < 7) { - if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) { - $file = $trace[$i]['file']; - $line = $trace[$i]['line']; - - break; - } elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof Template) { - $template = $trace[$i]['object']; - $name = $template->getTemplateName(); - $src = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : false); - $info = $template->getDebugInfo(); - if (isset($info[$trace[$i - 1]['line']])) { - $line = $info[$trace[$i - 1]['line']]; - $file = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getPath() : null; - - if ($src) { - $src = explode("\n", $src); - $fileExcerpt = array(); - - for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) { - $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; - } - - $fileExcerpt = '
      '.implode("\n", $fileExcerpt).'
    '; - } - } - break; - } - } - break; - } - } - - if (false === $name) { - $name = str_replace('\\', '/', $file); - $name = substr($name, strrpos($name, '/') + 1); - } - - if ($this->dumper) { - $this->doDump($data, $name, $file, $line); - } - - $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt'); - ++$this->dataCount; - - if ($this->stopwatch) { - $this->stopwatch->stop('dump'); - } - } - - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // Sub-requests and programmatic calls stay in the collected profile. - if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) { - return; - } - - // In all other conditions that remove the web debug toolbar, dumps are written on the output. - if (!$this->requestStack - || !$response->headers->has('X-Debug-Token') - || $response->isRedirection() - || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) - || 'html' !== $request->getRequestFormat() - || false === strripos($response->getContent(), '') - ) { - if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) { - $this->dumper = new HtmlDumper('php://output', $this->charset); - $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); - } else { - $this->dumper = new CliDumper('php://output', $this->charset); - } - - foreach ($this->data as $dump) { - $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); - } - } - } - - public function serialize() - { - if ($this->clonesCount !== $this->clonesIndex) { - return 'a:0:{}'; - } - - $this->data[] = $this->fileLinkFormat; - $this->data[] = $this->charset; - $ser = serialize($this->data); - $this->data = array(); - $this->dataCount = 0; - $this->isCollected = true; - if (!$this->dumperIsInjected) { - $this->dumper = null; - } - - return $ser; - } - - public function unserialize($data) - { - parent::unserialize($data); - $charset = array_pop($this->data); - $fileLinkFormat = array_pop($this->data); - $this->dataCount = count($this->data); - self::__construct($this->stopwatch, $fileLinkFormat, $charset); - } - - public function getDumpsCount() - { - return $this->dataCount; - } - - public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) - { - $data = fopen('php://memory', 'r+b'); - - if ('html' === $format) { - $dumper = new HtmlDumper($data, $this->charset); - $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); - } else { - throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format)); - } - $dumps = array(); - - foreach ($this->data as $dump) { - $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); - $dump['data'] = stream_get_contents($data, -1, 0); - ftruncate($data, 0); - rewind($data); - $dumps[] = $dump; - } - - return $dumps; - } - - public function getName() - { - return 'dump'; - } - - public function __destruct() - { - if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) { - $this->clonesCount = 0; - $this->isCollected = true; - - $h = headers_list(); - $i = count($h); - array_unshift($h, 'Content-Type: '.ini_get('default_mimetype')); - while (0 !== stripos($h[$i], 'Content-Type:')) { - --$i; - } - - if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) { - $this->dumper = new HtmlDumper('php://output', $this->charset); - $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); - } else { - $this->dumper = new CliDumper('php://output', $this->charset); - } - - foreach ($this->data as $i => $dump) { - $this->data[$i] = null; - $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); - } - - $this->data = array(); - $this->dataCount = 0; - } - } - - private function doDump($data, $name, $file, $line) - { - if ($this->dumper instanceof CliDumper) { - $contextDumper = function ($name, $file, $line, $fmt) { - if ($this instanceof HtmlDumper) { - if ($file) { - $s = $this->style('meta', '%s'); - $f = strip_tags($this->style('', $file)); - $name = strip_tags($this->style('', $name)); - if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) { - $name = sprintf(''.$s.'', strip_tags($this->style('', $link)), $f, $name); - } else { - $name = sprintf(''.$s.'', $f, $name); - } - } else { - $name = $this->style('meta', $name); - } - $this->line = $name.' on line '.$this->style('meta', $line).':'; - } else { - $this->line = $this->style('meta', $name).' on line '.$this->style('meta', $line).':'; - } - $this->dumpLine(0); - }; - $contextDumper = $contextDumper->bindTo($this->dumper, $this->dumper); - $contextDumper($name, $file, $line, $this->fileLinkFormat); - } else { - $cloner = new VarCloner(); - $this->dumper->dump($cloner->cloneVar($name.' on line '.$line.':')); - } - $this->dumper->dump($data); - } - - private function htmlEncode($s) - { - $html = ''; - - $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset); - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries('', ''); - - $cloner = new VarCloner(); - $dumper->dump($cloner->cloneVar($s)); - - return substr(strip_tags($html), 1, -1); - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php deleted file mode 100644 index 3d75f32..0000000 --- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface; - -/** - * EventDataCollector. - * - * @author Fabien Potencier - */ -class EventDataCollector extends DataCollector implements LateDataCollectorInterface -{ - protected $dispatcher; - - public function __construct(EventDispatcherInterface $dispatcher = null) - { - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'called_listeners' => array(), - 'not_called_listeners' => array(), - ); - } - - public function lateCollect() - { - if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { - $this->setCalledListeners($this->dispatcher->getCalledListeners()); - $this->setNotCalledListeners($this->dispatcher->getNotCalledListeners()); - } - $this->data = $this->cloneVar($this->data); - } - - /** - * Sets the called listeners. - * - * @param array $listeners An array of called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function setCalledListeners(array $listeners) - { - $this->data['called_listeners'] = $listeners; - } - - /** - * Gets the called listeners. - * - * @return array An array of called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getCalledListeners() - { - return $this->data['called_listeners']; - } - - /** - * Sets the not called listeners. - * - * @param array $listeners An array of not called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function setNotCalledListeners(array $listeners) - { - $this->data['not_called_listeners'] = $listeners; - } - - /** - * Gets the not called listeners. - * - * @return array An array of not called listeners - * - * @see TraceableEventDispatcherInterface - */ - public function getNotCalledListeners() - { - return $this->data['not_called_listeners']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'events'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php deleted file mode 100644 index 9fe8264..0000000 --- a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * ExceptionDataCollector. - * - * @author Fabien Potencier - */ -class ExceptionDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $exception) { - $this->data = array( - 'exception' => FlattenException::create($exception), - ); - } - } - - /** - * Checks if the exception is not null. - * - * @return bool true if the exception is not null, false otherwise - */ - public function hasException() - { - return isset($this->data['exception']); - } - - /** - * Gets the exception. - * - * @return \Exception The exception - */ - public function getException() - { - return $this->data['exception']; - } - - /** - * Gets the exception message. - * - * @return string The exception message - */ - public function getMessage() - { - return $this->data['exception']->getMessage(); - } - - /** - * Gets the exception code. - * - * @return int The exception code - */ - public function getCode() - { - return $this->data['exception']->getCode(); - } - - /** - * Gets the status code. - * - * @return int The status code - */ - public function getStatusCode() - { - return $this->data['exception']->getStatusCode(); - } - - /** - * Gets the exception trace. - * - * @return array The exception trace - */ - public function getTrace() - { - return $this->data['exception']->getTrace(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'exception'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php b/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php deleted file mode 100644 index 012332d..0000000 --- a/vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -/** - * LateDataCollectorInterface. - * - * @author Fabien Potencier - */ -interface LateDataCollectorInterface -{ - /** - * Collects data as late as possible. - */ - public function lateCollect(); -} diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php deleted file mode 100644 index 92fd0da..0000000 --- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ /dev/null @@ -1,262 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\Debug\Exception\SilencedErrorContext; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; - -/** - * LogDataCollector. - * - * @author Fabien Potencier - */ -class LoggerDataCollector extends DataCollector implements LateDataCollectorInterface -{ - private $logger; - private $containerPathPrefix; - - public function __construct($logger = null, $containerPathPrefix = null) - { - if (null !== $logger && $logger instanceof DebugLoggerInterface) { - $this->logger = $logger; - } - - $this->containerPathPrefix = $containerPathPrefix; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // everything is done as late as possible - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - if (null !== $this->logger) { - $containerDeprecationLogs = $this->getContainerDeprecationLogs(); - $this->data = $this->computeErrorsCount($containerDeprecationLogs); - $this->data['compiler_logs'] = $this->getContainerCompilerLogs(); - $this->data['logs'] = $this->sanitizeLogs(array_merge($this->logger->getLogs(), $containerDeprecationLogs)); - $this->data = $this->cloneVar($this->data); - } - } - - /** - * Gets the logs. - * - * @return array An array of logs - */ - public function getLogs() - { - return isset($this->data['logs']) ? $this->data['logs'] : array(); - } - - public function getPriorities() - { - return isset($this->data['priorities']) ? $this->data['priorities'] : array(); - } - - public function countErrors() - { - return isset($this->data['error_count']) ? $this->data['error_count'] : 0; - } - - public function countDeprecations() - { - return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0; - } - - public function countWarnings() - { - return isset($this->data['warning_count']) ? $this->data['warning_count'] : 0; - } - - public function countScreams() - { - return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0; - } - - public function getCompilerLogs() - { - return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : array(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'logger'; - } - - private function getContainerDeprecationLogs() - { - if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) { - return array(); - } - - $bootTime = filemtime($file); - $logs = array(); - foreach (unserialize(file_get_contents($file)) as $log) { - $log['context'] = array('exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])); - $log['timestamp'] = $bootTime; - $log['priority'] = 100; - $log['priorityName'] = 'DEBUG'; - $log['channel'] = '-'; - $log['scream'] = false; - unset($log['type'], $log['file'], $log['line'], $log['trace'], $log['trace'], $log['count']); - $logs[] = $log; - } - - return $logs; - } - - private function getContainerCompilerLogs() - { - if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Compiler.log')) { - return array(); - } - - $logs = array(); - foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) { - $log = explode(': ', $log, 2); - if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) { - $log = array('Unknown Compiler Pass', implode(': ', $log)); - } - - $logs[$log[0]][] = array('message' => $log[1]); - } - - return $logs; - } - - private function sanitizeLogs($logs) - { - $sanitizedLogs = array(); - - foreach ($logs as $log) { - if (!$this->isSilencedOrDeprecationErrorLog($log)) { - $sanitizedLogs[] = $log; - - continue; - } - - $message = $log['message']; - $exception = $log['context']['exception']; - - if ($exception instanceof SilencedErrorContext) { - if (isset($silencedLogs[$h = spl_object_hash($exception)])) { - continue; - } - $silencedLogs[$h] = true; - - if (!isset($sanitizedLogs[$message])) { - $sanitizedLogs[$message] = $log + array( - 'errorCount' => 0, - 'scream' => true, - ); - } - $sanitizedLogs[$message]['errorCount'] += $exception->count; - - continue; - } - - $errorId = md5("{$exception->getSeverity()}/{$exception->getLine()}/{$exception->getFile()}\0{$message}", true); - - if (isset($sanitizedLogs[$errorId])) { - ++$sanitizedLogs[$errorId]['errorCount']; - } else { - $log += array( - 'errorCount' => 1, - 'scream' => false, - ); - - $sanitizedLogs[$errorId] = $log; - } - } - - return array_values($sanitizedLogs); - } - - private function isSilencedOrDeprecationErrorLog(array $log) - { - if (!isset($log['context']['exception'])) { - return false; - } - - $exception = $log['context']['exception']; - - if ($exception instanceof SilencedErrorContext) { - return true; - } - - if ($exception instanceof \ErrorException && in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) { - return true; - } - - return false; - } - - private function computeErrorsCount(array $containerDeprecationLogs) - { - $silencedLogs = array(); - $count = array( - 'error_count' => $this->logger->countErrors(), - 'deprecation_count' => 0, - 'warning_count' => 0, - 'scream_count' => 0, - 'priorities' => array(), - ); - - foreach ($this->logger->getLogs() as $log) { - if (isset($count['priorities'][$log['priority']])) { - ++$count['priorities'][$log['priority']]['count']; - } else { - $count['priorities'][$log['priority']] = array( - 'count' => 1, - 'name' => $log['priorityName'], - ); - } - if ('WARNING' === $log['priorityName']) { - ++$count['warning_count']; - } - - if ($this->isSilencedOrDeprecationErrorLog($log)) { - $exception = $log['context']['exception']; - if ($exception instanceof SilencedErrorContext) { - if (isset($silencedLogs[$h = spl_object_hash($exception)])) { - continue; - } - $silencedLogs[$h] = true; - $count['scream_count'] += $exception->count; - } else { - ++$count['deprecation_count']; - } - } - } - - foreach ($containerDeprecationLogs as $deprecationLog) { - $count['deprecation_count'] += $deprecationLog['context']['exception']->count; - } - - ksort($count['priorities']); - - return $count; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php deleted file mode 100644 index b7f61f4..0000000 --- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * MemoryDataCollector. - * - * @author Fabien Potencier - */ -class MemoryDataCollector extends DataCollector implements LateDataCollectorInterface -{ - public function __construct() - { - $this->data = array( - 'memory' => 0, - 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), - ); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->updateMemoryUsage(); - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - $this->updateMemoryUsage(); - } - - /** - * Gets the memory. - * - * @return int The memory - */ - public function getMemory() - { - return $this->data['memory']; - } - - /** - * Gets the PHP memory limit. - * - * @return int The memory limit - */ - public function getMemoryLimit() - { - return $this->data['memory_limit']; - } - - /** - * Updates the memory usage data. - */ - public function updateMemoryUsage() - { - $this->data['memory'] = memory_get_peak_usage(true); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'memory'; - } - - private function convertToBytes($memoryLimit) - { - if ('-1' === $memoryLimit) { - return -1; - } - - $memoryLimit = strtolower($memoryLimit); - $max = strtolower(ltrim($memoryLimit, '+')); - if (0 === strpos($max, '0x')) { - $max = intval($max, 16); - } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); - } else { - $max = (int) $max; - } - - switch (substr($memoryLimit, -1)) { - case 't': $max *= 1024; - // no break - case 'g': $max *= 1024; - // no break - case 'm': $max *= 1024; - // no break - case 'k': $max *= 1024; - } - - return $max; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php deleted file mode 100644 index 7049844..0000000 --- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ /dev/null @@ -1,397 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\ParameterBag; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * RequestDataCollector. - * - * @author Fabien Potencier - */ -class RequestDataCollector extends DataCollector implements EventSubscriberInterface, LateDataCollectorInterface -{ - /** @var \SplObjectStorage */ - protected $controllers; - - public function __construct() - { - $this->controllers = new \SplObjectStorage(); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - // attributes are serialized and as they can be anything, they need to be converted to strings. - $attributes = array(); - $route = ''; - foreach ($request->attributes->all() as $key => $value) { - if ('_route' === $key) { - $route = is_object($value) ? $value->getPath() : $value; - $attributes[$key] = $route; - } else { - $attributes[$key] = $value; - } - } - - $content = null; - try { - $content = $request->getContent(); - } catch (\LogicException $e) { - // the user already got the request content as a resource - $content = false; - } - - $sessionMetadata = array(); - $sessionAttributes = array(); - $session = null; - $flashes = array(); - if ($request->hasSession()) { - $session = $request->getSession(); - if ($session->isStarted()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); - $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); - $sessionAttributes = $session->all(); - $flashes = $session->getFlashBag()->peekAll(); - } - } - - $statusCode = $response->getStatusCode(); - - $responseCookies = array(); - foreach ($response->headers->getCookies() as $cookie) { - $responseCookies[$cookie->getName()] = $cookie; - } - - $this->data = array( - 'method' => $request->getMethod(), - 'format' => $request->getRequestFormat(), - 'content' => $content, - 'content_type' => $response->headers->get('Content-Type', 'text/html'), - 'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '', - 'status_code' => $statusCode, - 'request_query' => $request->query->all(), - 'request_request' => $request->request->all(), - 'request_headers' => $request->headers->all(), - 'request_server' => $request->server->all(), - 'request_cookies' => $request->cookies->all(), - 'request_attributes' => $attributes, - 'route' => $route, - 'response_headers' => $response->headers->all(), - 'response_cookies' => $responseCookies, - 'session_metadata' => $sessionMetadata, - 'session_attributes' => $sessionAttributes, - 'flashes' => $flashes, - 'path_info' => $request->getPathInfo(), - 'controller' => 'n/a', - 'locale' => $request->getLocale(), - ); - - if (isset($this->data['request_headers']['php-auth-pw'])) { - $this->data['request_headers']['php-auth-pw'] = '******'; - } - - if (isset($this->data['request_server']['PHP_AUTH_PW'])) { - $this->data['request_server']['PHP_AUTH_PW'] = '******'; - } - - if (isset($this->data['request_request']['_password'])) { - $this->data['request_request']['_password'] = '******'; - } - - foreach ($this->data as $key => $value) { - if (!is_array($value)) { - continue; - } - if ('request_headers' === $key || 'response_headers' === $key) { - $this->data[$key] = array_map(function ($v) { return isset($v[0]) && !isset($v[1]) ? $v[0] : $v; }, $value); - } - } - - if (isset($this->controllers[$request])) { - $this->data['controller'] = $this->parseController($this->controllers[$request]); - unset($this->controllers[$request]); - } - - if (null !== $session && $session->isStarted()) { - if ($request->attributes->has('_redirected')) { - $this->data['redirect'] = $session->remove('sf_redirect'); - } - - if ($response->isRedirect()) { - $session->set('sf_redirect', array( - 'token' => $response->headers->get('x-debug-token'), - 'route' => $request->attributes->get('_route', 'n/a'), - 'method' => $request->getMethod(), - 'controller' => $this->parseController($request->attributes->get('_controller')), - 'status_code' => $statusCode, - 'status_text' => Response::$statusTexts[(int) $statusCode], - )); - } - } - - $this->data['identifier'] = $this->data['route'] ?: (is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']); - } - - public function lateCollect() - { - $this->data = $this->cloneVar($this->data); - } - - public function getMethod() - { - return $this->data['method']; - } - - public function getPathInfo() - { - return $this->data['path_info']; - } - - public function getRequestRequest() - { - return new ParameterBag($this->data['request_request']->getValue()); - } - - public function getRequestQuery() - { - return new ParameterBag($this->data['request_query']->getValue()); - } - - public function getRequestHeaders() - { - return new ParameterBag($this->data['request_headers']->getValue()); - } - - public function getRequestServer($raw = false) - { - return new ParameterBag($this->data['request_server']->getValue($raw)); - } - - public function getRequestCookies($raw = false) - { - return new ParameterBag($this->data['request_cookies']->getValue($raw)); - } - - public function getRequestAttributes() - { - return new ParameterBag($this->data['request_attributes']->getValue()); - } - - public function getResponseHeaders() - { - return new ParameterBag($this->data['response_headers']->getValue()); - } - - public function getResponseCookies() - { - return new ParameterBag($this->data['response_cookies']->getValue()); - } - - public function getSessionMetadata() - { - return $this->data['session_metadata']->getValue(); - } - - public function getSessionAttributes() - { - return $this->data['session_attributes']->getValue(); - } - - public function getFlashes() - { - return $this->data['flashes']->getValue(); - } - - public function getContent() - { - return $this->data['content']; - } - - public function getContentType() - { - return $this->data['content_type']; - } - - public function getStatusText() - { - return $this->data['status_text']; - } - - public function getStatusCode() - { - return $this->data['status_code']; - } - - public function getFormat() - { - return $this->data['format']; - } - - public function getLocale() - { - return $this->data['locale']; - } - - /** - * Gets the route name. - * - * The _route request attributes is automatically set by the Router Matcher. - * - * @return string The route - */ - public function getRoute() - { - return $this->data['route']; - } - - public function getIdentifier() - { - return $this->data['identifier']; - } - - /** - * Gets the route parameters. - * - * The _route_params request attributes is automatically set by the RouterListener. - * - * @return array The parameters - */ - public function getRouteParams() - { - return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : array(); - } - - /** - * Gets the parsed controller. - * - * @return array|string The controller as a string or array of data - * with keys 'class', 'method', 'file' and 'line' - */ - public function getController() - { - return $this->data['controller']; - } - - /** - * Gets the previous request attributes. - * - * @return array|bool A legacy array of data from the previous redirection response - * or false otherwise - */ - public function getRedirect() - { - return isset($this->data['redirect']) ? $this->data['redirect'] : false; - } - - public function onKernelController(FilterControllerEvent $event) - { - $this->controllers[$event->getRequest()] = $event->getController(); - } - - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest() || !$event->getRequest()->hasSession() || !$event->getRequest()->getSession()->isStarted()) { - return; - } - - if ($event->getRequest()->getSession()->has('sf_redirect')) { - $event->getRequest()->attributes->set('_redirected', true); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::CONTROLLER => 'onKernelController', - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'request'; - } - - /** - * Parse a controller. - * - * @param mixed $controller The controller to parse - * - * @return array|string An array of controller data or a simple string - */ - protected function parseController($controller) - { - if (is_string($controller) && false !== strpos($controller, '::')) { - $controller = explode('::', $controller); - } - - if (is_array($controller)) { - try { - $r = new \ReflectionMethod($controller[0], $controller[1]); - - return array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], - 'method' => $controller[1], - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } catch (\ReflectionException $e) { - if (is_callable($controller)) { - // using __call or __callStatic - return array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], - 'method' => $controller[1], - 'file' => 'n/a', - 'line' => 'n/a', - ); - } - } - } - - if ($controller instanceof \Closure) { - $r = new \ReflectionFunction($controller); - - return array( - 'class' => $r->getName(), - 'method' => null, - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } - - if (is_object($controller)) { - $r = new \ReflectionClass($controller); - - return array( - 'class' => $r->getName(), - 'method' => null, - 'file' => $r->getFileName(), - 'line' => $r->getStartLine(), - ); - } - - return is_string($controller) ? $controller : 'n/a'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php deleted file mode 100644 index 76d9623..0000000 --- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; - -/** - * RouterDataCollector. - * - * @author Fabien Potencier - */ -class RouterDataCollector extends DataCollector -{ - protected $controllers; - - public function __construct() - { - $this->controllers = new \SplObjectStorage(); - - $this->data = array( - 'redirect' => false, - 'url' => null, - 'route' => null, - ); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if ($response instanceof RedirectResponse) { - $this->data['redirect'] = true; - $this->data['url'] = $response->getTargetUrl(); - - if ($this->controllers->contains($request)) { - $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); - } - } - - unset($this->controllers[$request]); - } - - protected function guessRoute(Request $request, $controller) - { - return 'n/a'; - } - - /** - * Remembers the controller associated to each request. - * - * @param FilterControllerEvent $event The filter controller event - */ - public function onKernelController(FilterControllerEvent $event) - { - $this->controllers[$event->getRequest()] = $event->getController(); - } - - /** - * @return bool Whether this request will result in a redirect - */ - public function getRedirect() - { - return $this->data['redirect']; - } - - /** - * @return string|null The target URL - */ - public function getTargetUrl() - { - return $this->data['url']; - } - - /** - * @return string|null The target route - */ - public function getTargetRoute() - { - return $this->data['route']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'router'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php deleted file mode 100644 index 2d39156..0000000 --- a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\KernelInterface; - -/** - * TimeDataCollector. - * - * @author Fabien Potencier - */ -class TimeDataCollector extends DataCollector implements LateDataCollectorInterface -{ - protected $kernel; - protected $stopwatch; - - public function __construct(KernelInterface $kernel = null, $stopwatch = null) - { - $this->kernel = $kernel; - $this->stopwatch = $stopwatch; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (null !== $this->kernel) { - $startTime = $this->kernel->getStartTime(); - } else { - $startTime = $request->server->get('REQUEST_TIME_FLOAT'); - } - - $this->data = array( - 'token' => $response->headers->get('X-Debug-Token'), - 'start_time' => $startTime * 1000, - 'events' => array(), - ); - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - if (null !== $this->stopwatch && isset($this->data['token'])) { - $this->setEvents($this->stopwatch->getSectionEvents($this->data['token'])); - } - unset($this->data['token']); - } - - /** - * Sets the request events. - * - * @param array $events The request events - */ - public function setEvents(array $events) - { - foreach ($events as $event) { - $event->ensureStopped(); - } - - $this->data['events'] = $events; - } - - /** - * Gets the request events. - * - * @return array The request events - */ - public function getEvents() - { - return $this->data['events']; - } - - /** - * Gets the request elapsed time. - * - * @return float The elapsed time - */ - public function getDuration() - { - if (!isset($this->data['events']['__section__'])) { - return 0; - } - - $lastEvent = $this->data['events']['__section__']; - - return $lastEvent->getOrigin() + $lastEvent->getDuration() - $this->getStartTime(); - } - - /** - * Gets the initialization time. - * - * This is the time spent until the beginning of the request handling. - * - * @return float The elapsed time - */ - public function getInitTime() - { - if (!isset($this->data['events']['__section__'])) { - return 0; - } - - return $this->data['events']['__section__']->getOrigin() - $this->getStartTime(); - } - - /** - * Gets the request time. - * - * @return int The time - */ - public function getStartTime() - { - return $this->data['start_time']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'time'; - } -} diff --git a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php deleted file mode 100644 index f1e4831..0000000 --- a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector\Util; - -@trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since version 3.2 and will be removed in 4.0. Use the VarDumper component instead.', E_USER_DEPRECATED); - -/** - * @author Bernhard Schussek - * - * @deprecated since version 3.2, to be removed in 4.0. Use the VarDumper component instead. - */ -class ValueExporter -{ - /** - * Converts a PHP value to a string. - * - * @param mixed $value The PHP value - * @param int $depth only for internal usage - * @param bool $deep only for internal usage - * - * @return string The string representation of the given value - */ - public function exportValue($value, $depth = 1, $deep = false) - { - if ($value instanceof \__PHP_Incomplete_Class) { - return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value)); - } - - if (is_object($value)) { - if ($value instanceof \DateTimeInterface) { - return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM)); - } - - return sprintf('Object(%s)', get_class($value)); - } - - if (is_array($value)) { - if (empty($value)) { - return '[]'; - } - - $indent = str_repeat(' ', $depth); - - $a = array(); - foreach ($value as $k => $v) { - if (is_array($v)) { - $deep = true; - } - $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep)); - } - - if ($deep) { - return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1)); - } - - $s = sprintf('[%s]', implode(', ', $a)); - - if (80 > strlen($s)) { - return $s; - } - - return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a)); - } - - if (is_resource($value)) { - return sprintf('Resource(%s#%d)', get_resource_type($value), $value); - } - - if (null === $value) { - return 'null'; - } - - if (false === $value) { - return 'false'; - } - - if (true === $value) { - return 'true'; - } - - return (string) $value; - } - - private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value) - { - $array = new \ArrayObject($value); - - return $array['__PHP_Incomplete_Class_Name']; - } -} diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php deleted file mode 100644 index c340d9b..0000000 --- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; - -/** - * Formats debug file links. - * - * @author Jérémy Romey - */ -class FileLinkFormatter implements \Serializable -{ - private $fileLinkFormat; - private $requestStack; - private $baseDir; - private $urlFormat; - - public function __construct($fileLinkFormat = null, RequestStack $requestStack = null, $baseDir = null, $urlFormat = null) - { - $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - if ($fileLinkFormat && !is_array($fileLinkFormat)) { - $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f); - $fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); - } - - $this->fileLinkFormat = $fileLinkFormat; - $this->requestStack = $requestStack; - $this->baseDir = $baseDir; - $this->urlFormat = $urlFormat; - } - - public function format($file, $line) - { - if ($fmt = $this->getFileLinkFormat()) { - for ($i = 1; isset($fmt[$i]); ++$i) { - if (0 === strpos($file, $k = $fmt[$i++])) { - $file = substr_replace($file, $fmt[$i], 0, strlen($k)); - break; - } - } - - return strtr($fmt[0], array('%f' => $file, '%l' => $line)); - } - - return false; - } - - public function serialize() - { - return serialize($this->getFileLinkFormat()); - } - - public function unserialize($serialized) - { - if (\PHP_VERSION_ID >= 70000) { - $this->fileLinkFormat = unserialize($serialized, array('allowed_classes' => false)); - } else { - $this->fileLinkFormat = unserialize($serialized); - } - } - - private function getFileLinkFormat() - { - if ($this->fileLinkFormat) { - return $this->fileLinkFormat; - } - if ($this->requestStack && $this->baseDir && $this->urlFormat) { - $request = $this->requestStack->getMasterRequest(); - if ($request instanceof Request) { - return array( - $request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat, - $this->baseDir.DIRECTORY_SEPARATOR, '', - ); - } - } - } -} diff --git a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php b/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php deleted file mode 100644 index fbc49df..0000000 --- a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Debug; - -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\Event; - -/** - * Collects some data about event listeners. - * - * This event dispatcher delegates the dispatching to another one. - * - * @author Fabien Potencier - */ -class TraceableEventDispatcher extends BaseTraceableEventDispatcher -{ - /** - * {@inheritdoc} - */ - protected function preDispatch($eventName, Event $event) - { - switch ($eventName) { - case KernelEvents::REQUEST: - $this->stopwatch->openSection(); - break; - case KernelEvents::VIEW: - case KernelEvents::RESPONSE: - // stop only if a controller has been executed - if ($this->stopwatch->isStarted('controller')) { - $this->stopwatch->stop('controller'); - } - break; - case KernelEvents::TERMINATE: - $token = $event->getResponse()->headers->get('X-Debug-Token'); - // There is a very special case when using built-in AppCache class as kernel wrapper, in the case - // of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A]. - // In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID - // is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception - // which must be caught. - try { - $this->stopwatch->openSection($token); - } catch (\LogicException $e) { - } - break; - } - } - - /** - * {@inheritdoc} - */ - protected function postDispatch($eventName, Event $event) - { - switch ($eventName) { - case KernelEvents::CONTROLLER_ARGUMENTS: - $this->stopwatch->start('controller', 'section'); - break; - case KernelEvents::RESPONSE: - $token = $event->getResponse()->headers->get('X-Debug-Token'); - $this->stopwatch->stopSection($token); - break; - case KernelEvents::TERMINATE: - // In the special case described in the `preDispatch` method above, the `$token` section - // does not exist, then closing it throws an exception which must be caught. - $token = $event->getResponse()->headers->get('X-Debug-Token'); - try { - $this->stopwatch->stopSection($token); - } catch (\LogicException $e) { - } - break; - } - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php deleted file mode 100644 index b1ecebd..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Composer\Autoload\ClassLoader; -use Symfony\Component\Debug\DebugClassLoader; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\HttpKernel\Kernel; - -/** - * Sets the classes to compile in the cache for the container. - * - * @author Fabien Potencier - */ -class AddAnnotatedClassesToCachePass implements CompilerPassInterface -{ - private $kernel; - - public function __construct(Kernel $kernel) - { - $this->kernel = $kernel; - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $classes = array(); - $annotatedClasses = array(); - foreach ($container->getExtensions() as $extension) { - if ($extension instanceof Extension) { - if (\PHP_VERSION_ID < 70000) { - $classes = array_merge($classes, $extension->getClassesToCompile()); - } - $annotatedClasses = array_merge($annotatedClasses, $extension->getAnnotatedClassesToCompile()); - } - } - - $existingClasses = $this->getClassesInComposerClassMaps(); - - if (\PHP_VERSION_ID < 70000) { - $classes = $container->getParameterBag()->resolveValue($classes); - $this->kernel->setClassCache($this->expandClasses($classes, $existingClasses)); - } - $annotatedClasses = $container->getParameterBag()->resolveValue($annotatedClasses); - $this->kernel->setAnnotatedClassCache($this->expandClasses($annotatedClasses, $existingClasses)); - } - - /** - * Expands the given class patterns using a list of existing classes. - * - * @param array $patterns The class patterns to expand - * @param array $classes The existing classes to match against the patterns - * - * @return array A list of classes derivated from the patterns - */ - private function expandClasses(array $patterns, array $classes) - { - $expanded = array(); - - // Explicit classes declared in the patterns are returned directly - foreach ($patterns as $key => $pattern) { - if ('\\' !== substr($pattern, -1) && false === strpos($pattern, '*')) { - unset($patterns[$key]); - $expanded[] = ltrim($pattern, '\\'); - } - } - - // Match patterns with the classes list - $regexps = $this->patternsToRegexps($patterns); - - foreach ($classes as $class) { - $class = ltrim($class, '\\'); - - if ($this->matchAnyRegexps($class, $regexps)) { - $expanded[] = $class; - } - } - - return array_unique($expanded); - } - - private function getClassesInComposerClassMaps() - { - $classes = array(); - - foreach (spl_autoload_functions() as $function) { - if (!is_array($function)) { - continue; - } - - if ($function[0] instanceof DebugClassLoader) { - $function = $function[0]->getClassLoader(); - } - - if (is_array($function) && $function[0] instanceof ClassLoader) { - $classes += array_filter($function[0]->getClassMap()); - } - } - - return array_keys($classes); - } - - private function patternsToRegexps($patterns) - { - $regexps = array(); - - foreach ($patterns as $pattern) { - // Escape user input - $regex = preg_quote(ltrim($pattern, '\\')); - - // Wildcards * and ** - $regex = strtr($regex, array('\\*\\*' => '.*?', '\\*' => '[^\\\\]*?')); - - // If this class does not end by a slash, anchor the end - if ('\\' !== substr($regex, -1)) { - $regex .= '$'; - } - - $regexps[] = '{^\\\\'.$regex.'}'; - } - - return $regexps; - } - - private function matchAnyRegexps($class, $regexps) - { - $blacklisted = false !== strpos($class, 'Test'); - - foreach ($regexps as $regex) { - if ($blacklisted && false === strpos($regex, 'Test')) { - continue; - } - - if (preg_match($regex, '\\'.$class)) { - return true; - } - } - - return false; - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php deleted file mode 100644 index 4ffa175..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -@trigger_error('The '.__NAMESPACE__.'\AddClassesToCachePass class is deprecated since version 3.3 and will be removed in 4.0.', E_USER_DEPRECATED); - -/** - * Sets the classes to compile in the cache for the container. - * - * @author Fabien Potencier - * - * @deprecated since version 3.3, to be removed in 4.0. - */ -class AddClassesToCachePass extends AddAnnotatedClassesToCachePass -{ -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php b/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php deleted file mode 100644 index c7eca30..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * This extension sub-class provides first-class integration with the - * Config/Definition Component. - * - * You can use this as base class if - * - * a) you use the Config/Definition component for configuration, - * b) your configuration class is named "Configuration", and - * c) the configuration class resides in the DependencyInjection sub-folder. - * - * @author Johannes M. Schmitt - */ -abstract class ConfigurableExtension extends Extension -{ - /** - * {@inheritdoc} - */ - final public function load(array $configs, ContainerBuilder $container) - { - $this->loadInternal($this->processConfiguration($this->getConfiguration($configs, $container), $configs), $container); - } - - /** - * Configures the passed container according to the merged configuration. - * - * @param array $mergedConfig - * @param ContainerBuilder $container - */ - abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container); -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php b/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php deleted file mode 100644 index 343e217..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Gathers and configures the argument value resolvers. - * - * @author Iltar van der Berg - */ -class ControllerArgumentValueResolverPass implements CompilerPassInterface -{ - use PriorityTaggedServiceTrait; - - private $argumentResolverService; - private $argumentValueResolverTag; - - public function __construct($argumentResolverService = 'argument_resolver', $argumentValueResolverTag = 'controller.argument_value_resolver') - { - $this->argumentResolverService = $argumentResolverService; - $this->argumentValueResolverTag = $argumentValueResolverTag; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition($this->argumentResolverService)) { - return; - } - - $container - ->getDefinition($this->argumentResolverService) - ->replaceArgument(1, new IteratorArgument($this->findAndSortTaggedServices($this->argumentValueResolverTag, $container))) - ; - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/vendor/symfony/http-kernel/DependencyInjection/Extension.php deleted file mode 100644 index f6449f4..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/Extension.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension; - -/** - * Allow adding classes to the class cache. - * - * @author Fabien Potencier - */ -abstract class Extension extends BaseExtension -{ - private $classes = array(); - private $annotatedClasses = array(); - - /** - * Gets the classes to cache. - * - * @return array An array of classes - * - * @deprecated since version 3.3, to be removed in 4.0. - */ - public function getClassesToCompile() - { - if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); - } - - return $this->classes; - } - - /** - * Gets the annotated classes to cache. - * - * @return array An array of classes - */ - public function getAnnotatedClassesToCompile() - { - return $this->annotatedClasses; - } - - /** - * Adds classes to the class cache. - * - * @param array $classes An array of class patterns - * - * @deprecated since version 3.3, to be removed in 4.0. - */ - public function addClassesToCompile(array $classes) - { - if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); - } - - $this->classes = array_merge($this->classes, $classes); - } - - /** - * Adds annotated classes to the class cache. - * - * @param array $annotatedClasses An array of class patterns - */ - public function addAnnotatedClassesToCompile(array $annotatedClasses) - { - $this->annotatedClasses = array_merge($this->annotatedClasses, $annotatedClasses); - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php deleted file mode 100644 index ac52c87..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; - -/** - * Adds services tagged kernel.fragment_renderer as HTTP content rendering strategies. - * - * @author Fabien Potencier - */ -class FragmentRendererPass implements CompilerPassInterface -{ - private $handlerService; - private $rendererTag; - - /** - * @param string $handlerService Service name of the fragment handler in the container - * @param string $rendererTag Tag name used for fragments - */ - public function __construct($handlerService = 'fragment.handler', $rendererTag = 'kernel.fragment_renderer') - { - $this->handlerService = $handlerService; - $this->rendererTag = $rendererTag; - } - - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition($this->handlerService)) { - return; - } - - $definition = $container->getDefinition($this->handlerService); - $renderers = array(); - foreach ($container->findTaggedServiceIds($this->rendererTag, true) as $id => $tags) { - $def = $container->getDefinition($id); - $class = $container->getParameterBag()->resolveValue($def->getClass()); - - if (!$r = $container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } - if (!$r->isSubclassOf(FragmentRendererInterface::class)) { - throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, FragmentRendererInterface::class)); - } - - foreach ($tags as $tag) { - $renderers[$tag['alias']] = new Reference($id); - } - } - - $definition->replaceArgument(0, ServiceLocatorTagPass::register($container, $renderers)); - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php deleted file mode 100644 index 314217a..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Psr\Container\ContainerInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; - -/** - * Lazily loads fragment renderers from the dependency injection container. - * - * @author Fabien Potencier - */ -class LazyLoadingFragmentHandler extends FragmentHandler -{ - private $container; - /** - * @deprecated since version 3.3, to be removed in 4.0 - */ - private $rendererIds = array(); - private $initialized = array(); - - /** - * @param ContainerInterface $container A container - * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests - * @param bool $debug Whether the debug mode is enabled or not - */ - public function __construct(ContainerInterface $container, RequestStack $requestStack, $debug = false) - { - $this->container = $container; - - parent::__construct($requestStack, array(), $debug); - } - - /** - * Adds a service as a fragment renderer. - * - * @param string $name The service name - * @param string $renderer The render service id - * - * @deprecated since version 3.3, to be removed in 4.0 - */ - public function addRendererService($name, $renderer) - { - @trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); - - $this->rendererIds[$name] = $renderer; - } - - /** - * {@inheritdoc} - */ - public function render($uri, $renderer = 'inline', array $options = array()) - { - // BC 3.x, to be removed in 4.0 - if (isset($this->rendererIds[$renderer])) { - $this->addRenderer($this->container->get($this->rendererIds[$renderer])); - unset($this->rendererIds[$renderer]); - - return parent::render($uri, $renderer, $options); - } - - if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) { - $this->addRenderer($this->container->get($renderer)); - $this->initialized[$renderer] = true; - } - - return parent::render($uri, $renderer, $options); - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php deleted file mode 100644 index dcd7382..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass as BaseMergeExtensionConfigurationPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Ensures certain extensions are always loaded. - * - * @author Kris Wallsmith - */ -class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPass -{ - private $extensions; - - public function __construct(array $extensions) - { - $this->extensions = $extensions; - } - - public function process(ContainerBuilder $container) - { - foreach ($this->extensions as $extension) { - if (!count($container->getExtensionConfig($extension))) { - $container->loadFromExtension($extension, array()); - } - } - - parent::process($container); - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php deleted file mode 100644 index 9c00f99..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; - -/** - * Creates the service-locators required by ServiceValueResolver. - * - * @author Nicolas Grekas - */ -class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface -{ - private $resolverServiceId; - private $controllerTag; - - public function __construct($resolverServiceId = 'argument_resolver.service', $controllerTag = 'controller.service_arguments') - { - $this->resolverServiceId = $resolverServiceId; - $this->controllerTag = $controllerTag; - } - - public function process(ContainerBuilder $container) - { - if (false === $container->hasDefinition($this->resolverServiceId)) { - return; - } - - $parameterBag = $container->getParameterBag(); - $controllers = array(); - - foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) { - $def = $container->getDefinition($id); - $def->setPublic(true); - $class = $def->getClass(); - $autowire = $def->isAutowired(); - - // resolve service class, taking parent definitions into account - while (!$class && $def instanceof ChildDefinition) { - $def = $container->findDefinition($def->getParent()); - $class = $def->getClass(); - } - $class = $parameterBag->resolveValue($class); - - if (!$r = $container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } - $isContainerAware = $r->implementsInterface(ContainerAwareInterface::class) || is_subclass_of($class, AbstractController::class); - - // get regular public methods - $methods = array(); - $arguments = array(); - foreach ($r->getMethods(\ReflectionMethod::IS_PUBLIC) as $r) { - if ('setContainer' === $r->name && $isContainerAware) { - continue; - } - if (!$r->isConstructor() && !$r->isDestructor() && !$r->isAbstract()) { - $methods[strtolower($r->name)] = array($r, $r->getParameters()); - } - } - - // validate and collect explicit per-actions and per-arguments service references - foreach ($tags as $attributes) { - if (!isset($attributes['action']) && !isset($attributes['argument']) && !isset($attributes['id'])) { - $autowire = true; - continue; - } - foreach (array('action', 'argument', 'id') as $k) { - if (!isset($attributes[$k][0])) { - throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id)); - } - } - if (!isset($methods[$action = strtolower($attributes['action'])])) { - throw new InvalidArgumentException(sprintf('Invalid "action" attribute on tag "%s" for service "%s": no public "%s()" method found on class "%s".', $this->controllerTag, $id, $attributes['action'], $class)); - } - list($r, $parameters) = $methods[$action]; - $found = false; - - foreach ($parameters as $p) { - if ($attributes['argument'] === $p->name) { - if (!isset($arguments[$r->name][$p->name])) { - $arguments[$r->name][$p->name] = $attributes['id']; - } - $found = true; - break; - } - } - - if (!$found) { - throw new InvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $this->controllerTag, $id, $r->name, $attributes['argument'], $class)); - } - } - - foreach ($methods as list($r, $parameters)) { - /** @var \ReflectionMethod $r */ - - // create a per-method map of argument-names to service/type-references - $args = array(); - foreach ($parameters as $p) { - /** @var \ReflectionParameter $p */ - $type = $target = ProxyHelper::getTypeHint($r, $p, true); - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - - if (isset($arguments[$r->name][$p->name])) { - $target = $arguments[$r->name][$p->name]; - if ('?' !== $target[0]) { - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - } elseif ('' === $target = (string) substr($target, 1)) { - throw new InvalidArgumentException(sprintf('A "%s" tag must have non-empty "id" attributes for service "%s".', $this->controllerTag, $id)); - } elseif ($p->allowsNull() && !$p->isOptional()) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; - } - } elseif (!$type || !$autowire) { - continue; - } - - if ($type && !$p->isOptional() && !$p->allowsNull() && !class_exists($type) && !interface_exists($type, false)) { - $message = sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type); - - // see if the type-hint lives in the same namespace as the controller - if (0 === strncmp($type, $class, strrpos($class, '\\'))) { - $message .= ' Did you forget to add a use statement?'; - } - - throw new InvalidArgumentException($message); - } - - $args[$p->name] = $type ? new TypedReference($target, $type, $r->class, $invalidBehavior) : new Reference($target, $invalidBehavior); - } - // register the maps as a per-method service-locators - if ($args) { - $controllers[$id.':'.$r->name] = ServiceLocatorTagPass::register($container, $args); - } - } - } - - $container->getDefinition($this->resolverServiceId) - ->replaceArgument(0, ServiceLocatorTagPass::register($container, $controllers)); - } -} diff --git a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php deleted file mode 100644 index 440b0d0..0000000 --- a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DependencyInjection; - -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Removes empty service-locators registered for ServiceValueResolver. - * - * @author Nicolas Grekas - */ -class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface -{ - private $resolverServiceId; - - public function __construct($resolverServiceId = 'argument_resolver.service') - { - $this->resolverServiceId = $resolverServiceId; - } - - public function process(ContainerBuilder $container) - { - if (false === $container->hasDefinition($this->resolverServiceId)) { - return; - } - - $serviceResolver = $container->getDefinition($this->resolverServiceId); - $controllerLocator = $container->getDefinition((string) $serviceResolver->getArgument(0)); - $controllers = $controllerLocator->getArgument(0); - - foreach ($controllers as $controller => $argumentRef) { - $argumentLocator = $container->getDefinition((string) $argumentRef->getValues()[0]); - - if (!$argumentLocator->getArgument(0)) { - // remove empty argument locators - $reason = sprintf('Removing service-argument resolver for controller "%s": no corresponding services exist for the referenced types.', $controller); - } else { - // any methods listed for call-at-instantiation cannot be actions - $reason = false; - $action = substr(strrchr($controller, ':'), 1); - $id = substr($controller, 0, -1 - strlen($action)); - $controllerDef = $container->getDefinition($id); - foreach ($controllerDef->getMethodCalls() as list($method, $args)) { - if (0 === strcasecmp($action, $method)) { - $reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id); - break; - } - } - if (!$reason) { - if ($controllerDef->getClass() === $id) { - $controllers[$id.'::'.$action] = $argumentRef; - } - if ('__invoke' === $action) { - $controllers[$id] = $argumentRef; - } - continue; - } - } - - unset($controllers[$controller]); - $container->log($this, $reason); - } - - $controllerLocator->replaceArgument(0, $controllers); - } -} diff --git a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php deleted file mode 100644 index 1dc784e..0000000 --- a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows filtering of controller arguments. - * - * You can call getController() to retrieve the controller and getArguments - * to retrieve the current arguments. With setArguments() you can replace - * arguments that are used to call the controller. - * - * Arguments set in the event must be compatible with the signature of the - * controller. - * - * @author Christophe Coevoet - */ -class FilterControllerArgumentsEvent extends FilterControllerEvent -{ - private $arguments; - - public function __construct(HttpKernelInterface $kernel, callable $controller, array $arguments, Request $request, $requestType) - { - parent::__construct($kernel, $controller, $request, $requestType); - - $this->arguments = $arguments; - } - - /** - * @return array - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * @param array $arguments - */ - public function setArguments(array $arguments) - { - $this->arguments = $arguments; - } -} diff --git a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerEvent.php deleted file mode 100644 index e0d46aa..0000000 --- a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows filtering of a controller callable. - * - * You can call getController() to retrieve the current controller. With - * setController() you can set a new controller that is used in the processing - * of the request. - * - * Controllers should be callables. - * - * @author Bernhard Schussek - */ -class FilterControllerEvent extends KernelEvent -{ - /** - * The current controller. - */ - private $controller; - - public function __construct(HttpKernelInterface $kernel, callable $controller, Request $request, $requestType) - { - parent::__construct($kernel, $request, $requestType); - - $this->setController($controller); - } - - /** - * Returns the current controller. - * - * @return callable - */ - public function getController() - { - return $this->controller; - } - - /** - * Sets a new controller. - * - * @param callable $controller - */ - public function setController(callable $controller) - { - $this->controller = $controller; - } -} diff --git a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php b/vendor/symfony/http-kernel/Event/FilterResponseEvent.php deleted file mode 100644 index ed816a9..0000000 --- a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to filter a Response object. - * - * You can call getResponse() to retrieve the current response. With - * setResponse() you can set a new response that will be returned to the - * browser. - * - * @author Bernhard Schussek - */ -class FilterResponseEvent extends KernelEvent -{ - /** - * The current response object. - * - * @var Response - */ - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) - { - parent::__construct($kernel, $request, $requestType); - - $this->setResponse($response); - } - - /** - * Returns the current response object. - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a new response object. - * - * @param Response $response - */ - public function setResponse(Response $response) - { - $this->response = $response; - } -} diff --git a/vendor/symfony/http-kernel/Event/FinishRequestEvent.php b/vendor/symfony/http-kernel/Event/FinishRequestEvent.php deleted file mode 100644 index ee72484..0000000 --- a/vendor/symfony/http-kernel/Event/FinishRequestEvent.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -/** - * Triggered whenever a request is fully processed. - * - * @author Benjamin Eberlei - */ -class FinishRequestEvent extends KernelEvent -{ -} diff --git a/vendor/symfony/http-kernel/Event/GetResponseEvent.php b/vendor/symfony/http-kernel/Event/GetResponseEvent.php deleted file mode 100644 index 4c96a4b..0000000 --- a/vendor/symfony/http-kernel/Event/GetResponseEvent.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to create a response for a request. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - */ -class GetResponseEvent extends KernelEvent -{ - /** - * The response object. - * - * @var Response - */ - private $response; - - /** - * Returns the response object. - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } - - /** - * Sets a response and stops event propagation. - * - * @param Response $response - */ - public function setResponse(Response $response) - { - $this->response = $response; - - $this->stopPropagation(); - } - - /** - * Returns whether a response was set. - * - * @return bool Whether a response was set - */ - public function hasResponse() - { - return null !== $this->response; - } -} diff --git a/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php b/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php deleted file mode 100644 index f70ce09..0000000 --- a/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for the return value of a controller. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * @author Bernhard Schussek - */ -class GetResponseForControllerResultEvent extends GetResponseEvent -{ - /** - * The return value of the controller. - * - * @var mixed - */ - private $controllerResult; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, $controllerResult) - { - parent::__construct($kernel, $request, $requestType); - - $this->controllerResult = $controllerResult; - } - - /** - * Returns the return value of the controller. - * - * @return mixed The controller return value - */ - public function getControllerResult() - { - return $this->controllerResult; - } - - /** - * Assigns the return value of the controller. - * - * @param mixed $controllerResult The controller return value - */ - public function setControllerResult($controllerResult) - { - $this->controllerResult = $controllerResult; - } -} diff --git a/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php b/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php deleted file mode 100644 index 751b745..0000000 --- a/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Allows to create a response for a thrown exception. - * - * Call setResponse() to set the response that will be returned for the - * current request. The propagation of this event is stopped as soon as a - * response is set. - * - * You can also call setException() to replace the thrown exception. This - * exception will be thrown if no response is set during processing of this - * event. - * - * @author Bernhard Schussek - */ -class GetResponseForExceptionEvent extends GetResponseEvent -{ - /** - * The exception object. - * - * @var \Exception - */ - private $exception; - - /** - * @var bool - */ - private $allowCustomResponseCode = false; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \Exception $e) - { - parent::__construct($kernel, $request, $requestType); - - $this->setException($e); - } - - /** - * Returns the thrown exception. - * - * @return \Exception The thrown exception - */ - public function getException() - { - return $this->exception; - } - - /** - * Replaces the thrown exception. - * - * This exception will be thrown if no response is set in the event. - * - * @param \Exception $exception The thrown exception - */ - public function setException(\Exception $exception) - { - $this->exception = $exception; - } - - /** - * Mark the event as allowing a custom response code. - */ - public function allowCustomResponseCode() - { - $this->allowCustomResponseCode = true; - } - - /** - * Returns true if the event allows a custom response code. - * - * @return bool - */ - public function isAllowingCustomResponseCode() - { - return $this->allowCustomResponseCode; - } -} diff --git a/vendor/symfony/http-kernel/Event/KernelEvent.php b/vendor/symfony/http-kernel/Event/KernelEvent.php deleted file mode 100644 index 2043a01..0000000 --- a/vendor/symfony/http-kernel/Event/KernelEvent.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\Event; - -/** - * Base class for events thrown in the HttpKernel component. - * - * @author Bernhard Schussek - */ -class KernelEvent extends Event -{ - /** - * The kernel in which this event was thrown. - * - * @var HttpKernelInterface - */ - private $kernel; - - /** - * The request the kernel is currently processing. - * - * @var Request - */ - private $request; - - /** - * The request type the kernel is currently processing. One of - * HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST. - * - * @var int - */ - private $requestType; - - public function __construct(HttpKernelInterface $kernel, Request $request, $requestType) - { - $this->kernel = $kernel; - $this->request = $request; - $this->requestType = $requestType; - } - - /** - * Returns the kernel in which this event was thrown. - * - * @return HttpKernelInterface - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Returns the request the kernel is currently processing. - * - * @return Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the request type the kernel is currently processing. - * - * @return int One of HttpKernelInterface::MASTER_REQUEST and - * HttpKernelInterface::SUB_REQUEST - */ - public function getRequestType() - { - return $this->requestType; - } - - /** - * Checks if this is a master request. - * - * @return bool True if the request is a master request - */ - public function isMasterRequest() - { - return HttpKernelInterface::MASTER_REQUEST === $this->requestType; - } -} diff --git a/vendor/symfony/http-kernel/Event/PostResponseEvent.php b/vendor/symfony/http-kernel/Event/PostResponseEvent.php deleted file mode 100644 index 2406fdd..0000000 --- a/vendor/symfony/http-kernel/Event/PostResponseEvent.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Event; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Allows to execute logic after a response was sent. - * - * Since it's only triggered on master requests, the `getRequestType()` method - * will always return the value of `HttpKernelInterface::MASTER_REQUEST`. - * - * @author Jordi Boggiano - */ -class PostResponseEvent extends KernelEvent -{ - private $response; - - public function __construct(HttpKernelInterface $kernel, Request $request, Response $response) - { - parent::__construct($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - - $this->response = $response; - } - - /** - * Returns the response for which this event was thrown. - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php deleted file mode 100644 index 7a6c207..0000000 --- a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Sets the session in the request. - * - * @author Johannes M. Schmitt - */ -abstract class AbstractSessionListener implements EventSubscriberInterface -{ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $request = $event->getRequest(); - $session = $this->getSession(); - if (null === $session || $request->hasSession()) { - return; - } - - $request->setSession($session); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 128), - ); - } - - /** - * Gets the session object. - * - * @return SessionInterface|null A SessionInterface instance or null if no session is available - */ - abstract protected function getSession(); -} diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php deleted file mode 100644 index eb6e66c..0000000 --- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * TestSessionListener. - * - * Saves session in test environment. - * - * @author Bulat Shakirzyanov - * @author Fabien Potencier - */ -abstract class AbstractTestSessionListener implements EventSubscriberInterface -{ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - // bootstrap the session - $session = $this->getSession(); - if (!$session) { - return; - } - - $cookies = $event->getRequest()->cookies; - - if ($cookies->has($session->getName())) { - $session->setId($cookies->get($session->getName())); - } - } - - /** - * Checks if session was initialized and saves if current request is master - * Runs on 'kernel.response' in test environment. - * - * @param FilterResponseEvent $event - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { - $session->save(); - $params = session_get_cookie_params(); - $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 192), - KernelEvents::RESPONSE => array('onKernelResponse', -128), - ); - } - - /** - * Gets the session object. - * - * @return SessionInterface|null A SessionInterface instance or null if no session is available - */ - abstract protected function getSession(); -} diff --git a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php deleted file mode 100644 index 280844c..0000000 --- a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; - -/** - * Adds configured formats to each request. - * - * @author Gildas Quemener - */ -class AddRequestFormatsListener implements EventSubscriberInterface -{ - /** - * @var array - */ - protected $formats; - - /** - * @param array $formats - */ - public function __construct(array $formats) - { - $this->formats = $formats; - } - - /** - * Adds request formats. - * - * @param GetResponseEvent $event - */ - public function onKernelRequest(GetResponseEvent $event) - { - foreach ($this->formats as $format => $mimeTypes) { - $event->getRequest()->setFormat($format, $mimeTypes); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array(KernelEvents::REQUEST => array('onKernelRequest', 1)); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php deleted file mode 100644 index 29e1725..0000000 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\KernelEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\Console\Event\ConsoleEvent; -use Symfony\Component\Console\Output\ConsoleOutputInterface; - -/** - * Configures errors and exceptions handlers. - * - * @author Nicolas Grekas - */ -class DebugHandlersListener implements EventSubscriberInterface -{ - private $exceptionHandler; - private $logger; - private $levels; - private $throwAt; - private $scream; - private $fileLinkFormat; - private $scope; - private $firstCall = true; - - /** - * @param callable|null $exceptionHandler A handler that will be called on Exception - * @param LoggerInterface|null $logger A PSR-3 logger - * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants - * @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value - * @param bool $scream Enables/disables screaming mode, where even silenced errors are logged - * @param string|array $fileLinkFormat The format for links to source files - * @param bool $scope Enables/disables scoping mode - */ - public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null, $scope = true) - { - $this->exceptionHandler = $exceptionHandler; - $this->logger = $logger; - $this->levels = null === $levels ? E_ALL : $levels; - $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null)); - $this->scream = (bool) $scream; - $this->fileLinkFormat = $fileLinkFormat; - $this->scope = (bool) $scope; - } - - /** - * Configures the error handler. - * - * @param Event|null $event The triggering event - */ - public function configure(Event $event = null) - { - if (!$this->firstCall) { - return; - } - $this->firstCall = false; - if ($this->logger || null !== $this->throwAt) { - $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_error_handler(); - if ($handler instanceof ErrorHandler) { - if ($this->logger) { - $handler->setDefaultLogger($this->logger, $this->levels); - if (is_array($this->levels)) { - $levels = 0; - foreach ($this->levels as $type => $log) { - $levels |= $type; - } - } else { - $levels = $this->levels; - } - if ($this->scream) { - $handler->screamAt($levels); - } - if ($this->scope) { - $handler->scopeAt($this->levels); - } else { - $handler->scopeAt(0, true); - } - $this->logger = $this->levels = null; - } - if (null !== $this->throwAt) { - $handler->throwAt($this->throwAt, true); - } - } - } - if (!$this->exceptionHandler) { - if ($event instanceof KernelEvent) { - if (method_exists($event->getKernel(), 'terminateWithException')) { - $this->exceptionHandler = array($event->getKernel(), 'terminateWithException'); - } - } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { - $output = $event->getOutput(); - if ($output instanceof ConsoleOutputInterface) { - $output = $output->getErrorOutput(); - } - $this->exceptionHandler = function ($e) use ($app, $output) { - $app->renderException($e, $output); - }; - } - } - if ($this->exceptionHandler) { - $handler = set_exception_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; - restore_exception_handler(); - if ($handler instanceof ErrorHandler) { - $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler; - $handler->setExceptionHandler($h); - $handler = is_array($h) ? $h[0] : null; - } - if ($handler instanceof ExceptionHandler) { - $handler->setHandler($this->exceptionHandler); - if (null !== $this->fileLinkFormat) { - $handler->setFileLinkFormat($this->fileLinkFormat); - } - } - $this->exceptionHandler = null; - } - } - - public static function getSubscribedEvents() - { - $events = array(KernelEvents::REQUEST => array('configure', 2048)); - - if ('cli' === PHP_SAPI && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { - $events[ConsoleEvents::COMMAND] = array('configure', 2048); - } - - return $events; - } -} diff --git a/vendor/symfony/http-kernel/EventListener/DumpListener.php b/vendor/symfony/http-kernel/EventListener/DumpListener.php deleted file mode 100644 index 88acef3..0000000 --- a/vendor/symfony/http-kernel/EventListener/DumpListener.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\VarDumper\Cloner\ClonerInterface; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -use Symfony\Component\VarDumper\VarDumper; - -/** - * Configures dump() handler. - * - * @author Nicolas Grekas - */ -class DumpListener implements EventSubscriberInterface -{ - private $cloner; - private $dumper; - - /** - * @param ClonerInterface $cloner Cloner service - * @param DataDumperInterface $dumper Dumper service - */ - public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) - { - $this->cloner = $cloner; - $this->dumper = $dumper; - } - - public function configure() - { - $cloner = $this->cloner; - $dumper = $this->dumper; - - VarDumper::setHandler(function ($var) use ($cloner, $dumper) { - $dumper->dump($cloner->cloneVar($var)); - }); - } - - public static function getSubscribedEvents() - { - if (!class_exists(ConsoleEvents::class)) { - return array(); - } - - // Register early to have a working dump() as early as possible - return array(ConsoleEvents::COMMAND => array('configure', 1024)); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php deleted file mode 100644 index cf3a2f0..0000000 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ExceptionListener. - * - * @author Fabien Potencier - */ -class ExceptionListener implements EventSubscriberInterface -{ - protected $controller; - protected $logger; - - public function __construct($controller, LoggerInterface $logger = null) - { - $this->controller = $controller; - $this->logger = $logger; - } - - public function onKernelException(GetResponseForExceptionEvent $event) - { - $exception = $event->getException(); - $request = $event->getRequest(); - - $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); - - $request = $this->duplicateRequest($exception, $request); - - try { - $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false); - } catch (\Exception $e) { - $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine())); - - $wrapper = $e; - - while ($prev = $wrapper->getPrevious()) { - if ($exception === $wrapper = $prev) { - throw $e; - } - } - - $prev = new \ReflectionProperty('Exception', 'previous'); - $prev->setAccessible(true); - $prev->setValue($wrapper, $exception); - - throw $e; - } - - $event->setResponse($response); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::EXCEPTION => array('onKernelException', -128), - ); - } - - /** - * Logs an exception. - * - * @param \Exception $exception The \Exception instance - * @param string $message The error message to log - */ - protected function logException(\Exception $exception, $message) - { - if (null !== $this->logger) { - if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->critical($message, array('exception' => $exception)); - } else { - $this->logger->error($message, array('exception' => $exception)); - } - } - } - - /** - * Clones the request for the exception. - * - * @param \Exception $exception The thrown exception - * @param Request $request The original request - * - * @return Request $request The cloned request - */ - protected function duplicateRequest(\Exception $exception, Request $request) - { - $attributes = array( - '_controller' => $this->controller, - 'exception' => FlattenException::create($exception), - 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, - ); - $request = $request->duplicate(null, null, $attributes); - $request->setMethod('GET'); - - return $request; - } -} diff --git a/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/vendor/symfony/http-kernel/EventListener/FragmentListener.php deleted file mode 100644 index 4e81452..0000000 --- a/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\HttpKernel\UriSigner; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Handles content fragments represented by special URIs. - * - * All URL paths starting with /_fragment are handled as - * content fragments by this listener. - * - * If throws an AccessDeniedHttpException exception if the request - * is not signed or if it is not an internal sub-request. - * - * @author Fabien Potencier - */ -class FragmentListener implements EventSubscriberInterface -{ - private $signer; - private $fragmentPath; - - /** - * @param UriSigner $signer A UriSigner instance - * @param string $fragmentPath The path that triggers this listener - */ - public function __construct(UriSigner $signer, $fragmentPath = '/_fragment') - { - $this->signer = $signer; - $this->fragmentPath = $fragmentPath; - } - - /** - * Fixes request attributes when the path is '/_fragment'. - * - * @param GetResponseEvent $event A GetResponseEvent instance - * - * @throws AccessDeniedHttpException if the request does not come from a trusted IP - */ - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - if ($this->fragmentPath !== rawurldecode($request->getPathInfo())) { - return; - } - - if ($request->attributes->has('_controller')) { - // Is a sub-request: no need to parse _path but it should still be removed from query parameters as below. - $request->query->remove('_path'); - - return; - } - - if ($event->isMasterRequest()) { - $this->validateRequest($request); - } - - parse_str($request->query->get('_path', ''), $attributes); - $request->attributes->add($attributes); - $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', array()), $attributes)); - $request->query->remove('_path'); - } - - protected function validateRequest(Request $request) - { - // is the Request safe? - if (!$request->isMethodSafe(false)) { - throw new AccessDeniedHttpException(); - } - - // is the Request signed? - // we cannot use $request->getUri() here as we want to work with the original URI (no query string reordering) - if ($this->signer->check($request->getSchemeAndHttpHost().$request->getBaseUrl().$request->getPathInfo().(null !== ($qs = $request->server->get('QUERY_STRING')) ? '?'.$qs : ''))) { - return; - } - - throw new AccessDeniedHttpException(); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 48)), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/vendor/symfony/http-kernel/EventListener/LocaleListener.php deleted file mode 100644 index 427ea82..0000000 --- a/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Initializes the locale based on the current request. - * - * @author Fabien Potencier - */ -class LocaleListener implements EventSubscriberInterface -{ - private $router; - private $defaultLocale; - private $requestStack; - - /** - * @param RequestStack $requestStack A RequestStack instance - * @param string $defaultLocale The default locale - * @param RequestContextAwareInterface|null $router The router - */ - public function __construct(RequestStack $requestStack, $defaultLocale = 'en', RequestContextAwareInterface $router = null) - { - $this->defaultLocale = $defaultLocale; - $this->requestStack = $requestStack; - $this->router = $router; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - $request->setDefaultLocale($this->defaultLocale); - - $this->setLocale($request); - $this->setRouterContext($request); - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null !== $parentRequest = $this->requestStack->getParentRequest()) { - $this->setRouterContext($parentRequest); - } - } - - private function setLocale(Request $request) - { - if ($locale = $request->attributes->get('_locale')) { - $request->setLocale($locale); - } - } - - private function setRouterContext(Request $request) - { - if (null !== $this->router) { - $this->router->getContext()->setParameter('_locale', $request->getLocale()); - } - } - - public static function getSubscribedEvents() - { - return array( - // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php deleted file mode 100644 index 8886da0..0000000 --- a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\RequestMatcherInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ProfilerListener collects data for the current request by listening to the kernel events. - * - * @author Fabien Potencier - */ -class ProfilerListener implements EventSubscriberInterface -{ - protected $profiler; - protected $matcher; - protected $onlyException; - protected $onlyMasterRequests; - protected $exception; - protected $profiles; - protected $requestStack; - protected $parents; - - /** - * @param Profiler $profiler A Profiler instance - * @param RequestStack $requestStack A RequestStack instance - * @param RequestMatcherInterface|null $matcher A RequestMatcher instance - * @param bool $onlyException true if the profiler only collects data when an exception occurs, false otherwise - * @param bool $onlyMasterRequests true if the profiler only collects data when the request is a master request, false otherwise - */ - public function __construct(Profiler $profiler, RequestStack $requestStack, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false) - { - $this->profiler = $profiler; - $this->matcher = $matcher; - $this->onlyException = (bool) $onlyException; - $this->onlyMasterRequests = (bool) $onlyMasterRequests; - $this->profiles = new \SplObjectStorage(); - $this->parents = new \SplObjectStorage(); - $this->requestStack = $requestStack; - } - - /** - * Handles the onKernelException event. - * - * @param GetResponseForExceptionEvent $event A GetResponseForExceptionEvent instance - */ - public function onKernelException(GetResponseForExceptionEvent $event) - { - if ($this->onlyMasterRequests && !$event->isMasterRequest()) { - return; - } - - $this->exception = $event->getException(); - } - - /** - * Handles the onKernelResponse event. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - $master = $event->isMasterRequest(); - if ($this->onlyMasterRequests && !$master) { - return; - } - - if ($this->onlyException && null === $this->exception) { - return; - } - - $request = $event->getRequest(); - $exception = $this->exception; - $this->exception = null; - - if (null !== $this->matcher && !$this->matcher->matches($request)) { - return; - } - - if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) { - return; - } - - $this->profiles[$request] = $profile; - - $this->parents[$request] = $this->requestStack->getParentRequest(); - } - - public function onKernelTerminate(PostResponseEvent $event) - { - // attach children to parents - foreach ($this->profiles as $request) { - if (null !== $parentRequest = $this->parents[$request]) { - if (isset($this->profiles[$parentRequest])) { - $this->profiles[$parentRequest]->addChild($this->profiles[$request]); - } - } - } - - // save profiles - foreach ($this->profiles as $request) { - $this->profiler->saveProfile($this->profiles[$request]); - } - - $this->profiles = new \SplObjectStorage(); - $this->parents = new \SplObjectStorage(); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -100), - KernelEvents::EXCEPTION => 'onKernelException', - KernelEvents::TERMINATE => array('onKernelTerminate', -1024), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/vendor/symfony/http-kernel/EventListener/ResponseListener.php deleted file mode 100644 index eeb2b0f..0000000 --- a/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * ResponseListener fixes the Response headers based on the Request. - * - * @author Fabien Potencier - */ -class ResponseListener implements EventSubscriberInterface -{ - private $charset; - - public function __construct($charset) - { - $this->charset = $charset; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $response = $event->getResponse(); - - if (null === $response->getCharset()) { - $response->setCharset($this->charset); - } - - $response->prepare($event->getRequest()); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php deleted file mode 100644 index 16f31a2..0000000 --- a/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Initializes the context from the request and sets request attributes based on a matching route. - * - * @author Fabien Potencier - */ -class RouterListener implements EventSubscriberInterface -{ - private $matcher; - private $context; - private $logger; - private $requestStack; - - /** - * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher - * @param RequestStack $requestStack A RequestStack instance - * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) - * @param LoggerInterface|null $logger The logger - * - * @throws \InvalidArgumentException - */ - public function __construct($matcher, RequestStack $requestStack, RequestContext $context = null, LoggerInterface $logger = null) - { - if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { - throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); - } - - if (null === $context && !$matcher instanceof RequestContextAwareInterface) { - throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); - } - - $this->matcher = $matcher; - $this->context = $context ?: $matcher->getContext(); - $this->requestStack = $requestStack; - $this->logger = $logger; - } - - private function setCurrentRequest(Request $request = null) - { - if (null !== $request) { - $this->context->fromRequest($request); - } - } - - /** - * After a sub-request is done, we need to reset the routing context to the parent request so that the URL generator - * operates on the correct context again. - * - * @param FinishRequestEvent $event - */ - public function onKernelFinishRequest(FinishRequestEvent $event) - { - $this->setCurrentRequest($this->requestStack->getParentRequest()); - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - - $this->setCurrentRequest($request); - - if ($request->attributes->has('_controller')) { - // routing is already done - return; - } - - // add attributes based on the request (routing) - try { - // matching a request is more powerful than matching a URL path + context, so try that first - if ($this->matcher instanceof RequestMatcherInterface) { - $parameters = $this->matcher->matchRequest($request); - } else { - $parameters = $this->matcher->match($request->getPathInfo()); - } - - if (null !== $this->logger) { - $this->logger->info('Matched route "{route}".', array( - 'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a', - 'route_parameters' => $parameters, - 'request_uri' => $request->getUri(), - 'method' => $request->getMethod(), - )); - } - - $request->attributes->add($parameters); - unset($parameters['_route'], $parameters['_controller']); - $request->attributes->set('_route_params', $parameters); - } catch (ResourceNotFoundException $e) { - $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); - - if ($referer = $request->headers->get('referer')) { - $message .= sprintf(' (from "%s")', $referer); - } - - throw new NotFoundHttpException($message, $e); - } catch (MethodNotAllowedException $e) { - $message = sprintf('No route found for "%s %s": Method Not Allowed (Allow: %s)', $request->getMethod(), $request->getPathInfo(), implode(', ', $e->getAllowedMethods())); - - throw new MethodNotAllowedHttpException($e->getAllowedMethods(), $message, $e); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 32)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php b/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php deleted file mode 100644 index 36809b5..0000000 --- a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Saves the session, in case it is still open, before sending the response/headers. - * - * This ensures several things in case the developer did not save the session explicitly: - * - * * If a session save handler without locking is used, it ensures the data is available - * on the next request, e.g. after a redirect. PHPs auto-save at script end via - * session_register_shutdown is executed after fastcgi_finish_request. So in this case - * the data could be missing the next request because it might not be saved the moment - * the new request is processed. - * * A locking save handler (e.g. the native 'files') circumvents concurrency problems like - * the one above. But by saving the session before long-running things in the terminate event, - * we ensure the session is not blocked longer than needed. - * * When regenerating the session ID no locking is involved in PHPs session design. See - * https://bugs.php.net/bug.php?id=61470 for a discussion. So in this case, the session must - * be saved anyway before sending the headers with the new session ID. Otherwise session - * data could get lost again for concurrent requests with the new ID. One result could be - * that you get logged out after just logging in. - * - * This listener should be executed as one of the last listeners, so that previous listeners - * can still operate on the open session. This prevents the overhead of restarting it. - * Listeners after closing the session can still work with the session as usual because - * Symfonys session implementation starts the session on demand. So writing to it after - * it is saved will just restart it. - * - * @author Tobias Schultze - */ -class SaveSessionListener implements EventSubscriberInterface -{ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $session = $event->getRequest()->getSession(); - if ($session && $session->isStarted()) { - $session->save(); - } - } - - public static function getSubscribedEvents() - { - return array( - // low priority but higher than StreamedResponseListener - KernelEvents::RESPONSE => array(array('onKernelResponse', -1000)), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/SessionListener.php b/vendor/symfony/http-kernel/EventListener/SessionListener.php deleted file mode 100644 index 39ebfd9..0000000 --- a/vendor/symfony/http-kernel/EventListener/SessionListener.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Container\ContainerInterface; - -/** - * Sets the session in the request. - * - * @author Fabien Potencier - * - * @final since version 3.3 - */ -class SessionListener extends AbstractSessionListener -{ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - protected function getSession() - { - if (!$this->container->has('session')) { - return; - } - - return $this->container->get('session'); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php deleted file mode 100644 index 571cd74..0000000 --- a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * StreamedResponseListener is responsible for sending the Response - * to the client. - * - * @author Fabien Potencier - */ -class StreamedResponseListener implements EventSubscriberInterface -{ - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $response = $event->getResponse(); - - if ($response instanceof StreamedResponse) { - $response->send(); - } - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -1024), - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php deleted file mode 100644 index 358fc97..0000000 --- a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpCache\HttpCache; -use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates. - * - * @author Fabien Potencier - */ -class SurrogateListener implements EventSubscriberInterface -{ - private $surrogate; - - /** - * @param SurrogateInterface $surrogate An SurrogateInterface instance - */ - public function __construct(SurrogateInterface $surrogate = null) - { - $this->surrogate = $surrogate; - } - - /** - * Filters the Response. - * - * @param FilterResponseEvent $event A FilterResponseEvent instance - */ - public function onKernelResponse(FilterResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - - $kernel = $event->getKernel(); - $surrogate = $this->surrogate; - if ($kernel instanceof HttpCache) { - $surrogate = $kernel->getSurrogate(); - if (null !== $this->surrogate && $this->surrogate->getName() !== $surrogate->getName()) { - $surrogate = $this->surrogate; - } - } - - if (null === $surrogate) { - return; - } - - $surrogate->addSurrogateControl($event->getResponse()); - } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::RESPONSE => 'onKernelResponse', - ); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/TestSessionListener.php b/vendor/symfony/http-kernel/EventListener/TestSessionListener.php deleted file mode 100644 index 36abb42..0000000 --- a/vendor/symfony/http-kernel/EventListener/TestSessionListener.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Psr\Container\ContainerInterface; - -/** - * Sets the session in the request. - * - * @author Fabien Potencier - * - * @final since version 3.3 - */ -class TestSessionListener extends AbstractTestSessionListener -{ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - protected function getSession() - { - if (!$this->container->has('session')) { - return; - } - - return $this->container->get('session'); - } -} diff --git a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php deleted file mode 100644 index 6967ad0..0000000 --- a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Translation\TranslatorInterface; - -/** - * Synchronizes the locale between the request and the translator. - * - * @author Fabien Potencier - */ -class TranslatorListener implements EventSubscriberInterface -{ - private $translator; - private $requestStack; - - public function __construct(TranslatorInterface $translator, RequestStack $requestStack) - { - $this->translator = $translator; - $this->requestStack = $requestStack; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $this->setLocale($event->getRequest()); - } - - public function onKernelFinishRequest(FinishRequestEvent $event) - { - if (null === $parentRequest = $this->requestStack->getParentRequest()) { - return; - } - - $this->setLocale($parentRequest); - } - - public static function getSubscribedEvents() - { - return array( - // must be registered after the Locale listener - KernelEvents::REQUEST => array(array('onKernelRequest', 10)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); - } - - private function setLocale(Request $request) - { - try { - $this->translator->setLocale($request->getLocale()); - } catch (\InvalidArgumentException $e) { - $this->translator->setLocale($request->getDefaultLocale()); - } - } -} diff --git a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php deleted file mode 100644 index b96c781..0000000 --- a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Validates Requests. - * - * @author Magnus Nordlander - */ -class ValidateRequestListener implements EventSubscriberInterface -{ - /** - * Performs the validation. - * - * @param GetResponseEvent $event - */ - public function onKernelRequest(GetResponseEvent $event) - { - if (!$event->isMasterRequest()) { - return; - } - $request = $event->getRequest(); - - if ($request::getTrustedProxies()) { - $request->getClientIps(); - } - - $request->getHost(); - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array( - array('onKernelRequest', 256), - ), - ); - } -} diff --git a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php b/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php deleted file mode 100644 index 3941884..0000000 --- a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Fabien Potencier - * @author Christophe Coevoet - */ -class AccessDeniedHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(403, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php b/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php deleted file mode 100644 index c28d837..0000000 --- a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class BadRequestHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(400, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php b/vendor/symfony/http-kernel/Exception/ConflictHttpException.php deleted file mode 100644 index 79f24f2..0000000 --- a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class ConflictHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(409, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/GoneHttpException.php b/vendor/symfony/http-kernel/Exception/GoneHttpException.php deleted file mode 100644 index 84e6915..0000000 --- a/vendor/symfony/http-kernel/Exception/GoneHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class GoneHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(410, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/HttpException.php b/vendor/symfony/http-kernel/Exception/HttpException.php deleted file mode 100644 index e8e3760..0000000 --- a/vendor/symfony/http-kernel/Exception/HttpException.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * HttpException. - * - * @author Kris Wallsmith - */ -class HttpException extends \RuntimeException implements HttpExceptionInterface -{ - private $statusCode; - private $headers; - - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0) - { - $this->statusCode = $statusCode; - $this->headers = $headers; - - parent::__construct($message, $code, $previous); - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getHeaders() - { - return $this->headers; - } - - /** - * Set response headers. - * - * @param array $headers Response headers - */ - public function setHeaders(array $headers) - { - $this->headers = $headers; - } -} diff --git a/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php b/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php deleted file mode 100644 index 8aa50a9..0000000 --- a/vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * Interface for HTTP error exceptions. - * - * @author Kris Wallsmith - */ -interface HttpExceptionInterface -{ - /** - * Returns the status code. - * - * @return int An HTTP response status code - */ - public function getStatusCode(); - - /** - * Returns response headers. - * - * @return array Response headers - */ - public function getHeaders(); -} diff --git a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php deleted file mode 100644 index 645efe8..0000000 --- a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class LengthRequiredHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(411, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php b/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php deleted file mode 100644 index e308a5f..0000000 --- a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Kris Wallsmith - */ -class MethodNotAllowedHttpException extends HttpException -{ - /** - * @param array $allow An array of allowed methods - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array('Allow' => strtoupper(implode(', ', $allow))); - - parent::__construct(405, $message, $previous, $headers, $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php b/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php deleted file mode 100644 index 097a13f..0000000 --- a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class NotAcceptableHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(406, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php b/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php deleted file mode 100644 index 878173c..0000000 --- a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Fabien Potencier - */ -class NotFoundHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(404, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php deleted file mode 100644 index 9f13a62..0000000 --- a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class PreconditionFailedHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(412, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php deleted file mode 100644 index 9d0a36d..0000000 --- a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - * - * @see http://tools.ietf.org/html/rfc6585 - */ -class PreconditionRequiredHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(428, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php b/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php deleted file mode 100644 index b2767c3..0000000 --- a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class ServiceUnavailableHttpException extends HttpException -{ - /** - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array(); - if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); - } - - parent::__construct(503, $message, $previous, $headers, $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php b/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php deleted file mode 100644 index 7d8a803..0000000 --- a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - * - * @see http://tools.ietf.org/html/rfc6585 - */ -class TooManyRequestsHttpException extends HttpException -{ - /** - * @param int|string $retryAfter The number of seconds or HTTP-date after which the request may be retried - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($retryAfter = null, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array(); - if ($retryAfter) { - $headers = array('Retry-After' => $retryAfter); - } - - parent::__construct(429, $message, $previous, $headers, $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php b/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php deleted file mode 100644 index 05ac875..0000000 --- a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class UnauthorizedHttpException extends HttpException -{ - /** - * @param string $challenge WWW-Authenticate challenge string - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($challenge, $message = null, \Exception $previous = null, $code = 0) - { - $headers = array('WWW-Authenticate' => $challenge); - - parent::__construct(401, $message, $previous, $headers, $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php b/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php deleted file mode 100644 index 01b8b84..0000000 --- a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Steve Hutchins - */ -class UnprocessableEntityHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(422, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php b/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php deleted file mode 100644 index 6913504..0000000 --- a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Exception; - -/** - * @author Ben Ramsey - */ -class UnsupportedMediaTypeHttpException extends HttpException -{ - /** - * @param string $message The internal exception message - * @param \Exception $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct($message = null, \Exception $previous = null, $code = 0) - { - parent::__construct(415, $message, $previous, array(), $code); - } -} diff --git a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php deleted file mode 100644 index e955cd0..0000000 --- a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; -use Symfony\Component\HttpKernel\UriSigner; - -/** - * Implements Surrogate rendering strategy. - * - * @author Fabien Potencier - */ -abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRenderer -{ - private $surrogate; - private $inlineStrategy; - private $signer; - - /** - * The "fallback" strategy when surrogate is not available should always be an - * instance of InlineFragmentRenderer. - * - * @param SurrogateInterface $surrogate An Surrogate instance - * @param FragmentRendererInterface $inlineStrategy The inline strategy to use when the surrogate is not supported - * @param UriSigner $signer - */ - public function __construct(SurrogateInterface $surrogate = null, FragmentRendererInterface $inlineStrategy, UriSigner $signer = null) - { - $this->surrogate = $surrogate; - $this->inlineStrategy = $inlineStrategy; - $this->signer = $signer; - } - - /** - * {@inheritdoc} - * - * Note that if the current Request has no surrogate capability, this method - * falls back to use the inline rendering strategy. - * - * Additional available options: - * - * * alt: an alternative URI to render in case of an error - * * comment: a comment to add when returning the surrogate tag - * - * Note, that not all surrogate strategies support all options. For now - * 'alt' and 'comment' are only supported by ESI. - * - * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface - */ - public function render($uri, Request $request, array $options = array()) - { - if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { - if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { - @trigger_error('Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated since version 3.1, and will be removed in 4.0. Use a different rendering strategy or pass scalar values.', E_USER_DEPRECATED); - } - - return $this->inlineStrategy->render($uri, $request, $options); - } - - if ($uri instanceof ControllerReference) { - $uri = $this->generateSignedFragmentUri($uri, $request); - } - - $alt = isset($options['alt']) ? $options['alt'] : null; - if ($alt instanceof ControllerReference) { - $alt = $this->generateSignedFragmentUri($alt, $request); - } - - $tag = $this->surrogate->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : ''); - - return new Response($tag); - } - - private function generateSignedFragmentUri($uri, Request $request) - { - if (null === $this->signer) { - throw new \LogicException('You must use a URI when using the ESI rendering strategy or set a URL signer.'); - } - - // we need to sign the absolute URI, but want to return the path only. - $fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true)); - - return substr($fragmentUri, strlen($request->getSchemeAndHttpHost())); - } - - private function containsNonScalars(array $values) - { - foreach ($values as $value) { - if (is_array($value) && $this->containsNonScalars($value)) { - return true; - } elseif (!is_scalar($value) && null !== $value) { - return true; - } - } - - return false; - } -} diff --git a/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php deleted file mode 100644 index a4570e3..0000000 --- a/vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -/** - * Implements the ESI rendering strategy. - * - * @author Fabien Potencier - */ -class EsiFragmentRenderer extends AbstractSurrogateFragmentRenderer -{ - /** - * {@inheritdoc} - */ - public function getName() - { - return 'esi'; - } -} diff --git a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php deleted file mode 100644 index 3ea27e6..0000000 --- a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Controller\ControllerReference; - -/** - * Renders a URI that represents a resource fragment. - * - * This class handles the rendering of resource fragments that are included into - * a main resource. The handling of the rendering is managed by specialized renderers. - * - * @author Fabien Potencier - * - * @see FragmentRendererInterface - */ -class FragmentHandler -{ - private $debug; - private $renderers = array(); - private $requestStack; - - /** - * @param RequestStack $requestStack The Request stack that controls the lifecycle of requests - * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances - * @param bool $debug Whether the debug mode is enabled or not - */ - public function __construct(RequestStack $requestStack, array $renderers = array(), $debug = false) - { - $this->requestStack = $requestStack; - foreach ($renderers as $renderer) { - $this->addRenderer($renderer); - } - $this->debug = $debug; - } - - /** - * Adds a renderer. - * - * @param FragmentRendererInterface $renderer A FragmentRendererInterface instance - */ - public function addRenderer(FragmentRendererInterface $renderer) - { - $this->renderers[$renderer->getName()] = $renderer; - } - - /** - * Renders a URI and returns the Response content. - * - * Available options: - * - * * ignore_errors: true to return an empty string in case of an error - * - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param string $renderer The renderer name - * @param array $options An array of options - * - * @return string|null The Response content or null when the Response is streamed - * - * @throws \InvalidArgumentException when the renderer does not exist - * @throws \LogicException when no master request is being handled - */ - public function render($uri, $renderer = 'inline', array $options = array()) - { - if (!isset($options['ignore_errors'])) { - $options['ignore_errors'] = !$this->debug; - } - - if (!isset($this->renderers[$renderer])) { - throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer)); - } - - if (!$request = $this->requestStack->getCurrentRequest()) { - throw new \LogicException('Rendering a fragment can only be done when handling a Request.'); - } - - return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options)); - } - - /** - * Delivers the Response as a string. - * - * When the Response is a StreamedResponse, the content is streamed immediately - * instead of being returned. - * - * @param Response $response A Response instance - * - * @return string|null The Response content or null when the Response is streamed - * - * @throws \RuntimeException when the Response is not successful - */ - protected function deliver(Response $response) - { - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this->requestStack->getCurrentRequest()->getUri(), $response->getStatusCode())); - } - - if (!$response instanceof StreamedResponse) { - return $response->getContent(); - } - - $response->sendContent(); - } -} diff --git a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php deleted file mode 100644 index b177c3a..0000000 --- a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpFoundation\Response; - -/** - * Interface implemented by all rendering strategies. - * - * @author Fabien Potencier - */ -interface FragmentRendererInterface -{ - /** - * Renders a URI and returns the Response content. - * - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param Request $request A Request instance - * @param array $options An array of options - * - * @return Response A Response instance - */ - public function render($uri, Request $request, array $options = array()); - - /** - * Gets the name of the strategy. - * - * @return string The strategy name - */ - public function getName(); -} diff --git a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php deleted file mode 100644 index 7e957d4..0000000 --- a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Templating\EngineInterface; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\UriSigner; -use Twig\Environment; -use Twig\Error\LoaderError; -use Twig\Loader\ExistsLoaderInterface; - -/** - * Implements the Hinclude rendering strategy. - * - * @author Fabien Potencier - */ -class HIncludeFragmentRenderer extends RoutableFragmentRenderer -{ - private $globalDefaultTemplate; - private $signer; - private $templating; - private $charset; - - /** - * @param EngineInterface|Environment $templating An EngineInterface or a Twig instance - * @param UriSigner $signer A UriSigner instance - * @param string $globalDefaultTemplate The global default content (it can be a template name or the content) - * @param string $charset - */ - public function __construct($templating = null, UriSigner $signer = null, $globalDefaultTemplate = null, $charset = 'utf-8') - { - $this->setTemplating($templating); - $this->globalDefaultTemplate = $globalDefaultTemplate; - $this->signer = $signer; - $this->charset = $charset; - } - - /** - * Sets the templating engine to use to render the default content. - * - * @param EngineInterface|Environment|null $templating An EngineInterface or an Environment instance - * - * @throws \InvalidArgumentException - */ - public function setTemplating($templating) - { - if (null !== $templating && !$templating instanceof EngineInterface && !$templating instanceof Environment) { - throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface'); - } - - $this->templating = $templating; - } - - /** - * Checks if a templating engine has been set. - * - * @return bool true if the templating engine has been set, false otherwise - */ - public function hasTemplating() - { - return null !== $this->templating; - } - - /** - * {@inheritdoc} - * - * Additional available options: - * - * * default: The default content (it can be a template name or the content) - * * id: An optional hx:include tag id attribute - * * attributes: An optional array of hx:include tag attributes - */ - public function render($uri, Request $request, array $options = array()) - { - if ($uri instanceof ControllerReference) { - if (null === $this->signer) { - throw new \LogicException('You must use a proper URI when using the Hinclude rendering strategy or set a URL signer.'); - } - - // we need to sign the absolute URI, but want to return the path only. - $uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), strlen($request->getSchemeAndHttpHost())); - } - - // We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content. - $uri = str_replace('&', '&', $uri); - - $template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate; - if (null !== $this->templating && $template && $this->templateExists($template)) { - $content = $this->templating->render($template); - } else { - $content = $template; - } - - $attributes = isset($options['attributes']) && is_array($options['attributes']) ? $options['attributes'] : array(); - if (isset($options['id']) && $options['id']) { - $attributes['id'] = $options['id']; - } - $renderedAttributes = ''; - if (count($attributes) > 0) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - foreach ($attributes as $attribute => $value) { - $renderedAttributes .= sprintf( - ' %s="%s"', - htmlspecialchars($attribute, $flags, $this->charset, false), - htmlspecialchars($value, $flags, $this->charset, false) - ); - } - } - - return new Response(sprintf('%s', $uri, $renderedAttributes, $content)); - } - - /** - * @param string $template - * - * @return bool - */ - private function templateExists($template) - { - if ($this->templating instanceof EngineInterface) { - try { - return $this->templating->exists($template); - } catch (\InvalidArgumentException $e) { - return false; - } - } - - $loader = $this->templating->getLoader(); - if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) { - return $loader->exists($template); - } - - try { - if (method_exists($loader, 'getSourceContext')) { - $loader->getSourceContext($template); - } else { - $loader->getSource($template); - } - - return true; - } catch (LoaderError $e) { - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'hinclude'; - } -} diff --git a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php deleted file mode 100644 index 8ed81f9..0000000 --- a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel. - * - * @author Fabien Potencier - */ -class InlineFragmentRenderer extends RoutableFragmentRenderer -{ - private $kernel; - private $dispatcher; - - /** - * @param HttpKernelInterface $kernel A HttpKernelInterface instance - * @param EventDispatcherInterface $dispatcher A EventDispatcherInterface instance - */ - public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null) - { - $this->kernel = $kernel; - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - * - * Additional available options: - * - * * alt: an alternative URI to render in case of an error - */ - public function render($uri, Request $request, array $options = array()) - { - $reference = null; - if ($uri instanceof ControllerReference) { - $reference = $uri; - - // Remove attributes from the generated URI because if not, the Symfony - // routing system will use them to populate the Request attributes. We don't - // want that as we want to preserve objects (so we manually set Request attributes - // below instead) - $attributes = $reference->attributes; - $reference->attributes = array(); - - // The request format and locale might have been overridden by the user - foreach (array('_format', '_locale') as $key) { - if (isset($attributes[$key])) { - $reference->attributes[$key] = $attributes[$key]; - } - } - - $uri = $this->generateFragmentUri($uri, $request, false, false); - - $reference->attributes = array_merge($attributes, $reference->attributes); - } - - $subRequest = $this->createSubRequest($uri, $request); - - // override Request attributes as they can be objects (which are not supported by the generated URI) - if (null !== $reference) { - $subRequest->attributes->add($reference->attributes); - } - - $level = ob_get_level(); - try { - return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); - } catch (\Exception $e) { - // we dispatch the exception event to trigger the logging - // the response that comes back is simply ignored - if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) { - $event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e); - - $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - } - - // let's clean up the output buffers that were created by the sub-request - Response::closeOutputBuffers($level, false); - - if (isset($options['alt'])) { - $alt = $options['alt']; - unset($options['alt']); - - return $this->render($alt, $request, $options); - } - - if (!isset($options['ignore_errors']) || !$options['ignore_errors']) { - throw $e; - } - - return new Response(); - } - } - - protected function createSubRequest($uri, Request $request) - { - $cookies = $request->cookies->all(); - $server = $request->server->all(); - - // Override the arguments to emulate a sub-request. - // Sub-request object will point to localhost as client ip and real client ip - // will be included into trusted header for client ip - try { - if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $currentXForwardedFor = $request->headers->get('X_FORWARDED_FOR', ''); - - $server['HTTP_X_FORWARDED_FOR'] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); - } elseif (method_exists(Request::class, 'getTrustedHeaderName') && $trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP, false)) { - $currentXForwardedFor = $request->headers->get($trustedHeaderName, ''); - - $server['HTTP_'.$trustedHeaderName] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); - } - } catch (\InvalidArgumentException $e) { - // Do nothing - } - - $server['REMOTE_ADDR'] = '127.0.0.1'; - unset($server['HTTP_IF_MODIFIED_SINCE']); - unset($server['HTTP_IF_NONE_MATCH']); - - $subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server); - if ($request->headers->has('Surrogate-Capability')) { - $subRequest->headers->set('Surrogate-Capability', $request->headers->get('Surrogate-Capability')); - } - - if ($session = $request->getSession()) { - $subRequest->setSession($session); - } - - return $subRequest; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'inline'; - } -} diff --git a/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php deleted file mode 100644 index d7eeb89..0000000 --- a/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; - -/** - * Adds the possibility to generate a fragment URI for a given Controller. - * - * @author Fabien Potencier - */ -abstract class RoutableFragmentRenderer implements FragmentRendererInterface -{ - private $fragmentPath = '/_fragment'; - - /** - * Sets the fragment path that triggers the fragment listener. - * - * @param string $path The path - * - * @see FragmentListener - */ - public function setFragmentPath($path) - { - $this->fragmentPath = $path; - } - - /** - * Generates a fragment URI for a given controller. - * - * @param ControllerReference $reference A ControllerReference instance - * @param Request $request A Request instance - * @param bool $absolute Whether to generate an absolute URL or not - * @param bool $strict Whether to allow non-scalar attributes or not - * - * @return string A fragment URI - */ - protected function generateFragmentUri(ControllerReference $reference, Request $request, $absolute = false, $strict = true) - { - if ($strict) { - $this->checkNonScalar($reference->attributes); - } - - // We need to forward the current _format and _locale values as we don't have - // a proper routing pattern to do the job for us. - // This makes things inconsistent if you switch from rendering a controller - // to rendering a route if the route pattern does not contain the special - // _format and _locale placeholders. - if (!isset($reference->attributes['_format'])) { - $reference->attributes['_format'] = $request->getRequestFormat(); - } - if (!isset($reference->attributes['_locale'])) { - $reference->attributes['_locale'] = $request->getLocale(); - } - - $reference->attributes['_controller'] = $reference->controller; - - $reference->query['_path'] = http_build_query($reference->attributes, '', '&'); - - $path = $this->fragmentPath.'?'.http_build_query($reference->query, '', '&'); - - if ($absolute) { - return $request->getUriForPath($path); - } - - return $request->getBaseUrl().$path; - } - - private function checkNonScalar($values) - { - foreach ($values as $key => $value) { - if (is_array($value)) { - $this->checkNonScalar($value); - } elseif (!is_scalar($value) && null !== $value) { - throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key)); - } - } - } -} diff --git a/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php deleted file mode 100644 index 45e7122..0000000 --- a/vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Fragment; - -/** - * Implements the SSI rendering strategy. - * - * @author Sebastian Krebs - */ -class SsiFragmentRenderer extends AbstractSurrogateFragmentRenderer -{ - /** - * {@inheritdoc} - */ - public function getName() - { - return 'ssi'; - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php deleted file mode 100644 index 0999827..0000000 --- a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * Abstract class implementing Surrogate capabilities to Request and Response instances. - * - * @author Fabien Potencier - * @author Robin Chalas - */ -abstract class AbstractSurrogate implements SurrogateInterface -{ - protected $contentTypes; - protected $phpEscapeMap = array( - array('', '', '', ''), - ); - - /** - * @param array $contentTypes An array of content-type that should be parsed for Surrogate information - * (default: text/html, text/xml, application/xhtml+xml, and application/xml) - */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) - { - $this->contentTypes = $contentTypes; - } - - /** - * Returns a new cache strategy instance. - * - * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance - */ - public function createCacheStrategy() - { - return new ResponseCacheStrategy(); - } - - /** - * {@inheritdoc} - */ - public function hasSurrogateCapability(Request $request) - { - if (null === $value = $request->headers->get('Surrogate-Capability')) { - return false; - } - - return false !== strpos($value, sprintf('%s/1.0', strtoupper($this->getName()))); - } - - /** - * {@inheritdoc} - */ - public function addSurrogateCapability(Request $request) - { - $current = $request->headers->get('Surrogate-Capability'); - $new = sprintf('symfony="%s/1.0"', strtoupper($this->getName())); - - $request->headers->set('Surrogate-Capability', $current ? $current.', '.$new : $new); - } - - /** - * {@inheritdoc} - */ - public function needsParsing(Response $response) - { - if (!$control = $response->headers->get('Surrogate-Control')) { - return false; - } - - $pattern = sprintf('#content="[^"]*%s/1.0[^"]*"#', strtoupper($this->getName())); - - return (bool) preg_match($pattern, $control); - } - - /** - * {@inheritdoc} - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) - { - $subRequest = Request::create($uri, Request::METHOD_GET, array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); - - try { - $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); - - if (!$response->isSuccessful()) { - throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $subRequest->getUri(), $response->getStatusCode())); - } - - return $response->getContent(); - } catch (\Exception $e) { - if ($alt) { - return $this->handle($cache, $alt, '', $ignoreErrors); - } - - if (!$ignoreErrors) { - throw $e; - } - } - } - - /** - * Remove the Surrogate from the Surrogate-Control header. - * - * @param Response $response - */ - protected function removeFromControl(Response $response) - { - if (!$response->headers->has('Surrogate-Control')) { - return; - } - - $value = $response->headers->get('Surrogate-Control'); - $upperName = strtoupper($this->getName()); - - if (sprintf('content="%s/1.0"', $upperName) == $value) { - $response->headers->remove('Surrogate-Control'); - } elseif (preg_match(sprintf('#,\s*content="%s/1.0"#', $upperName), $value)) { - $response->headers->set('Surrogate-Control', preg_replace(sprintf('#,\s*content="%s/1.0"#', $upperName), '', $value)); - } elseif (preg_match(sprintf('#content="%s/1.0",\s*#', $upperName), $value)) { - $response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value)); - } - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/Esi.php b/vendor/symfony/http-kernel/HttpCache/Esi.php deleted file mode 100644 index d09907e..0000000 --- a/vendor/symfony/http-kernel/HttpCache/Esi.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Esi implements the ESI capabilities to Request and Response instances. - * - * For more information, read the following W3C notes: - * - * * ESI Language Specification 1.0 (http://www.w3.org/TR/esi-lang) - * - * * Edge Architecture Specification (http://www.w3.org/TR/edge-arch) - * - * @author Fabien Potencier - */ -class Esi extends AbstractSurrogate -{ - public function getName() - { - return 'esi'; - } - - /** - * {@inheritdoc} - */ - public function addSurrogateControl(Response $response) - { - if (false !== strpos($response->getContent(), 'headers->set('Surrogate-Control', 'content="ESI/1.0"'); - } - } - - /** - * {@inheritdoc} - */ - public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = '') - { - $html = sprintf('', - $uri, - $ignoreErrors ? ' onerror="continue"' : '', - $alt ? sprintf(' alt="%s"', $alt) : '' - ); - - if (!empty($comment)) { - return sprintf("\n%s", $comment, $html); - } - - return $html; - } - - /** - * {@inheritdoc} - */ - public function process(Request $request, Response $response) - { - $type = $response->headers->get('Content-Type'); - if (empty($type)) { - $type = 'text/html'; - } - - $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { - return $response; - } - - // we don't use a proper XML parser here as we can have ESI tags in a plain text response - $content = $response->getContent(); - $content = preg_replace('#.*?#s', '', $content); - $content = preg_replace('#]+>#s', '', $content); - - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); - $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); - - $i = 1; - while (isset($chunks[$i])) { - $options = array(); - preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); - foreach ($matches as $set) { - $options[$set[1]] = $set[2]; - } - - if (!isset($options['src'])) { - throw new \RuntimeException('Unable to process an ESI tag without a "src" attribute.'); - } - - $chunks[$i] = sprintf('surrogate->handle($this, %s, %s, %s) ?>'."\n", - var_export($options['src'], true), - var_export(isset($options['alt']) ? $options['alt'] : '', true), - isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false' - ); - ++$i; - $chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]); - ++$i; - } - $content = implode('', $chunks); - - $response->setContent($content); - $response->headers->set('X-Body-Eval', 'ESI'); - - // remove ESI/1.0 from the Surrogate-Control header - $this->removeFromControl($response); - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php deleted file mode 100644 index 41f95a4..0000000 --- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ /dev/null @@ -1,731 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Cache provides HTTP caching. - * - * @author Fabien Potencier - */ -class HttpCache implements HttpKernelInterface, TerminableInterface -{ - private $kernel; - private $store; - private $request; - private $surrogate; - private $surrogateCacheStrategy; - private $options = array(); - private $traces = array(); - - /** - * The available options are: - * - * * debug: If true, the traces are added as a HTTP header to ease debugging - * - * * default_ttl The number of seconds that a cache entry should be considered - * fresh when no explicit freshness information is provided in - * a response. Explicit Cache-Control or Expires headers - * override this value. (default: 0) - * - * * private_headers Set of request headers that trigger "private" cache-control behavior - * on responses that don't explicitly state whether the response is - * public or private via a Cache-Control directive. (default: Authorization and Cookie) - * - * * allow_reload Specifies whether the client can force a cache reload by including a - * Cache-Control "no-cache" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * allow_revalidate Specifies whether the client can force a cache revalidate by including - * a Cache-Control "max-age=0" directive in the request. Set it to ``true`` - * for compliance with RFC 2616. (default: false) - * - * * stale_while_revalidate Specifies the default number of seconds (the granularity is the second as the - * Response TTL precision is a second) during which the cache can immediately return - * a stale response while it revalidates it in the background (default: 2). - * This setting is overridden by the stale-while-revalidate HTTP Cache-Control - * extension (see RFC 5861). - * - * * stale_if_error Specifies the default number of seconds (the granularity is the second) during which - * the cache can serve a stale response when an error is encountered (default: 60). - * This setting is overridden by the stale-if-error HTTP Cache-Control extension - * (see RFC 5861). - * - * @param HttpKernelInterface $kernel An HttpKernelInterface instance - * @param StoreInterface $store A Store instance - * @param SurrogateInterface $surrogate A SurrogateInterface instance - * @param array $options An array of options - */ - public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) - { - $this->store = $store; - $this->kernel = $kernel; - $this->surrogate = $surrogate; - - // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function(array($this->store, 'cleanup')); - - $this->options = array_merge(array( - 'debug' => false, - 'default_ttl' => 0, - 'private_headers' => array('Authorization', 'Cookie'), - 'allow_reload' => false, - 'allow_revalidate' => false, - 'stale_while_revalidate' => 2, - 'stale_if_error' => 60, - ), $options); - } - - /** - * Gets the current store. - * - * @return StoreInterface $store A StoreInterface instance - */ - public function getStore() - { - return $this->store; - } - - /** - * Returns an array of events that took place during processing of the last request. - * - * @return array An array of events - */ - public function getTraces() - { - return $this->traces; - } - - /** - * Returns a log message for the events of the last request processing. - * - * @return string A log message - */ - public function getLog() - { - $log = array(); - foreach ($this->traces as $request => $traces) { - $log[] = sprintf('%s: %s', $request, implode(', ', $traces)); - } - - return implode('; ', $log); - } - - /** - * Gets the Request instance associated with the master request. - * - * @return Request A Request instance - */ - public function getRequest() - { - return $this->request; - } - - /** - * Gets the Kernel instance. - * - * @return HttpKernelInterface An HttpKernelInterface instance - */ - public function getKernel() - { - return $this->kernel; - } - - /** - * Gets the Surrogate instance. - * - * @return SurrogateInterface A Surrogate instance - * - * @throws \LogicException - */ - public function getSurrogate() - { - return $this->surrogate; - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->traces = array(); - $this->request = $request; - if (null !== $this->surrogate) { - $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy(); - } - } - - $this->traces[$this->getTraceKey($request)] = array(); - - if (!$request->isMethodSafe(false)) { - $response = $this->invalidate($request, $catch); - } elseif ($request->headers->has('expect') || !$request->isMethodCacheable()) { - $response = $this->pass($request, $catch); - } elseif ($this->options['allow_reload'] && $request->isNoCache()) { - /* - If allow_reload is configured and the client requests "Cache-Control: no-cache", - reload the cache by fetching a fresh response and caching it (if possible). - */ - $this->record($request, 'reload'); - $response = $this->fetch($request, $catch); - } else { - $response = $this->lookup($request, $catch); - } - - $this->restoreResponseBody($request, $response); - - if (HttpKernelInterface::MASTER_REQUEST === $type && $this->options['debug']) { - $response->headers->set('X-Symfony-Cache', $this->getLog()); - } - - if (null !== $this->surrogate) { - if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->surrogateCacheStrategy->update($response); - } else { - $this->surrogateCacheStrategy->add($response); - } - } - - $response->prepare($request); - - $response->isNotModified($request); - - return $response; - } - - /** - * {@inheritdoc} - */ - public function terminate(Request $request, Response $response) - { - if ($this->getKernel() instanceof TerminableInterface) { - $this->getKernel()->terminate($request, $response); - } - } - - /** - * Forwards the Request to the backend without storing the Response in the cache. - * - * @param Request $request A Request instance - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function pass(Request $request, $catch = false) - { - $this->record($request, 'pass'); - - return $this->forward($request, $catch); - } - - /** - * Invalidates non-safe methods (like POST, PUT, and DELETE). - * - * @param Request $request A Request instance - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - * - * @throws \Exception - * - * @see RFC2616 13.10 - */ - protected function invalidate(Request $request, $catch = false) - { - $response = $this->pass($request, $catch); - - // invalidate only when the response is successful - if ($response->isSuccessful() || $response->isRedirect()) { - try { - $this->store->invalidate($request); - - // As per the RFC, invalidate Location and Content-Location URLs if present - foreach (array('Location', 'Content-Location') as $header) { - if ($uri = $response->headers->get($header)) { - $subRequest = Request::create($uri, 'get', array(), array(), array(), $request->server->all()); - - $this->store->invalidate($subRequest); - } - } - - $this->record($request, 'invalidate'); - } catch (\Exception $e) { - $this->record($request, 'invalidate-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - } - - return $response; - } - - /** - * Lookups a Response from the cache for the given Request. - * - * When a matching cache entry is found and is fresh, it uses it as the - * response without forwarding any request to the backend. When a matching - * cache entry is found but is stale, it attempts to "validate" the entry with - * the backend using conditional GET. When no matching cache entry is found, - * it triggers "miss" processing. - * - * @param Request $request A Request instance - * @param bool $catch whether to process exceptions - * - * @return Response A Response instance - * - * @throws \Exception - */ - protected function lookup(Request $request, $catch = false) - { - try { - $entry = $this->store->lookup($request); - } catch (\Exception $e) { - $this->record($request, 'lookup-failed'); - - if ($this->options['debug']) { - throw $e; - } - - return $this->pass($request, $catch); - } - - if (null === $entry) { - $this->record($request, 'miss'); - - return $this->fetch($request, $catch); - } - - if (!$this->isFreshEnough($request, $entry)) { - $this->record($request, 'stale'); - - return $this->validate($request, $entry, $catch); - } - - $this->record($request, 'fresh'); - - $entry->headers->set('Age', $entry->getAge()); - - return $entry; - } - - /** - * Validates that a cache entry is fresh. - * - * The original request is used as a template for a conditional - * GET request with the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance to validate - * @param bool $catch Whether to process exceptions - * - * @return Response A Response instance - */ - protected function validate(Request $request, Response $entry, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - if ('HEAD' === $request->getMethod()) { - $subRequest->setMethod('GET'); - } - - // add our cached last-modified validator - $subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified')); - - // Add our cached etag validator to the environment. - // We keep the etags from the client to handle the case when the client - // has a different private valid entry which is not cached here. - $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); - $requestEtags = $request->getETags(); - if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { - $subRequest->headers->set('if_none_match', implode(', ', $etags)); - } - - $response = $this->forward($subRequest, $catch, $entry); - - if (304 == $response->getStatusCode()) { - $this->record($request, 'valid'); - - // return the response and not the cache entry if the response is valid but not cached - $etag = $response->getEtag(); - if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) { - return $response; - } - - $entry = clone $entry; - $entry->headers->remove('Date'); - - foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { - if ($response->headers->has($name)) { - $entry->headers->set($name, $response->headers->get($name)); - } - } - - $response = $entry; - } else { - $this->record($request, 'invalid'); - } - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Unconditionally fetches a fresh response from the backend and - * stores it in the cache if is cacheable. - * - * @param Request $request A Request instance - * @param bool $catch whether to process exceptions - * - * @return Response A Response instance - */ - protected function fetch(Request $request, $catch = false) - { - $subRequest = clone $request; - - // send no head requests because we want content - if ('HEAD' === $request->getMethod()) { - $subRequest->setMethod('GET'); - } - - // avoid that the backend sends no content - $subRequest->headers->remove('if_modified_since'); - $subRequest->headers->remove('if_none_match'); - - $response = $this->forward($subRequest, $catch); - - if ($response->isCacheable()) { - $this->store($request, $response); - } - - return $response; - } - - /** - * Forwards the Request to the backend and returns the Response. - * - * All backend requests (cache passes, fetches, cache validations) - * run through this method. - * - * @param Request $request A Request instance - * @param bool $catch Whether to catch exceptions or not - * @param Response $entry A Response instance (the stale entry if present, null otherwise) - * - * @return Response A Response instance - */ - protected function forward(Request $request, $catch = false, Response $entry = null) - { - if ($this->surrogate) { - $this->surrogate->addSurrogateCapability($request); - } - - // modify the X-Forwarded-For header if needed - $forwardedFor = $request->headers->get('X-Forwarded-For'); - if ($forwardedFor) { - $request->headers->set('X-Forwarded-For', $forwardedFor.', '.$request->server->get('REMOTE_ADDR')); - } else { - $request->headers->set('X-Forwarded-For', $request->server->get('REMOTE_ADDR')); - } - - // fix the client IP address by setting it to 127.0.0.1 as HttpCache - // is always called from the same process as the backend. - $request->server->set('REMOTE_ADDR', '127.0.0.1'); - - // make sure HttpCache is a trusted proxy - if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) { - $trustedProxies[] = '127.0.0.1'; - Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL); - } - - // always a "master" request (as the real master request can be in cache) - $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch); - // FIXME: we probably need to also catch exceptions if raw === true - - // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) { - if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { - $age = $this->options['stale_if_error']; - } - - if (abs($entry->getTtl()) < $age) { - $this->record($request, 'stale-if-error'); - - return $entry; - } - } - - /* - RFC 7231 Sect. 7.1.1.2 says that a server that does not have a reasonably accurate - clock MUST NOT send a "Date" header, although it MUST send one in most other cases - except for 1xx or 5xx responses where it MAY do so. - - Anyway, a client that received a message without a "Date" header MUST add it. - */ - if (!$response->headers->has('Date')) { - $response->setDate(\DateTime::createFromFormat('U', time())); - } - - $this->processResponseBody($request, $response); - - if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) { - $response->setPrivate(); - } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) { - $response->setTtl($this->options['default_ttl']); - } - - return $response; - } - - /** - * Checks whether the cache entry is "fresh enough" to satisfy the Request. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return bool true if the cache entry if fresh enough, false otherwise - */ - protected function isFreshEnough(Request $request, Response $entry) - { - if (!$entry->isFresh()) { - return $this->lock($request, $entry); - } - - if ($this->options['allow_revalidate'] && null !== $maxAge = $request->headers->getCacheControlDirective('max-age')) { - return $maxAge > 0 && $maxAge >= $entry->getAge(); - } - - return true; - } - - /** - * Locks a Request during the call to the backend. - * - * @param Request $request A Request instance - * @param Response $entry A Response instance - * - * @return bool true if the cache entry can be returned even if it is staled, false otherwise - */ - protected function lock(Request $request, Response $entry) - { - // try to acquire a lock to call the backend - $lock = $this->store->lock($request); - - if (true === $lock) { - // we have the lock, call the backend - return false; - } - - // there is already another process calling the backend - - // May we serve a stale response? - if ($this->mayServeStaleWhileRevalidate($entry)) { - $this->record($request, 'stale-while-revalidate'); - - return true; - } - - // wait for the lock to be released - if ($this->waitForLock($request)) { - // replace the current entry with the fresh one - $new = $this->lookup($request); - $entry->headers = $new->headers; - $entry->setContent($new->getContent()); - $entry->setStatusCode($new->getStatusCode()); - $entry->setProtocolVersion($new->getProtocolVersion()); - foreach ($new->headers->getCookies() as $cookie) { - $entry->headers->setCookie($cookie); - } - } else { - // backend is slow as hell, send a 503 response (to avoid the dog pile effect) - $entry->setStatusCode(503); - $entry->setContent('503 Service Unavailable'); - $entry->headers->set('Retry-After', 10); - } - - return true; - } - - /** - * Writes the Response to the cache. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @throws \Exception - */ - protected function store(Request $request, Response $response) - { - try { - $this->store->write($request, $response); - - $this->record($request, 'store'); - - $response->headers->set('Age', $response->getAge()); - } catch (\Exception $e) { - $this->record($request, 'store-failed'); - - if ($this->options['debug']) { - throw $e; - } - } - - // now that the response is cached, release the lock - $this->store->unlock($request); - } - - /** - * Restores the Response body. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - */ - private function restoreResponseBody(Request $request, Response $response) - { - if ($response->headers->has('X-Body-Eval')) { - ob_start(); - - if ($response->headers->has('X-Body-File')) { - include $response->headers->get('X-Body-File'); - } else { - eval('; ?>'.$response->getContent().'setContent(ob_get_clean()); - $response->headers->remove('X-Body-Eval'); - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } elseif ($response->headers->has('X-Body-File')) { - // Response does not include possibly dynamic content (ESI, SSI), so we need - // not handle the content for HEAD requests - if (!$request->isMethod('HEAD')) { - $response->setContent(file_get_contents($response->headers->get('X-Body-File'))); - } - } else { - return; - } - - $response->headers->remove('X-Body-File'); - } - - protected function processResponseBody(Request $request, Response $response) - { - if (null !== $this->surrogate && $this->surrogate->needsParsing($response)) { - $this->surrogate->process($request, $response); - } - } - - /** - * Checks if the Request includes authorization or other sensitive information - * that should cause the Response to be considered private by default. - * - * @param Request $request A Request instance - * - * @return bool true if the Request is private, false otherwise - */ - private function isPrivateRequest(Request $request) - { - foreach ($this->options['private_headers'] as $key) { - $key = strtolower(str_replace('HTTP_', '', $key)); - - if ('cookie' === $key) { - if (count($request->cookies->all())) { - return true; - } - } elseif ($request->headers->has($key)) { - return true; - } - } - - return false; - } - - /** - * Records that an event took place. - * - * @param Request $request A Request instance - * @param string $event The event name - */ - private function record(Request $request, $event) - { - $this->traces[$this->getTraceKey($request)][] = $event; - } - - /** - * Calculates the key we use in the "trace" array for a given request. - * - * @param Request $request - * - * @return string - */ - private function getTraceKey(Request $request) - { - $path = $request->getPathInfo(); - if ($qs = $request->getQueryString()) { - $path .= '?'.$qs; - } - - return $request->getMethod().' '.$path; - } - - /** - * Checks whether the given (cached) response may be served as "stale" when a revalidation - * is currently in progress. - * - * @param Response $entry - * - * @return bool true when the stale response may be served, false otherwise - */ - private function mayServeStaleWhileRevalidate(Response $entry) - { - $timeout = $entry->headers->getCacheControlDirective('stale-while-revalidate'); - - if (null === $timeout) { - $timeout = $this->options['stale_while_revalidate']; - } - - return abs($entry->getTtl()) < $timeout; - } - - /** - * Waits for the store to release a locked entry. - * - * @param Request $request The request to wait for - * - * @return bool true if the lock was released before the internal timeout was hit; false if the wait timeout was exceeded - */ - private function waitForLock(Request $request) - { - $wait = 0; - while ($this->store->isLocked($request) && $wait < 5000000) { - usleep(50000); - $wait += 50000; - } - - return $wait < 5000000; - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php deleted file mode 100644 index 027b2b1..0000000 --- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * ResponseCacheStrategy knows how to compute the Response cache HTTP header - * based on the different response cache headers. - * - * This implementation changes the master response TTL to the smallest TTL received - * or force validation if one of the surrogates has validation cache strategy. - * - * @author Fabien Potencier - */ -class ResponseCacheStrategy implements ResponseCacheStrategyInterface -{ - private $cacheable = true; - private $embeddedResponses = 0; - private $ttls = array(); - private $maxAges = array(); - private $isNotCacheableResponseEmbedded = false; - - /** - * {@inheritdoc} - */ - public function add(Response $response) - { - if (!$response->isFresh() || !$response->isCacheable()) { - $this->cacheable = false; - } else { - $maxAge = $response->getMaxAge(); - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $maxAge; - - if (null === $maxAge) { - $this->isNotCacheableResponseEmbedded = true; - } - } - - ++$this->embeddedResponses; - } - - /** - * {@inheritdoc} - */ - public function update(Response $response) - { - // if we have no embedded Response, do nothing - if (0 === $this->embeddedResponses) { - return; - } - - // Remove validation related headers in order to avoid browsers using - // their own cache, because some of the response content comes from - // at least one embedded response (which likely has a different caching strategy). - if ($response->isValidateable()) { - $response->setEtag(null); - $response->setLastModified(null); - } - - if (!$response->isFresh()) { - $this->cacheable = false; - } - - if (!$this->cacheable) { - $response->headers->set('Cache-Control', 'no-cache, must-revalidate'); - - return; - } - - $this->ttls[] = $response->getTtl(); - $this->maxAges[] = $response->getMaxAge(); - - if ($this->isNotCacheableResponseEmbedded) { - $response->headers->removeCacheControlDirective('s-maxage'); - } elseif (null !== $maxAge = min($this->maxAges)) { - $response->setSharedMaxAge($maxAge); - $response->headers->set('Age', $maxAge - min($this->ttls)); - } - $response->setMaxAge(0); - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php deleted file mode 100644 index d70c2e0..0000000 --- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Response; - -/** - * ResponseCacheStrategyInterface implementations know how to compute the - * Response cache HTTP header based on the different response cache headers. - * - * @author Fabien Potencier - */ -interface ResponseCacheStrategyInterface -{ - /** - * Adds a Response. - * - * @param Response $response - */ - public function add(Response $response); - - /** - * Updates the Response HTTP headers based on the embedded Responses. - * - * @param Response $response - */ - public function update(Response $response); -} diff --git a/vendor/symfony/http-kernel/HttpCache/Ssi.php b/vendor/symfony/http-kernel/HttpCache/Ssi.php deleted file mode 100644 index 3178c33..0000000 --- a/vendor/symfony/http-kernel/HttpCache/Ssi.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Ssi implements the SSI capabilities to Request and Response instances. - * - * @author Sebastian Krebs - */ -class Ssi extends AbstractSurrogate -{ - /** - * {@inheritdoc} - */ - public function getName() - { - return 'ssi'; - } - - /** - * {@inheritdoc} - */ - public function addSurrogateControl(Response $response) - { - if (false !== strpos($response->getContent(), '', $uri); - } - - /** - * {@inheritdoc} - */ - public function process(Request $request, Response $response) - { - $type = $response->headers->get('Content-Type'); - if (empty($type)) { - $type = 'text/html'; - } - - $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { - return $response; - } - - // we don't use a proper XML parser here as we can have SSI tags in a plain text response - $content = $response->getContent(); - - $chunks = preg_split('##', $content, -1, PREG_SPLIT_DELIM_CAPTURE); - $chunks[0] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[0]); - - $i = 1; - while (isset($chunks[$i])) { - $options = array(); - preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); - foreach ($matches as $set) { - $options[$set[1]] = $set[2]; - } - - if (!isset($options['virtual'])) { - throw new \RuntimeException('Unable to process an SSI tag without a "virtual" attribute.'); - } - - $chunks[$i] = sprintf('surrogate->handle($this, %s, \'\', false) ?>'."\n", - var_export($options['virtual'], true) - ); - ++$i; - $chunks[$i] = str_replace($this->phpEscapeMap[0], $this->phpEscapeMap[1], $chunks[$i]); - ++$i; - } - $content = implode('', $chunks); - - $response->setContent($content); - $response->headers->set('X-Body-Eval', 'SSI'); - - // remove SSI/1.0 from the Surrogate-Control header - $this->removeFromControl($response); - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php deleted file mode 100644 index 83c3a9a..0000000 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ /dev/null @@ -1,506 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Store implements all the logic for storing cache metadata (Request and Response headers). - * - * @author Fabien Potencier - */ -class Store implements StoreInterface -{ - protected $root; - private $keyCache; - private $locks; - - /** - * @param string $root The path to the cache directory - * - * @throws \RuntimeException - */ - public function __construct($root) - { - $this->root = $root; - if (!file_exists($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) { - throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); - } - $this->keyCache = new \SplObjectStorage(); - $this->locks = array(); - } - - /** - * Cleanups storage. - */ - public function cleanup() - { - // unlock everything - foreach ($this->locks as $lock) { - flock($lock, LOCK_UN); - fclose($lock); - } - - $this->locks = array(); - } - - /** - * Tries to lock the cache for a given Request, without blocking. - * - * @param Request $request A Request instance - * - * @return bool|string true if the lock is acquired, the path to the current lock otherwise - */ - public function lock(Request $request) - { - $key = $this->getCacheKey($request); - - if (!isset($this->locks[$key])) { - $path = $this->getPath($key); - if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { - return $path; - } - $h = fopen($path, 'cb'); - if (!flock($h, LOCK_EX | LOCK_NB)) { - fclose($h); - - return $path; - } - - $this->locks[$key] = $h; - } - - return true; - } - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - * - * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise - */ - public function unlock(Request $request) - { - $key = $this->getCacheKey($request); - - if (isset($this->locks[$key])) { - flock($this->locks[$key], LOCK_UN); - fclose($this->locks[$key]); - unset($this->locks[$key]); - - return true; - } - - return false; - } - - public function isLocked(Request $request) - { - $key = $this->getCacheKey($request); - - if (isset($this->locks[$key])) { - return true; // shortcut if lock held by this process - } - - if (!file_exists($path = $this->getPath($key))) { - return false; - } - - $h = fopen($path, 'rb'); - flock($h, LOCK_EX | LOCK_NB, $wouldBlock); - flock($h, LOCK_UN); // release the lock we just acquired - fclose($h); - - return (bool) $wouldBlock; - } - - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - public function lookup(Request $request) - { - $key = $this->getCacheKey($request); - - if (!$entries = $this->getMetadata($key)) { - return; - } - - // find a cached entry that matches the request. - $match = null; - foreach ($entries as $entry) { - if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? implode(', ', $entry[1]['vary']) : '', $request->headers->all(), $entry[0])) { - $match = $entry; - - break; - } - } - - if (null === $match) { - return; - } - - list($req, $headers) = $match; - if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) { - return $this->restoreResponse($headers, $body); - } - - // TODO the metaStore referenced an entity that doesn't exist in - // the entityStore. We definitely want to return nil but we should - // also purge the entry from the meta-store when this is detected. - } - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - * - * @throws \RuntimeException - */ - public function write(Request $request, Response $response) - { - $key = $this->getCacheKey($request); - $storedEnv = $this->persistRequest($request); - - // write the response body to the entity store if this is the original response - if (!$response->headers->has('X-Content-Digest')) { - $digest = $this->generateContentDigest($response); - - if (false === $this->save($digest, $response->getContent())) { - throw new \RuntimeException('Unable to store the entity.'); - } - - $response->headers->set('X-Content-Digest', $digest); - - if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); - } - } - - // read existing cache entries, remove non-varying, and add this one to the list - $entries = array(); - $vary = $response->headers->get('vary'); - foreach ($this->getMetadata($key) as $entry) { - if (!isset($entry[1]['vary'][0])) { - $entry[1]['vary'] = array(''); - } - - if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { - $entries[] = $entry; - } - } - - $headers = $this->persistResponse($response); - unset($headers['age']); - - array_unshift($entries, array($storedEnv, $headers)); - - if (false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - - return $key; - } - - /** - * Returns content digest for $response. - * - * @param Response $response - * - * @return string - */ - protected function generateContentDigest(Response $response) - { - return 'en'.hash('sha256', $response->getContent()); - } - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - * - * @throws \RuntimeException - */ - public function invalidate(Request $request) - { - $modified = false; - $key = $this->getCacheKey($request); - - $entries = array(); - foreach ($this->getMetadata($key) as $entry) { - $response = $this->restoreResponse($entry[1]); - if ($response->isFresh()) { - $response->expire(); - $modified = true; - $entries[] = array($entry[0], $this->persistResponse($response)); - } else { - $entries[] = $entry; - } - } - - if ($modified && false === $this->save($key, serialize($entries))) { - throw new \RuntimeException('Unable to store the metadata.'); - } - } - - /** - * Determines whether two Request HTTP header sets are non-varying based on - * the vary response header value provided. - * - * @param string $vary A Response vary header - * @param array $env1 A Request HTTP header array - * @param array $env2 A Request HTTP header array - * - * @return bool true if the two environments match, false otherwise - */ - private function requestsMatch($vary, $env1, $env2) - { - if (empty($vary)) { - return true; - } - - foreach (preg_split('/[\s,]+/', $vary) as $header) { - $key = str_replace('_', '-', strtolower($header)); - $v1 = isset($env1[$key]) ? $env1[$key] : null; - $v2 = isset($env2[$key]) ? $env2[$key] : null; - if ($v1 !== $v2) { - return false; - } - } - - return true; - } - - /** - * Gets all data associated with the given key. - * - * Use this method only if you know what you are doing. - * - * @param string $key The store key - * - * @return array An array of data associated with the key - */ - private function getMetadata($key) - { - if (!$entries = $this->load($key)) { - return array(); - } - - return unserialize($entries); - } - - /** - * Purges data for the given URL. - * - * This method purges both the HTTP and the HTTPS version of the cache entry. - * - * @param string $url A URL - * - * @return bool true if the URL exists with either HTTP or HTTPS scheme and has been purged, false otherwise - */ - public function purge($url) - { - $http = preg_replace('#^https:#', 'http:', $url); - $https = preg_replace('#^http:#', 'https:', $url); - - $purgedHttp = $this->doPurge($http); - $purgedHttps = $this->doPurge($https); - - return $purgedHttp || $purgedHttps; - } - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return bool true if the URL exists and has been purged, false otherwise - */ - private function doPurge($url) - { - $key = $this->getCacheKey(Request::create($url)); - if (isset($this->locks[$key])) { - flock($this->locks[$key], LOCK_UN); - fclose($this->locks[$key]); - unset($this->locks[$key]); - } - - if (file_exists($path = $this->getPath($key))) { - unlink($path); - - return true; - } - - return false; - } - - /** - * Loads data for the given key. - * - * @param string $key The store key - * - * @return string The data associated with the key - */ - private function load($key) - { - $path = $this->getPath($key); - - return file_exists($path) ? file_get_contents($path) : false; - } - - /** - * Save data for the given key. - * - * @param string $key The store key - * @param string $data The data to store - * - * @return bool - */ - private function save($key, $data) - { - $path = $this->getPath($key); - - if (isset($this->locks[$key])) { - $fp = $this->locks[$key]; - @ftruncate($fp, 0); - @fseek($fp, 0); - $len = @fwrite($fp, $data); - if (strlen($data) !== $len) { - @ftruncate($fp, 0); - - return false; - } - } else { - if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { - return false; - } - - $tmpFile = tempnam(dirname($path), basename($path)); - if (false === $fp = @fopen($tmpFile, 'wb')) { - return false; - } - @fwrite($fp, $data); - @fclose($fp); - - if ($data != file_get_contents($tmpFile)) { - return false; - } - - if (false === @rename($tmpFile, $path)) { - return false; - } - } - - @chmod($path, 0666 & ~umask()); - } - - public function getPath($key) - { - return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6); - } - - /** - * Generates a cache key for the given Request. - * - * This method should return a key that must only depend on a - * normalized version of the request URI. - * - * If the same URI can have more than one representation, based on some - * headers, use a Vary header to indicate them, and each representation will - * be stored independently under the same cache key. - * - * @param Request $request A Request instance - * - * @return string A key for the given Request - */ - protected function generateCacheKey(Request $request) - { - return 'md'.hash('sha256', $request->getUri()); - } - - /** - * Returns a cache key for the given Request. - * - * @param Request $request A Request instance - * - * @return string A key for the given Request - */ - private function getCacheKey(Request $request) - { - if (isset($this->keyCache[$request])) { - return $this->keyCache[$request]; - } - - return $this->keyCache[$request] = $this->generateCacheKey($request); - } - - /** - * Persists the Request HTTP headers. - * - * @param Request $request A Request instance - * - * @return array An array of HTTP headers - */ - private function persistRequest(Request $request) - { - return $request->headers->all(); - } - - /** - * Persists the Response HTTP headers. - * - * @param Response $response A Response instance - * - * @return array An array of HTTP headers - */ - private function persistResponse(Response $response) - { - $headers = $response->headers->all(); - $headers['X-Status'] = array($response->getStatusCode()); - - return $headers; - } - - /** - * Restores a Response from the HTTP headers and body. - * - * @param array $headers An array of HTTP headers for the Response - * @param string $body The Response body - * - * @return Response - */ - private function restoreResponse($headers, $body = null) - { - $status = $headers['X-Status'][0]; - unset($headers['X-Status']); - - if (null !== $body) { - $headers['X-Body-File'] = array($body); - } - - return new Response($body, $status, $headers); - } -} diff --git a/vendor/symfony/http-kernel/HttpCache/StoreInterface.php b/vendor/symfony/http-kernel/HttpCache/StoreInterface.php deleted file mode 100644 index ddc0c04..0000000 --- a/vendor/symfony/http-kernel/HttpCache/StoreInterface.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Interface implemented by HTTP cache stores. - * - * @author Fabien Potencier - */ -interface StoreInterface -{ - /** - * Locates a cached Response for the Request provided. - * - * @param Request $request A Request instance - * - * @return Response|null A Response instance, or null if no cache entry was found - */ - public function lookup(Request $request); - - /** - * Writes a cache entry to the store for the given Request and Response. - * - * Existing entries are read and any that match the response are removed. This - * method calls write with the new list of cache entries. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return string The key under which the response is stored - */ - public function write(Request $request, Response $response); - - /** - * Invalidates all cache entries that match the request. - * - * @param Request $request A Request instance - */ - public function invalidate(Request $request); - - /** - * Locks the cache for a given Request. - * - * @param Request $request A Request instance - * - * @return bool|string true if the lock is acquired, the path to the current lock otherwise - */ - public function lock(Request $request); - - /** - * Releases the lock for the given Request. - * - * @param Request $request A Request instance - * - * @return bool False if the lock file does not exist or cannot be unlocked, true otherwise - */ - public function unlock(Request $request); - - /** - * Returns whether or not a lock exists. - * - * @param Request $request A Request instance - * - * @return bool true if lock exists, false otherwise - */ - public function isLocked(Request $request); - - /** - * Purges data for the given URL. - * - * @param string $url A URL - * - * @return bool true if the URL exists and has been purged, false otherwise - */ - public function purge($url); - - /** - * Cleanups storage. - */ - public function cleanup(); -} diff --git a/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php b/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php deleted file mode 100644 index 5d65fd6..0000000 --- a/vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\HttpCache; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -interface SurrogateInterface -{ - /** - * Returns surrogate name. - * - * @return string - */ - public function getName(); - - /** - * Returns a new cache strategy instance. - * - * @return ResponseCacheStrategyInterface A ResponseCacheStrategyInterface instance - */ - public function createCacheStrategy(); - - /** - * Checks that at least one surrogate has Surrogate capability. - * - * @param Request $request A Request instance - * - * @return bool true if one surrogate has Surrogate capability, false otherwise - */ - public function hasSurrogateCapability(Request $request); - - /** - * Adds Surrogate-capability to the given Request. - * - * @param Request $request A Request instance - */ - public function addSurrogateCapability(Request $request); - - /** - * Adds HTTP headers to specify that the Response needs to be parsed for Surrogate. - * - * This method only adds an Surrogate HTTP header if the Response has some Surrogate tags. - * - * @param Response $response A Response instance - */ - public function addSurrogateControl(Response $response); - - /** - * Checks that the Response needs to be parsed for Surrogate tags. - * - * @param Response $response A Response instance - * - * @return bool true if the Response needs to be parsed, false otherwise - */ - public function needsParsing(Response $response); - - /** - * Renders a Surrogate tag. - * - * @param string $uri A URI - * @param string $alt An alternate URI - * @param bool $ignoreErrors Whether to ignore errors or not - * @param string $comment A comment to add as an esi:include tag - * - * @return string - */ - public function renderIncludeTag($uri, $alt = null, $ignoreErrors = true, $comment = ''); - - /** - * Replaces a Response Surrogate tags with the included resource content. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * - * @return Response - */ - public function process(Request $request, Response $response); - - /** - * Handles a Surrogate from the cache. - * - * @param HttpCache $cache An HttpCache instance - * @param string $uri The main URI - * @param string $alt An alternative URI - * @param bool $ignoreErrors Whether to ignore errors or not - * - * @return string - * - * @throws \RuntimeException - * @throws \Exception - */ - public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors); -} diff --git a/vendor/symfony/http-kernel/HttpKernel.php b/vendor/symfony/http-kernel/HttpKernel.php deleted file mode 100644 index 8d55ccd..0000000 --- a/vendor/symfony/http-kernel/HttpKernel.php +++ /dev/null @@ -1,301 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * HttpKernel notifies events to convert a Request object to a Response one. - * - * @author Fabien Potencier - */ -class HttpKernel implements HttpKernelInterface, TerminableInterface -{ - protected $dispatcher; - protected $resolver; - protected $requestStack; - private $argumentResolver; - - public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null, ArgumentResolverInterface $argumentResolver = null) - { - $this->dispatcher = $dispatcher; - $this->resolver = $resolver; - $this->requestStack = $requestStack ?: new RequestStack(); - $this->argumentResolver = $argumentResolver; - - if (null === $this->argumentResolver) { - @trigger_error(sprintf('As of 3.1 an %s is used to resolve arguments. In 4.0 the $argumentResolver becomes the %s if no other is provided instead of using the $resolver argument.', ArgumentResolverInterface::class, ArgumentResolver::class), E_USER_DEPRECATED); - // fallback in case of deprecations - $this->argumentResolver = $resolver; - } - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - $request->headers->set('X-Php-Ob-Level', ob_get_level()); - - try { - return $this->handleRaw($request, $type); - } catch (\Exception $e) { - if ($e instanceof RequestExceptionInterface) { - $e = new BadRequestHttpException($e->getMessage(), $e); - } - if (false === $catch) { - $this->finishRequest($request, $type); - - throw $e; - } - - return $this->handleException($e, $request, $type); - } - } - - /** - * {@inheritdoc} - */ - public function terminate(Request $request, Response $response) - { - $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response)); - } - - /** - * @throws \LogicException If the request stack is empty - * - * @internal - */ - public function terminateWithException(\Exception $exception) - { - if (!$request = $this->requestStack->getMasterRequest()) { - throw new \LogicException('Request stack is empty', 0, $exception); - } - - $response = $this->handleException($exception, $request, self::MASTER_REQUEST); - - $response->sendHeaders(); - $response->sendContent(); - - $this->terminate($request, $response); - } - - /** - * Handles a request to convert it to a response. - * - * Exceptions are not caught. - * - * @param Request $request A Request instance - * @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response A Response instance - * - * @throws \LogicException If one of the listener does not behave as expected - * @throws NotFoundHttpException When controller cannot be found - */ - private function handleRaw(Request $request, $type = self::MASTER_REQUEST) - { - $this->requestStack->push($request); - - // request - $event = new GetResponseEvent($this, $request, $type); - $this->dispatcher->dispatch(KernelEvents::REQUEST, $event); - - if ($event->hasResponse()) { - return $this->filterResponse($event->getResponse(), $request, $type); - } - - // load controller - if (false === $controller = $this->resolver->getController($request)) { - throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $request->getPathInfo())); - } - - $event = new FilterControllerEvent($this, $controller, $request, $type); - $this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event); - $controller = $event->getController(); - - // controller arguments - $arguments = $this->argumentResolver->getArguments($request, $controller); - - $event = new FilterControllerArgumentsEvent($this, $controller, $arguments, $request, $type); - $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event); - $controller = $event->getController(); - $arguments = $event->getArguments(); - - // call controller - $response = call_user_func_array($controller, $arguments); - - // view - if (!$response instanceof Response) { - $event = new GetResponseForControllerResultEvent($this, $request, $type, $response); - $this->dispatcher->dispatch(KernelEvents::VIEW, $event); - - if ($event->hasResponse()) { - $response = $event->getResponse(); - } - - if (!$response instanceof Response) { - $msg = sprintf('The controller must return a response (%s given).', $this->varToString($response)); - - // the user may have forgotten to return something - if (null === $response) { - $msg .= ' Did you forget to add a return statement somewhere in your controller?'; - } - throw new \LogicException($msg); - } - } - - return $this->filterResponse($response, $request, $type); - } - - /** - * Filters a response object. - * - * @param Response $response A Response instance - * @param Request $request An error message in case the response is not a Response object - * @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * - * @return Response The filtered Response instance - * - * @throws \RuntimeException if the passed object is not a Response instance - */ - private function filterResponse(Response $response, Request $request, $type) - { - $event = new FilterResponseEvent($this, $request, $type, $response); - - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->finishRequest($request, $type); - - return $event->getResponse(); - } - - /** - * Publishes the finish request event, then pop the request from the stack. - * - * Note that the order of the operations is important here, otherwise - * operations such as {@link RequestStack::getParentRequest()} can lead to - * weird results. - * - * @param Request $request - * @param int $type - */ - private function finishRequest(Request $request, $type) - { - $this->dispatcher->dispatch(KernelEvents::FINISH_REQUEST, new FinishRequestEvent($this, $request, $type)); - $this->requestStack->pop(); - } - - /** - * Handles an exception by trying to convert it to a Response. - * - * @param \Exception $e An \Exception instance - * @param Request $request A Request instance - * @param int $type The type of the request - * - * @return Response A Response instance - * - * @throws \Exception - */ - private function handleException(\Exception $e, $request, $type) - { - $event = new GetResponseForExceptionEvent($this, $request, $type, $e); - $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - - // a listener might have replaced the exception - $e = $event->getException(); - - if (!$event->hasResponse()) { - $this->finishRequest($request, $type); - - throw $e; - } - - $response = $event->getResponse(); - - // the developer asked for a specific status code - if ($response->headers->has('X-Status-Code')) { - @trigger_error(sprintf('Using the X-Status-Code header is deprecated since version 3.3 and will be removed in 4.0. Use %s::allowCustomResponseCode() instead.', GetResponseForExceptionEvent::class), E_USER_DEPRECATED); - - $response->setStatusCode($response->headers->get('X-Status-Code')); - - $response->headers->remove('X-Status-Code'); - } elseif (!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { - // ensure that we actually have an error response - if ($e instanceof HttpExceptionInterface) { - // keep the HTTP status code and headers - $response->setStatusCode($e->getStatusCode()); - $response->headers->add($e->getHeaders()); - } else { - $response->setStatusCode(500); - } - } - - try { - return $this->filterResponse($response, $request, $type); - } catch (\Exception $e) { - return $response; - } - } - - private function varToString($var) - { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); - } - - if (is_array($var)) { - $a = array(); - foreach ($var as $k => $v) { - $a[] = sprintf('%s => %s', $k, $this->varToString($v)); - } - - return sprintf('Array(%s)', implode(', ', $a)); - } - - if (is_resource($var)) { - return sprintf('Resource(%s)', get_resource_type($var)); - } - - if (null === $var) { - return 'null'; - } - - if (false === $var) { - return 'false'; - } - - if (true === $var) { - return 'true'; - } - - return (string) $var; - } -} diff --git a/vendor/symfony/http-kernel/HttpKernelInterface.php b/vendor/symfony/http-kernel/HttpKernelInterface.php deleted file mode 100644 index 5050bfc..0000000 --- a/vendor/symfony/http-kernel/HttpKernelInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * HttpKernelInterface handles a Request to convert it to a Response. - * - * @author Fabien Potencier - */ -interface HttpKernelInterface -{ - const MASTER_REQUEST = 1; - const SUB_REQUEST = 2; - - /** - * Handles a Request to convert it to a Response. - * - * When $catch is true, the implementation must catch all exceptions - * and do its best to convert them to a Response instance. - * - * @param Request $request A Request instance - * @param int $type The type of the request - * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param bool $catch Whether to catch exceptions or not - * - * @return Response A Response instance - * - * @throws \Exception When an Exception occurs during processing - */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php deleted file mode 100644 index 3a29e7b..0000000 --- a/vendor/symfony/http-kernel/Kernel.php +++ /dev/null @@ -1,864 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; -use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\EnvParametersResource; -use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; -use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass; -use Symfony\Component\Config\Loader\GlobFileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - */ -abstract class Kernel implements KernelInterface, TerminableInterface -{ - /** - * @var BundleInterface[] - */ - protected $bundles = array(); - - protected $bundleMap; - protected $container; - protected $rootDir; - protected $environment; - protected $debug; - protected $booted = false; - protected $name; - protected $startTime; - protected $loadClassCache; - - private $projectDir; - - const VERSION = '3.3.10'; - const VERSION_ID = 30310; - const MAJOR_VERSION = 3; - const MINOR_VERSION = 3; - const RELEASE_VERSION = 10; - const EXTRA_VERSION = ''; - - const END_OF_MAINTENANCE = '01/2018'; - const END_OF_LIFE = '07/2018'; - - /** - * @param string $environment The environment - * @param bool $debug Whether to enable debugging or not - */ - public function __construct($environment, $debug) - { - $this->environment = $environment; - $this->debug = (bool) $debug; - $this->rootDir = $this->getRootDir(); - $this->name = $this->getName(); - - if ($this->debug) { - $this->startTime = microtime(true); - } - } - - public function __clone() - { - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->booted = false; - $this->container = null; - } - - /** - * Boots the current kernel. - */ - public function boot() - { - if (true === $this->booted) { - return; - } - - if ($this->loadClassCache) { - $this->doLoadClassCache($this->loadClassCache[0], $this->loadClassCache[1]); - } - - // init bundles - $this->initializeBundles(); - - // init container - $this->initializeContainer(); - - foreach ($this->getBundles() as $bundle) { - $bundle->setContainer($this->container); - $bundle->boot(); - } - - $this->booted = true; - } - - /** - * {@inheritdoc} - */ - public function terminate(Request $request, Response $response) - { - if (false === $this->booted) { - return; - } - - if ($this->getHttpKernel() instanceof TerminableInterface) { - $this->getHttpKernel()->terminate($request, $response); - } - } - - /** - * {@inheritdoc} - */ - public function shutdown() - { - if (false === $this->booted) { - return; - } - - $this->booted = false; - - foreach ($this->getBundles() as $bundle) { - $bundle->shutdown(); - $bundle->setContainer(null); - } - - $this->container = null; - } - - /** - * {@inheritdoc} - */ - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (false === $this->booted) { - $this->boot(); - } - - return $this->getHttpKernel()->handle($request, $type, $catch); - } - - /** - * Gets a HTTP kernel from the container. - * - * @return HttpKernel - */ - protected function getHttpKernel() - { - return $this->container->get('http_kernel'); - } - - /** - * {@inheritdoc} - */ - public function getBundles() - { - return $this->bundles; - } - - /** - * {@inheritdoc} - */ - public function getBundle($name, $first = true) - { - if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); - } - - if (true === $first) { - return $this->bundleMap[$name][0]; - } - - return $this->bundleMap[$name]; - } - - /** - * {@inheritdoc} - * - * @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle - */ - public function locateResource($name, $dir = null, $first = true) - { - if ('@' !== $name[0]) { - throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); - } - - if (false !== strpos($name, '..')) { - throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); - } - - $bundleName = substr($name, 1); - $path = ''; - if (false !== strpos($bundleName, '/')) { - list($bundleName, $path) = explode('/', $bundleName, 2); - } - - $isResource = 0 === strpos($path, 'Resources') && null !== $dir; - $overridePath = substr($path, 9); - $resourceBundle = null; - $bundles = $this->getBundle($bundleName, false); - $files = array(); - - foreach ($bundles as $bundle) { - if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { - if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); - } - - if ($first) { - return $file; - } - $files[] = $file; - } - - if (file_exists($file = $bundle->getPath().'/'.$path)) { - if ($first && !$isResource) { - return $file; - } - $files[] = $file; - $resourceBundle = $bundle->getName(); - } - } - - if (count($files) > 0) { - return $first && $isResource ? $files[0] : $files; - } - - throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - if (null === $this->name) { - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); - if (ctype_digit($this->name[0])) { - $this->name = '_'.$this->name; - } - } - - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * {@inheritdoc} - */ - public function isDebug() - { - return $this->debug; - } - - /** - * {@inheritdoc} - */ - public function getRootDir() - { - if (null === $this->rootDir) { - $r = new \ReflectionObject($this); - $this->rootDir = dirname($r->getFileName()); - } - - return $this->rootDir; - } - - /** - * Gets the application root dir (path of the project's composer file). - * - * @return string The project root dir - */ - public function getProjectDir() - { - if (null === $this->projectDir) { - $r = new \ReflectionObject($this); - $dir = $rootDir = dirname($r->getFileName()); - while (!file_exists($dir.'/composer.json')) { - if ($dir === dirname($dir)) { - return $this->projectDir = $rootDir; - } - $dir = dirname($dir); - } - $this->projectDir = $dir; - } - - return $this->projectDir; - } - - /** - * {@inheritdoc} - */ - public function getContainer() - { - return $this->container; - } - - /** - * Loads the PHP class cache. - * - * This methods only registers the fact that you want to load the cache classes. - * The cache will actually only be loaded when the Kernel is booted. - * - * That optimization is mainly useful when using the HttpCache class in which - * case the class cache is not loaded if the Response is in the cache. - * - * @param string $name The cache name prefix - * @param string $extension File extension of the resulting file - * - * @deprecated since version 3.3, to be removed in 4.0. - */ - public function loadClassCache($name = 'classes', $extension = '.php') - { - if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); - } - - $this->loadClassCache = array($name, $extension); - } - - /** - * @internal - * - * @deprecated since version 3.3, to be removed in 4.0. - */ - public function setClassCache(array $classes) - { - if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); - } - - file_put_contents($this->getCacheDir().'/classes.map', sprintf('getCacheDir().'/annotations.map', sprintf('debug ? $this->startTime : -INF; - } - - /** - * {@inheritdoc} - */ - public function getCacheDir() - { - return $this->rootDir.'/cache/'.$this->environment; - } - - /** - * {@inheritdoc} - */ - public function getLogDir() - { - return $this->rootDir.'/logs'; - } - - /** - * {@inheritdoc} - */ - public function getCharset() - { - return 'UTF-8'; - } - - /** - * @deprecated since version 3.3, to be removed in 4.0. - */ - protected function doLoadClassCache($name, $extension) - { - if (\PHP_VERSION_ID >= 70000) { - @trigger_error(__METHOD__.'() is deprecated since version 3.3, to be removed in 4.0.', E_USER_DEPRECATED); - } - - if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) { - ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); - } - } - - /** - * Initializes the data structures related to the bundle management. - * - * - the bundles property maps a bundle name to the bundle instance, - * - the bundleMap property maps a bundle name to the bundle inheritance hierarchy (most derived bundle first). - * - * @throws \LogicException if two bundles share a common name - * @throws \LogicException if a bundle tries to extend a non-registered bundle - * @throws \LogicException if a bundle tries to extend itself - * @throws \LogicException if two bundles extend the same ancestor - */ - protected function initializeBundles() - { - // init bundles - $this->bundles = array(); - $topMostBundles = array(); - $directChildren = array(); - - foreach ($this->registerBundles() as $bundle) { - $name = $bundle->getName(); - if (isset($this->bundles[$name])) { - throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); - } - $this->bundles[$name] = $bundle; - - if ($parentName = $bundle->getParent()) { - if (isset($directChildren[$parentName])) { - throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); - } - if ($parentName == $name) { - throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); - } - $directChildren[$parentName] = $name; - } else { - $topMostBundles[$name] = $bundle; - } - } - - // look for orphans - if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) { - $diff = array_keys($diff); - - throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); - } - - // inheritance - $this->bundleMap = array(); - foreach ($topMostBundles as $name => $bundle) { - $bundleMap = array($bundle); - $hierarchy = array($name); - - while (isset($directChildren[$name])) { - $name = $directChildren[$name]; - array_unshift($bundleMap, $this->bundles[$name]); - $hierarchy[] = $name; - } - - foreach ($hierarchy as $hierarchyBundle) { - $this->bundleMap[$hierarchyBundle] = $bundleMap; - array_pop($bundleMap); - } - } - } - - /** - * The extension point similar to the Bundle::build() method. - * - * Use this method to register compiler passes and manipulate the container during the building process. - * - * @param ContainerBuilder $container - */ - protected function build(ContainerBuilder $container) - { - } - - /** - * Gets the container class. - * - * @return string The container class - */ - protected function getContainerClass() - { - return $this->name.ucfirst($this->environment).($this->debug ? 'Debug' : '').'ProjectContainer'; - } - - /** - * Gets the container's base class. - * - * All names except Container must be fully qualified. - * - * @return string - */ - protected function getContainerBaseClass() - { - return 'Container'; - } - - /** - * Initializes the service container. - * - * The cached version of the service container is used when fresh, otherwise the - * container is built. - */ - protected function initializeContainer() - { - $class = $this->getContainerClass(); - $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); - $fresh = true; - if (!$cache->isFresh()) { - if ($this->debug) { - $collectedLogs = array(); - $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { - if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { - return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; - } - - if (isset($collectedLogs[$message])) { - ++$collectedLogs[$message]['count']; - - return; - } - - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - // Clean the trace by removing first frames added by the error handler itself. - for ($i = 0; isset($backtrace[$i]); ++$i) { - if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $backtrace = array_slice($backtrace, 1 + $i); - break; - } - } - - $collectedLogs[$message] = array( - 'type' => $type, - 'message' => $message, - 'file' => $file, - 'line' => $line, - 'trace' => $backtrace, - 'count' => 1, - ); - }); - } - - try { - $container = null; - $container = $this->buildContainer(); - $container->compile(); - } finally { - if ($this->debug) { - restore_error_handler(); - - file_put_contents($this->getCacheDir().'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); - file_put_contents($this->getCacheDir().'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); - } - } - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - - $fresh = false; - } - - require_once $cache->getPath(); - - $this->container = new $class(); - $this->container->set('kernel', $this); - - if (!$fresh && $this->container->has('cache_warmer')) { - $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); - } - } - - /** - * Returns the kernel parameters. - * - * @return array An array of kernel parameters - */ - protected function getKernelParameters() - { - $bundles = array(); - $bundlesMetadata = array(); - - foreach ($this->bundles as $name => $bundle) { - $bundles[$name] = get_class($bundle); - $bundlesMetadata[$name] = array( - 'parent' => $bundle->getParent(), - 'path' => $bundle->getPath(), - 'namespace' => $bundle->getNamespace(), - ); - } - - return array_merge( - array( - 'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir, - 'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(), - 'kernel.environment' => $this->environment, - 'kernel.debug' => $this->debug, - 'kernel.name' => $this->name, - 'kernel.cache_dir' => realpath($this->getCacheDir()) ?: $this->getCacheDir(), - 'kernel.logs_dir' => realpath($this->getLogDir()) ?: $this->getLogDir(), - 'kernel.bundles' => $bundles, - 'kernel.bundles_metadata' => $bundlesMetadata, - 'kernel.charset' => $this->getCharset(), - 'kernel.container_class' => $this->getContainerClass(), - ), - $this->getEnvParameters(false) - ); - } - - /** - * Gets the environment parameters. - * - * Only the parameters starting with "SYMFONY__" are considered. - * - * @return array An array of parameters - * - * @deprecated since version 3.3, to be removed in 4.0 - */ - protected function getEnvParameters() - { - if (0 === func_num_args() || func_get_arg(0)) { - @trigger_error(sprintf('The %s() method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED); - } - - $parameters = array(); - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, 'SYMFONY__')) { - @trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax instead to get the value of environment variables in configuration files.', $key), E_USER_DEPRECATED); - $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; - } - } - - return $parameters; - } - - /** - * Builds the service container. - * - * @return ContainerBuilder The compiled service container - * - * @throws \RuntimeException - */ - protected function buildContainer() - { - foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); - } - } - - $container = $this->getContainerBuilder(); - $container->addObjectResource($this); - $this->prepareContainer($container); - - if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { - $container->merge($cont); - } - - $container->addCompilerPass(new AddAnnotatedClassesToCachePass($this)); - $container->addResource(new EnvParametersResource('SYMFONY__')); - - return $container; - } - - /** - * Prepares the ContainerBuilder before it is compiled. - * - * @param ContainerBuilder $container A ContainerBuilder instance - */ - protected function prepareContainer(ContainerBuilder $container) - { - $extensions = array(); - foreach ($this->bundles as $bundle) { - if ($extension = $bundle->getContainerExtension()) { - $container->registerExtension($extension); - $extensions[] = $extension->getAlias(); - } - - if ($this->debug) { - $container->addObjectResource($bundle); - } - } - - foreach ($this->bundles as $bundle) { - $bundle->build($container); - } - - $this->build($container); - - // ensure these extensions are implicitly loaded - $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); - } - - /** - * Gets a new ContainerBuilder instance used to build the service container. - * - * @return ContainerBuilder - */ - protected function getContainerBuilder() - { - $container = new ContainerBuilder(); - $container->getParameterBag()->add($this->getKernelParameters()); - - if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) { - $container->setProxyInstantiator(new RuntimeInstantiator()); - } - - return $container; - } - - /** - * Dumps the service container to PHP code in the cache. - * - * @param ConfigCache $cache The config cache - * @param ContainerBuilder $container The service container - * @param string $class The name of the class to generate - * @param string $baseClass The name of the container's base class - */ - protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) - { - // cache the container - $dumper = new PhpDumper($container); - - if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) { - $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); - } - - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'debug' => $this->debug)); - - $cache->write($content, $container->getResources()); - } - - /** - * Returns a loader for the container. - * - * @param ContainerInterface $container The service container - * - * @return DelegatingLoader The loader - */ - protected function getContainerLoader(ContainerInterface $container) - { - $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new GlobFileLoader($locator), - new DirectoryLoader($container, $locator), - new ClosureLoader($container), - )); - - return new DelegatingLoader($resolver); - } - - /** - * Removes comments from a PHP source string. - * - * We don't use the PHP php_strip_whitespace() function - * as we want the content to be readable and well-formatted. - * - * @param string $source A PHP string - * - * @return string The PHP string with the comments removed - */ - public static function stripComments($source) - { - if (!function_exists('token_get_all')) { - return $source; - } - - $rawChunk = ''; - $output = ''; - $tokens = token_get_all($source); - $ignoreSpace = false; - for ($i = 0; isset($tokens[$i]); ++$i) { - $token = $tokens[$i]; - if (!isset($token[1]) || 'b"' === $token) { - $rawChunk .= $token; - } elseif (T_START_HEREDOC === $token[0]) { - $output .= $rawChunk.$token[1]; - do { - $token = $tokens[++$i]; - $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token; - } while (T_END_HEREDOC !== $token[0]); - $rawChunk = ''; - } elseif (T_WHITESPACE === $token[0]) { - if ($ignoreSpace) { - $ignoreSpace = false; - - continue; - } - - // replace multiple new lines with a single newline - $rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]); - } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $ignoreSpace = true; - } else { - $rawChunk .= $token[1]; - - // The PHP-open tag already has a new-line - if (T_OPEN_TAG === $token[0]) { - $ignoreSpace = true; - } - } - } - - $output .= $rawChunk; - - if (\PHP_VERSION_ID >= 70000) { - // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098 - unset($tokens, $rawChunk); - gc_mem_caches(); - } - - return $output; - } - - public function serialize() - { - return serialize(array($this->environment, $this->debug)); - } - - public function unserialize($data) - { - if (\PHP_VERSION_ID >= 70000) { - list($environment, $debug) = unserialize($data, array('allowed_classes' => false)); - } else { - list($environment, $debug) = unserialize($data); - } - - $this->__construct($environment, $debug); - } -} diff --git a/vendor/symfony/http-kernel/KernelEvents.php b/vendor/symfony/http-kernel/KernelEvents.php deleted file mode 100644 index 3e96173..0000000 --- a/vendor/symfony/http-kernel/KernelEvents.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -/** - * Contains all events thrown in the HttpKernel component. - * - * @author Bernhard Schussek - */ -final class KernelEvents -{ - /** - * The REQUEST event occurs at the very beginning of request - * dispatching. - * - * This event allows you to create a response for a request before any - * other code in the framework is executed. - * - * @Event("Symfony\Component\HttpKernel\Event\GetResponseEvent") - * - * @var string - */ - const REQUEST = 'kernel.request'; - - /** - * The EXCEPTION event occurs when an uncaught exception appears. - * - * This event allows you to create a response for a thrown exception or - * to modify the thrown exception. - * - * @Event("Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent") - * - * @var string - */ - const EXCEPTION = 'kernel.exception'; - - /** - * The VIEW event occurs when the return value of a controller - * is not a Response instance. - * - * This event allows you to create a response for the return value of the - * controller. - * - * @Event("Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent") - * - * @var string - */ - const VIEW = 'kernel.view'; - - /** - * The CONTROLLER event occurs once a controller was found for - * handling a request. - * - * This event allows you to change the controller that will handle the - * request. - * - * @Event("Symfony\Component\HttpKernel\Event\FilterControllerEvent") - * - * @var string - */ - const CONTROLLER = 'kernel.controller'; - - /** - * The CONTROLLER_ARGUMENTS event occurs once controller arguments have been resolved. - * - * This event allows you to change the arguments that will be passed to - * the controller. - * - * @Event("Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent") - * - * @var string - */ - const CONTROLLER_ARGUMENTS = 'kernel.controller_arguments'; - - /** - * The RESPONSE event occurs once a response was created for - * replying to a request. - * - * This event allows you to modify or replace the response that will be - * replied. - * - * @Event("Symfony\Component\HttpKernel\Event\FilterResponseEvent") - * - * @var string - */ - const RESPONSE = 'kernel.response'; - - /** - * The TERMINATE event occurs once a response was sent. - * - * This event allows you to run expensive post-response jobs. - * - * @Event("Symfony\Component\HttpKernel\Event\PostResponseEvent") - * - * @var string - */ - const TERMINATE = 'kernel.terminate'; - - /** - * The FINISH_REQUEST event occurs when a response was generated for a request. - * - * This event allows you to reset the global and environmental state of - * the application, when it was changed during the request. - * - * @Event("Symfony\Component\HttpKernel\Event\FinishRequestEvent") - * - * @var string - */ - const FINISH_REQUEST = 'kernel.finish_request'; -} diff --git a/vendor/symfony/http-kernel/KernelInterface.php b/vendor/symfony/http-kernel/KernelInterface.php deleted file mode 100644 index b8609b9..0000000 --- a/vendor/symfony/http-kernel/KernelInterface.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; - -/** - * The Kernel is the heart of the Symfony system. - * - * It manages an environment made of bundles. - * - * @author Fabien Potencier - */ -interface KernelInterface extends HttpKernelInterface, \Serializable -{ - /** - * Returns an array of bundles to register. - * - * @return BundleInterface[] An array of bundle instances - */ - public function registerBundles(); - - /** - * Loads the container configuration. - * - * @param LoaderInterface $loader A LoaderInterface instance - */ - public function registerContainerConfiguration(LoaderInterface $loader); - - /** - * Boots the current kernel. - */ - public function boot(); - - /** - * Shutdowns the kernel. - * - * This method is mainly useful when doing functional testing. - */ - public function shutdown(); - - /** - * Gets the registered bundle instances. - * - * @return BundleInterface[] An array of registered bundle instances - */ - public function getBundles(); - - /** - * Returns a bundle and optionally its descendants by its name. - * - * @param string $name Bundle name - * @param bool $first Whether to return the first bundle only or together with its descendants - * - * @return BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false - * - * @throws \InvalidArgumentException when the bundle is not enabled - */ - public function getBundle($name, $first = true); - - /** - * Returns the file path for a given resource. - * - * A Resource can be a file or a directory. - * - * The resource name must follow the following pattern: - * - * "@BundleName/path/to/a/file.something" - * - * where BundleName is the name of the bundle - * and the remaining part is the relative path in the bundle. - * - * If $dir is passed, and the first segment of the path is "Resources", - * this method will look for a file named: - * - * $dir//path/without/Resources - * - * before looking in the bundle resource folder. - * - * @param string $name A resource name to locate - * @param string $dir A directory where to look for the resource first - * @param bool $first Whether to return the first path or paths for all matching bundles - * - * @return string|array The absolute path of the resource or an array if $first is false - * - * @throws \InvalidArgumentException if the file cannot be found or the name is not valid - * @throws \RuntimeException if the name contains invalid/unsafe characters - */ - public function locateResource($name, $dir = null, $first = true); - - /** - * Gets the name of the kernel. - * - * @return string The kernel name - */ - public function getName(); - - /** - * Gets the environment. - * - * @return string The current environment - */ - public function getEnvironment(); - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - */ - public function isDebug(); - - /** - * Gets the application root dir (path of the project's Kernel class). - * - * @return string The Kernel root dir - */ - public function getRootDir(); - - /** - * Gets the current container. - * - * @return ContainerInterface A ContainerInterface instance - */ - public function getContainer(); - - /** - * Gets the request start time (not available if debug is disabled). - * - * @return int The request start timestamp - */ - public function getStartTime(); - - /** - * Gets the cache directory. - * - * @return string The cache directory - */ - public function getCacheDir(); - - /** - * Gets the log directory. - * - * @return string The log directory - */ - public function getLogDir(); - - /** - * Gets the charset of the application. - * - * @return string The charset - */ - public function getCharset(); -} diff --git a/vendor/symfony/http-kernel/LICENSE b/vendor/symfony/http-kernel/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/http-kernel/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php b/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php deleted file mode 100644 index 5635a21..0000000 --- a/vendor/symfony/http-kernel/Log/DebugLoggerInterface.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Log; - -/** - * DebugLoggerInterface. - * - * @author Fabien Potencier - */ -interface DebugLoggerInterface -{ - /** - * Returns an array of logs. - * - * A log is an array with the following mandatory keys: - * timestamp, message, priority, and priorityName. - * It can also have an optional context key containing an array. - * - * @return array An array of logs - */ - public function getLogs(); - - /** - * Returns the number of errors. - * - * @return int The number of errors - */ - public function countErrors(); -} diff --git a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php deleted file mode 100644 index e24b2e0..0000000 --- a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php +++ /dev/null @@ -1,292 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * Storage for profiler using files. - * - * @author Alexandre Salomé - */ -class FileProfilerStorage implements ProfilerStorageInterface -{ - /** - * Folder where profiler data are stored. - * - * @var string - */ - private $folder; - - /** - * Constructs the file storage using a "dsn-like" path. - * - * Example : "file:/path/to/the/storage/folder" - * - * @param string $dsn The DSN - * - * @throws \RuntimeException - */ - public function __construct($dsn) - { - if (0 !== strpos($dsn, 'file:')) { - throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn)); - } - $this->folder = substr($dsn, 5); - - if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) { - throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder)); - } - } - - /** - * {@inheritdoc} - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null) - { - $file = $this->getIndexFilename(); - - if (!file_exists($file)) { - return array(); - } - - $file = fopen($file, 'r'); - fseek($file, 0, SEEK_END); - - $result = array(); - while (count($result) < $limit && $line = $this->readLineFromFile($file)) { - $values = str_getcsv($line); - list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values; - $csvTime = (int) $csvTime; - - if ($ip && false === strpos($csvIp, $ip) || $url && false === strpos($csvUrl, $url) || $method && false === strpos($csvMethod, $method) || $statusCode && false === strpos($csvStatusCode, $statusCode)) { - continue; - } - - if (!empty($start) && $csvTime < $start) { - continue; - } - - if (!empty($end) && $csvTime > $end) { - continue; - } - - $result[$csvToken] = array( - 'token' => $csvToken, - 'ip' => $csvIp, - 'method' => $csvMethod, - 'url' => $csvUrl, - 'time' => $csvTime, - 'parent' => $csvParent, - 'status_code' => $csvStatusCode, - ); - } - - fclose($file); - - return array_values($result); - } - - /** - * {@inheritdoc} - */ - public function purge() - { - $flags = \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveDirectoryIterator($this->folder, $flags); - $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST); - - foreach ($iterator as $file) { - if (is_file($file)) { - unlink($file); - } else { - rmdir($file); - } - } - } - - /** - * {@inheritdoc} - */ - public function read($token) - { - if (!$token || !file_exists($file = $this->getFilename($token))) { - return; - } - - return $this->createProfileFromData($token, unserialize(file_get_contents($file))); - } - - /** - * {@inheritdoc} - * - * @throws \RuntimeException - */ - public function write(Profile $profile) - { - $file = $this->getFilename($profile->getToken()); - - $profileIndexed = is_file($file); - if (!$profileIndexed) { - // Create directory - $dir = dirname($file); - if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) { - throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir)); - } - } - - $profileToken = $profile->getToken(); - // when there are errors in sub-requests, the parent and/or children tokens - // may equal the profile token, resulting in infinite loops - $parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null; - $childrenToken = array_filter(array_map(function ($p) use ($profileToken) { - return $profileToken !== $p->getToken() ? $p->getToken() : null; - }, $profile->getChildren())); - - // Store profile - $data = array( - 'token' => $profileToken, - 'parent' => $parentToken, - 'children' => $childrenToken, - 'data' => $profile->getCollectors(), - 'ip' => $profile->getIp(), - 'method' => $profile->getMethod(), - 'url' => $profile->getUrl(), - 'time' => $profile->getTime(), - 'status_code' => $profile->getStatusCode(), - ); - - if (false === file_put_contents($file, serialize($data))) { - return false; - } - - if (!$profileIndexed) { - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } - - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - $profile->getStatusCode(), - )); - fclose($file); - } - - return true; - } - - /** - * Gets filename to store data, associated to the token. - * - * @param string $token - * - * @return string The profile filename - */ - protected function getFilename($token) - { - // Uses 4 last characters, because first are mostly the same. - $folderA = substr($token, -2, 2); - $folderB = substr($token, -4, 2); - - return $this->folder.'/'.$folderA.'/'.$folderB.'/'.$token; - } - - /** - * Gets the index filename. - * - * @return string The index filename - */ - protected function getIndexFilename() - { - return $this->folder.'/index.csv'; - } - - /** - * Reads a line in the file, backward. - * - * This function automatically skips the empty lines and do not include the line return in result value. - * - * @param resource $file The file resource, with the pointer placed at the end of the line to read - * - * @return mixed A string representing the line or null if beginning of file is reached - */ - protected function readLineFromFile($file) - { - $line = ''; - $position = ftell($file); - - if (0 === $position) { - return; - } - - while (true) { - $chunkSize = min($position, 1024); - $position -= $chunkSize; - fseek($file, $position); - - if (0 === $chunkSize) { - // bof reached - break; - } - - $buffer = fread($file, $chunkSize); - - if (false === ($upTo = strrpos($buffer, "\n"))) { - $line = $buffer.$line; - continue; - } - - $position += $upTo; - $line = substr($buffer, $upTo + 1).$line; - fseek($file, max(0, $position), SEEK_SET); - - if ('' !== $line) { - break; - } - } - - return '' === $line ? null : $line; - } - - protected function createProfileFromData($token, $data, $parent = null) - { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setStatusCode($data['status_code']); - $profile->setCollectors($data['data']); - - if (!$parent && $data['parent']) { - $parent = $this->read($data['parent']); - } - - if ($parent) { - $profile->setParent($parent); - } - - foreach ($data['children'] as $token) { - if (!$token || !file_exists($file = $this->getFilename($token))) { - continue; - } - - $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); - } - - return $profile; - } -} diff --git a/vendor/symfony/http-kernel/Profiler/Profile.php b/vendor/symfony/http-kernel/Profiler/Profile.php deleted file mode 100644 index fba74ed..0000000 --- a/vendor/symfony/http-kernel/Profiler/Profile.php +++ /dev/null @@ -1,293 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; - -/** - * Profile. - * - * @author Fabien Potencier - */ -class Profile -{ - private $token; - - /** - * @var DataCollectorInterface[] - */ - private $collectors = array(); - - private $ip; - private $method; - private $url; - private $time; - private $statusCode; - - /** - * @var Profile - */ - private $parent; - - /** - * @var Profile[] - */ - private $children = array(); - - /** - * @param string $token The token - */ - public function __construct($token) - { - $this->token = $token; - } - - /** - * Sets the token. - * - * @param string $token The token - */ - public function setToken($token) - { - $this->token = $token; - } - - /** - * Gets the token. - * - * @return string The token - */ - public function getToken() - { - return $this->token; - } - - /** - * Sets the parent token. - * - * @param Profile $parent - */ - public function setParent(Profile $parent) - { - $this->parent = $parent; - } - - /** - * Returns the parent profile. - * - * @return self - */ - public function getParent() - { - return $this->parent; - } - - /** - * Returns the parent token. - * - * @return null|string The parent token - */ - public function getParentToken() - { - return $this->parent ? $this->parent->getToken() : null; - } - - /** - * Returns the IP. - * - * @return string The IP - */ - public function getIp() - { - return $this->ip; - } - - /** - * Sets the IP. - * - * @param string $ip - */ - public function setIp($ip) - { - $this->ip = $ip; - } - - /** - * Returns the request method. - * - * @return string The request method - */ - public function getMethod() - { - return $this->method; - } - - public function setMethod($method) - { - $this->method = $method; - } - - /** - * Returns the URL. - * - * @return string The URL - */ - public function getUrl() - { - return $this->url; - } - - public function setUrl($url) - { - $this->url = $url; - } - - /** - * Returns the time. - * - * @return int The time - */ - public function getTime() - { - if (null === $this->time) { - return 0; - } - - return $this->time; - } - - /** - * @param int The time - */ - public function setTime($time) - { - $this->time = $time; - } - - /** - * @param int $statusCode - */ - public function setStatusCode($statusCode) - { - $this->statusCode = $statusCode; - } - - /** - * @return int - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Finds children profilers. - * - * @return self[] - */ - public function getChildren() - { - return $this->children; - } - - /** - * Sets children profiler. - * - * @param Profile[] $children - */ - public function setChildren(array $children) - { - $this->children = array(); - foreach ($children as $child) { - $this->addChild($child); - } - } - - /** - * Adds the child token. - * - * @param Profile $child - */ - public function addChild(Profile $child) - { - $this->children[] = $child; - $child->setParent($this); - } - - /** - * Gets a Collector by name. - * - * @param string $name A collector name - * - * @return DataCollectorInterface A DataCollectorInterface instance - * - * @throws \InvalidArgumentException if the collector does not exist - */ - public function getCollector($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } - - /** - * Gets the Collectors associated with this profile. - * - * @return DataCollectorInterface[] - */ - public function getCollectors() - { - return $this->collectors; - } - - /** - * Sets the Collectors associated with this profile. - * - * @param DataCollectorInterface[] $collectors - */ - public function setCollectors(array $collectors) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->addCollector($collector); - } - } - - /** - * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance - */ - public function addCollector(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - /** - * Returns true if a Collector for the given name exists. - * - * @param string $name A collector name - * - * @return bool - */ - public function hasCollector($name) - { - return isset($this->collectors[$name]); - } - - public function __sleep() - { - return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode'); - } -} diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php deleted file mode 100644 index 2580b4f..0000000 --- a/vendor/symfony/http-kernel/Profiler/Profiler.php +++ /dev/null @@ -1,268 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; -use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Psr\Log\LoggerInterface; - -/** - * Profiler. - * - * @author Fabien Potencier - */ -class Profiler -{ - /** - * @var ProfilerStorageInterface - */ - private $storage; - - /** - * @var DataCollectorInterface[] - */ - private $collectors = array(); - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var bool - */ - private $enabled = true; - - /** - * @param ProfilerStorageInterface $storage A ProfilerStorageInterface instance - * @param LoggerInterface $logger A LoggerInterface instance - */ - public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null) - { - $this->storage = $storage; - $this->logger = $logger; - } - - /** - * Disables the profiler. - */ - public function disable() - { - $this->enabled = false; - } - - /** - * Enables the profiler. - */ - public function enable() - { - $this->enabled = true; - } - - /** - * Loads the Profile for the given Response. - * - * @param Response $response A Response instance - * - * @return Profile|false A Profile instance - */ - public function loadProfileFromResponse(Response $response) - { - if (!$token = $response->headers->get('X-Debug-Token')) { - return false; - } - - return $this->loadProfile($token); - } - - /** - * Loads the Profile for the given token. - * - * @param string $token A token - * - * @return Profile A Profile instance - */ - public function loadProfile($token) - { - return $this->storage->read($token); - } - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return bool - */ - public function saveProfile(Profile $profile) - { - // late collect - foreach ($profile->getCollectors() as $collector) { - if ($collector instanceof LateDataCollectorInterface) { - $collector->lateCollect(); - } - } - - if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => get_class($this->storage))); - } - - return $ret; - } - - /** - * Purges all data from the storage. - */ - public function purge() - { - $this->storage->purge(); - } - - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * @param string $start The start date to search from - * @param string $end The end date to search to - * @param string $statusCode The request status code - * - * @return array An array of tokens - * - * @see http://php.net/manual/en/datetime.formats.php for the supported date/time formats - */ - public function find($ip, $url, $limit, $method, $start, $end, $statusCode = null) - { - return $this->storage->find($ip, $url, $limit, $method, $this->getTimestamp($start), $this->getTimestamp($end), $statusCode); - } - - /** - * Collects data for the given Response. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - * @param \Exception $exception An exception instance if the request threw one - * - * @return Profile|null A Profile instance or null if the profiler is disabled - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if (false === $this->enabled) { - return; - } - - $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6)); - $profile->setTime(time()); - $profile->setUrl($request->getUri()); - $profile->setMethod($request->getMethod()); - $profile->setStatusCode($response->getStatusCode()); - try { - $profile->setIp($request->getClientIp()); - } catch (ConflictingHeadersException $e) { - $profile->setIp('Unknown'); - } - - $response->headers->set('X-Debug-Token', $profile->getToken()); - - foreach ($this->collectors as $collector) { - $collector->collect($request, $response, $exception); - - // we need to clone for sub-requests - $profile->addCollector(clone $collector); - } - - return $profile; - } - - /** - * Gets the Collectors associated with this profiler. - * - * @return array An array of collectors - */ - public function all() - { - return $this->collectors; - } - - /** - * Sets the Collectors associated with this profiler. - * - * @param DataCollectorInterface[] $collectors An array of collectors - */ - public function set(array $collectors = array()) - { - $this->collectors = array(); - foreach ($collectors as $collector) { - $this->add($collector); - } - } - - /** - * Adds a Collector. - * - * @param DataCollectorInterface $collector A DataCollectorInterface instance - */ - public function add(DataCollectorInterface $collector) - { - $this->collectors[$collector->getName()] = $collector; - } - - /** - * Returns true if a Collector for the given name exists. - * - * @param string $name A collector name - * - * @return bool - */ - public function has($name) - { - return isset($this->collectors[$name]); - } - - /** - * Gets a Collector by name. - * - * @param string $name A collector name - * - * @return DataCollectorInterface A DataCollectorInterface instance - * - * @throws \InvalidArgumentException if the collector does not exist - */ - public function get($name) - { - if (!isset($this->collectors[$name])) { - throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name)); - } - - return $this->collectors[$name]; - } - - private function getTimestamp($value) - { - if (null === $value || '' == $value) { - return; - } - - try { - $value = new \DateTime(is_numeric($value) ? '@'.$value : $value); - } catch (\Exception $e) { - return; - } - - return $value->getTimestamp(); - } -} diff --git a/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php b/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php deleted file mode 100644 index ea72af2..0000000 --- a/vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Profiler; - -/** - * ProfilerStorageInterface. - * - * @author Fabien Potencier - */ -interface ProfilerStorageInterface -{ - /** - * Finds profiler tokens for the given criteria. - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * @param int|null $start The start date to search from - * @param int|null $end The end date to search to - * - * @return array An array of tokens - */ - public function find($ip, $url, $limit, $method, $start = null, $end = null); - - /** - * Reads data associated with the given token. - * - * The method returns false if the token does not exist in the storage. - * - * @param string $token A token - * - * @return Profile The profile associated with token - */ - public function read($token); - - /** - * Saves a Profile. - * - * @param Profile $profile A Profile instance - * - * @return bool Write operation successful - */ - public function write(Profile $profile); - - /** - * Purges all data from the database. - */ - public function purge(); -} diff --git a/vendor/symfony/http-kernel/README.md b/vendor/symfony/http-kernel/README.md deleted file mode 100644 index cc5e74b..0000000 --- a/vendor/symfony/http-kernel/README.md +++ /dev/null @@ -1,16 +0,0 @@ -HttpKernel Component -==================== - -The HttpKernel component provides a structured process for converting a Request -into a Response by making use of the EventDispatcher component. It's flexible -enough to create a full-stack framework (Symfony), a micro-framework (Silex) or -an advanced CMS system (Drupal). - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/http_kernel/index.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/http-kernel/TerminableInterface.php b/vendor/symfony/http-kernel/TerminableInterface.php deleted file mode 100644 index d55a15b..0000000 --- a/vendor/symfony/http-kernel/TerminableInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * Terminable extends the Kernel request/response cycle with dispatching a post - * response event after sending the response and before shutting down the kernel. - * - * @author Jordi Boggiano - * @author Pierre Minnieur - */ -interface TerminableInterface -{ - /** - * Terminates a request/response cycle. - * - * Should be called after sending the response and before shutting down the kernel. - * - * @param Request $request A Request instance - * @param Response $response A Response instance - */ - public function terminate(Request $request, Response $response); -} diff --git a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php b/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php deleted file mode 100644 index eeefcca..0000000 --- a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Bundle; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Bundle\Bundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand; - -class BundleTest extends TestCase -{ - public function testGetContainerExtension() - { - $bundle = new ExtensionPresentBundle(); - - $this->assertInstanceOf( - 'Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\DependencyInjection\ExtensionPresentExtension', - $bundle->getContainerExtension() - ); - } - - public function testRegisterCommands() - { - $cmd = new FooCommand(); - $app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock(); - $app->expects($this->once())->method('add')->with($this->equalTo($cmd)); - - $bundle = new ExtensionPresentBundle(); - $bundle->registerCommands($app); - - $bundle2 = new ExtensionAbsentBundle(); - - $this->assertNull($bundle2->registerCommands($app)); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface - */ - public function testGetContainerExtensionWithInvalidClass() - { - $bundle = new ExtensionNotValidBundle(); - $bundle->getContainerExtension(); - } - - public function testHttpKernelRegisterCommandsIgnoresCommandsThatAreRegisteredAsServices() - { - $container = new ContainerBuilder(); - $container->register('console.command.symfony_component_httpkernel_tests_fixtures_extensionpresentbundle_command_foocommand', 'Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand'); - - $application = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock(); - // add() is never called when the found command classes are already registered as services - $application->expects($this->never())->method('add'); - - $bundle = new ExtensionPresentBundle(); - $bundle->setContainer($container); - $bundle->registerCommands($application); - } - - public function testBundleNameIsGuessedFromClass() - { - $bundle = new GuessedNameBundle(); - - $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); - $this->assertSame('GuessedNameBundle', $bundle->getName()); - } - - public function testBundleNameCanBeExplicitlyProvided() - { - $bundle = new NamedBundle(); - - $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); - $this->assertSame('Symfony\Component\HttpKernel\Tests\Bundle', $bundle->getNamespace()); - $this->assertSame('ExplicitlyNamedBundle', $bundle->getName()); - } -} - -class NamedBundle extends Bundle -{ - public function __construct() - { - $this->name = 'ExplicitlyNamedBundle'; - } -} - -class GuessedNameBundle extends Bundle -{ -} diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php deleted file mode 100644 index 1bc8533..0000000 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\CacheClearer; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer; - -class ChainCacheClearerTest extends TestCase -{ - protected static $cacheDir; - - public static function setUpBeforeClass() - { - self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_clearer_dir'); - } - - public static function tearDownAfterClass() - { - @unlink(self::$cacheDir); - } - - public function testInjectClearersInConstructor() - { - $clearer = $this->getMockClearer(); - $clearer - ->expects($this->once()) - ->method('clear'); - - $chainClearer = new ChainCacheClearer(array($clearer)); - $chainClearer->clear(self::$cacheDir); - } - - public function testInjectClearerUsingAdd() - { - $clearer = $this->getMockClearer(); - $clearer - ->expects($this->once()) - ->method('clear'); - - $chainClearer = new ChainCacheClearer(); - $chainClearer->add($clearer); - $chainClearer->clear(self::$cacheDir); - } - - protected function getMockClearer() - { - return $this->getMockBuilder('Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface')->getMock(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php deleted file mode 100644 index a5d9b6e..0000000 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\CacheClearer; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; -use Psr\Cache\CacheItemPoolInterface; - -class Psr6CacheClearerTest extends TestCase -{ - public function testClearPoolsInjectedInConstructor() - { - $pool = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock(); - $pool - ->expects($this->once()) - ->method('clear'); - - (new Psr6CacheClearer(array('pool' => $pool)))->clear(''); - } - - public function testClearPool() - { - $pool = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock(); - $pool - ->expects($this->once()) - ->method('clear'); - - (new Psr6CacheClearer(array('pool' => $pool)))->clearPool('pool'); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Cache pool not found: unknown - */ - public function testClearPoolThrowsExceptionOnUnreferencedPool() - { - (new Psr6CacheClearer())->clearPool('unknown'); - } - - /** - * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer::addPool() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead. - */ - public function testClearPoolsInjectedByAdder() - { - $pool1 = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock(); - $pool1 - ->expects($this->once()) - ->method('clear'); - - $pool2 = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock(); - $pool2 - ->expects($this->once()) - ->method('clear'); - - $clearer = new Psr6CacheClearer(array('pool1' => $pool1)); - $clearer->addPool($pool2); - $clearer->clear(''); - } -} diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php deleted file mode 100644 index d07ade3..0000000 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\CacheWarmer; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate; - -class CacheWarmerAggregateTest extends TestCase -{ - protected static $cacheDir; - - public static function setUpBeforeClass() - { - self::$cacheDir = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir'); - } - - public static function tearDownAfterClass() - { - @unlink(self::$cacheDir); - } - - public function testInjectWarmersUsingConstructor() - { - $warmer = $this->getCacheWarmerMock(); - $warmer - ->expects($this->once()) - ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); - $aggregate->warmUp(self::$cacheDir); - } - - public function testInjectWarmersUsingAdd() - { - $warmer = $this->getCacheWarmerMock(); - $warmer - ->expects($this->once()) - ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(); - $aggregate->add($warmer); - $aggregate->warmUp(self::$cacheDir); - } - - public function testInjectWarmersUsingSetWarmers() - { - $warmer = $this->getCacheWarmerMock(); - $warmer - ->expects($this->once()) - ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(); - $aggregate->setWarmers(array($warmer)); - $aggregate->warmUp(self::$cacheDir); - } - - public function testWarmupDoesCallWarmupOnOptionalWarmersWhenEnableOptionalWarmersIsEnabled() - { - $warmer = $this->getCacheWarmerMock(); - $warmer - ->expects($this->never()) - ->method('isOptional'); - $warmer - ->expects($this->once()) - ->method('warmUp'); - - $aggregate = new CacheWarmerAggregate(array($warmer)); - $aggregate->enableOptionalWarmers(); - $aggregate->warmUp(self::$cacheDir); - } - - public function testWarmupDoesNotCallWarmupOnOptionalWarmersWhenEnableOptionalWarmersIsNotEnabled() - { - $warmer = $this->getCacheWarmerMock(); - $warmer - ->expects($this->once()) - ->method('isOptional') - ->will($this->returnValue(true)); - $warmer - ->expects($this->never()) - ->method('warmUp'); - - $aggregate = new CacheWarmerAggregate(array($warmer)); - $aggregate->warmUp(self::$cacheDir); - } - - protected function getCacheWarmerMock() - { - $warmer = $this->getMockBuilder('Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface') - ->disableOriginalConstructor() - ->getMock(); - - return $warmer; - } -} diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php deleted file mode 100644 index 05666cb..0000000 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\CacheWarmer; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmer; - -class CacheWarmerTest extends TestCase -{ - protected static $cacheFile; - - public static function setUpBeforeClass() - { - self::$cacheFile = tempnam(sys_get_temp_dir(), 'sf2_cache_warmer_dir'); - } - - public static function tearDownAfterClass() - { - @unlink(self::$cacheFile); - } - - public function testWriteCacheFileCreatesTheFile() - { - $warmer = new TestCacheWarmer(self::$cacheFile); - $warmer->warmUp(dirname(self::$cacheFile)); - - $this->assertFileExists(self::$cacheFile); - } - - /** - * @expectedException \RuntimeException - */ - public function testWriteNonWritableCacheFileThrowsARuntimeException() - { - $nonWritableFile = '/this/file/is/very/probably/not/writable'; - $warmer = new TestCacheWarmer($nonWritableFile); - $warmer->warmUp(dirname($nonWritableFile)); - } -} - -class TestCacheWarmer extends CacheWarmer -{ - protected $file; - - public function __construct($file) - { - $this->file = $file; - } - - public function warmUp($cacheDir) - { - $this->writeCacheFile($this->file, 'content'); - } - - public function isOptional() - { - return false; - } -} diff --git a/vendor/symfony/http-kernel/Tests/ClientTest.php b/vendor/symfony/http-kernel/Tests/ClientTest.php deleted file mode 100644 index 1ac72c7..0000000 --- a/vendor/symfony/http-kernel/Tests/ClientTest.php +++ /dev/null @@ -1,183 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpKernel\Tests\Fixtures\TestClient; - -/** - * @group time-sensitive - */ -class ClientTest extends TestCase -{ - public function testDoRequest() - { - $client = new Client(new TestHttpKernel()); - - $client->request('GET', '/'); - $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request'); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Request', $client->getRequest()); - $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getInternalResponse()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $client->getResponse()); - - $client->request('GET', 'http://www.example.com/'); - $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request'); - $this->assertEquals('www.example.com', $client->getRequest()->getHost(), '->doRequest() uses the request handler to make the request'); - - $client->request('GET', 'http://www.example.com/?parameter=http://google.com'); - $this->assertEquals('http://www.example.com/?parameter='.urlencode('http://google.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request'); - } - - public function testGetScript() - { - $client = new TestClient(new TestHttpKernel()); - $client->insulate(); - $client->request('GET', '/'); - - $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->getScript() returns a script that uses the request handler to make the request'); - } - - public function testFilterResponseConvertsCookies() - { - $client = new Client(new TestHttpKernel()); - - $r = new \ReflectionObject($client); - $m = $r->getMethod('filterResponse'); - $m->setAccessible(true); - - $expected = array( - 'foo=bar; expires=Sun, 15-Feb-2009 20:00:00 GMT; max-age='.(strtotime('Sun, 15-Feb-2009 20:00:00 GMT') - time()).'; path=/foo; domain=http://example.com; secure; httponly', - 'foo1=bar1; expires=Sun, 15-Feb-2009 20:00:00 GMT; max-age='.(strtotime('Sun, 15-Feb-2009 20:00:00 GMT') - time()).'; path=/foo; domain=http://example.com; secure; httponly', - ); - - $response = new Response(); - $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true)); - $domResponse = $m->invoke($client, $response); - $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie')); - - $response = new Response(); - $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true)); - $response->headers->setCookie(new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true)); - $domResponse = $m->invoke($client, $response); - $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie')); - $this->assertEquals($expected, $domResponse->getHeader('Set-Cookie', false)); - } - - public function testFilterResponseSupportsStreamedResponses() - { - $client = new Client(new TestHttpKernel()); - - $r = new \ReflectionObject($client); - $m = $r->getMethod('filterResponse'); - $m->setAccessible(true); - - $response = new StreamedResponse(function () { - echo 'foo'; - }); - - $domResponse = $m->invoke($client, $response); - $this->assertEquals('foo', $domResponse->getContent()); - } - - public function testUploadedFile() - { - $source = tempnam(sys_get_temp_dir(), 'source'); - $target = sys_get_temp_dir().'/sf.moved.file'; - @unlink($target); - - $kernel = new TestHttpKernel(); - $client = new Client($kernel); - - $files = array( - array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 123, 'error' => UPLOAD_ERR_OK), - new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true), - ); - - $file = null; - foreach ($files as $file) { - $client->request('POST', '/', array(), array('foo' => $file)); - - $files = $client->getRequest()->files->all(); - - $this->assertCount(1, $files); - - $file = $files['foo']; - - $this->assertEquals('original', $file->getClientOriginalName()); - $this->assertEquals('mime/original', $file->getClientMimeType()); - $this->assertEquals('123', $file->getClientSize()); - $this->assertTrue($file->isValid()); - } - - $file->move(dirname($target), basename($target)); - - $this->assertFileExists($target); - unlink($target); - } - - public function testUploadedFileWhenNoFileSelected() - { - $kernel = new TestHttpKernel(); - $client = new Client($kernel); - - $file = array('tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE); - - $client->request('POST', '/', array(), array('foo' => $file)); - - $files = $client->getRequest()->files->all(); - - $this->assertCount(1, $files); - $this->assertNull($files['foo']); - } - - public function testUploadedFileWhenSizeExceedsUploadMaxFileSize() - { - $source = tempnam(sys_get_temp_dir(), 'source'); - - $kernel = new TestHttpKernel(); - $client = new Client($kernel); - - $file = $this - ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->setConstructorArgs(array($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true)) - ->setMethods(array('getSize')) - ->getMock() - ; - - $file->expects($this->once()) - ->method('getSize') - ->will($this->returnValue(INF)) - ; - - $client->request('POST', '/', array(), array($file)); - - $files = $client->getRequest()->files->all(); - - $this->assertCount(1, $files); - - $file = $files[0]; - - $this->assertFalse($file->isValid()); - $this->assertEquals(UPLOAD_ERR_INI_SIZE, $file->getError()); - $this->assertEquals('mime/original', $file->getClientMimeType()); - $this->assertEquals('original', $file->getClientOriginalName()); - $this->assertEquals(0, $file->getClientSize()); - - unlink($source); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php b/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php deleted file mode 100644 index 6fe8a67..0000000 --- a/vendor/symfony/http-kernel/Tests/Config/EnvParametersResourceTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Config; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Config\EnvParametersResource; - -class EnvParametersResourceTest extends TestCase -{ - protected $prefix = '__DUMMY_'; - protected $initialEnv; - protected $resource; - - protected function setUp() - { - $this->initialEnv = array( - $this->prefix.'1' => 'foo', - $this->prefix.'2' => 'bar', - ); - - foreach ($this->initialEnv as $key => $value) { - $_SERVER[$key] = $value; - } - - $this->resource = new EnvParametersResource($this->prefix); - } - - protected function tearDown() - { - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, $this->prefix)) { - unset($_SERVER[$key]); - } - } - } - - public function testGetResource() - { - $this->assertSame( - array('prefix' => $this->prefix, 'variables' => $this->initialEnv), - $this->resource->getResource(), - '->getResource() returns the resource' - ); - } - - public function testToString() - { - $this->assertSame( - serialize(array('prefix' => $this->prefix, 'variables' => $this->initialEnv)), - (string) $this->resource - ); - } - - public function testIsFreshNotChanged() - { - $this->assertTrue( - $this->resource->isFresh(time()), - '->isFresh() returns true if the variables have not changed' - ); - } - - public function testIsFreshValueChanged() - { - reset($this->initialEnv); - $_SERVER[key($this->initialEnv)] = 'baz'; - - $this->assertFalse( - $this->resource->isFresh(time()), - '->isFresh() returns false if a variable has been changed' - ); - } - - public function testIsFreshValueRemoved() - { - reset($this->initialEnv); - unset($_SERVER[key($this->initialEnv)]); - - $this->assertFalse( - $this->resource->isFresh(time()), - '->isFresh() returns false if a variable has been removed' - ); - } - - public function testIsFreshValueAdded() - { - $_SERVER[$this->prefix.'3'] = 'foo'; - - $this->assertFalse( - $this->resource->isFresh(time()), - '->isFresh() returns false if a variable has been added' - ); - } - - public function testSerializeUnserialize() - { - $this->assertEquals($this->resource, unserialize(serialize($this->resource))); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php b/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php deleted file mode 100644 index 6265f02..0000000 --- a/vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Config; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Config\FileLocator; - -class FileLocatorTest extends TestCase -{ - public function testLocate() - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock(); - $kernel - ->expects($this->atLeastOnce()) - ->method('locateResource') - ->with('@BundleName/some/path', null, true) - ->will($this->returnValue('/bundle-name/some/path')); - $locator = new FileLocator($kernel); - $this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path')); - - $kernel - ->expects($this->never()) - ->method('locateResource'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException'); - $locator->locate('/some/path'); - } - - public function testLocateWithGlobalResourcePath() - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock(); - $kernel - ->expects($this->atLeastOnce()) - ->method('locateResource') - ->with('@BundleName/some/path', '/global/resource/path', false); - - $locator = new FileLocator($kernel, '/global/resource/path'); - $locator->locate('@BundleName/some/path', null, false); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php deleted file mode 100644 index 0804139..0000000 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php +++ /dev/null @@ -1,349 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Controller; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingRequest; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingSession; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController; -use Symfony\Component\HttpFoundation\Request; - -class ArgumentResolverTest extends TestCase -{ - /** @var ArgumentResolver */ - private static $resolver; - - public static function setUpBeforeClass() - { - $factory = new ArgumentMetadataFactory(); - - self::$resolver = new ArgumentResolver($factory); - } - - public function testDefaultState() - { - $this->assertEquals(self::$resolver, new ArgumentResolver()); - $this->assertNotEquals(self::$resolver, new ArgumentResolver(null, array(new RequestAttributeValueResolver()))); - } - - public function testGetArguments() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFoo'); - - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); - } - - public function testGetArgumentsReturnsEmptyArrayWhenNoArguments() - { - $request = Request::create('/'); - $controller = array(new self(), 'controllerWithoutArguments'); - - $this->assertEquals(array(), self::$resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); - } - - public function testGetArgumentsUsesDefaultValue() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); - - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); - } - - public function testGetArgumentsOverrideDefaultValueByRequestAttribute() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', 'bar'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); - - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); - } - - public function testGetArgumentsFromClosure() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = function ($foo) {}; - - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller)); - } - - public function testGetArgumentsUsesDefaultValueFromClosure() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = function ($foo, $bar = 'bar') {}; - - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); - } - - public function testGetArgumentsFromInvokableObject() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = new self(); - - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller)); - - // Test default bar overridden by request attribute - $request->attributes->set('bar', 'bar'); - - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); - } - - public function testGetArgumentsFromFunctionName() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('foobar', 'foobar'); - $controller = __NAMESPACE__.'\controller_function'; - - $this->assertEquals(array('foo', 'foobar'), self::$resolver->getArguments($request, $controller)); - } - - public function testGetArgumentsFailsOnUnresolvedValue() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('foobar', 'foobar'); - $controller = array(new self(), 'controllerWithFooBarFoobar'); - - try { - self::$resolver->getArguments($request, $controller); - $this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } catch (\Exception $e) { - $this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } - } - - public function testGetArgumentsInjectsRequest() - { - $request = Request::create('/'); - $controller = array(new self(), 'controllerWithRequest'); - - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request'); - } - - public function testGetArgumentsInjectsExtendingRequest() - { - $request = ExtendingRequest::create('/'); - $controller = array(new self(), 'controllerWithExtendingRequest'); - - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request when extended'); - } - - /** - * @requires PHP 5.6 - */ - public function testGetVariadicArguments() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', array('foo', 'bar')); - $controller = array(new VariadicController(), 'action'); - - $this->assertEquals(array('foo', 'foo', 'bar'), self::$resolver->getArguments($request, $controller)); - } - - /** - * @requires PHP 5.6 - * @expectedException \InvalidArgumentException - */ - public function testGetVariadicArgumentsWithoutArrayInRequest() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', 'foo'); - $controller = array(new VariadicController(), 'action'); - - self::$resolver->getArguments($request, $controller); - } - - /** - * @requires PHP 5.6 - * @expectedException \InvalidArgumentException - */ - public function testGetArgumentWithoutArray() - { - $factory = new ArgumentMetadataFactory(); - $valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock(); - $resolver = new ArgumentResolver($factory, array($valueResolver)); - - $valueResolver->expects($this->any())->method('supports')->willReturn(true); - $valueResolver->expects($this->any())->method('resolve')->willReturn('foo'); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', 'foo'); - $controller = array($this, 'controllerWithFooAndDefaultBar'); - $resolver->getArguments($request, $controller); - } - - /** - * @expectedException \RuntimeException - */ - public function testIfExceptionIsThrownWhenMissingAnArgument() - { - $request = Request::create('/'); - $controller = array($this, 'controllerWithFoo'); - - self::$resolver->getArguments($request, $controller); - } - - /** - * @requires PHP 7.1 - */ - public function testGetNullableArguments() - { - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', new \stdClass()); - $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - - $this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); - } - - /** - * @requires PHP 7.1 - */ - public function testGetNullableArgumentsWithDefaults() - { - $request = Request::create('/'); - $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - - $this->assertEquals(array(null, null, 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); - } - - public function testGetSessionArguments() - { - $session = new Session(new MockArraySessionStorage()); - $request = Request::create('/'); - $request->setSession($session); - $controller = array($this, 'controllerWithSession'); - - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); - } - - public function testGetSessionArgumentsWithExtendedSession() - { - $session = new ExtendingSession(new MockArraySessionStorage()); - $request = Request::create('/'); - $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); - - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); - } - - public function testGetSessionArgumentsWithInterface() - { - $session = $this->getMockBuilder(SessionInterface::class)->getMock(); - $request = Request::create('/'); - $request->setSession($session); - $controller = array($this, 'controllerWithSessionInterface'); - - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetSessionMissMatchWithInterface() - { - $session = $this->getMockBuilder(SessionInterface::class)->getMock(); - $request = Request::create('/'); - $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); - - self::$resolver->getArguments($request, $controller); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetSessionMissMatchWithImplementation() - { - $session = new Session(new MockArraySessionStorage()); - $request = Request::create('/'); - $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); - - self::$resolver->getArguments($request, $controller); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetSessionMissMatchOnNull() - { - $request = Request::create('/'); - $controller = array($this, 'controllerWithExtendingSession'); - - self::$resolver->getArguments($request, $controller); - } - - public function __invoke($foo, $bar = null) - { - } - - public function controllerWithFoo($foo) - { - } - - public function controllerWithoutArguments() - { - } - - protected function controllerWithFooAndDefaultBar($foo, $bar = null) - { - } - - protected function controllerWithFooBarFoobar($foo, $bar, $foobar) - { - } - - protected function controllerWithRequest(Request $request) - { - } - - protected function controllerWithExtendingRequest(ExtendingRequest $request) - { - } - - protected function controllerWithSession(Session $session) - { - } - - protected function controllerWithSessionInterface(SessionInterface $session) - { - } - - protected function controllerWithExtendingSession(ExtendingSession $session) - { - } -} - -function controller_function($foo, $foobar) -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php deleted file mode 100644 index b3deb03..0000000 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ /dev/null @@ -1,198 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Controller; - -use Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver; - -class ContainerControllerResolverTest extends ControllerResolverTest -{ - public function testGetControllerService() - { - $container = $this->createMockContainer(); - $container->expects($this->once()) - ->method('get') - ->with('foo') - ->will($this->returnValue($this)) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', 'foo:controllerMethod1'); - - $controller = $resolver->getController($request); - - $this->assertInstanceOf(get_class($this), $controller[0]); - $this->assertSame('controllerMethod1', $controller[1]); - } - - public function testGetControllerInvokableService() - { - $invokableController = new InvokableController('bar'); - - $container = $this->createMockContainer(); - $container->expects($this->once()) - ->method('has') - ->with('foo') - ->will($this->returnValue(true)) - ; - $container->expects($this->once()) - ->method('get') - ->with('foo') - ->will($this->returnValue($invokableController)) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', 'foo'); - - $controller = $resolver->getController($request); - - $this->assertEquals($invokableController, $controller); - } - - public function testGetControllerInvokableServiceWithClassNameAsName() - { - $invokableController = new InvokableController('bar'); - $className = __NAMESPACE__.'\InvokableController'; - - $container = $this->createMockContainer(); - $container->expects($this->once()) - ->method('has') - ->with($className) - ->will($this->returnValue(true)) - ; - $container->expects($this->once()) - ->method('get') - ->with($className) - ->will($this->returnValue($invokableController)) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', $className); - - $controller = $resolver->getController($request); - - $this->assertEquals($invokableController, $controller); - } - - public function testNonInstantiableController() - { - $container = $this->createMockContainer(); - $container->expects($this->once()) - ->method('has') - ->with(NonInstantiableController::class) - ->will($this->returnValue(false)) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', array(NonInstantiableController::class, 'action')); - - $controller = $resolver->getController($request); - - $this->assertSame(array(NonInstantiableController::class, 'action'), $controller); - } - - public function testNonInstantiableControllerWithCorrespondingService() - { - $service = new \stdClass(); - - $container = $this->createMockContainer(); - $container->expects($this->atLeastOnce()) - ->method('has') - ->with(NonInstantiableController::class) - ->will($this->returnValue(true)) - ; - $container->expects($this->atLeastOnce()) - ->method('get') - ->with(NonInstantiableController::class) - ->will($this->returnValue($service)) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', array(NonInstantiableController::class, 'action')); - - $controller = $resolver->getController($request); - - $this->assertSame(array($service, 'action'), $controller); - } - - /** - * @dataProvider getUndefinedControllers - */ - public function testGetControllerOnNonUndefinedFunction($controller, $exceptionName = null, $exceptionMessage = null) - { - // All this logic needs to be duplicated, since calling parent::testGetControllerOnNonUndefinedFunction will override the expected excetion and not use the regex - $resolver = $this->createControllerResolver(); - if (method_exists($this, 'expectException')) { - $this->expectException($exceptionName); - $this->expectExceptionMessageRegExp($exceptionMessage); - } else { - $this->setExpectedExceptionRegExp($exceptionName, $exceptionMessage); - } - - $request = Request::create('/'); - $request->attributes->set('_controller', $controller); - $resolver->getController($request); - } - - public function getUndefinedControllers() - { - return array( - array('foo', \LogicException::class, '/Unable to parse the controller name "foo"\./'), - array('oof::bar', \InvalidArgumentException::class, '/Class "oof" does not exist\./'), - array('stdClass', \LogicException::class, '/Unable to parse the controller name "stdClass"\./'), - array( - 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar', - \InvalidArgumentException::class, - '/.?[cC]ontroller(.*?) for URI "\/" is not callable\.( Expected method(.*) Available methods)?/', - ), - ); - } - - protected function createControllerResolver(LoggerInterface $logger = null, ContainerInterface $container = null) - { - if (!$container) { - $container = $this->createMockContainer(); - } - - return new ContainerControllerResolver($container, $logger); - } - - protected function createMockContainer() - { - return $this->getMockBuilder(ContainerInterface::class)->getMock(); - } -} - -class InvokableController -{ - public function __construct($bar) // mandatory argument to prevent automatic instantiation - { - } - - public function __invoke() - { - } -} - -abstract class NonInstantiableController -{ - public static function action() - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php deleted file mode 100644 index 190e15a..0000000 --- a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php +++ /dev/null @@ -1,331 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Controller; - -use PHPUnit\Framework\TestCase; -use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Controller\ControllerResolver; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController; -use Symfony\Component\HttpFoundation\Request; - -class ControllerResolverTest extends TestCase -{ - public function testGetControllerWithoutControllerParameter() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger->expects($this->once())->method('warning')->with('Unable to look for the controller as the "_controller" parameter is missing.'); - $resolver = $this->createControllerResolver($logger); - - $request = Request::create('/'); - $this->assertFalse($resolver->getController($request), '->getController() returns false when the request has no _controller attribute'); - } - - public function testGetControllerWithLambda() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', $lambda = function () {}); - $controller = $resolver->getController($request); - $this->assertSame($lambda, $controller); - } - - public function testGetControllerWithObjectAndInvokeMethod() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', $this); - $controller = $resolver->getController($request); - $this->assertSame($this, $controller); - } - - public function testGetControllerWithObjectAndMethod() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', array($this, 'controllerMethod1')); - $controller = $resolver->getController($request); - $this->assertSame(array($this, 'controllerMethod1'), $controller); - } - - public function testGetControllerWithClassAndMethod() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4')); - $controller = $resolver->getController($request); - $this->assertSame(array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4'), $controller); - } - - public function testGetControllerWithObjectAndMethodAsString() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::controllerMethod1'); - $controller = $resolver->getController($request); - $this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', $controller[0], '->getController() returns a PHP callable'); - } - - public function testGetControllerWithClassAndInvokeMethod() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest'); - $controller = $resolver->getController($request); - $this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', $controller); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testGetControllerOnObjectWithoutInvokeMethod() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', new \stdClass()); - $resolver->getController($request); - } - - public function testGetControllerWithFunction() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\some_controller_function'); - $controller = $resolver->getController($request); - $this->assertSame('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function', $controller); - } - - /** - * @dataProvider getUndefinedControllers - */ - public function testGetControllerOnNonUndefinedFunction($controller, $exceptionName = null, $exceptionMessage = null) - { - $resolver = $this->createControllerResolver(); - if (method_exists($this, 'expectException')) { - $this->expectException($exceptionName); - $this->expectExceptionMessage($exceptionMessage); - } else { - $this->setExpectedException($exceptionName, $exceptionMessage); - } - - $request = Request::create('/'); - $request->attributes->set('_controller', $controller); - $resolver->getController($request); - } - - public function getUndefinedControllers() - { - return array( - array(1, 'InvalidArgumentException', 'Unable to find controller "1".'), - array('foo', 'InvalidArgumentException', 'Unable to find controller "foo".'), - array('oof::bar', 'InvalidArgumentException', 'Class "oof" does not exist.'), - array('stdClass', 'InvalidArgumentException', 'Unable to find controller "stdClass".'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', 'InvalidArgumentException', 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'), - ); - } - - /** - * @group legacy - */ - public function testGetArguments() - { - $resolver = $this->createControllerResolver(); - - $request = Request::create('/'); - $controller = array(new self(), 'testGetArguments'); - $this->assertEquals(array(), $resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerMethod1'); - $this->assertEquals(array('foo'), $resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerMethod2'); - $this->assertEquals(array('foo', null), $resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); - - $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = function ($foo) {}; - $this->assertEquals(array('foo'), $resolver->getArguments($request, $controller)); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = function ($foo, $bar = 'bar') {}; - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller)); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $controller = new self(); - $this->assertEquals(array('foo', null), $resolver->getArguments($request, $controller)); - $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), $resolver->getArguments($request, $controller)); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('foobar', 'foobar'); - $controller = 'Symfony\Component\HttpKernel\Tests\Controller\some_controller_function'; - $this->assertEquals(array('foo', 'foobar'), $resolver->getArguments($request, $controller)); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('foobar', 'foobar'); - $controller = array(new self(), 'controllerMethod3'); - - try { - $resolver->getArguments($request, $controller); - $this->fail('->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } catch (\Exception $e) { - $this->assertInstanceOf('\RuntimeException', $e, '->getArguments() throws a \RuntimeException exception if it cannot determine the argument value'); - } - - $request = Request::create('/'); - $controller = array(new self(), 'controllerMethod5'); - $this->assertEquals(array($request), $resolver->getArguments($request, $controller), '->getArguments() injects the request'); - } - - /** - * @requires PHP 5.6 - * @group legacy - */ - public function testGetVariadicArguments() - { - $resolver = new ControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', array('foo', 'bar')); - $controller = array(new VariadicController(), 'action'); - $this->assertEquals(array('foo', 'foo', 'bar'), $resolver->getArguments($request, $controller)); - } - - public function testCreateControllerCanReturnAnyCallable() - { - $mock = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolver')->setMethods(array('createController'))->getMock(); - $mock->expects($this->once())->method('createController')->will($this->returnValue('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function')); - - $request = Request::create('/'); - $request->attributes->set('_controller', 'foobar'); - $mock->getController($request); - } - - /** - * @expectedException \RuntimeException - * @group legacy - */ - public function testIfExceptionIsThrownWhenMissingAnArgument() - { - $resolver = new ControllerResolver(); - $request = Request::create('/'); - - $controller = array($this, 'controllerMethod1'); - - $resolver->getArguments($request, $controller); - } - - /** - * @requires PHP 7.1 - * @group legacy - */ - public function testGetNullableArguments() - { - $resolver = new ControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', new \stdClass()); - $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - $this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), $resolver->getArguments($request, $controller)); - } - - /** - * @requires PHP 7.1 - * @group legacy - */ - public function testGetNullableArgumentsWithDefaults() - { - $resolver = new ControllerResolver(); - - $request = Request::create('/'); - $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); - $this->assertEquals(array(null, null, 'value', 'mandatory'), $resolver->getArguments($request, $controller)); - } - - protected function createControllerResolver(LoggerInterface $logger = null) - { - return new ControllerResolver($logger); - } - - public function __invoke($foo, $bar = null) - { - } - - public function controllerMethod1($foo) - { - } - - protected function controllerMethod2($foo, $bar = null) - { - } - - protected function controllerMethod3($foo, $bar, $foobar) - { - } - - protected static function controllerMethod4() - { - } - - protected function controllerMethod5(Request $request) - { - } -} - -function some_controller_function($foo, $foobar) -{ -} - -class ControllerTest -{ - public function publicAction() - { - } - - private function privateAction() - { - } - - protected function protectedAction() - { - } - - public static function staticAction() - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php deleted file mode 100644 index b4b449f..0000000 --- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata; - -use Fake\ImportedAndFake; -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\BasicTypesController; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController; -use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController; - -class ArgumentMetadataFactoryTest extends TestCase -{ - /** - * @var ArgumentMetadataFactory - */ - private $factory; - - protected function setUp() - { - $this->factory = new ArgumentMetadataFactory(); - } - - public function testSignature1() - { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature1')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', self::class, false, false, null), - new ArgumentMetadata('bar', 'array', false, false, null), - new ArgumentMetadata('baz', 'callable', false, false, null), - ), $arguments); - } - - public function testSignature2() - { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature2')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', self::class, false, true, null, true), - new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, true, null, true), - new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, true, null, true), - ), $arguments); - } - - public function testSignature3() - { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature3')); - - $this->assertEquals(array( - new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, false, null), - new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, false, null), - ), $arguments); - } - - public function testSignature4() - { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature4')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', null, false, true, 'default'), - new ArgumentMetadata('bar', null, false, true, 500), - new ArgumentMetadata('baz', null, false, true, array()), - ), $arguments); - } - - public function testSignature5() - { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature5')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', 'array', false, true, null, true), - new ArgumentMetadata('bar', null, false, false, null), - ), $arguments); - } - - /** - * @requires PHP 5.6 - */ - public function testVariadicSignature() - { - $arguments = $this->factory->createArgumentMetadata(array(new VariadicController(), 'action')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', null, false, false, null), - new ArgumentMetadata('bar', null, true, false, null), - ), $arguments); - } - - /** - * @requires PHP 7.0 - */ - public function testBasicTypesSignature() - { - $arguments = $this->factory->createArgumentMetadata(array(new BasicTypesController(), 'action')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', 'string', false, false, null), - new ArgumentMetadata('bar', 'int', false, false, null), - new ArgumentMetadata('baz', 'float', false, false, null), - ), $arguments); - } - - /** - * @requires PHP 7.1 - */ - public function testNullableTypesSignature() - { - $arguments = $this->factory->createArgumentMetadata(array(new NullableController(), 'action')); - - $this->assertEquals(array( - new ArgumentMetadata('foo', 'string', false, false, null, true), - new ArgumentMetadata('bar', \stdClass::class, false, false, null, true), - new ArgumentMetadata('baz', 'string', false, true, 'value', true), - new ArgumentMetadata('mandatory', null, false, false, null, true), - ), $arguments); - } - - private function signature1(ArgumentMetadataFactoryTest $foo, array $bar, callable $baz) - { - } - - private function signature2(ArgumentMetadataFactoryTest $foo = null, FakeClassThatDoesNotExist $bar = null, ImportedAndFake $baz = null) - { - } - - private function signature3(FakeClassThatDoesNotExist $bar, ImportedAndFake $baz) - { - } - - private function signature4($foo = 'default', $bar = 500, $baz = array()) - { - } - - private function signature5(array $foo = null, $bar) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataTest.php deleted file mode 100644 index 0535144..0000000 --- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataTest.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\ControllerMetadata; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -class ArgumentMetadataTest extends TestCase -{ - public function testWithBcLayerWithDefault() - { - $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value'); - - $this->assertFalse($argument->isNullable()); - } - - public function testDefaultValueAvailable() - { - $argument = new ArgumentMetadata('foo', 'string', false, true, 'default value', true); - - $this->assertTrue($argument->isNullable()); - $this->assertTrue($argument->hasDefaultValue()); - $this->assertSame('default value', $argument->getDefaultValue()); - } - - /** - * @expectedException \LogicException - */ - public function testDefaultValueUnavailable() - { - $argument = new ArgumentMetadata('foo', 'string', false, false, null, false); - - $this->assertFalse($argument->isNullable()); - $this->assertFalse($argument->hasDefaultValue()); - $argument->getDefaultValue(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/Compiler.log b/vendor/symfony/http-kernel/Tests/DataCollector/Compiler.log deleted file mode 100644 index 88b6840..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/Compiler.log +++ /dev/null @@ -1,4 +0,0 @@ -Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass: Removed service "Psr\Container\ContainerInterface"; reason: private alias. -Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass: Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias. -Some custom logging message -With ending : diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php deleted file mode 100644 index 4fb36af..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class ConfigDataCollectorTest extends TestCase -{ - public function testCollect() - { - $kernel = new KernelForTest('test', true); - $c = new ConfigDataCollector(); - $c->setKernel($kernel); - $c->collect(new Request(), new Response()); - - $this->assertSame('test', $c->getEnv()); - $this->assertTrue($c->isDebug()); - $this->assertSame('config', $c->getName()); - $this->assertSame('testkernel', $c->getAppName()); - $this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION); - $this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION); - $this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture()); - $this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale()); - $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); - $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); - $this->assertNull($c->getToken()); - $this->assertSame(extension_loaded('xdebug'), $c->hasXDebug()); - $this->assertSame(extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache()); - $this->assertSame(extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu()); - } -} - -class KernelForTest extends Kernel -{ - public function getName() - { - return 'testkernel'; - } - - public function registerBundles() - { - } - - public function getBundles() - { - return array(); - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php deleted file mode 100644 index 54fd39e..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Tests\Fixtures\DataCollector\CloneVarDataCollector; -use Symfony\Component\VarDumper\Cloner\VarCloner; - -class DataCollectorTest extends TestCase -{ - public function testCloneVarStringWithScheme() - { - $c = new CloneVarDataCollector('scheme://foo'); - $c->collect(new Request(), new Response()); - $cloner = new VarCloner(); - - $this->assertEquals($cloner->cloneVar('scheme://foo'), $c->getData()); - } - - public function testCloneVarExistingFilePath() - { - $c = new CloneVarDataCollector(array($filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_'))); - $c->collect(new Request(), new Response()); - - $this->assertSame($filePath, $c->getData()[0]); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php deleted file mode 100644 index e642e3c..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\VarDumper\Cloner\Data; - -/** - * @author Nicolas Grekas - */ -class DumpDataCollectorTest extends TestCase -{ - public function testDump() - { - $data = new Data(array(array(123))); - - $collector = new DumpDataCollector(); - - $this->assertSame('dump', $collector->getName()); - - $collector->dump($data); - $line = __LINE__ - 1; - $this->assertSame(1, $collector->getDumpsCount()); - - $dump = $collector->getDumps('html'); - $this->assertTrue(isset($dump[0]['data'])); - $dump[0]['data'] = preg_replace('/^.*?
     "
    123\n
    \n", - 'name' => 'DumpDataCollectorTest.php', - 'file' => __FILE__, - 'line' => $line, - 'fileExcerpt' => false, - ), - ); - $this->assertEquals($xDump, $dump); - - $this->assertStringMatchesFormat('a:3:{i:0;a:5:{s:4:"data";%c:39:"Symfony\Component\VarDumper\Cloner\Data":%a', $collector->serialize()); - $this->assertSame(0, $collector->getDumpsCount()); - $this->assertSame('a:2:{i:0;b:0;i:1;s:5:"UTF-8";}', $collector->serialize()); - } - - public function testCollectDefault() - { - $data = new Data(array(array(123))); - - $collector = new DumpDataCollector(); - - $collector->dump($data); - $line = __LINE__ - 1; - - ob_start(); - $collector->collect(new Request(), new Response()); - $output = ob_get_clean(); - - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); - $this->assertSame(1, $collector->getDumpsCount()); - $collector->serialize(); - } - - public function testCollectHtml() - { - $data = new Data(array(array(123))); - - $collector = new DumpDataCollector(null, 'test://%f:%l'); - - $collector->dump($data); - $line = __LINE__ - 1; - $file = __FILE__; - $xOutput = <<DumpDataCollectorTest.php on line {$line}: -123 -
    -EOTXT; - - ob_start(); - $response = new Response(); - $response->headers->set('Content-Type', 'text/html'); - $collector->collect(new Request(), $response); - $output = ob_get_clean(); - $output = preg_replace('#<(script|style).*?#s', '', $output); - $output = preg_replace('/sf-dump-\d+/', 'sf-dump', $output); - - $this->assertSame($xOutput, trim($output)); - $this->assertSame(1, $collector->getDumpsCount()); - $collector->serialize(); - } - - public function testFlush() - { - $data = new Data(array(array(456))); - $collector = new DumpDataCollector(); - $collector->dump($data); - $line = __LINE__ - 1; - - ob_start(); - $collector->__destruct(); - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php deleted file mode 100644 index afad9f5..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class ExceptionDataCollectorTest extends TestCase -{ - public function testCollect() - { - $e = new \Exception('foo', 500); - $c = new ExceptionDataCollector(); - $flattened = FlattenException::create($e); - $trace = $flattened->getTrace(); - - $this->assertFalse($c->hasException()); - - $c->collect(new Request(), new Response(), $e); - - $this->assertTrue($c->hasException()); - $this->assertEquals($flattened, $c->getException()); - $this->assertSame('foo', $c->getMessage()); - $this->assertSame(500, $c->getCode()); - $this->assertSame('exception', $c->getName()); - $this->assertSame($trace, $c->getTrace()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php deleted file mode 100644 index 62bf2c0..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\Exception\SilencedErrorContext; -use Symfony\Component\HttpKernel\DataCollector\LoggerDataCollector; - -class LoggerDataCollectorTest extends TestCase -{ - public function testCollectWithUnexpectedFormat() - { - $logger = $this->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue(array())); - - $c = new LoggerDataCollector($logger, __DIR__.'/'); - $c->lateCollect(); - $compilerLogs = $c->getCompilerLogs()->getValue('message'); - - $this->assertSame(array( - array('message' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias.'), - array('message' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.'), - ), $compilerLogs['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass']); - - $this->assertSame(array( - array('message' => 'Some custom logging message'), - array('message' => 'With ending :'), - ), $compilerLogs['Unknown Compiler Pass']); - } - - /** - * @dataProvider getCollectTestData - */ - public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount, $expectedScreamCount, $expectedPriorities = null) - { - $logger = $this->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface')->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); - - $c = new LoggerDataCollector($logger); - $c->lateCollect(); - - $this->assertEquals('logger', $c->getName()); - $this->assertEquals($nb, $c->countErrors()); - - $logs = array_map(function ($v) { - if (isset($v['context']['exception'])) { - $e = &$v['context']['exception']; - $e = isset($e["\0*\0message"]) ? array($e["\0*\0message"], $e["\0*\0severity"]) : array($e["\0Symfony\Component\Debug\Exception\SilencedErrorContext\0severity"]); - } - - return $v; - }, $c->getLogs()->getValue(true)); - $this->assertEquals($expectedLogs, $logs); - $this->assertEquals($expectedDeprecationCount, $c->countDeprecations()); - $this->assertEquals($expectedScreamCount, $c->countScreams()); - - if (isset($expectedPriorities)) { - $this->assertSame($expectedPriorities, $c->getPriorities()->getValue(true)); - } - } - - public function getCollectTestData() - { - yield 'simple log' => array( - 1, - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), - 0, - 0, - ); - - yield 'log with a context' => array( - 1, - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), - 0, - 0, - ); - - if (!class_exists(SilencedErrorContext::class)) { - return; - } - - yield 'logs with some deprecations' => array( - 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo2', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => array('deprecated', E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - array('message' => 'foo2', 'context' => array('exception' => array('deprecated', E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - ), - 2, - 0, - array(100 => array('count' => 3, 'name' => 'DEBUG')), - ); - - yield 'logs with some silent errors' => array( - 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => array(E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true), - ), - 0, - 1, - ); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php deleted file mode 100644 index ab78e9e..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class MemoryDataCollectorTest extends TestCase -{ - public function testCollect() - { - $collector = new MemoryDataCollector(); - $collector->collect(new Request(), new Response()); - - $this->assertInternalType('integer', $collector->getMemory()); - $this->assertInternalType('integer', $collector->getMemoryLimit()); - $this->assertSame('memory', $collector->getName()); - } - - /** @dataProvider getBytesConversionTestData */ - public function testBytesConversion($limit, $bytes) - { - $collector = new MemoryDataCollector(); - $method = new \ReflectionMethod($collector, 'convertToBytes'); - $method->setAccessible(true); - $this->assertEquals($bytes, $method->invoke($collector, $limit)); - } - - public function getBytesConversionTestData() - { - return array( - array('2k', 2048), - array('2 k', 2048), - array('8m', 8 * 1024 * 1024), - array('+2 k', 2048), - array('+2???k', 2048), - array('0x10', 16), - array('0xf', 15), - array('010', 8), - array('+0x10 k', 16 * 1024), - array('1g', 1024 * 1024 * 1024), - array('1G', 1024 * 1024 * 1024), - array('-1', -1), - array('0', 0), - array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm' - ); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php deleted file mode 100644 index 93767b9..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php +++ /dev/null @@ -1,287 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ParameterBag; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class RequestDataCollectorTest extends TestCase -{ - public function testCollect() - { - $c = new RequestDataCollector(); - - $c->collect($request = $this->createRequest(), $this->createResponse()); - $c->lateCollect(); - - $attributes = $c->getRequestAttributes(); - - $this->assertSame('request', $c->getName()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestHeaders()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestServer()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestCookies()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $attributes); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestRequest()); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery()); - $this->assertInstanceOf(ParameterBag::class, $c->getResponseCookies()); - $this->assertSame('html', $c->getFormat()); - $this->assertEquals('foobar', $c->getRoute()); - $this->assertEquals(array('name' => 'foo'), $c->getRouteParams()); - $this->assertSame(array(), $c->getSessionAttributes()); - $this->assertSame('en', $c->getLocale()); - $this->assertContains(__FILE__, $attributes->get('resource')); - $this->assertSame('stdClass', $attributes->get('object')->getType()); - - $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getResponseHeaders()); - $this->assertSame('OK', $c->getStatusText()); - $this->assertSame(200, $c->getStatusCode()); - $this->assertSame('application/json', $c->getContentType()); - } - - public function testCollectWithoutRouteParams() - { - $request = $this->createRequest(array()); - - $c = new RequestDataCollector(); - $c->collect($request, $this->createResponse()); - $c->lateCollect(); - - $this->assertEquals(array(), $c->getRouteParams()); - } - - public function testKernelResponseDoesNotStartSession() - { - $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); - $request = new Request(); - $session = new Session(new MockArraySessionStorage()); - $request->setSession($session); - $response = new Response(); - - $c = new RequestDataCollector(); - $c->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); - - $this->assertFalse($session->isStarted()); - } - - /** - * @dataProvider provideControllerCallables - */ - public function testControllerInspection($name, $callable, $expected) - { - $c = new RequestDataCollector(); - $request = $this->createRequest(); - $response = $this->createResponse(); - $this->injectController($c, $callable, $request); - $c->collect($request, $response); - $c->lateCollect(); - - $this->assertSame($expected, $c->getController()->getValue(true), sprintf('Testing: %s', $name)); - } - - public function provideControllerCallables() - { - // make sure we always match the line number - $r1 = new \ReflectionMethod($this, 'testControllerInspection'); - $r2 = new \ReflectionMethod($this, 'staticControllerMethod'); - $r3 = new \ReflectionClass($this); - - // test name, callable, expected - return array( - array( - '"Regular" callable', - array($this, 'testControllerInspection'), - array( - 'class' => __NAMESPACE__.'\RequestDataCollectorTest', - 'method' => 'testControllerInspection', - 'file' => __FILE__, - 'line' => $r1->getStartLine(), - ), - ), - - array( - 'Closure', - function () { return 'foo'; }, - array( - 'class' => __NAMESPACE__.'\{closure}', - 'method' => null, - 'file' => __FILE__, - 'line' => __LINE__ - 5, - ), - ), - - array( - 'Static callback as string', - __NAMESPACE__.'\RequestDataCollectorTest::staticControllerMethod', - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => 'staticControllerMethod', - 'file' => __FILE__, - 'line' => $r2->getStartLine(), - ), - ), - - array( - 'Static callable with instance', - array($this, 'staticControllerMethod'), - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => 'staticControllerMethod', - 'file' => __FILE__, - 'line' => $r2->getStartLine(), - ), - ), - - array( - 'Static callable with class name', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'staticControllerMethod'), - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => 'staticControllerMethod', - 'file' => __FILE__, - 'line' => $r2->getStartLine(), - ), - ), - - array( - 'Callable with instance depending on __call()', - array($this, 'magicMethod'), - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => 'magicMethod', - 'file' => 'n/a', - 'line' => 'n/a', - ), - ), - - array( - 'Callable with class name depending on __callStatic()', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'magicMethod'), - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => 'magicMethod', - 'file' => 'n/a', - 'line' => 'n/a', - ), - ), - - array( - 'Invokable controller', - $this, - array( - 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', - 'method' => null, - 'file' => __FILE__, - 'line' => $r3->getStartLine(), - ), - ), - ); - } - - public function testItIgnoresInvalidCallables() - { - $request = $this->createRequestWithSession(); - $response = new RedirectResponse('/'); - - $c = new RequestDataCollector(); - $c->collect($request, $response); - - $this->assertSame('n/a', $c->getController()); - } - - protected function createRequest($routeParams = array('name' => 'foo')) - { - $request = Request::create('http://test.com/foo?bar=baz'); - $request->attributes->set('foo', 'bar'); - $request->attributes->set('_route', 'foobar'); - $request->attributes->set('_route_params', $routeParams); - $request->attributes->set('resource', fopen(__FILE__, 'r')); - $request->attributes->set('object', new \stdClass()); - - return $request; - } - - private function createRequestWithSession() - { - $request = $this->createRequest(); - $request->attributes->set('_controller', 'Foo::bar'); - $request->setSession(new Session(new MockArraySessionStorage())); - $request->getSession()->start(); - - return $request; - } - - protected function createResponse() - { - $response = new Response(); - $response->setStatusCode(200); - $response->headers->set('Content-Type', 'application/json'); - $response->headers->set('X-Foo-Bar', null); - $response->headers->setCookie(new Cookie('foo', 'bar', 1, '/foo', 'localhost', true, true)); - $response->headers->setCookie(new Cookie('bar', 'foo', new \DateTime('@946684800'))); - $response->headers->setCookie(new Cookie('bazz', 'foo', '2000-12-12')); - - return $response; - } - - /** - * Inject the given controller callable into the data collector. - */ - protected function injectController($collector, $controller, $request) - { - $resolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface')->getMock(); - $httpKernel = new HttpKernel(new EventDispatcher(), $resolver, null, $this->getMockBuilder(ArgumentResolverInterface::class)->getMock()); - $event = new FilterControllerEvent($httpKernel, $controller, $request, HttpKernelInterface::MASTER_REQUEST); - $collector->onKernelController($event); - } - - /** - * Dummy method used as controller callable. - */ - public static function staticControllerMethod() - { - throw new \LogicException('Unexpected method call'); - } - - /** - * Magic method to allow non existing methods to be called and delegated. - */ - public function __call($method, $args) - { - throw new \LogicException('Unexpected method call'); - } - - /** - * Magic method to allow non existing methods to be called and delegated. - */ - public static function __callStatic($method, $args) - { - throw new \LogicException('Unexpected method call'); - } - - public function __invoke() - { - throw new \LogicException('Unexpected method call'); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php deleted file mode 100644 index 8048cc3..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * @group time-sensitive - */ -class TimeDataCollectorTest extends TestCase -{ - public function testCollect() - { - $c = new TimeDataCollector(); - - $request = new Request(); - $request->server->set('REQUEST_TIME', 1); - - $c->collect($request, new Response()); - - $this->assertEquals(0, $c->getStartTime()); - - $request->server->set('REQUEST_TIME_FLOAT', 2); - - $c->collect($request, new Response()); - - $this->assertEquals(2000, $c->getStartTime()); - - $request = new Request(); - $c->collect($request, new Response()); - $this->assertEquals(0, $c->getStartTime()); - - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock(); - $kernel->expects($this->once())->method('getStartTime')->will($this->returnValue(123456)); - - $c = new TimeDataCollector($kernel); - $request = new Request(); - $request->server->set('REQUEST_TIME', 1); - - $c->collect($request, new Response()); - $this->assertEquals(123456000, $c->getStartTime()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/Util/ValueExporterTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/Util/ValueExporterTest.php deleted file mode 100644 index 5fe92d6..0000000 --- a/vendor/symfony/http-kernel/Tests/DataCollector/Util/ValueExporterTest.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter; - -/** - * @group legacy - */ -class ValueExporterTest extends TestCase -{ - /** - * @var ValueExporter - */ - private $valueExporter; - - protected function setUp() - { - $this->valueExporter = new ValueExporter(); - } - - public function testDateTime() - { - $dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC')); - $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime)); - } - - public function testDateTimeImmutable() - { - $dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC')); - $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime)); - } - - public function testIncompleteClass() - { - $foo = new \__PHP_Incomplete_Class(); - $array = new \ArrayObject($foo); - $array['__PHP_Incomplete_Class_Name'] = 'AppBundle/Foo'; - $this->assertSame('__PHP_Incomplete_Class(AppBundle/Foo)', $this->valueExporter->exportValue($foo)); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php b/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php deleted file mode 100644 index d616098..0000000 --- a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Debug; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; - -class FileLinkFormatterTest extends TestCase -{ - public function testWhenNoFileLinkFormatAndNoRequest() - { - $sut = new FileLinkFormatter(); - - $this->assertFalse($sut->format('/kernel/root/src/my/very/best/file.php', 3)); - } - - public function testWhenFileLinkFormatAndNoRequest() - { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; - - $sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', new RequestStack()); - - $this->assertSame("debug://open?url=file://$file&line=3", $sut->format($file, 3)); - } - - public function testWhenFileLinkFormatAndRequest() - { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; - $baseDir = __DIR__; - $requestStack = new RequestStack(); - $request = new Request(); - $requestStack->push($request); - - $sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l'); - - $this->assertSame("debug://open?url=file://$file&line=3", $sut->format($file, 3)); - } - - public function testWhenNoFileLinkFormatAndRequest() - { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; - $requestStack = new RequestStack(); - $request = new Request(); - $requestStack->push($request); - - $request->server->set('SERVER_NAME', 'www.example.org'); - $request->server->set('SERVER_PORT', 80); - $request->server->set('SCRIPT_NAME', '/app.php'); - $request->server->set('SCRIPT_FILENAME', '/web/app.php'); - $request->server->set('REQUEST_URI', '/app.php/example'); - - $sut = new FileLinkFormatter(null, $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l'); - - $this->assertSame('http://www.example.org/app.php/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3)); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php deleted file mode 100644 index aaa82d5..0000000 --- a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Debug; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Stopwatch\Stopwatch; - -class TraceableEventDispatcherTest extends TestCase -{ - public function testStopwatchSections() - { - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch = new Stopwatch()); - $kernel = $this->getHttpKernel($dispatcher, function () { return new Response(); }); - $request = Request::create('/'); - $response = $kernel->handle($request); - $kernel->terminate($request, $response); - - $events = $stopwatch->getSectionEvents($response->headers->get('X-Debug-Token')); - $this->assertEquals(array( - '__section__', - 'kernel.request', - 'kernel.controller', - 'kernel.controller_arguments', - 'controller', - 'kernel.response', - 'kernel.terminate', - ), array_keys($events)); - } - - public function testStopwatchCheckControllerOnRequestEvent() - { - $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted')) - ->getMock(); - $stopwatch->expects($this->once()) - ->method('isStarted') - ->will($this->returnValue(false)); - - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch); - - $kernel = $this->getHttpKernel($dispatcher, function () { return new Response(); }); - $request = Request::create('/'); - $kernel->handle($request); - } - - public function testStopwatchStopControllerOnRequestEvent() - { - $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted', 'stop', 'stopSection')) - ->getMock(); - $stopwatch->expects($this->once()) - ->method('isStarted') - ->will($this->returnValue(true)); - $stopwatch->expects($this->once()) - ->method('stop'); - $stopwatch->expects($this->once()) - ->method('stopSection'); - - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch); - - $kernel = $this->getHttpKernel($dispatcher, function () { return new Response(); }); - $request = Request::create('/'); - $kernel->handle($request); - } - - public function testAddListenerNested() - { - $called1 = false; - $called2 = false; - $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $dispatcher->addListener('my-event', function () use ($dispatcher, &$called1, &$called2) { - $called1 = true; - $dispatcher->addListener('my-event', function () use (&$called2) { - $called2 = true; - }); - }); - $dispatcher->dispatch('my-event'); - $this->assertTrue($called1); - $this->assertFalse($called2); - $dispatcher->dispatch('my-event'); - $this->assertTrue($called2); - } - - public function testListenerCanRemoveItselfWhenExecuted() - { - $eventDispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $listener1 = function () use ($eventDispatcher, &$listener1) { - $eventDispatcher->removeListener('foo', $listener1); - }; - $eventDispatcher->addListener('foo', $listener1); - $eventDispatcher->addListener('foo', function () {}); - $eventDispatcher->dispatch('foo'); - - $this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed'); - } - - protected function getHttpKernel($dispatcher, $controller) - { - $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock(); - $controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller)); - $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock(); - $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue(array())); - - return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php deleted file mode 100644 index a2fb6af..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass; - -class AddAnnotatedClassesToCachePassTest extends TestCase -{ - public function testExpandClasses() - { - $r = new \ReflectionClass(AddAnnotatedClassesToCachePass::class); - $pass = $r->newInstanceWithoutConstructor(); - $r = new \ReflectionMethod(AddAnnotatedClassesToCachePass::class, 'expandClasses'); - $r->setAccessible(true); - $expand = $r->getClosure($pass); - - $this->assertSame('Foo', $expand(array('Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('Foo'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar\\Acme'))[0]); - - $this->assertSame('Foo\\Bar', $expand(array('Foo\\'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Bar\\Acme', $expand(array('Foo\\'), array('\\Foo\\Bar\\Acme'))[0]); - $this->assertEmpty($expand(array('Foo\\'), array('\\Foo'))); - - $this->assertSame('Acme\\Foo\\Bar', $expand(array('**\\Foo\\'), array('\\Acme\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo\\Bar'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Acme\\Foo'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo'))); - - $this->assertSame('Acme\\Foo', $expand(array('**\\Foo'), array('\\Acme\\Foo'))[0]); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\Foo\\AcmeBundle'))); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\FooBar\\AcmeBundle'))); - - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))); - - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); - - $this->assertSame('Acme\\Bar', $expand(array('*\\Bar'), array('\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Bar'))); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Foo\\Acme\\Bar'))); - - $this->assertSame('Foo\\Acme\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Bar'), array('\\Bar'))); - - $this->assertSame('Foo\\Bar', $expand(array('Foo\\*'), array('\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*'), array('\\Foo\\Acme\\Bar'))); - - $this->assertSame('Foo\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); - - $this->assertSame(array('Foo\\Bar'), $expand(array('Foo\\*'), array('Foo\\Bar', 'Foo\\BarTest'))); - $this->assertSame(array('Foo\\Bar', 'Foo\\BarTest'), $expand(array('Foo\\*', 'Foo\\*Test'), array('Foo\\Bar', 'Foo\\BarTest'))); - - $this->assertSame( - 'Acme\\FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\DefaultController'))[0] - ); - - $this->assertSame( - 'FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\FooBundle\\Controller\\DefaultController'))[0] - ); - - $this->assertSame( - 'Acme\\FooBundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\Bar\\DefaultController'))[0] - ); - - $this->assertSame( - 'Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Bundle\\Controller\\Bar\\DefaultController'))[0] - ); - - $this->assertSame( - 'Acme\\Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\Bundle\\Controller\\Bar\\DefaultController'))[0] - ); - - $this->assertSame('Foo\\Bar', $expand(array('Foo\\Bar'), array())[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php deleted file mode 100644 index df8977d..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass; - -class ControllerArgumentValueResolverPassTest extends TestCase -{ - public function testServicesAreOrderedAccordingToPriority() - { - $services = array( - 'n3' => array(array()), - 'n1' => array(array('priority' => 200)), - 'n2' => array(array('priority' => 100)), - ); - - $expected = array( - new Reference('n1'), - new Reference('n2'), - new Reference('n3'), - ); - - $definition = new Definition(ArgumentResolver::class, array(null, array())); - $container = new ContainerBuilder(); - $container->setDefinition('argument_resolver', $definition); - - foreach ($services as $id => list($tag)) { - $container->register($id)->addTag('controller.argument_value_resolver', $tag); - } - - (new ControllerArgumentValueResolverPass())->process($container); - $this->assertEquals($expected, $definition->getArgument(1)->getValues()); - } - - public function testReturningEmptyArrayWhenNoService() - { - $definition = new Definition(ArgumentResolver::class, array(null, array())); - $container = new ContainerBuilder(); - $container->setDefinition('argument_resolver', $definition); - - (new ControllerArgumentValueResolverPass())->process($container); - $this->assertEquals(array(), $definition->getArgument(1)->getValues()); - } - - public function testNoArgumentResolver() - { - $container = new ContainerBuilder(); - - (new ControllerArgumentValueResolverPass())->process($container); - - $this->assertFalse($container->hasDefinition('argument_resolver')); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php deleted file mode 100644 index d28c6ec..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass; -use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; - -class FragmentRendererPassTest extends TestCase -{ - /** - * Tests that content rendering not implementing FragmentRendererInterface - * trigger an exception. - * - * @expectedException \InvalidArgumentException - */ - public function testContentRendererWithoutInterface() - { - // one service, not implementing any interface - $services = array( - 'my_content_renderer' => array(array('alias' => 'foo')), - ); - - $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock(); - - $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock(); - $builder->expects($this->any()) - ->method('hasDefinition') - ->will($this->returnValue(true)); - - // We don't test kernel.fragment_renderer here - $builder->expects($this->atLeastOnce()) - ->method('findTaggedServiceIds') - ->will($this->returnValue($services)); - - $builder->expects($this->atLeastOnce()) - ->method('getDefinition') - ->will($this->returnValue($definition)); - - $pass = new FragmentRendererPass(); - $pass->process($builder); - } - - public function testValidContentRenderer() - { - $services = array( - 'my_content_renderer' => array(array('alias' => 'foo')), - ); - - $renderer = new Definition('', array(null)); - - $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock(); - $definition->expects($this->atLeastOnce()) - ->method('getClass') - ->will($this->returnValue('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService')); - - $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'getReflectionClass'))->getMock(); - $builder->expects($this->any()) - ->method('hasDefinition') - ->will($this->returnValue(true)); - - // We don't test kernel.fragment_renderer here - $builder->expects($this->atLeastOnce()) - ->method('findTaggedServiceIds') - ->will($this->returnValue($services)); - - $builder->expects($this->atLeastOnce()) - ->method('getDefinition') - ->will($this->onConsecutiveCalls($renderer, $definition)); - - $builder->expects($this->atLeastOnce()) - ->method('getReflectionClass') - ->with('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService') - ->will($this->returnValue(new \ReflectionClass('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService'))); - - $pass = new FragmentRendererPass(); - $pass->process($builder); - - $this->assertInstanceOf(Reference::class, $renderer->getArgument(0)); - } -} - -class RendererService implements FragmentRendererInterface -{ - public function render($uri, Request $request = null, array $options = array()) - { - } - - public function getName() - { - return 'test'; - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php deleted file mode 100644 index 0406345..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class LazyLoadingFragmentHandlerTest extends TestCase -{ - /** - * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler::addRendererService() method is deprecated since version 3.3 and will be removed in 4.0. - */ - public function testRenderWithLegacyMapping() - { - $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer->expects($this->once())->method('getName')->will($this->returnValue('foo')); - $renderer->expects($this->any())->method('render')->will($this->returnValue(new Response())); - - $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); - - $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); - $container->expects($this->once())->method('get')->will($this->returnValue($renderer)); - - $handler = new LazyLoadingFragmentHandler($container, $requestStack, false); - $handler->addRendererService('foo', 'foo'); - - $handler->render('/foo', 'foo'); - - // second call should not lazy-load anymore (see once() above on the get() method) - $handler->render('/foo', 'foo'); - } - - public function testRender() - { - $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer->expects($this->once())->method('getName')->will($this->returnValue('foo')); - $renderer->expects($this->any())->method('render')->will($this->returnValue(new Response())); - - $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); - - $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock(); - $container->expects($this->once())->method('has')->with('foo')->willReturn(true); - $container->expects($this->once())->method('get')->will($this->returnValue($renderer)); - - $handler = new LazyLoadingFragmentHandler($container, $requestStack, false); - - $handler->render('/foo', 'foo'); - - // second call should not lazy-load anymore (see once() above on the get() method) - $handler->render('/foo', 'foo'); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php deleted file mode 100644 index 81fc8b4..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; - -class MergeExtensionConfigurationPassTest extends TestCase -{ - public function testAutoloadMainExtension() - { - $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')->setMethods(array('getExtensionConfig', 'loadFromExtension', 'getParameterBag', 'getDefinitions', 'getAliases', 'getExtensions'))->getMock(); - $params = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag')->getMock(); - - $container->expects($this->at(0)) - ->method('getExtensionConfig') - ->with('loaded') - ->will($this->returnValue(array(array()))); - $container->expects($this->at(1)) - ->method('getExtensionConfig') - ->with('notloaded') - ->will($this->returnValue(array())); - $container->expects($this->once()) - ->method('loadFromExtension') - ->with('notloaded', array()); - - $container->expects($this->any()) - ->method('getParameterBag') - ->will($this->returnValue($params)); - $params->expects($this->any()) - ->method('all') - ->will($this->returnValue(array())); - $container->expects($this->any()) - ->method('getDefinitions') - ->will($this->returnValue(array())); - $container->expects($this->any()) - ->method('getAliases') - ->will($this->returnValue(array())); - $container->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array())); - - $configPass = new MergeExtensionConfigurationPass(array('loaded', 'notloaded')); - $configPass->process($container); - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php deleted file mode 100644 index 83a07cb..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ /dev/null @@ -1,344 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass; - -class RegisterControllerArgumentLocatorsPassTest extends TestCase -{ - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Class "Symfony\Component\HttpKernel\Tests\DependencyInjection\NotFound" used for service "foo" cannot be found. - */ - public function testInvalidClass() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', NotFound::class) - ->addTag('controller.service_arguments') - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Missing "action" attribute on tag "controller.service_arguments" {"argument":"bar"} for service "foo". - */ - public function testNoAction() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('argument' => 'bar')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Missing "argument" attribute on tag "controller.service_arguments" {"action":"fooAction"} for service "foo". - */ - public function testNoArgument() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Missing "id" attribute on tag "controller.service_arguments" {"action":"fooAction","argument":"bar"} for service "foo". - */ - public function testNoService() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid "action" attribute on tag "controller.service_arguments" for service "foo": no public "barAction()" method found on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController". - */ - public function testInvalidMethod() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'barAction', 'argument' => 'bar', 'id' => 'bar_service')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid "controller.service_arguments" tag for service "foo": method "fooAction()" has no "baz" argument on class "Symfony\Component\HttpKernel\Tests\DependencyInjection\RegisterTestController". - */ - public function testInvalidArgument() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'baz', 'id' => 'bar')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - public function testAllActions() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments') - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - - $this->assertEquals(array('foo:fooAction'), array_keys($locator)); - $this->assertInstanceof(ServiceClosureArgument::class, $locator['foo:fooAction']); - - $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - - $this->assertSame(ServiceLocator::class, $locator->getClass()); - $this->assertFalse($locator->isPublic()); - - $expected = array('bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); - $this->assertEquals($expected, $locator->getArgument(0)); - } - - public function testExplicitArgument() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'bar')) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'baz')) // should be ignored, the first wins - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class))); - $this->assertEquals($expected, $locator->getArgument(0)); - } - - public function testOptionalArgument() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => '?bar')) - ; - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]); - - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); - $this->assertEquals($expected, $locator->getArgument(0)); - } - - public function testSkipSetContainer() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', ContainerAwareRegisterTestController::class) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo:fooAction'), array_keys($locator)); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClass". Did you forget to add a use statement? - */ - public function testExceptionOnNonExistentTypeHint() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', NonExistentClassController::class) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Cannot determine controller argument for "Symfony\Component\HttpKernel\Tests\DependencyInjection\NonExistentClassDifferentNamespaceController::fooAction()": the $nonExistent argument is type-hinted with the non-existent class or interface: "Acme\NonExistentClass". - */ - public function testExceptionOnNonExistentTypeHintDifferentNamespace() - { - $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', NonExistentClassDifferentNamespaceController::class) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - } - - public function testNoExceptionOnNonExistentTypeHintOptionalArg() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', NonExistentClassOptionalController::class) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo:barAction', 'foo:fooAction'), array_keys($locator)); - } - - public function testArgumentWithNoTypeHintIsOk() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', ArgumentWithoutTypeController::class) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertEmpty(array_keys($locator)); - } - - public function testControllersAreMadePublic() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('foo', ArgumentWithoutTypeController::class) - ->setPublic(false) - ->addTag('controller.service_arguments'); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $this->assertTrue($container->getDefinition('foo')->isPublic()); - } -} - -class RegisterTestController -{ - public function __construct(ControllerDummy $bar) - { - } - - public function fooAction(ControllerDummy $bar) - { - } - - protected function barAction(ControllerDummy $bar) - { - } -} - -class ContainerAwareRegisterTestController implements ContainerAwareInterface -{ - use ContainerAwareTrait; - - public function fooAction(ControllerDummy $bar) - { - } -} - -class ControllerDummy -{ -} - -class NonExistentClassController -{ - public function fooAction(NonExistentClass $nonExistent) - { - } -} - -class NonExistentClassDifferentNamespaceController -{ - public function fooAction(\Acme\NonExistentClass $nonExistent) - { - } -} - -class NonExistentClassOptionalController -{ - public function fooAction(NonExistentClass $nonExistent = null) - { - } - - public function barAction(NonExistentClass $nonExistent = null, $bar) - { - } -} - -class ArgumentWithoutTypeController -{ - public function fooAction($someArg) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php deleted file mode 100644 index 9cac968..0000000 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass; -use Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass; - -class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase -{ - public function testProcess() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('stdClass', 'stdClass'); - $container->register(parent::class, 'stdClass'); - $container->register('c1', RemoveTestController1::class)->addTag('controller.service_arguments'); - $container->register('c2', RemoveTestController2::class)->addTag('controller.service_arguments') - ->addMethodCall('setTestCase', array(new Reference('c1'))); - - $pass = new RegisterControllerArgumentLocatorsPass(); - $pass->process($container); - - $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - - $this->assertCount(2, $container->getDefinition((string) $controllers['c1:fooAction']->getValues()[0])->getArgument(0)); - $this->assertCount(1, $container->getDefinition((string) $controllers['c2:setTestCase']->getValues()[0])->getArgument(0)); - $this->assertCount(1, $container->getDefinition((string) $controllers['c2:fooAction']->getValues()[0])->getArgument(0)); - - (new ResolveInvalidReferencesPass())->process($container); - - $this->assertCount(1, $container->getDefinition((string) $controllers['c2:setTestCase']->getValues()[0])->getArgument(0)); - $this->assertSame(array(), $container->getDefinition((string) $controllers['c2:fooAction']->getValues()[0])->getArgument(0)); - - (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - - $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - - $this->assertSame(array('c1:fooAction'), array_keys($controllers)); - $this->assertSame(array('bar'), array_keys($container->getDefinition((string) $controllers['c1:fooAction']->getValues()[0])->getArgument(0))); - - $expectedLog = array( - 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing service-argument resolver for controller "c2:fooAction": no corresponding services exist for the referenced types.', - 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing method "setTestCase" of service "c2" from controller candidates: the method is called at instantiation, thus cannot be an action.', - ); - - $this->assertSame($expectedLog, $container->getCompiler()->getLog()); - } - - public function testSameIdClass() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register(RegisterTestController::class, RegisterTestController::class) - ->addTag('controller.service_arguments') - ; - - (new RegisterControllerArgumentLocatorsPass())->process($container); - (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - - $expected = array( - RegisterTestController::class.':fooAction', - RegisterTestController::class.'::fooAction', - ); - $this->assertEquals($expected, array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0))); - } - - public function testInvoke() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register('invokable', InvokableRegisterTestController::class) - ->addTag('controller.service_arguments') - ; - - (new RegisterControllerArgumentLocatorsPass())->process($container); - (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - - $this->assertEquals( - array('invokable:__invoke', 'invokable'), - array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0)) - ); - } - - public function testInvokeSameIdClass() - { - $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); - - $container->register(InvokableRegisterTestController::class, InvokableRegisterTestController::class) - ->addTag('controller.service_arguments') - ; - - (new RegisterControllerArgumentLocatorsPass())->process($container); - (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); - - $expected = array( - InvokableRegisterTestController::class.':__invoke', - InvokableRegisterTestController::class.'::__invoke', - InvokableRegisterTestController::class, - ); - $this->assertEquals($expected, array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0))); - } -} - -class RemoveTestController1 -{ - public function fooAction(\stdClass $bar, ClassNotInContainer $baz) - { - } -} - -class RemoveTestController2 -{ - public function setTestCase(TestCase $test) - { - } - - public function fooAction(ClassNotInContainer $bar) - { - } -} - -class InvokableRegisterTestController -{ - public function __invoke(\stdClass $bar) - { - } -} - -class ClassNotInContainer -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Event/GetResponseForExceptionEventTest.php b/vendor/symfony/http-kernel/Tests/Event/GetResponseForExceptionEventTest.php deleted file mode 100644 index 7242579..0000000 --- a/vendor/symfony/http-kernel/Tests/Event/GetResponseForExceptionEventTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Event; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Tests\TestHttpKernel; - -class GetResponseForExceptionEventTest extends TestCase -{ - public function testAllowSuccessfulResponseIsFalseByDefault() - { - $event = new GetResponseForExceptionEvent(new TestHttpKernel(), new Request(), 1, new \Exception()); - - $this->assertFalse($event->isAllowingCustomResponseCode()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php deleted file mode 100644 index f4878f6..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * Test AddRequestFormatsListener class. - * - * @author Gildas Quemener - */ -class AddRequestFormatsListenerTest extends TestCase -{ - /** - * @var AddRequestFormatsListener - */ - private $listener; - - protected function setUp() - { - $this->listener = new AddRequestFormatsListener(array('csv' => array('text/csv', 'text/plain'))); - } - - protected function tearDown() - { - $this->listener = null; - } - - public function testIsAnEventSubscriber() - { - $this->assertInstanceOf('Symfony\Component\EventDispatcher\EventSubscriberInterface', $this->listener); - } - - public function testRegisteredEvent() - { - $this->assertEquals( - array(KernelEvents::REQUEST => array('onKernelRequest', 1)), - AddRequestFormatsListener::getSubscribedEvents() - ); - } - - public function testSetAdditionalFormats() - { - $request = $this->getRequestMock(); - $event = $this->getGetResponseEventMock($request); - - $request->expects($this->once()) - ->method('setFormat') - ->with('csv', array('text/csv', 'text/plain')); - - $this->listener->onKernelRequest($event); - } - - protected function getRequestMock() - { - return $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - } - - protected function getGetResponseEventMock(Request $request) - { - $event = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') - ->disableOriginalConstructor() - ->getMock(); - - $event->expects($this->any()) - ->method('getRequest') - ->will($this->returnValue($request)); - - return $event; - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php deleted file mode 100644 index d134990..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Psr\Log\LogLevel; -use Symfony\Component\Console\Event\ConsoleEvent; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Output\ConsoleOutput; -use Symfony\Component\Debug\ErrorHandler; -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\KernelEvent; -use Symfony\Component\HttpKernel\EventListener\DebugHandlersListener; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; - -/** - * DebugHandlersListenerTest. - * - * @author Nicolas Grekas - */ -class DebugHandlersListenerTest extends TestCase -{ - public function testConfigure() - { - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $userHandler = function () {}; - $listener = new DebugHandlersListener($userHandler, $logger); - $xHandler = new ExceptionHandler(); - $eHandler = new ErrorHandler(); - $eHandler->setExceptionHandler(array($xHandler, 'handle')); - - $exception = null; - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); - try { - $listener->configure(); - } catch (\Exception $exception) { - } - restore_exception_handler(); - restore_error_handler(); - - if (null !== $exception) { - throw $exception; - } - - $this->assertSame($userHandler, $xHandler->setHandler('var_dump')); - - $loggers = $eHandler->setLoggers(array()); - - $this->assertArrayHasKey(E_DEPRECATED, $loggers); - $this->assertSame(array($logger, LogLevel::INFO), $loggers[E_DEPRECATED]); - } - - public function testConfigureForHttpKernelWithNoTerminateWithException() - { - $listener = new DebugHandlersListener(null); - $eHandler = new ErrorHandler(); - $event = new KernelEvent( - $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), - Request::create('/'), - HttpKernelInterface::MASTER_REQUEST - ); - - $exception = null; - $h = set_exception_handler(array($eHandler, 'handleException')); - try { - $listener->configure($event); - } catch (\Exception $exception) { - } - restore_exception_handler(); - - if (null !== $exception) { - throw $exception; - } - - $this->assertNull($h); - } - - public function testConsoleEvent() - { - $dispatcher = new EventDispatcher(); - $listener = new DebugHandlersListener(null); - $app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock(); - $app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet())); - $command = new Command(__FUNCTION__); - $command->setApplication($app); - $event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput()); - - $dispatcher->addSubscriber($listener); - - $xListeners = array( - KernelEvents::REQUEST => array(array($listener, 'configure')), - ConsoleEvents::COMMAND => array(array($listener, 'configure')), - ); - $this->assertSame($xListeners, $dispatcher->getListeners()); - - $exception = null; - $eHandler = new ErrorHandler(); - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); - try { - $dispatcher->dispatch(ConsoleEvents::COMMAND, $event); - } catch (\Exception $exception) { - } - restore_exception_handler(); - restore_error_handler(); - - if (null !== $exception) { - throw $exception; - } - - $xHandler = $eHandler->setExceptionHandler('var_dump'); - $this->assertInstanceOf('Closure', $xHandler); - - $app->expects($this->once()) - ->method('renderException'); - - $xHandler(new \Exception()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php deleted file mode 100644 index 509f443..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\HttpKernel\EventListener\DumpListener; -use Symfony\Component\VarDumper\Cloner\ClonerInterface; -use Symfony\Component\VarDumper\Cloner\Data; -use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -use Symfony\Component\VarDumper\VarDumper; - -/** - * DumpListenerTest. - * - * @author Nicolas Grekas - */ -class DumpListenerTest extends TestCase -{ - public function testSubscribedEvents() - { - $this->assertSame( - array(ConsoleEvents::COMMAND => array('configure', 1024)), - DumpListener::getSubscribedEvents() - ); - } - - public function testConfigure() - { - $prevDumper = VarDumper::setHandler('var_dump'); - VarDumper::setHandler($prevDumper); - - $cloner = new MockCloner(); - $dumper = new MockDumper(); - - ob_start(); - $exception = null; - $listener = new DumpListener($cloner, $dumper); - - try { - $listener->configure(); - - VarDumper::dump('foo'); - VarDumper::dump('bar'); - - $this->assertSame('+foo-+bar-', ob_get_clean()); - } catch (\Exception $exception) { - } - - VarDumper::setHandler($prevDumper); - - if (null !== $exception) { - throw $exception; - } - } -} - -class MockCloner implements ClonerInterface -{ - public function cloneVar($var) - { - return new Data(array(array($var.'-'))); - } -} - -class MockDumper implements DataDumperInterface -{ - public function dump(Data $data) - { - echo '+'.$data->getValue(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php deleted file mode 100644 index f5501a3..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ /dev/null @@ -1,149 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\EventListener\ExceptionListener; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Tests\Logger; - -/** - * ExceptionListenerTest. - * - * @author Robert Schönthal - * - * @group time-sensitive - */ -class ExceptionListenerTest extends TestCase -{ - public function testConstruct() - { - $logger = new TestLogger(); - $l = new ExceptionListener('foo', $logger); - - $_logger = new \ReflectionProperty(get_class($l), 'logger'); - $_logger->setAccessible(true); - $_controller = new \ReflectionProperty(get_class($l), 'controller'); - $_controller->setAccessible(true); - - $this->assertSame($logger, $_logger->getValue($l)); - $this->assertSame('foo', $_controller->getValue($l)); - } - - /** - * @dataProvider provider - */ - public function testHandleWithoutLogger($event, $event2) - { - $this->iniSet('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul'); - - $l = new ExceptionListener('foo'); - $l->onKernelException($event); - - $this->assertEquals(new Response('foo'), $event->getResponse()); - - try { - $l->onKernelException($event2); - $this->fail('RuntimeException expected'); - } catch (\RuntimeException $e) { - $this->assertSame('bar', $e->getMessage()); - $this->assertSame('foo', $e->getPrevious()->getMessage()); - } - } - - /** - * @dataProvider provider - */ - public function testHandleWithLogger($event, $event2) - { - $logger = new TestLogger(); - - $l = new ExceptionListener('foo', $logger); - $l->onKernelException($event); - - $this->assertEquals(new Response('foo'), $event->getResponse()); - - try { - $l->onKernelException($event2); - $this->fail('RuntimeException expected'); - } catch (\RuntimeException $e) { - $this->assertSame('bar', $e->getMessage()); - $this->assertSame('foo', $e->getPrevious()->getMessage()); - } - - $this->assertEquals(3, $logger->countErrors()); - $this->assertCount(3, $logger->getLogs('critical')); - } - - public function provider() - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - return array(array(null, null)); - } - - $request = new Request(); - $exception = new \Exception('foo'); - $event = new GetResponseForExceptionEvent(new TestKernel(), $request, 'foo', $exception); - $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, 'foo', $exception); - - return array( - array($event, $event2), - ); - } - - public function testSubRequestFormat() - { - $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock()); - - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { - return new Response($request->getRequestFormat()); - })); - - $request = Request::create('/'); - $request->setRequestFormat('xml'); - - $event = new GetResponseForExceptionEvent($kernel, $request, 'foo', new \Exception('foo')); - $listener->onKernelException($event); - - $response = $event->getResponse(); - $this->assertEquals('xml', $response->getContent()); - } -} - -class TestLogger extends Logger implements DebugLoggerInterface -{ - public function countErrors() - { - return count($this->logs['critical']); - } -} - -class TestKernel implements HttpKernelInterface -{ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) - { - return new Response('foo'); - } -} - -class TestKernelThatThrowsException implements HttpKernelInterface -{ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) - { - throw new \RuntimeException('bar'); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php deleted file mode 100644 index 464b2ab..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\UriSigner; - -class FragmentListenerTest extends TestCase -{ - public function testOnlyTriggeredOnFragmentRoute() - { - $request = Request::create('http://example.com/foo?_path=foo%3Dbar%26_controller%3Dfoo'); - - $listener = new FragmentListener(new UriSigner('foo')); - $event = $this->createGetResponseEvent($request); - - $expected = $request->attributes->all(); - - $listener->onKernelRequest($event); - - $this->assertEquals($expected, $request->attributes->all()); - $this->assertTrue($request->query->has('_path')); - } - - public function testOnlyTriggeredIfControllerWasNotDefinedYet() - { - $request = Request::create('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'); - $request->attributes->set('_controller', 'bar'); - - $listener = new FragmentListener(new UriSigner('foo')); - $event = $this->createGetResponseEvent($request, HttpKernelInterface::SUB_REQUEST); - - $expected = $request->attributes->all(); - - $listener->onKernelRequest($event); - - $this->assertEquals($expected, $request->attributes->all()); - } - - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - public function testAccessDeniedWithNonSafeMethods() - { - $request = Request::create('http://example.com/_fragment', 'POST'); - - $listener = new FragmentListener(new UriSigner('foo')); - $event = $this->createGetResponseEvent($request); - - $listener->onKernelRequest($event); - } - - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException - */ - public function testAccessDeniedWithWrongSignature() - { - $request = Request::create('http://example.com/_fragment', 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); - - $listener = new FragmentListener(new UriSigner('foo')); - $event = $this->createGetResponseEvent($request); - - $listener->onKernelRequest($event); - } - - public function testWithSignature() - { - $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); - - $listener = new FragmentListener($signer); - $event = $this->createGetResponseEvent($request); - - $listener->onKernelRequest($event); - - $this->assertEquals(array('foo' => 'bar', '_controller' => 'foo'), $request->attributes->get('_route_params')); - $this->assertFalse($request->query->has('_path')); - } - - public function testRemovesPathWithControllerDefined() - { - $request = Request::create('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'); - - $listener = new FragmentListener(new UriSigner('foo')); - $event = $this->createGetResponseEvent($request, HttpKernelInterface::SUB_REQUEST); - - $listener->onKernelRequest($event); - - $this->assertFalse($request->query->has('_path')); - } - - public function testRemovesPathWithControllerNotDefined() - { - $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); - - $listener = new FragmentListener($signer); - $event = $this->createGetResponseEvent($request); - - $listener->onKernelRequest($event); - - $this->assertFalse($request->query->has('_path')); - } - - private function createGetResponseEvent(Request $request, $requestType = HttpKernelInterface::MASTER_REQUEST) - { - return new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, $requestType); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php deleted file mode 100644 index 2ce3281..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\EventListener\LocaleListener; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; - -class LocaleListenerTest extends TestCase -{ - private $requestStack; - - protected function setUp() - { - $this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock(); - } - - public function testDefaultLocaleWithoutSession() - { - $listener = new LocaleListener($this->requestStack, 'fr'); - $event = $this->getEvent($request = Request::create('/')); - - $listener->onKernelRequest($event); - $this->assertEquals('fr', $request->getLocale()); - } - - public function testLocaleFromRequestAttribute() - { - $request = Request::create('/'); - session_name('foo'); - $request->cookies->set('foo', 'value'); - - $request->attributes->set('_locale', 'es'); - $listener = new LocaleListener($this->requestStack, 'fr'); - $event = $this->getEvent($request); - - $listener->onKernelRequest($event); - $this->assertEquals('es', $request->getLocale()); - } - - public function testLocaleSetForRoutingContext() - { - // the request context is updated - $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); - $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); - - $request = Request::create('/'); - - $request->attributes->set('_locale', 'es'); - $listener = new LocaleListener($this->requestStack, 'fr', $router); - $listener->onKernelRequest($this->getEvent($request)); - } - - public function testRouterResetWithParentRequestOnKernelFinishRequest() - { - // the request context is updated - $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); - $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); - - $parentRequest = Request::create('/'); - $parentRequest->setLocale('es'); - - $this->requestStack->expects($this->once())->method('getParentRequest')->will($this->returnValue($parentRequest)); - - $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')->disableOriginalConstructor()->getMock(); - - $listener = new LocaleListener($this->requestStack, 'fr', $router); - $listener->onKernelFinishRequest($event); - } - - public function testRequestLocaleIsNotOverridden() - { - $request = Request::create('/'); - $request->setLocale('de'); - $listener = new LocaleListener($this->requestStack, 'fr'); - $event = $this->getEvent($request); - - $listener->onKernelRequest($event); - $this->assertEquals('de', $request->getLocale()); - } - - private function getEvent(Request $request) - { - return new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php deleted file mode 100644 index 751aee8..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\EventListener\ProfilerListener; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\Exception\HttpException; -use Symfony\Component\HttpKernel\Kernel; - -class ProfilerListenerTest extends TestCase -{ - /** - * Test a master and sub request with an exception and `onlyException` profiler option enabled. - */ - public function testKernelTerminate() - { - $profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') - ->disableOriginalConstructor() - ->getMock(); - - $profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler') - ->disableOriginalConstructor() - ->getMock(); - - $profiler->expects($this->once()) - ->method('collect') - ->will($this->returnValue($profile)); - - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - - $masterRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') - ->disableOriginalConstructor() - ->getMock(); - - $subRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request') - ->disableOriginalConstructor() - ->getMock(); - - $response = $this->getMockBuilder('Symfony\Component\HttpFoundation\Response') - ->disableOriginalConstructor() - ->getMock(); - - $requestStack = new RequestStack(); - $requestStack->push($masterRequest); - - $onlyException = true; - $listener = new ProfilerListener($profiler, $requestStack, null, $onlyException); - - // master request - $listener->onKernelResponse(new FilterResponseEvent($kernel, $masterRequest, Kernel::MASTER_REQUEST, $response)); - - // sub request - $listener->onKernelException(new GetResponseForExceptionEvent($kernel, $subRequest, Kernel::SUB_REQUEST, new HttpException(404))); - $listener->onKernelResponse(new FilterResponseEvent($kernel, $subRequest, Kernel::SUB_REQUEST, $response)); - - $listener->onKernelTerminate(new PostResponseEvent($kernel, $masterRequest, $response)); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php deleted file mode 100644 index 12a31eb..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\ResponseListener; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class ResponseListenerTest extends TestCase -{ - private $dispatcher; - - private $kernel; - - protected function setUp() - { - $this->dispatcher = new EventDispatcher(); - $listener = new ResponseListener('UTF-8'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); - - $this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - } - - protected function tearDown() - { - $this->dispatcher = null; - $this->kernel = null; - } - - public function testFilterDoesNothingForSubRequests() - { - $response = new Response('foo'); - - $event = new FilterResponseEvent($this->kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response); - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('', $event->getResponse()->headers->get('content-type')); - } - - public function testFilterSetsNonDefaultCharsetIfNotOverridden() - { - $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); - - $response = new Response('foo'); - - $event = new FilterResponseEvent($this->kernel, Request::create('/'), HttpKernelInterface::MASTER_REQUEST, $response); - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('ISO-8859-15', $response->getCharset()); - } - - public function testFilterDoesNothingIfCharsetIsOverridden() - { - $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); - - $response = new Response('foo'); - $response->setCharset('ISO-8859-1'); - - $event = new FilterResponseEvent($this->kernel, Request::create('/'), HttpKernelInterface::MASTER_REQUEST, $response); - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('ISO-8859-1', $response->getCharset()); - } - - public function testFiltersSetsNonDefaultCharsetIfNotOverriddenOnNonTextContentType() - { - $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); - - $response = new Response('foo'); - $request = Request::create('/'); - $request->setRequestFormat('application/json'); - - $event = new FilterResponseEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); - $this->dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('ISO-8859-15', $response->getCharset()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php deleted file mode 100644 index a40e579..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\Controller\ControllerResolver; -use Symfony\Component\HttpKernel\EventListener\ExceptionListener; -use Symfony\Component\HttpKernel\EventListener\RouterListener; -use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\Routing\RequestContext; - -class RouterListenerTest extends TestCase -{ - private $requestStack; - - protected function setUp() - { - $this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->disableOriginalConstructor()->getMock(); - } - - /** - * @dataProvider getPortData - */ - public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHttpPort, $expectedHttpsPort) - { - $urlMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface') - ->disableOriginalConstructor() - ->getMock(); - $context = new RequestContext(); - $context->setHttpPort($defaultHttpPort); - $context->setHttpsPort($defaultHttpsPort); - $urlMatcher->expects($this->any()) - ->method('getContext') - ->will($this->returnValue($context)); - - $listener = new RouterListener($urlMatcher, $this->requestStack); - $event = $this->createGetResponseEventForUri($uri); - $listener->onKernelRequest($event); - - $this->assertEquals($expectedHttpPort, $context->getHttpPort()); - $this->assertEquals($expectedHttpsPort, $context->getHttpsPort()); - $this->assertEquals(0 === strpos($uri, 'https') ? 'https' : 'http', $context->getScheme()); - } - - public function getPortData() - { - return array( - array(80, 443, 'http://localhost/', 80, 443), - array(80, 443, 'http://localhost:90/', 90, 443), - array(80, 443, 'https://localhost/', 80, 443), - array(80, 443, 'https://localhost:90/', 80, 90), - ); - } - - /** - * @param string $uri - * - * @return GetResponseEvent - */ - private function createGetResponseEventForUri($uri) - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create($uri); - $request->attributes->set('_controller', null); // Prevents going in to routing process - - return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testInvalidMatcher() - { - new RouterListener(new \stdClass(), $this->requestStack); - } - - public function testRequestMatcher() - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('http://localhost/'); - $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - - $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $requestMatcher->expects($this->once()) - ->method('matchRequest') - ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); - - $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); - $listener->onKernelRequest($event); - } - - public function testSubRequestWithDifferentMethod() - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('http://localhost/', 'post'); - $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - - $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $requestMatcher->expects($this->any()) - ->method('matchRequest') - ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); - - $context = new RequestContext(); - - $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); - $listener->onKernelRequest($event); - - // sub-request with another HTTP method - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('http://localhost/', 'get'); - $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST); - - $listener->onKernelRequest($event); - - $this->assertEquals('GET', $context->getMethod()); - } - - /** - * @dataProvider getLoggingParameterData - */ - public function testLoggingParameter($parameter, $log, $parameters) - { - $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $requestMatcher->expects($this->once()) - ->method('matchRequest') - ->will($this->returnValue($parameter)); - - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger->expects($this->once()) - ->method('info') - ->with($this->equalTo($log), $this->equalTo($parameters)); - - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('http://localhost/'); - - $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext(), $logger); - $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); - } - - public function getLoggingParameterData() - { - return array( - array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - ); - } - - public function testWithBadRequest() - { - $requestStack = new RequestStack(); - - $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $requestMatcher->expects($this->never())->method('matchRequest'); - - $dispatcher = new EventDispatcher(); - $dispatcher->addSubscriber(new ValidateRequestListener()); - $dispatcher->addSubscriber(new RouterListener($requestMatcher, $requestStack, new RequestContext())); - $dispatcher->addSubscriber(new ExceptionListener(function () { - return new Response('Exception handled', 400); - })); - - $kernel = new HttpKernel($dispatcher, new ControllerResolver(), $requestStack, new ArgumentResolver()); - - $request = Request::create('http://localhost/'); - $request->headers->set('host', '###'); - $response = $kernel->handle($request); - $this->assertSame(400, $response->getStatusCode()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php deleted file mode 100644 index 1e79ebe..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpKernel\EventListener\SurrogateListener; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class SurrogateListenerTest extends TestCase -{ - public function testFilterDoesNothingForSubRequests() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $response = new Response('foo '); - $listener = new SurrogateListener(new Esi()); - - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); - $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response); - $dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('', $event->getResponse()->headers->get('Surrogate-Control')); - } - - public function testFilterWhenThereIsSomeEsiIncludes() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $response = new Response('foo '); - $listener = new SurrogateListener(new Esi()); - - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); - $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); - $dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('content="ESI/1.0"', $event->getResponse()->headers->get('Surrogate-Control')); - } - - public function testFilterWhenThereIsNoEsiIncludes() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $response = new Response('foo'); - $listener = new SurrogateListener(new Esi()); - - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); - $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); - $dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals('', $event->getResponse()->headers->get('Surrogate-Control')); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php deleted file mode 100644 index 8ada8e7..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\EventListener\SessionListener; -use Symfony\Component\HttpKernel\EventListener\TestSessionListener; -use Symfony\Component\HttpFoundation\Session\SessionInterface; - -/** - * SessionListenerTest. - * - * Tests SessionListener. - * - * @author Bulat Shakirzyanov - */ -class TestSessionListenerTest extends TestCase -{ - /** - * @var TestSessionListener - */ - private $listener; - - /** - * @var SessionInterface - */ - private $session; - - protected function setUp() - { - $this->listener = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener'); - $this->session = $this->getSession(); - } - - public function testShouldSaveMasterRequestSession() - { - $this->sessionHasBeenStarted(); - $this->sessionMustBeSaved(); - - $this->filterResponse(new Request()); - } - - public function testShouldNotSaveSubRequestSession() - { - $this->sessionMustNotBeSaved(); - - $this->filterResponse(new Request(), HttpKernelInterface::SUB_REQUEST); - } - - public function testDoesNotDeleteCookieIfUsingSessionLifetime() - { - $this->sessionHasBeenStarted(); - - $params = session_get_cookie_params(); - session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']); - - $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); - $cookies = $response->headers->getCookies(); - - $this->assertEquals(0, reset($cookies)->getExpiresTime()); - } - - public function testUnstartedSessionIsNotSave() - { - $this->sessionHasNotBeenStarted(); - $this->sessionMustNotBeSaved(); - - $this->filterResponse(new Request()); - } - - public function testDoesNotImplementServiceSubscriberInterface() - { - $this->assertTrue(interface_exists(ServiceSubscriberInterface::class)); - $this->assertTrue(class_exists(SessionListener::class)); - $this->assertTrue(class_exists(TestSessionListener::class)); - $this->assertFalse(is_subclass_of(SessionListener::class, ServiceSubscriberInterface::class), 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford'); - $this->assertFalse(is_subclass_of(TestSessionListener::class, ServiceSubscriberInterface::class, 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford')); - } - - private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST) - { - $request->setSession($this->session); - $response = new Response(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $event = new FilterResponseEvent($kernel, $request, $type, $response); - - $this->listener->onKernelResponse($event); - - $this->assertSame($response, $event->getResponse()); - - return $response; - } - - private function sessionMustNotBeSaved() - { - $this->session->expects($this->never()) - ->method('save'); - } - - private function sessionMustBeSaved() - { - $this->session->expects($this->once()) - ->method('save'); - } - - private function sessionHasBeenStarted() - { - $this->session->expects($this->once()) - ->method('isStarted') - ->will($this->returnValue(true)); - } - - private function sessionHasNotBeenStarted() - { - $this->session->expects($this->once()) - ->method('isStarted') - ->will($this->returnValue(false)); - } - - private function getSession() - { - $mock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session') - ->disableOriginalConstructor() - ->getMock(); - - // set return value for getName() - $mock->expects($this->any())->method('getName')->will($this->returnValue('MOCKSESSID')); - - return $mock; - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php deleted file mode 100644 index 23b8331..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\EventListener\TranslatorListener; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -class TranslatorListenerTest extends TestCase -{ - private $listener; - private $translator; - private $requestStack; - - protected function setUp() - { - $this->translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock(); - $this->requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $this->listener = new TranslatorListener($this->translator, $this->requestStack); - } - - public function testLocaleIsSetInOnKernelRequest() - { - $this->translator - ->expects($this->once()) - ->method('setLocale') - ->with($this->equalTo('fr')); - - $event = new GetResponseEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST); - $this->listener->onKernelRequest($event); - } - - public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest() - { - $this->translator - ->expects($this->at(0)) - ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); - $this->translator - ->expects($this->at(1)) - ->method('setLocale') - ->with($this->equalTo('en')); - - $event = new GetResponseEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST); - $this->listener->onKernelRequest($event); - } - - public function testLocaleIsSetInOnKernelFinishRequestWhenParentRequestExists() - { - $this->translator - ->expects($this->once()) - ->method('setLocale') - ->with($this->equalTo('fr')); - - $this->setMasterRequest($this->createRequest('fr')); - $event = new FinishRequestEvent($this->createHttpKernel(), $this->createRequest('de'), HttpKernelInterface::SUB_REQUEST); - $this->listener->onKernelFinishRequest($event); - } - - public function testLocaleIsNotSetInOnKernelFinishRequestWhenParentRequestDoesNotExist() - { - $this->translator - ->expects($this->never()) - ->method('setLocale'); - - $event = new FinishRequestEvent($this->createHttpKernel(), $this->createRequest('de'), HttpKernelInterface::SUB_REQUEST); - $this->listener->onKernelFinishRequest($event); - } - - public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest() - { - $this->translator - ->expects($this->at(0)) - ->method('setLocale') - ->will($this->throwException(new \InvalidArgumentException())); - $this->translator - ->expects($this->at(1)) - ->method('setLocale') - ->with($this->equalTo('en')); - - $this->setMasterRequest($this->createRequest('fr')); - $event = new FinishRequestEvent($this->createHttpKernel(), $this->createRequest('de'), HttpKernelInterface::SUB_REQUEST); - $this->listener->onKernelFinishRequest($event); - } - - private function createHttpKernel() - { - return $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - } - - private function createRequest($locale) - { - $request = new Request(); - $request->setLocale($locale); - - return $request; - } - - private function setMasterRequest($request) - { - $this->requestStack - ->expects($this->any()) - ->method('getParentRequest') - ->will($this->returnValue($request)); - } -} diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php deleted file mode 100644 index d060943..0000000 --- a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\EventListener; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; - -class ValidateRequestListenerTest extends TestCase -{ - /** - * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException - */ - public function testListenerThrowsWhenMasterRequestHasInconsistentClientIps() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - - $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $request->headers->set('FORWARDED', 'for=2.2.2.2'); - $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); - - $dispatcher->addListener(KernelEvents::REQUEST, array(new ValidateRequestListener(), 'onKernelRequest')); - $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - - $dispatcher->dispatch(KernelEvents::REQUEST, $event); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php deleted file mode 100644 index 2bfcb2b..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php +++ /dev/null @@ -1,13 +0,0 @@ - 'Test')), - array(array('X-Test' => 1)), - array( - array( - array('X-Test' => 'Test'), - array('X-Test-2' => 'Test-2'), - ), - ), - ); - } - - public function testHeadersDefault() - { - $exception = $this->createException(); - $this->assertSame(array(), $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersConstructor($headers) - { - $exception = new HttpException(200, null, null, $headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = $this->createException(); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException() - { - return new HttpException(200); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php deleted file mode 100644 index 462d3ca..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php +++ /dev/null @@ -1,13 +0,0 @@ -assertSame(array('Allow' => 'GET, PUT'), $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new MethodNotAllowedHttpException(array('GET')); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php deleted file mode 100644 index 4c0db7a..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php +++ /dev/null @@ -1,13 +0,0 @@ -assertSame(array('Retry-After' => 10), $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new ServiceUnavailableHttpException(10); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException() - { - return new ServiceUnavailableHttpException(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php deleted file mode 100644 index 2079bb3..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php +++ /dev/null @@ -1,29 +0,0 @@ -assertSame(array('Retry-After' => 10), $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new TooManyRequestsHttpException(10); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException() - { - return new TooManyRequestsHttpException(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php deleted file mode 100644 index 37a0028..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php +++ /dev/null @@ -1,24 +0,0 @@ -assertSame(array('WWW-Authenticate' => 'Challenge'), $exception->getHeaders()); - } - - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new UnauthorizedHttpException('Challenge'); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php deleted file mode 100644 index 760366c..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php +++ /dev/null @@ -1,28 +0,0 @@ -setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException() - { - return new UnprocessableEntityHttpException(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php deleted file mode 100644 index d47287a..0000000 --- a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php +++ /dev/null @@ -1,23 +0,0 @@ -setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException($headers = array()) - { - return new UnsupportedMediaTypeHttpException(); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php b/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php deleted file mode 100644 index b6cf1cb..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\_123; - -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Config\Loader\LoaderInterface; - -class Kernel123 extends Kernel -{ - public function registerBundles() - { - return array(); - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } - - public function getCacheDir() - { - return sys_get_temp_dir().'/'.Kernel::VERSION.'/kernel123/cache/'.$this->environment; - } - - public function getLogDir() - { - return sys_get_temp_dir().'/'.Kernel::VERSION.'/kernel123/logs'; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/hide.txt b/vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/hide.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/bar.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/bar.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Bundle2Bundle/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Bundle2Bundle/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/hide.txt b/vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/hide.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/BasicTypesController.php b/vendor/symfony/http-kernel/Tests/Fixtures/Controller/BasicTypesController.php deleted file mode 100644 index e8e0b60..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/BasicTypesController.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller; - -class BasicTypesController -{ - public function action(string $foo, int $bar, float $baz) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingRequest.php b/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingRequest.php deleted file mode 100644 index 9b4754b..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingRequest.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller; - -use Symfony\Component\HttpFoundation\Request; - -class ExtendingRequest extends Request -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingSession.php b/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingSession.php deleted file mode 100644 index 9fa54ee..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingSession.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller; - -use Symfony\Component\HttpFoundation\Session\Session; - -class ExtendingSession extends Session -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/NullableController.php b/vendor/symfony/http-kernel/Tests/Fixtures/Controller/NullableController.php deleted file mode 100644 index 9db4df7..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/NullableController.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller; - -class NullableController -{ - public function action(?string $foo, ?\stdClass $bar, ?string $baz = 'value', $mandatory) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/VariadicController.php b/vendor/symfony/http-kernel/Tests/Fixtures/Controller/VariadicController.php deleted file mode 100644 index c398124..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/Controller/VariadicController.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\Controller; - -class VariadicController -{ - public function action($foo, ...$bar) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php deleted file mode 100644 index 867ccdc..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; - -class CloneVarDataCollector extends DataCollector -{ - private $varToClone; - - public function __construct($varToClone) - { - $this->varToClone = $varToClone; - } - - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = $this->cloneVar($this->varToClone); - } - - public function getData() - { - return $this->data; - } - - public function getName() - { - return 'clone_var'; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php deleted file mode 100644 index c8bfd36..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionAbsentBundle extends Bundle -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php deleted file mode 100644 index b43bc66..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; - -class ExtensionLoadedExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php deleted file mode 100644 index 3af81cb..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionLoadedBundle extends Bundle -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php deleted file mode 100644 index 0fd6431..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\DependencyInjection; - -class ExtensionNotValidExtension -{ - public function getAlias() - { - return 'extension_not_valid'; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php deleted file mode 100644 index 34e2920..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionNotValidBundle extends Bundle -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php deleted file mode 100644 index 977976b..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php +++ /dev/null @@ -1,17 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command; - -use Symfony\Component\Console\Command\Command; - -class FooCommand extends Command -{ - protected function configure() - { - $this->setName('foo'); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php deleted file mode 100644 index 1085717..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\DependencyInjection; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; - -class ExtensionPresentExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php b/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php deleted file mode 100644 index 36a7ad4..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle; - -use Symfony\Component\HttpKernel\Bundle\Bundle; - -class ExtensionPresentBundle extends Bundle -{ -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php deleted file mode 100644 index a1102ab..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Config\Loader\LoaderInterface; - -class KernelForOverrideName extends Kernel -{ - protected $name = 'overridden'; - - public function registerBundles() - { - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php deleted file mode 100644 index 5fd61bb..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Config\Loader\LoaderInterface; - -class KernelForTest extends Kernel -{ - public function getBundleMap() - { - return $this->bundleMap; - } - - public function registerBundles() - { - return array(); - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } - - public function isBooted() - { - return $this->booted; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php deleted file mode 100644 index cee1b09..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Kernel; - -class KernelWithoutBundles extends Kernel -{ - public function registerBundles() - { - return array(); - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } - - protected function build(ContainerBuilder $container) - { - $container->setParameter('test_executed', true); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Resources/BaseBundle/hide.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Resources/BaseBundle/hide.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Resources/ChildBundle/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Resources/ChildBundle/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/Resources/FooBundle/foo.txt b/vendor/symfony/http-kernel/Tests/Fixtures/Resources/FooBundle/foo.txt deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php b/vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php deleted file mode 100644 index e7d60cf..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\HttpKernel\Client; - -class TestClient extends Client -{ - protected function getScript($request) - { - $script = parent::getScript($request); - - $autoload = file_exists(__DIR__.'/../../vendor/autoload.php') - ? __DIR__.'/../../vendor/autoload.php' - : __DIR__.'/../../../../../../vendor/autoload.php' - ; - - $script = preg_replace('/(\->register\(\);)/', "$0\nrequire_once '$autoload';\n", $script); - - return $script; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php deleted file mode 100644 index da7ef5b..0000000 --- a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fixtures; - -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class TestEventDispatcher extends EventDispatcher implements TraceableEventDispatcherInterface -{ - public function getCalledListeners() - { - return array('foo'); - } - - public function getNotCalledListeners() - { - return array('bar'); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php deleted file mode 100644 index bfe922e..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\UriSigner; - -class EsiFragmentRendererTest extends TestCase -{ - public function testRenderFallbackToInlineStrategyIfEsiNotSupported() - { - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true)); - $strategy->render('/', Request::create('/')); - } - - /** - * @group legacy - * @expectedDeprecation Passing non-scalar values as part of URI attributes to the ESI and SSI rendering strategies is deprecated %s. - */ - public function testRenderFallbackWithObjectAttributesIsDeprecated() - { - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); - $request = Request::create('/'); - $reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array()); - $strategy->render($reference, $request); - } - - public function testRender() - { - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - - $this->assertEquals('', $strategy->render('/', $request)->getContent()); - $this->assertEquals("\n", $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent()); - $this->assertEquals('', $strategy->render('/', $request, array('alt' => 'foo'))->getContent()); - } - - public function testRenderControllerReference() - { - $signer = new UriSigner('foo'); - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(), $signer); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); - - $this->assertEquals( - '', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() - ); - } - - /** - * @expectedException \LogicException - */ - public function testRenderControllerReferenceWithoutSignerThrowsException() - { - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - - $strategy->render(new ControllerReference('main_controller'), $request); - } - - /** - * @expectedException \LogicException - */ - public function testRenderAltControllerReferenceWithoutSignerThrowsException() - { - $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); - } - - private function getInlineStrategy($called = false) - { - $inline = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer')->disableOriginalConstructor()->getMock(); - - if ($called) { - $inline->expects($this->once())->method('render'); - } - - return $inline; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php deleted file mode 100644 index 9c906b5..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * @group time-sensitive - */ -class FragmentHandlerTest extends TestCase -{ - private $requestStack; - - protected function setUp() - { - $this->requestStack = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack') - ->disableOriginalConstructor() - ->getMock() - ; - $this->requestStack - ->expects($this->any()) - ->method('getCurrentRequest') - ->will($this->returnValue(Request::create('/'))) - ; - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRenderWhenRendererDoesNotExist() - { - $handler = new FragmentHandler($this->requestStack); - $handler->render('/', 'foo'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRenderWithUnknownRenderer() - { - $handler = $this->getHandler($this->returnValue(new Response('foo'))); - - $handler->render('/', 'bar'); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage Error when rendering "http://localhost/" (Status code is 404). - */ - public function testDeliverWithUnsuccessfulResponse() - { - $handler = $this->getHandler($this->returnValue(new Response('foo', 404))); - - $handler->render('/', 'foo'); - } - - public function testRender() - { - $handler = $this->getHandler($this->returnValue(new Response('foo')), array('/', Request::create('/'), array('foo' => 'foo', 'ignore_errors' => true))); - - $this->assertEquals('foo', $handler->render('/', 'foo', array('foo' => 'foo'))); - } - - protected function getHandler($returnValue, $arguments = array()) - { - $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer - ->expects($this->any()) - ->method('getName') - ->will($this->returnValue('foo')) - ; - $e = $renderer - ->expects($this->any()) - ->method('render') - ->will($returnValue) - ; - - if ($arguments) { - call_user_func_array(array($e, 'with'), $arguments); - } - - $handler = new FragmentHandler($this->requestStack); - $handler->addRenderer($renderer); - - return $handler; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php deleted file mode 100644 index 1be052e..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer; -use Symfony\Component\HttpKernel\UriSigner; -use Symfony\Component\HttpFoundation\Request; - -class HIncludeFragmentRendererTest extends TestCase -{ - /** - * @expectedException \LogicException - */ - public function testRenderExceptionWhenControllerAndNoSigner() - { - $strategy = new HIncludeFragmentRenderer(); - $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/')); - } - - public function testRenderWithControllerAndSigner() - { - $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo')); - - $this->assertEquals('', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); - } - - public function testRenderWithUri() - { - $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('', $strategy->render('/foo', Request::create('/'))->getContent()); - - $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo')); - $this->assertEquals('', $strategy->render('/foo', Request::create('/'))->getContent()); - } - - public function testRenderWithDefault() - { - // only default - $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); - - // only global default - $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('global_default', $strategy->render('/foo', Request::create('/'), array())->getContent()); - - // global default and default - $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); - } - - public function testRenderWithAttributesOptions() - { - // with id - $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar'))->getContent()); - - // with attributes - $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); - - // with id & attributes - $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); - } - - public function testRenderWithDefaultText() - { - $engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock(); - $engine->expects($this->once()) - ->method('exists') - ->with('default') - ->will($this->throwException(new \InvalidArgumentException())); - - // only default - $strategy = new HIncludeFragmentRenderer($engine); - $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php deleted file mode 100644 index 18e55a5..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php +++ /dev/null @@ -1,250 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class InlineFragmentRendererTest extends TestCase -{ - public function testRender() - { - $strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo')))); - - $this->assertEquals('foo', $strategy->render('/', Request::create('/'))->getContent()); - } - - public function testRenderWithControllerReference() - { - $strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo')))); - - $this->assertEquals('foo', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); - } - - public function testRenderWithObjectsAsAttributes() - { - $object = new \stdClass(); - - $subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller'); - $subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en')); - $subRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); - - $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest)); - - $this->assertSame('foo', $strategy->render(new ControllerReference('main_controller', array('object' => $object), array()), Request::create('/'))->getContent()); - } - - /** - * @group legacy - */ - public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheControllerLegacy() - { - $resolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver')->setMethods(array('getController'))->getMock(); - $resolver - ->expects($this->once()) - ->method('getController') - ->will($this->returnValue(function (\stdClass $object, Bar $object1) { - return new Response($object1->getBar()); - })) - ; - - $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack()); - $renderer = new InlineFragmentRenderer($kernel); - - $response = $renderer->render(new ControllerReference('main_controller', array('object' => new \stdClass(), 'object1' => new Bar()), array()), Request::create('/')); - $this->assertEquals('bar', $response->getContent()); - } - - /** - * @group legacy - */ - public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheController() - { - $resolver = $this->getMockBuilder(ControllerResolverInterface::class)->getMock(); - $resolver - ->expects($this->once()) - ->method('getController') - ->will($this->returnValue(function (\stdClass $object, Bar $object1) { - return new Response($object1->getBar()); - })) - ; - - $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack(), new ArgumentResolver()); - $renderer = new InlineFragmentRenderer($kernel); - - $response = $renderer->render(new ControllerReference('main_controller', array('object' => new \stdClass(), 'object1' => new Bar()), array()), Request::create('/')); - $this->assertEquals('bar', $response->getContent()); - } - - public function testRenderWithTrustedHeaderDisabled() - { - Request::setTrustedProxies(array(), 0); - - $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/'))); - $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); - - Request::setTrustedProxies(array(), -1); - } - - /** - * @expectedException \RuntimeException - */ - public function testRenderExceptionNoIgnoreErrors() - { - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $dispatcher->expects($this->never())->method('dispatch'); - - $strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher); - - $this->assertEquals('foo', $strategy->render('/', Request::create('/'))->getContent()); - } - - public function testRenderExceptionIgnoreErrors() - { - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $dispatcher->expects($this->once())->method('dispatch')->with(KernelEvents::EXCEPTION); - - $strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher); - - $this->assertEmpty($strategy->render('/', Request::create('/'), array('ignore_errors' => true))->getContent()); - } - - public function testRenderExceptionIgnoreErrorsWithAlt() - { - $strategy = new InlineFragmentRenderer($this->getKernel($this->onConsecutiveCalls( - $this->throwException(new \RuntimeException('foo')), - $this->returnValue(new Response('bar')) - ))); - - $this->assertEquals('bar', $strategy->render('/', Request::create('/'), array('ignore_errors' => true, 'alt' => '/foo'))->getContent()); - } - - private function getKernel($returnValue) - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel - ->expects($this->any()) - ->method('handle') - ->will($returnValue) - ; - - return $kernel; - } - - public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() - { - $controllerResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface')->getMock(); - $controllerResolver - ->expects($this->once()) - ->method('getController') - ->will($this->returnValue(function () { - ob_start(); - echo 'bar'; - throw new \RuntimeException(); - })) - ; - - $argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock(); - $argumentResolver - ->expects($this->once()) - ->method('getArguments') - ->will($this->returnValue(array())) - ; - - $kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver); - $renderer = new InlineFragmentRenderer($kernel); - - // simulate a main request with output buffering - ob_start(); - echo 'Foo'; - - // simulate a sub-request with output buffering and an exception - $renderer->render('/', Request::create('/'), array('ignore_errors' => true)); - - $this->assertEquals('Foo', ob_get_clean()); - } - - public function testESIHeaderIsKeptInSubrequest() - { - $expectedSubRequest = Request::create('/'); - $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); - - if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); - } - - $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); - - $request = Request::create('/'); - $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); - $strategy->render('/', $request); - } - - public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() - { - Request::setTrustedProxies(array(), 0); - - $this->testESIHeaderIsKeptInSubrequest(); - - Request::setTrustedProxies(array(), -1); - } - - public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest() - { - $expectedSubRequest = Request::create('/'); - if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); - } - - $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); - $request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*')); - $strategy->render('/', $request); - } - - /** - * Creates a Kernel expecting a request equals to $request - * Allows delta in comparison in case REQUEST_TIME changed by 1 second. - */ - private function getKernelExpectingRequest(Request $request, $strict = false) - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel - ->expects($this->once()) - ->method('handle') - ->with($this->equalTo($request, 1)) - ->willReturn(new Response('foo')); - - return $kernel; - } -} - -class Bar -{ - public $bar = 'bar'; - - public function getBar() - { - return $this->bar; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php deleted file mode 100644 index 3a040de..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerReference; - -class RoutableFragmentRendererTest extends TestCase -{ - /** - * @dataProvider getGenerateFragmentUriData - */ - public function testGenerateFragmentUri($uri, $controller) - { - $this->assertEquals($uri, $this->callGenerateFragmentUriMethod($controller, Request::create('/'))); - } - - /** - * @dataProvider getGenerateFragmentUriData - */ - public function testGenerateAbsoluteFragmentUri($uri, $controller) - { - $this->assertEquals('http://localhost'.$uri, $this->callGenerateFragmentUriMethod($controller, Request::create('/'), true)); - } - - public function getGenerateFragmentUriData() - { - return array( - array('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array())), - array('/_fragment?_path=_format%3Dxml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('_format' => 'xml'), array())), - array('/_fragment?_path=foo%3Dfoo%26_format%3Djson%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo', '_format' => 'json'), array())), - array('/_fragment?bar=bar&_path=foo%3Dfoo%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo'), array('bar' => 'bar'))), - array('/_fragment?foo=foo&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array('foo' => 'foo'))), - array('/_fragment?_path=foo%255B0%255D%3Dfoo%26foo%255B1%255D%3Dbar%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => array('foo', 'bar')), array())), - ); - } - - public function testGenerateFragmentUriWithARequest() - { - $request = Request::create('/'); - $request->attributes->set('_format', 'json'); - $request->setLocale('fr'); - $controller = new ControllerReference('controller', array(), array()); - - $this->assertEquals('/_fragment?_path=_format%3Djson%26_locale%3Dfr%26_controller%3Dcontroller', $this->callGenerateFragmentUriMethod($controller, $request)); - } - - /** - * @expectedException \LogicException - * @dataProvider getGenerateFragmentUriDataWithNonScalar - */ - public function testGenerateFragmentUriWithNonScalar($controller) - { - $this->callGenerateFragmentUriMethod($controller, Request::create('/')); - } - - public function getGenerateFragmentUriDataWithNonScalar() - { - return array( - array(new ControllerReference('controller', array('foo' => new Foo(), 'bar' => 'bar'), array())), - array(new ControllerReference('controller', array('foo' => array('foo' => 'foo'), 'bar' => array('bar' => new Foo())), array())), - ); - } - - private function callGenerateFragmentUriMethod(ControllerReference $reference, Request $request, $absolute = false) - { - $renderer = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\Fragment\RoutableFragmentRenderer'); - $r = new \ReflectionObject($renderer); - $m = $r->getMethod('generateFragmentUri'); - $m->setAccessible(true); - - return $m->invoke($renderer, $reference, $request, $absolute); - } -} - -class Foo -{ - public $foo; - - public function getFoo() - { - return $this->foo; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php deleted file mode 100644 index b537625..0000000 --- a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Fragment; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer; -use Symfony\Component\HttpKernel\HttpCache\Ssi; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\UriSigner; - -class SsiFragmentRendererTest extends TestCase -{ - public function testRenderFallbackToInlineStrategyIfSsiNotSupported() - { - $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(true)); - $strategy->render('/', Request::create('/')); - } - - public function testRender() - { - $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - - $this->assertEquals('', $strategy->render('/', $request)->getContent()); - $this->assertEquals('', $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent(), 'Strategy options should not impact the ssi include tag'); - } - - public function testRenderControllerReference() - { - $signer = new UriSigner('foo'); - $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy(), $signer); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); - - $this->assertEquals( - '', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() - ); - } - - /** - * @expectedException \LogicException - */ - public function testRenderControllerReferenceWithoutSignerThrowsException() - { - $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - - $strategy->render(new ControllerReference('main_controller'), $request); - } - - /** - * @expectedException \LogicException - */ - public function testRenderAltControllerReferenceWithoutSignerThrowsException() - { - $strategy = new SsiFragmentRenderer(new Ssi(), $this->getInlineStrategy()); - - $request = Request::create('/'); - $request->setLocale('fr'); - $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); - } - - private function getInlineStrategy($called = false) - { - $inline = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer')->disableOriginalConstructor()->getMock(); - - if ($called) { - $inline->expects($this->once())->method('render'); - } - - return $inline; - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php deleted file mode 100644 index a8662b2..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php +++ /dev/null @@ -1,248 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class EsiTest extends TestCase -{ - public function testHasSurrogateEsiCapability() - { - $esi = new Esi(); - - $request = Request::create('/'); - $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); - $this->assertTrue($esi->hasSurrogateCapability($request)); - - $request = Request::create('/'); - $request->headers->set('Surrogate-Capability', 'foobar'); - $this->assertFalse($esi->hasSurrogateCapability($request)); - - $request = Request::create('/'); - $this->assertFalse($esi->hasSurrogateCapability($request)); - } - - public function testAddSurrogateEsiCapability() - { - $esi = new Esi(); - - $request = Request::create('/'); - $esi->addSurrogateCapability($request); - $this->assertEquals('symfony="ESI/1.0"', $request->headers->get('Surrogate-Capability')); - - $esi->addSurrogateCapability($request); - $this->assertEquals('symfony="ESI/1.0", symfony="ESI/1.0"', $request->headers->get('Surrogate-Capability')); - } - - public function testAddSurrogateControl() - { - $esi = new Esi(); - - $response = new Response('foo '); - $esi->addSurrogateControl($response); - $this->assertEquals('content="ESI/1.0"', $response->headers->get('Surrogate-Control')); - - $response = new Response('foo'); - $esi->addSurrogateControl($response); - $this->assertEquals('', $response->headers->get('Surrogate-Control')); - } - - public function testNeedsEsiParsing() - { - $esi = new Esi(); - - $response = new Response(); - $response->headers->set('Surrogate-Control', 'content="ESI/1.0"'); - $this->assertTrue($esi->needsParsing($response)); - - $response = new Response(); - $this->assertFalse($esi->needsParsing($response)); - } - - public function testRenderIncludeTag() - { - $esi = new Esi(); - - $this->assertEquals('', $esi->renderIncludeTag('/', '/alt', true)); - $this->assertEquals('', $esi->renderIncludeTag('/', '/alt', false)); - $this->assertEquals('', $esi->renderIncludeTag('/')); - $this->assertEquals(''."\n".'', $esi->renderIncludeTag('/', '/alt', true, 'some comment')); - } - - public function testProcessDoesNothingIfContentTypeIsNotHtml() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response(); - $response->headers->set('Content-Type', 'text/plain'); - $esi->process($request, $response); - - $this->assertFalse($response->headers->has('x-body-eval')); - } - - public function testMultilineEsiRemoveTagsAreRemoved() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response(' www.example.com Keep this'."\n www.example.com And this"); - $esi->process($request, $response); - - $this->assertEquals(' Keep this And this', $response->getContent()); - } - - public function testCommentTagsAreRemoved() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response(' Keep this'); - $esi->process($request, $response); - - $this->assertEquals(' Keep this', $response->getContent()); - } - - public function testProcess() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $esi->process($request, $response); - - $this->assertEquals('foo surrogate->handle($this, \'...\', \'alt\', true) ?>'."\n", $response->getContent()); - $this->assertEquals('ESI', $response->headers->get('x-body-eval')); - - $response = new Response('foo '); - $esi->process($request, $response); - - $this->assertEquals('foo surrogate->handle($this, \'foo\\\'\', \'bar\\\'\', true) ?>'."\n", $response->getContent()); - - $response = new Response('foo '); - $esi->process($request, $response); - - $this->assertEquals('foo surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent()); - - $response = new Response('foo '); - $esi->process($request, $response); - - $this->assertEquals('foo surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent()); - } - - public function testProcessEscapesPhpTags() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response(''); - $esi->process($request, $response); - - $this->assertEquals('php cript language=php>', $response->getContent()); - } - - /** - * @expectedException \RuntimeException - */ - public function testProcessWhenNoSrcInAnEsi() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $esi->process($request, $response); - } - - public function testProcessRemoveSurrogateControlHeader() - { - $esi = new Esi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $response->headers->set('Surrogate-Control', 'content="ESI/1.0"'); - $esi->process($request, $response); - $this->assertEquals('ESI', $response->headers->get('x-body-eval')); - - $response->headers->set('Surrogate-Control', 'no-store, content="ESI/1.0"'); - $esi->process($request, $response); - $this->assertEquals('ESI', $response->headers->get('x-body-eval')); - $this->assertEquals('no-store', $response->headers->get('surrogate-control')); - - $response->headers->set('Surrogate-Control', 'content="ESI/1.0", no-store'); - $esi->process($request, $response); - $this->assertEquals('ESI', $response->headers->get('x-body-eval')); - $this->assertEquals('no-store', $response->headers->get('surrogate-control')); - } - - public function testHandle() - { - $esi = new Esi(); - $cache = $this->getCache(Request::create('/'), new Response('foo')); - $this->assertEquals('foo', $esi->handle($cache, '/', '/alt', true)); - } - - /** - * @expectedException \RuntimeException - */ - public function testHandleWhenResponseIsNot200() - { - $esi = new Esi(); - $response = new Response('foo'); - $response->setStatusCode(404); - $cache = $this->getCache(Request::create('/'), $response); - $esi->handle($cache, '/', '/alt', false); - } - - public function testHandleWhenResponseIsNot200AndErrorsAreIgnored() - { - $esi = new Esi(); - $response = new Response('foo'); - $response->setStatusCode(404); - $cache = $this->getCache(Request::create('/'), $response); - $this->assertEquals('', $esi->handle($cache, '/', '/alt', true)); - } - - public function testHandleWhenResponseIsNot200AndAltIsPresent() - { - $esi = new Esi(); - $response1 = new Response('foo'); - $response1->setStatusCode(404); - $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); - $this->assertEquals('bar', $esi->handle($cache, '/', '/alt', false)); - } - - protected function getCache($request, $response) - { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); - $cache->expects($this->any()) - ->method('getRequest') - ->will($this->returnValue($request)) - ; - if (is_array($response)) { - $cache->expects($this->any()) - ->method('handle') - ->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) - ; - } else { - $cache->expects($this->any()) - ->method('handle') - ->will($this->returnValue($response)) - ; - } - - return $cache; - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php deleted file mode 100644 index 4664ea9..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php +++ /dev/null @@ -1,1482 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use Symfony\Component\HttpKernel\HttpCache\HttpCache; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -/** - * @group time-sensitive - */ -class HttpCacheTest extends HttpCacheTestCase -{ - public function testTerminateDelegatesTerminationOnlyForTerminableInterface() - { - $storeMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface') - ->disableOriginalConstructor() - ->getMock(); - - // does not implement TerminableInterface - $kernel = new TestKernel(); - $httpCache = new HttpCache($kernel, $storeMock); - $httpCache->terminate(Request::create('/'), new Response()); - - $this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface'); - - // implements TerminableInterface - $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel') - ->disableOriginalConstructor() - ->setMethods(array('terminate', 'registerBundles', 'registerContainerConfiguration')) - ->getMock(); - - $kernelMock->expects($this->once()) - ->method('terminate'); - - $kernel = new HttpCache($kernelMock, $storeMock); - $kernel->terminate(Request::create('/'), new Response()); - } - - public function testPassesOnNonGetHeadRequests() - { - $this->setNextResponse(200); - $this->request('POST', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertTraceContains('pass'); - $this->assertFalse($this->response->headers->has('Age')); - } - - public function testInvalidatesOnPostPutDeleteRequests() - { - foreach (array('post', 'put', 'delete') as $method) { - $this->setNextResponse(200); - $this->request($method, '/'); - - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertTraceContains('invalidate'); - $this->assertTraceContains('pass'); - } - } - - public function testDoesNotCacheWithAuthorizationRequestHeaderAndNonPublicResponse() - { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); - - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertEquals('private', $this->response->headers->get('Cache-Control')); - - $this->assertTraceContains('miss'); - $this->assertTraceNotContains('store'); - $this->assertFalse($this->response->headers->has('Age')); - } - - public function testDoesCacheWithAuthorizationRequestHeaderAndPublicResponse() - { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); - - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertTrue($this->response->headers->has('Age')); - $this->assertEquals('public', $this->response->headers->get('Cache-Control')); - } - - public function testDoesNotCacheWithCookieHeaderAndNonPublicResponse() - { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array(), array('foo' => 'bar')); - - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertEquals('private', $this->response->headers->get('Cache-Control')); - $this->assertTraceContains('miss'); - $this->assertTraceNotContains('store'); - $this->assertFalse($this->response->headers->has('Age')); - } - - public function testDoesNotCacheRequestsWithACookieHeader() - { - $this->setNextResponse(200); - $this->request('GET', '/', array(), array('foo' => 'bar')); - - $this->assertHttpKernelIsCalled(); - $this->assertResponseOk(); - $this->assertEquals('private', $this->response->headers->get('Cache-Control')); - $this->assertTraceContains('miss'); - $this->assertTraceNotContains('store'); - $this->assertFalse($this->response->headers->has('Age')); - } - - public function testRespondsWith304WhenIfModifiedSinceMatchesLastModified() - { - $time = \DateTime::createFromFormat('U', time()); - - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); - - $this->assertHttpKernelIsCalled(); - $this->assertEquals(304, $this->response->getStatusCode()); - $this->assertEquals('', $this->response->headers->get('Content-Type')); - $this->assertEmpty($this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - } - - public function testRespondsWith304WhenIfNoneMatchMatchesETag() - { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '12345', 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345')); - - $this->assertHttpKernelIsCalled(); - $this->assertEquals(304, $this->response->getStatusCode()); - $this->assertEquals('', $this->response->headers->get('Content-Type')); - $this->assertTrue($this->response->headers->has('ETag')); - $this->assertEmpty($this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - } - - public function testRespondsWith304OnlyIfIfNoneMatchAndIfModifiedSinceBothMatch() - { - $time = \DateTime::createFromFormat('U', time()); - - $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) { - $response->setStatusCode(200); - $response->headers->set('ETag', '12345'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - $response->headers->set('Content-Type', 'text/plain'); - $response->setContent('Hello World'); - }); - - // only ETag matches - $t = \DateTime::createFromFormat('U', time() - 3600); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822))); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - - // only Last-Modified matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - - // Both matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(304, $this->response->getStatusCode()); - } - - public function testIncrementsMaxAgeWhenNoDateIsSpecifiedEventWhenUsingETag() - { - $this->setNextResponse( - 200, - array( - 'ETag' => '1234', - 'Cache-Control' => 'public, s-maxage=60', - ) - ); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - sleep(2); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertEquals(2, $this->response->headers->get('Age')); - } - - public function testValidatesPrivateResponsesCachedOnTheClient() - { - $this->setNextResponse(200, array(), '', function ($request, $response) { - $etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH')); - if ($request->cookies->has('authenticated')) { - $response->headers->set('Cache-Control', 'private, no-store'); - $response->setETag('"private tag"'); - if (in_array('"private tag"', $etags)) { - $response->setStatusCode(304); - } else { - $response->setStatusCode(200); - $response->headers->set('Content-Type', 'text/plain'); - $response->setContent('private data'); - } - } else { - $response->headers->set('Cache-Control', 'public'); - $response->setETag('"public tag"'); - if (in_array('"public tag"', $etags)) { - $response->setStatusCode(304); - } else { - $response->setStatusCode(200); - $response->headers->set('Content-Type', 'text/plain'); - $response->setContent('public data'); - } - } - }); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('"public tag"', $this->response->headers->get('ETag')); - $this->assertEquals('public data', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - $this->request('GET', '/', array(), array('authenticated' => '')); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('"private tag"', $this->response->headers->get('ETag')); - $this->assertEquals('private data', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('invalid'); - $this->assertTraceNotContains('store'); - } - - public function testStoresResponsesWhenNoCacheRequestDirectivePresent() - { - $time = \DateTime::createFromFormat('U', time() + 5); - - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); - - $this->assertHttpKernelIsCalled(); - $this->assertTraceContains('store'); - $this->assertTrue($this->response->headers->has('Age')); - } - - public function testReloadsResponsesWhenCacheHitsButNoCacheRequestDirectivePresentWhenAllowReloadIsSetTrue() - { - $count = 0; - - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { - ++$count; - $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); - }); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('store'); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Goodbye World', $this->response->getContent()); - $this->assertTraceContains('reload'); - $this->assertTraceContains('store'); - } - - public function testDoesNotReloadResponsesWhenAllowReloadIsSetFalseDefault() - { - $count = 0; - - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { - ++$count; - $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); - }); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('store'); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - $this->cacheConfig['allow_reload'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceNotContains('reload'); - - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceNotContains('reload'); - } - - public function testRevalidatesFreshCacheEntryWhenMaxAgeRequestDirectiveIsExceededWhenAllowRevalidateOptionIsSetTrue() - { - $count = 0; - - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { - ++$count; - $response->headers->set('Cache-Control', 'public, max-age=10000'); - $response->setETag($count); - $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); - }); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('store'); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - $this->cacheConfig['allow_revalidate'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Goodbye World', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('invalid'); - $this->assertTraceContains('store'); - } - - public function testDoesNotRevalidateFreshCacheEntryWhenEnableRevalidateOptionIsSetFalseDefault() - { - $count = 0; - - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { - ++$count; - $response->headers->set('Cache-Control', 'public, max-age=10000'); - $response->setETag($count); - $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); - }); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('store'); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - $this->cacheConfig['allow_revalidate'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceNotContains('stale'); - $this->assertTraceNotContains('invalid'); - $this->assertTraceContains('fresh'); - - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceNotContains('stale'); - $this->assertTraceNotContains('invalid'); - $this->assertTraceContains('fresh'); - } - - public function testFetchesResponseFromBackendWhenCacheMisses() - { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('miss'); - $this->assertTrue($this->response->headers->has('Age')); - } - - public function testDoesNotCacheSomeStatusCodeResponses() - { - foreach (array_merge(range(201, 202), range(204, 206), range(303, 305), range(400, 403), range(405, 409), range(411, 417), range(500, 505)) as $code) { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse($code, array('Expires' => $time->format(DATE_RFC2822))); - - $this->request('GET', '/'); - $this->assertEquals($code, $this->response->getStatusCode()); - $this->assertTraceNotContains('store'); - $this->assertFalse($this->response->headers->has('Age')); - } - } - - public function testDoesNotCacheResponsesWithExplicitNoStoreDirective() - { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store')); - - $this->request('GET', '/'); - $this->assertTraceNotContains('store'); - $this->assertFalse($this->response->headers->has('Age')); - } - - public function testDoesNotCacheResponsesWithoutFreshnessInformationOrAValidator() - { - $this->setNextResponse(); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceNotContains('store'); - } - - public function testCachesResponsesWithExplicitNoCacheDirective() - { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache')); - - $this->request('GET', '/'); - $this->assertTraceContains('store'); - $this->assertTrue($this->response->headers->has('Age')); - } - - public function testCachesResponsesWithAnExpirationHeader() - { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - } - - public function testCachesResponsesWithAMaxAgeDirective() - { - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=5')); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - } - - public function testCachesResponsesWithASMaxAgeDirective() - { - $this->setNextResponse(200, array('Cache-Control' => 's-maxage=5')); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - } - - public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInformation() - { - $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822))); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - } - - public function testCachesResponsesWithAnETagValidatorButNoFreshnessInformation() - { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"123456"')); - - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - } - - public function testHitsCachedResponsesWithExpiresHeader() - { - $time1 = \DateTime::createFromFormat('U', time() - 5); - $time2 = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822))); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - } - - public function testHitsCachedResponseWithMaxAgeDirective() - { - $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10')); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - } - - public function testDegradationWhenCacheLocked() - { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('Skips on windows to avoid permissions issues.'); - } - - $this->cacheConfig['stale_while_revalidate'] = 10; - - // The prescence of Last-Modified makes this cacheable (because Response::isValidateable() then). - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=5', 'Last-Modified' => 'some while ago'), 'Old response'); - $this->request('GET', '/'); // warm the cache - - // Now, lock the cache - $concurrentRequest = Request::create('/', 'GET'); - $this->store->lock($concurrentRequest); - - /* - * After 10s, the cached response has become stale. Yet, we're still within the "stale_while_revalidate" - * timeout so we may serve the stale response. - */ - sleep(10); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('stale-while-revalidate'); - $this->assertEquals('Old response', $this->response->getContent()); - - /* - * Another 10s later, stale_while_revalidate is over. Resort to serving the old response, but - * do so with a "server unavailable" message. - */ - sleep(10); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(503, $this->response->getStatusCode()); - $this->assertEquals('Old response', $this->response->getContent()); - } - - public function testHitsCachedResponseWithSMaxAgeDirective() - { - $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0')); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue(strtotime($this->responses[0]->headers->get('Date')) - strtotime($this->response->headers->get('Date')) < 2); - $this->assertTrue($this->response->headers->get('Age') > 0); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - } - - public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformation() - { - $this->setNextResponse(); - - $this->cacheConfig['default_ttl'] = 10; - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control')); - - $this->cacheConfig['default_ttl'] = 10; - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=10/', $this->response->headers->get('Cache-Control')); - } - - public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpired() - { - $this->setNextResponse(); - - $this->cacheConfig['default_ttl'] = 2; - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - - // expires the cache - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - $tmp = unserialize($values[0]); - $time = \DateTime::createFromFormat('U', time() - 5); - $tmp[0][1]['date'] = $time->format(DATE_RFC2822); - $r = new \ReflectionObject($this->store); - $m = $r->getMethod('save'); - $m->setAccessible(true); - $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('invalid'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - - $this->setNextResponse(); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - } - - public function testAssignsDefaultTtlWhenResponseHasNoFreshnessInformationAndAfterTtlWasExpiredWithStatus304() - { - $this->setNextResponse(); - - $this->cacheConfig['default_ttl'] = 2; - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - - // expires the cache - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - $tmp = unserialize($values[0]); - $time = \DateTime::createFromFormat('U', time() - 5); - $tmp[0][1]['date'] = $time->format(DATE_RFC2822); - $r = new \ReflectionObject($this->store); - $m = $r->getMethod('save'); - $m->setAccessible(true); - $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('valid'); - $this->assertTraceContains('store'); - $this->assertTraceNotContains('miss'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control')); - } - - public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective() - { - $this->setNextResponse(200, array('Cache-Control' => 'must-revalidate')); - - $this->cacheConfig['default_ttl'] = 10; - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('miss'); - $this->assertTraceNotContains('store'); - $this->assertNotRegExp('/s-maxage/', $this->response->headers->get('Cache-Control')); - $this->assertEquals('Hello World', $this->response->getContent()); - } - - public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() - { - $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - - // build initial request - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Date')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertNotNull($this->response->headers->get('Age')); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - - // go in and play around with the cached metadata directly ... - $values = $this->getMetaStorageValues(); - $this->assertCount(1, $values); - $tmp = unserialize($values[0]); - $time = \DateTime::createFromFormat('U', time()); - $tmp[0][1]['expires'] = $time->format(DATE_RFC2822); - $r = new \ReflectionObject($this->store); - $m = $r->getMethod('save'); - $m->setAccessible(true); - $m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp)); - - // build subsequent request; should be found but miss due to freshness - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTrue($this->response->headers->get('Age') <= 1); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTraceContains('stale'); - $this->assertTraceNotContains('fresh'); - $this->assertTraceNotContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Hello World', $this->response->getContent()); - } - - public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation() - { - $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { - $response->headers->set('Cache-Control', 'public'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { - $response->setStatusCode(304); - $response->setContent(''); - } - }); - - // build initial request - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Last-Modified')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertTraceNotContains('stale'); - - // build subsequent request; should be found but miss due to freshness - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('Last-Modified')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTrue($this->response->headers->get('Age') <= 1); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('valid'); - $this->assertTraceContains('store'); - $this->assertTraceNotContains('miss'); - } - - public function testValidatesCachedResponsesUseSameHttpMethod() - { - $test = $this; - - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($test) { - $test->assertSame('OPTIONS', $request->getMethod()); - }); - - // build initial request - $this->request('OPTIONS', '/'); - - // build subsequent request - $this->request('OPTIONS', '/'); - } - - public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation() - { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { - $response->headers->set('Cache-Control', 'public'); - $response->headers->set('ETag', '"12345"'); - if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) { - $response->setStatusCode(304); - $response->setContent(''); - } - }); - - // build initial request - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('ETag')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - // build subsequent request; should be found but miss due to freshness - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertNotNull($this->response->headers->get('ETag')); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $this->assertTrue($this->response->headers->get('Age') <= 1); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('valid'); - $this->assertTraceContains('store'); - $this->assertTraceNotContains('miss'); - } - - public function testServesResponseWhileFreshAndRevalidatesWithLastModifiedInformation() - { - $time = \DateTime::createFromFormat('U', time()); - - $this->setNextResponse(200, array(), 'Hello World', function (Request $request, Response $response) use ($time) { - $response->setSharedMaxAge(10); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - }); - - // prime the cache - $this->request('GET', '/'); - - // next request before s-maxage has expired: Serve from cache - // without hitting the backend - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - sleep(15); // expire the cache - - $this->setNextResponse(304, array(), '', function (Request $request, Response $response) use ($time) { - $this->assertEquals($time->format(DATE_RFC2822), $request->headers->get('IF_MODIFIED_SINCE')); - }); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('valid'); - } - - public function testReplacesCachedResponsesWhenValidationResultsInNon304Response() - { - $time = \DateTime::createFromFormat('U', time()); - $count = 0; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) { - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - $response->headers->set('Cache-Control', 'public'); - switch (++$count) { - case 1: - $response->setContent('first response'); - break; - case 2: - $response->setContent('second response'); - break; - case 3: - $response->setContent(''); - $response->setStatusCode(304); - break; - } - }); - - // first request should fetch from backend and store in cache - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('first response', $this->response->getContent()); - - // second request is validated, is invalid, and replaces cached entry - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('second response', $this->response->getContent()); - - // third response is validated, valid, and returns cached entry - $this->request('GET', '/'); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('second response', $this->response->getContent()); - - $this->assertEquals(3, $count); - } - - public function testPassesHeadRequestsThroughDirectlyOnPass() - { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { - $response->setContent(''); - $response->setStatusCode(200); - $this->assertEquals('HEAD', $request->getMethod()); - }); - - $this->request('HEAD', '/', array('HTTP_EXPECT' => 'something ...')); - $this->assertHttpKernelIsCalled(); - $this->assertEquals('', $this->response->getContent()); - } - - public function testUsesCacheToRespondToHeadRequestsWhenFresh() - { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { - $response->headers->set('Cache-Control', 'public, max-age=10'); - $response->setContent('Hello World'); - $response->setStatusCode(200); - $this->assertNotEquals('HEAD', $request->getMethod()); - }); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals('Hello World', $this->response->getContent()); - - $this->request('HEAD', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('', $this->response->getContent()); - $this->assertEquals(strlen('Hello World'), $this->response->headers->get('Content-Length')); - } - - public function testSendsNoContentWhenFresh() - { - $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { - $response->headers->set('Cache-Control', 'public, max-age=10'); - $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); - }); - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals('Hello World', $this->response->getContent()); - - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(304, $this->response->getStatusCode()); - $this->assertEquals('', $this->response->getContent()); - } - - public function testInvalidatesCachedResponsesOnPost() - { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { - if ('GET' == $request->getMethod()) { - $response->setStatusCode(200); - $response->headers->set('Cache-Control', 'public, max-age=500'); - $response->setContent('Hello World'); - } elseif ('POST' == $request->getMethod()) { - $response->setStatusCode(303); - $response->headers->set('Location', '/'); - $response->headers->remove('Cache-Control'); - $response->setContent(''); - } - }); - - // build initial request to enter into the cache - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - // make sure it is valid - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('fresh'); - - // now POST to same URL - $this->request('POST', '/helloworld'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals('/', $this->response->headers->get('Location')); - $this->assertTraceContains('invalidate'); - $this->assertTraceContains('pass'); - $this->assertEquals('', $this->response->getContent()); - - // now make sure it was actually invalidated - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Hello World', $this->response->getContent()); - $this->assertTraceContains('stale'); - $this->assertTraceContains('invalid'); - $this->assertTraceContains('store'); - } - - public function testServesFromCacheWhenHeadersMatch() - { - $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { - $response->headers->set('Vary', 'Accept User-Agent Foo'); - $response->headers->set('Cache-Control', 'public, max-age=10'); - $response->headers->set('X-Response-Count', ++$count); - $response->setContent($request->headers->get('USER_AGENT')); - }); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Bob/1.0', $this->response->getContent()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Bob/1.0', $this->response->getContent()); - $this->assertTraceContains('fresh'); - $this->assertTraceNotContains('store'); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - } - - public function testStoresMultipleResponsesWhenHeadersDiffer() - { - $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { - $response->headers->set('Vary', 'Accept User-Agent Foo'); - $response->headers->set('Cache-Control', 'public, max-age=10'); - $response->headers->set('X-Response-Count', ++$count); - $response->setContent($request->headers->get('USER_AGENT')); - }); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertEquals('Bob/1.0', $this->response->getContent()); - $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->assertEquals('Bob/2.0', $this->response->getContent()); - $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); - $this->assertTraceContains('fresh'); - $this->assertEquals('Bob/1.0', $this->response->getContent()); - $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); - $this->assertTraceContains('fresh'); - $this->assertEquals('Bob/2.0', $this->response->getContent()); - $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - - $this->request('GET', '/', array('HTTP_USER_AGENT' => 'Bob/2.0')); - $this->assertTraceContains('miss'); - $this->assertEquals('Bob/2.0', $this->response->getContent()); - $this->assertEquals(3, $this->response->headers->get('X-Response-Count')); - } - - public function testShouldCatchExceptions() - { - $this->catchExceptions(); - - $this->setNextResponse(); - $this->request('GET', '/'); - - $this->assertExceptionsAreCaught(); - } - - public function testShouldCatchExceptionsWhenReloadingAndNoCacheRequest() - { - $this->catchExceptions(); - - $this->setNextResponse(); - $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array(), array(), false, array('Pragma' => 'no-cache')); - - $this->assertExceptionsAreCaught(); - } - - public function testShouldNotCatchExceptions() - { - $this->catchExceptions(false); - - $this->setNextResponse(); - $this->request('GET', '/'); - - $this->assertExceptionsAreNotCaught(); - } - - public function testEsiCacheSendsTheLowestTtl() - { - $responses = array( - array( - 'status' => 200, - 'body' => ' ', - 'headers' => array( - 'Cache-Control' => 's-maxage=300', - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'Hello World!', - 'headers' => array('Cache-Control' => 's-maxage=200'), - ), - array( - 'status' => 200, - 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); - - $this->setNextResponses($responses); - - $this->request('GET', '/', array(), array(), true); - $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); - - $this->assertEquals(100, $this->response->getTtl()); - } - - public function testEsiCacheSendsTheLowestTtlForHeadRequests() - { - $responses = array( - array( - 'status' => 200, - 'body' => 'I am a long-lived master response, but I embed a short-lived resource: ', - 'headers' => array( - 'Cache-Control' => 's-maxage=300', - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'I am a short-lived resource', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); - - $this->setNextResponses($responses); - - $this->request('HEAD', '/', array(), array(), true); - - $this->assertEmpty($this->response->getContent()); - $this->assertEquals(100, $this->response->getTtl()); - } - - public function testEsiCacheForceValidation() - { - $responses = array( - array( - 'status' => 200, - 'body' => ' ', - 'headers' => array( - 'Cache-Control' => 's-maxage=300', - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'Hello World!', - 'headers' => array('ETag' => 'foobar'), - ), - array( - 'status' => 200, - 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); - - $this->setNextResponses($responses); - - $this->request('GET', '/', array(), array(), true); - $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); - $this->assertNull($this->response->getTtl()); - $this->assertTrue($this->response->mustRevalidate()); - $this->assertTrue($this->response->headers->hasCacheControlDirective('private')); - $this->assertTrue($this->response->headers->hasCacheControlDirective('no-cache')); - } - - public function testEsiCacheForceValidationForHeadRequests() - { - $responses = array( - array( - 'status' => 200, - 'body' => 'I am the master response and use expiration caching, but I embed another resource: ', - 'headers' => array( - 'Cache-Control' => 's-maxage=300', - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'I am the embedded resource and use validation caching', - 'headers' => array('ETag' => 'foobar'), - ), - ); - - $this->setNextResponses($responses); - - $this->request('HEAD', '/', array(), array(), true); - - // The response has been assembled from expiration and validation based resources - // This can neither be cached nor revalidated, so it should be private/no cache - $this->assertEmpty($this->response->getContent()); - $this->assertNull($this->response->getTtl()); - $this->assertTrue($this->response->mustRevalidate()); - $this->assertTrue($this->response->headers->hasCacheControlDirective('private')); - $this->assertTrue($this->response->headers->hasCacheControlDirective('no-cache')); - } - - public function testEsiRecalculateContentLengthHeader() - { - $responses = array( - array( - 'status' => 200, - 'body' => '', - 'headers' => array( - 'Content-Length' => 26, - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'Hello World!', - 'headers' => array(), - ), - ); - - $this->setNextResponses($responses); - - $this->request('GET', '/', array(), array(), true); - $this->assertEquals('Hello World!', $this->response->getContent()); - $this->assertEquals(12, $this->response->headers->get('Content-Length')); - } - - public function testEsiRecalculateContentLengthHeaderForHeadRequest() - { - $responses = array( - array( - 'status' => 200, - 'body' => '', - 'headers' => array( - 'Content-Length' => 26, - 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( - 'status' => 200, - 'body' => 'Hello World!', - 'headers' => array(), - ), - ); - - $this->setNextResponses($responses); - - $this->request('HEAD', '/', array(), array(), true); - - // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 - // "The Content-Length entity-header field indicates the size of the entity-body, - // in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD - // method, the size of the entity-body that would have been sent had the request - // been a GET." - $this->assertEmpty($this->response->getContent()); - $this->assertEquals(12, $this->response->headers->get('Content-Length')); - } - - public function testClientIpIsAlwaysLocalhostForForwardedRequests() - { - $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); - - $this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR')); - } - - /** - * @dataProvider getTrustedProxyData - */ - public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected) - { - Request::setTrustedProxies($existing, Request::HEADER_X_FORWARDED_ALL); - - $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); - - $this->assertEquals($expected, Request::getTrustedProxies()); - } - - public function getTrustedProxyData() - { - return array( - array(array(), array('127.0.0.1')), - array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')), - array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')), - ); - } - - /** - * @dataProvider getXForwardedForData - */ - public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected) - { - $this->setNextResponse(); - $server = array('REMOTE_ADDR' => '10.0.0.1'); - if (false !== $xForwardedFor) { - $server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor; - } - $this->request('GET', '/', $server); - - $this->assertEquals($expected, $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For')); - } - - public function getXForwardedForData() - { - return array( - array(false, '10.0.0.1'), - array('10.0.0.2', '10.0.0.2, 10.0.0.1'), - array('10.0.0.2, 10.0.0.3', '10.0.0.2, 10.0.0.3, 10.0.0.1'), - ); - } - - public function testXForwarderForHeaderForPassRequests() - { - $this->setNextResponse(); - $server = array('REMOTE_ADDR' => '10.0.0.1'); - $this->request('POST', '/', $server); - - $this->assertEquals('10.0.0.1', $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For')); - } - - public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses() - { - $time = \DateTime::createFromFormat('U', time()); - - $responses = array( - array( - 'status' => 200, - 'body' => '', - 'headers' => array( - 'Surrogate-Control' => 'content="ESI/1.0"', - 'ETag' => 'hey', - 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( - 'status' => 200, - 'body' => 'Hey!', - 'headers' => array(), - ), - ); - - $this->setNextResponses($responses); - - $this->request('GET', '/', array(), array(), true); - $this->assertNull($this->response->getETag()); - $this->assertNull($this->response->getLastModified()); - } - - public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponsesAndHeadRequest() - { - $time = \DateTime::createFromFormat('U', time()); - - $responses = array( - array( - 'status' => 200, - 'body' => '', - 'headers' => array( - 'Surrogate-Control' => 'content="ESI/1.0"', - 'ETag' => 'hey', - 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( - 'status' => 200, - 'body' => 'Hey!', - 'headers' => array(), - ), - ); - - $this->setNextResponses($responses); - - $this->request('HEAD', '/', array(), array(), true); - $this->assertEmpty($this->response->getContent()); - $this->assertNull($this->response->getETag()); - $this->assertNull($this->response->getLastModified()); - } - - public function testDoesNotCacheOptionsRequest() - { - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'get'); - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'options'); - $this->request('OPTIONS', '/'); - $this->assertHttpKernelIsCalled(); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertSame('get', $this->response->getContent()); - } -} - -class TestKernel implements HttpKernelInterface -{ - public $terminateCalled = false; - - public function terminate(Request $request, Response $response) - { - $this->terminateCalled = true; - } - - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) - { - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php deleted file mode 100644 index ed5c690..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpKernel\HttpCache\HttpCache; -use Symfony\Component\HttpKernel\HttpCache\Store; -use Symfony\Component\HttpKernel\HttpKernelInterface; - -class HttpCacheTestCase extends TestCase -{ - protected $kernel; - protected $cache; - protected $caches; - protected $cacheConfig; - protected $request; - protected $response; - protected $responses; - protected $catch; - protected $esi; - - /** - * @var Store - */ - protected $store; - - protected function setUp() - { - $this->kernel = null; - - $this->cache = null; - $this->esi = null; - $this->caches = array(); - $this->cacheConfig = array(); - - $this->request = null; - $this->response = null; - $this->responses = array(); - - $this->catch = false; - - $this->clearDirectory(sys_get_temp_dir().'/http_cache'); - } - - protected function tearDown() - { - if ($this->cache) { - $this->cache->getStore()->cleanup(); - } - $this->kernel = null; - $this->cache = null; - $this->caches = null; - $this->request = null; - $this->response = null; - $this->responses = null; - $this->cacheConfig = null; - $this->catch = null; - $this->esi = null; - - $this->clearDirectory(sys_get_temp_dir().'/http_cache'); - } - - public function assertHttpKernelIsCalled() - { - $this->assertTrue($this->kernel->hasBeenCalled()); - } - - public function assertHttpKernelIsNotCalled() - { - $this->assertFalse($this->kernel->hasBeenCalled()); - } - - public function assertResponseOk() - { - $this->assertEquals(200, $this->response->getStatusCode()); - } - - public function assertTraceContains($trace) - { - $traces = $this->cache->getTraces(); - $traces = current($traces); - - $this->assertRegExp('/'.$trace.'/', implode(', ', $traces)); - } - - public function assertTraceNotContains($trace) - { - $traces = $this->cache->getTraces(); - $traces = current($traces); - - $this->assertNotRegExp('/'.$trace.'/', implode(', ', $traces)); - } - - public function assertExceptionsAreCaught() - { - $this->assertTrue($this->kernel->isCatchingExceptions()); - } - - public function assertExceptionsAreNotCaught() - { - $this->assertFalse($this->kernel->isCatchingExceptions()); - } - - public function request($method, $uri = '/', $server = array(), $cookies = array(), $esi = false, $headers = array()) - { - if (null === $this->kernel) { - throw new \LogicException('You must call setNextResponse() before calling request().'); - } - - $this->kernel->reset(); - - $this->store = new Store(sys_get_temp_dir().'/http_cache'); - - $this->cacheConfig['debug'] = true; - - $this->esi = $esi ? new Esi() : null; - $this->cache = new HttpCache($this->kernel, $this->store, $this->esi, $this->cacheConfig); - $this->request = Request::create($uri, $method, array(), $cookies, array(), $server); - $this->request->headers->add($headers); - - $this->response = $this->cache->handle($this->request, HttpKernelInterface::MASTER_REQUEST, $this->catch); - - $this->responses[] = $this->response; - } - - public function getMetaStorageValues() - { - $values = array(); - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(sys_get_temp_dir().'/http_cache/md', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - $values[] = file_get_contents($file); - } - - return $values; - } - - // A basic response with 200 status code and a tiny body. - public function setNextResponse($statusCode = 200, array $headers = array(), $body = 'Hello World', \Closure $customizer = null) - { - $this->kernel = new TestHttpKernel($body, $statusCode, $headers, $customizer); - } - - public function setNextResponses($responses) - { - $this->kernel = new TestMultipleHttpKernel($responses); - } - - public function catchExceptions($catch = true) - { - $this->catch = $catch; - } - - public static function clearDirectory($directory) - { - if (!is_dir($directory)) { - return; - } - - $fp = opendir($directory); - while (false !== $file = readdir($fp)) { - if (!in_array($file, array('.', '..'))) { - if (is_link($directory.'/'.$file)) { - unlink($directory.'/'.$file); - } elseif (is_dir($directory.'/'.$file)) { - self::clearDirectory($directory.'/'.$file); - rmdir($directory.'/'.$file); - } else { - unlink($directory.'/'.$file); - } - } - } - - closedir($fp); - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php deleted file mode 100644 index 5e4c322..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php +++ /dev/null @@ -1,222 +0,0 @@ - - * - * This code is partially based on the Rack-Cache library by Ryan Tomayko, - * which is released under the MIT license. - * (based on commit 02d2b48d75bcb63cf1c0c7149c077ad256542801) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategy; - -class ResponseCacheStrategyTest extends TestCase -{ - public function testMinimumSharedMaxAgeWins() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $response1 = new Response(); - $response1->setSharedMaxAge(60); - $cacheStrategy->add($response1); - - $response2 = new Response(); - $response2->setSharedMaxAge(3600); - $cacheStrategy->add($response2); - - $response = new Response(); - $response->setSharedMaxAge(86400); - $cacheStrategy->update($response); - - $this->assertSame('60', $response->headers->getCacheControlDirective('s-maxage')); - } - - public function testSharedMaxAgeNotSetIfNotSetInAnyEmbeddedRequest() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $response1 = new Response(); - $response1->setSharedMaxAge(60); - $cacheStrategy->add($response1); - - $response2 = new Response(); - $cacheStrategy->add($response2); - - $response = new Response(); - $response->setSharedMaxAge(86400); - $cacheStrategy->update($response); - - $this->assertFalse($response->headers->hasCacheControlDirective('s-maxage')); - } - - public function testSharedMaxAgeNotSetIfNotSetInMasterRequest() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $response1 = new Response(); - $response1->setSharedMaxAge(60); - $cacheStrategy->add($response1); - - $response2 = new Response(); - $response2->setSharedMaxAge(3600); - $cacheStrategy->add($response2); - - $response = new Response(); - $cacheStrategy->update($response); - - $this->assertFalse($response->headers->hasCacheControlDirective('s-maxage')); - } - - public function testMasterResponseNotCacheableWhenEmbeddedResponseRequiresValidation() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $embeddedResponse = new Response(); - $embeddedResponse->setLastModified(new \DateTime()); - $cacheStrategy->add($embeddedResponse); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); - $cacheStrategy->update($masterResponse); - - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('no-cache')); - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('must-revalidate')); - $this->assertFalse($masterResponse->isFresh()); - } - - public function testValidationOnMasterResponseIsNotPossibleWhenItContainsEmbeddedResponses() - { - $cacheStrategy = new ResponseCacheStrategy(); - - // This master response uses the "validation" model - $masterResponse = new Response(); - $masterResponse->setLastModified(new \DateTime()); - $masterResponse->setEtag('foo'); - - // Embedded response uses "expiry" model - $embeddedResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); - $cacheStrategy->add($embeddedResponse); - - $cacheStrategy->update($masterResponse); - - $this->assertFalse($masterResponse->isValidateable()); - $this->assertFalse($masterResponse->headers->has('Last-Modified')); - $this->assertFalse($masterResponse->headers->has('ETag')); - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('no-cache')); - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('must-revalidate')); - } - - public function testMasterResponseWithValidationIsUnchangedWhenThereIsNoEmbeddedResponse() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setLastModified(new \DateTime()); - $cacheStrategy->update($masterResponse); - - $this->assertTrue($masterResponse->isValidateable()); - } - - public function testMasterResponseWithExpirationIsUnchangedWhenThereIsNoEmbeddedResponse() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); - $cacheStrategy->update($masterResponse); - - $this->assertTrue($masterResponse->isFresh()); - } - - public function testMasterResponseIsNotCacheableWhenEmbeddedResponseIsNotCacheable() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); // Public, cacheable - - /* This response has no validation or expiration information. - That makes it uncacheable, it is always stale. - (It does *not* make this private, though.) */ - $embeddedResponse = new Response(); - $this->assertFalse($embeddedResponse->isFresh()); // not fresh, as no lifetime is provided - - $cacheStrategy->add($embeddedResponse); - $cacheStrategy->update($masterResponse); - - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('no-cache')); - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('must-revalidate')); - $this->assertFalse($masterResponse->isFresh()); - } - - public function testEmbeddingPrivateResponseMakesMainResponsePrivate() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); // public, cacheable - - // The embedded response might for example contain per-user data that remains valid for 60 seconds - $embeddedResponse = new Response(); - $embeddedResponse->setPrivate(); - $embeddedResponse->setMaxAge(60); // this would implicitly set "private" as well, but let's be explicit - - $cacheStrategy->add($embeddedResponse); - $cacheStrategy->update($masterResponse); - - $this->assertTrue($masterResponse->headers->hasCacheControlDirective('private')); - // Not sure if we should pass "max-age: 60" in this case, as long as the response is private and - // that's the more conservative of both the master and embedded response...? - } - - public function testResponseIsExiprableWhenEmbeddedResponseCombinesExpiryAndValidation() - { - /* When "expiration wins over validation" (https://symfony.com/doc/current/http_cache/validation.html) - * and both the main and embedded response provide s-maxage, then the more restricting value of both - * should be fine, regardless of whether the embedded response can be validated later on or must be - * completely regenerated. - */ - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); - - $embeddedResponse = new Response(); - $embeddedResponse->setSharedMaxAge(60); - $embeddedResponse->setEtag('foo'); - - $cacheStrategy->add($embeddedResponse); - $cacheStrategy->update($masterResponse); - - $this->assertSame('60', $masterResponse->headers->getCacheControlDirective('s-maxage')); - } - - public function testResponseIsExpirableButNotValidateableWhenMasterResponseCombinesExpirationAndValidation() - { - $cacheStrategy = new ResponseCacheStrategy(); - - $masterResponse = new Response(); - $masterResponse->setSharedMaxAge(3600); - $masterResponse->setEtag('foo'); - $masterResponse->setLastModified(new \DateTime()); - - $embeddedResponse = new Response(); - $embeddedResponse->setSharedMaxAge(60); - - $cacheStrategy->add($embeddedResponse); - $cacheStrategy->update($masterResponse); - - $this->assertSame('60', $masterResponse->headers->getCacheControlDirective('s-maxage')); - $this->assertFalse($masterResponse->isValidateable()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php deleted file mode 100644 index 1079d37..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php +++ /dev/null @@ -1,215 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpCache\Ssi; - -class SsiTest extends TestCase -{ - public function testHasSurrogateSsiCapability() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $request->headers->set('Surrogate-Capability', 'abc="SSI/1.0"'); - $this->assertTrue($ssi->hasSurrogateCapability($request)); - - $request = Request::create('/'); - $request->headers->set('Surrogate-Capability', 'foobar'); - $this->assertFalse($ssi->hasSurrogateCapability($request)); - - $request = Request::create('/'); - $this->assertFalse($ssi->hasSurrogateCapability($request)); - } - - public function testAddSurrogateSsiCapability() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $ssi->addSurrogateCapability($request); - $this->assertEquals('symfony="SSI/1.0"', $request->headers->get('Surrogate-Capability')); - - $ssi->addSurrogateCapability($request); - $this->assertEquals('symfony="SSI/1.0", symfony="SSI/1.0"', $request->headers->get('Surrogate-Capability')); - } - - public function testAddSurrogateControl() - { - $ssi = new Ssi(); - - $response = new Response('foo '); - $ssi->addSurrogateControl($response); - $this->assertEquals('content="SSI/1.0"', $response->headers->get('Surrogate-Control')); - - $response = new Response('foo'); - $ssi->addSurrogateControl($response); - $this->assertEquals('', $response->headers->get('Surrogate-Control')); - } - - public function testNeedsSsiParsing() - { - $ssi = new Ssi(); - - $response = new Response(); - $response->headers->set('Surrogate-Control', 'content="SSI/1.0"'); - $this->assertTrue($ssi->needsParsing($response)); - - $response = new Response(); - $this->assertFalse($ssi->needsParsing($response)); - } - - public function testRenderIncludeTag() - { - $ssi = new Ssi(); - - $this->assertEquals('', $ssi->renderIncludeTag('/', '/alt', true)); - $this->assertEquals('', $ssi->renderIncludeTag('/', '/alt', false)); - $this->assertEquals('', $ssi->renderIncludeTag('/')); - } - - public function testProcessDoesNothingIfContentTypeIsNotHtml() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $response = new Response(); - $response->headers->set('Content-Type', 'text/plain'); - $ssi->process($request, $response); - - $this->assertFalse($response->headers->has('x-body-eval')); - } - - public function testProcess() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $ssi->process($request, $response); - - $this->assertEquals('foo surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent()); - $this->assertEquals('SSI', $response->headers->get('x-body-eval')); - - $response = new Response('foo '); - $ssi->process($request, $response); - - $this->assertEquals("foo surrogate->handle(\$this, 'foo\\'', '', false) ?>"."\n", $response->getContent()); - } - - public function testProcessEscapesPhpTags() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $response = new Response(''); - $ssi->process($request, $response); - - $this->assertEquals('php cript language=php>', $response->getContent()); - } - - /** - * @expectedException \RuntimeException - */ - public function testProcessWhenNoSrcInAnSsi() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $ssi->process($request, $response); - } - - public function testProcessRemoveSurrogateControlHeader() - { - $ssi = new Ssi(); - - $request = Request::create('/'); - $response = new Response('foo '); - $response->headers->set('Surrogate-Control', 'content="SSI/1.0"'); - $ssi->process($request, $response); - $this->assertEquals('SSI', $response->headers->get('x-body-eval')); - - $response->headers->set('Surrogate-Control', 'no-store, content="SSI/1.0"'); - $ssi->process($request, $response); - $this->assertEquals('SSI', $response->headers->get('x-body-eval')); - $this->assertEquals('no-store', $response->headers->get('surrogate-control')); - - $response->headers->set('Surrogate-Control', 'content="SSI/1.0", no-store'); - $ssi->process($request, $response); - $this->assertEquals('SSI', $response->headers->get('x-body-eval')); - $this->assertEquals('no-store', $response->headers->get('surrogate-control')); - } - - public function testHandle() - { - $ssi = new Ssi(); - $cache = $this->getCache(Request::create('/'), new Response('foo')); - $this->assertEquals('foo', $ssi->handle($cache, '/', '/alt', true)); - } - - /** - * @expectedException \RuntimeException - */ - public function testHandleWhenResponseIsNot200() - { - $ssi = new Ssi(); - $response = new Response('foo'); - $response->setStatusCode(404); - $cache = $this->getCache(Request::create('/'), $response); - $ssi->handle($cache, '/', '/alt', false); - } - - public function testHandleWhenResponseIsNot200AndErrorsAreIgnored() - { - $ssi = new Ssi(); - $response = new Response('foo'); - $response->setStatusCode(404); - $cache = $this->getCache(Request::create('/'), $response); - $this->assertEquals('', $ssi->handle($cache, '/', '/alt', true)); - } - - public function testHandleWhenResponseIsNot200AndAltIsPresent() - { - $ssi = new Ssi(); - $response1 = new Response('foo'); - $response1->setStatusCode(404); - $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); - $this->assertEquals('bar', $ssi->handle($cache, '/', '/alt', false)); - } - - protected function getCache($request, $response) - { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); - $cache->expects($this->any()) - ->method('getRequest') - ->will($this->returnValue($request)) - ; - if (is_array($response)) { - $cache->expects($this->any()) - ->method('handle') - ->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) - ; - } else { - $cache->expects($this->any()) - ->method('handle') - ->will($this->returnValue($response)) - ; - } - - return $cache; - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php deleted file mode 100644 index cef0191..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php +++ /dev/null @@ -1,301 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpCache\Store; - -class StoreTest extends TestCase -{ - protected $request; - protected $response; - - /** - * @var Store - */ - protected $store; - - protected function setUp() - { - $this->request = Request::create('/'); - $this->response = new Response('hello world', 200, array()); - - HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); - - $this->store = new Store(sys_get_temp_dir().'/http_cache'); - } - - protected function tearDown() - { - $this->store = null; - $this->request = null; - $this->response = null; - - HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); - } - - public function testReadsAnEmptyArrayWithReadWhenNothingCachedAtKey() - { - $this->assertEmpty($this->getStoreMetadata('/nothing')); - } - - public function testUnlockFileThatDoesExist() - { - $cacheKey = $this->storeSimpleEntry(); - $this->store->lock($this->request); - - $this->assertTrue($this->store->unlock($this->request)); - } - - public function testUnlockFileThatDoesNotExist() - { - $this->assertFalse($this->store->unlock($this->request)); - } - - public function testRemovesEntriesForKeyWithPurge() - { - $request = Request::create('/foo'); - $this->store->write($request, new Response('foo')); - - $metadata = $this->getStoreMetadata($request); - $this->assertNotEmpty($metadata); - - $this->assertTrue($this->store->purge('/foo')); - $this->assertEmpty($this->getStoreMetadata($request)); - - // cached content should be kept after purging - $path = $this->store->getPath($metadata[0][1]['x-content-digest'][0]); - $this->assertTrue(is_file($path)); - - $this->assertFalse($this->store->purge('/bar')); - } - - public function testStoresACacheEntry() - { - $cacheKey = $this->storeSimpleEntry(); - - $this->assertNotEmpty($this->getStoreMetadata($cacheKey)); - } - - public function testSetsTheXContentDigestResponseHeaderBeforeStoring() - { - $cacheKey = $this->storeSimpleEntry(); - $entries = $this->getStoreMetadata($cacheKey); - list($req, $res) = $entries[0]; - - $this->assertEquals('en9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', $res['x-content-digest'][0]); - } - - public function testFindsAStoredEntryWithLookup() - { - $this->storeSimpleEntry(); - $response = $this->store->lookup($this->request); - - $this->assertNotNull($response); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); - } - - public function testDoesNotFindAnEntryWithLookupWhenNoneExists() - { - $request = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - - $this->assertNull($this->store->lookup($request)); - } - - public function testCanonizesUrlsForCacheKeys() - { - $this->storeSimpleEntry($path = '/test?x=y&p=q'); - $hitsReq = Request::create($path); - $missReq = Request::create('/test?p=x'); - - $this->assertNotNull($this->store->lookup($hitsReq)); - $this->assertNull($this->store->lookup($missReq)); - } - - public function testDoesNotFindAnEntryWithLookupWhenTheBodyDoesNotExist() - { - $this->storeSimpleEntry(); - $this->assertNotNull($this->response->headers->get('X-Content-Digest')); - $path = $this->getStorePath($this->response->headers->get('X-Content-Digest')); - @unlink($path); - $this->assertNull($this->store->lookup($this->request)); - } - - public function testRestoresResponseHeadersProperlyWithLookup() - { - $this->storeSimpleEntry(); - $response = $this->store->lookup($this->request); - - $this->assertEquals($response->headers->all(), array_merge(array('content-length' => 4, 'x-body-file' => array($this->getStorePath($response->headers->get('X-Content-Digest')))), $this->response->headers->all())); - } - - public function testRestoresResponseContentFromEntityStoreWithLookup() - { - $this->storeSimpleEntry(); - $response = $this->store->lookup($this->request); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test')), $response->getContent()); - } - - public function testInvalidatesMetaAndEntityStoreEntriesWithInvalidate() - { - $this->storeSimpleEntry(); - $this->store->invalidate($this->request); - $response = $this->store->lookup($this->request); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); - $this->assertFalse($response->isFresh()); - } - - public function testSucceedsQuietlyWhenInvalidateCalledWithNoMatchingEntries() - { - $req = Request::create('/test'); - $this->store->invalidate($req); - $this->assertNull($this->store->lookup($this->request)); - } - - public function testDoesNotReturnEntriesThatVaryWithLookup() - { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => 'Foo Bar')); - $this->store->write($req1, $res); - - $this->assertNull($this->store->lookup($req2)); - } - - public function testDoesNotReturnEntriesThatSlightlyVaryWithLookup() - { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => array('Foo', 'Bar'))); - $this->store->write($req1, $res); - - $this->assertNull($this->store->lookup($req2)); - } - - public function testStoresMultipleResponsesForEachVaryCombination() - { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); - $key = $this->store->write($req1, $res1); - - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); - $this->store->write($req2, $res2); - - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); - $this->store->write($req3, $res3); - - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 2')), $this->store->lookup($req2)->getContent()); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); - - $this->assertCount(3, $this->getStoreMetadata($key)); - } - - public function testOverwritesNonVaryingResponseWithStore() - { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); - $key = $this->store->write($req1, $res1); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); - - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); - $this->store->write($req2, $res2); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 2')), $this->store->lookup($req2)->getContent()); - - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); - $key = $this->store->write($req3, $res3); - $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); - - $this->assertCount(2, $this->getStoreMetadata($key)); - } - - public function testLocking() - { - $req = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $this->assertTrue($this->store->lock($req)); - - $path = $this->store->lock($req); - $this->assertTrue($this->store->isLocked($req)); - - $this->store->unlock($req); - $this->assertFalse($this->store->isLocked($req)); - } - - public function testPurgeHttps() - { - $request = Request::create('https://example.com/foo'); - $this->store->write($request, new Response('foo')); - - $this->assertNotEmpty($this->getStoreMetadata($request)); - - $this->assertTrue($this->store->purge('https://example.com/foo')); - $this->assertEmpty($this->getStoreMetadata($request)); - } - - public function testPurgeHttpAndHttps() - { - $requestHttp = Request::create('https://example.com/foo'); - $this->store->write($requestHttp, new Response('foo')); - - $requestHttps = Request::create('http://example.com/foo'); - $this->store->write($requestHttps, new Response('foo')); - - $this->assertNotEmpty($this->getStoreMetadata($requestHttp)); - $this->assertNotEmpty($this->getStoreMetadata($requestHttps)); - - $this->assertTrue($this->store->purge('http://example.com/foo')); - $this->assertEmpty($this->getStoreMetadata($requestHttp)); - $this->assertEmpty($this->getStoreMetadata($requestHttps)); - } - - protected function storeSimpleEntry($path = null, $headers = array()) - { - if (null === $path) { - $path = '/test'; - } - - $this->request = Request::create($path, 'get', array(), array(), array(), $headers); - $this->response = new Response('test', 200, array('Cache-Control' => 'max-age=420')); - - return $this->store->write($this->request, $this->response); - } - - protected function getStoreMetadata($key) - { - $r = new \ReflectionObject($this->store); - $m = $r->getMethod('getMetadata'); - $m->setAccessible(true); - - if ($key instanceof Request) { - $m1 = $r->getMethod('getCacheKey'); - $m1->setAccessible(true); - $key = $m1->invoke($this->store, $key); - } - - return $m->invoke($this->store, $key); - } - - protected function getStorePath($key) - { - $r = new \ReflectionObject($this->store); - $m = $r->getMethod('getPath'); - $m->setAccessible(true); - - return $m->invoke($this->store, $key); - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php deleted file mode 100644 index 946c7a3..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface -{ - protected $body; - protected $status; - protected $headers; - protected $called = false; - protected $customizer; - protected $catch = false; - protected $backendRequest; - - public function __construct($body, $status, $headers, \Closure $customizer = null) - { - $this->body = $body; - $this->status = $status; - $this->headers = $headers; - $this->customizer = $customizer; - - parent::__construct(new EventDispatcher(), $this, null, $this); - } - - public function getBackendRequest() - { - return $this->backendRequest; - } - - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) - { - $this->catch = $catch; - $this->backendRequest = $request; - - return parent::handle($request, $type, $catch); - } - - public function isCatchingExceptions() - { - return $this->catch; - } - - public function getController(Request $request) - { - return array($this, 'callController'); - } - - public function getArguments(Request $request, $controller) - { - return array($request); - } - - public function callController(Request $request) - { - $this->called = true; - - $response = new Response($this->body, $this->status, $this->headers); - - if (null !== $customizer = $this->customizer) { - $customizer($request, $response); - } - - return $response; - } - - public function hasBeenCalled() - { - return $this->called; - } - - public function reset() - { - $this->called = false; - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php deleted file mode 100644 index 926d8da..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\HttpCache; - -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface -{ - protected $bodies = array(); - protected $statuses = array(); - protected $headers = array(); - protected $called = false; - protected $backendRequest; - - public function __construct($responses) - { - foreach ($responses as $response) { - $this->bodies[] = $response['body']; - $this->statuses[] = $response['status']; - $this->headers[] = $response['headers']; - } - - parent::__construct(new EventDispatcher(), $this, null, $this); - } - - public function getBackendRequest() - { - return $this->backendRequest; - } - - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) - { - $this->backendRequest = $request; - - return parent::handle($request, $type, $catch); - } - - public function getController(Request $request) - { - return array($this, 'callController'); - } - - public function getArguments(Request $request, $controller) - { - return array($request); - } - - public function callController(Request $request) - { - $this->called = true; - - $response = new Response(array_shift($this->bodies), array_shift($this->statuses), array_shift($this->headers)); - - return $response; - } - - public function hasBeenCalled() - { - return $this->called; - } - - public function reset() - { - $this->called = false; - } -} diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php deleted file mode 100644 index 7aed26a..0000000 --- a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php +++ /dev/null @@ -1,403 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class HttpKernelTest extends TestCase -{ - /** - * @expectedException \RuntimeException - */ - public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue() - { - $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }); - - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); - } - - /** - * @expectedException \RuntimeException - */ - public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered() - { - $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }); - - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false); - } - - public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { - $event->setResponse(new Response($event->getException()->getMessage())); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { throw new \RuntimeException('foo'); }); - $response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); - - $this->assertEquals('500', $response->getStatusCode()); - $this->assertEquals('foo', $response->getContent()); - } - - public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener() - { - $exception = new \RuntimeException(); - - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { - // should set a response, but does not - }); - - $kernel = $this->getHttpKernel($dispatcher, function () use ($exception) { throw $exception; }); - - try { - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); - $this->fail('LogicException expected'); - } catch (\RuntimeException $e) { - $this->assertSame($exception, $e); - } - } - - public function testHandleExceptionWithARedirectionResponse() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { - $event->setResponse(new RedirectResponse('/login', 301)); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { throw new AccessDeniedHttpException(); }); - $response = $kernel->handle(new Request()); - - $this->assertEquals('301', $response->getStatusCode()); - $this->assertEquals('/login', $response->headers->get('Location')); - } - - public function testHandleHttpException() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { - $event->setResponse(new Response($event->getException()->getMessage())); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { throw new MethodNotAllowedHttpException(array('POST')); }); - $response = $kernel->handle(new Request()); - - $this->assertEquals('405', $response->getStatusCode()); - $this->assertEquals('POST', $response->headers->get('Allow')); - } - - /** - * @group legacy - * @dataProvider getStatusCodes - */ - public function testLegacyHandleWhenAnExceptionIsHandledWithASpecificStatusCode($responseStatusCode, $expectedStatusCode) - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) use ($responseStatusCode, $expectedStatusCode) { - $event->setResponse(new Response('', $responseStatusCode, array('X-Status-Code' => $expectedStatusCode))); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { throw new \RuntimeException(); }); - $response = $kernel->handle(new Request()); - - $this->assertEquals($expectedStatusCode, $response->getStatusCode()); - $this->assertFalse($response->headers->has('X-Status-Code')); - } - - public function getStatusCodes() - { - return array( - array(200, 404), - array(404, 200), - array(301, 200), - array(500, 200), - ); - } - - /** - * @dataProvider getSpecificStatusCodes - */ - public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($expectedStatusCode) - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function (GetResponseForExceptionEvent $event) use ($expectedStatusCode) { - $event->allowCustomResponseCode(); - $event->setResponse(new Response('', $expectedStatusCode)); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { throw new \RuntimeException(); }); - $response = $kernel->handle(new Request()); - - $this->assertEquals($expectedStatusCode, $response->getStatusCode()); - } - - public function getSpecificStatusCodes() - { - return array( - array(200), - array(302), - array(403), - ); - } - - public function testHandleWhenAListenerReturnsAResponse() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::REQUEST, function ($event) { - $event->setResponse(new Response('hello')); - }); - - $kernel = $this->getHttpKernel($dispatcher); - - $this->assertEquals('hello', $kernel->handle(new Request())->getContent()); - } - - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException - */ - public function testHandleWhenNoControllerIsFound() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, false); - - $kernel->handle(new Request()); - } - - public function testHandleWhenTheControllerIsAClosure() - { - $response = new Response('foo'); - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, function () use ($response) { return $response; }); - - $this->assertSame($response, $kernel->handle(new Request())); - } - - public function testHandleWhenTheControllerIsAnObjectWithInvoke() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, new Controller()); - - $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); - } - - public function testHandleWhenTheControllerIsAFunction() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, 'Symfony\Component\HttpKernel\Tests\controller_func'); - - $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); - } - - public function testHandleWhenTheControllerIsAnArray() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array(new Controller(), 'controller')); - - $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); - } - - public function testHandleWhenTheControllerIsAStaticArray() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array('Symfony\Component\HttpKernel\Tests\Controller', 'staticcontroller')); - - $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); - } - - /** - * @expectedException \LogicException - */ - public function testHandleWhenTheControllerDoesNotReturnAResponse() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, function () { return 'foo'; }); - - $kernel->handle(new Request()); - } - - public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::VIEW, function ($event) { - $event->setResponse(new Response($event->getControllerResult())); - }); - - $kernel = $this->getHttpKernel($dispatcher, function () { return 'foo'; }); - - $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); - } - - public function testHandleWithAResponseListener() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::RESPONSE, function ($event) { - $event->setResponse(new Response('foo')); - }); - $kernel = $this->getHttpKernel($dispatcher); - - $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); - } - - public function testHandleAllowChangingControllerArguments() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::CONTROLLER_ARGUMENTS, function (FilterControllerArgumentsEvent $event) { - $event->setArguments(array('foo')); - }); - - $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }); - - $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); - } - - public function testHandleAllowChangingControllerAndArguments() - { - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::CONTROLLER_ARGUMENTS, function (FilterControllerArgumentsEvent $event) { - $oldController = $event->getController(); - $oldArguments = $event->getArguments(); - - $newController = function ($id) use ($oldController, $oldArguments) { - $response = call_user_func_array($oldController, $oldArguments); - - $response->headers->set('X-Id', $id); - - return $response; - }; - - $event->setController($newController); - $event->setArguments(array('bar')); - }); - - $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }, null, array('foo')); - - $this->assertResponseEquals(new Response('foo', 200, array('X-Id' => 'bar')), $kernel->handle(new Request())); - } - - public function testTerminate() - { - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher); - $dispatcher->addListener(KernelEvents::TERMINATE, function ($event) use (&$called, &$capturedKernel, &$capturedRequest, &$capturedResponse) { - $called = true; - $capturedKernel = $event->getKernel(); - $capturedRequest = $event->getRequest(); - $capturedResponse = $event->getResponse(); - }); - - $kernel->terminate($request = Request::create('/'), $response = new Response()); - $this->assertTrue($called); - $this->assertEquals($kernel, $capturedKernel); - $this->assertEquals($request, $capturedRequest); - $this->assertEquals($response, $capturedResponse); - } - - public function testVerifyRequestStackPushPopDuringHandle() - { - $request = new Request(); - - $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(array('push', 'pop'))->getMock(); - $stack->expects($this->at(0))->method('push')->with($this->equalTo($request)); - $stack->expects($this->at(1))->method('pop'); - - $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, null, $stack); - - $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST); - } - - /** - * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException - */ - public function testInconsistentClientIpsOnMasterRequests() - { - $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); - $request->server->set('REMOTE_ADDR', '1.1.1.1'); - $request->headers->set('FORWARDED', 'for=2.2.2.2'); - $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); - - $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::REQUEST, function ($event) { - $event->getRequest()->getClientIp(); - }); - - $kernel = $this->getHttpKernel($dispatcher); - $kernel->handle($request, $kernel::MASTER_REQUEST, false); - } - - private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = array()) - { - if (null === $controller) { - $controller = function () { return new Response('Hello'); }; - } - - $controllerResolver = $this->getMockBuilder(ControllerResolverInterface::class)->getMock(); - $controllerResolver - ->expects($this->any()) - ->method('getController') - ->will($this->returnValue($controller)); - - $argumentResolver = $this->getMockBuilder(ArgumentResolverInterface::class)->getMock(); - $argumentResolver - ->expects($this->any()) - ->method('getArguments') - ->will($this->returnValue($arguments)); - - return new HttpKernel($eventDispatcher, $controllerResolver, $requestStack, $argumentResolver); - } - - private function assertResponseEquals(Response $expected, Response $actual) - { - $expected->setDate($actual->getDate()); - $this->assertEquals($expected, $actual); - } -} - -class Controller -{ - public function __invoke() - { - return new Response('foo'); - } - - public function controller() - { - return new Response('foo'); - } - - public static function staticController() - { - return new Response('foo'); - } -} - -function controller_func() -{ - return new Response('foo'); -} diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php deleted file mode 100644 index 052e576..0000000 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ /dev/null @@ -1,907 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\EnvParametersResource; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; -use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; -use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles; - -class KernelTest extends TestCase -{ - public static function tearDownAfterClass() - { - $fs = new Filesystem(); - $fs->remove(__DIR__.'/Fixtures/cache'); - } - - public function testConstructor() - { - $env = 'test_env'; - $debug = true; - $kernel = new KernelForTest($env, $debug); - - $this->assertEquals($env, $kernel->getEnvironment()); - $this->assertEquals($debug, $kernel->isDebug()); - $this->assertFalse($kernel->isBooted()); - $this->assertLessThanOrEqual(microtime(true), $kernel->getStartTime()); - $this->assertNull($kernel->getContainer()); - } - - public function testClone() - { - $env = 'test_env'; - $debug = true; - $kernel = new KernelForTest($env, $debug); - - $clone = clone $kernel; - - $this->assertEquals($env, $clone->getEnvironment()); - $this->assertEquals($debug, $clone->isDebug()); - $this->assertFalse($clone->isBooted()); - $this->assertLessThanOrEqual(microtime(true), $clone->getStartTime()); - $this->assertNull($clone->getContainer()); - } - - public function testBootInitializesBundlesAndContainer() - { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); - $kernel->expects($this->once()) - ->method('initializeBundles'); - $kernel->expects($this->once()) - ->method('initializeContainer'); - - $kernel->boot(); - } - - public function testBootSetsTheContainerToTheBundles() - { - $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock(); - $bundle->expects($this->once()) - ->method('setContainer'); - - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'getBundles')); - $kernel->expects($this->once()) - ->method('getBundles') - ->will($this->returnValue(array($bundle))); - - $kernel->boot(); - } - - public function testBootSetsTheBootedFlagToTrue() - { - // use test kernel to access isBooted() - $kernel = $this->getKernelForTest(array('initializeBundles', 'initializeContainer')); - $kernel->boot(); - - $this->assertTrue($kernel->isBooted()); - } - - /** - * @group legacy - */ - public function testClassCacheIsLoaded() - { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); - $kernel->loadClassCache('name', '.extension'); - $kernel->expects($this->once()) - ->method('doLoadClassCache') - ->with('name', '.extension'); - - $kernel->boot(); - } - - public function testClassCacheIsNotLoadedByDefault() - { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); - $kernel->expects($this->never()) - ->method('doLoadClassCache'); - - $kernel->boot(); - } - - /** - * @group legacy - */ - public function testClassCacheIsNotLoadedWhenKernelIsNotBooted() - { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); - $kernel->loadClassCache(); - $kernel->expects($this->never()) - ->method('doLoadClassCache'); - } - - public function testEnvParametersResourceIsAdded() - { - $container = new ContainerBuilder(); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->disableOriginalConstructor() - ->setMethods(array('getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir')) - ->getMock(); - $kernel->expects($this->any()) - ->method('getContainerBuilder') - ->will($this->returnValue($container)); - $kernel->expects($this->any()) - ->method('prepareContainer') - ->will($this->returnValue(null)); - $kernel->expects($this->any()) - ->method('getCacheDir') - ->will($this->returnValue(sys_get_temp_dir())); - $kernel->expects($this->any()) - ->method('getLogDir') - ->will($this->returnValue(sys_get_temp_dir())); - - $reflection = new \ReflectionClass(get_class($kernel)); - $method = $reflection->getMethod('buildContainer'); - $method->setAccessible(true); - $method->invoke($kernel); - - $found = false; - foreach ($container->getResources() as $resource) { - if ($resource instanceof EnvParametersResource) { - $found = true; - break; - } - } - - $this->assertTrue($found); - } - - public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce() - { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); - $kernel->expects($this->once()) - ->method('initializeBundles'); - - $kernel->boot(); - $kernel->boot(); - } - - public function testShutdownCallsShutdownOnAllBundles() - { - $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock(); - $bundle->expects($this->once()) - ->method('shutdown'); - - $kernel = $this->getKernel(array(), array($bundle)); - - $kernel->boot(); - $kernel->shutdown(); - } - - public function testShutdownGivesNullContainerToAllBundles() - { - $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock(); - $bundle->expects($this->at(3)) - ->method('setContainer') - ->with(null); - - $kernel = $this->getKernel(array('getBundles')); - $kernel->expects($this->any()) - ->method('getBundles') - ->will($this->returnValue(array($bundle))); - - $kernel->boot(); - $kernel->shutdown(); - } - - public function testHandleCallsHandleOnHttpKernel() - { - $type = HttpKernelInterface::MASTER_REQUEST; - $catch = true; - $request = new Request(); - - $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') - ->disableOriginalConstructor() - ->getMock(); - $httpKernelMock - ->expects($this->once()) - ->method('handle') - ->with($request, $type, $catch); - - $kernel = $this->getKernel(array('getHttpKernel')); - $kernel->expects($this->once()) - ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); - - $kernel->handle($request, $type, $catch); - } - - public function testHandleBootsTheKernel() - { - $type = HttpKernelInterface::MASTER_REQUEST; - $catch = true; - $request = new Request(); - - $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') - ->disableOriginalConstructor() - ->getMock(); - - $kernel = $this->getKernel(array('getHttpKernel', 'boot')); - $kernel->expects($this->once()) - ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); - - $kernel->expects($this->once()) - ->method('boot'); - - $kernel->handle($request, $type, $catch); - } - - public function testStripComments() - { - $source = <<<'EOF' -assertEquals($expected, $output); - } - - public function testGetRootDir() - { - $kernel = new KernelForTest('test', true); - - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir())); - } - - public function testGetName() - { - $kernel = new KernelForTest('test', true); - - $this->assertEquals('Fixtures', $kernel->getName()); - } - - public function testOverrideGetName() - { - $kernel = new KernelForOverrideName('test', true); - - $this->assertEquals('overridden', $kernel->getName()); - } - - public function testSerialize() - { - $env = 'test_env'; - $debug = true; - $kernel = new KernelForTest($env, $debug); - - $expected = serialize(array($env, $debug)); - $this->assertEquals($expected, $kernel->serialize()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLocateResourceThrowsExceptionWhenNameIsNotValid() - { - $this->getKernel()->locateResource('Foo'); - } - - /** - * @expectedException \RuntimeException - */ - public function testLocateResourceThrowsExceptionWhenNameIsUnsafe() - { - $this->getKernel()->locateResource('@FooBundle/../bar'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLocateResourceThrowsExceptionWhenBundleDoesNotExist() - { - $this->getKernel()->locateResource('@FooBundle/config/routing.xml'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) - ; - - $kernel->locateResource('@Bundle1Bundle/config/routing.xml'); - } - - public function testLocateResourceReturnsTheFirstThatMatches() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) - ; - - $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt')); - } - - public function testLocateResourceReturnsTheFirstThatMatchesWithParent() - { - $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); - $child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle'); - - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->exactly(2)) - ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) - ; - - $this->assertEquals(__DIR__.'/Fixtures/Bundle2Bundle/foo.txt', $kernel->locateResource('@ParentAABundle/foo.txt')); - $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/bar.txt', $kernel->locateResource('@ParentAABundle/bar.txt')); - } - - public function testLocateResourceReturnsAllMatches() - { - $parent = $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'); - $child = $this->getBundle(__DIR__.'/Fixtures/Bundle2Bundle'); - - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) - ; - - $this->assertEquals(array( - __DIR__.'/Fixtures/Bundle2Bundle/foo.txt', - __DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ), - $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)); - } - - public function testLocateResourceReturnsAllMatchesBis() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array( - $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'), - $this->getBundle(__DIR__.'/Foobar'), - ))) - ; - - $this->assertEquals( - array(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt'), - $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false) - ); - } - - public function testLocateResourceIgnoresDirOnNonResource() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')))) - ; - - $this->assertEquals( - __DIR__.'/Fixtures/Bundle1Bundle/foo.txt', - $kernel->locateResource('@Bundle1Bundle/foo.txt', __DIR__.'/Fixtures') - ); - } - - public function testLocateResourceReturnsTheDirOneForResources() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))) - ; - - $this->assertEquals( - __DIR__.'/Fixtures/Resources/FooBundle/foo.txt', - $kernel->locateResource('@FooBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources') - ); - } - - public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->once()) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))) - ; - - $this->assertEquals(array( - __DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt', - __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ), - $kernel->locateResource('@Bundle1Bundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false) - ); - } - - public function testLocateResourceOverrideBundleAndResourcesFolders() - { - $parent = $this->getBundle(__DIR__.'/Fixtures/BaseBundle', null, 'BaseBundle', 'BaseBundle'); - $child = $this->getBundle(__DIR__.'/Fixtures/ChildBundle', 'ParentBundle', 'ChildBundle', 'ChildBundle'); - - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->exactly(4)) - ->method('getBundle') - ->will($this->returnValue(array($child, $parent))) - ; - - $this->assertEquals(array( - __DIR__.'/Fixtures/Resources/ChildBundle/foo.txt', - __DIR__.'/Fixtures/ChildBundle/Resources/foo.txt', - __DIR__.'/Fixtures/BaseBundle/Resources/foo.txt', - ), - $kernel->locateResource('@BaseBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false) - ); - - $this->assertEquals( - __DIR__.'/Fixtures/Resources/ChildBundle/foo.txt', - $kernel->locateResource('@BaseBundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources') - ); - - try { - $kernel->locateResource('@BaseBundle/Resources/hide.txt', __DIR__.'/Fixtures/Resources', false); - $this->fail('Hidden resources should raise an exception when returning an array of matching paths'); - } catch (\RuntimeException $e) { - } - - try { - $kernel->locateResource('@BaseBundle/Resources/hide.txt', __DIR__.'/Fixtures/Resources', true); - $this->fail('Hidden resources should raise an exception when returning the first matching path'); - } catch (\RuntimeException $e) { - } - } - - public function testLocateResourceOnDirectories() - { - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->exactly(2)) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')))) - ; - - $this->assertEquals( - __DIR__.'/Fixtures/Resources/FooBundle/', - $kernel->locateResource('@FooBundle/Resources/', __DIR__.'/Fixtures/Resources') - ); - $this->assertEquals( - __DIR__.'/Fixtures/Resources/FooBundle', - $kernel->locateResource('@FooBundle/Resources', __DIR__.'/Fixtures/Resources') - ); - - $kernel = $this->getKernel(array('getBundle')); - $kernel - ->expects($this->exactly(2)) - ->method('getBundle') - ->will($this->returnValue(array($this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')))) - ; - - $this->assertEquals( - __DIR__.'/Fixtures/Bundle1Bundle/Resources/', - $kernel->locateResource('@Bundle1Bundle/Resources/') - ); - $this->assertEquals( - __DIR__.'/Fixtures/Bundle1Bundle/Resources', - $kernel->locateResource('@Bundle1Bundle/Resources') - ); - } - - public function testInitializeBundles() - { - $parent = $this->getBundle(null, null, 'ParentABundle'); - $child = $this->getBundle(null, 'ParentABundle', 'ChildABundle'); - - // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); - $kernel - ->expects($this->once()) - ->method('registerBundles') - ->will($this->returnValue(array($parent, $child))) - ; - $kernel->boot(); - - $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent), $map['ParentABundle']); - } - - public function testInitializeBundlesSupportInheritanceCascade() - { - $grandparent = $this->getBundle(null, null, 'GrandParentBBundle'); - $parent = $this->getBundle(null, 'GrandParentBBundle', 'ParentBBundle'); - $child = $this->getBundle(null, 'ParentBBundle', 'ChildBBundle'); - - // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); - $kernel - ->expects($this->once()) - ->method('registerBundles') - ->will($this->returnValue(array($grandparent, $parent, $child))) - ; - $kernel->boot(); - - $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentBBundle']); - $this->assertEquals(array($child, $parent), $map['ParentBBundle']); - $this->assertEquals(array($child), $map['ChildBBundle']); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Bundle "ChildCBundle" extends bundle "FooBar", which is not registered. - */ - public function testInitializeBundlesThrowsExceptionWhenAParentDoesNotExists() - { - $child = $this->getBundle(null, 'FooBar', 'ChildCBundle'); - $kernel = $this->getKernel(array(), array($child)); - $kernel->boot(); - } - - public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder() - { - $grandparent = $this->getBundle(null, null, 'GrandParentCBundle'); - $parent = $this->getBundle(null, 'GrandParentCBundle', 'ParentCBundle'); - $child = $this->getBundle(null, 'ParentCBundle', 'ChildCBundle'); - - // use test kernel so we can access getBundleMap() - $kernel = $this->getKernelForTest(array('registerBundles')); - $kernel - ->expects($this->once()) - ->method('registerBundles') - ->will($this->returnValue(array($parent, $grandparent, $child))) - ; - $kernel->boot(); - - $map = $kernel->getBundleMap(); - $this->assertEquals(array($child, $parent, $grandparent), $map['GrandParentCBundle']); - $this->assertEquals(array($child, $parent), $map['ParentCBundle']); - $this->assertEquals(array($child), $map['ChildCBundle']); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Bundle "ParentCBundle" is directly extended by two bundles "ChildC2Bundle" and "ChildC1Bundle". - */ - public function testInitializeBundlesThrowsExceptionWhenABundleIsDirectlyExtendedByTwoBundles() - { - $parent = $this->getBundle(null, null, 'ParentCBundle'); - $child1 = $this->getBundle(null, 'ParentCBundle', 'ChildC1Bundle'); - $child2 = $this->getBundle(null, 'ParentCBundle', 'ChildC2Bundle'); - - $kernel = $this->getKernel(array(), array($parent, $child1, $child2)); - $kernel->boot(); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Trying to register two bundles with the same name "DuplicateName" - */ - public function testInitializeBundleThrowsExceptionWhenRegisteringTwoBundlesWithTheSameName() - { - $fooBundle = $this->getBundle(null, null, 'FooBundle', 'DuplicateName'); - $barBundle = $this->getBundle(null, null, 'BarBundle', 'DuplicateName'); - - $kernel = $this->getKernel(array(), array($fooBundle, $barBundle)); - $kernel->boot(); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Bundle "CircularRefBundle" can not extend itself. - */ - public function testInitializeBundleThrowsExceptionWhenABundleExtendsItself() - { - $circularRef = $this->getBundle(null, 'CircularRefBundle', 'CircularRefBundle'); - - $kernel = $this->getKernel(array(), array($circularRef)); - $kernel->boot(); - } - - public function testTerminateReturnsSilentlyIfKernelIsNotBooted() - { - $kernel = $this->getKernel(array('getHttpKernel')); - $kernel->expects($this->never()) - ->method('getHttpKernel'); - - $kernel->terminate(Request::create('/'), new Response()); - } - - public function testTerminateDelegatesTerminationOnlyForTerminableInterface() - { - // does not implement TerminableInterface - $httpKernel = new TestKernel(); - - $kernel = $this->getKernel(array('getHttpKernel')); - $kernel->expects($this->once()) - ->method('getHttpKernel') - ->willReturn($httpKernel); - - $kernel->boot(); - $kernel->terminate(Request::create('/'), new Response()); - - $this->assertFalse($httpKernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface'); - - // implements TerminableInterface - $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') - ->disableOriginalConstructor() - ->setMethods(array('terminate')) - ->getMock(); - - $httpKernelMock - ->expects($this->once()) - ->method('terminate'); - - $kernel = $this->getKernel(array('getHttpKernel')); - $kernel->expects($this->exactly(2)) - ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); - - $kernel->boot(); - $kernel->terminate(Request::create('/'), new Response()); - } - - public function testKernelWithoutBundles() - { - $kernel = new KernelWithoutBundles('test', true); - $kernel->boot(); - - $this->assertTrue($kernel->getContainer()->getParameter('test_executed')); - } - - public function testKernelRootDirNameStartingWithANumber() - { - $dir = __DIR__.'/Fixtures/123'; - require_once $dir.'/Kernel123.php'; - $kernel = new \Symfony\Component\HttpKernel\Tests\Fixtures\_123\Kernel123('dev', true); - $this->assertEquals('_123', $kernel->getName()); - } - - /** - * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\Kernel::getEnvParameters() method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead. - * @expectedDeprecation The support of special environment variables that start with SYMFONY__ (such as "SYMFONY__FOO__BAR") is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax instead to get the value of environment variables in configuration files. - */ - public function testSymfonyEnvironmentVariables() - { - $_SERVER['SYMFONY__FOO__BAR'] = 'baz'; - - $kernel = $this->getKernel(); - $method = new \ReflectionMethod($kernel, 'getEnvParameters'); - $method->setAccessible(true); - - $envParameters = $method->invoke($kernel); - $this->assertSame('baz', $envParameters['foo.bar']); - - unset($_SERVER['SYMFONY__FOO__BAR']); - } - - public function testProjectDirExtension() - { - $kernel = new CustomProjectDirKernel('test', true); - $kernel->boot(); - - $this->assertSame('foo', $kernel->getProjectDir()); - $this->assertSame('foo', $kernel->getContainer()->getParameter('kernel.project_dir')); - } - - /** - * Returns a mock for the BundleInterface. - * - * @return BundleInterface - */ - protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) - { - $bundle = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') - ->setMethods(array('getPath', 'getParent', 'getName')) - ->disableOriginalConstructor() - ; - - if ($className) { - $bundle->setMockClassName($className); - } - - $bundle = $bundle->getMockForAbstractClass(); - - $bundle - ->expects($this->any()) - ->method('getName') - ->will($this->returnValue(null === $bundleName ? get_class($bundle) : $bundleName)) - ; - - $bundle - ->expects($this->any()) - ->method('getPath') - ->will($this->returnValue($dir)) - ; - - $bundle - ->expects($this->any()) - ->method('getParent') - ->will($this->returnValue($parent)) - ; - - return $bundle; - } - - /** - * Returns a mock for the abstract kernel. - * - * @param array $methods Additional methods to mock (besides the abstract ones) - * @param array $bundles Bundles to register - * - * @return Kernel - */ - protected function getKernel(array $methods = array(), array $bundles = array()) - { - $methods[] = 'registerBundles'; - - $kernel = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Kernel') - ->setMethods($methods) - ->setConstructorArgs(array('test', false)) - ->getMockForAbstractClass() - ; - $kernel->expects($this->any()) - ->method('registerBundles') - ->will($this->returnValue($bundles)) - ; - $p = new \ReflectionProperty($kernel, 'rootDir'); - $p->setAccessible(true); - $p->setValue($kernel, __DIR__.'/Fixtures'); - - return $kernel; - } - - protected function getKernelForTest(array $methods = array()) - { - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->setConstructorArgs(array('test', false)) - ->setMethods($methods) - ->getMock(); - $p = new \ReflectionProperty($kernel, 'rootDir'); - $p->setAccessible(true); - $p->setValue($kernel, __DIR__.'/Fixtures'); - - return $kernel; - } -} - -class TestKernel implements HttpKernelInterface -{ - public $terminateCalled = false; - - public function terminate() - { - $this->terminateCalled = true; - } - - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) - { - } -} - -class CustomProjectDirKernel extends Kernel -{ - private $baseDir; - - public function __construct() - { - parent::__construct('test', false); - - $this->baseDir = 'foo'; - } - - public function registerBundles() - { - return array(); - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { - } - - public function getProjectDir() - { - return $this->baseDir; - } - - public function getRootDir() - { - return __DIR__.'/Fixtures'; - } -} diff --git a/vendor/symfony/http-kernel/Tests/Logger.php b/vendor/symfony/http-kernel/Tests/Logger.php deleted file mode 100644 index 63c70bf..0000000 --- a/vendor/symfony/http-kernel/Tests/Logger.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use Psr\Log\LoggerInterface; - -class Logger implements LoggerInterface -{ - protected $logs; - - public function __construct() - { - $this->clear(); - } - - public function getLogs($level = false) - { - return false === $level ? $this->logs : $this->logs[$level]; - } - - public function clear() - { - $this->logs = array( - 'emergency' => array(), - 'alert' => array(), - 'critical' => array(), - 'error' => array(), - 'warning' => array(), - 'notice' => array(), - 'info' => array(), - 'debug' => array(), - ); - } - - public function log($level, $message, array $context = array()) - { - $this->logs[$level][] = $message; - } - - public function emergency($message, array $context = array()) - { - $this->log('emergency', $message, $context); - } - - public function alert($message, array $context = array()) - { - $this->log('alert', $message, $context); - } - - public function critical($message, array $context = array()) - { - $this->log('critical', $message, $context); - } - - public function error($message, array $context = array()) - { - $this->log('error', $message, $context); - } - - public function warning($message, array $context = array()) - { - $this->log('warning', $message, $context); - } - - public function notice($message, array $context = array()) - { - $this->log('notice', $message, $context); - } - - public function info($message, array $context = array()) - { - $this->log('info', $message, $context); - } - - public function debug($message, array $context = array()) - { - $this->log('debug', $message, $context); - } -} diff --git a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php deleted file mode 100644 index 99ff207..0000000 --- a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php +++ /dev/null @@ -1,350 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Profiler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; -use Symfony\Component\HttpKernel\Profiler\Profile; - -class FileProfilerStorageTest extends TestCase -{ - private $tmpDir; - private $storage; - - protected function setUp() - { - $this->tmpDir = sys_get_temp_dir().'/sf2_profiler_file_storage'; - if (is_dir($this->tmpDir)) { - self::cleanDir(); - } - $this->storage = new FileProfilerStorage('file:'.$this->tmpDir); - $this->storage->purge(); - } - - protected function tearDown() - { - self::cleanDir(); - } - - public function testStore() - { - for ($i = 0; $i < 10; ++$i) { - $profile = new Profile('token_'.$i); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar'); - $profile->setMethod('GET'); - $this->storage->write($profile); - } - $this->assertCount(10, $this->storage->find('127.0.0.1', 'http://foo.bar', 20, 'GET'), '->write() stores data in the storage'); - } - - public function testChildren() - { - $parentProfile = new Profile('token_parent'); - $parentProfile->setIp('127.0.0.1'); - $parentProfile->setUrl('http://foo.bar/parent'); - - $childProfile = new Profile('token_child'); - $childProfile->setIp('127.0.0.1'); - $childProfile->setUrl('http://foo.bar/child'); - - $parentProfile->addChild($childProfile); - - $this->storage->write($parentProfile); - $this->storage->write($childProfile); - - // Load them from storage - $parentProfile = $this->storage->read('token_parent'); - $childProfile = $this->storage->read('token_child'); - - // Check child has link to parent - $this->assertNotNull($childProfile->getParent()); - $this->assertEquals($parentProfile->getToken(), $childProfile->getParentToken()); - - // Check parent has child - $children = $parentProfile->getChildren(); - $this->assertCount(1, $children); - $this->assertEquals($childProfile->getToken(), $children[0]->getToken()); - } - - public function testStoreSpecialCharsInUrl() - { - // The storage accepts special characters in URLs (Even though URLs are not - // supposed to contain them) - $profile = new Profile('simple_quote'); - $profile->setUrl('http://foo.bar/\''); - $this->storage->write($profile); - $this->assertTrue(false !== $this->storage->read('simple_quote'), '->write() accepts single quotes in URL'); - - $profile = new Profile('double_quote'); - $profile->setUrl('http://foo.bar/"'); - $this->storage->write($profile); - $this->assertTrue(false !== $this->storage->read('double_quote'), '->write() accepts double quotes in URL'); - - $profile = new Profile('backslash'); - $profile->setUrl('http://foo.bar/\\'); - $this->storage->write($profile); - $this->assertTrue(false !== $this->storage->read('backslash'), '->write() accepts backslash in URL'); - - $profile = new Profile('comma'); - $profile->setUrl('http://foo.bar/,'); - $this->storage->write($profile); - $this->assertTrue(false !== $this->storage->read('comma'), '->write() accepts comma in URL'); - } - - public function testStoreDuplicateToken() - { - $profile = new Profile('token'); - $profile->setUrl('http://example.com/'); - - $this->assertTrue($this->storage->write($profile), '->write() returns true when the token is unique'); - - $profile->setUrl('http://example.net/'); - - $this->assertTrue($this->storage->write($profile), '->write() returns true when the token is already present in the storage'); - $this->assertEquals('http://example.net/', $this->storage->read('token')->getUrl(), '->write() overwrites the current profile data'); - - $this->assertCount(1, $this->storage->find('', '', 1000, ''), '->find() does not return the same profile twice'); - } - - public function testRetrieveByIp() - { - $profile = new Profile('token'); - $profile->setIp('127.0.0.1'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $this->assertCount(1, $this->storage->find('127.0.0.1', '', 10, 'GET'), '->find() retrieve a record by IP'); - $this->assertCount(0, $this->storage->find('127.0.%.1', '', 10, 'GET'), '->find() does not interpret a "%" as a wildcard in the IP'); - $this->assertCount(0, $this->storage->find('127.0._.1', '', 10, 'GET'), '->find() does not interpret a "_" as a wildcard in the IP'); - } - - public function testRetrieveByStatusCode() - { - $profile200 = new Profile('statuscode200'); - $profile200->setStatusCode(200); - $this->storage->write($profile200); - - $profile404 = new Profile('statuscode404'); - $profile404->setStatusCode(404); - $this->storage->write($profile404); - - $this->assertCount(1, $this->storage->find(null, null, 10, null, null, null, '200'), '->find() retrieve a record by Status code 200'); - $this->assertCount(1, $this->storage->find(null, null, 10, null, null, null, '404'), '->find() retrieve a record by Status code 404'); - } - - public function testRetrieveByUrl() - { - $profile = new Profile('simple_quote'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar/\''); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $profile = new Profile('double_quote'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar/"'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $profile = new Profile('backslash'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo\\bar/'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $profile = new Profile('percent'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar/%'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $profile = new Profile('underscore'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar/_'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $profile = new Profile('semicolon'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar/;'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo.bar/\'', 10, 'GET'), '->find() accepts single quotes in URLs'); - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo.bar/"', 10, 'GET'), '->find() accepts double quotes in URLs'); - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo\\bar/', 10, 'GET'), '->find() accepts backslash in URLs'); - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo.bar/;', 10, 'GET'), '->find() accepts semicolon in URLs'); - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo.bar/%', 10, 'GET'), '->find() does not interpret a "%" as a wildcard in the URL'); - $this->assertCount(1, $this->storage->find('127.0.0.1', 'http://foo.bar/_', 10, 'GET'), '->find() does not interpret a "_" as a wildcard in the URL'); - } - - public function testStoreTime() - { - $dt = new \DateTime('now'); - $start = $dt->getTimestamp(); - - for ($i = 0; $i < 3; ++$i) { - $dt->modify('+1 minute'); - $profile = new Profile('time_'.$i); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://foo.bar'); - $profile->setTime($dt->getTimestamp()); - $profile->setMethod('GET'); - $this->storage->write($profile); - } - - $records = $this->storage->find('', '', 3, 'GET', $start, time() + 3 * 60); - $this->assertCount(3, $records, '->find() returns all previously added records'); - $this->assertEquals($records[0]['token'], 'time_2', '->find() returns records ordered by time in descendant order'); - $this->assertEquals($records[1]['token'], 'time_1', '->find() returns records ordered by time in descendant order'); - $this->assertEquals($records[2]['token'], 'time_0', '->find() returns records ordered by time in descendant order'); - - $records = $this->storage->find('', '', 3, 'GET', $start, time() + 2 * 60); - $this->assertCount(2, $records, '->find() should return only first two of the previously added records'); - } - - public function testRetrieveByEmptyUrlAndIp() - { - for ($i = 0; $i < 5; ++$i) { - $profile = new Profile('token_'.$i); - $profile->setMethod('GET'); - $this->storage->write($profile); - } - $this->assertCount(5, $this->storage->find('', '', 10, 'GET'), '->find() returns all previously added records'); - $this->storage->purge(); - } - - public function testRetrieveByMethodAndLimit() - { - foreach (array('POST', 'GET') as $method) { - for ($i = 0; $i < 5; ++$i) { - $profile = new Profile('token_'.$i.$method); - $profile->setMethod($method); - $this->storage->write($profile); - } - } - - $this->assertCount(5, $this->storage->find('', '', 5, 'POST')); - - $this->storage->purge(); - } - - public function testPurge() - { - $profile = new Profile('token1'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://example.com/'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $this->assertTrue(false !== $this->storage->read('token1')); - $this->assertCount(1, $this->storage->find('127.0.0.1', '', 10, 'GET')); - - $profile = new Profile('token2'); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://example.net/'); - $profile->setMethod('GET'); - $this->storage->write($profile); - - $this->assertTrue(false !== $this->storage->read('token2')); - $this->assertCount(2, $this->storage->find('127.0.0.1', '', 10, 'GET')); - - $this->storage->purge(); - - $this->assertEmpty($this->storage->read('token'), '->purge() removes all data stored by profiler'); - $this->assertCount(0, $this->storage->find('127.0.0.1', '', 10, 'GET'), '->purge() removes all items from index'); - } - - public function testDuplicates() - { - for ($i = 1; $i <= 5; ++$i) { - $profile = new Profile('foo'.$i); - $profile->setIp('127.0.0.1'); - $profile->setUrl('http://example.net/'); - $profile->setMethod('GET'); - - ///three duplicates - $this->storage->write($profile); - $this->storage->write($profile); - $this->storage->write($profile); - } - $this->assertCount(3, $this->storage->find('127.0.0.1', 'http://example.net/', 3, 'GET'), '->find() method returns incorrect number of entries'); - } - - public function testStatusCode() - { - $profile = new Profile('token1'); - $profile->setStatusCode(200); - $this->storage->write($profile); - - $profile = new Profile('token2'); - $profile->setStatusCode(404); - $this->storage->write($profile); - - $tokens = $this->storage->find('', '', 10, ''); - $this->assertCount(2, $tokens); - $this->assertContains($tokens[0]['status_code'], array(200, 404)); - $this->assertContains($tokens[1]['status_code'], array(200, 404)); - } - - public function testMultiRowIndexFile() - { - $iteration = 3; - for ($i = 0; $i < $iteration; ++$i) { - $profile = new Profile('token'.$i); - $profile->setIp('127.0.0.'.$i); - $profile->setUrl('http://foo.bar/'.$i); - - $this->storage->write($profile); - $this->storage->write($profile); - $this->storage->write($profile); - } - - $handle = fopen($this->tmpDir.'/index.csv', 'r'); - for ($i = 0; $i < $iteration; ++$i) { - $row = fgetcsv($handle); - $this->assertEquals('token'.$i, $row[0]); - $this->assertEquals('127.0.0.'.$i, $row[1]); - $this->assertEquals('http://foo.bar/'.$i, $row[3]); - } - $this->assertFalse(fgetcsv($handle)); - } - - public function testReadLineFromFile() - { - $r = new \ReflectionMethod($this->storage, 'readLineFromFile'); - - $r->setAccessible(true); - - $h = tmpfile(); - - fwrite($h, "line1\n\n\nline2\n"); - fseek($h, 0, SEEK_END); - - $this->assertEquals('line2', $r->invoke($this->storage, $h)); - $this->assertEquals('line1', $r->invoke($this->storage, $h)); - } - - protected function cleanDir() - { - $flags = \FilesystemIterator::SKIP_DOTS; - $iterator = new \RecursiveDirectoryIterator($this->tmpDir, $flags); - $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); - - foreach ($iterator as $file) { - if (is_file($file)) { - unlink($file); - } - } - } -} diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php deleted file mode 100644 index 1a6f546..0000000 --- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests\Profiler; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; -use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; -use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -class ProfilerTest extends TestCase -{ - private $tmp; - private $storage; - - public function testCollect() - { - $request = new Request(); - $request->query->set('foo', 'bar'); - $response = new Response('', 204); - $collector = new RequestDataCollector(); - - $profiler = new Profiler($this->storage); - $profiler->add($collector); - $profile = $profiler->collect($request, $response); - $profiler->saveProfile($profile); - - $this->assertSame(204, $profile->getStatusCode()); - $this->assertSame('GET', $profile->getMethod()); - $this->assertSame('bar', $profile->getCollector('request')->getRequestQuery()->all()['foo']->getValue()); - } - - public function testFindWorksWithDates() - { - $profiler = new Profiler($this->storage); - - $this->assertCount(0, $profiler->find(null, null, null, null, '7th April 2014', '9th April 2014')); - } - - public function testFindWorksWithTimestamps() - { - $profiler = new Profiler($this->storage); - - $this->assertCount(0, $profiler->find(null, null, null, null, '1396828800', '1397001600')); - } - - public function testFindWorksWithInvalidDates() - { - $profiler = new Profiler($this->storage); - - $this->assertCount(0, $profiler->find(null, null, null, null, 'some string', '')); - } - - public function testFindWorksWithStatusCode() - { - $profiler = new Profiler($this->storage); - - $this->assertCount(0, $profiler->find(null, null, null, null, null, null, '204')); - } - - protected function setUp() - { - $this->tmp = tempnam(sys_get_temp_dir(), 'sf2_profiler'); - if (file_exists($this->tmp)) { - @unlink($this->tmp); - } - - $this->storage = new FileProfilerStorage('file:'.$this->tmp); - $this->storage->purge(); - } - - protected function tearDown() - { - if (null !== $this->storage) { - $this->storage->purge(); - $this->storage = null; - - @unlink($this->tmp); - } - } -} diff --git a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php deleted file mode 100644 index 3ec5927..0000000 --- a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; - -class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface -{ - public function __construct() - { - parent::__construct(new EventDispatcher(), $this, null, $this); - } - - public function getController(Request $request) - { - return array($this, 'callController'); - } - - public function getArguments(Request $request, $controller) - { - return array($request); - } - - public function callController(Request $request) - { - return new Response('Request: '.$request->getRequestUri()); - } -} diff --git a/vendor/symfony/http-kernel/Tests/UriSignerTest.php b/vendor/symfony/http-kernel/Tests/UriSignerTest.php deleted file mode 100644 index 253a4c9..0000000 --- a/vendor/symfony/http-kernel/Tests/UriSignerTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\UriSigner; - -class UriSignerTest extends TestCase -{ - public function testSign() - { - $signer = new UriSigner('foobar'); - - $this->assertContains('?_hash=', $signer->sign('http://example.com/foo')); - $this->assertContains('&_hash=', $signer->sign('http://example.com/foo?foo=bar')); - } - - public function testCheck() - { - $signer = new UriSigner('foobar'); - - $this->assertFalse($signer->check('http://example.com/foo?_hash=foo')); - $this->assertFalse($signer->check('http://example.com/foo?foo=bar&_hash=foo')); - $this->assertFalse($signer->check('http://example.com/foo?foo=bar&_hash=foo&bar=foo')); - - $this->assertTrue($signer->check($signer->sign('http://example.com/foo'))); - $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar'))); - $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer'))); - - $this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar')); - } - - public function testCheckWithDifferentArgSeparator() - { - $this->iniSet('arg_separator.output', '&'); - $signer = new UriSigner('foobar'); - - $this->assertSame( - 'http://example.com/foo?baz=bay&foo=bar&_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D', - $signer->sign('http://example.com/foo?foo=bar&baz=bay') - ); - $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay'))); - } - - public function testCheckWithDifferentParameter() - { - $signer = new UriSigner('foobar', 'qux'); - - $this->assertSame( - 'http://example.com/foo?baz=bay&foo=bar&qux=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D', - $signer->sign('http://example.com/foo?foo=bar&baz=bay') - ); - $this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay'))); - } -} diff --git a/vendor/symfony/http-kernel/UriSigner.php b/vendor/symfony/http-kernel/UriSigner.php deleted file mode 100644 index c3df231..0000000 --- a/vendor/symfony/http-kernel/UriSigner.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel; - -/** - * Signs URIs. - * - * @author Fabien Potencier - */ -class UriSigner -{ - private $secret; - private $parameter; - - /** - * @param string $secret A secret - * @param string $parameter Query string parameter to use - */ - public function __construct($secret, $parameter = '_hash') - { - $this->secret = $secret; - $this->parameter = $parameter; - } - - /** - * Signs a URI. - * - * The given URI is signed by adding the query string parameter - * which value depends on the URI and the secret. - * - * @param string $uri A URI to sign - * - * @return string The signed URI - */ - public function sign($uri) - { - $url = parse_url($uri); - if (isset($url['query'])) { - parse_str($url['query'], $params); - } else { - $params = array(); - } - - $uri = $this->buildUrl($url, $params); - - return $uri.(false === strpos($uri, '?') ? '?' : '&').$this->parameter.'='.$this->computeHash($uri); - } - - /** - * Checks that a URI contains the correct hash. - * - * The query string parameter must be the last one - * (as it is generated that way by the sign() method, it should - * never be a problem). - * - * @param string $uri A signed URI - * - * @return bool True if the URI is signed correctly, false otherwise - */ - public function check($uri) - { - $url = parse_url($uri); - if (isset($url['query'])) { - parse_str($url['query'], $params); - } else { - $params = array(); - } - - if (empty($params[$this->parameter])) { - return false; - } - - $hash = urlencode($params[$this->parameter]); - unset($params[$this->parameter]); - - return $this->computeHash($this->buildUrl($url, $params)) === $hash; - } - - private function computeHash($uri) - { - return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true))); - } - - private function buildUrl(array $url, array $params = array()) - { - ksort($params, SORT_STRING); - $url['query'] = http_build_query($params, '', '&'); - - $scheme = isset($url['scheme']) ? $url['scheme'].'://' : ''; - $host = isset($url['host']) ? $url['host'] : ''; - $port = isset($url['port']) ? ':'.$url['port'] : ''; - $user = isset($url['user']) ? $url['user'] : ''; - $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; - $pass = ($user || $pass) ? "$pass@" : ''; - $path = isset($url['path']) ? $url['path'] : ''; - $query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : ''; - $fragment = isset($url['fragment']) ? '#'.$url['fragment'] : ''; - - return $scheme.$user.$pass.$host.$port.$path.$query.$fragment; - } -} diff --git a/vendor/symfony/http-kernel/composer.json b/vendor/symfony/http-kernel/composer.json deleted file mode 100644 index cc543c6..0000000 --- a/vendor/symfony/http-kernel/composer.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "symfony/http-kernel", - "type": "library", - "description": "Symfony HttpKernel Component", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~3.3", - "symfony/debug": "~2.8|~3.0", - "psr/log": "~1.0" - }, - "require-dev": { - "symfony/browser-kit": "~2.8|~3.0", - "symfony/class-loader": "~2.8|~3.0", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/css-selector": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0", - "symfony/routing": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~3.3", - "psr/cache": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/var-dumper": "<3.3", - "twig/twig": "<1.34|<2.4,>=2" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/class-loader": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/finder": "", - "symfony/var-dumper": "" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\HttpKernel\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/http-kernel/phpunit.xml.dist b/vendor/symfony/http-kernel/phpunit.xml.dist deleted file mode 100644 index e0de769..0000000 --- a/vendor/symfony/http-kernel/phpunit.xml.dist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - - - - - - Symfony\Component\HttpFoundation - - - - - diff --git a/vendor/symfony/polyfill-mbstring/LICENSE b/vendor/symfony/polyfill-mbstring/LICENSE deleted file mode 100644 index 39fa189..0000000 --- a/vendor/symfony/polyfill-mbstring/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014-2016 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php deleted file mode 100644 index 97e8c9b..0000000 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ /dev/null @@ -1,664 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Mbstring; - -/** - * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. - * - * Implemented: - * - mb_chr - Returns a specific character from its Unicode code point - * - mb_convert_encoding - Convert character encoding - * - mb_convert_variables - Convert character code in variable(s) - * - mb_decode_mimeheader - Decode string in MIME header field - * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED - * - mb_convert_case - Perform case folding on a string - * - mb_get_info - Get internal settings of mbstring - * - mb_http_input - Detect HTTP input character encoding - * - mb_http_output - Set/Get HTTP output character encoding - * - mb_internal_encoding - Set/Get internal character encoding - * - mb_list_encodings - Returns an array of all supported encodings - * - mb_ord - Returns the Unicode code point of a character - * - mb_output_handler - Callback function converts character encoding in output buffer - * - mb_scrub - Replaces ill-formed byte sequences with substitute characters - * - mb_strlen - Get string length - * - mb_strpos - Find position of first occurrence of string in a string - * - mb_strrpos - Find position of last occurrence of a string in a string - * - mb_strtolower - Make a string lowercase - * - mb_strtoupper - Make a string uppercase - * - mb_substitute_character - Set/Get substitution character - * - mb_substr - Get part of string - * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive - * - mb_stristr - Finds first occurrence of a string within another, case insensitive - * - mb_strrchr - Finds the last occurrence of a character in a string within another - * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive - * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within anothers - * - mb_strwidth - Return width of string - * - mb_substr_count - Count the number of substring occurrences - * - * Not implemented: - * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * - mb_decode_numericentity - Decode HTML numeric string reference to character - * - mb_encode_numericentity - Encode character to HTML numeric string reference - * - mb_ereg_* - Regular expression with multibyte support - * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable - * - mb_preferred_mime_name - Get MIME charset string - * - mb_regex_encoding - Returns current encoding for multibyte regex as string - * - mb_regex_set_options - Set/Get the default options for mbregex functions - * - mb_send_mail - Send encoded mail - * - mb_split - Split multibyte string using regular expression - * - mb_strcut - Get part of string - * - mb_strimwidth - Get truncated string with specified width - * - * @author Nicolas Grekas - * - * @internal - */ -final class Mbstring -{ - const MB_CASE_FOLD = PHP_INT_MAX; - - private static $encodingList = array('ASCII', 'UTF-8'); - private static $language = 'neutral'; - private static $internalEncoding = 'UTF-8'; - private static $caseFold = array( - array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"), - array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1",'ι'), - ); - - public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) - { - if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) { - $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); - } else { - $fromEncoding = self::getEncoding($fromEncoding); - } - - $toEncoding = self::getEncoding($toEncoding); - - if ('BASE64' === $fromEncoding) { - $s = base64_decode($s); - $fromEncoding = $toEncoding; - } - - if ('BASE64' === $toEncoding) { - return base64_encode($s); - } - - if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { - if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { - $fromEncoding = 'Windows-1252'; - } - if ('UTF-8' !== $fromEncoding) { - $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); - } - - return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s); - } - - if ('HTML-ENTITIES' === $fromEncoding) { - $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8'); - $fromEncoding = 'UTF-8'; - } - - return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); - } - - public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) - { - $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); - - $ok = true; - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { - if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { - $ok = false; - } - }); - - return $ok ? $fromEncoding : false; - } - - public static function mb_decode_mimeheader($s) - { - return iconv_mime_decode($s, 2, self::$internalEncoding); - } - - public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) - { - trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING); - } - - public static function mb_convert_case($s, $mode, $encoding = null) - { - if ('' === $s .= '') { - return ''; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding) { - $encoding = null; - if (!preg_match('//u', $s)) { - $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); - } - } else { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - if (MB_CASE_TITLE == $mode) { - $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); - $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s); - } else { - if (MB_CASE_UPPER == $mode) { - static $upper = null; - if (null === $upper) { - $upper = self::getData('upperCase'); - } - $map = $upper; - } else { - if (self::MB_CASE_FOLD === $mode) { - $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s); - } - - static $lower = null; - if (null === $lower) { - $lower = self::getData('lowerCase'); - } - $map = $lower; - } - - static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4); - - $i = 0; - $len = strlen($s); - - while ($i < $len) { - $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; - $uchr = substr($s, $i, $ulen); - $i += $ulen; - - if (isset($map[$uchr])) { - $uchr = $map[$uchr]; - $nlen = strlen($uchr); - - if ($nlen == $ulen) { - $nlen = $i; - do { - $s[--$nlen] = $uchr[--$ulen]; - } while ($ulen); - } else { - $s = substr_replace($s, $uchr, $i - $ulen, $ulen); - $len += $nlen - $ulen; - $i += $nlen - $ulen; - } - } - } - } - - if (null === $encoding) { - return $s; - } - - return iconv('UTF-8', $encoding.'//IGNORE', $s); - } - - public static function mb_internal_encoding($encoding = null) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - $encoding = self::getEncoding($encoding); - - if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) { - self::$internalEncoding = $encoding; - - return true; - } - - return false; - } - - public static function mb_language($lang = null) - { - if (null === $lang) { - return self::$language; - } - - switch ($lang = strtolower($lang)) { - case 'uni': - case 'neutral': - self::$language = $lang; - - return true; - } - - return false; - } - - public static function mb_list_encodings() - { - return array('UTF-8'); - } - - public static function mb_encoding_aliases($encoding) - { - switch (strtoupper($encoding)) { - case 'UTF8': - case 'UTF-8': - return array('utf8'); - } - - return false; - } - - public static function mb_check_encoding($var = null, $encoding = null) - { - if (null === $encoding) { - if (null === $var) { - return false; - } - $encoding = self::$internalEncoding; - } - - return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var); - } - - public static function mb_detect_encoding($str, $encodingList = null, $strict = false) - { - if (null === $encodingList) { - $encodingList = self::$encodingList; - } else { - if (!is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - } - - foreach ($encodingList as $enc) { - switch ($enc) { - case 'ASCII': - if (!preg_match('/[\x80-\xFF]/', $str)) { - return $enc; - } - break; - - case 'UTF8': - case 'UTF-8': - if (preg_match('//u', $str)) { - return 'UTF-8'; - } - break; - - default: - if (0 === strncmp($enc, 'ISO-8859-', 9)) { - return $enc; - } - } - } - - return false; - } - - public static function mb_detect_order($encodingList = null) - { - if (null === $encodingList) { - return self::$encodingList; - } - - if (!is_array($encodingList)) { - $encodingList = array_map('trim', explode(',', $encodingList)); - } - $encodingList = array_map('strtoupper', $encodingList); - - foreach ($encodingList as $enc) { - switch ($enc) { - default: - if (strncmp($enc, 'ISO-8859-', 9)) { - return false; - } - case 'ASCII': - case 'UTF8': - case 'UTF-8': - } - } - - self::$encodingList = $encodingList; - - return true; - } - - public static function mb_strlen($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strlen($s); - } - - return @iconv_strlen($s, $encoding); - } - - public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strpos($haystack, $needle, $offset); - } - - if ('' === $needle .= '') { - trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING); - - return false; - } - - return iconv_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strrpos($haystack, $needle, $offset); - } - - if ($offset != (int) $offset) { - $offset = 0; - } elseif ($offset = (int) $offset) { - if ($offset < 0) { - $haystack = self::mb_substr($haystack, 0, $offset, $encoding); - $offset = 0; - } else { - $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); - } - } - - $pos = iconv_strrpos($haystack, $needle, $encoding); - - return false !== $pos ? $offset + $pos : false; - } - - public static function mb_strtolower($s, $encoding = null) - { - return self::mb_convert_case($s, MB_CASE_LOWER, $encoding); - } - - public static function mb_strtoupper($s, $encoding = null) - { - return self::mb_convert_case($s, MB_CASE_UPPER, $encoding); - } - - public static function mb_substitute_character($c = null) - { - if (0 === strcasecmp($c, 'none')) { - return true; - } - - return null !== $c ? false : 'none'; - } - - public static function mb_substr($s, $start, $length = null, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return substr($s, $start, null === $length ? 2147483647 : $length); - } - - if ($start < 0) { - $start = iconv_strlen($s, $encoding) + $start; - if ($start < 0) { - $start = 0; - } - } - - if (null === $length) { - $length = 2147483647; - } elseif ($length < 0) { - $length = iconv_strlen($s, $encoding) + $length - $start; - if ($length < 0) { - return ''; - } - } - - return iconv_substr($s, $start, $length, $encoding).''; - } - - public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) - { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); - - return self::mb_strpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) - { - $pos = self::mb_stripos($haystack, $needle, 0, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) - { - $encoding = self::getEncoding($encoding); - if ('CP850' === $encoding || 'ASCII' === $encoding) { - return strrchr($haystack, $needle, $part); - } - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = iconv_strrpos($haystack, $needle, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) - { - $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = self::mb_strripos($haystack, $needle, $encoding); - - return self::getSubpart($pos, $part, $haystack, $encoding); - } - - public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) - { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); - - return self::mb_strrpos($haystack, $needle, $offset, $encoding); - } - - public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) - { - $pos = strpos($haystack, $needle); - if (false === $pos) { - return false; - } - if ($part) { - return substr($haystack, 0, $pos); - } - - return substr($haystack, $pos); - } - - public static function mb_get_info($type = 'all') - { - $info = array( - 'internal_encoding' => self::$internalEncoding, - 'http_output' => 'pass', - 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)', - 'func_overload' => 0, - 'func_overload_list' => 'no overload', - 'mail_charset' => 'UTF-8', - 'mail_header_encoding' => 'BASE64', - 'mail_body_encoding' => 'BASE64', - 'illegal_chars' => 0, - 'encoding_translation' => 'Off', - 'language' => self::$language, - 'detect_order' => self::$encodingList, - 'substitute_character' => 'none', - 'strict_detection' => 'Off', - ); - - if ('all' === $type) { - return $info; - } - if (isset($info[$type])) { - return $info[$type]; - } - - return false; - } - - public static function mb_http_input($type = '') - { - return false; - } - - public static function mb_http_output($encoding = null) - { - return null !== $encoding ? 'pass' === $encoding : 'pass'; - } - - public static function mb_strwidth($s, $encoding = null) - { - $encoding = self::getEncoding($encoding); - - if ('UTF-8' !== $encoding) { - $s = iconv($encoding, 'UTF-8//IGNORE', $s); - } - - $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); - - return ($wide << 1) + iconv_strlen($s, 'UTF-8'); - } - - public static function mb_substr_count($haystack, $needle, $encoding = null) - { - return substr_count($haystack, $needle); - } - - public static function mb_output_handler($contents, $status) - { - return $contents; - } - - public static function mb_chr($code, $encoding = null) - { - if (0x80 > $code %= 0x200000) { - $s = chr($code); - } elseif (0x800 > $code) { - $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F); - } elseif (0x10000 > $code) { - $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F); - } else { - $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F); - } - - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, $encoding, 'UTF-8'); - } - - return $s; - } - - public static function mb_ord($s, $encoding = null) - { - if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { - $s = mb_convert_encoding($s, 'UTF-8', $encoding); - } - - $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; - if (0xF0 <= $code) { - return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; - } - if (0xE0 <= $code) { - return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; - } - if (0xC0 <= $code) { - return (($code - 0xC0) << 6) + $s[2] - 0x80; - } - - return $code; - } - - private static function getSubpart($pos, $part, $haystack, $encoding) - { - if (false === $pos) { - return false; - } - if ($part) { - return self::mb_substr($haystack, 0, $pos, $encoding); - } - - return self::mb_substr($haystack, $pos, null, $encoding); - } - - private static function html_encoding_callback($m) - { - $i = 1; - $entities = ''; - $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8')); - - while (isset($m[$i])) { - if (0x80 > $m[$i]) { - $entities .= chr($m[$i++]); - continue; - } - if (0xF0 <= $m[$i]) { - $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } elseif (0xE0 <= $m[$i]) { - $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; - } else { - $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; - } - - $entities .= '&#'.$c.';'; - } - - return $entities; - } - - private static function title_case_lower($s) - { - return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8'); - } - - private static function title_case_upper($s) - { - return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); - } - - private static function getData($file) - { - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { - return require $file; - } - - return false; - } - - private static function getEncoding($encoding) - { - if (null === $encoding) { - return self::$internalEncoding; - } - - $encoding = strtoupper($encoding); - - if ('8BIT' === $encoding || 'BINARY' === $encoding) { - return 'CP850'; - } - if ('UTF8' === $encoding) { - return 'UTF-8'; - } - - return $encoding; - } -} diff --git a/vendor/symfony/polyfill-mbstring/README.md b/vendor/symfony/polyfill-mbstring/README.md deleted file mode 100644 index 342e828..0000000 --- a/vendor/symfony/polyfill-mbstring/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Symfony Polyfill / Mbstring -=========================== - -This component provides a partial, native PHP implementation for the -[Mbstring](http://php.net/mbstring) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php deleted file mode 100644 index 3ca1641..0000000 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ /dev/null @@ -1,1101 +0,0 @@ - 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - 'À' => 'à', - 'Á' => 'á', - 'Â' => 'â', - 'Ã' => 'ã', - 'Ä' => 'ä', - 'Å' => 'å', - 'Æ' => 'æ', - 'Ç' => 'ç', - 'È' => 'è', - 'É' => 'é', - 'Ê' => 'ê', - 'Ë' => 'ë', - 'Ì' => 'ì', - 'Í' => 'í', - 'Î' => 'î', - 'Ï' => 'ï', - 'Ð' => 'ð', - 'Ñ' => 'ñ', - 'Ò' => 'ò', - 'Ó' => 'ó', - 'Ô' => 'ô', - 'Õ' => 'õ', - 'Ö' => 'ö', - 'Ø' => 'ø', - 'Ù' => 'ù', - 'Ú' => 'ú', - 'Û' => 'û', - 'Ü' => 'ü', - 'Ý' => 'ý', - 'Þ' => 'þ', - 'Ā' => 'ā', - 'Ă' => 'ă', - 'Ą' => 'ą', - 'Ć' => 'ć', - 'Ĉ' => 'ĉ', - 'Ċ' => 'ċ', - 'Č' => 'č', - 'Ď' => 'ď', - 'Đ' => 'đ', - 'Ē' => 'ē', - 'Ĕ' => 'ĕ', - 'Ė' => 'ė', - 'Ę' => 'ę', - 'Ě' => 'ě', - 'Ĝ' => 'ĝ', - 'Ğ' => 'ğ', - 'Ġ' => 'ġ', - 'Ģ' => 'ģ', - 'Ĥ' => 'ĥ', - 'Ħ' => 'ħ', - 'Ĩ' => 'ĩ', - 'Ī' => 'ī', - 'Ĭ' => 'ĭ', - 'Į' => 'į', - 'İ' => 'i', - 'IJ' => 'ij', - 'Ĵ' => 'ĵ', - 'Ķ' => 'ķ', - 'Ĺ' => 'ĺ', - 'Ļ' => 'ļ', - 'Ľ' => 'ľ', - 'Ŀ' => 'ŀ', - 'Ł' => 'ł', - 'Ń' => 'ń', - 'Ņ' => 'ņ', - 'Ň' => 'ň', - 'Ŋ' => 'ŋ', - 'Ō' => 'ō', - 'Ŏ' => 'ŏ', - 'Ő' => 'ő', - 'Œ' => 'œ', - 'Ŕ' => 'ŕ', - 'Ŗ' => 'ŗ', - 'Ř' => 'ř', - 'Ś' => 'ś', - 'Ŝ' => 'ŝ', - 'Ş' => 'ş', - 'Š' => 'š', - 'Ţ' => 'ţ', - 'Ť' => 'ť', - 'Ŧ' => 'ŧ', - 'Ũ' => 'ũ', - 'Ū' => 'ū', - 'Ŭ' => 'ŭ', - 'Ů' => 'ů', - 'Ű' => 'ű', - 'Ų' => 'ų', - 'Ŵ' => 'ŵ', - 'Ŷ' => 'ŷ', - 'Ÿ' => 'ÿ', - 'Ź' => 'ź', - 'Ż' => 'ż', - 'Ž' => 'ž', - 'Ɓ' => 'ɓ', - 'Ƃ' => 'ƃ', - 'Ƅ' => 'ƅ', - 'Ɔ' => 'ɔ', - 'Ƈ' => 'ƈ', - 'Ɖ' => 'ɖ', - 'Ɗ' => 'ɗ', - 'Ƌ' => 'ƌ', - 'Ǝ' => 'ǝ', - 'Ə' => 'ə', - 'Ɛ' => 'ɛ', - 'Ƒ' => 'ƒ', - 'Ɠ' => 'ɠ', - 'Ɣ' => 'ɣ', - 'Ɩ' => 'ɩ', - 'Ɨ' => 'ɨ', - 'Ƙ' => 'ƙ', - 'Ɯ' => 'ɯ', - 'Ɲ' => 'ɲ', - 'Ɵ' => 'ɵ', - 'Ơ' => 'ơ', - 'Ƣ' => 'ƣ', - 'Ƥ' => 'ƥ', - 'Ʀ' => 'ʀ', - 'Ƨ' => 'ƨ', - 'Ʃ' => 'ʃ', - 'Ƭ' => 'ƭ', - 'Ʈ' => 'ʈ', - 'Ư' => 'ư', - 'Ʊ' => 'ʊ', - 'Ʋ' => 'ʋ', - 'Ƴ' => 'ƴ', - 'Ƶ' => 'ƶ', - 'Ʒ' => 'ʒ', - 'Ƹ' => 'ƹ', - 'Ƽ' => 'ƽ', - 'DŽ' => 'dž', - 'Dž' => 'dž', - 'LJ' => 'lj', - 'Lj' => 'lj', - 'NJ' => 'nj', - 'Nj' => 'nj', - 'Ǎ' => 'ǎ', - 'Ǐ' => 'ǐ', - 'Ǒ' => 'ǒ', - 'Ǔ' => 'ǔ', - 'Ǖ' => 'ǖ', - 'Ǘ' => 'ǘ', - 'Ǚ' => 'ǚ', - 'Ǜ' => 'ǜ', - 'Ǟ' => 'ǟ', - 'Ǡ' => 'ǡ', - 'Ǣ' => 'ǣ', - 'Ǥ' => 'ǥ', - 'Ǧ' => 'ǧ', - 'Ǩ' => 'ǩ', - 'Ǫ' => 'ǫ', - 'Ǭ' => 'ǭ', - 'Ǯ' => 'ǯ', - 'DZ' => 'dz', - 'Dz' => 'dz', - 'Ǵ' => 'ǵ', - 'Ƕ' => 'ƕ', - 'Ƿ' => 'ƿ', - 'Ǹ' => 'ǹ', - 'Ǻ' => 'ǻ', - 'Ǽ' => 'ǽ', - 'Ǿ' => 'ǿ', - 'Ȁ' => 'ȁ', - 'Ȃ' => 'ȃ', - 'Ȅ' => 'ȅ', - 'Ȇ' => 'ȇ', - 'Ȉ' => 'ȉ', - 'Ȋ' => 'ȋ', - 'Ȍ' => 'ȍ', - 'Ȏ' => 'ȏ', - 'Ȑ' => 'ȑ', - 'Ȓ' => 'ȓ', - 'Ȕ' => 'ȕ', - 'Ȗ' => 'ȗ', - 'Ș' => 'ș', - 'Ț' => 'ț', - 'Ȝ' => 'ȝ', - 'Ȟ' => 'ȟ', - 'Ƞ' => 'ƞ', - 'Ȣ' => 'ȣ', - 'Ȥ' => 'ȥ', - 'Ȧ' => 'ȧ', - 'Ȩ' => 'ȩ', - 'Ȫ' => 'ȫ', - 'Ȭ' => 'ȭ', - 'Ȯ' => 'ȯ', - 'Ȱ' => 'ȱ', - 'Ȳ' => 'ȳ', - 'Ⱥ' => 'ⱥ', - 'Ȼ' => 'ȼ', - 'Ƚ' => 'ƚ', - 'Ⱦ' => 'ⱦ', - 'Ɂ' => 'ɂ', - 'Ƀ' => 'ƀ', - 'Ʉ' => 'ʉ', - 'Ʌ' => 'ʌ', - 'Ɇ' => 'ɇ', - 'Ɉ' => 'ɉ', - 'Ɋ' => 'ɋ', - 'Ɍ' => 'ɍ', - 'Ɏ' => 'ɏ', - 'Ͱ' => 'ͱ', - 'Ͳ' => 'ͳ', - 'Ͷ' => 'ͷ', - 'Ϳ' => 'ϳ', - 'Ά' => 'ά', - 'Έ' => 'έ', - 'Ή' => 'ή', - 'Ί' => 'ί', - 'Ό' => 'ό', - 'Ύ' => 'ύ', - 'Ώ' => 'ώ', - 'Α' => 'α', - 'Β' => 'β', - 'Γ' => 'γ', - 'Δ' => 'δ', - 'Ε' => 'ε', - 'Ζ' => 'ζ', - 'Η' => 'η', - 'Θ' => 'θ', - 'Ι' => 'ι', - 'Κ' => 'κ', - 'Λ' => 'λ', - 'Μ' => 'μ', - 'Ν' => 'ν', - 'Ξ' => 'ξ', - 'Ο' => 'ο', - 'Π' => 'π', - 'Ρ' => 'ρ', - 'Σ' => 'σ', - 'Τ' => 'τ', - 'Υ' => 'υ', - 'Φ' => 'φ', - 'Χ' => 'χ', - 'Ψ' => 'ψ', - 'Ω' => 'ω', - 'Ϊ' => 'ϊ', - 'Ϋ' => 'ϋ', - 'Ϗ' => 'ϗ', - 'Ϙ' => 'ϙ', - 'Ϛ' => 'ϛ', - 'Ϝ' => 'ϝ', - 'Ϟ' => 'ϟ', - 'Ϡ' => 'ϡ', - 'Ϣ' => 'ϣ', - 'Ϥ' => 'ϥ', - 'Ϧ' => 'ϧ', - 'Ϩ' => 'ϩ', - 'Ϫ' => 'ϫ', - 'Ϭ' => 'ϭ', - 'Ϯ' => 'ϯ', - 'ϴ' => 'θ', - 'Ϸ' => 'ϸ', - 'Ϲ' => 'ϲ', - 'Ϻ' => 'ϻ', - 'Ͻ' => 'ͻ', - 'Ͼ' => 'ͼ', - 'Ͽ' => 'ͽ', - 'Ѐ' => 'ѐ', - 'Ё' => 'ё', - 'Ђ' => 'ђ', - 'Ѓ' => 'ѓ', - 'Є' => 'є', - 'Ѕ' => 'ѕ', - 'І' => 'і', - 'Ї' => 'ї', - 'Ј' => 'ј', - 'Љ' => 'љ', - 'Њ' => 'њ', - 'Ћ' => 'ћ', - 'Ќ' => 'ќ', - 'Ѝ' => 'ѝ', - 'Ў' => 'ў', - 'Џ' => 'џ', - 'А' => 'а', - 'Б' => 'б', - 'В' => 'в', - 'Г' => 'г', - 'Д' => 'д', - 'Е' => 'е', - 'Ж' => 'ж', - 'З' => 'з', - 'И' => 'и', - 'Й' => 'й', - 'К' => 'к', - 'Л' => 'л', - 'М' => 'м', - 'Н' => 'н', - 'О' => 'о', - 'П' => 'п', - 'Р' => 'р', - 'С' => 'с', - 'Т' => 'т', - 'У' => 'у', - 'Ф' => 'ф', - 'Х' => 'х', - 'Ц' => 'ц', - 'Ч' => 'ч', - 'Ш' => 'ш', - 'Щ' => 'щ', - 'Ъ' => 'ъ', - 'Ы' => 'ы', - 'Ь' => 'ь', - 'Э' => 'э', - 'Ю' => 'ю', - 'Я' => 'я', - 'Ѡ' => 'ѡ', - 'Ѣ' => 'ѣ', - 'Ѥ' => 'ѥ', - 'Ѧ' => 'ѧ', - 'Ѩ' => 'ѩ', - 'Ѫ' => 'ѫ', - 'Ѭ' => 'ѭ', - 'Ѯ' => 'ѯ', - 'Ѱ' => 'ѱ', - 'Ѳ' => 'ѳ', - 'Ѵ' => 'ѵ', - 'Ѷ' => 'ѷ', - 'Ѹ' => 'ѹ', - 'Ѻ' => 'ѻ', - 'Ѽ' => 'ѽ', - 'Ѿ' => 'ѿ', - 'Ҁ' => 'ҁ', - 'Ҋ' => 'ҋ', - 'Ҍ' => 'ҍ', - 'Ҏ' => 'ҏ', - 'Ґ' => 'ґ', - 'Ғ' => 'ғ', - 'Ҕ' => 'ҕ', - 'Җ' => 'җ', - 'Ҙ' => 'ҙ', - 'Қ' => 'қ', - 'Ҝ' => 'ҝ', - 'Ҟ' => 'ҟ', - 'Ҡ' => 'ҡ', - 'Ң' => 'ң', - 'Ҥ' => 'ҥ', - 'Ҧ' => 'ҧ', - 'Ҩ' => 'ҩ', - 'Ҫ' => 'ҫ', - 'Ҭ' => 'ҭ', - 'Ү' => 'ү', - 'Ұ' => 'ұ', - 'Ҳ' => 'ҳ', - 'Ҵ' => 'ҵ', - 'Ҷ' => 'ҷ', - 'Ҹ' => 'ҹ', - 'Һ' => 'һ', - 'Ҽ' => 'ҽ', - 'Ҿ' => 'ҿ', - 'Ӏ' => 'ӏ', - 'Ӂ' => 'ӂ', - 'Ӄ' => 'ӄ', - 'Ӆ' => 'ӆ', - 'Ӈ' => 'ӈ', - 'Ӊ' => 'ӊ', - 'Ӌ' => 'ӌ', - 'Ӎ' => 'ӎ', - 'Ӑ' => 'ӑ', - 'Ӓ' => 'ӓ', - 'Ӕ' => 'ӕ', - 'Ӗ' => 'ӗ', - 'Ә' => 'ә', - 'Ӛ' => 'ӛ', - 'Ӝ' => 'ӝ', - 'Ӟ' => 'ӟ', - 'Ӡ' => 'ӡ', - 'Ӣ' => 'ӣ', - 'Ӥ' => 'ӥ', - 'Ӧ' => 'ӧ', - 'Ө' => 'ө', - 'Ӫ' => 'ӫ', - 'Ӭ' => 'ӭ', - 'Ӯ' => 'ӯ', - 'Ӱ' => 'ӱ', - 'Ӳ' => 'ӳ', - 'Ӵ' => 'ӵ', - 'Ӷ' => 'ӷ', - 'Ӹ' => 'ӹ', - 'Ӻ' => 'ӻ', - 'Ӽ' => 'ӽ', - 'Ӿ' => 'ӿ', - 'Ԁ' => 'ԁ', - 'Ԃ' => 'ԃ', - 'Ԅ' => 'ԅ', - 'Ԇ' => 'ԇ', - 'Ԉ' => 'ԉ', - 'Ԋ' => 'ԋ', - 'Ԍ' => 'ԍ', - 'Ԏ' => 'ԏ', - 'Ԑ' => 'ԑ', - 'Ԓ' => 'ԓ', - 'Ԕ' => 'ԕ', - 'Ԗ' => 'ԗ', - 'Ԙ' => 'ԙ', - 'Ԛ' => 'ԛ', - 'Ԝ' => 'ԝ', - 'Ԟ' => 'ԟ', - 'Ԡ' => 'ԡ', - 'Ԣ' => 'ԣ', - 'Ԥ' => 'ԥ', - 'Ԧ' => 'ԧ', - 'Ԩ' => 'ԩ', - 'Ԫ' => 'ԫ', - 'Ԭ' => 'ԭ', - 'Ԯ' => 'ԯ', - 'Ա' => 'ա', - 'Բ' => 'բ', - 'Գ' => 'գ', - 'Դ' => 'դ', - 'Ե' => 'ե', - 'Զ' => 'զ', - 'Է' => 'է', - 'Ը' => 'ը', - 'Թ' => 'թ', - 'Ժ' => 'ժ', - 'Ի' => 'ի', - 'Լ' => 'լ', - 'Խ' => 'խ', - 'Ծ' => 'ծ', - 'Կ' => 'կ', - 'Հ' => 'հ', - 'Ձ' => 'ձ', - 'Ղ' => 'ղ', - 'Ճ' => 'ճ', - 'Մ' => 'մ', - 'Յ' => 'յ', - 'Ն' => 'ն', - 'Շ' => 'շ', - 'Ո' => 'ո', - 'Չ' => 'չ', - 'Պ' => 'պ', - 'Ջ' => 'ջ', - 'Ռ' => 'ռ', - 'Ս' => 'ս', - 'Վ' => 'վ', - 'Տ' => 'տ', - 'Ր' => 'ր', - 'Ց' => 'ց', - 'Ւ' => 'ւ', - 'Փ' => 'փ', - 'Ք' => 'ք', - 'Օ' => 'օ', - 'Ֆ' => 'ֆ', - 'Ⴀ' => 'ⴀ', - 'Ⴁ' => 'ⴁ', - 'Ⴂ' => 'ⴂ', - 'Ⴃ' => 'ⴃ', - 'Ⴄ' => 'ⴄ', - 'Ⴅ' => 'ⴅ', - 'Ⴆ' => 'ⴆ', - 'Ⴇ' => 'ⴇ', - 'Ⴈ' => 'ⴈ', - 'Ⴉ' => 'ⴉ', - 'Ⴊ' => 'ⴊ', - 'Ⴋ' => 'ⴋ', - 'Ⴌ' => 'ⴌ', - 'Ⴍ' => 'ⴍ', - 'Ⴎ' => 'ⴎ', - 'Ⴏ' => 'ⴏ', - 'Ⴐ' => 'ⴐ', - 'Ⴑ' => 'ⴑ', - 'Ⴒ' => 'ⴒ', - 'Ⴓ' => 'ⴓ', - 'Ⴔ' => 'ⴔ', - 'Ⴕ' => 'ⴕ', - 'Ⴖ' => 'ⴖ', - 'Ⴗ' => 'ⴗ', - 'Ⴘ' => 'ⴘ', - 'Ⴙ' => 'ⴙ', - 'Ⴚ' => 'ⴚ', - 'Ⴛ' => 'ⴛ', - 'Ⴜ' => 'ⴜ', - 'Ⴝ' => 'ⴝ', - 'Ⴞ' => 'ⴞ', - 'Ⴟ' => 'ⴟ', - 'Ⴠ' => 'ⴠ', - 'Ⴡ' => 'ⴡ', - 'Ⴢ' => 'ⴢ', - 'Ⴣ' => 'ⴣ', - 'Ⴤ' => 'ⴤ', - 'Ⴥ' => 'ⴥ', - 'Ⴧ' => 'ⴧ', - 'Ⴭ' => 'ⴭ', - 'Ḁ' => 'ḁ', - 'Ḃ' => 'ḃ', - 'Ḅ' => 'ḅ', - 'Ḇ' => 'ḇ', - 'Ḉ' => 'ḉ', - 'Ḋ' => 'ḋ', - 'Ḍ' => 'ḍ', - 'Ḏ' => 'ḏ', - 'Ḑ' => 'ḑ', - 'Ḓ' => 'ḓ', - 'Ḕ' => 'ḕ', - 'Ḗ' => 'ḗ', - 'Ḙ' => 'ḙ', - 'Ḛ' => 'ḛ', - 'Ḝ' => 'ḝ', - 'Ḟ' => 'ḟ', - 'Ḡ' => 'ḡ', - 'Ḣ' => 'ḣ', - 'Ḥ' => 'ḥ', - 'Ḧ' => 'ḧ', - 'Ḩ' => 'ḩ', - 'Ḫ' => 'ḫ', - 'Ḭ' => 'ḭ', - 'Ḯ' => 'ḯ', - 'Ḱ' => 'ḱ', - 'Ḳ' => 'ḳ', - 'Ḵ' => 'ḵ', - 'Ḷ' => 'ḷ', - 'Ḹ' => 'ḹ', - 'Ḻ' => 'ḻ', - 'Ḽ' => 'ḽ', - 'Ḿ' => 'ḿ', - 'Ṁ' => 'ṁ', - 'Ṃ' => 'ṃ', - 'Ṅ' => 'ṅ', - 'Ṇ' => 'ṇ', - 'Ṉ' => 'ṉ', - 'Ṋ' => 'ṋ', - 'Ṍ' => 'ṍ', - 'Ṏ' => 'ṏ', - 'Ṑ' => 'ṑ', - 'Ṓ' => 'ṓ', - 'Ṕ' => 'ṕ', - 'Ṗ' => 'ṗ', - 'Ṙ' => 'ṙ', - 'Ṛ' => 'ṛ', - 'Ṝ' => 'ṝ', - 'Ṟ' => 'ṟ', - 'Ṡ' => 'ṡ', - 'Ṣ' => 'ṣ', - 'Ṥ' => 'ṥ', - 'Ṧ' => 'ṧ', - 'Ṩ' => 'ṩ', - 'Ṫ' => 'ṫ', - 'Ṭ' => 'ṭ', - 'Ṯ' => 'ṯ', - 'Ṱ' => 'ṱ', - 'Ṳ' => 'ṳ', - 'Ṵ' => 'ṵ', - 'Ṷ' => 'ṷ', - 'Ṹ' => 'ṹ', - 'Ṻ' => 'ṻ', - 'Ṽ' => 'ṽ', - 'Ṿ' => 'ṿ', - 'Ẁ' => 'ẁ', - 'Ẃ' => 'ẃ', - 'Ẅ' => 'ẅ', - 'Ẇ' => 'ẇ', - 'Ẉ' => 'ẉ', - 'Ẋ' => 'ẋ', - 'Ẍ' => 'ẍ', - 'Ẏ' => 'ẏ', - 'Ẑ' => 'ẑ', - 'Ẓ' => 'ẓ', - 'Ẕ' => 'ẕ', - 'ẞ' => 'ß', - 'Ạ' => 'ạ', - 'Ả' => 'ả', - 'Ấ' => 'ấ', - 'Ầ' => 'ầ', - 'Ẩ' => 'ẩ', - 'Ẫ' => 'ẫ', - 'Ậ' => 'ậ', - 'Ắ' => 'ắ', - 'Ằ' => 'ằ', - 'Ẳ' => 'ẳ', - 'Ẵ' => 'ẵ', - 'Ặ' => 'ặ', - 'Ẹ' => 'ẹ', - 'Ẻ' => 'ẻ', - 'Ẽ' => 'ẽ', - 'Ế' => 'ế', - 'Ề' => 'ề', - 'Ể' => 'ể', - 'Ễ' => 'ễ', - 'Ệ' => 'ệ', - 'Ỉ' => 'ỉ', - 'Ị' => 'ị', - 'Ọ' => 'ọ', - 'Ỏ' => 'ỏ', - 'Ố' => 'ố', - 'Ồ' => 'ồ', - 'Ổ' => 'ổ', - 'Ỗ' => 'ỗ', - 'Ộ' => 'ộ', - 'Ớ' => 'ớ', - 'Ờ' => 'ờ', - 'Ở' => 'ở', - 'Ỡ' => 'ỡ', - 'Ợ' => 'ợ', - 'Ụ' => 'ụ', - 'Ủ' => 'ủ', - 'Ứ' => 'ứ', - 'Ừ' => 'ừ', - 'Ử' => 'ử', - 'Ữ' => 'ữ', - 'Ự' => 'ự', - 'Ỳ' => 'ỳ', - 'Ỵ' => 'ỵ', - 'Ỷ' => 'ỷ', - 'Ỹ' => 'ỹ', - 'Ỻ' => 'ỻ', - 'Ỽ' => 'ỽ', - 'Ỿ' => 'ỿ', - 'Ἀ' => 'ἀ', - 'Ἁ' => 'ἁ', - 'Ἂ' => 'ἂ', - 'Ἃ' => 'ἃ', - 'Ἄ' => 'ἄ', - 'Ἅ' => 'ἅ', - 'Ἆ' => 'ἆ', - 'Ἇ' => 'ἇ', - 'Ἐ' => 'ἐ', - 'Ἑ' => 'ἑ', - 'Ἒ' => 'ἒ', - 'Ἓ' => 'ἓ', - 'Ἔ' => 'ἔ', - 'Ἕ' => 'ἕ', - 'Ἠ' => 'ἠ', - 'Ἡ' => 'ἡ', - 'Ἢ' => 'ἢ', - 'Ἣ' => 'ἣ', - 'Ἤ' => 'ἤ', - 'Ἥ' => 'ἥ', - 'Ἦ' => 'ἦ', - 'Ἧ' => 'ἧ', - 'Ἰ' => 'ἰ', - 'Ἱ' => 'ἱ', - 'Ἲ' => 'ἲ', - 'Ἳ' => 'ἳ', - 'Ἴ' => 'ἴ', - 'Ἵ' => 'ἵ', - 'Ἶ' => 'ἶ', - 'Ἷ' => 'ἷ', - 'Ὀ' => 'ὀ', - 'Ὁ' => 'ὁ', - 'Ὂ' => 'ὂ', - 'Ὃ' => 'ὃ', - 'Ὄ' => 'ὄ', - 'Ὅ' => 'ὅ', - 'Ὑ' => 'ὑ', - 'Ὓ' => 'ὓ', - 'Ὕ' => 'ὕ', - 'Ὗ' => 'ὗ', - 'Ὠ' => 'ὠ', - 'Ὡ' => 'ὡ', - 'Ὢ' => 'ὢ', - 'Ὣ' => 'ὣ', - 'Ὤ' => 'ὤ', - 'Ὥ' => 'ὥ', - 'Ὦ' => 'ὦ', - 'Ὧ' => 'ὧ', - 'ᾈ' => 'ᾀ', - 'ᾉ' => 'ᾁ', - 'ᾊ' => 'ᾂ', - 'ᾋ' => 'ᾃ', - 'ᾌ' => 'ᾄ', - 'ᾍ' => 'ᾅ', - 'ᾎ' => 'ᾆ', - 'ᾏ' => 'ᾇ', - 'ᾘ' => 'ᾐ', - 'ᾙ' => 'ᾑ', - 'ᾚ' => 'ᾒ', - 'ᾛ' => 'ᾓ', - 'ᾜ' => 'ᾔ', - 'ᾝ' => 'ᾕ', - 'ᾞ' => 'ᾖ', - 'ᾟ' => 'ᾗ', - 'ᾨ' => 'ᾠ', - 'ᾩ' => 'ᾡ', - 'ᾪ' => 'ᾢ', - 'ᾫ' => 'ᾣ', - 'ᾬ' => 'ᾤ', - 'ᾭ' => 'ᾥ', - 'ᾮ' => 'ᾦ', - 'ᾯ' => 'ᾧ', - 'Ᾰ' => 'ᾰ', - 'Ᾱ' => 'ᾱ', - 'Ὰ' => 'ὰ', - 'Ά' => 'ά', - 'ᾼ' => 'ᾳ', - 'Ὲ' => 'ὲ', - 'Έ' => 'έ', - 'Ὴ' => 'ὴ', - 'Ή' => 'ή', - 'ῌ' => 'ῃ', - 'Ῐ' => 'ῐ', - 'Ῑ' => 'ῑ', - 'Ὶ' => 'ὶ', - 'Ί' => 'ί', - 'Ῠ' => 'ῠ', - 'Ῡ' => 'ῡ', - 'Ὺ' => 'ὺ', - 'Ύ' => 'ύ', - 'Ῥ' => 'ῥ', - 'Ὸ' => 'ὸ', - 'Ό' => 'ό', - 'Ὼ' => 'ὼ', - 'Ώ' => 'ώ', - 'ῼ' => 'ῳ', - 'Ω' => 'ω', - 'K' => 'k', - 'Å' => 'å', - 'Ⅎ' => 'ⅎ', - 'Ⅰ' => 'ⅰ', - 'Ⅱ' => 'ⅱ', - 'Ⅲ' => 'ⅲ', - 'Ⅳ' => 'ⅳ', - 'Ⅴ' => 'ⅴ', - 'Ⅵ' => 'ⅵ', - 'Ⅶ' => 'ⅶ', - 'Ⅷ' => 'ⅷ', - 'Ⅸ' => 'ⅸ', - 'Ⅹ' => 'ⅹ', - 'Ⅺ' => 'ⅺ', - 'Ⅻ' => 'ⅻ', - 'Ⅼ' => 'ⅼ', - 'Ⅽ' => 'ⅽ', - 'Ⅾ' => 'ⅾ', - 'Ⅿ' => 'ⅿ', - 'Ↄ' => 'ↄ', - 'Ⓐ' => 'ⓐ', - 'Ⓑ' => 'ⓑ', - 'Ⓒ' => 'ⓒ', - 'Ⓓ' => 'ⓓ', - 'Ⓔ' => 'ⓔ', - 'Ⓕ' => 'ⓕ', - 'Ⓖ' => 'ⓖ', - 'Ⓗ' => 'ⓗ', - 'Ⓘ' => 'ⓘ', - 'Ⓙ' => 'ⓙ', - 'Ⓚ' => 'ⓚ', - 'Ⓛ' => 'ⓛ', - 'Ⓜ' => 'ⓜ', - 'Ⓝ' => 'ⓝ', - 'Ⓞ' => 'ⓞ', - 'Ⓟ' => 'ⓟ', - 'Ⓠ' => 'ⓠ', - 'Ⓡ' => 'ⓡ', - 'Ⓢ' => 'ⓢ', - 'Ⓣ' => 'ⓣ', - 'Ⓤ' => 'ⓤ', - 'Ⓥ' => 'ⓥ', - 'Ⓦ' => 'ⓦ', - 'Ⓧ' => 'ⓧ', - 'Ⓨ' => 'ⓨ', - 'Ⓩ' => 'ⓩ', - 'Ⰰ' => 'ⰰ', - 'Ⰱ' => 'ⰱ', - 'Ⰲ' => 'ⰲ', - 'Ⰳ' => 'ⰳ', - 'Ⰴ' => 'ⰴ', - 'Ⰵ' => 'ⰵ', - 'Ⰶ' => 'ⰶ', - 'Ⰷ' => 'ⰷ', - 'Ⰸ' => 'ⰸ', - 'Ⰹ' => 'ⰹ', - 'Ⰺ' => 'ⰺ', - 'Ⰻ' => 'ⰻ', - 'Ⰼ' => 'ⰼ', - 'Ⰽ' => 'ⰽ', - 'Ⰾ' => 'ⰾ', - 'Ⰿ' => 'ⰿ', - 'Ⱀ' => 'ⱀ', - 'Ⱁ' => 'ⱁ', - 'Ⱂ' => 'ⱂ', - 'Ⱃ' => 'ⱃ', - 'Ⱄ' => 'ⱄ', - 'Ⱅ' => 'ⱅ', - 'Ⱆ' => 'ⱆ', - 'Ⱇ' => 'ⱇ', - 'Ⱈ' => 'ⱈ', - 'Ⱉ' => 'ⱉ', - 'Ⱊ' => 'ⱊ', - 'Ⱋ' => 'ⱋ', - 'Ⱌ' => 'ⱌ', - 'Ⱍ' => 'ⱍ', - 'Ⱎ' => 'ⱎ', - 'Ⱏ' => 'ⱏ', - 'Ⱐ' => 'ⱐ', - 'Ⱑ' => 'ⱑ', - 'Ⱒ' => 'ⱒ', - 'Ⱓ' => 'ⱓ', - 'Ⱔ' => 'ⱔ', - 'Ⱕ' => 'ⱕ', - 'Ⱖ' => 'ⱖ', - 'Ⱗ' => 'ⱗ', - 'Ⱘ' => 'ⱘ', - 'Ⱙ' => 'ⱙ', - 'Ⱚ' => 'ⱚ', - 'Ⱛ' => 'ⱛ', - 'Ⱜ' => 'ⱜ', - 'Ⱝ' => 'ⱝ', - 'Ⱞ' => 'ⱞ', - 'Ⱡ' => 'ⱡ', - 'Ɫ' => 'ɫ', - 'Ᵽ' => 'ᵽ', - 'Ɽ' => 'ɽ', - 'Ⱨ' => 'ⱨ', - 'Ⱪ' => 'ⱪ', - 'Ⱬ' => 'ⱬ', - 'Ɑ' => 'ɑ', - 'Ɱ' => 'ɱ', - 'Ɐ' => 'ɐ', - 'Ɒ' => 'ɒ', - 'Ⱳ' => 'ⱳ', - 'Ⱶ' => 'ⱶ', - 'Ȿ' => 'ȿ', - 'Ɀ' => 'ɀ', - 'Ⲁ' => 'ⲁ', - 'Ⲃ' => 'ⲃ', - 'Ⲅ' => 'ⲅ', - 'Ⲇ' => 'ⲇ', - 'Ⲉ' => 'ⲉ', - 'Ⲋ' => 'ⲋ', - 'Ⲍ' => 'ⲍ', - 'Ⲏ' => 'ⲏ', - 'Ⲑ' => 'ⲑ', - 'Ⲓ' => 'ⲓ', - 'Ⲕ' => 'ⲕ', - 'Ⲗ' => 'ⲗ', - 'Ⲙ' => 'ⲙ', - 'Ⲛ' => 'ⲛ', - 'Ⲝ' => 'ⲝ', - 'Ⲟ' => 'ⲟ', - 'Ⲡ' => 'ⲡ', - 'Ⲣ' => 'ⲣ', - 'Ⲥ' => 'ⲥ', - 'Ⲧ' => 'ⲧ', - 'Ⲩ' => 'ⲩ', - 'Ⲫ' => 'ⲫ', - 'Ⲭ' => 'ⲭ', - 'Ⲯ' => 'ⲯ', - 'Ⲱ' => 'ⲱ', - 'Ⲳ' => 'ⲳ', - 'Ⲵ' => 'ⲵ', - 'Ⲷ' => 'ⲷ', - 'Ⲹ' => 'ⲹ', - 'Ⲻ' => 'ⲻ', - 'Ⲽ' => 'ⲽ', - 'Ⲿ' => 'ⲿ', - 'Ⳁ' => 'ⳁ', - 'Ⳃ' => 'ⳃ', - 'Ⳅ' => 'ⳅ', - 'Ⳇ' => 'ⳇ', - 'Ⳉ' => 'ⳉ', - 'Ⳋ' => 'ⳋ', - 'Ⳍ' => 'ⳍ', - 'Ⳏ' => 'ⳏ', - 'Ⳑ' => 'ⳑ', - 'Ⳓ' => 'ⳓ', - 'Ⳕ' => 'ⳕ', - 'Ⳗ' => 'ⳗ', - 'Ⳙ' => 'ⳙ', - 'Ⳛ' => 'ⳛ', - 'Ⳝ' => 'ⳝ', - 'Ⳟ' => 'ⳟ', - 'Ⳡ' => 'ⳡ', - 'Ⳣ' => 'ⳣ', - 'Ⳬ' => 'ⳬ', - 'Ⳮ' => 'ⳮ', - 'Ⳳ' => 'ⳳ', - 'Ꙁ' => 'ꙁ', - 'Ꙃ' => 'ꙃ', - 'Ꙅ' => 'ꙅ', - 'Ꙇ' => 'ꙇ', - 'Ꙉ' => 'ꙉ', - 'Ꙋ' => 'ꙋ', - 'Ꙍ' => 'ꙍ', - 'Ꙏ' => 'ꙏ', - 'Ꙑ' => 'ꙑ', - 'Ꙓ' => 'ꙓ', - 'Ꙕ' => 'ꙕ', - 'Ꙗ' => 'ꙗ', - 'Ꙙ' => 'ꙙ', - 'Ꙛ' => 'ꙛ', - 'Ꙝ' => 'ꙝ', - 'Ꙟ' => 'ꙟ', - 'Ꙡ' => 'ꙡ', - 'Ꙣ' => 'ꙣ', - 'Ꙥ' => 'ꙥ', - 'Ꙧ' => 'ꙧ', - 'Ꙩ' => 'ꙩ', - 'Ꙫ' => 'ꙫ', - 'Ꙭ' => 'ꙭ', - 'Ꚁ' => 'ꚁ', - 'Ꚃ' => 'ꚃ', - 'Ꚅ' => 'ꚅ', - 'Ꚇ' => 'ꚇ', - 'Ꚉ' => 'ꚉ', - 'Ꚋ' => 'ꚋ', - 'Ꚍ' => 'ꚍ', - 'Ꚏ' => 'ꚏ', - 'Ꚑ' => 'ꚑ', - 'Ꚓ' => 'ꚓ', - 'Ꚕ' => 'ꚕ', - 'Ꚗ' => 'ꚗ', - 'Ꚙ' => 'ꚙ', - 'Ꚛ' => 'ꚛ', - 'Ꜣ' => 'ꜣ', - 'Ꜥ' => 'ꜥ', - 'Ꜧ' => 'ꜧ', - 'Ꜩ' => 'ꜩ', - 'Ꜫ' => 'ꜫ', - 'Ꜭ' => 'ꜭ', - 'Ꜯ' => 'ꜯ', - 'Ꜳ' => 'ꜳ', - 'Ꜵ' => 'ꜵ', - 'Ꜷ' => 'ꜷ', - 'Ꜹ' => 'ꜹ', - 'Ꜻ' => 'ꜻ', - 'Ꜽ' => 'ꜽ', - 'Ꜿ' => 'ꜿ', - 'Ꝁ' => 'ꝁ', - 'Ꝃ' => 'ꝃ', - 'Ꝅ' => 'ꝅ', - 'Ꝇ' => 'ꝇ', - 'Ꝉ' => 'ꝉ', - 'Ꝋ' => 'ꝋ', - 'Ꝍ' => 'ꝍ', - 'Ꝏ' => 'ꝏ', - 'Ꝑ' => 'ꝑ', - 'Ꝓ' => 'ꝓ', - 'Ꝕ' => 'ꝕ', - 'Ꝗ' => 'ꝗ', - 'Ꝙ' => 'ꝙ', - 'Ꝛ' => 'ꝛ', - 'Ꝝ' => 'ꝝ', - 'Ꝟ' => 'ꝟ', - 'Ꝡ' => 'ꝡ', - 'Ꝣ' => 'ꝣ', - 'Ꝥ' => 'ꝥ', - 'Ꝧ' => 'ꝧ', - 'Ꝩ' => 'ꝩ', - 'Ꝫ' => 'ꝫ', - 'Ꝭ' => 'ꝭ', - 'Ꝯ' => 'ꝯ', - 'Ꝺ' => 'ꝺ', - 'Ꝼ' => 'ꝼ', - 'Ᵹ' => 'ᵹ', - 'Ꝿ' => 'ꝿ', - 'Ꞁ' => 'ꞁ', - 'Ꞃ' => 'ꞃ', - 'Ꞅ' => 'ꞅ', - 'Ꞇ' => 'ꞇ', - 'Ꞌ' => 'ꞌ', - 'Ɥ' => 'ɥ', - 'Ꞑ' => 'ꞑ', - 'Ꞓ' => 'ꞓ', - 'Ꞗ' => 'ꞗ', - 'Ꞙ' => 'ꞙ', - 'Ꞛ' => 'ꞛ', - 'Ꞝ' => 'ꞝ', - 'Ꞟ' => 'ꞟ', - 'Ꞡ' => 'ꞡ', - 'Ꞣ' => 'ꞣ', - 'Ꞥ' => 'ꞥ', - 'Ꞧ' => 'ꞧ', - 'Ꞩ' => 'ꞩ', - 'Ɦ' => 'ɦ', - 'Ɜ' => 'ɜ', - 'Ɡ' => 'ɡ', - 'Ɬ' => 'ɬ', - 'Ʞ' => 'ʞ', - 'Ʇ' => 'ʇ', - 'A' => 'a', - 'B' => 'b', - 'C' => 'c', - 'D' => 'd', - 'E' => 'e', - 'F' => 'f', - 'G' => 'g', - 'H' => 'h', - 'I' => 'i', - 'J' => 'j', - 'K' => 'k', - 'L' => 'l', - 'M' => 'm', - 'N' => 'n', - 'O' => 'o', - 'P' => 'p', - 'Q' => 'q', - 'R' => 'r', - 'S' => 's', - 'T' => 't', - 'U' => 'u', - 'V' => 'v', - 'W' => 'w', - 'X' => 'x', - 'Y' => 'y', - 'Z' => 'z', - '𐐀' => '𐐨', - '𐐁' => '𐐩', - '𐐂' => '𐐪', - '𐐃' => '𐐫', - '𐐄' => '𐐬', - '𐐅' => '𐐭', - '𐐆' => '𐐮', - '𐐇' => '𐐯', - '𐐈' => '𐐰', - '𐐉' => '𐐱', - '𐐊' => '𐐲', - '𐐋' => '𐐳', - '𐐌' => '𐐴', - '𐐍' => '𐐵', - '𐐎' => '𐐶', - '𐐏' => '𐐷', - '𐐐' => '𐐸', - '𐐑' => '𐐹', - '𐐒' => '𐐺', - '𐐓' => '𐐻', - '𐐔' => '𐐼', - '𐐕' => '𐐽', - '𐐖' => '𐐾', - '𐐗' => '𐐿', - '𐐘' => '𐑀', - '𐐙' => '𐑁', - '𐐚' => '𐑂', - '𐐛' => '𐑃', - '𐐜' => '𐑄', - '𐐝' => '𐑅', - '𐐞' => '𐑆', - '𐐟' => '𐑇', - '𐐠' => '𐑈', - '𐐡' => '𐑉', - '𐐢' => '𐑊', - '𐐣' => '𐑋', - '𐐤' => '𐑌', - '𐐥' => '𐑍', - '𐐦' => '𐑎', - '𐐧' => '𐑏', - '𑢠' => '𑣀', - '𑢡' => '𑣁', - '𑢢' => '𑣂', - '𑢣' => '𑣃', - '𑢤' => '𑣄', - '𑢥' => '𑣅', - '𑢦' => '𑣆', - '𑢧' => '𑣇', - '𑢨' => '𑣈', - '𑢩' => '𑣉', - '𑢪' => '𑣊', - '𑢫' => '𑣋', - '𑢬' => '𑣌', - '𑢭' => '𑣍', - '𑢮' => '𑣎', - '𑢯' => '𑣏', - '𑢰' => '𑣐', - '𑢱' => '𑣑', - '𑢲' => '𑣒', - '𑢳' => '𑣓', - '𑢴' => '𑣔', - '𑢵' => '𑣕', - '𑢶' => '𑣖', - '𑢷' => '𑣗', - '𑢸' => '𑣘', - '𑢹' => '𑣙', - '𑢺' => '𑣚', - '𑢻' => '𑣛', - '𑢼' => '𑣜', - '𑢽' => '𑣝', - '𑢾' => '𑣞', - '𑢿' => '𑣟', -); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php deleted file mode 100644 index ec94221..0000000 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +++ /dev/null @@ -1,1109 +0,0 @@ - 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - 'µ' => 'Μ', - 'à' => 'À', - 'á' => 'Á', - 'â' => 'Â', - 'ã' => 'Ã', - 'ä' => 'Ä', - 'å' => 'Å', - 'æ' => 'Æ', - 'ç' => 'Ç', - 'è' => 'È', - 'é' => 'É', - 'ê' => 'Ê', - 'ë' => 'Ë', - 'ì' => 'Ì', - 'í' => 'Í', - 'î' => 'Î', - 'ï' => 'Ï', - 'ð' => 'Ð', - 'ñ' => 'Ñ', - 'ò' => 'Ò', - 'ó' => 'Ó', - 'ô' => 'Ô', - 'õ' => 'Õ', - 'ö' => 'Ö', - 'ø' => 'Ø', - 'ù' => 'Ù', - 'ú' => 'Ú', - 'û' => 'Û', - 'ü' => 'Ü', - 'ý' => 'Ý', - 'þ' => 'Þ', - 'ÿ' => 'Ÿ', - 'ā' => 'Ā', - 'ă' => 'Ă', - 'ą' => 'Ą', - 'ć' => 'Ć', - 'ĉ' => 'Ĉ', - 'ċ' => 'Ċ', - 'č' => 'Č', - 'ď' => 'Ď', - 'đ' => 'Đ', - 'ē' => 'Ē', - 'ĕ' => 'Ĕ', - 'ė' => 'Ė', - 'ę' => 'Ę', - 'ě' => 'Ě', - 'ĝ' => 'Ĝ', - 'ğ' => 'Ğ', - 'ġ' => 'Ġ', - 'ģ' => 'Ģ', - 'ĥ' => 'Ĥ', - 'ħ' => 'Ħ', - 'ĩ' => 'Ĩ', - 'ī' => 'Ī', - 'ĭ' => 'Ĭ', - 'į' => 'Į', - 'ı' => 'I', - 'ij' => 'IJ', - 'ĵ' => 'Ĵ', - 'ķ' => 'Ķ', - 'ĺ' => 'Ĺ', - 'ļ' => 'Ļ', - 'ľ' => 'Ľ', - 'ŀ' => 'Ŀ', - 'ł' => 'Ł', - 'ń' => 'Ń', - 'ņ' => 'Ņ', - 'ň' => 'Ň', - 'ŋ' => 'Ŋ', - 'ō' => 'Ō', - 'ŏ' => 'Ŏ', - 'ő' => 'Ő', - 'œ' => 'Œ', - 'ŕ' => 'Ŕ', - 'ŗ' => 'Ŗ', - 'ř' => 'Ř', - 'ś' => 'Ś', - 'ŝ' => 'Ŝ', - 'ş' => 'Ş', - 'š' => 'Š', - 'ţ' => 'Ţ', - 'ť' => 'Ť', - 'ŧ' => 'Ŧ', - 'ũ' => 'Ũ', - 'ū' => 'Ū', - 'ŭ' => 'Ŭ', - 'ů' => 'Ů', - 'ű' => 'Ű', - 'ų' => 'Ų', - 'ŵ' => 'Ŵ', - 'ŷ' => 'Ŷ', - 'ź' => 'Ź', - 'ż' => 'Ż', - 'ž' => 'Ž', - 'ſ' => 'S', - 'ƀ' => 'Ƀ', - 'ƃ' => 'Ƃ', - 'ƅ' => 'Ƅ', - 'ƈ' => 'Ƈ', - 'ƌ' => 'Ƌ', - 'ƒ' => 'Ƒ', - 'ƕ' => 'Ƕ', - 'ƙ' => 'Ƙ', - 'ƚ' => 'Ƚ', - 'ƞ' => 'Ƞ', - 'ơ' => 'Ơ', - 'ƣ' => 'Ƣ', - 'ƥ' => 'Ƥ', - 'ƨ' => 'Ƨ', - 'ƭ' => 'Ƭ', - 'ư' => 'Ư', - 'ƴ' => 'Ƴ', - 'ƶ' => 'Ƶ', - 'ƹ' => 'Ƹ', - 'ƽ' => 'Ƽ', - 'ƿ' => 'Ƿ', - 'Dž' => 'DŽ', - 'dž' => 'DŽ', - 'Lj' => 'LJ', - 'lj' => 'LJ', - 'Nj' => 'NJ', - 'nj' => 'NJ', - 'ǎ' => 'Ǎ', - 'ǐ' => 'Ǐ', - 'ǒ' => 'Ǒ', - 'ǔ' => 'Ǔ', - 'ǖ' => 'Ǖ', - 'ǘ' => 'Ǘ', - 'ǚ' => 'Ǚ', - 'ǜ' => 'Ǜ', - 'ǝ' => 'Ǝ', - 'ǟ' => 'Ǟ', - 'ǡ' => 'Ǡ', - 'ǣ' => 'Ǣ', - 'ǥ' => 'Ǥ', - 'ǧ' => 'Ǧ', - 'ǩ' => 'Ǩ', - 'ǫ' => 'Ǫ', - 'ǭ' => 'Ǭ', - 'ǯ' => 'Ǯ', - 'Dz' => 'DZ', - 'dz' => 'DZ', - 'ǵ' => 'Ǵ', - 'ǹ' => 'Ǹ', - 'ǻ' => 'Ǻ', - 'ǽ' => 'Ǽ', - 'ǿ' => 'Ǿ', - 'ȁ' => 'Ȁ', - 'ȃ' => 'Ȃ', - 'ȅ' => 'Ȅ', - 'ȇ' => 'Ȇ', - 'ȉ' => 'Ȉ', - 'ȋ' => 'Ȋ', - 'ȍ' => 'Ȍ', - 'ȏ' => 'Ȏ', - 'ȑ' => 'Ȑ', - 'ȓ' => 'Ȓ', - 'ȕ' => 'Ȕ', - 'ȗ' => 'Ȗ', - 'ș' => 'Ș', - 'ț' => 'Ț', - 'ȝ' => 'Ȝ', - 'ȟ' => 'Ȟ', - 'ȣ' => 'Ȣ', - 'ȥ' => 'Ȥ', - 'ȧ' => 'Ȧ', - 'ȩ' => 'Ȩ', - 'ȫ' => 'Ȫ', - 'ȭ' => 'Ȭ', - 'ȯ' => 'Ȯ', - 'ȱ' => 'Ȱ', - 'ȳ' => 'Ȳ', - 'ȼ' => 'Ȼ', - 'ȿ' => 'Ȿ', - 'ɀ' => 'Ɀ', - 'ɂ' => 'Ɂ', - 'ɇ' => 'Ɇ', - 'ɉ' => 'Ɉ', - 'ɋ' => 'Ɋ', - 'ɍ' => 'Ɍ', - 'ɏ' => 'Ɏ', - 'ɐ' => 'Ɐ', - 'ɑ' => 'Ɑ', - 'ɒ' => 'Ɒ', - 'ɓ' => 'Ɓ', - 'ɔ' => 'Ɔ', - 'ɖ' => 'Ɖ', - 'ɗ' => 'Ɗ', - 'ə' => 'Ə', - 'ɛ' => 'Ɛ', - 'ɜ' => 'Ɜ', - 'ɠ' => 'Ɠ', - 'ɡ' => 'Ɡ', - 'ɣ' => 'Ɣ', - 'ɥ' => 'Ɥ', - 'ɦ' => 'Ɦ', - 'ɨ' => 'Ɨ', - 'ɩ' => 'Ɩ', - 'ɫ' => 'Ɫ', - 'ɬ' => 'Ɬ', - 'ɯ' => 'Ɯ', - 'ɱ' => 'Ɱ', - 'ɲ' => 'Ɲ', - 'ɵ' => 'Ɵ', - 'ɽ' => 'Ɽ', - 'ʀ' => 'Ʀ', - 'ʃ' => 'Ʃ', - 'ʇ' => 'Ʇ', - 'ʈ' => 'Ʈ', - 'ʉ' => 'Ʉ', - 'ʊ' => 'Ʊ', - 'ʋ' => 'Ʋ', - 'ʌ' => 'Ʌ', - 'ʒ' => 'Ʒ', - 'ʞ' => 'Ʞ', - 'ͅ' => 'Ι', - 'ͱ' => 'Ͱ', - 'ͳ' => 'Ͳ', - 'ͷ' => 'Ͷ', - 'ͻ' => 'Ͻ', - 'ͼ' => 'Ͼ', - 'ͽ' => 'Ͽ', - 'ά' => 'Ά', - 'έ' => 'Έ', - 'ή' => 'Ή', - 'ί' => 'Ί', - 'α' => 'Α', - 'β' => 'Β', - 'γ' => 'Γ', - 'δ' => 'Δ', - 'ε' => 'Ε', - 'ζ' => 'Ζ', - 'η' => 'Η', - 'θ' => 'Θ', - 'ι' => 'Ι', - 'κ' => 'Κ', - 'λ' => 'Λ', - 'μ' => 'Μ', - 'ν' => 'Ν', - 'ξ' => 'Ξ', - 'ο' => 'Ο', - 'π' => 'Π', - 'ρ' => 'Ρ', - 'ς' => 'Σ', - 'σ' => 'Σ', - 'τ' => 'Τ', - 'υ' => 'Υ', - 'φ' => 'Φ', - 'χ' => 'Χ', - 'ψ' => 'Ψ', - 'ω' => 'Ω', - 'ϊ' => 'Ϊ', - 'ϋ' => 'Ϋ', - 'ό' => 'Ό', - 'ύ' => 'Ύ', - 'ώ' => 'Ώ', - 'ϐ' => 'Β', - 'ϑ' => 'Θ', - 'ϕ' => 'Φ', - 'ϖ' => 'Π', - 'ϗ' => 'Ϗ', - 'ϙ' => 'Ϙ', - 'ϛ' => 'Ϛ', - 'ϝ' => 'Ϝ', - 'ϟ' => 'Ϟ', - 'ϡ' => 'Ϡ', - 'ϣ' => 'Ϣ', - 'ϥ' => 'Ϥ', - 'ϧ' => 'Ϧ', - 'ϩ' => 'Ϩ', - 'ϫ' => 'Ϫ', - 'ϭ' => 'Ϭ', - 'ϯ' => 'Ϯ', - 'ϰ' => 'Κ', - 'ϱ' => 'Ρ', - 'ϲ' => 'Ϲ', - 'ϳ' => 'Ϳ', - 'ϵ' => 'Ε', - 'ϸ' => 'Ϸ', - 'ϻ' => 'Ϻ', - 'а' => 'А', - 'б' => 'Б', - 'в' => 'В', - 'г' => 'Г', - 'д' => 'Д', - 'е' => 'Е', - 'ж' => 'Ж', - 'з' => 'З', - 'и' => 'И', - 'й' => 'Й', - 'к' => 'К', - 'л' => 'Л', - 'м' => 'М', - 'н' => 'Н', - 'о' => 'О', - 'п' => 'П', - 'р' => 'Р', - 'с' => 'С', - 'т' => 'Т', - 'у' => 'У', - 'ф' => 'Ф', - 'х' => 'Х', - 'ц' => 'Ц', - 'ч' => 'Ч', - 'ш' => 'Ш', - 'щ' => 'Щ', - 'ъ' => 'Ъ', - 'ы' => 'Ы', - 'ь' => 'Ь', - 'э' => 'Э', - 'ю' => 'Ю', - 'я' => 'Я', - 'ѐ' => 'Ѐ', - 'ё' => 'Ё', - 'ђ' => 'Ђ', - 'ѓ' => 'Ѓ', - 'є' => 'Є', - 'ѕ' => 'Ѕ', - 'і' => 'І', - 'ї' => 'Ї', - 'ј' => 'Ј', - 'љ' => 'Љ', - 'њ' => 'Њ', - 'ћ' => 'Ћ', - 'ќ' => 'Ќ', - 'ѝ' => 'Ѝ', - 'ў' => 'Ў', - 'џ' => 'Џ', - 'ѡ' => 'Ѡ', - 'ѣ' => 'Ѣ', - 'ѥ' => 'Ѥ', - 'ѧ' => 'Ѧ', - 'ѩ' => 'Ѩ', - 'ѫ' => 'Ѫ', - 'ѭ' => 'Ѭ', - 'ѯ' => 'Ѯ', - 'ѱ' => 'Ѱ', - 'ѳ' => 'Ѳ', - 'ѵ' => 'Ѵ', - 'ѷ' => 'Ѷ', - 'ѹ' => 'Ѹ', - 'ѻ' => 'Ѻ', - 'ѽ' => 'Ѽ', - 'ѿ' => 'Ѿ', - 'ҁ' => 'Ҁ', - 'ҋ' => 'Ҋ', - 'ҍ' => 'Ҍ', - 'ҏ' => 'Ҏ', - 'ґ' => 'Ґ', - 'ғ' => 'Ғ', - 'ҕ' => 'Ҕ', - 'җ' => 'Җ', - 'ҙ' => 'Ҙ', - 'қ' => 'Қ', - 'ҝ' => 'Ҝ', - 'ҟ' => 'Ҟ', - 'ҡ' => 'Ҡ', - 'ң' => 'Ң', - 'ҥ' => 'Ҥ', - 'ҧ' => 'Ҧ', - 'ҩ' => 'Ҩ', - 'ҫ' => 'Ҫ', - 'ҭ' => 'Ҭ', - 'ү' => 'Ү', - 'ұ' => 'Ұ', - 'ҳ' => 'Ҳ', - 'ҵ' => 'Ҵ', - 'ҷ' => 'Ҷ', - 'ҹ' => 'Ҹ', - 'һ' => 'Һ', - 'ҽ' => 'Ҽ', - 'ҿ' => 'Ҿ', - 'ӂ' => 'Ӂ', - 'ӄ' => 'Ӄ', - 'ӆ' => 'Ӆ', - 'ӈ' => 'Ӈ', - 'ӊ' => 'Ӊ', - 'ӌ' => 'Ӌ', - 'ӎ' => 'Ӎ', - 'ӏ' => 'Ӏ', - 'ӑ' => 'Ӑ', - 'ӓ' => 'Ӓ', - 'ӕ' => 'Ӕ', - 'ӗ' => 'Ӗ', - 'ә' => 'Ә', - 'ӛ' => 'Ӛ', - 'ӝ' => 'Ӝ', - 'ӟ' => 'Ӟ', - 'ӡ' => 'Ӡ', - 'ӣ' => 'Ӣ', - 'ӥ' => 'Ӥ', - 'ӧ' => 'Ӧ', - 'ө' => 'Ө', - 'ӫ' => 'Ӫ', - 'ӭ' => 'Ӭ', - 'ӯ' => 'Ӯ', - 'ӱ' => 'Ӱ', - 'ӳ' => 'Ӳ', - 'ӵ' => 'Ӵ', - 'ӷ' => 'Ӷ', - 'ӹ' => 'Ӹ', - 'ӻ' => 'Ӻ', - 'ӽ' => 'Ӽ', - 'ӿ' => 'Ӿ', - 'ԁ' => 'Ԁ', - 'ԃ' => 'Ԃ', - 'ԅ' => 'Ԅ', - 'ԇ' => 'Ԇ', - 'ԉ' => 'Ԉ', - 'ԋ' => 'Ԋ', - 'ԍ' => 'Ԍ', - 'ԏ' => 'Ԏ', - 'ԑ' => 'Ԑ', - 'ԓ' => 'Ԓ', - 'ԕ' => 'Ԕ', - 'ԗ' => 'Ԗ', - 'ԙ' => 'Ԙ', - 'ԛ' => 'Ԛ', - 'ԝ' => 'Ԝ', - 'ԟ' => 'Ԟ', - 'ԡ' => 'Ԡ', - 'ԣ' => 'Ԣ', - 'ԥ' => 'Ԥ', - 'ԧ' => 'Ԧ', - 'ԩ' => 'Ԩ', - 'ԫ' => 'Ԫ', - 'ԭ' => 'Ԭ', - 'ԯ' => 'Ԯ', - 'ա' => 'Ա', - 'բ' => 'Բ', - 'գ' => 'Գ', - 'դ' => 'Դ', - 'ե' => 'Ե', - 'զ' => 'Զ', - 'է' => 'Է', - 'ը' => 'Ը', - 'թ' => 'Թ', - 'ժ' => 'Ժ', - 'ի' => 'Ի', - 'լ' => 'Լ', - 'խ' => 'Խ', - 'ծ' => 'Ծ', - 'կ' => 'Կ', - 'հ' => 'Հ', - 'ձ' => 'Ձ', - 'ղ' => 'Ղ', - 'ճ' => 'Ճ', - 'մ' => 'Մ', - 'յ' => 'Յ', - 'ն' => 'Ն', - 'շ' => 'Շ', - 'ո' => 'Ո', - 'չ' => 'Չ', - 'պ' => 'Պ', - 'ջ' => 'Ջ', - 'ռ' => 'Ռ', - 'ս' => 'Ս', - 'վ' => 'Վ', - 'տ' => 'Տ', - 'ր' => 'Ր', - 'ց' => 'Ց', - 'ւ' => 'Ւ', - 'փ' => 'Փ', - 'ք' => 'Ք', - 'օ' => 'Օ', - 'ֆ' => 'Ֆ', - 'ᵹ' => 'Ᵹ', - 'ᵽ' => 'Ᵽ', - 'ḁ' => 'Ḁ', - 'ḃ' => 'Ḃ', - 'ḅ' => 'Ḅ', - 'ḇ' => 'Ḇ', - 'ḉ' => 'Ḉ', - 'ḋ' => 'Ḋ', - 'ḍ' => 'Ḍ', - 'ḏ' => 'Ḏ', - 'ḑ' => 'Ḑ', - 'ḓ' => 'Ḓ', - 'ḕ' => 'Ḕ', - 'ḗ' => 'Ḗ', - 'ḙ' => 'Ḙ', - 'ḛ' => 'Ḛ', - 'ḝ' => 'Ḝ', - 'ḟ' => 'Ḟ', - 'ḡ' => 'Ḡ', - 'ḣ' => 'Ḣ', - 'ḥ' => 'Ḥ', - 'ḧ' => 'Ḧ', - 'ḩ' => 'Ḩ', - 'ḫ' => 'Ḫ', - 'ḭ' => 'Ḭ', - 'ḯ' => 'Ḯ', - 'ḱ' => 'Ḱ', - 'ḳ' => 'Ḳ', - 'ḵ' => 'Ḵ', - 'ḷ' => 'Ḷ', - 'ḹ' => 'Ḹ', - 'ḻ' => 'Ḻ', - 'ḽ' => 'Ḽ', - 'ḿ' => 'Ḿ', - 'ṁ' => 'Ṁ', - 'ṃ' => 'Ṃ', - 'ṅ' => 'Ṅ', - 'ṇ' => 'Ṇ', - 'ṉ' => 'Ṉ', - 'ṋ' => 'Ṋ', - 'ṍ' => 'Ṍ', - 'ṏ' => 'Ṏ', - 'ṑ' => 'Ṑ', - 'ṓ' => 'Ṓ', - 'ṕ' => 'Ṕ', - 'ṗ' => 'Ṗ', - 'ṙ' => 'Ṙ', - 'ṛ' => 'Ṛ', - 'ṝ' => 'Ṝ', - 'ṟ' => 'Ṟ', - 'ṡ' => 'Ṡ', - 'ṣ' => 'Ṣ', - 'ṥ' => 'Ṥ', - 'ṧ' => 'Ṧ', - 'ṩ' => 'Ṩ', - 'ṫ' => 'Ṫ', - 'ṭ' => 'Ṭ', - 'ṯ' => 'Ṯ', - 'ṱ' => 'Ṱ', - 'ṳ' => 'Ṳ', - 'ṵ' => 'Ṵ', - 'ṷ' => 'Ṷ', - 'ṹ' => 'Ṹ', - 'ṻ' => 'Ṻ', - 'ṽ' => 'Ṽ', - 'ṿ' => 'Ṿ', - 'ẁ' => 'Ẁ', - 'ẃ' => 'Ẃ', - 'ẅ' => 'Ẅ', - 'ẇ' => 'Ẇ', - 'ẉ' => 'Ẉ', - 'ẋ' => 'Ẋ', - 'ẍ' => 'Ẍ', - 'ẏ' => 'Ẏ', - 'ẑ' => 'Ẑ', - 'ẓ' => 'Ẓ', - 'ẕ' => 'Ẕ', - 'ẛ' => 'Ṡ', - 'ạ' => 'Ạ', - 'ả' => 'Ả', - 'ấ' => 'Ấ', - 'ầ' => 'Ầ', - 'ẩ' => 'Ẩ', - 'ẫ' => 'Ẫ', - 'ậ' => 'Ậ', - 'ắ' => 'Ắ', - 'ằ' => 'Ằ', - 'ẳ' => 'Ẳ', - 'ẵ' => 'Ẵ', - 'ặ' => 'Ặ', - 'ẹ' => 'Ẹ', - 'ẻ' => 'Ẻ', - 'ẽ' => 'Ẽ', - 'ế' => 'Ế', - 'ề' => 'Ề', - 'ể' => 'Ể', - 'ễ' => 'Ễ', - 'ệ' => 'Ệ', - 'ỉ' => 'Ỉ', - 'ị' => 'Ị', - 'ọ' => 'Ọ', - 'ỏ' => 'Ỏ', - 'ố' => 'Ố', - 'ồ' => 'Ồ', - 'ổ' => 'Ổ', - 'ỗ' => 'Ỗ', - 'ộ' => 'Ộ', - 'ớ' => 'Ớ', - 'ờ' => 'Ờ', - 'ở' => 'Ở', - 'ỡ' => 'Ỡ', - 'ợ' => 'Ợ', - 'ụ' => 'Ụ', - 'ủ' => 'Ủ', - 'ứ' => 'Ứ', - 'ừ' => 'Ừ', - 'ử' => 'Ử', - 'ữ' => 'Ữ', - 'ự' => 'Ự', - 'ỳ' => 'Ỳ', - 'ỵ' => 'Ỵ', - 'ỷ' => 'Ỷ', - 'ỹ' => 'Ỹ', - 'ỻ' => 'Ỻ', - 'ỽ' => 'Ỽ', - 'ỿ' => 'Ỿ', - 'ἀ' => 'Ἀ', - 'ἁ' => 'Ἁ', - 'ἂ' => 'Ἂ', - 'ἃ' => 'Ἃ', - 'ἄ' => 'Ἄ', - 'ἅ' => 'Ἅ', - 'ἆ' => 'Ἆ', - 'ἇ' => 'Ἇ', - 'ἐ' => 'Ἐ', - 'ἑ' => 'Ἑ', - 'ἒ' => 'Ἒ', - 'ἓ' => 'Ἓ', - 'ἔ' => 'Ἔ', - 'ἕ' => 'Ἕ', - 'ἠ' => 'Ἠ', - 'ἡ' => 'Ἡ', - 'ἢ' => 'Ἢ', - 'ἣ' => 'Ἣ', - 'ἤ' => 'Ἤ', - 'ἥ' => 'Ἥ', - 'ἦ' => 'Ἦ', - 'ἧ' => 'Ἧ', - 'ἰ' => 'Ἰ', - 'ἱ' => 'Ἱ', - 'ἲ' => 'Ἲ', - 'ἳ' => 'Ἳ', - 'ἴ' => 'Ἴ', - 'ἵ' => 'Ἵ', - 'ἶ' => 'Ἶ', - 'ἷ' => 'Ἷ', - 'ὀ' => 'Ὀ', - 'ὁ' => 'Ὁ', - 'ὂ' => 'Ὂ', - 'ὃ' => 'Ὃ', - 'ὄ' => 'Ὄ', - 'ὅ' => 'Ὅ', - 'ὑ' => 'Ὑ', - 'ὓ' => 'Ὓ', - 'ὕ' => 'Ὕ', - 'ὗ' => 'Ὗ', - 'ὠ' => 'Ὠ', - 'ὡ' => 'Ὡ', - 'ὢ' => 'Ὢ', - 'ὣ' => 'Ὣ', - 'ὤ' => 'Ὤ', - 'ὥ' => 'Ὥ', - 'ὦ' => 'Ὦ', - 'ὧ' => 'Ὧ', - 'ὰ' => 'Ὰ', - 'ά' => 'Ά', - 'ὲ' => 'Ὲ', - 'έ' => 'Έ', - 'ὴ' => 'Ὴ', - 'ή' => 'Ή', - 'ὶ' => 'Ὶ', - 'ί' => 'Ί', - 'ὸ' => 'Ὸ', - 'ό' => 'Ό', - 'ὺ' => 'Ὺ', - 'ύ' => 'Ύ', - 'ὼ' => 'Ὼ', - 'ώ' => 'Ώ', - 'ᾀ' => 'ᾈ', - 'ᾁ' => 'ᾉ', - 'ᾂ' => 'ᾊ', - 'ᾃ' => 'ᾋ', - 'ᾄ' => 'ᾌ', - 'ᾅ' => 'ᾍ', - 'ᾆ' => 'ᾎ', - 'ᾇ' => 'ᾏ', - 'ᾐ' => 'ᾘ', - 'ᾑ' => 'ᾙ', - 'ᾒ' => 'ᾚ', - 'ᾓ' => 'ᾛ', - 'ᾔ' => 'ᾜ', - 'ᾕ' => 'ᾝ', - 'ᾖ' => 'ᾞ', - 'ᾗ' => 'ᾟ', - 'ᾠ' => 'ᾨ', - 'ᾡ' => 'ᾩ', - 'ᾢ' => 'ᾪ', - 'ᾣ' => 'ᾫ', - 'ᾤ' => 'ᾬ', - 'ᾥ' => 'ᾭ', - 'ᾦ' => 'ᾮ', - 'ᾧ' => 'ᾯ', - 'ᾰ' => 'Ᾰ', - 'ᾱ' => 'Ᾱ', - 'ᾳ' => 'ᾼ', - 'ι' => 'Ι', - 'ῃ' => 'ῌ', - 'ῐ' => 'Ῐ', - 'ῑ' => 'Ῑ', - 'ῠ' => 'Ῠ', - 'ῡ' => 'Ῡ', - 'ῥ' => 'Ῥ', - 'ῳ' => 'ῼ', - 'ⅎ' => 'Ⅎ', - 'ⅰ' => 'Ⅰ', - 'ⅱ' => 'Ⅱ', - 'ⅲ' => 'Ⅲ', - 'ⅳ' => 'Ⅳ', - 'ⅴ' => 'Ⅴ', - 'ⅵ' => 'Ⅵ', - 'ⅶ' => 'Ⅶ', - 'ⅷ' => 'Ⅷ', - 'ⅸ' => 'Ⅸ', - 'ⅹ' => 'Ⅹ', - 'ⅺ' => 'Ⅺ', - 'ⅻ' => 'Ⅻ', - 'ⅼ' => 'Ⅼ', - 'ⅽ' => 'Ⅽ', - 'ⅾ' => 'Ⅾ', - 'ⅿ' => 'Ⅿ', - 'ↄ' => 'Ↄ', - 'ⓐ' => 'Ⓐ', - 'ⓑ' => 'Ⓑ', - 'ⓒ' => 'Ⓒ', - 'ⓓ' => 'Ⓓ', - 'ⓔ' => 'Ⓔ', - 'ⓕ' => 'Ⓕ', - 'ⓖ' => 'Ⓖ', - 'ⓗ' => 'Ⓗ', - 'ⓘ' => 'Ⓘ', - 'ⓙ' => 'Ⓙ', - 'ⓚ' => 'Ⓚ', - 'ⓛ' => 'Ⓛ', - 'ⓜ' => 'Ⓜ', - 'ⓝ' => 'Ⓝ', - 'ⓞ' => 'Ⓞ', - 'ⓟ' => 'Ⓟ', - 'ⓠ' => 'Ⓠ', - 'ⓡ' => 'Ⓡ', - 'ⓢ' => 'Ⓢ', - 'ⓣ' => 'Ⓣ', - 'ⓤ' => 'Ⓤ', - 'ⓥ' => 'Ⓥ', - 'ⓦ' => 'Ⓦ', - 'ⓧ' => 'Ⓧ', - 'ⓨ' => 'Ⓨ', - 'ⓩ' => 'Ⓩ', - 'ⰰ' => 'Ⰰ', - 'ⰱ' => 'Ⰱ', - 'ⰲ' => 'Ⰲ', - 'ⰳ' => 'Ⰳ', - 'ⰴ' => 'Ⰴ', - 'ⰵ' => 'Ⰵ', - 'ⰶ' => 'Ⰶ', - 'ⰷ' => 'Ⰷ', - 'ⰸ' => 'Ⰸ', - 'ⰹ' => 'Ⰹ', - 'ⰺ' => 'Ⰺ', - 'ⰻ' => 'Ⰻ', - 'ⰼ' => 'Ⰼ', - 'ⰽ' => 'Ⰽ', - 'ⰾ' => 'Ⰾ', - 'ⰿ' => 'Ⰿ', - 'ⱀ' => 'Ⱀ', - 'ⱁ' => 'Ⱁ', - 'ⱂ' => 'Ⱂ', - 'ⱃ' => 'Ⱃ', - 'ⱄ' => 'Ⱄ', - 'ⱅ' => 'Ⱅ', - 'ⱆ' => 'Ⱆ', - 'ⱇ' => 'Ⱇ', - 'ⱈ' => 'Ⱈ', - 'ⱉ' => 'Ⱉ', - 'ⱊ' => 'Ⱊ', - 'ⱋ' => 'Ⱋ', - 'ⱌ' => 'Ⱌ', - 'ⱍ' => 'Ⱍ', - 'ⱎ' => 'Ⱎ', - 'ⱏ' => 'Ⱏ', - 'ⱐ' => 'Ⱐ', - 'ⱑ' => 'Ⱑ', - 'ⱒ' => 'Ⱒ', - 'ⱓ' => 'Ⱓ', - 'ⱔ' => 'Ⱔ', - 'ⱕ' => 'Ⱕ', - 'ⱖ' => 'Ⱖ', - 'ⱗ' => 'Ⱗ', - 'ⱘ' => 'Ⱘ', - 'ⱙ' => 'Ⱙ', - 'ⱚ' => 'Ⱚ', - 'ⱛ' => 'Ⱛ', - 'ⱜ' => 'Ⱜ', - 'ⱝ' => 'Ⱝ', - 'ⱞ' => 'Ⱞ', - 'ⱡ' => 'Ⱡ', - 'ⱥ' => 'Ⱥ', - 'ⱦ' => 'Ⱦ', - 'ⱨ' => 'Ⱨ', - 'ⱪ' => 'Ⱪ', - 'ⱬ' => 'Ⱬ', - 'ⱳ' => 'Ⱳ', - 'ⱶ' => 'Ⱶ', - 'ⲁ' => 'Ⲁ', - 'ⲃ' => 'Ⲃ', - 'ⲅ' => 'Ⲅ', - 'ⲇ' => 'Ⲇ', - 'ⲉ' => 'Ⲉ', - 'ⲋ' => 'Ⲋ', - 'ⲍ' => 'Ⲍ', - 'ⲏ' => 'Ⲏ', - 'ⲑ' => 'Ⲑ', - 'ⲓ' => 'Ⲓ', - 'ⲕ' => 'Ⲕ', - 'ⲗ' => 'Ⲗ', - 'ⲙ' => 'Ⲙ', - 'ⲛ' => 'Ⲛ', - 'ⲝ' => 'Ⲝ', - 'ⲟ' => 'Ⲟ', - 'ⲡ' => 'Ⲡ', - 'ⲣ' => 'Ⲣ', - 'ⲥ' => 'Ⲥ', - 'ⲧ' => 'Ⲧ', - 'ⲩ' => 'Ⲩ', - 'ⲫ' => 'Ⲫ', - 'ⲭ' => 'Ⲭ', - 'ⲯ' => 'Ⲯ', - 'ⲱ' => 'Ⲱ', - 'ⲳ' => 'Ⲳ', - 'ⲵ' => 'Ⲵ', - 'ⲷ' => 'Ⲷ', - 'ⲹ' => 'Ⲹ', - 'ⲻ' => 'Ⲻ', - 'ⲽ' => 'Ⲽ', - 'ⲿ' => 'Ⲿ', - 'ⳁ' => 'Ⳁ', - 'ⳃ' => 'Ⳃ', - 'ⳅ' => 'Ⳅ', - 'ⳇ' => 'Ⳇ', - 'ⳉ' => 'Ⳉ', - 'ⳋ' => 'Ⳋ', - 'ⳍ' => 'Ⳍ', - 'ⳏ' => 'Ⳏ', - 'ⳑ' => 'Ⳑ', - 'ⳓ' => 'Ⳓ', - 'ⳕ' => 'Ⳕ', - 'ⳗ' => 'Ⳗ', - 'ⳙ' => 'Ⳙ', - 'ⳛ' => 'Ⳛ', - 'ⳝ' => 'Ⳝ', - 'ⳟ' => 'Ⳟ', - 'ⳡ' => 'Ⳡ', - 'ⳣ' => 'Ⳣ', - 'ⳬ' => 'Ⳬ', - 'ⳮ' => 'Ⳮ', - 'ⳳ' => 'Ⳳ', - 'ⴀ' => 'Ⴀ', - 'ⴁ' => 'Ⴁ', - 'ⴂ' => 'Ⴂ', - 'ⴃ' => 'Ⴃ', - 'ⴄ' => 'Ⴄ', - 'ⴅ' => 'Ⴅ', - 'ⴆ' => 'Ⴆ', - 'ⴇ' => 'Ⴇ', - 'ⴈ' => 'Ⴈ', - 'ⴉ' => 'Ⴉ', - 'ⴊ' => 'Ⴊ', - 'ⴋ' => 'Ⴋ', - 'ⴌ' => 'Ⴌ', - 'ⴍ' => 'Ⴍ', - 'ⴎ' => 'Ⴎ', - 'ⴏ' => 'Ⴏ', - 'ⴐ' => 'Ⴐ', - 'ⴑ' => 'Ⴑ', - 'ⴒ' => 'Ⴒ', - 'ⴓ' => 'Ⴓ', - 'ⴔ' => 'Ⴔ', - 'ⴕ' => 'Ⴕ', - 'ⴖ' => 'Ⴖ', - 'ⴗ' => 'Ⴗ', - 'ⴘ' => 'Ⴘ', - 'ⴙ' => 'Ⴙ', - 'ⴚ' => 'Ⴚ', - 'ⴛ' => 'Ⴛ', - 'ⴜ' => 'Ⴜ', - 'ⴝ' => 'Ⴝ', - 'ⴞ' => 'Ⴞ', - 'ⴟ' => 'Ⴟ', - 'ⴠ' => 'Ⴠ', - 'ⴡ' => 'Ⴡ', - 'ⴢ' => 'Ⴢ', - 'ⴣ' => 'Ⴣ', - 'ⴤ' => 'Ⴤ', - 'ⴥ' => 'Ⴥ', - 'ⴧ' => 'Ⴧ', - 'ⴭ' => 'Ⴭ', - 'ꙁ' => 'Ꙁ', - 'ꙃ' => 'Ꙃ', - 'ꙅ' => 'Ꙅ', - 'ꙇ' => 'Ꙇ', - 'ꙉ' => 'Ꙉ', - 'ꙋ' => 'Ꙋ', - 'ꙍ' => 'Ꙍ', - 'ꙏ' => 'Ꙏ', - 'ꙑ' => 'Ꙑ', - 'ꙓ' => 'Ꙓ', - 'ꙕ' => 'Ꙕ', - 'ꙗ' => 'Ꙗ', - 'ꙙ' => 'Ꙙ', - 'ꙛ' => 'Ꙛ', - 'ꙝ' => 'Ꙝ', - 'ꙟ' => 'Ꙟ', - 'ꙡ' => 'Ꙡ', - 'ꙣ' => 'Ꙣ', - 'ꙥ' => 'Ꙥ', - 'ꙧ' => 'Ꙧ', - 'ꙩ' => 'Ꙩ', - 'ꙫ' => 'Ꙫ', - 'ꙭ' => 'Ꙭ', - 'ꚁ' => 'Ꚁ', - 'ꚃ' => 'Ꚃ', - 'ꚅ' => 'Ꚅ', - 'ꚇ' => 'Ꚇ', - 'ꚉ' => 'Ꚉ', - 'ꚋ' => 'Ꚋ', - 'ꚍ' => 'Ꚍ', - 'ꚏ' => 'Ꚏ', - 'ꚑ' => 'Ꚑ', - 'ꚓ' => 'Ꚓ', - 'ꚕ' => 'Ꚕ', - 'ꚗ' => 'Ꚗ', - 'ꚙ' => 'Ꚙ', - 'ꚛ' => 'Ꚛ', - 'ꜣ' => 'Ꜣ', - 'ꜥ' => 'Ꜥ', - 'ꜧ' => 'Ꜧ', - 'ꜩ' => 'Ꜩ', - 'ꜫ' => 'Ꜫ', - 'ꜭ' => 'Ꜭ', - 'ꜯ' => 'Ꜯ', - 'ꜳ' => 'Ꜳ', - 'ꜵ' => 'Ꜵ', - 'ꜷ' => 'Ꜷ', - 'ꜹ' => 'Ꜹ', - 'ꜻ' => 'Ꜻ', - 'ꜽ' => 'Ꜽ', - 'ꜿ' => 'Ꜿ', - 'ꝁ' => 'Ꝁ', - 'ꝃ' => 'Ꝃ', - 'ꝅ' => 'Ꝅ', - 'ꝇ' => 'Ꝇ', - 'ꝉ' => 'Ꝉ', - 'ꝋ' => 'Ꝋ', - 'ꝍ' => 'Ꝍ', - 'ꝏ' => 'Ꝏ', - 'ꝑ' => 'Ꝑ', - 'ꝓ' => 'Ꝓ', - 'ꝕ' => 'Ꝕ', - 'ꝗ' => 'Ꝗ', - 'ꝙ' => 'Ꝙ', - 'ꝛ' => 'Ꝛ', - 'ꝝ' => 'Ꝝ', - 'ꝟ' => 'Ꝟ', - 'ꝡ' => 'Ꝡ', - 'ꝣ' => 'Ꝣ', - 'ꝥ' => 'Ꝥ', - 'ꝧ' => 'Ꝧ', - 'ꝩ' => 'Ꝩ', - 'ꝫ' => 'Ꝫ', - 'ꝭ' => 'Ꝭ', - 'ꝯ' => 'Ꝯ', - 'ꝺ' => 'Ꝺ', - 'ꝼ' => 'Ꝼ', - 'ꝿ' => 'Ꝿ', - 'ꞁ' => 'Ꞁ', - 'ꞃ' => 'Ꞃ', - 'ꞅ' => 'Ꞅ', - 'ꞇ' => 'Ꞇ', - 'ꞌ' => 'Ꞌ', - 'ꞑ' => 'Ꞑ', - 'ꞓ' => 'Ꞓ', - 'ꞗ' => 'Ꞗ', - 'ꞙ' => 'Ꞙ', - 'ꞛ' => 'Ꞛ', - 'ꞝ' => 'Ꞝ', - 'ꞟ' => 'Ꞟ', - 'ꞡ' => 'Ꞡ', - 'ꞣ' => 'Ꞣ', - 'ꞥ' => 'Ꞥ', - 'ꞧ' => 'Ꞧ', - 'ꞩ' => 'Ꞩ', - 'a' => 'A', - 'b' => 'B', - 'c' => 'C', - 'd' => 'D', - 'e' => 'E', - 'f' => 'F', - 'g' => 'G', - 'h' => 'H', - 'i' => 'I', - 'j' => 'J', - 'k' => 'K', - 'l' => 'L', - 'm' => 'M', - 'n' => 'N', - 'o' => 'O', - 'p' => 'P', - 'q' => 'Q', - 'r' => 'R', - 's' => 'S', - 't' => 'T', - 'u' => 'U', - 'v' => 'V', - 'w' => 'W', - 'x' => 'X', - 'y' => 'Y', - 'z' => 'Z', - '𐐨' => '𐐀', - '𐐩' => '𐐁', - '𐐪' => '𐐂', - '𐐫' => '𐐃', - '𐐬' => '𐐄', - '𐐭' => '𐐅', - '𐐮' => '𐐆', - '𐐯' => '𐐇', - '𐐰' => '𐐈', - '𐐱' => '𐐉', - '𐐲' => '𐐊', - '𐐳' => '𐐋', - '𐐴' => '𐐌', - '𐐵' => '𐐍', - '𐐶' => '𐐎', - '𐐷' => '𐐏', - '𐐸' => '𐐐', - '𐐹' => '𐐑', - '𐐺' => '𐐒', - '𐐻' => '𐐓', - '𐐼' => '𐐔', - '𐐽' => '𐐕', - '𐐾' => '𐐖', - '𐐿' => '𐐗', - '𐑀' => '𐐘', - '𐑁' => '𐐙', - '𐑂' => '𐐚', - '𐑃' => '𐐛', - '𐑄' => '𐐜', - '𐑅' => '𐐝', - '𐑆' => '𐐞', - '𐑇' => '𐐟', - '𐑈' => '𐐠', - '𐑉' => '𐐡', - '𐑊' => '𐐢', - '𐑋' => '𐐣', - '𐑌' => '𐐤', - '𐑍' => '𐐥', - '𐑎' => '𐐦', - '𐑏' => '𐐧', - '𑣀' => '𑢠', - '𑣁' => '𑢡', - '𑣂' => '𑢢', - '𑣃' => '𑢣', - '𑣄' => '𑢤', - '𑣅' => '𑢥', - '𑣆' => '𑢦', - '𑣇' => '𑢧', - '𑣈' => '𑢨', - '𑣉' => '𑢩', - '𑣊' => '𑢪', - '𑣋' => '𑢫', - '𑣌' => '𑢬', - '𑣍' => '𑢭', - '𑣎' => '𑢮', - '𑣏' => '𑢯', - '𑣐' => '𑢰', - '𑣑' => '𑢱', - '𑣒' => '𑢲', - '𑣓' => '𑢳', - '𑣔' => '𑢴', - '𑣕' => '𑢵', - '𑣖' => '𑢶', - '𑣗' => '𑢷', - '𑣘' => '𑢸', - '𑣙' => '𑢹', - '𑣚' => '𑢺', - '𑣛' => '𑢻', - '𑣜' => '𑢼', - '𑣝' => '𑢽', - '𑣞' => '𑢾', - '𑣟' => '𑢿', -); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php deleted file mode 100644 index 3372291..0000000 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Mbstring as p; - -if (!function_exists('mb_strlen')) { - define('MB_CASE_UPPER', 0); - define('MB_CASE_LOWER', 1); - define('MB_CASE_TITLE', 2); - - function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } - function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } - function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } - function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } - function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } - function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } - function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); } - function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); } - function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); } - function mb_parse_str($s, &$result = array()) { parse_str($s, $result); } - function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); } - function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); } - function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); } - function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); } - function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); } - function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); } - function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); } - function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); } - function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); } - function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); } - function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); } - function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); } - function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); } - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } - function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); } - function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); } - function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); } - function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); } - function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); } - function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); } -} -if (!function_exists('mb_chr')) { - function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); } - function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); } - function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); } -} diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json deleted file mode 100644 index 5946b5d..0000000 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "symfony/polyfill-mbstring", - "type": "library", - "description": "Symfony polyfill for the Mbstring extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=5.3.3" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - } -} diff --git a/vendor/symfony/routing/.gitignore b/vendor/symfony/routing/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/routing/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/routing/Annotation/Route.php b/vendor/symfony/routing/Annotation/Route.php deleted file mode 100644 index 5b3cbea..0000000 --- a/vendor/symfony/routing/Annotation/Route.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Annotation; - -/** - * Annotation class for @Route(). - * - * @Annotation - * @Target({"CLASS", "METHOD"}) - * - * @author Fabien Potencier - */ -class Route -{ - private $path; - private $name; - private $requirements = array(); - private $options = array(); - private $defaults = array(); - private $host; - private $methods = array(); - private $schemes = array(); - private $condition; - - /** - * @param array $data An array of key/value parameters - * - * @throws \BadMethodCallException - */ - public function __construct(array $data) - { - if (isset($data['value'])) { - $data['path'] = $data['value']; - unset($data['value']); - } - - foreach ($data as $key => $value) { - $method = 'set'.str_replace('_', '', $key); - if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this))); - } - $this->$method($value); - } - } - - public function setPath($path) - { - $this->path = $path; - } - - public function getPath() - { - return $this->path; - } - - public function setHost($pattern) - { - $this->host = $pattern; - } - - public function getHost() - { - return $this->host; - } - - public function setName($name) - { - $this->name = $name; - } - - public function getName() - { - return $this->name; - } - - public function setRequirements($requirements) - { - $this->requirements = $requirements; - } - - public function getRequirements() - { - return $this->requirements; - } - - public function setOptions($options) - { - $this->options = $options; - } - - public function getOptions() - { - return $this->options; - } - - public function setDefaults($defaults) - { - $this->defaults = $defaults; - } - - public function getDefaults() - { - return $this->defaults; - } - - public function setSchemes($schemes) - { - $this->schemes = is_array($schemes) ? $schemes : array($schemes); - } - - public function getSchemes() - { - return $this->schemes; - } - - public function setMethods($methods) - { - $this->methods = is_array($methods) ? $methods : array($methods); - } - - public function getMethods() - { - return $this->methods; - } - - public function setCondition($condition) - { - $this->condition = $condition; - } - - public function getCondition() - { - return $this->condition; - } -} diff --git a/vendor/symfony/routing/CHANGELOG.md b/vendor/symfony/routing/CHANGELOG.md deleted file mode 100644 index d04581f..0000000 --- a/vendor/symfony/routing/CHANGELOG.md +++ /dev/null @@ -1,219 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - - * [DEPRECATION] Class parameters have been deprecated and will be removed in 4.0. - * router.options.generator_class - * router.options.generator_base_class - * router.options.generator_dumper_class - * router.options.matcher_class - * router.options.matcher_base_class - * router.options.matcher_dumper_class - * router.options.matcher.cache_class - * router.options.generator.cache_class - -3.2.0 ------ - - * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations. - * Added support for UTF-8 requirements - -2.8.0 ------ - - * allowed specifying a directory to recursively load all routing configuration files it contains - * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded - by calling a method on an object/service. - * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method. - Use the constants defined in the `UrlGeneratorInterface` instead. - - Before: - - ```php - $router->generate('blog_show', array('slug' => 'my-blog-post'), true); - ``` - - After: - - ```php - use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - - $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL); - ``` - -2.5.0 ------ - - * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and - will be removed in Symfony 3.0, since the performance gains were minimal and - it's hard to replicate the behaviour of PHP implementation. - -2.3.0 ------ - - * added RequestContext::getQueryString() - -2.2.0 ------ - - * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0): - - * The `pattern` setting for a route has been deprecated in favor of `path` - * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings - - Before: - - ```yaml - article_edit: - pattern: /article/{id} - requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' } - ``` - - ```xml - - POST|PUT - https - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPattern('/article/{id}'); - $route->setRequirement('_method', 'POST|PUT'); - $route->setRequirement('_scheme', 'https'); - ``` - - After: - - ```yaml - article_edit: - path: /article/{id} - methods: [POST, PUT] - schemes: https - requirements: { 'id': '\d+' } - ``` - - ```xml - - \d+ - - ``` - - ```php - $route = new Route(); - $route->setPath('/article/{id}'); - $route->setMethods(array('POST', 'PUT')); - $route->setSchemes('https'); - ``` - - * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as - a flat array of Routes. So when using PHP to build the RouteCollection, you must - make sure to add routes to the sub-collection before adding it to the parent - collection (this is not relevant when using YAML or XML for Route definitions). - - Before: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $rootCollection->addCollection($subCollection); - $subCollection->add('foo', new Route('/foo')); - ``` - - After: - - ```php - $rootCollection = new RouteCollection(); - $subCollection = new RouteCollection(); - $subCollection->add('foo', new Route('/foo')); - $rootCollection->addCollection($subCollection); - ``` - - Also one must call `addCollection` from the bottom to the top hierarchy. - So the correct sequence is the following (and not the reverse): - - ```php - $childCollection->addCollection($grandchildCollection); - $rootCollection->addCollection($childCollection); - ``` - - * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()` - have been deprecated and will be removed in Symfony 2.3. - * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements - or options without adding a prefix is not supported anymore. So if you called `addPrefix` - with an empty prefix or `/` only (both have no relevance), like - `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)` - you need to use the new dedicated methods `addDefaults($defaultsArray)`, - `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead. - * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated - because adding options has nothing to do with adding a path prefix. If you want to add options - to all child routes of a RouteCollection, you can use `addOptions()`. - * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated - because it suggested that all routes in the collection would have this prefix, which is - not necessarily true. On top of that, since there is no tree structure anymore, this method - is also useless. Don't worry about performance, prefix optimization for matching is still done - in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities. - * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be - used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` - will still work, but have been deprecated. The `addPrefix` method should be used for this - use-case instead. - Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))` - After: - ```php - $collection->addPrefix('/prefix', array(...), array(...)); - $parentCollection->addCollection($collection); - ``` - * added support for the method default argument values when defining a @Route - * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`. - * Characters that function as separator between placeholders are now whitelisted - to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`. - * [BC BREAK] The default requirement of a variable has been changed slightly. - Previously it disallowed the previous and the next char around a variable. Now - it disallows the slash (`/`) and the next char. Using the previous char added - no value and was problematic because the route `/index.{_format}` would be - matched by `/index.ht/ml`. - * The default requirement now uses possessive quantifiers when possible which - improves matching performance by up to 20% because it prevents backtracking - when it's not needed. - * The ConfigurableRequirementsInterface can now also be used to disable the requirements - check on URL generation completely by calling `setStrictRequirements(null)`. It - improves performance in production environment as you should know that params always - pass the requirements (otherwise it would break your link anyway). - * There is no restriction on the route name anymore. So non-alphanumeric characters - are now also allowed. - * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static - (only relevant if you implemented your own RouteCompiler). - * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g. - "../parent-file" and "//example.com/dir/file". The third parameter in - `UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)` - now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for - claritiy. The old method calls with a Boolean parameter will continue to work because they - equal the signature using the constants. - -2.1.0 ------ - - * added RequestMatcherInterface - * added RequestContext::fromRequest() - * the UrlMatcher does not throw a \LogicException anymore when the required - scheme is not the current one - * added TraceableUrlMatcher - * added the possibility to define options, default values and requirements - for placeholders in prefix, including imported routes - * added RouterInterface::getRouteCollection - * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they - were decoded twice before. Note that the `urldecode()` calls have been - changed for a single `rawurldecode()` in order to support `+` for input - paths. - * added RouteCollection::getRoot method to retrieve the root of a - RouteCollection tree - * [BC BREAK] made RouteCollection::setParent private which could not have - been used anyway without creating inconsistencies - * [BC BREAK] RouteCollection::remove also removes a route from parent - collections (not only from its children) - * added ConfigurableRequirementsInterface that allows to disable exceptions - (and generate empty URLs instead) when generating a route with an invalid - parameter value diff --git a/vendor/symfony/routing/CompiledRoute.php b/vendor/symfony/routing/CompiledRoute.php deleted file mode 100644 index 8ecf515..0000000 --- a/vendor/symfony/routing/CompiledRoute.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * CompiledRoutes are returned by the RouteCompiler class. - * - * @author Fabien Potencier - */ -class CompiledRoute implements \Serializable -{ - private $variables; - private $tokens; - private $staticPrefix; - private $regex; - private $pathVariables; - private $hostVariables; - private $hostRegex; - private $hostTokens; - - /** - * @param string $staticPrefix The static prefix of the compiled route - * @param string $regex The regular expression to use to match this route - * @param array $tokens An array of tokens to use to generate URL for this route - * @param array $pathVariables An array of path variables - * @param string|null $hostRegex Host regex - * @param array $hostTokens Host tokens - * @param array $hostVariables An array of host variables - * @param array $variables An array of variables (variables defined in the path and in the host patterns) - */ - public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array()) - { - $this->staticPrefix = (string) $staticPrefix; - $this->regex = $regex; - $this->tokens = $tokens; - $this->pathVariables = $pathVariables; - $this->hostRegex = $hostRegex; - $this->hostTokens = $hostTokens; - $this->hostVariables = $hostVariables; - $this->variables = $variables; - } - - /** - * {@inheritdoc} - */ - public function serialize() - { - return serialize(array( - 'vars' => $this->variables, - 'path_prefix' => $this->staticPrefix, - 'path_regex' => $this->regex, - 'path_tokens' => $this->tokens, - 'path_vars' => $this->pathVariables, - 'host_regex' => $this->hostRegex, - 'host_tokens' => $this->hostTokens, - 'host_vars' => $this->hostVariables, - )); - } - - /** - * {@inheritdoc} - */ - public function unserialize($serialized) - { - if (\PHP_VERSION_ID >= 70000) { - $data = unserialize($serialized, array('allowed_classes' => false)); - } else { - $data = unserialize($serialized); - } - - $this->variables = $data['vars']; - $this->staticPrefix = $data['path_prefix']; - $this->regex = $data['path_regex']; - $this->tokens = $data['path_tokens']; - $this->pathVariables = $data['path_vars']; - $this->hostRegex = $data['host_regex']; - $this->hostTokens = $data['host_tokens']; - $this->hostVariables = $data['host_vars']; - } - - /** - * Returns the static prefix. - * - * @return string The static prefix - */ - public function getStaticPrefix() - { - return $this->staticPrefix; - } - - /** - * Returns the regex. - * - * @return string The regex - */ - public function getRegex() - { - return $this->regex; - } - - /** - * Returns the host regex. - * - * @return string|null The host regex or null - */ - public function getHostRegex() - { - return $this->hostRegex; - } - - /** - * Returns the tokens. - * - * @return array The tokens - */ - public function getTokens() - { - return $this->tokens; - } - - /** - * Returns the host tokens. - * - * @return array The tokens - */ - public function getHostTokens() - { - return $this->hostTokens; - } - - /** - * Returns the variables. - * - * @return array The variables - */ - public function getVariables() - { - return $this->variables; - } - - /** - * Returns the path variables. - * - * @return array The variables - */ - public function getPathVariables() - { - return $this->pathVariables; - } - - /** - * Returns the host variables. - * - * @return array The variables - */ - public function getHostVariables() - { - return $this->hostVariables; - } -} diff --git a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php deleted file mode 100644 index 73a8f85..0000000 --- a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\DependencyInjection; - -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -/** - * Adds tagged routing.loader services to routing.resolver service. - * - * @author Fabien Potencier - */ -class RoutingResolverPass implements CompilerPassInterface -{ - private $resolverServiceId; - private $loaderTag; - - public function __construct($resolverServiceId = 'routing.resolver', $loaderTag = 'routing.loader') - { - $this->resolverServiceId = $resolverServiceId; - $this->loaderTag = $loaderTag; - } - - public function process(ContainerBuilder $container) - { - if (false === $container->hasDefinition($this->resolverServiceId)) { - return; - } - - $definition = $container->getDefinition($this->resolverServiceId); - - foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) { - $definition->addMethodCall('addLoader', array(new Reference($id))); - } - } -} diff --git a/vendor/symfony/routing/Exception/ExceptionInterface.php b/vendor/symfony/routing/Exception/ExceptionInterface.php deleted file mode 100644 index db76362..0000000 --- a/vendor/symfony/routing/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * ExceptionInterface. - * - * @author Alexandre Salomé - */ -interface ExceptionInterface -{ -} diff --git a/vendor/symfony/routing/Exception/InvalidParameterException.php b/vendor/symfony/routing/Exception/InvalidParameterException.php deleted file mode 100644 index 94d841f..0000000 --- a/vendor/symfony/routing/Exception/InvalidParameterException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a parameter is not valid. - * - * @author Alexandre Salomé - */ -class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/vendor/symfony/routing/Exception/MethodNotAllowedException.php b/vendor/symfony/routing/Exception/MethodNotAllowedException.php deleted file mode 100644 index f684c74..0000000 --- a/vendor/symfony/routing/Exception/MethodNotAllowedException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * The resource was found but the request method is not allowed. - * - * This exception should trigger an HTTP 405 response in your application code. - * - * @author Kris Wallsmith - */ -class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface -{ - /** - * @var array - */ - protected $allowedMethods = array(); - - public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null) - { - $this->allowedMethods = array_map('strtoupper', $allowedMethods); - - parent::__construct($message, $code, $previous); - } - - /** - * Gets the allowed HTTP methods. - * - * @return array - */ - public function getAllowedMethods() - { - return $this->allowedMethods; - } -} diff --git a/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php b/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php deleted file mode 100644 index 57f3a40..0000000 --- a/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a route cannot be generated because of missing - * mandatory parameters. - * - * @author Alexandre Salomé - */ -class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/vendor/symfony/routing/Exception/ResourceNotFoundException.php b/vendor/symfony/routing/Exception/ResourceNotFoundException.php deleted file mode 100644 index ccbca15..0000000 --- a/vendor/symfony/routing/Exception/ResourceNotFoundException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * The resource was not found. - * - * This exception should trigger an HTTP 404 response in your application code. - * - * @author Kris Wallsmith - */ -class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/vendor/symfony/routing/Exception/RouteNotFoundException.php b/vendor/symfony/routing/Exception/RouteNotFoundException.php deleted file mode 100644 index 24ab0b4..0000000 --- a/vendor/symfony/routing/Exception/RouteNotFoundException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Exception; - -/** - * Exception thrown when a route does not exist. - * - * @author Alexandre Salomé - */ -class RouteNotFoundException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php b/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php deleted file mode 100644 index dc97b7e..0000000 --- a/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -/** - * ConfigurableRequirementsInterface must be implemented by URL generators that - * can be configured whether an exception should be generated when the parameters - * do not match the requirements. It is also possible to disable the requirements - * check for URL generation completely. - * - * The possible configurations and use-cases: - * - setStrictRequirements(true): Throw an exception for mismatching requirements. This - * is mostly useful in development environment. - * - setStrictRequirements(false): Don't throw an exception but return null as URL for - * mismatching requirements and log the problem. Useful when you cannot control all - * params because they come from third party libs but don't want to have a 404 in - * production environment. It should log the mismatch so one can review it. - * - setStrictRequirements(null): Return the URL with the given parameters without - * checking the requirements at all. When generating a URL you should either trust - * your params or you validated them beforehand because otherwise it would break your - * link anyway. So in production environment you should know that params always pass - * the requirements. Thus this option allows to disable the check on URL generation for - * performance reasons (saving a preg_match for each requirement every time a URL is - * generated). - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -interface ConfigurableRequirementsInterface -{ - /** - * Enables or disables the exception on incorrect parameters. - * Passing null will deactivate the requirements check completely. - * - * @param bool|null $enabled - */ - public function setStrictRequirements($enabled); - - /** - * Returns whether to throw an exception on incorrect parameters. - * Null means the requirements check is deactivated completely. - * - * @return bool|null - */ - public function isStrictRequirements(); -} diff --git a/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php b/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php deleted file mode 100644 index 4a7051b..0000000 --- a/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumper is the base class for all built-in generator dumpers. - * - * @author Fabien Potencier - */ -abstract class GeneratorDumper implements GeneratorDumperInterface -{ - /** - * @var RouteCollection - */ - private $routes; - - /** - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - /** - * {@inheritdoc} - */ - public function getRoutes() - { - return $this->routes; - } -} diff --git a/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php b/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php deleted file mode 100644 index fed3472..0000000 --- a/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * GeneratorDumperInterface is the interface that all generator dumper classes must implement. - * - * @author Fabien Potencier - */ -interface GeneratorDumperInterface -{ - /** - * Dumps a set of routes to a string representation of executable code - * that can then be used to generate a URL of such a route. - * - * @param array $options An array of options - * - * @return string Executable code - */ - public function dump(array $options = array()); - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRoutes(); -} diff --git a/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php b/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php deleted file mode 100644 index 60bdf1d..0000000 --- a/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator\Dumper; - -/** - * PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class PhpGeneratorDumper extends GeneratorDumper -{ - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the generator class - */ - public function dump(array $options = array()) - { - $options = array_merge(array( - 'class' => 'ProjectUrlGenerator', - 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - ), $options); - - return <<context = \$context; - \$this->logger = \$logger; - if (null === self::\$declaredRoutes) { - self::\$declaredRoutes = {$this->generateDeclaredRoutes()}; - } - } - -{$this->generateGenerateMethod()} -} - -EOF; - } - - /** - * Generates PHP code representing an array of defined routes - * together with the routes properties (e.g. requirements). - * - * @return string PHP code - */ - private function generateDeclaredRoutes() - { - $routes = "array(\n"; - foreach ($this->getRoutes()->all() as $name => $route) { - $compiledRoute = $route->compile(); - - $properties = array(); - $properties[] = $compiledRoute->getVariables(); - $properties[] = $route->getDefaults(); - $properties[] = $route->getRequirements(); - $properties[] = $compiledRoute->getTokens(); - $properties[] = $compiledRoute->getHostTokens(); - $properties[] = $route->getSchemes(); - - $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); - } - $routes .= ' )'; - - return $routes; - } - - /** - * Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface. - * - * @return string PHP code - */ - private function generateGenerateMethod() - { - return <<<'EOF' - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) - { - if (!isset(self::$declaredRoutes[$name])) { - throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); - } - - list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = self::$declaredRoutes[$name]; - - return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes); - } -EOF; - } -} diff --git a/vendor/symfony/routing/Generator/UrlGenerator.php b/vendor/symfony/routing/Generator/UrlGenerator.php deleted file mode 100644 index 7e4fa34..0000000 --- a/vendor/symfony/routing/Generator/UrlGenerator.php +++ /dev/null @@ -1,337 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; -use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; -use Psr\Log\LoggerInterface; - -/** - * UrlGenerator can generate a URL or a path for any route in the RouteCollection - * based on the passed parameters. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface -{ - /** - * @var RouteCollection - */ - protected $routes; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var bool|null - */ - protected $strictRequirements = true; - - /** - * @var LoggerInterface|null - */ - protected $logger; - - /** - * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. - * - * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars - * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. - * "?" and "#" (would be interpreted wrongly as query and fragment identifier), - * "'" and """ (are used as delimiters in HTML). - */ - protected $decodedChars = array( - // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning - // some webservers don't allow the slash in encoded form in the path for security reasons anyway - // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss - '%2F' => '/', - // the following chars are general delimiters in the URI specification but have only special meaning in the authority component - // so they can safely be used in the path in unencoded form - '%40' => '@', - '%3A' => ':', - // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally - // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability - '%3B' => ';', - '%2C' => ',', - '%3D' => '=', - '%2B' => '+', - '%21' => '!', - '%2A' => '*', - '%7C' => '|', - ); - - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - * @param LoggerInterface|null $logger A logger instance - */ - public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) - { - $this->routes = $routes; - $this->context = $context; - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritdoc} - */ - public function setStrictRequirements($enabled) - { - $this->strictRequirements = null === $enabled ? null : (bool) $enabled; - } - - /** - * {@inheritdoc} - */ - public function isStrictRequirements() - { - return $this->strictRequirements; - } - - /** - * {@inheritdoc} - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) - { - if (null === $route = $this->routes->get($name)) { - throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name)); - } - - // the Route has a cache of its own and is not recompiled as long as it does not get modified - $compiledRoute = $route->compile(); - - return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens(), $route->getSchemes()); - } - - /** - * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route - * @throws InvalidParameterException When a parameter value for a placeholder is not correct because - * it does not match the requirement - */ - protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) - { - $variables = array_flip($variables); - $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters); - - // all params must be given - if ($diff = array_diff_key($variables, $mergedParams)) { - throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name)); - } - - $url = ''; - $optional = true; - $message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.'; - foreach ($tokens as $token) { - if ('variable' === $token[0]) { - if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { - // check requirement - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { - if ($this->strictRequirements) { - throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); - } - - if ($this->logger) { - $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); - } - - return; - } - - $url = $token[1].$mergedParams[$token[3]].$url; - $optional = false; - } - } else { - // static text - $url = $token[1].$url; - $optional = false; - } - } - - if ('' === $url) { - $url = '/'; - } - - // the contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request) - $url = strtr(rawurlencode($url), $this->decodedChars); - - // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 - // so we need to encode them as they are not used for this purpose here - // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route - $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); - if ('/..' === substr($url, -3)) { - $url = substr($url, 0, -2).'%2E%2E'; - } elseif ('/.' === substr($url, -2)) { - $url = substr($url, 0, -1).'%2E'; - } - - $schemeAuthority = ''; - if ($host = $this->context->getHost()) { - $scheme = $this->context->getScheme(); - - if ($requiredSchemes) { - if (!in_array($scheme, $requiredSchemes, true)) { - $referenceType = self::ABSOLUTE_URL; - $scheme = current($requiredSchemes); - } - } - - if ($hostTokens) { - $routeHost = ''; - foreach ($hostTokens as $token) { - if ('variable' === $token[0]) { - if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { - if ($this->strictRequirements) { - throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]))); - } - - if ($this->logger) { - $this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]])); - } - - return; - } - - $routeHost = $token[1].$mergedParams[$token[3]].$routeHost; - } else { - $routeHost = $token[1].$routeHost; - } - } - - if ($routeHost !== $host) { - $host = $routeHost; - if (self::ABSOLUTE_URL !== $referenceType) { - $referenceType = self::NETWORK_PATH; - } - } - } - - if (self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) { - $port = ''; - if ('http' === $scheme && 80 != $this->context->getHttpPort()) { - $port = ':'.$this->context->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) { - $port = ':'.$this->context->getHttpsPort(); - } - - $schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://"; - $schemeAuthority .= $host.$port; - } - } - - if (self::RELATIVE_PATH === $referenceType) { - $url = self::getRelativePath($this->context->getPathInfo(), $url); - } else { - $url = $schemeAuthority.$this->context->getBaseUrl().$url; - } - - // add a query string if needed - $extra = array_udiff_assoc(array_diff_key($parameters, $variables), $defaults, function ($a, $b) { - return $a == $b ? 0 : 1; - }); - - // extract fragment - $fragment = ''; - if (isset($defaults['_fragment'])) { - $fragment = $defaults['_fragment']; - } - - if (isset($extra['_fragment'])) { - $fragment = $extra['_fragment']; - unset($extra['_fragment']); - } - - if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) { - // "/" and "?" can be left decoded for better user experience, see - // http://tools.ietf.org/html/rfc3986#section-3.4 - $url .= '?'.strtr($query, array('%2F' => '/')); - } - - if ('' !== $fragment) { - $url .= '#'.strtr(rawurlencode($fragment), array('%2F' => '/', '%3F' => '?')); - } - - return $url; - } - - /** - * Returns the target path as relative reference from the base path. - * - * Only the URIs path component (no schema, host etc.) is relevant and must be given, starting with a slash. - * Both paths must be absolute and not contain relative parts. - * Relative URLs from one resource to another are useful when generating self-contained downloadable document archives. - * Furthermore, they can be used to reduce the link size in documents. - * - * Example target paths, given a base path of "/a/b/c/d": - * - "/a/b/c/d" -> "" - * - "/a/b/c/" -> "./" - * - "/a/b/" -> "../" - * - "/a/b/c/other" -> "other" - * - "/a/x/y" -> "../../x/y" - * - * @param string $basePath The base path - * @param string $targetPath The target path - * - * @return string The relative target path - */ - public static function getRelativePath($basePath, $targetPath) - { - if ($basePath === $targetPath) { - return ''; - } - - $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($targetPath[0]) && '/' === $targetPath[0] ? substr($targetPath, 1) : $targetPath); - array_pop($sourceDirs); - $targetFile = array_pop($targetDirs); - - foreach ($sourceDirs as $i => $dir) { - if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) { - unset($sourceDirs[$i], $targetDirs[$i]); - } else { - break; - } - } - - $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); - - // A reference to the same base directory or an empty subdirectory must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name - // (see http://tools.ietf.org/html/rfc3986#section-4.2). - return '' === $path || '/' === $path[0] - || false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos) - ? "./$path" : $path; - } -} diff --git a/vendor/symfony/routing/Generator/UrlGeneratorInterface.php b/vendor/symfony/routing/Generator/UrlGeneratorInterface.php deleted file mode 100644 index d6e7938..0000000 --- a/vendor/symfony/routing/Generator/UrlGeneratorInterface.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Generator; - -use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; -use Symfony\Component\Routing\RequestContextAwareInterface; - -/** - * UrlGeneratorInterface is the interface that all URL generator classes must implement. - * - * The constants in this interface define the different types of resource references that - * are declared in RFC 3986: http://tools.ietf.org/html/rfc3986 - * We are using the term "URL" instead of "URI" as this is more common in web applications - * and we do not need to distinguish them as the difference is mostly semantical and - * less technical. Generating URIs, i.e. representation-independent resource identifiers, - * is also possible. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -interface UrlGeneratorInterface extends RequestContextAwareInterface -{ - /** - * Generates an absolute URL, e.g. "http://example.com/dir/file". - */ - const ABSOLUTE_URL = 0; - - /** - * Generates an absolute path, e.g. "/dir/file". - */ - const ABSOLUTE_PATH = 1; - - /** - * Generates a relative path based on the current request path, e.g. "../parent-file". - * - * @see UrlGenerator::getRelativePath() - */ - const RELATIVE_PATH = 2; - - /** - * Generates a network path, e.g. "//example.com/dir/file". - * Such reference reuses the current scheme but specifies the host. - */ - const NETWORK_PATH = 3; - - /** - * Generates a URL or path for a specific route based on the given parameters. - * - * Parameters that reference placeholders in the route pattern will substitute them in the - * path or host. Extra params are added as query string to the URL. - * - * When the passed reference type cannot be generated for the route because it requires a different - * host or scheme than the current one, the method will return a more comprehensive reference - * that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH - * but the route requires the https scheme whereas the current scheme is http, it will instead return an - * ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches - * the route in any case. - * - * If there is no route with the given name, the generator must throw the RouteNotFoundException. - * - * The special parameter _fragment will be used as the document fragment suffixed to the final URL. - * - * @param string $name The name of the route - * @param mixed $parameters An array of parameters - * @param int $referenceType The type of reference to be generated (one of the constants) - * - * @return string The generated URL - * - * @throws RouteNotFoundException If the named route doesn't exist - * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route - * @throws InvalidParameterException When a parameter value for a placeholder is not correct because - * it does not match the requirement - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH); -} diff --git a/vendor/symfony/routing/LICENSE b/vendor/symfony/routing/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/routing/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php deleted file mode 100644 index d3ca72f..0000000 --- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ /dev/null @@ -1,268 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Doctrine\Common\Annotations\Reader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolverInterface; - -/** - * AnnotationClassLoader loads routing information from a PHP class and its methods. - * - * You need to define an implementation for the getRouteDefaults() method. Most of the - * time, this method should define some PHP callable to be called for the route - * (a controller in MVC speak). - * - * The @Route annotation can be set on the class (for global parameters), - * and on each method. - * - * The @Route annotation main value is the route path. The annotation also - * recognizes several parameters: requirements, options, defaults, schemes, - * methods, host, and name. The name parameter is mandatory. - * Here is an example of how you should be able to use it: - * - * /** - * * @Route("/Blog") - * * / - * class Blog - * { - * /** - * * @Route("/", name="blog_index") - * * / - * public function index() - * { - * } - * - * /** - * * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"}) - * * / - * public function show() - * { - * } - * } - * - * @author Fabien Potencier - */ -abstract class AnnotationClassLoader implements LoaderInterface -{ - /** - * @var Reader - */ - protected $reader; - - /** - * @var string - */ - protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route'; - - /** - * @var int - */ - protected $defaultRouteIndex = 0; - - /** - * @param Reader $reader - */ - public function __construct(Reader $reader) - { - $this->reader = $reader; - } - - /** - * Sets the annotation class to read route properties from. - * - * @param string $class A fully-qualified class name - */ - public function setRouteAnnotationClass($class) - { - $this->routeAnnotationClass = $class; - } - - /** - * Loads from annotations from a class. - * - * @param string $class A class name - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When route can't be parsed - */ - public function load($class, $type = null) - { - if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); - } - - $class = new \ReflectionClass($class); - if ($class->isAbstract()) { - throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class->getName())); - } - - $globals = $this->getGlobals($class); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($class->getFileName())); - - foreach ($class->getMethods() as $method) { - $this->defaultRouteIndex = 0; - foreach ($this->reader->getMethodAnnotations($method) as $annot) { - if ($annot instanceof $this->routeAnnotationClass) { - $this->addRoute($collection, $annot, $globals, $class, $method); - } - } - } - - if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { - $globals['path'] = ''; - $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); - } - - return $collection; - } - - protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method) - { - $name = $annot->getName(); - if (null === $name) { - $name = $this->getDefaultRouteName($class, $method); - } - - $defaults = array_replace($globals['defaults'], $annot->getDefaults()); - foreach ($method->getParameters() as $param) { - if (false !== strpos($globals['path'].$annot->getPath(), sprintf('{%s}', $param->getName())) && !isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { - $defaults[$param->getName()] = $param->getDefaultValue(); - } - } - $requirements = array_replace($globals['requirements'], $annot->getRequirements()); - $options = array_replace($globals['options'], $annot->getOptions()); - $schemes = array_merge($globals['schemes'], $annot->getSchemes()); - $methods = array_merge($globals['methods'], $annot->getMethods()); - - $host = $annot->getHost(); - if (null === $host) { - $host = $globals['host']; - } - - $condition = $annot->getCondition(); - if (null === $condition) { - $condition = $globals['condition']; - } - - $route = $this->createRoute($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - - $this->configureRoute($route, $class, $method, $annot); - - $collection->add($name, $route); - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type); - } - - /** - * {@inheritdoc} - */ - public function setResolver(LoaderResolverInterface $resolver) - { - } - - /** - * {@inheritdoc} - */ - public function getResolver() - { - } - - /** - * Gets the default route name for a class method. - * - * @param \ReflectionClass $class - * @param \ReflectionMethod $method - * - * @return string - */ - protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) - { - $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name); - if ($this->defaultRouteIndex > 0) { - $name .= '_'.$this->defaultRouteIndex; - } - ++$this->defaultRouteIndex; - - return $name; - } - - protected function getGlobals(\ReflectionClass $class) - { - $globals = array( - 'path' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'host' => '', - 'condition' => '', - ); - - if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { - if (null !== $annot->getPath()) { - $globals['path'] = $annot->getPath(); - } - - if (null !== $annot->getRequirements()) { - $globals['requirements'] = $annot->getRequirements(); - } - - if (null !== $annot->getOptions()) { - $globals['options'] = $annot->getOptions(); - } - - if (null !== $annot->getDefaults()) { - $globals['defaults'] = $annot->getDefaults(); - } - - if (null !== $annot->getSchemes()) { - $globals['schemes'] = $annot->getSchemes(); - } - - if (null !== $annot->getMethods()) { - $globals['methods'] = $annot->getMethods(); - } - - if (null !== $annot->getHost()) { - $globals['host'] = $annot->getHost(); - } - - if (null !== $annot->getCondition()) { - $globals['condition'] = $annot->getCondition(); - } - } - - return $globals; - } - - protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) - { - return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - } - - abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot); -} diff --git a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php b/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php deleted file mode 100644 index 616d01e..0000000 --- a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\DirectoryResource; - -/** - * AnnotationDirectoryLoader loads routing information from annotations set - * on PHP classes and methods. - * - * @author Fabien Potencier - */ -class AnnotationDirectoryLoader extends AnnotationFileLoader -{ - /** - * Loads from annotations from a directory. - * - * @param string $path A directory path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed - */ - public function load($path, $type = null) - { - $dir = $this->locator->locate($path); - - $collection = new RouteCollection(); - $collection->addResource(new DirectoryResource($dir, '/\.php$/')); - $files = iterator_to_array(new \RecursiveIteratorIterator( - new \RecursiveCallbackFilterIterator( - new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - function (\SplFileInfo $current) { - return '.' !== substr($current->getBasename(), 0, 1); - } - ), - \RecursiveIteratorIterator::LEAVES_ONLY - )); - usort($files, function (\SplFileInfo $a, \SplFileInfo $b) { - return (string) $a > (string) $b ? 1 : -1; - }); - - foreach ($files as $file) { - if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) { - continue; - } - - if ($class = $this->findClass($file)) { - $refl = new \ReflectionClass($class); - if ($refl->isAbstract()) { - continue; - } - - $collection->addCollection($this->loader->load($class, $type)); - } - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - if (!is_string($resource)) { - return false; - } - - try { - $path = $this->locator->locate($resource); - } catch (\Exception $e) { - return false; - } - - return is_dir($path) && (!$type || 'annotation' === $type); - } -} diff --git a/vendor/symfony/routing/Loader/AnnotationFileLoader.php b/vendor/symfony/routing/Loader/AnnotationFileLoader.php deleted file mode 100644 index f85fac7..0000000 --- a/vendor/symfony/routing/Loader/AnnotationFileLoader.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\FileLocatorInterface; - -/** - * AnnotationFileLoader loads routing information from annotations set - * on a PHP class and its methods. - * - * @author Fabien Potencier - */ -class AnnotationFileLoader extends FileLoader -{ - protected $loader; - - /** - * @param FileLocatorInterface $locator A FileLocator instance - * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * - * @throws \RuntimeException - */ - public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) - { - if (!function_exists('token_get_all')) { - throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.'); - } - - parent::__construct($locator); - - $this->loader = $loader; - } - - /** - * Loads from annotations from a file. - * - * @param string $file A PHP file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $collection = new RouteCollection(); - if ($class = $this->findClass($path)) { - $collection->addResource(new FileResource($path)); - $collection->addCollection($this->loader->load($class, $type)); - } - if (\PHP_VERSION_ID >= 70000) { - // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098 - gc_mem_caches(); - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); - } - - /** - * Returns the full class name for the first class in the file. - * - * @param string $file A PHP file path - * - * @return string|false Full class name if found, false otherwise - */ - protected function findClass($file) - { - $class = false; - $namespace = false; - $tokens = token_get_all(file_get_contents($file)); - - if (1 === count($tokens) && T_INLINE_HTML === $tokens[0][0]) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the " 0; --$j) { - if (!isset($tokens[$j][1])) { - break; - } - - if (T_DOUBLE_COLON === $tokens[$j][0]) { - $isClassConstant = true; - break; - } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) { - break; - } - } - - if (!$isClassConstant) { - $class = true; - } - } - - if (T_NAMESPACE === $token[0]) { - $namespace = true; - } - } - - return false; - } -} diff --git a/vendor/symfony/routing/Loader/ClosureLoader.php b/vendor/symfony/routing/Loader/ClosureLoader.php deleted file mode 100644 index 5df9f6a..0000000 --- a/vendor/symfony/routing/Loader/ClosureLoader.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\Routing\RouteCollection; - -/** - * ClosureLoader loads routes from a PHP closure. - * - * The Closure must return a RouteCollection instance. - * - * @author Fabien Potencier - */ -class ClosureLoader extends Loader -{ - /** - * Loads a Closure. - * - * @param \Closure $closure A Closure - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - */ - public function load($closure, $type = null) - { - return $closure(); - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return $resource instanceof \Closure && (!$type || 'closure' === $type); - } -} diff --git a/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php b/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php deleted file mode 100644 index 6c16216..0000000 --- a/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader\DependencyInjection; - -use Psr\Container\ContainerInterface; -use Symfony\Component\Routing\Loader\ObjectRouteLoader; - -/** - * A route loader that executes a service to load the routes. - * - * This depends on the DependencyInjection component. - * - * @author Ryan Weaver - */ -class ServiceRouterLoader extends ObjectRouteLoader -{ - /** - * @var ContainerInterface - */ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - protected function getServiceObject($id) - { - return $this->container->get($id); - } -} diff --git a/vendor/symfony/routing/Loader/DirectoryLoader.php b/vendor/symfony/routing/Loader/DirectoryLoader.php deleted file mode 100644 index 4bb5b31..0000000 --- a/vendor/symfony/routing/Loader/DirectoryLoader.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\DirectoryResource; - -class DirectoryLoader extends FileLoader -{ - /** - * {@inheritdoc} - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $collection = new RouteCollection(); - $collection->addResource(new DirectoryResource($path)); - - foreach (scandir($path) as $dir) { - if ('.' !== $dir[0]) { - $this->setCurrentDir($path); - $subPath = $path.'/'.$dir; - $subType = null; - - if (is_dir($subPath)) { - $subPath .= '/'; - $subType = 'directory'; - } - - $subCollection = $this->import($subPath, $subType, false, $path); - $collection->addCollection($subCollection); - } - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - // only when type is forced to directory, not to conflict with AnnotationLoader - - return 'directory' === $type; - } -} diff --git a/vendor/symfony/routing/Loader/ObjectRouteLoader.php b/vendor/symfony/routing/Loader/ObjectRouteLoader.php deleted file mode 100644 index 0899a81..0000000 --- a/vendor/symfony/routing/Loader/ObjectRouteLoader.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\RouteCollection; - -/** - * A route loader that calls a method on an object to load the routes. - * - * @author Ryan Weaver - */ -abstract class ObjectRouteLoader extends Loader -{ - /** - * Returns the object that the method will be called on to load routes. - * - * For example, if your application uses a service container, - * the $id may be a service id. - * - * @param string $id - * - * @return object - */ - abstract protected function getServiceObject($id); - - /** - * Calls the service that will load the routes. - * - * @param mixed $resource Some value that will resolve to a callable - * @param string|null $type The resource type - * - * @return RouteCollection - */ - public function load($resource, $type = null) - { - $parts = explode(':', $resource); - if (2 != count($parts)) { - throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource)); - } - - $serviceString = $parts[0]; - $method = $parts[1]; - - $loaderObject = $this->getServiceObject($serviceString); - - if (!is_object($loaderObject)) { - throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject))); - } - - if (!method_exists($loaderObject, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource)); - } - - $routeCollection = call_user_func(array($loaderObject, $method), $this); - - if (!$routeCollection instanceof RouteCollection) { - $type = is_object($routeCollection) ? get_class($routeCollection) : gettype($routeCollection); - - throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', get_class($loaderObject), $method, $type)); - } - - // make the service file tracked so that if it changes, the cache rebuilds - $this->addClassResource(new \ReflectionClass($loaderObject), $routeCollection); - - return $routeCollection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return 'service' === $type; - } - - private function addClassResource(\ReflectionClass $class, RouteCollection $collection) - { - do { - if (is_file($class->getFileName())) { - $collection->addResource(new FileResource($class->getFileName())); - } - } while ($class = $class->getParentClass()); - } -} diff --git a/vendor/symfony/routing/Loader/PhpFileLoader.php b/vendor/symfony/routing/Loader/PhpFileLoader.php deleted file mode 100644 index b4ba5fb..0000000 --- a/vendor/symfony/routing/Loader/PhpFileLoader.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\RouteCollection; - -/** - * PhpFileLoader loads routes from a PHP file. - * - * The file must return a RouteCollection instance. - * - * @author Fabien Potencier - */ -class PhpFileLoader extends FileLoader -{ - /** - * Loads a PHP file. - * - * @param string $file A PHP file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - $this->setCurrentDir(dirname($path)); - - $collection = self::includeFile($path, $this); - $collection->addResource(new FileResource($path)); - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); - } - - /** - * Safe include. Used for scope isolation. - * - * @param string $file File to include - * @param PhpFileLoader $loader the loader variable is exposed to the included file below - * - * @return RouteCollection - */ - private static function includeFile($file, PhpFileLoader $loader) - { - return include $file; - } -} diff --git a/vendor/symfony/routing/Loader/XmlFileLoader.php b/vendor/symfony/routing/Loader/XmlFileLoader.php deleted file mode 100644 index 396047e..0000000 --- a/vendor/symfony/routing/Loader/XmlFileLoader.php +++ /dev/null @@ -1,342 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Config\Util\XmlUtils; - -/** - * XmlFileLoader loads XML routing files. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class XmlFileLoader extends FileLoader -{ - const NAMESPACE_URI = 'http://symfony.com/schema/routing'; - const SCHEME_PATH = '/schema/routing/routing-1.0.xsd'; - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException when the file cannot be loaded or when the XML cannot be - * parsed because it does not validate against the scheme - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - $xml = $this->loadFile($path); - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // process routes and imports - foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement) { - continue; - } - - $this->parseNode($collection, $node, $path, $file); - } - - return $collection; - } - - /** - * Parses a node from a loaded XML file. - * - * @param RouteCollection $collection Collection to associate with the node - * @param \DOMElement $node Element to parse - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) - { - if (self::NAMESPACE_URI !== $node->namespaceURI) { - return; - } - - switch ($node->localName) { - case 'route': - $this->parseRoute($collection, $node, $path); - break; - case 'import': - $this->parseImport($collection, $node, $path, $file); - break; - default: - throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->localName, $path)); - } - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection RouteCollection instance - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path) - { - if ('' === ($id = $node->getAttribute('id')) || !$node->hasAttribute('path')) { - throw new \InvalidArgumentException(sprintf('The element in file "%s" must have an "id" and a "path" attribute.', $path)); - } - - $schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY); - $methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY); - - list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); - - $route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition); - $collection->add($id, $route); - } - - /** - * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @param RouteCollection $collection RouteCollection instance - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * - * @throws \InvalidArgumentException When the XML is invalid - */ - protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file) - { - if ('' === $resource = $node->getAttribute('resource')) { - throw new \InvalidArgumentException(sprintf('The element in file "%s" must have a "resource" attribute.', $path)); - } - - $type = $node->getAttribute('type'); - $prefix = $node->getAttribute('prefix'); - $host = $node->hasAttribute('host') ? $node->getAttribute('host') : null; - $schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null; - $methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null; - - list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); - - $this->setCurrentDir(dirname($path)); - - $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file); - /* @var $subCollection RouteCollection */ - $subCollection->addPrefix($prefix); - if (null !== $host) { - $subCollection->setHost($host); - } - if (null !== $condition) { - $subCollection->setCondition($condition); - } - if (null !== $schemes) { - $subCollection->setSchemes($schemes); - } - if (null !== $methods) { - $subCollection->setMethods($methods); - } - $subCollection->addDefaults($defaults); - $subCollection->addRequirements($requirements); - $subCollection->addOptions($options); - - $collection->addCollection($subCollection); - } - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * - * @return \DOMDocument - * - * @throws \InvalidArgumentException When loading of XML file fails because of syntax errors - * or when the XML structure is not as expected by the scheme - - * see validate() - */ - protected function loadFile($file) - { - return XmlUtils::loadFile($file, __DIR__.static::SCHEME_PATH); - } - - /** - * Parses the config elements (default, requirement, option). - * - * @param \DOMElement $node Element to parse that contains the configs - * @param string $path Full path of the XML file being processed - * - * @return array An array with the defaults as first item, requirements as second and options as third - * - * @throws \InvalidArgumentException When the XML is invalid - */ - private function parseConfigs(\DOMElement $node, $path) - { - $defaults = array(); - $requirements = array(); - $options = array(); - $condition = null; - - foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) { - if ($node !== $n->parentNode) { - continue; - } - - switch ($n->localName) { - case 'default': - if ($this->isElementValueNull($n)) { - $defaults[$n->getAttribute('key')] = null; - } else { - $defaults[$n->getAttribute('key')] = $this->parseDefaultsConfig($n, $path); - } - - break; - case 'requirement': - $requirements[$n->getAttribute('key')] = trim($n->textContent); - break; - case 'option': - $options[$n->getAttribute('key')] = trim($n->textContent); - break; - case 'condition': - $condition = trim($n->textContent); - break; - default: - throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement", "option" or "condition".', $n->localName, $path)); - } - } - - return array($defaults, $requirements, $options, $condition); - } - - /** - * Parses the "default" elements. - * - * @param \DOMElement $element The "default" element to parse - * @param string $path Full path of the XML file being processed - * - * @return array|bool|float|int|string|null The parsed value of the "default" element - */ - private function parseDefaultsConfig(\DOMElement $element, $path) - { - if ($this->isElementValueNull($element)) { - return; - } - - // Check for existing element nodes in the default element. There can - // only be a single element inside a default element. So this element - // (if one was found) can safely be returned. - foreach ($element->childNodes as $child) { - if (!$child instanceof \DOMElement) { - continue; - } - - if (self::NAMESPACE_URI !== $child->namespaceURI) { - continue; - } - - return $this->parseDefaultNode($child, $path); - } - - // If the default element doesn't contain a nested "bool", "int", "float", - // "string", "list", or "map" element, the element contents will be treated - // as the string value of the associated default option. - return trim($element->textContent); - } - - /** - * Recursively parses the value of a "default" element. - * - * @param \DOMElement $node The node value - * @param string $path Full path of the XML file being processed - * - * @return array|bool|float|int|string The parsed value - * - * @throws \InvalidArgumentException when the XML is invalid - */ - private function parseDefaultNode(\DOMElement $node, $path) - { - if ($this->isElementValueNull($node)) { - return; - } - - switch ($node->localName) { - case 'bool': - return 'true' === trim($node->nodeValue) || '1' === trim($node->nodeValue); - case 'int': - return (int) trim($node->nodeValue); - case 'float': - return (float) trim($node->nodeValue); - case 'string': - return trim($node->nodeValue); - case 'list': - $list = array(); - - foreach ($node->childNodes as $element) { - if (!$element instanceof \DOMElement) { - continue; - } - - if (self::NAMESPACE_URI !== $element->namespaceURI) { - continue; - } - - $list[] = $this->parseDefaultNode($element, $path); - } - - return $list; - case 'map': - $map = array(); - - foreach ($node->childNodes as $element) { - if (!$element instanceof \DOMElement) { - continue; - } - - if (self::NAMESPACE_URI !== $element->namespaceURI) { - continue; - } - - $map[$element->getAttribute('key')] = $this->parseDefaultNode($element, $path); - } - - return $map; - default: - throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "bool", "int", "float", "string", "list", or "map".', $node->localName, $path)); - } - } - - private function isElementValueNull(\DOMElement $element) - { - $namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance'; - - if (!$element->hasAttributeNS($namespaceUri, 'nil')) { - return false; - } - - return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil'); - } -} diff --git a/vendor/symfony/routing/Loader/YamlFileLoader.php b/vendor/symfony/routing/Loader/YamlFileLoader.php deleted file mode 100644 index 72935fa..0000000 --- a/vendor/symfony/routing/Loader/YamlFileLoader.php +++ /dev/null @@ -1,216 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Loader; - -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlFileLoader loads Yaml routing files. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class YamlFileLoader extends FileLoader -{ - private static $availableKeys = array( - 'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', - ); - private $yamlParser; - - /** - * Loads a Yaml file. - * - * @param string $file A Yaml file path - * @param string|null $type The resource type - * - * @return RouteCollection A RouteCollection instance - * - * @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid - */ - public function load($file, $type = null) - { - $path = $this->locator->locate($file); - - if (!stream_is_local($path)) { - throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path)); - } - - if (!file_exists($path)) { - throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path)); - } - - if (null === $this->yamlParser) { - $this->yamlParser = new YamlParser(); - } - - $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) { - $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message; - - return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false; - }); - - try { - $parsedConfig = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_KEYS_AS_STRINGS); - } catch (ParseException $e) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e); - } finally { - restore_error_handler(); - } - - $collection = new RouteCollection(); - $collection->addResource(new FileResource($path)); - - // empty file - if (null === $parsedConfig) { - return $collection; - } - - // not an array - if (!is_array($parsedConfig)) { - throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); - } - - foreach ($parsedConfig as $name => $config) { - $this->validate($config, $name, $path); - - if (isset($config['resource'])) { - $this->parseImport($collection, $config, $path, $file); - } else { - $this->parseRoute($collection, $name, $config, $path); - } - } - - return $collection; - } - - /** - * {@inheritdoc} - */ - public function supports($resource, $type = null) - { - return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type); - } - - /** - * Parses a route and adds it to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param string $name Route name - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed - */ - protected function parseRoute(RouteCollection $collection, $name, array $config, $path) - { - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - $host = isset($config['host']) ? $config['host'] : ''; - $schemes = isset($config['schemes']) ? $config['schemes'] : array(); - $methods = isset($config['methods']) ? $config['methods'] : array(); - $condition = isset($config['condition']) ? $config['condition'] : null; - - $route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition); - - $collection->add($name, $route); - } - - /** - * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @param RouteCollection $collection A RouteCollection instance - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed - * @param string $file Loaded file name - */ - protected function parseImport(RouteCollection $collection, array $config, $path, $file) - { - $type = isset($config['type']) ? $config['type'] : null; - $prefix = isset($config['prefix']) ? $config['prefix'] : ''; - $defaults = isset($config['defaults']) ? $config['defaults'] : array(); - $requirements = isset($config['requirements']) ? $config['requirements'] : array(); - $options = isset($config['options']) ? $config['options'] : array(); - $host = isset($config['host']) ? $config['host'] : null; - $condition = isset($config['condition']) ? $config['condition'] : null; - $schemes = isset($config['schemes']) ? $config['schemes'] : null; - $methods = isset($config['methods']) ? $config['methods'] : null; - - $this->setCurrentDir(dirname($path)); - - $subCollection = $this->import($config['resource'], $type, false, $file); - /* @var $subCollection RouteCollection */ - $subCollection->addPrefix($prefix); - if (null !== $host) { - $subCollection->setHost($host); - } - if (null !== $condition) { - $subCollection->setCondition($condition); - } - if (null !== $schemes) { - $subCollection->setSchemes($schemes); - } - if (null !== $methods) { - $subCollection->setMethods($methods); - } - $subCollection->addDefaults($defaults); - $subCollection->addRequirements($requirements); - $subCollection->addOptions($options); - - $collection->addCollection($subCollection); - } - - /** - * Validates the route configuration. - * - * @param array $config A resource config - * @param string $name The config key - * @param string $path The loaded file path - * - * @throws \InvalidArgumentException If one of the provided config keys is not supported, - * something is missing or the combination is nonsense - */ - protected function validate($config, $name, $path) - { - if (!is_array($config)) { - throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); - } - if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', - $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) - )); - } - if (isset($config['resource']) && isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', - $path, $name - )); - } - if (!isset($config['resource']) && isset($config['type'])) { - throw new \InvalidArgumentException(sprintf( - 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', - $name, $path - )); - } - if (!isset($config['resource']) && !isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'You must define a "path" for the route "%s" in file "%s".', - $name, $path - )); - } - } -} diff --git a/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd b/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd deleted file mode 100644 index 92d4ae2..0000000 --- a/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php deleted file mode 100644 index b24c851..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php +++ /dev/null @@ -1,161 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -/** - * Collection of routes. - * - * @author Arnaud Le Blanc - * - * @internal - */ -class DumperCollection implements \IteratorAggregate -{ - /** - * @var DumperCollection|null - */ - private $parent; - - /** - * @var DumperCollection[]|DumperRoute[] - */ - private $children = array(); - - /** - * @var array - */ - private $attributes = array(); - - /** - * Returns the children routes and collections. - * - * @return self[]|DumperRoute[] - */ - public function all() - { - return $this->children; - } - - /** - * Adds a route or collection. - * - * @param DumperRoute|DumperCollection The route or collection - */ - public function add($child) - { - if ($child instanceof self) { - $child->setParent($this); - } - $this->children[] = $child; - } - - /** - * Sets children. - * - * @param array $children The children - */ - public function setAll(array $children) - { - foreach ($children as $child) { - if ($child instanceof self) { - $child->setParent($this); - } - } - $this->children = $children; - } - - /** - * Returns an iterator over the children. - * - * @return \Iterator|DumperCollection[]|DumperRoute[] The iterator - */ - public function getIterator() - { - return new \ArrayIterator($this->children); - } - - /** - * Returns the root of the collection. - * - * @return self The root collection - */ - public function getRoot() - { - return (null !== $this->parent) ? $this->parent->getRoot() : $this; - } - - /** - * Returns the parent collection. - * - * @return self|null The parent collection or null if the collection has no parent - */ - protected function getParent() - { - return $this->parent; - } - - /** - * Sets the parent collection. - * - * @param DumperCollection $parent The parent collection - */ - protected function setParent(DumperCollection $parent) - { - $this->parent = $parent; - } - - /** - * Returns true if the attribute is defined. - * - * @param string $name The attribute name - * - * @return bool true if the attribute is defined, false otherwise - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * Returns an attribute by name. - * - * @param string $name The attribute name - * @param mixed $default Default value is the attribute doesn't exist - * - * @return mixed The attribute value - */ - public function getAttribute($name, $default = null) - { - return $this->hasAttribute($name) ? $this->attributes[$name] : $default; - } - - /** - * Sets an attribute by name. - * - * @param string $name The attribute name - * @param mixed $value The attribute value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - /** - * Sets multiple attributes. - * - * @param array $attributes The attributes - */ - public function setAttributes($attributes) - { - $this->attributes = $attributes; - } -} diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php b/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php deleted file mode 100644 index c2e2a11..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\Route; - -/** - * Container for a Route. - * - * @author Arnaud Le Blanc - * - * @internal - */ -class DumperRoute -{ - /** - * @var string - */ - private $name; - - /** - * @var Route - */ - private $route; - - /** - * @param string $name The route name - * @param Route $route The route - */ - public function __construct($name, Route $route) - { - $this->name = $name; - $this->route = $route; - } - - /** - * Returns the route name. - * - * @return string The route name - */ - public function getName() - { - return $this->name; - } - - /** - * Returns the route. - * - * @return Route The route - */ - public function getRoute() - { - return $this->route; - } -} diff --git a/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php deleted file mode 100644 index 70c23f6..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * MatcherDumper is the abstract class for all built-in matcher dumpers. - * - * @author Fabien Potencier - */ -abstract class MatcherDumper implements MatcherDumperInterface -{ - /** - * @var RouteCollection - */ - private $routes; - - /** - * @param RouteCollection $routes The RouteCollection to dump - */ - public function __construct(RouteCollection $routes) - { - $this->routes = $routes; - } - - /** - * {@inheritdoc} - */ - public function getRoutes() - { - return $this->routes; - } -} diff --git a/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php b/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php deleted file mode 100644 index 5e7c134..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\RouteCollection; - -/** - * MatcherDumperInterface is the interface that all matcher dumper classes must implement. - * - * @author Fabien Potencier - */ -interface MatcherDumperInterface -{ - /** - * Dumps a set of routes to a string representation of executable code - * that can then be used to match a request against these routes. - * - * @param array $options An array of options - * - * @return string Executable code - */ - public function dump(array $options = array()); - - /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRoutes(); -} diff --git a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php deleted file mode 100644 index e172135..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php +++ /dev/null @@ -1,426 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes. - * - * @author Fabien Potencier - * @author Tobias Schultze - * @author Arnaud Le Blanc - */ -class PhpMatcherDumper extends MatcherDumper -{ - private $expressionLanguage; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - private $expressionLanguageProviders = array(); - - /** - * Dumps a set of routes to a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the matcher class - */ - public function dump(array $options = array()) - { - $options = array_replace(array( - 'class' => 'ProjectUrlMatcher', - 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - ), $options); - - // trailing slash support is only enabled if we know how to redirect the user - $interfaces = class_implements($options['base_class']); - $supportsRedirections = isset($interfaces['Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface']); - - return <<context = \$context; - } - -{$this->generateMatchMethod($supportsRedirections)} -} - -EOF; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * Generates the code for the match method implementing UrlMatcherInterface. - * - * @param bool $supportsRedirections Whether redirections are supported by the base class - * - * @return string Match method as PHP code - */ - private function generateMatchMethod($supportsRedirections) - { - $code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n"); - - return <<context; - \$request = \$this->request; - \$requestMethod = \$canonicalMethod = \$context->getMethod(); - \$scheme = \$context->getScheme(); - - if ('HEAD' === \$requestMethod) { - \$canonicalMethod = 'GET'; - } - - -$code - - throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException(); - } -EOF; - } - - /** - * Generates PHP code to match a RouteCollection with all its routes. - * - * @param RouteCollection $routes A RouteCollection instance - * @param bool $supportsRedirections Whether redirections are supported by the base class - * - * @return string PHP code - */ - private function compileRoutes(RouteCollection $routes, $supportsRedirections) - { - $fetchedHost = false; - $groups = $this->groupRoutesByHostRegex($routes); - $code = ''; - - foreach ($groups as $collection) { - if (null !== $regex = $collection->getAttribute('host_regex')) { - if (!$fetchedHost) { - $code .= " \$host = \$context->getHost();\n\n"; - $fetchedHost = true; - } - - $code .= sprintf(" if (preg_match(%s, \$host, \$hostMatches)) {\n", var_export($regex, true)); - } - - $tree = $this->buildStaticPrefixCollection($collection); - $groupCode = $this->compileStaticPrefixRoutes($tree, $supportsRedirections); - - if (null !== $regex) { - // apply extra indention at each line (except empty ones) - $groupCode = preg_replace('/^.{2,}$/m', ' $0', $groupCode); - $code .= $groupCode; - $code .= " }\n\n"; - } else { - $code .= $groupCode; - } - } - - return $code; - } - - private function buildStaticPrefixCollection(DumperCollection $collection) - { - $prefixCollection = new StaticPrefixCollection(); - - foreach ($collection as $dumperRoute) { - $prefix = $dumperRoute->getRoute()->compile()->getStaticPrefix(); - $prefixCollection->addRoute($prefix, $dumperRoute); - } - - $prefixCollection->optimizeGroups(); - - return $prefixCollection; - } - - /** - * Generates PHP code to match a tree of routes. - * - * @param StaticPrefixCollection $collection A StaticPrefixCollection instance - * @param bool $supportsRedirections Whether redirections are supported by the base class - * @param string $ifOrElseIf either "if" or "elseif" to influence chaining - * - * @return string PHP code - */ - private function compileStaticPrefixRoutes(StaticPrefixCollection $collection, $supportsRedirections, $ifOrElseIf = 'if') - { - $code = ''; - $prefix = $collection->getPrefix(); - - if (!empty($prefix) && '/' !== $prefix) { - $code .= sprintf(" %s (0 === strpos(\$pathinfo, %s)) {\n", $ifOrElseIf, var_export($prefix, true)); - } - - $ifOrElseIf = 'if'; - - foreach ($collection->getItems() as $route) { - if ($route instanceof StaticPrefixCollection) { - $code .= $this->compileStaticPrefixRoutes($route, $supportsRedirections, $ifOrElseIf); - $ifOrElseIf = 'elseif'; - } else { - $code .= $this->compileRoute($route[1]->getRoute(), $route[1]->getName(), $supportsRedirections, $prefix)."\n"; - $ifOrElseIf = 'if'; - } - } - - if (!empty($prefix) && '/' !== $prefix) { - $code .= " }\n\n"; - // apply extra indention at each line (except empty ones) - $code = preg_replace('/^.{2,}$/m', ' $0', $code); - } - - return $code; - } - - /** - * Compiles a single Route to PHP code used to match it against the path info. - * - * @param Route $route A Route instance - * @param string $name The name of the Route - * @param bool $supportsRedirections Whether redirections are supported by the base class - * @param string|null $parentPrefix The prefix of the parent collection used to optimize the code - * - * @return string PHP code - * - * @throws \LogicException - */ - private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null) - { - $code = ''; - $compiledRoute = $route->compile(); - $conditions = array(); - $hasTrailingSlash = false; - $matches = false; - $hostMatches = false; - $methods = $route->getMethods(); - - $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods) || in_array('GET', $methods)); - $regex = $compiledRoute->getRegex(); - - if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) { - if ($supportsTrailingSlash && '/' === substr($m['url'], -1)) { - $conditions[] = sprintf('%s === $trimmedPathinfo', var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true)); - $hasTrailingSlash = true; - } else { - $conditions[] = sprintf('%s === $pathinfo', var_export(str_replace('\\', '', $m['url']), true)); - } - } else { - if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() !== $parentPrefix) { - $conditions[] = sprintf('0 === strpos($pathinfo, %s)', var_export($compiledRoute->getStaticPrefix(), true)); - } - - if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) { - $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2); - $hasTrailingSlash = true; - } - $conditions[] = sprintf('preg_match(%s, $pathinfo, $matches)', var_export($regex, true)); - - $matches = true; - } - - if ($compiledRoute->getHostVariables()) { - $hostMatches = true; - } - - if ($route->getCondition()) { - $conditions[] = $this->getExpressionLanguage()->compile($route->getCondition(), array('context', 'request')); - } - - $conditions = implode(' && ', $conditions); - - $code .= <<redirect(\$pathinfo.'/', '$name'); - } - - -EOF; - } - - if ($schemes = $route->getSchemes()) { - if (!$supportsRedirections) { - throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); - } - $schemes = str_replace("\n", '', var_export(array_flip($schemes), true)); - $code .= <<redirect(\$pathinfo, '$name', key(\$requiredSchemes)); - } - - -EOF; - } - - // optimize parameters array - if ($matches || $hostMatches) { - $vars = array(); - if ($hostMatches) { - $vars[] = '$hostMatches'; - } - if ($matches) { - $vars[] = '$matches'; - } - $vars[] = "array('_route' => '$name')"; - - $code .= sprintf( - " return \$this->mergeDefaults(array_replace(%s), %s);\n", - implode(', ', $vars), - str_replace("\n", '', var_export($route->getDefaults(), true)) - ); - } elseif ($route->getDefaults()) { - $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); - } else { - $code .= sprintf(" return array('_route' => '%s');\n", $name); - } - $code .= " }\n"; - - if ($methods) { - $code .= " $gotoname:\n"; - } - - return $code; - } - - /** - * Groups consecutive routes having the same host regex. - * - * The result is a collection of collections of routes having the same host regex. - * - * @param RouteCollection $routes A flat RouteCollection - * - * @return DumperCollection A collection with routes grouped by host regex in sub-collections - */ - private function groupRoutesByHostRegex(RouteCollection $routes) - { - $groups = new DumperCollection(); - $currentGroup = new DumperCollection(); - $currentGroup->setAttribute('host_regex', null); - $groups->add($currentGroup); - - foreach ($routes as $name => $route) { - $hostRegex = $route->compile()->getHostRegex(); - if ($currentGroup->getAttribute('host_regex') !== $hostRegex) { - $currentGroup = new DumperCollection(); - $currentGroup->setAttribute('host_regex', $hostRegex); - $groups->add($currentGroup); - } - $currentGroup->add(new DumperRoute($name, $route)); - } - - return $groups; - } - - private function getExpressionLanguage() - { - if (null === $this->expressionLanguage) { - if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { - throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); - } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); - } - - return $this->expressionLanguage; - } -} diff --git a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php deleted file mode 100644 index 7365808..0000000 --- a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php +++ /dev/null @@ -1,238 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher\Dumper; - -/** - * Prefix tree of routes preserving routes order. - * - * @author Frank de Jonge - * - * @internal - */ -class StaticPrefixCollection -{ - /** - * @var string - */ - private $prefix; - - /** - * @var array[]|StaticPrefixCollection[] - */ - private $items = array(); - - /** - * @var int - */ - private $matchStart = 0; - - public function __construct($prefix = '') - { - $this->prefix = $prefix; - } - - public function getPrefix() - { - return $this->prefix; - } - - /** - * @return mixed[]|StaticPrefixCollection[] - */ - public function getItems() - { - return $this->items; - } - - /** - * Adds a route to a group. - * - * @param string $prefix - * @param mixed $route - */ - public function addRoute($prefix, $route) - { - $prefix = '/' === $prefix ? $prefix : rtrim($prefix, '/'); - $this->guardAgainstAddingNotAcceptedRoutes($prefix); - - if ($this->prefix === $prefix) { - // When a prefix is exactly the same as the base we move up the match start position. - // This is needed because otherwise routes that come afterwards have higher precedence - // than a possible regular expression, which goes against the input order sorting. - $this->items[] = array($prefix, $route); - $this->matchStart = count($this->items); - - return; - } - - foreach ($this->items as $i => $item) { - if ($i < $this->matchStart) { - continue; - } - - if ($item instanceof self && $item->accepts($prefix)) { - $item->addRoute($prefix, $route); - - return; - } - - $group = $this->groupWithItem($item, $prefix, $route); - - if ($group instanceof self) { - $this->items[$i] = $group; - - return; - } - } - - // No optimised case was found, in this case we simple add the route for possible - // grouping when new routes are added. - $this->items[] = array($prefix, $route); - } - - /** - * Tries to combine a route with another route or group. - * - * @param StaticPrefixCollection|array $item - * @param string $prefix - * @param mixed $route - * - * @return null|StaticPrefixCollection - */ - private function groupWithItem($item, $prefix, $route) - { - $itemPrefix = $item instanceof self ? $item->prefix : $item[0]; - $commonPrefix = $this->detectCommonPrefix($prefix, $itemPrefix); - - if (!$commonPrefix) { - return; - } - - $child = new self($commonPrefix); - - if ($item instanceof self) { - $child->items = array($item); - } else { - $child->addRoute($item[0], $item[1]); - } - - $child->addRoute($prefix, $route); - - return $child; - } - - /** - * Checks whether a prefix can be contained within the group. - * - * @param string $prefix - * - * @return bool Whether a prefix could belong in a given group - */ - private function accepts($prefix) - { - return '' === $this->prefix || 0 === strpos($prefix, $this->prefix); - } - - /** - * Detects whether there's a common prefix relative to the group prefix and returns it. - * - * @param string $prefix - * @param string $anotherPrefix - * - * @return false|string A common prefix, longer than the base/group prefix, or false when none available - */ - private function detectCommonPrefix($prefix, $anotherPrefix) - { - $baseLength = strlen($this->prefix); - $commonLength = $baseLength; - $end = min(strlen($prefix), strlen($anotherPrefix)); - - for ($i = $baseLength; $i <= $end; ++$i) { - if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) { - break; - } - - $commonLength = $i; - } - - $commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/'); - - if (strlen($commonPrefix) > $baseLength) { - return $commonPrefix; - } - - return false; - } - - /** - * Optimizes the tree by inlining items from groups with less than 3 items. - */ - public function optimizeGroups() - { - $index = -1; - - while (isset($this->items[++$index])) { - $item = $this->items[$index]; - - if ($item instanceof self) { - $item->optimizeGroups(); - - // When a group contains only two items there's no reason to optimize because at minimum - // the amount of prefix check is 2. In this case inline the group. - if ($item->shouldBeInlined()) { - array_splice($this->items, $index, 1, $item->items); - - // Lower index to pass through the same index again after optimizing. - // The first item of the replacements might be a group needing optimization. - --$index; - } - } - } - } - - private function shouldBeInlined() - { - if (count($this->items) >= 3) { - return false; - } - - foreach ($this->items as $item) { - if ($item instanceof self) { - return true; - } - } - - foreach ($this->items as $item) { - if (is_array($item) && $item[0] === $this->prefix) { - return false; - } - } - - return true; - } - - /** - * Guards against adding incompatible prefixes in a group. - * - * @param string $prefix - * - * @throws \LogicException when a prefix does not belong in a group - */ - private function guardAgainstAddingNotAcceptedRoutes($prefix) - { - if (!$this->accepts($prefix)) { - $message = sprintf('Could not add route with prefix %s to collection with prefix %s', $prefix, $this->prefix); - - throw new \LogicException($message); - } - } -} diff --git a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php deleted file mode 100644 index 900c59f..0000000 --- a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Route; - -/** - * @author Fabien Potencier - */ -abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface -{ - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - try { - $parameters = parent::match($pathinfo); - } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { - throw $e; - } - - try { - parent::match($pathinfo.'/'); - - return $this->redirect($pathinfo.'/', null); - } catch (ResourceNotFoundException $e2) { - throw $e; - } - } - - return $parameters; - } - - /** - * {@inheritdoc} - */ - protected function handleRouteRequirements($pathinfo, $name, Route $route) - { - // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { - return array(self::REQUIREMENT_MISMATCH, null); - } - - // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $schemes = $route->getSchemes(); - if ($schemes && !$route->hasScheme($scheme)) { - return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))); - } - - return array(self::REQUIREMENT_MATCH, null); - } -} diff --git a/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php b/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php deleted file mode 100644 index 7c27bc8..0000000 --- a/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -/** - * RedirectableUrlMatcherInterface knows how to redirect the user. - * - * @author Fabien Potencier - */ -interface RedirectableUrlMatcherInterface -{ - /** - * Redirects the user to another URL. - * - * @param string $path The path info to redirect to - * @param string $route The route name that matched - * @param string|null $scheme The URL scheme (null to keep the current one) - * - * @return array An array of parameters - */ - public function redirect($path, $route, $scheme = null); -} diff --git a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php b/vendor/symfony/routing/Matcher/RequestMatcherInterface.php deleted file mode 100644 index b5def3d..0000000 --- a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * RequestMatcherInterface is the interface that all request matcher classes must implement. - * - * @author Fabien Potencier - */ -interface RequestMatcherInterface -{ - /** - * Tries to match a request with a set of routes. - * - * If the matcher can not find information, it must throw one of the exceptions documented - * below. - * - * @param Request $request The request to match - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If no matching resource could be found - * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed - */ - public function matchRequest(Request $request); -} diff --git a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php deleted file mode 100644 index 9085be0..0000000 --- a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Exception\ExceptionInterface; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * TraceableUrlMatcher helps debug path info matching by tracing the match. - * - * @author Fabien Potencier - */ -class TraceableUrlMatcher extends UrlMatcher -{ - const ROUTE_DOES_NOT_MATCH = 0; - const ROUTE_ALMOST_MATCHES = 1; - const ROUTE_MATCHES = 2; - - protected $traces; - - public function getTraces($pathinfo) - { - $this->traces = array(); - - try { - $this->match($pathinfo); - } catch (ExceptionInterface $e) { - } - - return $this->traces; - } - - public function getTracesForRequest(Request $request) - { - $this->request = $request; - $traces = $this->getTraces($request->getPathInfo()); - $this->request = null; - - return $traces; - } - - protected function matchCollection($pathinfo, RouteCollection $routes) - { - foreach ($routes as $name => $route) { - $compiledRoute = $route->compile(); - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - // does it match without any requirements? - $r = new Route($route->getPath(), $route->getDefaults(), array(), $route->getOptions()); - $cr = $r->compile(); - if (!preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Path "%s" does not match', $route->getPath()), self::ROUTE_DOES_NOT_MATCH, $name, $route); - - continue; - } - - foreach ($route->getRequirements() as $n => $regex) { - $r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions()); - $cr = $r->compile(); - - if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { - $this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue 2; - } - } - - continue; - } - - // check host requirement - $hostMatches = array(); - if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { - $this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - - // check HTTP method requirement - if ($requiredMethods = $route->getMethods()) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $requiredMethods)) { - $this->allow = array_merge($this->allow, $requiredMethods); - - $this->addTrace(sprintf('Method "%s" does not match any of the required methods (%s)', $this->context->getMethod(), implode(', ', $requiredMethods)), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - // check condition - if ($condition = $route->getCondition()) { - if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { - $this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $condition), self::ROUTE_ALMOST_MATCHES, $name, $route); - - continue; - } - } - - // check HTTP scheme requirement - if ($requiredSchemes = $route->getSchemes()) { - $scheme = $this->context->getScheme(); - - if (!$route->hasScheme($scheme)) { - $this->addTrace(sprintf('Scheme "%s" does not match any of the required schemes (%s); the user will be redirected to first required scheme', $scheme, implode(', ', $requiredSchemes)), self::ROUTE_ALMOST_MATCHES, $name, $route); - - return true; - } - } - - $this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route); - - return true; - } - } - - private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null) - { - $this->traces[] = array( - 'log' => $log, - 'name' => $name, - 'level' => $level, - 'path' => null !== $route ? $route->getPath() : null, - ); - } -} diff --git a/vendor/symfony/routing/Matcher/UrlMatcher.php b/vendor/symfony/routing/Matcher/UrlMatcher.php deleted file mode 100644 index 62bb74a..0000000 --- a/vendor/symfony/routing/Matcher/UrlMatcher.php +++ /dev/null @@ -1,264 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Route; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * UrlMatcher matches URL based on a set of routes. - * - * @author Fabien Potencier - */ -class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface -{ - const REQUIREMENT_MATCH = 0; - const REQUIREMENT_MISMATCH = 1; - const ROUTE_MATCH = 2; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var array - */ - protected $allow = array(); - - /** - * @var RouteCollection - */ - protected $routes; - - protected $request; - protected $expressionLanguage; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - protected $expressionLanguageProviders = array(); - - /** - * @param RouteCollection $routes A RouteCollection instance - * @param RequestContext $context The context - */ - public function __construct(RouteCollection $routes, RequestContext $context) - { - $this->routes = $routes; - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - $this->allow = array(); - - if ($ret = $this->matchCollection(rawurldecode($pathinfo), $this->routes)) { - return $ret; - } - - throw 0 < count($this->allow) - ? new MethodNotAllowedException(array_unique($this->allow)) - : new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo)); - } - - /** - * {@inheritdoc} - */ - public function matchRequest(Request $request) - { - $this->request = $request; - - $ret = $this->match($request->getPathInfo()); - - $this->request = null; - - return $ret; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * Tries to match a URL with a set of routes. - * - * @param string $pathinfo The path info to be parsed - * @param RouteCollection $routes The set of routes - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - */ - protected function matchCollection($pathinfo, RouteCollection $routes) - { - foreach ($routes as $name => $route) { - $compiledRoute = $route->compile(); - - // check the static prefix of the URL first. Only use the more expensive preg_match when it matches - if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) { - continue; - } - - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { - continue; - } - - $hostMatches = array(); - if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { - continue; - } - - // check HTTP method requirement - if ($requiredMethods = $route->getMethods()) { - // HEAD and GET are equivalent as per RFC - if ('HEAD' === $method = $this->context->getMethod()) { - $method = 'GET'; - } - - if (!in_array($method, $requiredMethods)) { - $this->allow = array_merge($this->allow, $requiredMethods); - - continue; - } - } - - $status = $this->handleRouteRequirements($pathinfo, $name, $route); - - if (self::ROUTE_MATCH === $status[0]) { - return $status[1]; - } - - if (self::REQUIREMENT_MISMATCH === $status[0]) { - continue; - } - - return $this->getAttributes($route, $name, array_replace($matches, $hostMatches)); - } - } - - /** - * Returns an array of values to use as request attributes. - * - * As this method requires the Route object, it is not available - * in matchers that do not have access to the matched Route instance - * (like the PHP and Apache matcher dumpers). - * - * @param Route $route The route we are matching against - * @param string $name The name of the route - * @param array $attributes An array of attributes from the matcher - * - * @return array An array of parameters - */ - protected function getAttributes(Route $route, $name, array $attributes) - { - $attributes['_route'] = $name; - - return $this->mergeDefaults($attributes, $route->getDefaults()); - } - - /** - * Handles specific route requirements. - * - * @param string $pathinfo The path - * @param string $name The route name - * @param Route $route The route - * - * @return array The first element represents the status, the second contains additional information - */ - protected function handleRouteRequirements($pathinfo, $name, Route $route) - { - // expression condition - if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) { - return array(self::REQUIREMENT_MISMATCH, null); - } - - // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - - return array($status, null); - } - - /** - * Get merged default parameters. - * - * @param array $params The parameters - * @param array $defaults The defaults - * - * @return array Merged default parameters - */ - protected function mergeDefaults($params, $defaults) - { - foreach ($params as $key => $value) { - if (!is_int($key)) { - $defaults[$key] = $value; - } - } - - return $defaults; - } - - protected function getExpressionLanguage() - { - if (null === $this->expressionLanguage) { - if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { - throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); - } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); - } - - return $this->expressionLanguage; - } - - /** - * @internal - */ - protected function createRequest($pathinfo) - { - if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - return null; - } - - return Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters(), array(), array(), array( - 'SCRIPT_FILENAME' => $this->context->getBaseUrl(), - 'SCRIPT_NAME' => $this->context->getBaseUrl(), - )); - } -} diff --git a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php b/vendor/symfony/routing/Matcher/UrlMatcherInterface.php deleted file mode 100644 index af38662..0000000 --- a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Matcher; - -use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - -/** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. - * - * @author Fabien Potencier - */ -interface UrlMatcherInterface extends RequestContextAwareInterface -{ - /** - * Tries to match a URL path with a set of routes. - * - * If the matcher can not find information, it must throw one of the exceptions documented - * below. - * - * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - */ - public function match($pathinfo); -} diff --git a/vendor/symfony/routing/README.md b/vendor/symfony/routing/README.md deleted file mode 100644 index 88fb1fd..0000000 --- a/vendor/symfony/routing/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Routing Component -================= - -The Routing component maps an HTTP request to a set of configuration variables. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/routing/index.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/routing/RequestContext.php b/vendor/symfony/routing/RequestContext.php deleted file mode 100644 index d522189..0000000 --- a/vendor/symfony/routing/RequestContext.php +++ /dev/null @@ -1,342 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\HttpFoundation\Request; - -/** - * Holds information about the current request. - * - * This class implements a fluent interface. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class RequestContext -{ - private $baseUrl; - private $pathInfo; - private $method; - private $host; - private $scheme; - private $httpPort; - private $httpsPort; - private $queryString; - - /** - * @var array - */ - private $parameters = array(); - - /** - * @param string $baseUrl The base URL - * @param string $method The HTTP method - * @param string $host The HTTP host name - * @param string $scheme The HTTP scheme - * @param int $httpPort The HTTP port - * @param int $httpsPort The HTTPS port - * @param string $path The path - * @param string $queryString The query string - */ - public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443, $path = '/', $queryString = '') - { - $this->setBaseUrl($baseUrl); - $this->setMethod($method); - $this->setHost($host); - $this->setScheme($scheme); - $this->setHttpPort($httpPort); - $this->setHttpsPort($httpsPort); - $this->setPathInfo($path); - $this->setQueryString($queryString); - } - - /** - * Updates the RequestContext information based on a HttpFoundation Request. - * - * @param Request $request A Request instance - * - * @return $this - */ - public function fromRequest(Request $request) - { - $this->setBaseUrl($request->getBaseUrl()); - $this->setPathInfo($request->getPathInfo()); - $this->setMethod($request->getMethod()); - $this->setHost($request->getHost()); - $this->setScheme($request->getScheme()); - $this->setHttpPort($request->isSecure() ? $this->httpPort : $request->getPort()); - $this->setHttpsPort($request->isSecure() ? $request->getPort() : $this->httpsPort); - $this->setQueryString($request->server->get('QUERY_STRING', '')); - - return $this; - } - - /** - * Gets the base URL. - * - * @return string The base URL - */ - public function getBaseUrl() - { - return $this->baseUrl; - } - - /** - * Sets the base URL. - * - * @param string $baseUrl The base URL - * - * @return $this - */ - public function setBaseUrl($baseUrl) - { - $this->baseUrl = $baseUrl; - - return $this; - } - - /** - * Gets the path info. - * - * @return string The path info - */ - public function getPathInfo() - { - return $this->pathInfo; - } - - /** - * Sets the path info. - * - * @param string $pathInfo The path info - * - * @return $this - */ - public function setPathInfo($pathInfo) - { - $this->pathInfo = $pathInfo; - - return $this; - } - - /** - * Gets the HTTP method. - * - * The method is always an uppercased string. - * - * @return string The HTTP method - */ - public function getMethod() - { - return $this->method; - } - - /** - * Sets the HTTP method. - * - * @param string $method The HTTP method - * - * @return $this - */ - public function setMethod($method) - { - $this->method = strtoupper($method); - - return $this; - } - - /** - * Gets the HTTP host. - * - * The host is always lowercased because it must be treated case-insensitive. - * - * @return string The HTTP host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the HTTP host. - * - * @param string $host The HTTP host - * - * @return $this - */ - public function setHost($host) - { - $this->host = strtolower($host); - - return $this; - } - - /** - * Gets the HTTP scheme. - * - * @return string The HTTP scheme - */ - public function getScheme() - { - return $this->scheme; - } - - /** - * Sets the HTTP scheme. - * - * @param string $scheme The HTTP scheme - * - * @return $this - */ - public function setScheme($scheme) - { - $this->scheme = strtolower($scheme); - - return $this; - } - - /** - * Gets the HTTP port. - * - * @return int The HTTP port - */ - public function getHttpPort() - { - return $this->httpPort; - } - - /** - * Sets the HTTP port. - * - * @param int $httpPort The HTTP port - * - * @return $this - */ - public function setHttpPort($httpPort) - { - $this->httpPort = (int) $httpPort; - - return $this; - } - - /** - * Gets the HTTPS port. - * - * @return int The HTTPS port - */ - public function getHttpsPort() - { - return $this->httpsPort; - } - - /** - * Sets the HTTPS port. - * - * @param int $httpsPort The HTTPS port - * - * @return $this - */ - public function setHttpsPort($httpsPort) - { - $this->httpsPort = (int) $httpsPort; - - return $this; - } - - /** - * Gets the query string. - * - * @return string The query string without the "?" - */ - public function getQueryString() - { - return $this->queryString; - } - - /** - * Sets the query string. - * - * @param string $queryString The query string (after "?") - * - * @return $this - */ - public function setQueryString($queryString) - { - // string cast to be fault-tolerant, accepting null - $this->queryString = (string) $queryString; - - return $this; - } - - /** - * Returns the parameters. - * - * @return array The parameters - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * Sets the parameters. - * - * @param array $parameters The parameters - * - * @return $this - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - - return $this; - } - - /** - * Gets a parameter value. - * - * @param string $name A parameter name - * - * @return mixed The parameter value or null if nonexistent - */ - public function getParameter($name) - { - return isset($this->parameters[$name]) ? $this->parameters[$name] : null; - } - - /** - * Checks if a parameter value is set for the given parameter. - * - * @param string $name A parameter name - * - * @return bool True if the parameter value is set, false otherwise - */ - public function hasParameter($name) - { - return array_key_exists($name, $this->parameters); - } - - /** - * Sets a parameter value. - * - * @param string $name A parameter name - * @param mixed $parameter The parameter value - * - * @return $this - */ - public function setParameter($name, $parameter) - { - $this->parameters[$name] = $parameter; - - return $this; - } -} diff --git a/vendor/symfony/routing/RequestContextAwareInterface.php b/vendor/symfony/routing/RequestContextAwareInterface.php deleted file mode 100644 index ebb0ef4..0000000 --- a/vendor/symfony/routing/RequestContextAwareInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -interface RequestContextAwareInterface -{ - /** - * Sets the request context. - * - * @param RequestContext $context The context - */ - public function setContext(RequestContext $context); - - /** - * Gets the request context. - * - * @return RequestContext The context - */ - public function getContext(); -} diff --git a/vendor/symfony/routing/Route.php b/vendor/symfony/routing/Route.php deleted file mode 100644 index dd4eb84..0000000 --- a/vendor/symfony/routing/Route.php +++ /dev/null @@ -1,587 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * A Route describes a route and its parameters. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class Route implements \Serializable -{ - /** - * @var string - */ - private $path = '/'; - - /** - * @var string - */ - private $host = ''; - - /** - * @var string[] - */ - private $schemes = array(); - - /** - * @var string[] - */ - private $methods = array(); - - /** - * @var array - */ - private $defaults = array(); - - /** - * @var array - */ - private $requirements = array(); - - /** - * @var array - */ - private $options = array(); - - /** - * @var null|CompiledRoute - */ - private $compiled; - - /** - * @var string - */ - private $condition = ''; - - /** - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * * utf8: Whether UTF-8 matching is enforced ot not - * - * @param string $path The path pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * @param string $host The host pattern to match - * @param string|string[] $schemes A required URI scheme or an array of restricted schemes - * @param string|string[] $methods A required HTTP method or an array of restricted methods - * @param string $condition A condition that should evaluate to true for the route to match - */ - public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '') - { - $this->setPath($path); - $this->setDefaults($defaults); - $this->setRequirements($requirements); - $this->setOptions($options); - $this->setHost($host); - $this->setSchemes($schemes); - $this->setMethods($methods); - $this->setCondition($condition); - } - - /** - * {@inheritdoc} - */ - public function serialize() - { - return serialize(array( - 'path' => $this->path, - 'host' => $this->host, - 'defaults' => $this->defaults, - 'requirements' => $this->requirements, - 'options' => $this->options, - 'schemes' => $this->schemes, - 'methods' => $this->methods, - 'condition' => $this->condition, - 'compiled' => $this->compiled, - )); - } - - /** - * {@inheritdoc} - */ - public function unserialize($serialized) - { - $data = unserialize($serialized); - $this->path = $data['path']; - $this->host = $data['host']; - $this->defaults = $data['defaults']; - $this->requirements = $data['requirements']; - $this->options = $data['options']; - $this->schemes = $data['schemes']; - $this->methods = $data['methods']; - - if (isset($data['condition'])) { - $this->condition = $data['condition']; - } - if (isset($data['compiled'])) { - $this->compiled = $data['compiled']; - } - } - - /** - * Returns the pattern for the path. - * - * @return string The path pattern - */ - public function getPath() - { - return $this->path; - } - - /** - * Sets the pattern for the path. - * - * This method implements a fluent interface. - * - * @param string $pattern The path pattern - * - * @return $this - */ - public function setPath($pattern) - { - // A pattern must start with a slash and must not have multiple slashes at the beginning because the - // generated path for this route would be confused with a network path, e.g. '//domain.com/path'. - $this->path = '/'.ltrim(trim($pattern), '/'); - $this->compiled = null; - - return $this; - } - - /** - * Returns the pattern for the host. - * - * @return string The host pattern - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the pattern for the host. - * - * This method implements a fluent interface. - * - * @param string $pattern The host pattern - * - * @return $this - */ - public function setHost($pattern) - { - $this->host = (string) $pattern; - $this->compiled = null; - - return $this; - } - - /** - * Returns the lowercased schemes this route is restricted to. - * So an empty array means that any scheme is allowed. - * - * @return string[] The schemes - */ - public function getSchemes() - { - return $this->schemes; - } - - /** - * Sets the schemes (e.g. 'https') this route is restricted to. - * So an empty array means that any scheme is allowed. - * - * This method implements a fluent interface. - * - * @param string|string[] $schemes The scheme or an array of schemes - * - * @return $this - */ - public function setSchemes($schemes) - { - $this->schemes = array_map('strtolower', (array) $schemes); - $this->compiled = null; - - return $this; - } - - /** - * Checks if a scheme requirement has been set. - * - * @param string $scheme - * - * @return bool true if the scheme requirement exists, otherwise false - */ - public function hasScheme($scheme) - { - return in_array(strtolower($scheme), $this->schemes, true); - } - - /** - * Returns the uppercased HTTP methods this route is restricted to. - * So an empty array means that any method is allowed. - * - * @return string[] The methods - */ - public function getMethods() - { - return $this->methods; - } - - /** - * Sets the HTTP methods (e.g. 'POST') this route is restricted to. - * So an empty array means that any method is allowed. - * - * This method implements a fluent interface. - * - * @param string|string[] $methods The method or an array of methods - * - * @return $this - */ - public function setMethods($methods) - { - $this->methods = array_map('strtoupper', (array) $methods); - $this->compiled = null; - - return $this; - } - - /** - * Returns the options. - * - * @return array The options - */ - public function getOptions() - { - return $this->options; - } - - /** - * Sets the options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return $this - */ - public function setOptions(array $options) - { - $this->options = array( - 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ); - - return $this->addOptions($options); - } - - /** - * Adds options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return $this - */ - public function addOptions(array $options) - { - foreach ($options as $name => $option) { - $this->options[$name] = $option; - } - $this->compiled = null; - - return $this; - } - - /** - * Sets an option value. - * - * This method implements a fluent interface. - * - * @param string $name An option name - * @param mixed $value The option value - * - * @return $this - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - $this->compiled = null; - - return $this; - } - - /** - * Get an option value. - * - * @param string $name An option name - * - * @return mixed The option value or null when not given - */ - public function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; - } - - /** - * Checks if an option has been set. - * - * @param string $name An option name - * - * @return bool true if the option is set, false otherwise - */ - public function hasOption($name) - { - return array_key_exists($name, $this->options); - } - - /** - * Returns the defaults. - * - * @return array The defaults - */ - public function getDefaults() - { - return $this->defaults; - } - - /** - * Sets the defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return $this - */ - public function setDefaults(array $defaults) - { - $this->defaults = array(); - - return $this->addDefaults($defaults); - } - - /** - * Adds defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return $this - */ - public function addDefaults(array $defaults) - { - foreach ($defaults as $name => $default) { - $this->defaults[$name] = $default; - } - $this->compiled = null; - - return $this; - } - - /** - * Gets a default value. - * - * @param string $name A variable name - * - * @return mixed The default value or null when not given - */ - public function getDefault($name) - { - return isset($this->defaults[$name]) ? $this->defaults[$name] : null; - } - - /** - * Checks if a default value is set for the given variable. - * - * @param string $name A variable name - * - * @return bool true if the default value is set, false otherwise - */ - public function hasDefault($name) - { - return array_key_exists($name, $this->defaults); - } - - /** - * Sets a default value. - * - * @param string $name A variable name - * @param mixed $default The default value - * - * @return $this - */ - public function setDefault($name, $default) - { - $this->defaults[$name] = $default; - $this->compiled = null; - - return $this; - } - - /** - * Returns the requirements. - * - * @return array The requirements - */ - public function getRequirements() - { - return $this->requirements; - } - - /** - * Sets the requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return $this - */ - public function setRequirements(array $requirements) - { - $this->requirements = array(); - - return $this->addRequirements($requirements); - } - - /** - * Adds requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return $this - */ - public function addRequirements(array $requirements) - { - foreach ($requirements as $key => $regex) { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - } - $this->compiled = null; - - return $this; - } - - /** - * Returns the requirement for the given key. - * - * @param string $key The key - * - * @return string|null The regex or null when not given - */ - public function getRequirement($key) - { - return isset($this->requirements[$key]) ? $this->requirements[$key] : null; - } - - /** - * Checks if a requirement is set for the given key. - * - * @param string $key A variable name - * - * @return bool true if a requirement is specified, false otherwise - */ - public function hasRequirement($key) - { - return array_key_exists($key, $this->requirements); - } - - /** - * Sets a requirement for the given key. - * - * @param string $key The key - * @param string $regex The regex - * - * @return $this - */ - public function setRequirement($key, $regex) - { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - $this->compiled = null; - - return $this; - } - - /** - * Returns the condition. - * - * @return string The condition - */ - public function getCondition() - { - return $this->condition; - } - - /** - * Sets the condition. - * - * This method implements a fluent interface. - * - * @param string $condition The condition - * - * @return $this - */ - public function setCondition($condition) - { - $this->condition = (string) $condition; - $this->compiled = null; - - return $this; - } - - /** - * Compiles the route. - * - * @return CompiledRoute A CompiledRoute instance - * - * @throws \LogicException If the Route cannot be compiled because the - * path or host pattern is invalid - * - * @see RouteCompiler which is responsible for the compilation process - */ - public function compile() - { - if (null !== $this->compiled) { - return $this->compiled; - } - - $class = $this->getOption('compiler_class'); - - return $this->compiled = $class::compile($this); - } - - private function sanitizeRequirement($key, $regex) - { - if (!is_string($regex)) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key)); - } - - if ('' !== $regex && '^' === $regex[0]) { - $regex = (string) substr($regex, 1); // returns false for a single character - } - - if ('$' === substr($regex, -1)) { - $regex = substr($regex, 0, -1); - } - - if ('' === $regex) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" cannot be empty.', $key)); - } - - return $regex; - } -} diff --git a/vendor/symfony/routing/RouteCollection.php b/vendor/symfony/routing/RouteCollection.php deleted file mode 100644 index f8b1808..0000000 --- a/vendor/symfony/routing/RouteCollection.php +++ /dev/null @@ -1,277 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * A RouteCollection represents a set of Route instances. - * - * When adding a route at the end of the collection, an existing route - * with the same name is removed first. So there can only be one route - * with a given name. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class RouteCollection implements \IteratorAggregate, \Countable -{ - /** - * @var Route[] - */ - private $routes = array(); - - /** - * @var array - */ - private $resources = array(); - - public function __clone() - { - foreach ($this->routes as $name => $route) { - $this->routes[$name] = clone $route; - } - } - - /** - * Gets the current RouteCollection as an Iterator that includes all routes. - * - * It implements \IteratorAggregate. - * - * @see all() - * - * @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes - */ - public function getIterator() - { - return new \ArrayIterator($this->routes); - } - - /** - * Gets the number of Routes in this collection. - * - * @return int The number of routes - */ - public function count() - { - return count($this->routes); - } - - /** - * Adds a route. - * - * @param string $name The route name - * @param Route $route A Route instance - */ - public function add($name, Route $route) - { - unset($this->routes[$name]); - - $this->routes[$name] = $route; - } - - /** - * Returns all routes in this collection. - * - * @return Route[] An array of routes - */ - public function all() - { - return $this->routes; - } - - /** - * Gets a route by name. - * - * @param string $name The route name - * - * @return Route|null A Route instance or null when not found - */ - public function get($name) - { - return isset($this->routes[$name]) ? $this->routes[$name] : null; - } - - /** - * Removes a route or an array of routes by name from the collection. - * - * @param string|string[] $name The route name or an array of route names - */ - public function remove($name) - { - foreach ((array) $name as $n) { - unset($this->routes[$n]); - } - } - - /** - * Adds a route collection at the end of the current set by appending all - * routes of the added collection. - * - * @param RouteCollection $collection A RouteCollection instance - */ - public function addCollection(RouteCollection $collection) - { - // we need to remove all routes with the same names first because just replacing them - // would not place the new route at the end of the merged array - foreach ($collection->all() as $name => $route) { - unset($this->routes[$name]); - $this->routes[$name] = $route; - } - - $this->resources = array_merge($this->resources, $collection->getResources()); - } - - /** - * Adds a prefix to the path of all child routes. - * - * @param string $prefix An optional prefix to add before each pattern of the route collection - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - */ - public function addPrefix($prefix, array $defaults = array(), array $requirements = array()) - { - $prefix = trim(trim($prefix), '/'); - - if ('' === $prefix) { - return; - } - - foreach ($this->routes as $route) { - $route->setPath('/'.$prefix.$route->getPath()); - $route->addDefaults($defaults); - $route->addRequirements($requirements); - } - } - - /** - * Sets the host pattern on all routes. - * - * @param string $pattern The pattern - * @param array $defaults An array of default values - * @param array $requirements An array of requirements - */ - public function setHost($pattern, array $defaults = array(), array $requirements = array()) - { - foreach ($this->routes as $route) { - $route->setHost($pattern); - $route->addDefaults($defaults); - $route->addRequirements($requirements); - } - } - - /** - * Sets a condition on all routes. - * - * Existing conditions will be overridden. - * - * @param string $condition The condition - */ - public function setCondition($condition) - { - foreach ($this->routes as $route) { - $route->setCondition($condition); - } - } - - /** - * Adds defaults to all routes. - * - * An existing default value under the same name in a route will be overridden. - * - * @param array $defaults An array of default values - */ - public function addDefaults(array $defaults) - { - if ($defaults) { - foreach ($this->routes as $route) { - $route->addDefaults($defaults); - } - } - } - - /** - * Adds requirements to all routes. - * - * An existing requirement under the same name in a route will be overridden. - * - * @param array $requirements An array of requirements - */ - public function addRequirements(array $requirements) - { - if ($requirements) { - foreach ($this->routes as $route) { - $route->addRequirements($requirements); - } - } - } - - /** - * Adds options to all routes. - * - * An existing option value under the same name in a route will be overridden. - * - * @param array $options An array of options - */ - public function addOptions(array $options) - { - if ($options) { - foreach ($this->routes as $route) { - $route->addOptions($options); - } - } - } - - /** - * Sets the schemes (e.g. 'https') all child routes are restricted to. - * - * @param string|string[] $schemes The scheme or an array of schemes - */ - public function setSchemes($schemes) - { - foreach ($this->routes as $route) { - $route->setSchemes($schemes); - } - } - - /** - * Sets the HTTP methods (e.g. 'POST') all child routes are restricted to. - * - * @param string|string[] $methods The method or an array of methods - */ - public function setMethods($methods) - { - foreach ($this->routes as $route) { - $route->setMethods($methods); - } - } - - /** - * Returns an array of resources loaded to build this collection. - * - * @return ResourceInterface[] An array of resources - */ - public function getResources() - { - return array_unique($this->resources); - } - - /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource A resource instance - */ - public function addResource(ResourceInterface $resource) - { - $this->resources[] = $resource; - } -} diff --git a/vendor/symfony/routing/RouteCollectionBuilder.php b/vendor/symfony/routing/RouteCollectionBuilder.php deleted file mode 100644 index 54bd86b..0000000 --- a/vendor/symfony/routing/RouteCollectionBuilder.php +++ /dev/null @@ -1,383 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Exception\FileLoaderLoadException; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * Helps add and import routes into a RouteCollection. - * - * @author Ryan Weaver - */ -class RouteCollectionBuilder -{ - /** - * @var Route[]|RouteCollectionBuilder[] - */ - private $routes = array(); - - private $loader; - private $defaults = array(); - private $prefix; - private $host; - private $condition; - private $requirements = array(); - private $options = array(); - private $schemes; - private $methods; - private $resources = array(); - - /** - * @param LoaderInterface $loader - */ - public function __construct(LoaderInterface $loader = null) - { - $this->loader = $loader; - } - - /** - * Import an external routing resource and returns the RouteCollectionBuilder. - * - * $routes->import('blog.yml', '/blog'); - * - * @param mixed $resource - * @param string|null $prefix - * @param string $type - * - * @return self - * - * @throws FileLoaderLoadException - */ - public function import($resource, $prefix = '/', $type = null) - { - /** @var RouteCollection[] $collection */ - $collections = $this->load($resource, $type); - - // create a builder from the RouteCollection - $builder = $this->createBuilder(); - - foreach ($collections as $collection) { - if (null === $collection) { - continue; - } - - foreach ($collection->all() as $name => $route) { - $builder->addRoute($route, $name); - } - - foreach ($collection->getResources() as $resource) { - $builder->addResource($resource); - } - - // mount into this builder - $this->mount($prefix, $builder); - } - - return $builder; - } - - /** - * Adds a route and returns it for future modification. - * - * @param string $path The route path - * @param string $controller The route's controller - * @param string|null $name The name to give this route - * - * @return Route - */ - public function add($path, $controller, $name = null) - { - $route = new Route($path); - $route->setDefault('_controller', $controller); - $this->addRoute($route, $name); - - return $route; - } - - /** - * Returns a RouteCollectionBuilder that can be configured and then added with mount(). - * - * @return self - */ - public function createBuilder() - { - return new self($this->loader); - } - - /** - * Add a RouteCollectionBuilder. - * - * @param string $prefix - * @param RouteCollectionBuilder $builder - */ - public function mount($prefix, RouteCollectionBuilder $builder) - { - $builder->prefix = trim(trim($prefix), '/'); - $this->routes[] = $builder; - } - - /** - * Adds a Route object to the builder. - * - * @param Route $route - * @param string|null $name - * - * @return $this - */ - public function addRoute(Route $route, $name = null) - { - if (null === $name) { - // used as a flag to know which routes will need a name later - $name = '_unnamed_route_'.spl_object_hash($route); - } - - $this->routes[$name] = $route; - - return $this; - } - - /** - * Sets the host on all embedded routes (unless already set). - * - * @param string $pattern - * - * @return $this - */ - public function setHost($pattern) - { - $this->host = $pattern; - - return $this; - } - - /** - * Sets a condition on all embedded routes (unless already set). - * - * @param string $condition - * - * @return $this - */ - public function setCondition($condition) - { - $this->condition = $condition; - - return $this; - } - - /** - * Sets a default value that will be added to all embedded routes (unless that - * default value is already set). - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function setDefault($key, $value) - { - $this->defaults[$key] = $value; - - return $this; - } - - /** - * Sets a requirement that will be added to all embedded routes (unless that - * requirement is already set). - * - * @param string $key - * @param mixed $regex - * - * @return $this - */ - public function setRequirement($key, $regex) - { - $this->requirements[$key] = $regex; - - return $this; - } - - /** - * Sets an option that will be added to all embedded routes (unless that - * option is already set). - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function setOption($key, $value) - { - $this->options[$key] = $value; - - return $this; - } - - /** - * Sets the schemes on all embedded routes (unless already set). - * - * @param array|string $schemes - * - * @return $this - */ - public function setSchemes($schemes) - { - $this->schemes = $schemes; - - return $this; - } - - /** - * Sets the methods on all embedded routes (unless already set). - * - * @param array|string $methods - * - * @return $this - */ - public function setMethods($methods) - { - $this->methods = $methods; - - return $this; - } - - /** - * Adds a resource for this collection. - * - * @param ResourceInterface $resource - * - * @return $this - */ - private function addResource(ResourceInterface $resource) - { - $this->resources[] = $resource; - - return $this; - } - - /** - * Creates the final RouteCollection and returns it. - * - * @return RouteCollection - */ - public function build() - { - $routeCollection = new RouteCollection(); - - foreach ($this->routes as $name => $route) { - if ($route instanceof Route) { - $route->setDefaults(array_merge($this->defaults, $route->getDefaults())); - $route->setOptions(array_merge($this->options, $route->getOptions())); - - foreach ($this->requirements as $key => $val) { - if (!$route->hasRequirement($key)) { - $route->setRequirement($key, $val); - } - } - - if (null !== $this->prefix) { - $route->setPath('/'.$this->prefix.$route->getPath()); - } - - if (!$route->getHost()) { - $route->setHost($this->host); - } - - if (!$route->getCondition()) { - $route->setCondition($this->condition); - } - - if (!$route->getSchemes()) { - $route->setSchemes($this->schemes); - } - - if (!$route->getMethods()) { - $route->setMethods($this->methods); - } - - // auto-generate the route name if it's been marked - if ('_unnamed_route_' === substr($name, 0, 15)) { - $name = $this->generateRouteName($route); - } - - $routeCollection->add($name, $route); - } else { - /* @var self $route */ - $subCollection = $route->build(); - $subCollection->addPrefix($this->prefix); - - $routeCollection->addCollection($subCollection); - } - - foreach ($this->resources as $resource) { - $routeCollection->addResource($resource); - } - } - - return $routeCollection; - } - - /** - * Generates a route name based on details of this route. - * - * @return string - */ - private function generateRouteName(Route $route) - { - $methods = implode('_', $route->getMethods()).'_'; - - $routeName = $methods.$route->getPath(); - $routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName); - $routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName); - - // Collapse consecutive underscores down into a single underscore. - $routeName = preg_replace('/_+/', '_', $routeName); - - return $routeName; - } - - /** - * Finds a loader able to load an imported resource and loads it. - * - * @param mixed $resource A resource - * @param string|null $type The resource type or null if unknown - * - * @return RouteCollection[] - * - * @throws FileLoaderLoadException If no loader is found - */ - private function load($resource, $type = null) - { - if (null === $this->loader) { - throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.'); - } - - if ($this->loader->supports($resource, $type)) { - $collections = $this->loader->load($resource, $type); - - return is_array($collections) ? $collections : array($collections); - } - - if (null === $resolver = $this->loader->getResolver()) { - throw new FileLoaderLoadException($resource, null, null, null, $type); - } - - if (false === $loader = $resolver->resolve($resource, $type)) { - throw new FileLoaderLoadException($resource, null, null, null, $type); - } - - $collections = $loader->load($resource, $type); - - return is_array($collections) ? $collections : array($collections); - } -} diff --git a/vendor/symfony/routing/RouteCompiler.php b/vendor/symfony/routing/RouteCompiler.php deleted file mode 100644 index fc6a182..0000000 --- a/vendor/symfony/routing/RouteCompiler.php +++ /dev/null @@ -1,319 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompiler compiles Route instances to CompiledRoute instances. - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class RouteCompiler implements RouteCompilerInterface -{ - const REGEX_DELIMITER = '#'; - - /** - * This string defines the characters that are automatically considered separators in front of - * optional placeholders (with default and no static text following). Such a single separator - * can be left out together with the optional placeholder from matching and generating URLs. - */ - const SEPARATORS = '/,;.:-_~+*=@|'; - - /** - * The maximum supported length of a PCRE subpattern name - * http://pcre.org/current/doc/html/pcre2pattern.html#SEC16. - * - * @internal - */ - const VARIABLE_MAXIMUM_LENGTH = 32; - - /** - * {@inheritdoc} - * - * @throws \InvalidArgumentException if a path variable is named _fragment - * @throws \LogicException if a variable is referenced more than once - * @throws \DomainException if a variable name starts with a digit or if it is too long to be successfully used as - * a PCRE subpattern - */ - public static function compile(Route $route) - { - $hostVariables = array(); - $variables = array(); - $hostRegex = null; - $hostTokens = array(); - - if ('' !== $host = $route->getHost()) { - $result = self::compilePattern($route, $host, true); - - $hostVariables = $result['variables']; - $variables = $hostVariables; - - $hostTokens = $result['tokens']; - $hostRegex = $result['regex']; - } - - $path = $route->getPath(); - - $result = self::compilePattern($route, $path, false); - - $staticPrefix = $result['staticPrefix']; - - $pathVariables = $result['variables']; - - foreach ($pathVariables as $pathParam) { - if ('_fragment' === $pathParam) { - throw new \InvalidArgumentException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath())); - } - } - - $variables = array_merge($variables, $pathVariables); - - $tokens = $result['tokens']; - $regex = $result['regex']; - - return new CompiledRoute( - $staticPrefix, - $regex, - $tokens, - $pathVariables, - $hostRegex, - $hostTokens, - $hostVariables, - array_unique($variables) - ); - } - - private static function compilePattern(Route $route, $pattern, $isHost) - { - $tokens = array(); - $variables = array(); - $matches = array(); - $pos = 0; - $defaultSeparator = $isHost ? '.' : '/'; - $useUtf8 = preg_match('//u', $pattern); - $needsUtf8 = $route->getOption('utf8'); - - if (!$needsUtf8 && $useUtf8 && preg_match('/[\x80-\xFF]/', $pattern)) { - $needsUtf8 = true; - @trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), E_USER_DEPRECATED); - } - if (!$useUtf8 && $needsUtf8) { - throw new \LogicException(sprintf('Cannot mix UTF-8 requirements with non-UTF-8 pattern "%s".', $pattern)); - } - - // Match all variables enclosed in "{}" and iterate over them. But we only want to match the innermost variable - // in case of nested "{}", e.g. {foo{bar}}. This in ensured because \w does not match "{" or "}" itself. - preg_match_all('#\{\w+\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); - foreach ($matches as $match) { - $varName = substr($match[0][0], 1, -1); - // get all static text preceding the current variable - $precedingText = substr($pattern, $pos, $match[0][1] - $pos); - $pos = $match[0][1] + strlen($match[0][0]); - - if (!strlen($precedingText)) { - $precedingChar = ''; - } elseif ($useUtf8) { - preg_match('/.$/u', $precedingText, $precedingChar); - $precedingChar = $precedingChar[0]; - } else { - $precedingChar = substr($precedingText, -1); - } - $isSeparator = '' !== $precedingChar && false !== strpos(static::SEPARATORS, $precedingChar); - - // A PCRE subpattern name must start with a non-digit. Also a PHP variable cannot start with a digit so the - // variable would not be usable as a Controller action argument. - if (preg_match('/^\d/', $varName)) { - throw new \DomainException(sprintf('Variable name "%s" cannot start with a digit in route pattern "%s". Please use a different name.', $varName, $pattern)); - } - if (in_array($varName, $variables)) { - throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName)); - } - - if (strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) { - throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %s characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern)); - } - - if ($isSeparator && $precedingText !== $precedingChar) { - $tokens[] = array('text', substr($precedingText, 0, -strlen($precedingChar))); - } elseif (!$isSeparator && strlen($precedingText) > 0) { - $tokens[] = array('text', $precedingText); - } - - $regexp = $route->getRequirement($varName); - if (null === $regexp) { - $followingPattern = (string) substr($pattern, $pos); - // Find the next static character after the variable that functions as a separator. By default, this separator and '/' - // are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all - // and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are - // the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html')) - // If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything. - // Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally - // part of {_format} when generating the URL, e.g. _format = 'mobile.html'. - $nextSeparator = self::findNextSeparator($followingPattern, $useUtf8); - $regexp = sprintf( - '[^%s%s]+', - preg_quote($defaultSeparator, self::REGEX_DELIMITER), - $defaultSeparator !== $nextSeparator && '' !== $nextSeparator ? preg_quote($nextSeparator, self::REGEX_DELIMITER) : '' - ); - if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) { - // When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive - // quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns. - // Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow - // after it. This optimization cannot be applied when the next char is no real separator or when the next variable is - // directly adjacent, e.g. '/{x}{y}'. - $regexp .= '+'; - } - } else { - if (!preg_match('//u', $regexp)) { - $useUtf8 = false; - } elseif (!$needsUtf8 && preg_match('/[\x80-\xFF]|(?= 0; --$i) { - $token = $tokens[$i]; - if ('variable' === $token[0] && $route->hasDefault($token[3])) { - $firstOptional = $i; - } else { - break; - } - } - } - - // compute the matching regexp - $regexp = ''; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { - $regexp .= self::computeRegexp($tokens, $i, $firstOptional); - } - $regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'s'.($isHost ? 'i' : ''); - - // enable Utf8 matching if really required - if ($needsUtf8) { - $regexp .= 'u'; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { - if ('variable' === $tokens[$i][0]) { - $tokens[$i][] = true; - } - } - } - - return array( - 'staticPrefix' => self::determineStaticPrefix($route, $tokens), - 'regex' => $regexp, - 'tokens' => array_reverse($tokens), - 'variables' => $variables, - ); - } - - /** - * Determines the longest static prefix possible for a route. - * - * @param Route $route - * @param array $tokens - * - * @return string The leading static part of a route's path - */ - private static function determineStaticPrefix(Route $route, array $tokens) - { - if ('text' !== $tokens[0][0]) { - return ($route->hasDefault($tokens[0][3]) || '/' === $tokens[0][1]) ? '' : $tokens[0][1]; - } - - $prefix = $tokens[0][1]; - - if (isset($tokens[1][1]) && '/' !== $tokens[1][1] && false === $route->hasDefault($tokens[1][3])) { - $prefix .= $tokens[1][1]; - } - - return $prefix; - } - - /** - * Returns the next static character in the Route pattern that will serve as a separator. - * - * @param string $pattern The route pattern - * @param bool $useUtf8 Whether the character is encoded in UTF-8 or not - * - * @return string The next static character that functions as separator (or empty string when none available) - */ - private static function findNextSeparator($pattern, $useUtf8) - { - if ('' == $pattern) { - // return empty string if pattern is empty or false (false which can be returned by substr) - return ''; - } - // first remove all placeholders from the pattern so we can find the next real static character - if ('' === $pattern = preg_replace('#\{\w+\}#', '', $pattern)) { - return ''; - } - if ($useUtf8) { - preg_match('/^./u', $pattern, $pattern); - } - - return false !== strpos(static::SEPARATORS, $pattern[0]) ? $pattern[0] : ''; - } - - /** - * Computes the regexp used to match a specific token. It can be static text or a subpattern. - * - * @param array $tokens The route tokens - * @param int $index The index of the current token - * @param int $firstOptional The index of the first optional token - * - * @return string The regexp pattern for a single token - */ - private static function computeRegexp(array $tokens, $index, $firstOptional) - { - $token = $tokens[$index]; - if ('text' === $token[0]) { - // Text tokens - return preg_quote($token[1], self::REGEX_DELIMITER); - } else { - // Variable tokens - if (0 === $index && 0 === $firstOptional) { - // When the only token is an optional variable token, the separator is required - return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); - } else { - $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); - if ($index >= $firstOptional) { - // Enclose each optional token in a subpattern to make it optional. - // "?:" means it is non-capturing, i.e. the portion of the subject string that - // matched the optional subpattern is not passed back. - $regexp = "(?:$regexp"; - $nbTokens = count($tokens); - if ($nbTokens - 1 == $index) { - // Close the optional subpatterns - $regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); - } - } - - return $regexp; - } - } - } -} diff --git a/vendor/symfony/routing/RouteCompilerInterface.php b/vendor/symfony/routing/RouteCompilerInterface.php deleted file mode 100644 index e6f8ee6..0000000 --- a/vendor/symfony/routing/RouteCompilerInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompilerInterface is the interface that all RouteCompiler classes must implement. - * - * @author Fabien Potencier - */ -interface RouteCompilerInterface -{ - /** - * Compiles the current route instance. - * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance - * - * @throws \LogicException If the Route cannot be compiled because the - * path or host pattern is invalid - */ - public static function compile(Route $route); -} diff --git a/vendor/symfony/routing/Router.php b/vendor/symfony/routing/Router.php deleted file mode 100644 index e93cd65..0000000 --- a/vendor/symfony/routing/Router.php +++ /dev/null @@ -1,386 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheFactory; -use Psr\Log\LoggerInterface; -use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface; -use Symfony\Component\Routing\Matcher\RequestMatcherInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * The Router class is an example of the integration of all pieces of the - * routing system for easier use. - * - * @author Fabien Potencier - */ -class Router implements RouterInterface, RequestMatcherInterface -{ - /** - * @var UrlMatcherInterface|null - */ - protected $matcher; - - /** - * @var UrlGeneratorInterface|null - */ - protected $generator; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var LoaderInterface - */ - protected $loader; - - /** - * @var RouteCollection|null - */ - protected $collection; - - /** - * @var mixed - */ - protected $resource; - - /** - * @var array - */ - protected $options = array(); - - /** - * @var LoggerInterface|null - */ - protected $logger; - - /** - * @var ConfigCacheFactoryInterface|null - */ - private $configCacheFactory; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - private $expressionLanguageProviders = array(); - - /** - * @param LoaderInterface $loader A LoaderInterface instance - * @param mixed $resource The main resource to load - * @param array $options An array of options - * @param RequestContext $context The context - * @param LoggerInterface $logger A logger instance - */ - public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null) - { - $this->loader = $loader; - $this->resource = $resource; - $this->logger = $logger; - $this->context = $context ?: new RequestContext(); - $this->setOptions($options); - } - - /** - * Sets options. - * - * Available options: - * - * * cache_dir: The cache directory (or null to disable caching) - * * debug: Whether to enable debugging or not (false by default) - * * generator_class: The name of a UrlGeneratorInterface implementation - * * generator_base_class: The base class for the dumped generator class - * * generator_cache_class: The class name for the dumped generator class - * * generator_dumper_class: The name of a GeneratorDumperInterface implementation - * * matcher_class: The name of a UrlMatcherInterface implementation - * * matcher_base_class: The base class for the dumped matcher class - * * matcher_dumper_class: The class name for the dumped matcher class - * * matcher_cache_class: The name of a MatcherDumperInterface implementation - * * resource_type: Type hint for the main resource (optional) - * * strict_requirements: Configure strict requirement checking for generators - * implementing ConfigurableRequirementsInterface (default is true) - * - * @param array $options An array of options - * - * @throws \InvalidArgumentException When unsupported option is provided - */ - public function setOptions(array $options) - { - $this->options = array( - 'cache_dir' => null, - 'debug' => false, - 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - 'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper', - 'generator_cache_class' => 'ProjectUrlGenerator', - 'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper', - 'matcher_cache_class' => 'ProjectUrlMatcher', - 'resource_type' => null, - 'strict_requirements' => true, - ); - - // check option names and live merge, if errors are encountered Exception will be thrown - $invalid = array(); - foreach ($options as $key => $value) { - if (array_key_exists($key, $this->options)) { - $this->options[$key] = $value; - } else { - $invalid[] = $key; - } - } - - if ($invalid) { - throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid))); - } - } - - /** - * Sets an option. - * - * @param string $key The key - * @param mixed $value The value - * - * @throws \InvalidArgumentException - */ - public function setOption($key, $value) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - $this->options[$key] = $value; - } - - /** - * Gets an option value. - * - * @param string $key The key - * - * @return mixed The value - * - * @throws \InvalidArgumentException - */ - public function getOption($key) - { - if (!array_key_exists($key, $this->options)) { - throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key)); - } - - return $this->options[$key]; - } - - /** - * {@inheritdoc} - */ - public function getRouteCollection() - { - if (null === $this->collection) { - $this->collection = $this->loader->load($this->resource, $this->options['resource_type']); - } - - return $this->collection; - } - - /** - * {@inheritdoc} - */ - public function setContext(RequestContext $context) - { - $this->context = $context; - - if (null !== $this->matcher) { - $this->getMatcher()->setContext($context); - } - if (null !== $this->generator) { - $this->getGenerator()->setContext($context); - } - } - - /** - * {@inheritdoc} - */ - public function getContext() - { - return $this->context; - } - - /** - * Sets the ConfigCache factory to use. - * - * @param ConfigCacheFactoryInterface $configCacheFactory The factory to use - */ - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) - { - $this->configCacheFactory = $configCacheFactory; - } - - /** - * {@inheritdoc} - */ - public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) - { - return $this->getGenerator()->generate($name, $parameters, $referenceType); - } - - /** - * {@inheritdoc} - */ - public function match($pathinfo) - { - return $this->getMatcher()->match($pathinfo); - } - - /** - * {@inheritdoc} - */ - public function matchRequest(Request $request) - { - $matcher = $this->getMatcher(); - if (!$matcher instanceof RequestMatcherInterface) { - // fallback to the default UrlMatcherInterface - return $matcher->match($request->getPathInfo()); - } - - return $matcher->matchRequest($request); - } - - /** - * Gets the UrlMatcher instance associated with this Router. - * - * @return UrlMatcherInterface A UrlMatcherInterface instance - */ - public function getMatcher() - { - if (null !== $this->matcher) { - return $this->matcher; - } - - if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) { - $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context); - if (method_exists($this->matcher, 'addExpressionLanguageProvider')) { - foreach ($this->expressionLanguageProviders as $provider) { - $this->matcher->addExpressionLanguageProvider($provider); - } - } - - return $this->matcher; - } - - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php', - function (ConfigCacheInterface $cache) { - $dumper = $this->getMatcherDumperInstance(); - if (method_exists($dumper, 'addExpressionLanguageProvider')) { - foreach ($this->expressionLanguageProviders as $provider) { - $dumper->addExpressionLanguageProvider($provider); - } - } - - $options = array( - 'class' => $this->options['matcher_cache_class'], - 'base_class' => $this->options['matcher_base_class'], - ); - - $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); - } - ); - - require_once $cache->getPath(); - - return $this->matcher = new $this->options['matcher_cache_class']($this->context); - } - - /** - * Gets the UrlGenerator instance associated with this Router. - * - * @return UrlGeneratorInterface A UrlGeneratorInterface instance - */ - public function getGenerator() - { - if (null !== $this->generator) { - return $this->generator; - } - - if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) { - $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger); - } else { - $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php', - function (ConfigCacheInterface $cache) { - $dumper = $this->getGeneratorDumperInstance(); - - $options = array( - 'class' => $this->options['generator_cache_class'], - 'base_class' => $this->options['generator_base_class'], - ); - - $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); - } - ); - - require_once $cache->getPath(); - - $this->generator = new $this->options['generator_cache_class']($this->context, $this->logger); - } - - if ($this->generator instanceof ConfigurableRequirementsInterface) { - $this->generator->setStrictRequirements($this->options['strict_requirements']); - } - - return $this->generator; - } - - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * @return GeneratorDumperInterface - */ - protected function getGeneratorDumperInstance() - { - return new $this->options['generator_dumper_class']($this->getRouteCollection()); - } - - /** - * @return MatcherDumperInterface - */ - protected function getMatcherDumperInstance() - { - return new $this->options['matcher_dumper_class']($this->getRouteCollection()); - } - - /** - * Provides the ConfigCache factory implementation, falling back to a - * default implementation if necessary. - * - * @return ConfigCacheFactoryInterface $configCacheFactory - */ - private function getConfigCacheFactory() - { - if (null === $this->configCacheFactory) { - $this->configCacheFactory = new ConfigCacheFactory($this->options['debug']); - } - - return $this->configCacheFactory; - } -} diff --git a/vendor/symfony/routing/RouterInterface.php b/vendor/symfony/routing/RouterInterface.php deleted file mode 100644 index a10ae34..0000000 --- a/vendor/symfony/routing/RouterInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; - -/** - * RouterInterface is the interface that all Router classes must implement. - * - * This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface. - * - * @author Fabien Potencier - */ -interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface -{ - /** - * Gets the RouteCollection instance associated with this Router. - * - * @return RouteCollection A RouteCollection instance - */ - public function getRouteCollection(); -} diff --git a/vendor/symfony/routing/Tests/Annotation/RouteTest.php b/vendor/symfony/routing/Tests/Annotation/RouteTest.php deleted file mode 100644 index 9af22f2..0000000 --- a/vendor/symfony/routing/Tests/Annotation/RouteTest.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Annotation; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends TestCase -{ - /** - * @expectedException \BadMethodCallException - */ - public function testInvalidRouteParameter() - { - $route = new Route(array('foo' => 'bar')); - } - - /** - * @dataProvider getValidParameters - */ - public function testRouteParameters($parameter, $value, $getter) - { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); - } - - public function getValidParameters() - { - return array( - array('value', '/Blog', 'getPath'), - array('requirements', array('locale' => 'en'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'), - array('schemes', array('https'), 'getSchemes'), - array('methods', array('GET', 'POST'), 'getMethods'), - array('host', '{locale}.example.com', 'getHost'), - array('condition', 'context.getMethod() == "GET"', 'getCondition'), - ); - } -} diff --git a/vendor/symfony/routing/Tests/CompiledRouteTest.php b/vendor/symfony/routing/Tests/CompiledRouteTest.php deleted file mode 100644 index c553179..0000000 --- a/vendor/symfony/routing/Tests/CompiledRouteTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\CompiledRoute; - -class CompiledRouteTest extends TestCase -{ - public function testAccessors() - { - $compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), array(), array(), array(), array('variables')); - $this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument'); - $this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument'); - $this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument'); - $this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument'); - } -} diff --git a/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php b/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php deleted file mode 100644 index 97a34c9..0000000 --- a/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\DependencyInjection; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass; - -class RoutingResolverPassTest extends TestCase -{ - public function testProcess() - { - $container = new ContainerBuilder(); - $container->register('routing.resolver', LoaderResolver::class); - $container->register('loader1')->addTag('routing.loader'); - $container->register('loader2')->addTag('routing.loader'); - - (new RoutingResolverPass())->process($container); - - $this->assertEquals( - array(array('addLoader', array(new Reference('loader1'))), array('addLoader', array(new Reference('loader2')))), - $container->getDefinition('routing.resolver')->getMethodCalls() - ); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php b/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php deleted file mode 100644 index 56bcab2..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; - -abstract class AbstractClass -{ -} diff --git a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php b/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php deleted file mode 100644 index a388277..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; - -class BarClass -{ - public function routeAction($arg1, $arg2 = 'defaultValue2', $arg3 = 'defaultValue3') - { - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php b/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php deleted file mode 100644 index 471968b..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; - -class BazClass -{ - public function __invoke() - { - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php b/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php deleted file mode 100644 index 320dc35..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses; - -class FooClass -{ -} diff --git a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php b/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php deleted file mode 100644 index ee8f4b0..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php +++ /dev/null @@ -1,13 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures; - -use Symfony\Component\Routing\CompiledRoute; - -class CustomCompiledRoute extends CompiledRoute -{ -} diff --git a/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php b/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php deleted file mode 100644 index c2e2afd..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures; - -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCompiler; - -class CustomRouteCompiler extends RouteCompiler -{ - /** - * {@inheritdoc} - */ - public static function compile(Route $route) - { - return new CustomCompiledRoute('', '', array(), array()); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php b/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php deleted file mode 100644 index 9fd5754..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures; - -use Symfony\Component\Routing\Loader\XmlFileLoader; -use Symfony\Component\Config\Util\XmlUtils; - -/** - * XmlFileLoader with schema validation turned off. - */ -class CustomXmlFileLoader extends XmlFileLoader -{ - protected function loadFile($file) - { - return XmlUtils::loadFile($file, function () { return true; }); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php b/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php deleted file mode 100644 index 8900d34..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php +++ /dev/null @@ -1,3 +0,0 @@ -class NoStartTagClass -{ -} diff --git a/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php b/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php deleted file mode 100644 index 729c9b4..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures\OtherAnnotatedClasses; - -class VariadicClass -{ - public function routeAction(...$params) - { - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php b/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php deleted file mode 100644 index 15937bc..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Fixtures; - -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface; - -/** - * @author Fabien Potencier - */ -class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface -{ - public function redirect($path, $route, $scheme = null) - { - return array( - '_controller' => 'Some controller reference...', - 'path' => $path, - 'scheme' => $scheme, - ); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/annotated.php b/vendor/symfony/routing/Tests/Fixtures/annotated.php deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/bad_format.yml b/vendor/symfony/routing/Tests/Fixtures/bad_format.yml deleted file mode 100644 index 8ba50e2..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/bad_format.yml +++ /dev/null @@ -1,3 +0,0 @@ -blog_show: - path: /blog/{slug} - defaults: { _controller: "MyBundle:Blog:show" } diff --git a/vendor/symfony/routing/Tests/Fixtures/bar.xml b/vendor/symfony/routing/Tests/Fixtures/bar.xml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml b/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml deleted file mode 100644 index d078836..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml +++ /dev/null @@ -1,2 +0,0 @@ -route1: - path: /route/1 diff --git a/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml b/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml deleted file mode 100644 index 938fb24..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml +++ /dev/null @@ -1,2 +0,0 @@ -route2: - path: /route/2 diff --git a/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml b/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml deleted file mode 100644 index 088cfb4..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml +++ /dev/null @@ -1,2 +0,0 @@ -route3: - path: /route/3 diff --git a/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml b/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml deleted file mode 100644 index af829e5..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml +++ /dev/null @@ -1,3 +0,0 @@ -_directory: - resource: "../directory" - type: directory diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php deleted file mode 100644 index 51fd29e..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php +++ /dev/null @@ -1,312 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/foo')) { - // foo - if (preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); - } - - // foofoo - if ('/foofoo' === $pathinfo) { - return array ( 'def' => 'test', '_route' => 'foofoo',); - } - - } - - elseif (0 === strpos($pathinfo, '/bar')) { - // bar - if (preg_match('#^/bar/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_bar; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); - } - not_bar: - - // barhead - if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_barhead; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); - } - not_barhead: - - } - - elseif (0 === strpos($pathinfo, '/test')) { - if (0 === strpos($pathinfo, '/test/baz')) { - // baz - if ('/test/baz' === $pathinfo) { - return array('_route' => 'baz'); - } - - // baz2 - if ('/test/baz.html' === $pathinfo) { - return array('_route' => 'baz2'); - } - - // baz3 - if ('/test/baz3/' === $pathinfo) { - return array('_route' => 'baz3'); - } - - } - - // baz4 - if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); - } - - // baz5 - if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_baz5; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); - } - not_baz5: - - // baz.baz6 - if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('PUT' !== $canonicalMethod) { - $allow[] = 'PUT'; - goto not_bazbaz6; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); - } - not_bazbaz6: - - } - - // quoter - if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); - } - - // space - if ('/spa ce' === $pathinfo) { - return array('_route' => 'space'); - } - - if (0 === strpos($pathinfo, '/a')) { - if (0 === strpos($pathinfo, '/a/b\'b')) { - // foo1 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); - } - - // bar1 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); - } - - } - - // overridden - if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); - } - - if (0 === strpos($pathinfo, '/a/b\'b')) { - // foo2 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); - } - - // bar2 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); - } - - } - - } - - elseif (0 === strpos($pathinfo, '/multi')) { - // helloWorld - if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); - } - - // hey - if ('/multi/hey/' === $pathinfo) { - return array('_route' => 'hey'); - } - - // overridden2 - if ('/multi/new' === $pathinfo) { - return array('_route' => 'overridden2'); - } - - } - - // foo3 - if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); - } - - // bar3 - if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); - } - - if (0 === strpos($pathinfo, '/aba')) { - // ababa - if ('/ababa' === $pathinfo) { - return array('_route' => 'ababa'); - } - - // foo4 - if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); - } - - } - - $host = $context->getHost(); - - if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { - // route1 - if ('/route1' === $pathinfo) { - return array('_route' => 'route1'); - } - - // route2 - if ('/c2/route2' === $pathinfo) { - return array('_route' => 'route2'); - } - - } - - if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { - // route3 - if ('/c2/route3' === $pathinfo) { - return array('_route' => 'route3'); - } - - } - - if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { - // route4 - if ('/route4' === $pathinfo) { - return array('_route' => 'route4'); - } - - } - - if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { - // route5 - if ('/route5' === $pathinfo) { - return array('_route' => 'route5'); - } - - } - - // route6 - if ('/route6' === $pathinfo) { - return array('_route' => 'route6'); - } - - if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) { - if (0 === strpos($pathinfo, '/route1')) { - // route11 - if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); - } - - // route12 - if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); - } - - // route13 - if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); - } - - // route14 - if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); - } - - } - - } - - if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { - // route15 - if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); - } - - } - - // route16 - if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); - } - - // route17 - if ('/route17' === $pathinfo) { - return array('_route' => 'route17'); - } - - // a - if ('/a/a...' === $pathinfo) { - return array('_route' => 'a'); - } - - if (0 === strpos($pathinfo, '/a/b')) { - // b - if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); - } - - // c - if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); - } - - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php deleted file mode 100644 index 008f7c3..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php +++ /dev/null @@ -1,344 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/foo')) { - // foo - if (preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); - } - - // foofoo - if ('/foofoo' === $pathinfo) { - return array ( 'def' => 'test', '_route' => 'foofoo',); - } - - } - - elseif (0 === strpos($pathinfo, '/bar')) { - // bar - if (preg_match('#^/bar/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_bar; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); - } - not_bar: - - // barhead - if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_barhead; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); - } - not_barhead: - - } - - elseif (0 === strpos($pathinfo, '/test')) { - if (0 === strpos($pathinfo, '/test/baz')) { - // baz - if ('/test/baz' === $pathinfo) { - return array('_route' => 'baz'); - } - - // baz2 - if ('/test/baz.html' === $pathinfo) { - return array('_route' => 'baz2'); - } - - // baz3 - if ('/test/baz3' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'baz3'); - } - - return array('_route' => 'baz3'); - } - - } - - // baz4 - if (preg_match('#^/test/(?P[^/]++)/?$#s', $pathinfo, $matches)) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'baz4'); - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); - } - - // baz5 - if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_baz5; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); - } - not_baz5: - - // baz.baz6 - if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('PUT' !== $canonicalMethod) { - $allow[] = 'PUT'; - goto not_bazbaz6; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); - } - not_bazbaz6: - - } - - // quoter - if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); - } - - // space - if ('/spa ce' === $pathinfo) { - return array('_route' => 'space'); - } - - if (0 === strpos($pathinfo, '/a')) { - if (0 === strpos($pathinfo, '/a/b\'b')) { - // foo1 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); - } - - // bar1 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); - } - - } - - // overridden - if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); - } - - if (0 === strpos($pathinfo, '/a/b\'b')) { - // foo2 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); - } - - // bar2 - if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); - } - - } - - } - - elseif (0 === strpos($pathinfo, '/multi')) { - // helloWorld - if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); - } - - // hey - if ('/multi/hey' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'hey'); - } - - return array('_route' => 'hey'); - } - - // overridden2 - if ('/multi/new' === $pathinfo) { - return array('_route' => 'overridden2'); - } - - } - - // foo3 - if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); - } - - // bar3 - if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); - } - - if (0 === strpos($pathinfo, '/aba')) { - // ababa - if ('/ababa' === $pathinfo) { - return array('_route' => 'ababa'); - } - - // foo4 - if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); - } - - } - - $host = $context->getHost(); - - if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { - // route1 - if ('/route1' === $pathinfo) { - return array('_route' => 'route1'); - } - - // route2 - if ('/c2/route2' === $pathinfo) { - return array('_route' => 'route2'); - } - - } - - if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { - // route3 - if ('/c2/route3' === $pathinfo) { - return array('_route' => 'route3'); - } - - } - - if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { - // route4 - if ('/route4' === $pathinfo) { - return array('_route' => 'route4'); - } - - } - - if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { - // route5 - if ('/route5' === $pathinfo) { - return array('_route' => 'route5'); - } - - } - - // route6 - if ('/route6' === $pathinfo) { - return array('_route' => 'route6'); - } - - if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) { - if (0 === strpos($pathinfo, '/route1')) { - // route11 - if ('/route11' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); - } - - // route12 - if ('/route12' === $pathinfo) { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); - } - - // route13 - if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); - } - - // route14 - if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); - } - - } - - } - - if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { - // route15 - if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); - } - - } - - // route16 - if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); - } - - // route17 - if ('/route17' === $pathinfo) { - return array('_route' => 'route17'); - } - - // a - if ('/a/a...' === $pathinfo) { - return array('_route' => 'a'); - } - - if (0 === strpos($pathinfo, '/a/b')) { - // b - if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); - } - - // c - if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); - } - - } - - // secure - if ('/secure' === $pathinfo) { - $requiredSchemes = array ( 'https' => 0,); - if (!isset($requiredSchemes[$scheme])) { - return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); - } - - return array('_route' => 'secure'); - } - - // nonsecure - if ('/nonsecure' === $pathinfo) { - $requiredSchemes = array ( 'http' => 0,); - if (!isset($requiredSchemes[$scheme])) { - return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); - } - - return array('_route' => 'nonsecure'); - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php deleted file mode 100644 index c982a45..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php +++ /dev/null @@ -1,53 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/rootprefix')) { - // static - if ('/rootprefix/test' === $pathinfo) { - return array('_route' => 'static'); - } - - // dynamic - if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); - } - - } - - // with-condition - if ('/with-condition' === $pathinfo && ($context->getMethod() == "GET")) { - return array('_route' => 'with-condition'); - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php deleted file mode 100644 index 6aefd69..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php +++ /dev/null @@ -1,104 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - // just_head - if ('/just_head' === $pathinfo) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_just_head; - } - - return array('_route' => 'just_head'); - } - not_just_head: - - // head_and_get - if ('/head_and_get' === $pathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_head_and_get; - } - - return array('_route' => 'head_and_get'); - } - not_head_and_get: - - // get_and_head - if ('/get_and_head' === $pathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_get_and_head; - } - - return array('_route' => 'get_and_head'); - } - not_get_and_head: - - // post_and_head - if ('/post_and_get' === $pathinfo) { - if (!in_array($requestMethod, array('POST', 'HEAD'))) { - $allow = array_merge($allow, array('POST', 'HEAD')); - goto not_post_and_head; - } - - return array('_route' => 'post_and_head'); - } - not_post_and_head: - - if (0 === strpos($pathinfo, '/put_and_post')) { - // put_and_post - if ('/put_and_post' === $pathinfo) { - if (!in_array($requestMethod, array('PUT', 'POST'))) { - $allow = array_merge($allow, array('PUT', 'POST')); - goto not_put_and_post; - } - - return array('_route' => 'put_and_post'); - } - not_put_and_post: - - // put_and_get_and_head - if ('/put_and_post' === $pathinfo) { - if (!in_array($canonicalMethod, array('PUT', 'GET'))) { - $allow = array_merge($allow, array('PUT', 'GET')); - goto not_put_and_get_and_head; - } - - return array('_route' => 'put_and_get_and_head'); - } - not_put_and_get_and_head: - - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php deleted file mode 100644 index 1884df1..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php +++ /dev/null @@ -1,153 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/a')) { - // a_first - if ('/a/11' === $pathinfo) { - return array('_route' => 'a_first'); - } - - // a_second - if ('/a/22' === $pathinfo) { - return array('_route' => 'a_second'); - } - - // a_third - if ('/a/333' === $pathinfo) { - return array('_route' => 'a_third'); - } - - } - - // a_wildcard - if (preg_match('#^/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'a_wildcard')), array ()); - } - - if (0 === strpos($pathinfo, '/a')) { - // a_fourth - if ('/a/44' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_fourth'); - } - - return array('_route' => 'a_fourth'); - } - - // a_fifth - if ('/a/55' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_fifth'); - } - - return array('_route' => 'a_fifth'); - } - - // a_sixth - if ('/a/66' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'a_sixth'); - } - - return array('_route' => 'a_sixth'); - } - - } - - // nested_wildcard - if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'nested_wildcard')), array ()); - } - - if (0 === strpos($pathinfo, '/nested/group')) { - // nested_a - if ('/nested/group/a' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_a'); - } - - return array('_route' => 'nested_a'); - } - - // nested_b - if ('/nested/group/b' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_b'); - } - - return array('_route' => 'nested_b'); - } - - // nested_c - if ('/nested/group/c' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'nested_c'); - } - - return array('_route' => 'nested_c'); - } - - } - - elseif (0 === strpos($pathinfo, '/slashed/group')) { - // slashed_a - if ('/slashed/group' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_a'); - } - - return array('_route' => 'slashed_a'); - } - - // slashed_b - if ('/slashed/group/b' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_b'); - } - - return array('_route' => 'slashed_b'); - } - - // slashed_c - if ('/slashed/group/c' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'slashed_c'); - } - - return array('_route' => 'slashed_c'); - } - - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php deleted file mode 100644 index bb9d80b..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php +++ /dev/null @@ -1,199 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/trailing/simple')) { - // simple_trailing_slash_no_methods - if ('/trailing/simple/no-methods/' === $pathinfo) { - return array('_route' => 'simple_trailing_slash_no_methods'); - } - - // simple_trailing_slash_GET_method - if ('/trailing/simple/get-method/' === $pathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_simple_trailing_slash_GET_method; - } - - return array('_route' => 'simple_trailing_slash_GET_method'); - } - not_simple_trailing_slash_GET_method: - - // simple_trailing_slash_HEAD_method - if ('/trailing/simple/head-method/' === $pathinfo) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_simple_trailing_slash_HEAD_method; - } - - return array('_route' => 'simple_trailing_slash_HEAD_method'); - } - not_simple_trailing_slash_HEAD_method: - - // simple_trailing_slash_POST_method - if ('/trailing/simple/post-method/' === $pathinfo) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_simple_trailing_slash_POST_method; - } - - return array('_route' => 'simple_trailing_slash_POST_method'); - } - not_simple_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/trailing/regex')) { - // regex_trailing_slash_no_methods - if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); - } - - // regex_trailing_slash_GET_method - if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_regex_trailing_slash_GET_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); - } - not_regex_trailing_slash_GET_method: - - // regex_trailing_slash_HEAD_method - if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_regex_trailing_slash_HEAD_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); - } - not_regex_trailing_slash_HEAD_method: - - // regex_trailing_slash_POST_method - if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_regex_trailing_slash_POST_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ()); - } - not_regex_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { - // simple_not_trailing_slash_no_methods - if ('/not-trailing/simple/no-methods' === $pathinfo) { - return array('_route' => 'simple_not_trailing_slash_no_methods'); - } - - // simple_not_trailing_slash_GET_method - if ('/not-trailing/simple/get-method' === $pathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_simple_not_trailing_slash_GET_method; - } - - return array('_route' => 'simple_not_trailing_slash_GET_method'); - } - not_simple_not_trailing_slash_GET_method: - - // simple_not_trailing_slash_HEAD_method - if ('/not-trailing/simple/head-method' === $pathinfo) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_simple_not_trailing_slash_HEAD_method; - } - - return array('_route' => 'simple_not_trailing_slash_HEAD_method'); - } - not_simple_not_trailing_slash_HEAD_method: - - // simple_not_trailing_slash_POST_method - if ('/not-trailing/simple/post-method' === $pathinfo) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_simple_not_trailing_slash_POST_method; - } - - return array('_route' => 'simple_not_trailing_slash_POST_method'); - } - not_simple_not_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { - // regex_not_trailing_slash_no_methods - if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ()); - } - - // regex_not_trailing_slash_GET_method - if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_regex_not_trailing_slash_GET_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ()); - } - not_regex_not_trailing_slash_GET_method: - - // regex_not_trailing_slash_HEAD_method - if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_regex_not_trailing_slash_HEAD_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ()); - } - not_regex_not_trailing_slash_HEAD_method: - - // regex_not_trailing_slash_POST_method - if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_regex_not_trailing_slash_POST_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ()); - } - not_regex_not_trailing_slash_POST_method: - - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php deleted file mode 100644 index 404d462..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php +++ /dev/null @@ -1,223 +0,0 @@ -context = $context; - } - - public function match($pathinfo) - { - $allow = array(); - $pathinfo = rawurldecode($pathinfo); - $trimmedPathinfo = rtrim($pathinfo, '/'); - $context = $this->context; - $request = $this->request; - $requestMethod = $canonicalMethod = $context->getMethod(); - $scheme = $context->getScheme(); - - if ('HEAD' === $requestMethod) { - $canonicalMethod = 'GET'; - } - - - if (0 === strpos($pathinfo, '/trailing/simple')) { - // simple_trailing_slash_no_methods - if ('/trailing/simple/no-methods' === $trimmedPathinfo) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods'); - } - - return array('_route' => 'simple_trailing_slash_no_methods'); - } - - // simple_trailing_slash_GET_method - if ('/trailing/simple/get-method' === $trimmedPathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_simple_trailing_slash_GET_method; - } - - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method'); - } - - return array('_route' => 'simple_trailing_slash_GET_method'); - } - not_simple_trailing_slash_GET_method: - - // simple_trailing_slash_HEAD_method - if ('/trailing/simple/head-method' === $trimmedPathinfo) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_simple_trailing_slash_HEAD_method; - } - - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method'); - } - - return array('_route' => 'simple_trailing_slash_HEAD_method'); - } - not_simple_trailing_slash_HEAD_method: - - // simple_trailing_slash_POST_method - if ('/trailing/simple/post-method/' === $pathinfo) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_simple_trailing_slash_POST_method; - } - - return array('_route' => 'simple_trailing_slash_POST_method'); - } - not_simple_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/trailing/regex')) { - // regex_trailing_slash_no_methods - if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#s', $pathinfo, $matches)) { - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods'); - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ()); - } - - // regex_trailing_slash_GET_method - if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/?$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_regex_trailing_slash_GET_method; - } - - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method'); - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ()); - } - not_regex_trailing_slash_GET_method: - - // regex_trailing_slash_HEAD_method - if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/?$#s', $pathinfo, $matches)) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_regex_trailing_slash_HEAD_method; - } - - if (substr($pathinfo, -1) !== '/') { - return $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method'); - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ()); - } - not_regex_trailing_slash_HEAD_method: - - // regex_trailing_slash_POST_method - if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_regex_trailing_slash_POST_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ()); - } - not_regex_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/simple')) { - // simple_not_trailing_slash_no_methods - if ('/not-trailing/simple/no-methods' === $pathinfo) { - return array('_route' => 'simple_not_trailing_slash_no_methods'); - } - - // simple_not_trailing_slash_GET_method - if ('/not-trailing/simple/get-method' === $pathinfo) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_simple_not_trailing_slash_GET_method; - } - - return array('_route' => 'simple_not_trailing_slash_GET_method'); - } - not_simple_not_trailing_slash_GET_method: - - // simple_not_trailing_slash_HEAD_method - if ('/not-trailing/simple/head-method' === $pathinfo) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_simple_not_trailing_slash_HEAD_method; - } - - return array('_route' => 'simple_not_trailing_slash_HEAD_method'); - } - not_simple_not_trailing_slash_HEAD_method: - - // simple_not_trailing_slash_POST_method - if ('/not-trailing/simple/post-method' === $pathinfo) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_simple_not_trailing_slash_POST_method; - } - - return array('_route' => 'simple_not_trailing_slash_POST_method'); - } - not_simple_not_trailing_slash_POST_method: - - } - - elseif (0 === strpos($pathinfo, '/not-trailing/regex')) { - // regex_not_trailing_slash_no_methods - if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ()); - } - - // regex_not_trailing_slash_GET_method - if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('GET' !== $canonicalMethod) { - $allow[] = 'GET'; - goto not_regex_not_trailing_slash_GET_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ()); - } - not_regex_not_trailing_slash_GET_method: - - // regex_not_trailing_slash_HEAD_method - if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('HEAD' !== $requestMethod) { - $allow[] = 'HEAD'; - goto not_regex_not_trailing_slash_HEAD_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ()); - } - not_regex_not_trailing_slash_HEAD_method: - - // regex_not_trailing_slash_POST_method - if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) { - if ('POST' !== $canonicalMethod) { - $allow[] = 'POST'; - goto not_regex_not_trailing_slash_POST_method; - } - - return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ()); - } - not_regex_not_trailing_slash_POST_method: - - } - - throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); - } -} diff --git a/vendor/symfony/routing/Tests/Fixtures/empty.yml b/vendor/symfony/routing/Tests/Fixtures/empty.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/file_resource.yml b/vendor/symfony/routing/Tests/Fixtures/file_resource.yml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/foo.xml b/vendor/symfony/routing/Tests/Fixtures/foo.xml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/foo1.xml b/vendor/symfony/routing/Tests/Fixtures/foo1.xml deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/symfony/routing/Tests/Fixtures/incomplete.yml b/vendor/symfony/routing/Tests/Fixtures/incomplete.yml deleted file mode 100644 index df64d32..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/incomplete.yml +++ /dev/null @@ -1,2 +0,0 @@ -blog_show: - defaults: { _controller: MyBlogBundle:Blog:show } diff --git a/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml deleted file mode 100644 index f93bf9c..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - true - 1 - 3.5 - foo - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml deleted file mode 100644 index 987086d..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - true - 1 - 3.5 - foo - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml deleted file mode 100644 index 32d393c..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - true - 1 - 3.5 - foo - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml b/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml deleted file mode 100644 index c70e03c..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - - - - - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml deleted file mode 100644 index 47feb29..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - true - 1 - 3.5 - foo - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml deleted file mode 100644 index 6d77065..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - true - 1 - 3.5 - foo - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml deleted file mode 100644 index 2beee61..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - true - 1 - 3.5 - foo - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml b/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml deleted file mode 100644 index 8fd8954..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - - - - - - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/missing_id.xml b/vendor/symfony/routing/Tests/Fixtures/missing_id.xml deleted file mode 100644 index 4ea4115..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/missing_id.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/missing_path.xml b/vendor/symfony/routing/Tests/Fixtures/missing_path.xml deleted file mode 100644 index ef5bc08..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/missing_path.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml b/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml deleted file mode 100644 index e33955a..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - MyBundle:Blog:show - \w+ - en|fr|de - RouteCompiler - - 1 - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml b/vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml deleted file mode 100644 index a3e9473..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml +++ /dev/null @@ -1,3 +0,0 @@ -blog_show: - resource: validpattern.yml - path: /test diff --git a/vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml b/vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml deleted file mode 100644 index 547cda3..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml +++ /dev/null @@ -1,3 +0,0 @@ -blog_show: - path: /blog/{slug} - type: custom diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml b/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml deleted file mode 100644 index dc147d2..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - MyBundle:Blog:show - - diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalid.yml b/vendor/symfony/routing/Tests/Fixtures/nonvalid.yml deleted file mode 100644 index 257cc56..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalid.yml +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml b/vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml deleted file mode 100644 index cfa9992..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml +++ /dev/null @@ -1 +0,0 @@ -route: string diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml b/vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml deleted file mode 100644 index 015e270..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml +++ /dev/null @@ -1,3 +0,0 @@ -someroute: - resource: path/to/some.yml - name_prefix: test_ diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml b/vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml deleted file mode 100644 index 863ef03..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - bar - diff --git a/vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml b/vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml deleted file mode 100644 index 908958c..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - MyBundle:Blog:show - - baz - - diff --git a/vendor/symfony/routing/Tests/Fixtures/null_values.xml b/vendor/symfony/routing/Tests/Fixtures/null_values.xml deleted file mode 100644 index f9e2aa2..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/null_values.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - foo - bar - - diff --git a/vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml b/vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml deleted file mode 100644 index ecfde28..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - AcmeBlogBundle:Blog:index - - - - true - - - 1 - - - 3.5 - - - false - - - 1 - - - 0 - - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/special_route_name.yml b/vendor/symfony/routing/Tests/Fixtures/special_route_name.yml deleted file mode 100644 index 78be239..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/special_route_name.yml +++ /dev/null @@ -1,2 +0,0 @@ -"#$péß^a|": - path: "true" diff --git a/vendor/symfony/routing/Tests/Fixtures/validpattern.php b/vendor/symfony/routing/Tests/Fixtures/validpattern.php deleted file mode 100644 index edc16d8..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validpattern.php +++ /dev/null @@ -1,18 +0,0 @@ -add('blog_show', new Route( - '/blog/{slug}', - array('_controller' => 'MyBlogBundle:Blog:show'), - array('locale' => '\w+'), - array('compiler_class' => 'RouteCompiler'), - '{locale}.example.com', - array('https'), - array('GET', 'POST', 'put', 'OpTiOnS'), - 'context.getMethod() == "GET"' -)); - -return $collection; diff --git a/vendor/symfony/routing/Tests/Fixtures/validpattern.xml b/vendor/symfony/routing/Tests/Fixtures/validpattern.xml deleted file mode 100644 index dbc72e4..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validpattern.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - MyBundle:Blog:show - \w+ - - context.getMethod() == "GET" - - - - diff --git a/vendor/symfony/routing/Tests/Fixtures/validpattern.yml b/vendor/symfony/routing/Tests/Fixtures/validpattern.yml deleted file mode 100644 index 565abaa..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validpattern.yml +++ /dev/null @@ -1,13 +0,0 @@ -blog_show: - path: /blog/{slug} - defaults: { _controller: "MyBundle:Blog:show" } - host: "{locale}.example.com" - requirements: { 'locale': '\w+' } - methods: ['GET','POST','put','OpTiOnS'] - schemes: ['https'] - condition: 'context.getMethod() == "GET"' - options: - compiler_class: RouteCompiler - -blog_show_inherited: - path: /blog/{slug} diff --git a/vendor/symfony/routing/Tests/Fixtures/validresource.php b/vendor/symfony/routing/Tests/Fixtures/validresource.php deleted file mode 100644 index 482c80b..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validresource.php +++ /dev/null @@ -1,18 +0,0 @@ -import('validpattern.php'); -$collection->addDefaults(array( - 'foo' => 123, -)); -$collection->addRequirements(array( - 'foo' => '\d+', -)); -$collection->addOptions(array( - 'foo' => 'bar', -)); -$collection->setCondition('context.getMethod() == "POST"'); -$collection->addPrefix('/prefix'); - -return $collection; diff --git a/vendor/symfony/routing/Tests/Fixtures/validresource.xml b/vendor/symfony/routing/Tests/Fixtures/validresource.xml deleted file mode 100644 index b7a15dd..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validresource.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - 123 - \d+ - - context.getMethod() == "POST" - - diff --git a/vendor/symfony/routing/Tests/Fixtures/validresource.yml b/vendor/symfony/routing/Tests/Fixtures/validresource.yml deleted file mode 100644 index faf2263..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/validresource.yml +++ /dev/null @@ -1,8 +0,0 @@ -_blog: - resource: validpattern.yml - prefix: /{foo} - defaults: { 'foo': '123' } - requirements: { 'foo': '\d+' } - options: { 'foo': 'bar' } - host: "" - condition: 'context.getMethod() == "POST"' diff --git a/vendor/symfony/routing/Tests/Fixtures/with_define_path_variable.php b/vendor/symfony/routing/Tests/Fixtures/with_define_path_variable.php deleted file mode 100644 index 5871420..0000000 --- a/vendor/symfony/routing/Tests/Fixtures/with_define_path_variable.php +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php deleted file mode 100644 index f84802b..0000000 --- a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ /dev/null @@ -1,181 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Generator\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper; -use Symfony\Component\Routing\RequestContext; - -class PhpGeneratorDumperTest extends TestCase -{ - /** - * @var RouteCollection - */ - private $routeCollection; - - /** - * @var PhpGeneratorDumper - */ - private $generatorDumper; - - /** - * @var string - */ - private $testTmpFilepath; - - /** - * @var string - */ - private $largeTestTmpFilepath; - - protected function setUp() - { - parent::setUp(); - - $this->routeCollection = new RouteCollection(); - $this->generatorDumper = new PhpGeneratorDumper($this->routeCollection); - $this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php'; - $this->largeTestTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php'; - @unlink($this->testTmpFilepath); - @unlink($this->largeTestTmpFilepath); - } - - protected function tearDown() - { - parent::tearDown(); - - @unlink($this->testTmpFilepath); - - $this->routeCollection = null; - $this->generatorDumper = null; - $this->testTmpFilepath = null; - } - - public function testDumpWithRoutes() - { - $this->routeCollection->add('Test', new Route('/testing/{foo}')); - $this->routeCollection->add('Test2', new Route('/testing2')); - - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump()); - include $this->testTmpFilepath; - - $projectUrlGenerator = new \ProjectUrlGenerator(new RequestContext('/app.php')); - - $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter); - $this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter); - $this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter); - $this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter); - } - - public function testDumpWithTooManyRoutes() - { - if (defined('HHVM_VERSION_ID')) { - $this->markTestSkipped('HHVM consumes too much memory on this test.'); - } - - $this->routeCollection->add('Test', new Route('/testing/{foo}')); - for ($i = 0; $i < 32769; ++$i) { - $this->routeCollection->add('route_'.$i, new Route('/route_'.$i)); - } - $this->routeCollection->add('Test2', new Route('/testing2')); - - file_put_contents($this->largeTestTmpFilepath, $this->generatorDumper->dump(array( - 'class' => 'ProjectLargeUrlGenerator', - ))); - $this->routeCollection = $this->generatorDumper = null; - include $this->largeTestTmpFilepath; - - $projectUrlGenerator = new \ProjectLargeUrlGenerator(new RequestContext('/app.php')); - - $absoluteUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - $absoluteUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - $relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter); - $this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter); - $this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter); - $this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testDumpWithoutRoutes() - { - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'WithoutRoutesUrlGenerator'))); - include $this->testTmpFilepath; - - $projectUrlGenerator = new \WithoutRoutesUrlGenerator(new RequestContext('/app.php')); - - $projectUrlGenerator->generate('Test', array()); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException - */ - public function testGenerateNonExistingRoute() - { - $this->routeCollection->add('Test', new Route('/test')); - - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'NonExistingRoutesUrlGenerator'))); - include $this->testTmpFilepath; - - $projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext()); - $url = $projectUrlGenerator->generate('NonExisting', array()); - } - - public function testDumpForRouteWithDefaults() - { - $this->routeCollection->add('Test', new Route('/testing/{foo}', array('foo' => 'bar'))); - - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'DefaultRoutesUrlGenerator'))); - include $this->testTmpFilepath; - - $projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext()); - $url = $projectUrlGenerator->generate('Test', array()); - - $this->assertEquals('/testing', $url); - } - - public function testDumpWithSchemeRequirement() - { - $this->routeCollection->add('Test1', new Route('/testing', array(), array(), array(), '', array('ftp', 'https'))); - - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'SchemeUrlGenerator'))); - include $this->testTmpFilepath; - - $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php')); - - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('ftp://localhost/app.php/testing', $absoluteUrl); - $this->assertEquals('ftp://localhost/app.php/testing', $relativeUrl); - - $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https')); - - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('https://localhost/app.php/testing', $absoluteUrl); - $this->assertEquals('/app.php/testing', $relativeUrl); - } -} diff --git a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php deleted file mode 100644 index e334e43..0000000 --- a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php +++ /dev/null @@ -1,692 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Generator; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\Generator\UrlGenerator; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\RequestContext; - -class UrlGeneratorTest extends TestCase -{ - public function testAbsoluteUrlWithPort80() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('http://localhost/app.php/testing', $url); - } - - public function testAbsoluteSecureUrlWithPort443() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('scheme' => 'https'))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('https://localhost/app.php/testing', $url); - } - - public function testAbsoluteUrlWithNonStandardPort() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('httpPort' => 8080))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('http://localhost:8080/app.php/testing', $url); - } - - public function testAbsoluteSecureUrlWithNonStandardPort() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes, array('httpsPort' => 8080, 'scheme' => 'https'))->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('https://localhost:8080/app.php/testing', $url); - } - - public function testRelativeUrlWithoutParameters() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing', $url); - } - - public function testRelativeUrlWithParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing/bar', $url); - } - - public function testRelativeUrlWithNullParameter() - { - $routes = $this->getRoutes('test', new Route('/testing.{format}', array('format' => null))); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing', $url); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testRelativeUrlWithNullParameterButNotOptional() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}/bar', array('foo' => null))); - // This must raise an exception because the default requirement for "foo" is "[^/]+" which is not met with these params. - // Generating path "/testing//bar" would be wrong as matching this route would fail. - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - } - - public function testRelativeUrlWithOptionalZeroParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{page}')); - $url = $this->getGenerator($routes)->generate('test', array('page' => 0), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing/0', $url); - } - - public function testNotPassedOptionalParameterInBetween() - { - $routes = $this->getRoutes('test', new Route('/{slug}/{page}', array('slug' => 'index', 'page' => 0))); - $this->assertSame('/app.php/index/1', $this->getGenerator($routes)->generate('test', array('page' => 1))); - $this->assertSame('/app.php/', $this->getGenerator($routes)->generate('test')); - } - - public function testRelativeUrlWithExtraParameters() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing?foo=bar', $url); - } - - public function testAbsoluteUrlWithExtraParameters() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('http://localhost/app.php/testing?foo=bar', $url); - } - - public function testUrlWithNullExtraParameters() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('foo' => null), UrlGeneratorInterface::ABSOLUTE_URL); - - $this->assertEquals('http://localhost/app.php/testing', $url); - } - - public function testUrlWithExtraParametersFromGlobals() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $generator = $this->getGenerator($routes); - $context = new RequestContext('/app.php'); - $context->setParameter('bar', 'bar'); - $generator->setContext($context); - $url = $generator->generate('test', array('foo' => 'bar')); - - $this->assertEquals('/app.php/testing?foo=bar', $url); - } - - public function testUrlWithGlobalParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}')); - $generator = $this->getGenerator($routes); - $context = new RequestContext('/app.php'); - $context->setParameter('foo', 'bar'); - $generator->setContext($context); - $url = $generator->generate('test', array()); - - $this->assertEquals('/app.php/testing/bar', $url); - } - - public function testGlobalParameterHasHigherPriorityThanDefault() - { - $routes = $this->getRoutes('test', new Route('/{_locale}', array('_locale' => 'en'))); - $generator = $this->getGenerator($routes); - $context = new RequestContext('/app.php'); - $context->setParameter('_locale', 'de'); - $generator->setContext($context); - $url = $generator->generate('test', array()); - - $this->assertSame('/app.php/de', $url); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\RouteNotFoundException - */ - public function testGenerateWithoutRoutes() - { - $routes = $this->getRoutes('foo', new Route('/testing/{foo}')); - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException - */ - public function testGenerateForRouteWithoutMandatoryParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}')); - $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testGenerateForRouteWithInvalidOptionalParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); - $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testGenerateForRouteWithInvalidParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => '1|2'))); - $this->getGenerator($routes)->generate('test', array('foo' => '0'), UrlGeneratorInterface::ABSOLUTE_URL); - } - - public function testGenerateForRouteWithInvalidOptionalParameterNonStrict() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); - $generator = $this->getGenerator($routes); - $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL)); - } - - public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); - $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); - $logger->expects($this->once()) - ->method('error'); - $generator = $this->getGenerator($routes, array(), $logger); - $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL)); - } - - public function testGenerateForRouteWithInvalidParameterButDisabledRequirementsCheck() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); - $generator = $this->getGenerator($routes); - $generator->setStrictRequirements(null); - $this->assertSame('/app.php/testing/bar', $generator->generate('test', array('foo' => 'bar'))); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testGenerateForRouteWithInvalidMandatoryParameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => 'd+'))); - $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testGenerateForRouteWithInvalidUtf8Parameter() - { - $routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => '\pL+'), array('utf8' => true))); - $this->getGenerator($routes)->generate('test', array('foo' => 'abc123'), UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testRequiredParamAndEmptyPassed() - { - $routes = $this->getRoutes('test', new Route('/{slug}', array(), array('slug' => '.+'))); - $this->getGenerator($routes)->generate('test', array('slug' => '')); - } - - public function testSchemeRequirementDoesNothingIfSameCurrentScheme() - { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); - $this->assertEquals('/app.php/', $this->getGenerator($routes)->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); - $this->assertEquals('/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); - } - - public function testSchemeRequirementForcesAbsoluteUrl() - { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); - $this->assertEquals('https://localhost/app.php/', $this->getGenerator($routes)->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); - $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); - } - - public function testSchemeRequirementCreatesUrlForFirstRequiredScheme() - { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('Ftp', 'https'))); - $this->assertEquals('ftp://localhost/app.php/', $this->getGenerator($routes)->generate('test')); - } - - public function testPathWithTwoStartingSlashes() - { - $routes = $this->getRoutes('test', new Route('//path-and-not-domain')); - - // this must not generate '//path-and-not-domain' because that would be a network path - $this->assertSame('/path-and-not-domain', $this->getGenerator($routes, array('BaseUrl' => ''))->generate('test')); - } - - public function testNoTrailingSlashForMultipleOptionalParameters() - { - $routes = $this->getRoutes('test', new Route('/category/{slug1}/{slug2}/{slug3}', array('slug2' => null, 'slug3' => null))); - - $this->assertEquals('/app.php/category/foo', $this->getGenerator($routes)->generate('test', array('slug1' => 'foo'))); - } - - public function testWithAnIntegerAsADefaultValue() - { - $routes = $this->getRoutes('test', new Route('/{default}', array('default' => 0))); - - $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); - } - - public function testNullForOptionalParameterIsIgnored() - { - $routes = $this->getRoutes('test', new Route('/test/{default}', array('default' => 0))); - - $this->assertEquals('/app.php/test', $this->getGenerator($routes)->generate('test', array('default' => null))); - } - - public function testQueryParamSameAsDefault() - { - $routes = $this->getRoutes('test', new Route('/test', array('page' => 1))); - - $this->assertSame('/app.php/test?page=2', $this->getGenerator($routes)->generate('test', array('page' => 2))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('page' => 1))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('page' => '1'))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test')); - } - - public function testArrayQueryParamSameAsDefault() - { - $routes = $this->getRoutes('test', new Route('/test', array('array' => array('foo', 'bar')))); - - $this->assertSame('/app.php/test?array%5B0%5D=bar&array%5B1%5D=foo', $this->getGenerator($routes)->generate('test', array('array' => array('bar', 'foo')))); - $this->assertSame('/app.php/test?array%5Ba%5D=foo&array%5Bb%5D=bar', $this->getGenerator($routes)->generate('test', array('array' => array('a' => 'foo', 'b' => 'bar')))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('array' => array('foo', 'bar')))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test', array('array' => array(1 => 'bar', 0 => 'foo')))); - $this->assertSame('/app.php/test', $this->getGenerator($routes)->generate('test')); - } - - public function testGenerateWithSpecialRouteName() - { - $routes = $this->getRoutes('$péß^a|', new Route('/bar')); - - $this->assertSame('/app.php/bar', $this->getGenerator($routes)->generate('$péß^a|')); - } - - public function testUrlEncoding() - { - $expectedPath = '/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' - .'/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' - .'?query=%40%3A%5B%5D/%28%29%2A%27%22%20%2B%2C%3B-._~%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id'; - - // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986) - // and other special ASCII chars. These chars are tested as static text path, variable path and query param. - $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id'; - $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+'))); - $this->assertSame($expectedPath, $this->getGenerator($routes)->generate('test', array( - 'varpath' => $chars, - 'query' => $chars, - ))); - } - - public function testEncodingOfRelativePathSegments() - { - $routes = $this->getRoutes('test', new Route('/dir/../dir/..')); - $this->assertSame('/app.php/dir/%2E%2E/dir/%2E%2E', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/dir/./dir/.')); - $this->assertSame('/app.php/dir/%2E/dir/%2E', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/a./.a/a../..a/...')); - $this->assertSame('/app.php/a./.a/a../..a/...', $this->getGenerator($routes)->generate('test')); - } - - public function testAdjacentVariables() - { - $routes = $this->getRoutes('test', new Route('/{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '\d+'))); - $generator = $this->getGenerator($routes); - $this->assertSame('/app.php/foo123', $generator->generate('test', array('x' => 'foo', 'y' => '123'))); - $this->assertSame('/app.php/foo123bar.xml', $generator->generate('test', array('x' => 'foo', 'y' => '123', 'z' => 'bar', '_format' => 'xml'))); - - // The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything - // and following optional variables like _format could never match. - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException'); - $generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml')); - } - - public function testOptionalVariableWithNoRealSeparator() - { - $routes = $this->getRoutes('test', new Route('/get{what}', array('what' => 'All'))); - $generator = $this->getGenerator($routes); - - $this->assertSame('/app.php/get', $generator->generate('test')); - $this->assertSame('/app.php/getSites', $generator->generate('test', array('what' => 'Sites'))); - } - - public function testRequiredVariableWithNoRealSeparator() - { - $routes = $this->getRoutes('test', new Route('/get{what}Suffix')); - $generator = $this->getGenerator($routes); - - $this->assertSame('/app.php/getSitesSuffix', $generator->generate('test', array('what' => 'Sites'))); - } - - public function testDefaultRequirementOfVariable() - { - $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); - $generator = $this->getGenerator($routes); - - $this->assertSame('/app.php/index.mobile.html', $generator->generate('test', array('page' => 'index', '_format' => 'mobile.html'))); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testDefaultRequirementOfVariableDisallowsSlash() - { - $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); - $this->getGenerator($routes)->generate('test', array('page' => 'index', '_format' => 'sl/ash')); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testDefaultRequirementOfVariableDisallowsNextSeparator() - { - $routes = $this->getRoutes('test', new Route('/{page}.{_format}')); - $this->getGenerator($routes)->generate('test', array('page' => 'do.t', '_format' => 'html')); - } - - public function testWithHostDifferentFromContext() - { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); - - $this->assertEquals('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', array('name' => 'Fabien', 'locale' => 'fr'))); - } - - public function testWithHostSameAsContext() - { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); - - $this->assertEquals('/app.php/Fabien', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', array('name' => 'Fabien', 'locale' => 'fr'))); - } - - public function testWithHostSameAsContextAndAbsolute() - { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com')); - - $this->assertEquals('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::ABSOLUTE_URL)); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testUrlWithInvalidParameterInHost() - { - $routes = $this->getRoutes('test', new Route('/', array(), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testUrlWithInvalidParameterInHostWhenParamHasADefaultValue() - { - $routes = $this->getRoutes('test', new Route('/', array('foo' => 'bar'), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException - */ - public function testUrlWithInvalidParameterEqualsDefaultValueInHost() - { - $routes = $this->getRoutes('test', new Route('/', array('foo' => 'baz'), array('foo' => 'bar'), array(), '{foo}.example.com')); - $this->getGenerator($routes)->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH); - } - - public function testUrlWithInvalidParameterInHostInNonStrictMode() - { - $routes = $this->getRoutes('test', new Route('/', array(), array('foo' => 'bar'), array(), '{foo}.example.com')); - $generator = $this->getGenerator($routes); - $generator->setStrictRequirements(false); - $this->assertNull($generator->generate('test', array('foo' => 'baz'), UrlGeneratorInterface::ABSOLUTE_PATH)); - } - - public function testHostIsCaseInsensitive() - { - $routes = $this->getRoutes('test', new Route('/', array(), array('locale' => 'en|de|fr'), array(), '{locale}.FooBar.com')); - $generator = $this->getGenerator($routes); - $this->assertSame('//EN.FooBar.com/app.php/', $generator->generate('test', array('locale' => 'EN'), UrlGeneratorInterface::NETWORK_PATH)); - } - - public function testGenerateNetworkPath() - { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com', array('http'))); - - $this->assertSame('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' - ); - $this->assertSame('//fr.example.com/app.php/Fabien?query=string', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', - array('name' => 'Fabien', 'locale' => 'fr', 'query' => 'string'), UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context' - ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context' - ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' => 'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested' - ); - } - - public function testGenerateRelativePath() - { - $routes = new RouteCollection(); - $routes->add('article', new Route('/{author}/{article}/')); - $routes->add('comments', new Route('/{author}/{article}/comments')); - $routes->add('host', new Route('/{article}', array(), array(), array(), '{author}.example.com')); - $routes->add('scheme', new Route('/{author}/blog', array(), array(), array(), '', array('https'))); - $routes->add('unrelated', new Route('/about')); - - $generator = $this->getGenerator($routes, array('host' => 'example.com', 'pathInfo' => '/fabien/symfony-is-great/')); - - $this->assertSame('comments', $generator->generate('comments', - array('author' => 'fabien', 'article' => 'symfony-is-great'), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('comments?page=2', $generator->generate('comments', - array('author' => 'fabien', 'article' => 'symfony-is-great', 'page' => 2), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('../twig-is-great/', $generator->generate('article', - array('author' => 'fabien', 'article' => 'twig-is-great'), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('../../bernhard/forms-are-great/', $generator->generate('article', - array('author' => 'bernhard', 'article' => 'forms-are-great'), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('//bernhard.example.com/app.php/forms-are-great', $generator->generate('host', - array('author' => 'bernhard', 'article' => 'forms-are-great'), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('https://example.com/app.php/bernhard/blog', $generator->generate('scheme', - array('author' => 'bernhard'), UrlGeneratorInterface::RELATIVE_PATH) - ); - $this->assertSame('../../about', $generator->generate('unrelated', - array(), UrlGeneratorInterface::RELATIVE_PATH) - ); - } - - /** - * @dataProvider provideRelativePaths - */ - public function testGetRelativePath($sourcePath, $targetPath, $expectedPath) - { - $this->assertSame($expectedPath, UrlGenerator::getRelativePath($sourcePath, $targetPath)); - } - - public function provideRelativePaths() - { - return array( - array( - '/same/dir/', - '/same/dir/', - '', - ), - array( - '/same/file', - '/same/file', - '', - ), - array( - '/', - '/file', - 'file', - ), - array( - '/', - '/dir/file', - 'dir/file', - ), - array( - '/dir/file.html', - '/dir/different-file.html', - 'different-file.html', - ), - array( - '/same/dir/extra-file', - '/same/dir/', - './', - ), - array( - '/parent/dir/', - '/parent/', - '../', - ), - array( - '/parent/dir/extra-file', - '/parent/', - '../', - ), - array( - '/a/b/', - '/x/y/z/', - '../../x/y/z/', - ), - array( - '/a/b/c/d/e', - '/a/c/d', - '../../../c/d', - ), - array( - '/a/b/c//', - '/a/b/c/', - '../', - ), - array( - '/a/b/c/', - '/a/b/c//', - './/', - ), - array( - '/root/a/b/c/', - '/root/x/b/c/', - '../../../x/b/c/', - ), - array( - '/a/b/c/d/', - '/a', - '../../../../a', - ), - array( - '/special-chars/sp%20ce/1€/mäh/e=mc²', - '/special-chars/sp%20ce/1€/<µ>/e=mc²', - '../<µ>/e=mc²', - ), - array( - 'not-rooted', - 'dir/file', - 'dir/file', - ), - array( - '//dir/', - '', - '../../', - ), - array( - '/dir/', - '/dir/file:with-colon', - './file:with-colon', - ), - array( - '/dir/', - '/dir/subdir/file:with-colon', - 'subdir/file:with-colon', - ), - array( - '/dir/', - '/dir/:subdir/', - './:subdir/', - ), - ); - } - - public function testFragmentsCanBeAppendedToUrls() - { - $routes = $this->getRoutes('test', new Route('/testing')); - - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => 'frag ment'), UrlGeneratorInterface::ABSOLUTE_PATH); - $this->assertEquals('/app.php/testing#frag%20ment', $url); - - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => '0'), UrlGeneratorInterface::ABSOLUTE_PATH); - $this->assertEquals('/app.php/testing#0', $url); - } - - public function testFragmentsDoNotEscapeValidCharacters() - { - $routes = $this->getRoutes('test', new Route('/testing')); - $url = $this->getGenerator($routes)->generate('test', array('_fragment' => '?/'), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing#?/', $url); - } - - public function testFragmentsCanBeDefinedAsDefaults() - { - $routes = $this->getRoutes('test', new Route('/testing', array('_fragment' => 'fragment'))); - $url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH); - - $this->assertEquals('/app.php/testing#fragment', $url); - } - - protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) - { - $context = new RequestContext('/app.php'); - foreach ($parameters as $key => $value) { - $method = 'set'.$key; - $context->$method($value); - } - - return new UrlGenerator($routes, $context, $logger); - } - - protected function getRoutes($name, Route $route) - { - $routes = new RouteCollection(); - $routes->add($name, $route); - - return $routes; - } -} diff --git a/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php deleted file mode 100644 index e8bbe8f..0000000 --- a/vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; - -abstract class AbstractAnnotationLoaderTest extends TestCase -{ - public function getReader() - { - return $this->getMockBuilder('Doctrine\Common\Annotations\Reader') - ->disableOriginalConstructor() - ->getMock() - ; - } - - public function getClassLoader($reader) - { - return $this->getMockBuilder('Symfony\Component\Routing\Loader\AnnotationClassLoader') - ->setConstructorArgs(array($reader)) - ->getMockForAbstractClass() - ; - } -} diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php deleted file mode 100644 index bf2ab4a..0000000 --- a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php +++ /dev/null @@ -1,254 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use Symfony\Component\Routing\Annotation\Route; - -class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest -{ - protected $loader; - private $reader; - - protected function setUp() - { - parent::setUp(); - - $this->reader = $this->getReader(); - $this->loader = $this->getClassLoader($this->reader); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLoadMissingClass() - { - $this->loader->load('MissingClass'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testLoadAbstractClass() - { - $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\AbstractClass'); - } - - /** - * @dataProvider provideTestSupportsChecksResource - */ - public function testSupportsChecksResource($resource, $expectedSupports) - { - $this->assertSame($expectedSupports, $this->loader->supports($resource), '->supports() returns true if the resource is loadable'); - } - - public function provideTestSupportsChecksResource() - { - return array( - array('class', true), - array('\fully\qualified\class\name', true), - array('namespaced\class\without\leading\slash', true), - array('ÿClassWithLegalSpecialCharacters', true), - array('5', false), - array('foo.foo', false), - array(null, false), - ); - } - - public function testSupportsChecksTypeIfSpecified() - { - $this->assertTrue($this->loader->supports('class', 'annotation'), '->supports() checks the resource type if specified'); - $this->assertFalse($this->loader->supports('class', 'foo'), '->supports() checks the resource type if specified'); - } - - public function getLoadTests() - { - return array( - array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('name' => 'route1', 'path' => '/path'), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('defaults' => array('arg2' => 'foo'), 'requirements' => array('arg3' => '\w+')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('options' => array('foo' => 'bar')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('schemes' => array('https'), 'methods' => array('GET')), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - array('condition' => 'context.getMethod() == "GET"'), - array('arg2' => 'defaultValue2', 'arg3' => 'defaultValue3'), - ), - ); - } - - /** - * @dataProvider getLoadTests - */ - public function testLoad($className, $routeData = array(), $methodArgs = array()) - { - $routeData = array_replace(array( - 'name' => 'route', - 'path' => '/', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'condition' => '', - ), $routeData); - - $this->reader - ->expects($this->once()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($routeData)))) - ; - - $routeCollection = $this->loader->load($className); - $route = $routeCollection->get($routeData['name']); - - $this->assertSame($routeData['path'], $route->getPath(), '->load preserves path annotation'); - $this->assertCount( - count($routeData['requirements']), - array_intersect_assoc($routeData['requirements'], $route->getRequirements()), - '->load preserves requirements annotation' - ); - $this->assertCount( - count($routeData['options']), - array_intersect_assoc($routeData['options'], $route->getOptions()), - '->load preserves options annotation' - ); - $this->assertCount( - count($routeData['defaults']), - $route->getDefaults(), - '->load preserves defaults annotation' - ); - $this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation'); - $this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation'); - $this->assertSame($routeData['condition'], $route->getCondition(), '->load preserves condition annotation'); - } - - public function testClassRouteLoad() - { - $classRouteData = array( - 'path' => '/prefix', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); - - $methodRouteData = array( - 'name' => 'route1', - 'path' => '/path', - 'schemes' => array('http'), - 'methods' => array('POST', 'PUT'), - ); - - $this->reader - ->expects($this->once()) - ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) - ; - $this->reader - ->expects($this->once()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData)))) - ; - - $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass'); - $route = $routeCollection->get($methodRouteData['name']); - - $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path'); - $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes'); - $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods'); - } - - public function testInvokableClassRouteLoad() - { - $classRouteData = array( - 'name' => 'route1', - 'path' => '/', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); - - $this->reader - ->expects($this->exactly(2)) - ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) - ; - $this->reader - ->expects($this->once()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array())) - ; - - $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); - $route = $routeCollection->get($classRouteData['name']); - - $this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path'); - $this->assertEquals(array_merge($classRouteData['schemes'], $classRouteData['schemes']), $route->getSchemes(), '->load preserves class route schemes'); - $this->assertEquals(array_merge($classRouteData['methods'], $classRouteData['methods']), $route->getMethods(), '->load preserves class route methods'); - } - - public function testInvokableClassWithMethodRouteLoad() - { - $classRouteData = array( - 'name' => 'route1', - 'path' => '/prefix', - 'schemes' => array('https'), - 'methods' => array('GET'), - ); - - $methodRouteData = array( - 'name' => 'route2', - 'path' => '/path', - 'schemes' => array('http'), - 'methods' => array('POST', 'PUT'), - ); - - $this->reader - ->expects($this->once()) - ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) - ; - $this->reader - ->expects($this->once()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array($this->getAnnotatedRoute($methodRouteData)))) - ; - - $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); - $route = $routeCollection->get($classRouteData['name']); - - $this->assertNull($route, '->load ignores class route'); - - $route = $routeCollection->get($methodRouteData['name']); - - $this->assertSame($classRouteData['path'].$methodRouteData['path'], $route->getPath(), '->load concatenates class and method route path'); - $this->assertEquals(array_merge($classRouteData['schemes'], $methodRouteData['schemes']), $route->getSchemes(), '->load merges class and method route schemes'); - $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods'); - } - - private function getAnnotatedRoute($data) - { - return new Route($data); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php deleted file mode 100644 index 78cec4b..0000000 --- a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; -use Symfony\Component\Config\FileLocator; - -class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest -{ - protected $loader; - protected $reader; - - protected function setUp() - { - parent::setUp(); - - $this->reader = $this->getReader(); - $this->loader = new AnnotationDirectoryLoader(new FileLocator(), $this->getClassLoader($this->reader)); - } - - public function testLoad() - { - $this->reader->expects($this->exactly(4))->method('getClassAnnotation'); - - $this->reader - ->expects($this->any()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array())) - ; - - $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); - } - - public function testLoadIgnoresHiddenDirectories() - { - $this->expectAnnotationsToBeReadFrom(array( - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass', - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass', - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass', - 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\FooClass', - )); - - $this->reader - ->expects($this->any()) - ->method('getMethodAnnotations') - ->will($this->returnValue(array())) - ; - - $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); - } - - public function testSupports() - { - $fixturesDir = __DIR__.'/../Fixtures'; - - $this->assertTrue($this->loader->supports($fixturesDir), '->supports() returns true if the resource is loadable'); - $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($this->loader->supports($fixturesDir, 'annotation'), '->supports() checks the resource type if specified'); - $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports() checks the resource type if specified'); - } - - private function expectAnnotationsToBeReadFrom(array $classes) - { - $this->reader->expects($this->exactly(count($classes))) - ->method('getClassAnnotation') - ->with($this->callback(function (\ReflectionClass $class) use ($classes) { - return in_array($class->getName(), $classes); - })); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php deleted file mode 100644 index 5d54f9f..0000000 --- a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use Symfony\Component\Routing\Loader\AnnotationFileLoader; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\Annotation\Route; - -class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest -{ - protected $loader; - protected $reader; - - protected function setUp() - { - parent::setUp(); - - $this->reader = $this->getReader(); - $this->loader = new AnnotationFileLoader(new FileLocator(), $this->getClassLoader($this->reader)); - } - - public function testLoad() - { - $this->reader->expects($this->once())->method('getClassAnnotation'); - - $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); - } - - /** - * @requires PHP 5.4 - */ - public function testLoadTraitWithClassConstant() - { - $this->reader->expects($this->never())->method('getClassAnnotation'); - - $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooTrait.php'); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Did you forgot to add the "loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/NoStartTagClass.php'); - } - - /** - * @requires PHP 5.6 - */ - public function testLoadVariadic() - { - $route = new Route(array('path' => '/path/to/{id}')); - $this->reader->expects($this->once())->method('getClassAnnotation'); - $this->reader->expects($this->once())->method('getMethodAnnotations') - ->will($this->returnValue(array($route))); - - $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); - } - - public function testSupports() - { - $fixture = __DIR__.'/../Fixtures/annotated.php'; - - $this->assertTrue($this->loader->supports($fixture), '->supports() returns true if the resource is loadable'); - $this->assertFalse($this->loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($this->loader->supports($fixture, 'annotation'), '->supports() checks the resource type if specified'); - $this->assertFalse($this->loader->supports($fixture, 'foo'), '->supports() checks the resource type if specified'); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php b/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php deleted file mode 100644 index 5d963f8..0000000 --- a/vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Loader\ClosureLoader; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -class ClosureLoaderTest extends TestCase -{ - public function testSupports() - { - $loader = new ClosureLoader(); - - $closure = function () {}; - - $this->assertTrue($loader->supports($closure), '->supports() returns true if the resource is loadable'); - $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($loader->supports($closure, 'closure'), '->supports() checks the resource type if specified'); - $this->assertFalse($loader->supports($closure, 'foo'), '->supports() checks the resource type if specified'); - } - - public function testLoad() - { - $loader = new ClosureLoader(); - - $route = new Route('/'); - $routes = $loader->load(function () use ($route) { - $routes = new RouteCollection(); - - $routes->add('foo', $route); - - return $routes; - }); - - $this->assertEquals($route, $routes->get('foo'), '->load() loads a \Closure resource'); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php deleted file mode 100644 index fc29d37..0000000 --- a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use Symfony\Component\Routing\Loader\DirectoryLoader; -use Symfony\Component\Routing\Loader\YamlFileLoader; -use Symfony\Component\Routing\Loader\AnnotationFileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\RouteCollection; - -class DirectoryLoaderTest extends AbstractAnnotationLoaderTest -{ - private $loader; - private $reader; - - protected function setUp() - { - parent::setUp(); - - $locator = new FileLocator(); - $this->reader = $this->getReader(); - $this->loader = new DirectoryLoader($locator); - $resolver = new LoaderResolver(array( - new YamlFileLoader($locator), - new AnnotationFileLoader($locator, $this->getClassLoader($this->reader)), - $this->loader, - )); - $this->loader->setResolver($resolver); - } - - public function testLoadDirectory() - { - $collection = $this->loader->load(__DIR__.'/../Fixtures/directory', 'directory'); - $this->verifyCollection($collection); - } - - public function testImportDirectory() - { - $collection = $this->loader->load(__DIR__.'/../Fixtures/directory_import', 'directory'); - $this->verifyCollection($collection); - } - - private function verifyCollection(RouteCollection $collection) - { - $routes = $collection->all(); - - $this->assertCount(3, $routes, 'Three routes are loaded'); - $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); - - for ($i = 1; $i <= 3; ++$i) { - $this->assertSame('/route/'.$i, $routes['route'.$i]->getPath()); - } - } - - public function testSupports() - { - $fixturesDir = __DIR__.'/../Fixtures'; - - $this->assertFalse($this->loader->supports($fixturesDir), '->supports(*) returns false'); - - $this->assertTrue($this->loader->supports($fixturesDir, 'directory'), '->supports(*, "directory") returns true'); - $this->assertFalse($this->loader->supports($fixturesDir, 'foo'), '->supports(*, "foo") returns false'); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php b/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php deleted file mode 100644 index 408fa0b..0000000 --- a/vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Loader\ObjectRouteLoader; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -class ObjectRouteLoaderTest extends TestCase -{ - public function testLoadCallsServiceAndReturnsCollection() - { - $loader = new ObjectRouteLoaderForTest(); - - // create a basic collection that will be returned - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $loader->loaderMap = array( - 'my_route_provider_service' => new RouteService($collection), - ); - - $actualRoutes = $loader->load( - 'my_route_provider_service:loadRoutes', - 'service' - ); - - $this->assertSame($collection, $actualRoutes); - // the service file should be listed as a resource - $this->assertNotEmpty($actualRoutes->getResources()); - } - - /** - * @expectedException \InvalidArgumentException - * @dataProvider getBadResourceStrings - */ - public function testExceptionWithoutSyntax($resourceString) - { - $loader = new ObjectRouteLoaderForTest(); - $loader->load($resourceString); - } - - public function getBadResourceStrings() - { - return array( - array('Foo'), - array('Bar::baz'), - array('Foo:Bar:baz'), - ); - } - - /** - * @expectedException \LogicException - */ - public function testExceptionOnNoObjectReturned() - { - $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => 'NOT_AN_OBJECT'); - $loader->load('my_service:method'); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testExceptionOnBadMethod() - { - $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => new \stdClass()); - $loader->load('my_service:method'); - } - - /** - * @expectedException \LogicException - */ - public function testExceptionOnMethodNotReturningCollection() - { - $service = $this->getMockBuilder('stdClass') - ->setMethods(array('loadRoutes')) - ->getMock(); - $service->expects($this->once()) - ->method('loadRoutes') - ->will($this->returnValue('NOT_A_COLLECTION')); - - $loader = new ObjectRouteLoaderForTest(); - $loader->loaderMap = array('my_service' => $service); - $loader->load('my_service:loadRoutes'); - } -} - -class ObjectRouteLoaderForTest extends ObjectRouteLoader -{ - public $loaderMap = array(); - - protected function getServiceObject($id) - { - return isset($this->loaderMap[$id]) ? $this->loaderMap[$id] : null; - } -} - -class RouteService -{ - private $collection; - - public function __construct($collection) - { - $this->collection = $collection; - } - - public function loadRoutes() - { - return $this->collection; - } -} diff --git a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php deleted file mode 100644 index bda6423..0000000 --- a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\Loader\PhpFileLoader; - -class PhpFileLoaderTest extends TestCase -{ - public function testSupports() - { - $loader = new PhpFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock()); - - $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable'); - $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($loader->supports('foo.php', 'php'), '->supports() checks the resource type if specified'); - $this->assertFalse($loader->supports('foo.php', 'foo'), '->supports() checks the resource type if specified'); - } - - public function testLoadWithRoute() - { - $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validpattern.php'); - $routes = $routeCollection->all(); - - $this->assertCount(1, $routes, 'One route is loaded'); - $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); - - foreach ($routes as $route) { - $this->assertSame('/blog/{slug}', $route->getPath()); - $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller')); - $this->assertSame('{locale}.example.com', $route->getHost()); - $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); - } - } - - public function testLoadWithImport() - { - $loader = new PhpFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validresource.php'); - $routes = $routeCollection->all(); - - $this->assertCount(1, $routes, 'One route is loaded'); - $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); - - foreach ($routes as $route) { - $this->assertSame('/prefix/blog/{slug}', $route->getPath()); - $this->assertSame('MyBlogBundle:Blog:show', $route->getDefault('_controller')); - $this->assertSame('{locale}.example.com', $route->getHost()); - $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); - } - } - - public function testThatDefiningVariableInConfigFileHasNoSideEffects() - { - $locator = new FileLocator(array(__DIR__.'/../Fixtures')); - $loader = new PhpFileLoader($locator); - $routeCollection = $loader->load('with_define_path_variable.php'); - $resources = $routeCollection->getResources(); - $this->assertCount(1, $resources); - $this->assertContainsOnly('Symfony\Component\Config\Resource\ResourceInterface', $resources); - $fileResource = reset($resources); - $this->assertSame( - realpath($locator->locate('with_define_path_variable.php')), - (string) $fileResource - ); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php deleted file mode 100644 index d24ec79..0000000 --- a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php +++ /dev/null @@ -1,290 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\Loader\XmlFileLoader; -use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader; - -class XmlFileLoaderTest extends TestCase -{ - public function testSupports() - { - $loader = new XmlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock()); - - $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); - $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($loader->supports('foo.xml', 'xml'), '->supports() checks the resource type if specified'); - $this->assertFalse($loader->supports('foo.xml', 'foo'), '->supports() checks the resource type if specified'); - } - - public function testLoadWithRoute() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validpattern.xml'); - $route = $routeCollection->get('blog_show'); - - $this->assertInstanceOf('Symfony\Component\Routing\Route', $route); - $this->assertSame('/blog/{slug}', $route->getPath()); - $this->assertSame('{locale}.example.com', $route->getHost()); - $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller')); - $this->assertSame('\w+', $route->getRequirement('locale')); - $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); - $this->assertEquals('context.getMethod() == "GET"', $route->getCondition()); - } - - public function testLoadWithNamespacePrefix() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('namespaceprefix.xml'); - - $this->assertCount(1, $routeCollection->all(), 'One route is loaded'); - - $route = $routeCollection->get('blog_show'); - $this->assertSame('/blog/{slug}', $route->getPath()); - $this->assertSame('{_locale}.example.com', $route->getHost()); - $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller')); - $this->assertSame('\w+', $route->getRequirement('slug')); - $this->assertSame('en|fr|de', $route->getRequirement('_locale')); - $this->assertNull($route->getDefault('slug')); - $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertSame(1, $route->getDefault('page')); - } - - public function testLoadWithImport() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validresource.xml'); - $routes = $routeCollection->all(); - - $this->assertCount(2, $routes, 'Two routes are loaded'); - $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); - - foreach ($routes as $route) { - $this->assertSame('/{foo}/blog/{slug}', $route->getPath()); - $this->assertSame('123', $route->getDefault('foo')); - $this->assertSame('\d+', $route->getRequirement('foo')); - $this->assertSame('bar', $route->getOption('foo')); - $this->assertSame('', $route->getHost()); - $this->assertSame('context.getMethod() == "POST"', $route->getCondition()); - } - } - - /** - * @expectedException \InvalidArgumentException - * @dataProvider getPathsToInvalidFiles - */ - public function testLoadThrowsExceptionWithInvalidFile($filePath) - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load($filePath); - } - - /** - * @expectedException \InvalidArgumentException - * @dataProvider getPathsToInvalidFiles - */ - public function testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation($filePath) - { - $loader = new CustomXmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load($filePath); - } - - public function getPathsToInvalidFiles() - { - return array(array('nonvalidnode.xml'), array('nonvalidroute.xml'), array('nonvalid.xml'), array('missing_id.xml'), array('missing_path.xml')); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Document types are not allowed. - */ - public function testDocTypeIsNotAllowed() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load('withdoctype.xml'); - } - - public function testNullValues() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('null_values.xml'); - $route = $routeCollection->get('blog_show'); - - $this->assertTrue($route->hasDefault('foo')); - $this->assertNull($route->getDefault('foo')); - $this->assertTrue($route->hasDefault('bar')); - $this->assertNull($route->getDefault('bar')); - $this->assertEquals('foo', $route->getDefault('foobar')); - $this->assertEquals('bar', $route->getDefault('baz')); - } - - public function testScalarDataTypeDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('scalar_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'slug' => null, - 'published' => true, - 'page' => 1, - 'price' => 3.5, - 'archived' => false, - 'free' => true, - 'locked' => false, - 'foo' => null, - 'bar' => null, - ), - $route->getDefaults() - ); - } - - public function testListDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('list_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(true, 1, 3.5, 'foo'), - ), - $route->getDefaults() - ); - } - - public function testListInListDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('list_in_list_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(array(true, 1, 3.5, 'foo')), - ), - $route->getDefaults() - ); - } - - public function testListInMapDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('list_in_map_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array('list' => array(true, 1, 3.5, 'foo')), - ), - $route->getDefaults() - ); - } - - public function testMapDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('map_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array( - 'public' => true, - 'page' => 1, - 'price' => 3.5, - 'title' => 'foo', - ), - ), - $route->getDefaults() - ); - } - - public function testMapInListDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('map_in_list_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array(array( - 'public' => true, - 'page' => 1, - 'price' => 3.5, - 'title' => 'foo', - )), - ), - $route->getDefaults() - ); - } - - public function testMapInMapDefaults() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('map_in_map_defaults.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - '_controller' => 'AcmeBlogBundle:Blog:index', - 'values' => array('map' => array( - 'public' => true, - 'page' => 1, - 'price' => 3.5, - 'title' => 'foo', - )), - ), - $route->getDefaults() - ); - } - - public function testNullValuesInList() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('list_null_values.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame(array(null, null, null, null, null, null), $route->getDefault('list')); - } - - public function testNullValuesInMap() - { - $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('map_null_values.xml'); - $route = $routeCollection->get('blog'); - - $this->assertSame( - array( - 'boolean' => null, - 'integer' => null, - 'float' => null, - 'string' => null, - 'list' => null, - 'map' => null, - ), - $route->getDefault('map') - ); - } -} diff --git a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php deleted file mode 100644 index 8342c26..0000000 --- a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Loader; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\Loader\YamlFileLoader; -use Symfony\Component\Config\Resource\FileResource; - -class YamlFileLoaderTest extends TestCase -{ - public function testSupports() - { - $loader = new YamlFileLoader($this->getMockBuilder('Symfony\Component\Config\FileLocator')->getMock()); - - $this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable'); - $this->assertTrue($loader->supports('foo.yaml'), '->supports() returns true if the resource is loadable'); - $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); - - $this->assertTrue($loader->supports('foo.yml', 'yaml'), '->supports() checks the resource type if specified'); - $this->assertTrue($loader->supports('foo.yaml', 'yaml'), '->supports() checks the resource type if specified'); - $this->assertFalse($loader->supports('foo.yml', 'foo'), '->supports() checks the resource type if specified'); - } - - public function testLoadDoesNothingIfEmpty() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $collection = $loader->load('empty.yml'); - - $this->assertEquals(array(), $collection->all()); - $this->assertEquals(array(new FileResource(realpath(__DIR__.'/../Fixtures/empty.yml'))), $collection->getResources()); - } - - /** - * @expectedException \InvalidArgumentException - * @dataProvider getPathsToInvalidFiles - */ - public function testLoadThrowsExceptionWithInvalidFile($filePath) - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $loader->load($filePath); - } - - public function getPathsToInvalidFiles() - { - return array( - array('nonvalid.yml'), - array('nonvalid2.yml'), - array('incomplete.yml'), - array('nonvalidkeys.yml'), - array('nonesense_resource_plus_path.yml'), - array('nonesense_type_without_resource.yml'), - array('bad_format.yml'), - ); - } - - public function testLoadSpecialRouteName() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('special_route_name.yml'); - $route = $routeCollection->get('#$péß^a|'); - - $this->assertInstanceOf('Symfony\Component\Routing\Route', $route); - $this->assertSame('/true', $route->getPath()); - } - - public function testLoadWithRoute() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validpattern.yml'); - $route = $routeCollection->get('blog_show'); - - $this->assertInstanceOf('Symfony\Component\Routing\Route', $route); - $this->assertSame('/blog/{slug}', $route->getPath()); - $this->assertSame('{locale}.example.com', $route->getHost()); - $this->assertSame('MyBundle:Blog:show', $route->getDefault('_controller')); - $this->assertSame('\w+', $route->getRequirement('locale')); - $this->assertSame('RouteCompiler', $route->getOption('compiler_class')); - $this->assertEquals(array('GET', 'POST', 'PUT', 'OPTIONS'), $route->getMethods()); - $this->assertEquals(array('https'), $route->getSchemes()); - $this->assertEquals('context.getMethod() == "GET"', $route->getCondition()); - } - - public function testLoadWithResource() - { - $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures'))); - $routeCollection = $loader->load('validresource.yml'); - $routes = $routeCollection->all(); - - $this->assertCount(2, $routes, 'Two routes are loaded'); - $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes); - - foreach ($routes as $route) { - $this->assertSame('/{foo}/blog/{slug}', $route->getPath()); - $this->assertSame('123', $route->getDefault('foo')); - $this->assertSame('\d+', $route->getRequirement('foo')); - $this->assertSame('bar', $route->getOption('foo')); - $this->assertSame('', $route->getHost()); - $this->assertSame('context.getMethod() == "POST"', $route->getCondition()); - } - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/DumperCollectionTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/DumperCollectionTest.php deleted file mode 100644 index 823efdb..0000000 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/DumperCollectionTest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Matcher\Dumper\DumperCollection; - -class DumperCollectionTest extends TestCase -{ - public function testGetRoot() - { - $a = new DumperCollection(); - - $b = new DumperCollection(); - $a->add($b); - - $c = new DumperCollection(); - $b->add($c); - - $d = new DumperCollection(); - $c->add($d); - - $this->assertSame($a, $c->getRoot()); - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php deleted file mode 100644 index 4fb65f4..0000000 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ /dev/null @@ -1,386 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher\Dumper; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -class PhpMatcherDumperTest extends TestCase -{ - /** - * @expectedException \LogicException - */ - public function testDumpWhenSchemeIsUsedWithoutAProperDumper() - { - $collection = new RouteCollection(); - $collection->add('secure', new Route( - '/secure', - array(), - array(), - array(), - '', - array('https') - )); - $dumper = new PhpMatcherDumper($collection); - $dumper->dump(); - } - - /** - * @dataProvider getRouteCollections - */ - public function testDump(RouteCollection $collection, $fixture, $options = array()) - { - $basePath = __DIR__.'/../../Fixtures/dumper/'; - - $dumper = new PhpMatcherDumper($collection); - $this->assertStringEqualsFile($basePath.$fixture, $dumper->dump($options), '->dump() correctly dumps routes as optimized PHP code.'); - } - - public function getRouteCollections() - { - /* test case 1 */ - - $collection = new RouteCollection(); - - $collection->add('overridden', new Route('/overridden')); - - // defaults and requirements - $collection->add('foo', new Route( - '/foo/{bar}', - array('def' => 'test'), - array('bar' => 'baz|symfony') - )); - // method requirement - $collection->add('bar', new Route( - '/bar/{foo}', - array(), - array(), - array(), - '', - array(), - array('GET', 'head') - )); - // GET method requirement automatically adds HEAD as valid - $collection->add('barhead', new Route( - '/barhead/{foo}', - array(), - array(), - array(), - '', - array(), - array('GET') - )); - // simple - $collection->add('baz', new Route( - '/test/baz' - )); - // simple with extension - $collection->add('baz2', new Route( - '/test/baz.html' - )); - // trailing slash - $collection->add('baz3', new Route( - '/test/baz3/' - )); - // trailing slash with variable - $collection->add('baz4', new Route( - '/test/{foo}/' - )); - // trailing slash and method - $collection->add('baz5', new Route( - '/test/{foo}/', - array(), - array(), - array(), - '', - array(), - array('post') - )); - // complex name - $collection->add('baz.baz6', new Route( - '/test/{foo}/', - array(), - array(), - array(), - '', - array(), - array('put') - )); - // defaults without variable - $collection->add('foofoo', new Route( - '/foofoo', - array('def' => 'test') - )); - // pattern with quotes - $collection->add('quoter', new Route( - '/{quoter}', - array(), - array('quoter' => '[\']+') - )); - // space in pattern - $collection->add('space', new Route( - '/spa ce' - )); - - // prefixes - $collection1 = new RouteCollection(); - $collection1->add('overridden', new Route('/overridden1')); - $collection1->add('foo1', new Route('/{foo}')); - $collection1->add('bar1', new Route('/{bar}')); - $collection1->addPrefix('/b\'b'); - $collection2 = new RouteCollection(); - $collection2->addCollection($collection1); - $collection2->add('overridden', new Route('/{var}', array(), array('var' => '.*'))); - $collection1 = new RouteCollection(); - $collection1->add('foo2', new Route('/{foo1}')); - $collection1->add('bar2', new Route('/{bar1}')); - $collection1->addPrefix('/b\'b'); - $collection2->addCollection($collection1); - $collection2->addPrefix('/a'); - $collection->addCollection($collection2); - - // overridden through addCollection() and multiple sub-collections with no own prefix - $collection1 = new RouteCollection(); - $collection1->add('overridden2', new Route('/old')); - $collection1->add('helloWorld', new Route('/hello/{who}', array('who' => 'World!'))); - $collection2 = new RouteCollection(); - $collection3 = new RouteCollection(); - $collection3->add('overridden2', new Route('/new')); - $collection3->add('hey', new Route('/hey/')); - $collection2->addCollection($collection3); - $collection1->addCollection($collection2); - $collection1->addPrefix('/multi'); - $collection->addCollection($collection1); - - // "dynamic" prefix - $collection1 = new RouteCollection(); - $collection1->add('foo3', new Route('/{foo}')); - $collection1->add('bar3', new Route('/{bar}')); - $collection1->addPrefix('/b'); - $collection1->addPrefix('{_locale}'); - $collection->addCollection($collection1); - - // route between collections - $collection->add('ababa', new Route('/ababa')); - - // collection with static prefix but only one route - $collection1 = new RouteCollection(); - $collection1->add('foo4', new Route('/{foo}')); - $collection1->addPrefix('/aba'); - $collection->addCollection($collection1); - - // prefix and host - - $collection1 = new RouteCollection(); - - $route1 = new Route('/route1', array(), array(), array(), 'a.example.com'); - $collection1->add('route1', $route1); - - $route2 = new Route('/c2/route2', array(), array(), array(), 'a.example.com'); - $collection1->add('route2', $route2); - - $route3 = new Route('/c2/route3', array(), array(), array(), 'b.example.com'); - $collection1->add('route3', $route3); - - $route4 = new Route('/route4', array(), array(), array(), 'a.example.com'); - $collection1->add('route4', $route4); - - $route5 = new Route('/route5', array(), array(), array(), 'c.example.com'); - $collection1->add('route5', $route5); - - $route6 = new Route('/route6', array(), array(), array(), null); - $collection1->add('route6', $route6); - - $collection->addCollection($collection1); - - // host and variables - - $collection1 = new RouteCollection(); - - $route11 = new Route('/route11', array(), array(), array(), '{var1}.example.com'); - $collection1->add('route11', $route11); - - $route12 = new Route('/route12', array('var1' => 'val'), array(), array(), '{var1}.example.com'); - $collection1->add('route12', $route12); - - $route13 = new Route('/route13/{name}', array(), array(), array(), '{var1}.example.com'); - $collection1->add('route13', $route13); - - $route14 = new Route('/route14/{name}', array('var1' => 'val'), array(), array(), '{var1}.example.com'); - $collection1->add('route14', $route14); - - $route15 = new Route('/route15/{name}', array(), array(), array(), 'c.example.com'); - $collection1->add('route15', $route15); - - $route16 = new Route('/route16/{name}', array('var1' => 'val'), array(), array(), null); - $collection1->add('route16', $route16); - - $route17 = new Route('/route17', array(), array(), array(), null); - $collection1->add('route17', $route17); - - $collection->addCollection($collection1); - - // multiple sub-collections with a single route and a prefix each - $collection1 = new RouteCollection(); - $collection1->add('a', new Route('/a...')); - $collection2 = new RouteCollection(); - $collection2->add('b', new Route('/{var}')); - $collection3 = new RouteCollection(); - $collection3->add('c', new Route('/{var}')); - $collection3->addPrefix('/c'); - $collection2->addCollection($collection3); - $collection2->addPrefix('/b'); - $collection1->addCollection($collection2); - $collection1->addPrefix('/a'); - $collection->addCollection($collection1); - - /* test case 2 */ - - $redirectCollection = clone $collection; - - // force HTTPS redirection - $redirectCollection->add('secure', new Route( - '/secure', - array(), - array(), - array(), - '', - array('https') - )); - - // force HTTP redirection - $redirectCollection->add('nonsecure', new Route( - '/nonsecure', - array(), - array(), - array(), - '', - array('http') - )); - - /* test case 3 */ - - $rootprefixCollection = new RouteCollection(); - $rootprefixCollection->add('static', new Route('/test')); - $rootprefixCollection->add('dynamic', new Route('/{var}')); - $rootprefixCollection->addPrefix('rootprefix'); - $route = new Route('/with-condition'); - $route->setCondition('context.getMethod() == "GET"'); - $rootprefixCollection->add('with-condition', $route); - - /* test case 4 */ - $headMatchCasesCollection = new RouteCollection(); - $headMatchCasesCollection->add('just_head', new Route( - '/just_head', - array(), - array(), - array(), - '', - array(), - array('HEAD') - )); - $headMatchCasesCollection->add('head_and_get', new Route( - '/head_and_get', - array(), - array(), - array(), - '', - array(), - array('HEAD', 'GET') - )); - $headMatchCasesCollection->add('get_and_head', new Route( - '/get_and_head', - array(), - array(), - array(), - '', - array(), - array('GET', 'HEAD') - )); - $headMatchCasesCollection->add('post_and_head', new Route( - '/post_and_get', - array(), - array(), - array(), - '', - array(), - array('POST', 'HEAD') - )); - $headMatchCasesCollection->add('put_and_post', new Route( - '/put_and_post', - array(), - array(), - array(), - '', - array(), - array('PUT', 'POST') - )); - $headMatchCasesCollection->add('put_and_get_and_head', new Route( - '/put_and_post', - array(), - array(), - array(), - '', - array(), - array('PUT', 'GET', 'HEAD') - )); - - /* test case 5 */ - $groupOptimisedCollection = new RouteCollection(); - $groupOptimisedCollection->add('a_first', new Route('/a/11')); - $groupOptimisedCollection->add('a_second', new Route('/a/22')); - $groupOptimisedCollection->add('a_third', new Route('/a/333')); - $groupOptimisedCollection->add('a_wildcard', new Route('/{param}')); - $groupOptimisedCollection->add('a_fourth', new Route('/a/44/')); - $groupOptimisedCollection->add('a_fifth', new Route('/a/55/')); - $groupOptimisedCollection->add('a_sixth', new Route('/a/66/')); - $groupOptimisedCollection->add('nested_wildcard', new Route('/nested/{param}')); - $groupOptimisedCollection->add('nested_a', new Route('/nested/group/a/')); - $groupOptimisedCollection->add('nested_b', new Route('/nested/group/b/')); - $groupOptimisedCollection->add('nested_c', new Route('/nested/group/c/')); - - $groupOptimisedCollection->add('slashed_a', new Route('/slashed/group/')); - $groupOptimisedCollection->add('slashed_b', new Route('/slashed/group/b/')); - $groupOptimisedCollection->add('slashed_c', new Route('/slashed/group/c/')); - - $trailingSlashCollection = new RouteCollection(); - $trailingSlashCollection->add('simple_trailing_slash_no_methods', new Route('/trailing/simple/no-methods/', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('simple_trailing_slash_GET_method', new Route('/trailing/simple/get-method/', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('simple_trailing_slash_HEAD_method', new Route('/trailing/simple/head-method/', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('simple_trailing_slash_POST_method', new Route('/trailing/simple/post-method/', array(), array(), array(), '', array(), array('POST'))); - $trailingSlashCollection->add('regex_trailing_slash_no_methods', new Route('/trailing/regex/no-methods/{param}/', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('regex_trailing_slash_GET_method', new Route('/trailing/regex/get-method/{param}/', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('regex_trailing_slash_HEAD_method', new Route('/trailing/regex/head-method/{param}/', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('regex_trailing_slash_POST_method', new Route('/trailing/regex/post-method/{param}/', array(), array(), array(), '', array(), array('POST'))); - - $trailingSlashCollection->add('simple_not_trailing_slash_no_methods', new Route('/not-trailing/simple/no-methods', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('simple_not_trailing_slash_GET_method', new Route('/not-trailing/simple/get-method', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('simple_not_trailing_slash_HEAD_method', new Route('/not-trailing/simple/head-method', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('simple_not_trailing_slash_POST_method', new Route('/not-trailing/simple/post-method', array(), array(), array(), '', array(), array('POST'))); - $trailingSlashCollection->add('regex_not_trailing_slash_no_methods', new Route('/not-trailing/regex/no-methods/{param}', array(), array(), array(), '', array(), array())); - $trailingSlashCollection->add('regex_not_trailing_slash_GET_method', new Route('/not-trailing/regex/get-method/{param}', array(), array(), array(), '', array(), array('GET'))); - $trailingSlashCollection->add('regex_not_trailing_slash_HEAD_method', new Route('/not-trailing/regex/head-method/{param}', array(), array(), array(), '', array(), array('HEAD'))); - $trailingSlashCollection->add('regex_not_trailing_slash_POST_method', new Route('/not-trailing/regex/post-method/{param}', array(), array(), array(), '', array(), array('POST'))); - - return array( - array($collection, 'url_matcher1.php', array()), - array($redirectCollection, 'url_matcher2.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - array($rootprefixCollection, 'url_matcher3.php', array()), - array($headMatchCasesCollection, 'url_matcher4.php', array()), - array($groupOptimisedCollection, 'url_matcher5.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - array($trailingSlashCollection, 'url_matcher6.php', array()), - array($trailingSlashCollection, 'url_matcher7.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')), - ); - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php deleted file mode 100644 index 37419e7..0000000 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php +++ /dev/null @@ -1,175 +0,0 @@ -compile()->getStaticPrefix(); - $collection->addRoute($staticPrefix, $name); - } - - $collection->optimizeGroups(); - $dumped = $this->dumpCollection($collection); - $this->assertEquals($expected, $dumped); - } - - public function routeProvider() - { - return array( - 'Simple - not nested' => array( - array( - array('/', 'root'), - array('/prefix/segment/', 'prefix_segment'), - array('/leading/segment/', 'leading_segment'), - ), - << array( - array( - array('/', 'root'), - array('/prefix/segment/aa', 'prefix_segment'), - array('/prefix/segment/bb', 'leading_segment'), - ), - << array( - array( - array('/', 'root'), - array('/prefix/segment/', 'prefix_segment'), - array('/prefix/segment/bb', 'leading_segment'), - ), - << /prefix/segment prefix_segment --> /prefix/segment/bb leading_segment -EOF - ), - 'Simple one level nesting' => array( - array( - array('/', 'root'), - array('/group/segment/', 'nested_segment'), - array('/group/thing/', 'some_segment'), - array('/group/other/', 'other_segment'), - ), - << /group/segment nested_segment --> /group/thing some_segment --> /group/other other_segment -EOF - ), - 'Retain matching order with groups' => array( - array( - array('/group/aa/', 'aa'), - array('/group/bb/', 'bb'), - array('/group/cc/', 'cc'), - array('/', 'root'), - array('/group/dd/', 'dd'), - array('/group/ee/', 'ee'), - array('/group/ff/', 'ff'), - ), - << /group/aa aa --> /group/bb bb --> /group/cc cc -/ root -/group --> /group/dd dd --> /group/ee ee --> /group/ff ff -EOF - ), - 'Retain complex matching order with groups at base' => array( - array( - array('/aaa/111/', 'first_aaa'), - array('/prefixed/group/aa/', 'aa'), - array('/prefixed/group/bb/', 'bb'), - array('/prefixed/group/cc/', 'cc'), - array('/prefixed/', 'root'), - array('/prefixed/group/dd/', 'dd'), - array('/prefixed/group/ee/', 'ee'), - array('/prefixed/group/ff/', 'ff'), - array('/aaa/222/', 'second_aaa'), - array('/aaa/333/', 'third_aaa'), - ), - << /aaa/111 first_aaa --> /aaa/222 second_aaa --> /aaa/333 third_aaa -/prefixed --> /prefixed/group --> -> /prefixed/group/aa aa --> -> /prefixed/group/bb bb --> -> /prefixed/group/cc cc --> /prefixed root --> /prefixed/group --> -> /prefixed/group/dd dd --> -> /prefixed/group/ee ee --> -> /prefixed/group/ff ff -EOF - ), - - 'Group regardless of segments' => array( - array( - array('/aaa-111/', 'a1'), - array('/aaa-222/', 'a2'), - array('/aaa-333/', 'a3'), - array('/group-aa/', 'g1'), - array('/group-bb/', 'g2'), - array('/group-cc/', 'g3'), - ), - << /aaa-111 a1 --> /aaa-222 a2 --> /aaa-333 a3 -/group- --> /group-aa g1 --> /group-bb g2 --> /group-cc g3 -EOF - ), - ); - } - - private function dumpCollection(StaticPrefixCollection $collection, $prefix = '') - { - $lines = array(); - - foreach ($collection->getItems() as $item) { - if ($item instanceof StaticPrefixCollection) { - $lines[] = $prefix.$item->getPrefix(); - $lines[] = $this->dumpCollection($item, $prefix.'-> '); - } else { - $lines[] = $prefix.implode(' ', $item); - } - } - - return implode("\n", $lines); - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php deleted file mode 100644 index ba4c6e9..0000000 --- a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; - -class RedirectableUrlMatcherTest extends TestCase -{ - public function testRedirectWhenNoSlash() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/')); - - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher->expects($this->once())->method('redirect'); - $matcher->match('/foo'); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testRedirectWhenNoSlashForNonSafeMethod() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/')); - - $context = new RequestContext(); - $context->setMethod('POST'); - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context)); - $matcher->match('/foo'); - } - - public function testSchemeRedirectRedirectsToFirstScheme() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('FTP', 'HTTPS'))); - - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher - ->expects($this->once()) - ->method('redirect') - ->with('/foo', 'foo', 'ftp') - ->will($this->returnValue(array('_route' => 'foo'))) - ; - $matcher->match('/foo'); - } - - public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http'))); - - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher - ->expects($this->never()) - ->method('redirect') - ; - $matcher->match('/foo'); - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php deleted file mode 100644 index 9f0529e..0000000 --- a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Matcher\TraceableUrlMatcher; - -class TraceableUrlMatcherTest extends TestCase -{ - public function test() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('POST'))); - $coll->add('bar', new Route('/bar/{id}', array(), array('id' => '\d+'))); - $coll->add('bar1', new Route('/bar/{name}', array(), array('id' => '\w+'), array(), '', array(), array('POST'))); - $coll->add('bar2', new Route('/foo', array(), array(), array(), 'baz')); - $coll->add('bar3', new Route('/foo1', array(), array(), array(), 'baz')); - $coll->add('bar4', new Route('/foo2', array(), array(), array(), 'baz', array(), array(), 'context.getMethod() == "GET"')); - - $context = new RequestContext(); - $context->setHost('baz'); - - $matcher = new TraceableUrlMatcher($coll, $context); - $traces = $matcher->getTraces('/babar'); - $this->assertSame(array(0, 0, 0, 0, 0, 0), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/foo'); - $this->assertSame(array(1, 0, 0, 2), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/bar/12'); - $this->assertSame(array(0, 2), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/bar/dd'); - $this->assertSame(array(0, 1, 1, 0, 0, 0), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/foo1'); - $this->assertSame(array(0, 0, 0, 0, 2), $this->getLevels($traces)); - - $context->setMethod('POST'); - $traces = $matcher->getTraces('/foo'); - $this->assertSame(array(2), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/bar/dd'); - $this->assertSame(array(0, 1, 2), $this->getLevels($traces)); - - $traces = $matcher->getTraces('/foo2'); - $this->assertSame(array(0, 0, 0, 0, 0, 1), $this->getLevels($traces)); - } - - public function testMatchRouteOnMultipleHosts() - { - $routes = new RouteCollection(); - $routes->add('first', new Route( - '/mypath/', - array('_controller' => 'MainBundle:Info:first'), - array(), - array(), - 'some.example.com' - )); - - $routes->add('second', new Route( - '/mypath/', - array('_controller' => 'MainBundle:Info:second'), - array(), - array(), - 'another.example.com' - )); - - $context = new RequestContext(); - $context->setHost('baz'); - - $matcher = new TraceableUrlMatcher($routes, $context); - - $traces = $matcher->getTraces('/mypath/'); - $this->assertSame( - array(TraceableUrlMatcher::ROUTE_ALMOST_MATCHES, TraceableUrlMatcher::ROUTE_ALMOST_MATCHES), - $this->getLevels($traces) - ); - } - - public function getLevels($traces) - { - $levels = array(); - foreach ($traces as $trace) { - $levels[] = $trace['level']; - } - - return $levels; - } - - public function testRoutesWithConditions() - { - $routes = new RouteCollection(); - $routes->add('foo', new Route('/foo', array(), array(), array(), 'baz', array(), array(), "request.headers.get('User-Agent') matches '/firefox/i'")); - - $context = new RequestContext(); - $context->setHost('baz'); - - $matcher = new TraceableUrlMatcher($routes, $context); - - $notMatchingRequest = Request::create('/foo', 'GET'); - $traces = $matcher->getTracesForRequest($notMatchingRequest); - $this->assertEquals("Condition \"request.headers.get('User-Agent') matches '/firefox/i'\" does not evaluate to \"true\"", $traces[0]['log']); - - $matchingRequest = Request::create('/foo', 'GET', array(), array(), array(), array('HTTP_USER_AGENT' => 'Firefox')); - $traces = $matcher->getTracesForRequest($matchingRequest); - $this->assertEquals('Route matches!', $traces[0]['log']); - } -} diff --git a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php deleted file mode 100644 index 1eeb5d4..0000000 --- a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php +++ /dev/null @@ -1,430 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests\Matcher; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; - -class UrlMatcherTest extends TestCase -{ - public function testNoMethodSoAllowed() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo')); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertInternalType('array', $matcher->match('/foo')); - } - - public function testMethodNotAllowed() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('post'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - - try { - $matcher->match('/foo'); - $this->fail(); - } catch (MethodNotAllowedException $e) { - $this->assertEquals(array('POST'), $e->getAllowedMethods()); - } - } - - public function testHeadAllowedWhenRequirementContainsGet() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get'))); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'head')); - $this->assertInternalType('array', $matcher->match('/foo')); - } - - public function testMethodNotAllowedAggregatesAllowedMethods() - { - $coll = new RouteCollection(); - $coll->add('foo1', new Route('/foo', array(), array(), array(), '', array(), array('post'))); - $coll->add('foo2', new Route('/foo', array(), array(), array(), '', array(), array('put', 'delete'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - - try { - $matcher->match('/foo'); - $this->fail(); - } catch (MethodNotAllowedException $e) { - $this->assertEquals(array('POST', 'PUT', 'DELETE'), $e->getAllowedMethods()); - } - } - - public function testMatch() - { - // test the patterns are matched and parameters are returned - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo/{bar}')); - $matcher = new UrlMatcher($collection, new RequestContext()); - try { - $matcher->match('/no-match'); - $this->fail(); - } catch (ResourceNotFoundException $e) { - } - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz'), $matcher->match('/foo/baz')); - - // test that defaults are merged - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo/{bar}', array('def' => 'test'))); - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'def' => 'test'), $matcher->match('/foo/baz')); - - // test that route "method" is ignored if no method is given in the context - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get', 'head'))); - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertInternalType('array', $matcher->match('/foo')); - - // route does not match with POST method context - $matcher = new UrlMatcher($collection, new RequestContext('', 'post')); - try { - $matcher->match('/foo'); - $this->fail(); - } catch (MethodNotAllowedException $e) { - } - - // route does match with GET or HEAD method context - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertInternalType('array', $matcher->match('/foo')); - $matcher = new UrlMatcher($collection, new RequestContext('', 'head')); - $this->assertInternalType('array', $matcher->match('/foo')); - - // route with an optional variable as the first segment - $collection = new RouteCollection(); - $collection->add('bar', new Route('/{bar}/foo', array('bar' => 'bar'), array('bar' => 'foo|bar'))); - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/bar/foo')); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo/foo')); - - $collection = new RouteCollection(); - $collection->add('bar', new Route('/{bar}', array('bar' => 'bar'), array('bar' => 'foo|bar'))); - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo')); - $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/')); - - // route with only optional variables - $collection = new RouteCollection(); - $collection->add('bar', new Route('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar'), array())); - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'foo', 'bar' => 'bar'), $matcher->match('/')); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'bar'), $matcher->match('/a')); - $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'b'), $matcher->match('/a/b')); - } - - public function testMatchWithPrefixes() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/{foo}')); - $collection->addPrefix('/b'); - $collection->addPrefix('/a'); - - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'foo', 'foo' => 'foo'), $matcher->match('/a/b/foo')); - } - - public function testMatchWithDynamicPrefix() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/{foo}')); - $collection->addPrefix('/b'); - $collection->addPrefix('/{_locale}'); - - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_locale' => 'fr', '_route' => 'foo', 'foo' => 'foo'), $matcher->match('/fr/b/foo')); - } - - public function testMatchSpecialRouteName() - { - $collection = new RouteCollection(); - $collection->add('$péß^a|', new Route('/bar')); - - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => '$péß^a|'), $matcher->match('/bar')); - } - - public function testMatchNonAlpha() - { - $collection = new RouteCollection(); - $chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-'; - $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+'), array('utf8' => true))); - - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.rawurlencode($chars).'/bar')); - $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.strtr($chars, array('%' => '%25')).'/bar')); - } - - public function testMatchWithDotMetacharacterInRequirements() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '.+'))); - - $matcher = new UrlMatcher($collection, new RequestContext()); - $this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); - } - - public function testMatchOverriddenRoute() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('foo', new Route('/foo1')); - - $collection->addCollection($collection1); - - $matcher = new UrlMatcher($collection, new RequestContext()); - - $this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1')); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); - $this->assertEquals(array(), $matcher->match('/foo')); - } - - public function testMatchRegression() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}')); - $coll->add('bar', new Route('/foo/bar/{foo}')); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertEquals(array('foo' => 'bar', '_route' => 'bar'), $matcher->match('/foo/bar/bar')); - - $collection = new RouteCollection(); - $collection->add('foo', new Route('/{bar}')); - $matcher = new UrlMatcher($collection, new RequestContext()); - try { - $matcher->match('/'); - $this->fail(); - } catch (ResourceNotFoundException $e) { - } - } - - public function testDefaultRequirementForOptionalVariables() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}', array('page' => 'index', '_format' => 'html'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertEquals(array('page' => 'my-page', '_format' => 'xml', '_route' => 'test'), $matcher->match('/my-page.xml')); - } - - public function testMatchingIsEager() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{foo}-{bar}-', array(), array('foo' => '.+', 'bar' => '.+'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertEquals(array('foo' => 'text1-text2-text3', 'bar' => 'text4', '_route' => 'test'), $matcher->match('/text1-text2-text3-text4-')); - } - - public function testAdjacentVariables() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => 'y|Y'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - // 'w' eagerly matches as much as possible and the other variables match the remaining chars. - // This also shows that the variables w-z must all exclude the separating char (the dot '.' in this case) by default requirement. - // Otherwise they would also consume '.xml' and _format would never match as it's an optional variable. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'Y', 'z' => 'Z', '_format' => 'xml', '_route' => 'test'), $matcher->match('/wwwwwxYZ.xml')); - // As 'y' has custom requirement and can only be of value 'y|Y', it will leave 'ZZZ' to variable z. - // So with carefully chosen requirements adjacent variables, can be useful. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'ZZZ', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxyZZZ')); - // z and _format are optional. - $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy')); - - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); - $matcher->match('/wxy.html'); - } - - public function testOptionalVariableWithNoRealSeparator() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/get{what}', array('what' => 'All'))); - $matcher = new UrlMatcher($coll, new RequestContext()); - - $this->assertEquals(array('what' => 'All', '_route' => 'test'), $matcher->match('/get')); - $this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSites')); - - // Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match. - // But here the 't' in 'get' is not a separating character, so it makes no sense to match without it. - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); - $matcher->match('/ge'); - } - - public function testRequiredVariableWithNoRealSeparator() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/get{what}Suffix')); - $matcher = new UrlMatcher($coll, new RequestContext()); - - $this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSitesSuffix')); - } - - public function testDefaultRequirementOfVariable() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}')); - $matcher = new UrlMatcher($coll, new RequestContext()); - - $this->assertEquals(array('page' => 'index', '_format' => 'mobile.html', '_route' => 'test'), $matcher->match('/index.mobile.html')); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testDefaultRequirementOfVariableDisallowsSlash() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}')); - $matcher = new UrlMatcher($coll, new RequestContext()); - - $matcher->match('/index.sl/ash'); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testDefaultRequirementOfVariableDisallowsNextSeparator() - { - $coll = new RouteCollection(); - $coll->add('test', new Route('/{page}.{_format}', array(), array('_format' => 'html|xml'))); - $matcher = new UrlMatcher($coll, new RequestContext()); - - $matcher->match('/do.t.html'); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testSchemeRequirement() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https'))); - $matcher = new UrlMatcher($coll, new RequestContext()); - $matcher->match('/foo'); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testCondition() - { - $coll = new RouteCollection(); - $route = new Route('/foo'); - $route->setCondition('context.getMethod() == "POST"'); - $coll->add('foo', $route); - $matcher = new UrlMatcher($coll, new RequestContext()); - $matcher->match('/foo'); - } - - public function testRequestCondition() - { - $coll = new RouteCollection(); - $route = new Route('/foo/{bar}'); - $route->setCondition('request.getBaseUrl() == "/sub/front.php" and request.getPathInfo() == "/foo/bar"'); - $coll->add('foo', $route); - $matcher = new UrlMatcher($coll, new RequestContext('/sub/front.php')); - $this->assertEquals(array('bar' => 'bar', '_route' => 'foo'), $matcher->match('/foo/bar')); - } - - public function testDecodeOnce() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}')); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertEquals(array('foo' => 'bar%23', '_route' => 'foo'), $matcher->match('/foo/bar%2523')); - } - - public function testCannotRelyOnPrefix() - { - $coll = new RouteCollection(); - - $subColl = new RouteCollection(); - $subColl->add('bar', new Route('/bar')); - $subColl->addPrefix('/prefix'); - // overwrite the pattern, so the prefix is not valid anymore for this route in the collection - $subColl->get('bar')->setPath('/new'); - - $coll->addCollection($subColl); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $this->assertEquals(array('_route' => 'bar'), $matcher->match('/new')); - } - - public function testWithHost() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com')); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar')); - } - - public function testWithHostOnRouteCollection() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}')); - $coll->add('bar', new Route('/bar/{foo}', array(), array(), array(), '{locale}.example.net')); - $coll->setHost('{locale}.example.com'); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar')); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('foo' => 'bar', '_route' => 'bar', 'locale' => 'en'), $matcher->match('/bar/bar')); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testWithOutHostHostDoesNotMatch() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com')); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'example.com')); - $matcher->match('/foo/bar'); - } - - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testPathIsCaseSensitive() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/locale', array(), array('locale' => 'EN|FR|DE'))); - - $matcher = new UrlMatcher($coll, new RequestContext()); - $matcher->match('/en'); - } - - public function testHostIsCaseInsensitive() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/', array(), array('locale' => 'EN|FR|DE'), array(), '{locale}.example.com')); - - $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com')); - $this->assertEquals(array('_route' => 'foo', 'locale' => 'en'), $matcher->match('/')); - } -} diff --git a/vendor/symfony/routing/Tests/RequestContextTest.php b/vendor/symfony/routing/Tests/RequestContextTest.php deleted file mode 100644 index ffe29d1..0000000 --- a/vendor/symfony/routing/Tests/RequestContextTest.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContext; - -class RequestContextTest extends TestCase -{ - public function testConstruct() - { - $requestContext = new RequestContext( - 'foo', - 'post', - 'foo.bar', - 'HTTPS', - 8080, - 444, - '/baz', - 'bar=foobar' - ); - - $this->assertEquals('foo', $requestContext->getBaseUrl()); - $this->assertEquals('POST', $requestContext->getMethod()); - $this->assertEquals('foo.bar', $requestContext->getHost()); - $this->assertEquals('https', $requestContext->getScheme()); - $this->assertSame(8080, $requestContext->getHttpPort()); - $this->assertSame(444, $requestContext->getHttpsPort()); - $this->assertEquals('/baz', $requestContext->getPathInfo()); - $this->assertEquals('bar=foobar', $requestContext->getQueryString()); - } - - public function testFromRequest() - { - $request = Request::create('https://test.com:444/foo?bar=baz'); - $requestContext = new RequestContext(); - $requestContext->setHttpPort(123); - $requestContext->fromRequest($request); - - $this->assertEquals('', $requestContext->getBaseUrl()); - $this->assertEquals('GET', $requestContext->getMethod()); - $this->assertEquals('test.com', $requestContext->getHost()); - $this->assertEquals('https', $requestContext->getScheme()); - $this->assertEquals('/foo', $requestContext->getPathInfo()); - $this->assertEquals('bar=baz', $requestContext->getQueryString()); - $this->assertSame(123, $requestContext->getHttpPort()); - $this->assertSame(444, $requestContext->getHttpsPort()); - - $request = Request::create('http://test.com:8080/foo?bar=baz'); - $requestContext = new RequestContext(); - $requestContext->setHttpsPort(567); - $requestContext->fromRequest($request); - - $this->assertSame(8080, $requestContext->getHttpPort()); - $this->assertSame(567, $requestContext->getHttpsPort()); - } - - public function testGetParameters() - { - $requestContext = new RequestContext(); - $this->assertEquals(array(), $requestContext->getParameters()); - - $requestContext->setParameters(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $requestContext->getParameters()); - } - - public function testHasParameter() - { - $requestContext = new RequestContext(); - $requestContext->setParameters(array('foo' => 'bar')); - - $this->assertTrue($requestContext->hasParameter('foo')); - $this->assertFalse($requestContext->hasParameter('baz')); - } - - public function testGetParameter() - { - $requestContext = new RequestContext(); - $requestContext->setParameters(array('foo' => 'bar')); - - $this->assertEquals('bar', $requestContext->getParameter('foo')); - $this->assertNull($requestContext->getParameter('baz')); - } - - public function testSetParameter() - { - $requestContext = new RequestContext(); - $requestContext->setParameter('foo', 'bar'); - - $this->assertEquals('bar', $requestContext->getParameter('foo')); - } - - public function testMethod() - { - $requestContext = new RequestContext(); - $requestContext->setMethod('post'); - - $this->assertSame('POST', $requestContext->getMethod()); - } - - public function testScheme() - { - $requestContext = new RequestContext(); - $requestContext->setScheme('HTTPS'); - - $this->assertSame('https', $requestContext->getScheme()); - } - - public function testHost() - { - $requestContext = new RequestContext(); - $requestContext->setHost('eXampLe.com'); - - $this->assertSame('example.com', $requestContext->getHost()); - } - - public function testQueryString() - { - $requestContext = new RequestContext(); - $requestContext->setQueryString(null); - - $this->assertSame('', $requestContext->getQueryString()); - } - - public function testPort() - { - $requestContext = new RequestContext(); - $requestContext->setHttpPort('123'); - $requestContext->setHttpsPort('456'); - - $this->assertSame(123, $requestContext->getHttpPort()); - $this->assertSame(456, $requestContext->getHttpsPort()); - } - - public function testFluentInterface() - { - $requestContext = new RequestContext(); - - $this->assertSame($requestContext, $requestContext->setBaseUrl('/app.php')); - $this->assertSame($requestContext, $requestContext->setPathInfo('/index')); - $this->assertSame($requestContext, $requestContext->setMethod('POST')); - $this->assertSame($requestContext, $requestContext->setScheme('https')); - $this->assertSame($requestContext, $requestContext->setHost('example.com')); - $this->assertSame($requestContext, $requestContext->setQueryString('foo=bar')); - $this->assertSame($requestContext, $requestContext->setHttpPort(80)); - $this->assertSame($requestContext, $requestContext->setHttpsPort(443)); - $this->assertSame($requestContext, $requestContext->setParameters(array())); - $this->assertSame($requestContext, $requestContext->setParameter('foo', 'bar')); - } -} diff --git a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php deleted file mode 100644 index 058a100..0000000 --- a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php +++ /dev/null @@ -1,325 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RouteCollectionBuilder; - -class RouteCollectionBuilderTest extends TestCase -{ - public function testImport() - { - $resolvedLoader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock(); - $resolver->expects($this->once()) - ->method('resolve') - ->with('admin_routing.yml', 'yaml') - ->will($this->returnValue($resolvedLoader)); - - $originalRoute = new Route('/foo/path'); - $expectedCollection = new RouteCollection(); - $expectedCollection->add('one_test_route', $originalRoute); - $expectedCollection->addResource(new FileResource(__DIR__.'/Fixtures/file_resource.yml')); - - $resolvedLoader - ->expects($this->once()) - ->method('load') - ->with('admin_routing.yml', 'yaml') - ->will($this->returnValue($expectedCollection)); - - $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader->expects($this->any()) - ->method('getResolver') - ->will($this->returnValue($resolver)); - - // import the file! - $routes = new RouteCollectionBuilder($loader); - $importedRoutes = $routes->import('admin_routing.yml', '/', 'yaml'); - - // we should get back a RouteCollectionBuilder - $this->assertInstanceOf('Symfony\Component\Routing\RouteCollectionBuilder', $importedRoutes); - - // get the collection back so we can look at it - $addedCollection = $importedRoutes->build(); - $route = $addedCollection->get('one_test_route'); - $this->assertSame($originalRoute, $route); - // should return file_resource.yml, which is in the original collection - $this->assertCount(1, $addedCollection->getResources()); - - // make sure the routes were imported into the top-level builder - $this->assertCount(1, $routes->build()); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testImportWithoutLoaderThrowsException() - { - $collectionBuilder = new RouteCollectionBuilder(); - $collectionBuilder->import('routing.yml'); - } - - public function testAdd() - { - $collectionBuilder = new RouteCollectionBuilder(); - - $addedRoute = $collectionBuilder->add('/checkout', 'AppBundle:Order:checkout'); - $addedRoute2 = $collectionBuilder->add('/blogs', 'AppBundle:Blog:list', 'blog_list'); - $this->assertInstanceOf('Symfony\Component\Routing\Route', $addedRoute); - $this->assertEquals('AppBundle:Order:checkout', $addedRoute->getDefault('_controller')); - - $finalCollection = $collectionBuilder->build(); - $this->assertSame($addedRoute2, $finalCollection->get('blog_list')); - } - - public function testFlushOrdering() - { - $importedCollection = new RouteCollection(); - $importedCollection->add('imported_route1', new Route('/imported/foo1')); - $importedCollection->add('imported_route2', new Route('/imported/foo2')); - - $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - // make this loader able to do the import - keeps mocking simple - $loader->expects($this->any()) - ->method('supports') - ->will($this->returnValue(true)); - $loader - ->expects($this->once()) - ->method('load') - ->will($this->returnValue($importedCollection)); - - $routes = new RouteCollectionBuilder($loader); - - // 1) Add a route - $routes->add('/checkout', 'AppBundle:Order:checkout', 'checkout_route'); - // 2) Import from a file - $routes->mount('/', $routes->import('admin_routing.yml')); - // 3) Add another route - $routes->add('/', 'AppBundle:Default:homepage', 'homepage'); - // 4) Add another route - $routes->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); - - // set a default value - $routes->setDefault('_locale', 'fr'); - - $actualCollection = $routes->build(); - - $this->assertCount(5, $actualCollection); - $actualRouteNames = array_keys($actualCollection->all()); - $this->assertEquals(array( - 'checkout_route', - 'imported_route1', - 'imported_route2', - 'homepage', - 'admin_dashboard', - ), $actualRouteNames); - - // make sure the defaults were set - $checkoutRoute = $actualCollection->get('checkout_route'); - $defaults = $checkoutRoute->getDefaults(); - $this->assertArrayHasKey('_locale', $defaults); - $this->assertEquals('fr', $defaults['_locale']); - } - - public function testFlushSetsRouteNames() - { - $collectionBuilder = new RouteCollectionBuilder(); - - // add a "named" route - $collectionBuilder->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); - // add an unnamed route - $collectionBuilder->add('/blogs', 'AppBundle:Blog:list') - ->setMethods(array('GET')); - - // integer route names are allowed - they don't confuse things - $collectionBuilder->add('/products', 'AppBundle:Product:list', 100); - - $actualCollection = $collectionBuilder->build(); - $actualRouteNames = array_keys($actualCollection->all()); - $this->assertEquals(array( - 'admin_dashboard', - 'GET_blogs', - '100', - ), $actualRouteNames); - } - - public function testFlushSetsDetailsOnChildrenRoutes() - { - $routes = new RouteCollectionBuilder(); - - $routes->add('/blogs/{page}', 'listAction', 'blog_list') - // unique things for the route - ->setDefault('page', 1) - ->setRequirement('id', '\d+') - ->setOption('expose', true) - // things that the collection will try to override (but won't) - ->setDefault('_format', 'html') - ->setRequirement('_format', 'json|xml') - ->setOption('fooBar', true) - ->setHost('example.com') - ->setCondition('request.isSecure()') - ->setSchemes(array('https')) - ->setMethods(array('POST')); - - // a simple route, nothing added to it - $routes->add('/blogs/{id}', 'editAction', 'blog_edit'); - - // configure the collection itself - $routes - // things that will not override the child route - ->setDefault('_format', 'json') - ->setRequirement('_format', 'xml') - ->setOption('fooBar', false) - ->setHost('symfony.com') - ->setCondition('request.query.get("page")==1') - // some unique things that should be set on the child - ->setDefault('_locale', 'fr') - ->setRequirement('_locale', 'fr|en') - ->setOption('niceRoute', true) - ->setSchemes(array('http')) - ->setMethods(array('GET', 'POST')); - - $collection = $routes->build(); - $actualListRoute = $collection->get('blog_list'); - - $this->assertEquals(1, $actualListRoute->getDefault('page')); - $this->assertEquals('\d+', $actualListRoute->getRequirement('id')); - $this->assertTrue($actualListRoute->getOption('expose')); - // none of these should be overridden - $this->assertEquals('html', $actualListRoute->getDefault('_format')); - $this->assertEquals('json|xml', $actualListRoute->getRequirement('_format')); - $this->assertTrue($actualListRoute->getOption('fooBar')); - $this->assertEquals('example.com', $actualListRoute->getHost()); - $this->assertEquals('request.isSecure()', $actualListRoute->getCondition()); - $this->assertEquals(array('https'), $actualListRoute->getSchemes()); - $this->assertEquals(array('POST'), $actualListRoute->getMethods()); - // inherited from the main collection - $this->assertEquals('fr', $actualListRoute->getDefault('_locale')); - $this->assertEquals('fr|en', $actualListRoute->getRequirement('_locale')); - $this->assertTrue($actualListRoute->getOption('niceRoute')); - - $actualEditRoute = $collection->get('blog_edit'); - // inherited from the collection - $this->assertEquals('symfony.com', $actualEditRoute->getHost()); - $this->assertEquals('request.query.get("page")==1', $actualEditRoute->getCondition()); - $this->assertEquals(array('http'), $actualEditRoute->getSchemes()); - $this->assertEquals(array('GET', 'POST'), $actualEditRoute->getMethods()); - } - - /** - * @dataProvider providePrefixTests - */ - public function testFlushPrefixesPaths($collectionPrefix, $routePath, $expectedPath) - { - $routes = new RouteCollectionBuilder(); - - $routes->add($routePath, 'someController', 'test_route'); - - $outerRoutes = new RouteCollectionBuilder(); - $outerRoutes->mount($collectionPrefix, $routes); - - $collection = $outerRoutes->build(); - - $this->assertEquals($expectedPath, $collection->get('test_route')->getPath()); - } - - public function providePrefixTests() - { - $tests = array(); - // empty prefix is of course ok - $tests[] = array('', '/foo', '/foo'); - // normal prefix - does not matter if it's a wildcard - $tests[] = array('/{admin}', '/foo', '/{admin}/foo'); - // shows that a prefix will always be given the starting slash - $tests[] = array('0', '/foo', '/0/foo'); - - // spaces are ok, and double slahses at the end are cleaned - $tests[] = array('/ /', '/foo', '/ /foo'); - - return $tests; - } - - public function testFlushSetsPrefixedWithMultipleLevels() - { - $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $routes = new RouteCollectionBuilder($loader); - - $routes->add('homepage', 'MainController::homepageAction', 'homepage'); - - $adminRoutes = $routes->createBuilder(); - $adminRoutes->add('/dashboard', 'AdminController::dashboardAction', 'admin_dashboard'); - - // embedded collection under /admin - $adminBlogRoutes = $routes->createBuilder(); - $adminBlogRoutes->add('/new', 'BlogController::newAction', 'admin_blog_new'); - // mount into admin, but before the parent collection has been mounted - $adminRoutes->mount('/blog', $adminBlogRoutes); - - // now mount the /admin routes, above should all still be /blog/admin - $routes->mount('/admin', $adminRoutes); - // add a route after mounting - $adminRoutes->add('/users', 'AdminController::userAction', 'admin_users'); - - // add another sub-collection after the mount - $otherAdminRoutes = $routes->createBuilder(); - $otherAdminRoutes->add('/sales', 'StatsController::indexAction', 'admin_stats_sales'); - $adminRoutes->mount('/stats', $otherAdminRoutes); - - // add a normal collection and see that it is also prefixed - $importedCollection = new RouteCollection(); - $importedCollection->add('imported_route', new Route('/foo')); - // make this loader able to do the import - keeps mocking simple - $loader->expects($this->any()) - ->method('supports') - ->will($this->returnValue(true)); - $loader - ->expects($this->any()) - ->method('load') - ->will($this->returnValue($importedCollection)); - // import this from the /admin route builder - $adminRoutes->import('admin.yml', '/imported'); - - $collection = $routes->build(); - $this->assertEquals('/admin/dashboard', $collection->get('admin_dashboard')->getPath(), 'Routes before mounting have the prefix'); - $this->assertEquals('/admin/users', $collection->get('admin_users')->getPath(), 'Routes after mounting have the prefix'); - $this->assertEquals('/admin/blog/new', $collection->get('admin_blog_new')->getPath(), 'Sub-collections receive prefix even if mounted before parent prefix'); - $this->assertEquals('/admin/stats/sales', $collection->get('admin_stats_sales')->getPath(), 'Sub-collections receive prefix if mounted after parent prefix'); - $this->assertEquals('/admin/imported/foo', $collection->get('imported_route')->getPath(), 'Normal RouteCollections are also prefixed properly'); - } - - public function testAutomaticRouteNamesDoNotConflict() - { - $routes = new RouteCollectionBuilder(); - - $adminRoutes = $routes->createBuilder(); - // route 1 - $adminRoutes->add('/dashboard', ''); - - $accountRoutes = $routes->createBuilder(); - // route 2 - $accountRoutes->add('/dashboard', '') - ->setMethods(array('GET')); - // route 3 - $accountRoutes->add('/dashboard', '') - ->setMethods(array('POST')); - - $routes->mount('/admin', $adminRoutes); - $routes->mount('/account', $accountRoutes); - - $collection = $routes->build(); - // there are 2 routes (i.e. with non-conflicting names) - $this->assertCount(3, $collection->all()); - } -} diff --git a/vendor/symfony/routing/Tests/RouteCollectionTest.php b/vendor/symfony/routing/Tests/RouteCollectionTest.php deleted file mode 100644 index 83457ff..0000000 --- a/vendor/symfony/routing/Tests/RouteCollectionTest.php +++ /dev/null @@ -1,305 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; - -class RouteCollectionTest extends TestCase -{ - public function testRoute() - { - $collection = new RouteCollection(); - $route = new Route('/foo'); - $collection->add('foo', $route); - $this->assertEquals(array('foo' => $route), $collection->all(), '->add() adds a route'); - $this->assertEquals($route, $collection->get('foo'), '->get() returns a route by name'); - $this->assertNull($collection->get('bar'), '->get() returns null if a route does not exist'); - } - - public function testOverriddenRoute() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - $collection->add('foo', new Route('/foo1')); - - $this->assertEquals('/foo1', $collection->get('foo')->getPath()); - } - - public function testDeepOverriddenRoute() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('foo', new Route('/foo1')); - - $collection2 = new RouteCollection(); - $collection2->add('foo', new Route('/foo2')); - - $collection1->addCollection($collection2); - $collection->addCollection($collection1); - - $this->assertEquals('/foo2', $collection1->get('foo')->getPath()); - $this->assertEquals('/foo2', $collection->get('foo')->getPath()); - } - - public function testIterator() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('bar', $bar = new Route('/bar')); - $collection1->add('foo', $foo = new Route('/foo-new')); - $collection->addCollection($collection1); - $collection->add('last', $last = new Route('/last')); - - $this->assertInstanceOf('\ArrayIterator', $collection->getIterator()); - $this->assertSame(array('bar' => $bar, 'foo' => $foo, 'last' => $last), $collection->getIterator()->getArrayCopy()); - } - - public function testCount() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('bar', new Route('/bar')); - $collection->addCollection($collection1); - - $this->assertCount(2, $collection); - } - - public function testAddCollection() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('bar', $bar = new Route('/bar')); - $collection1->add('foo', $foo = new Route('/foo-new')); - - $collection2 = new RouteCollection(); - $collection2->add('grandchild', $grandchild = new Route('/grandchild')); - - $collection1->addCollection($collection2); - $collection->addCollection($collection1); - $collection->add('last', $last = new Route('/last')); - - $this->assertSame(array('bar' => $bar, 'foo' => $foo, 'grandchild' => $grandchild, 'last' => $last), $collection->all(), - '->addCollection() imports routes of another collection, overrides if necessary and adds them at the end'); - } - - public function testAddCollectionWithResources() - { - $collection = new RouteCollection(); - $collection->addResource($foo = new FileResource(__DIR__.'/Fixtures/foo.xml')); - $collection1 = new RouteCollection(); - $collection1->addResource($foo1 = new FileResource(__DIR__.'/Fixtures/foo1.xml')); - $collection->addCollection($collection1); - $this->assertEquals(array($foo, $foo1), $collection->getResources(), '->addCollection() merges resources'); - } - - public function testAddDefaultsAndRequirementsAndOptions() - { - $collection = new RouteCollection(); - $collection->add('foo', new Route('/{placeholder}')); - $collection1 = new RouteCollection(); - $collection1->add('bar', new Route('/{placeholder}', - array('_controller' => 'fixed', 'placeholder' => 'default'), array('placeholder' => '.+'), array('option' => 'value')) - ); - $collection->addCollection($collection1); - - $collection->addDefaults(array('placeholder' => 'new-default')); - $this->assertEquals(array('placeholder' => 'new-default'), $collection->get('foo')->getDefaults(), '->addDefaults() adds defaults to all routes'); - $this->assertEquals(array('_controller' => 'fixed', 'placeholder' => 'new-default'), $collection->get('bar')->getDefaults(), - '->addDefaults() adds defaults to all routes and overwrites existing ones'); - - $collection->addRequirements(array('placeholder' => '\d+')); - $this->assertEquals(array('placeholder' => '\d+'), $collection->get('foo')->getRequirements(), '->addRequirements() adds requirements to all routes'); - $this->assertEquals(array('placeholder' => '\d+'), $collection->get('bar')->getRequirements(), - '->addRequirements() adds requirements to all routes and overwrites existing ones'); - - $collection->addOptions(array('option' => 'new-value')); - $this->assertEquals( - array('option' => 'new-value', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), - $collection->get('bar')->getOptions(), '->addOptions() adds options to all routes and overwrites existing ones' - ); - } - - public function testAddPrefix() - { - $collection = new RouteCollection(); - $collection->add('foo', $foo = new Route('/foo')); - $collection2 = new RouteCollection(); - $collection2->add('bar', $bar = new Route('/bar')); - $collection->addCollection($collection2); - $collection->addPrefix(' / '); - $this->assertSame('/foo', $collection->get('foo')->getPath(), '->addPrefix() trims the prefix and a single slash has no effect'); - $collection->addPrefix('/{admin}', array('admin' => 'admin'), array('admin' => '\d+')); - $this->assertEquals('/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() adds a prefix to all routes'); - $this->assertEquals('/{admin}/bar', $collection->get('bar')->getPath(), '->addPrefix() adds a prefix to all routes'); - $this->assertEquals(array('admin' => 'admin'), $collection->get('foo')->getDefaults(), '->addPrefix() adds defaults to all routes'); - $this->assertEquals(array('admin' => 'admin'), $collection->get('bar')->getDefaults(), '->addPrefix() adds defaults to all routes'); - $this->assertEquals(array('admin' => '\d+'), $collection->get('foo')->getRequirements(), '->addPrefix() adds requirements to all routes'); - $this->assertEquals(array('admin' => '\d+'), $collection->get('bar')->getRequirements(), '->addPrefix() adds requirements to all routes'); - $collection->addPrefix('0'); - $this->assertEquals('/0/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() ensures a prefix must start with a slash and must not end with a slash'); - $collection->addPrefix('/ /'); - $this->assertSame('/ /0/{admin}/foo', $collection->get('foo')->getPath(), '->addPrefix() can handle spaces if desired'); - $this->assertSame('/ /0/{admin}/bar', $collection->get('bar')->getPath(), 'the route pattern of an added collection is in synch with the added prefix'); - } - - public function testAddPrefixOverridesDefaultsAndRequirements() - { - $collection = new RouteCollection(); - $collection->add('foo', $foo = new Route('/foo.{_format}')); - $collection->add('bar', $bar = new Route('/bar.{_format}', array(), array('_format' => 'json'))); - $collection->addPrefix('/admin', array(), array('_format' => 'html')); - - $this->assertEquals('html', $collection->get('foo')->getRequirement('_format'), '->addPrefix() overrides existing requirements'); - $this->assertEquals('html', $collection->get('bar')->getRequirement('_format'), '->addPrefix() overrides existing requirements'); - } - - public function testResource() - { - $collection = new RouteCollection(); - $collection->addResource($foo = new FileResource(__DIR__.'/Fixtures/foo.xml')); - $collection->addResource($bar = new FileResource(__DIR__.'/Fixtures/bar.xml')); - $collection->addResource(new FileResource(__DIR__.'/Fixtures/foo.xml')); - - $this->assertEquals(array($foo, $bar), $collection->getResources(), - '->addResource() adds a resource and getResources() only returns unique ones by comparing the string representation'); - } - - public function testUniqueRouteWithGivenName() - { - $collection1 = new RouteCollection(); - $collection1->add('foo', new Route('/old')); - $collection2 = new RouteCollection(); - $collection3 = new RouteCollection(); - $collection3->add('foo', $new = new Route('/new')); - - $collection2->addCollection($collection3); - $collection1->addCollection($collection2); - - $this->assertSame($new, $collection1->get('foo'), '->get() returns new route that overrode previous one'); - // size of 1 because collection1 contains /new but not /old anymore - $this->assertCount(1, $collection1->getIterator(), '->addCollection() removes previous routes when adding new routes with the same name'); - } - - public function testGet() - { - $collection1 = new RouteCollection(); - $collection1->add('a', $a = new Route('/a')); - $collection2 = new RouteCollection(); - $collection2->add('b', $b = new Route('/b')); - $collection1->addCollection($collection2); - $collection1->add('$péß^a|', $c = new Route('/special')); - - $this->assertSame($b, $collection1->get('b'), '->get() returns correct route in child collection'); - $this->assertSame($c, $collection1->get('$péß^a|'), '->get() can handle special characters'); - $this->assertNull($collection2->get('a'), '->get() does not return the route defined in parent collection'); - $this->assertNull($collection1->get('non-existent'), '->get() returns null when route does not exist'); - $this->assertNull($collection1->get(0), '->get() does not disclose internal child RouteCollection'); - } - - public function testRemove() - { - $collection = new RouteCollection(); - $collection->add('foo', $foo = new Route('/foo')); - - $collection1 = new RouteCollection(); - $collection1->add('bar', $bar = new Route('/bar')); - $collection->addCollection($collection1); - $collection->add('last', $last = new Route('/last')); - - $collection->remove('foo'); - $this->assertSame(array('bar' => $bar, 'last' => $last), $collection->all(), '->remove() can remove a single route'); - $collection->remove(array('bar', 'last')); - $this->assertSame(array(), $collection->all(), '->remove() accepts an array and can remove multiple routes at once'); - } - - public function testSetHost() - { - $collection = new RouteCollection(); - $routea = new Route('/a'); - $routeb = new Route('/b', array(), array(), array(), '{locale}.example.net'); - $collection->add('a', $routea); - $collection->add('b', $routeb); - - $collection->setHost('{locale}.example.com'); - - $this->assertEquals('{locale}.example.com', $routea->getHost()); - $this->assertEquals('{locale}.example.com', $routeb->getHost()); - } - - public function testSetCondition() - { - $collection = new RouteCollection(); - $routea = new Route('/a'); - $routeb = new Route('/b', array(), array(), array(), '{locale}.example.net', array(), array(), 'context.getMethod() == "GET"'); - $collection->add('a', $routea); - $collection->add('b', $routeb); - - $collection->setCondition('context.getMethod() == "POST"'); - - $this->assertEquals('context.getMethod() == "POST"', $routea->getCondition()); - $this->assertEquals('context.getMethod() == "POST"', $routeb->getCondition()); - } - - public function testClone() - { - $collection = new RouteCollection(); - $collection->add('a', new Route('/a')); - $collection->add('b', new Route('/b', array('placeholder' => 'default'), array('placeholder' => '.+'))); - - $clonedCollection = clone $collection; - - $this->assertCount(2, $clonedCollection); - $this->assertEquals($collection->get('a'), $clonedCollection->get('a')); - $this->assertNotSame($collection->get('a'), $clonedCollection->get('a')); - $this->assertEquals($collection->get('b'), $clonedCollection->get('b')); - $this->assertNotSame($collection->get('b'), $clonedCollection->get('b')); - } - - public function testSetSchemes() - { - $collection = new RouteCollection(); - $routea = new Route('/a', array(), array(), array(), '', 'http'); - $routeb = new Route('/b'); - $collection->add('a', $routea); - $collection->add('b', $routeb); - - $collection->setSchemes(array('http', 'https')); - - $this->assertEquals(array('http', 'https'), $routea->getSchemes()); - $this->assertEquals(array('http', 'https'), $routeb->getSchemes()); - } - - public function testSetMethods() - { - $collection = new RouteCollection(); - $routea = new Route('/a', array(), array(), array(), '', array(), array('GET', 'POST')); - $routeb = new Route('/b'); - $collection->add('a', $routea); - $collection->add('b', $routeb); - - $collection->setMethods('PUT'); - - $this->assertEquals(array('PUT'), $routea->getMethods()); - $this->assertEquals(array('PUT'), $routeb->getMethods()); - } -} diff --git a/vendor/symfony/routing/Tests/RouteCompilerTest.php b/vendor/symfony/routing/Tests/RouteCompilerTest.php deleted file mode 100644 index 54006d7..0000000 --- a/vendor/symfony/routing/Tests/RouteCompilerTest.php +++ /dev/null @@ -1,389 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCompiler; - -class RouteCompilerTest extends TestCase -{ - /** - * @dataProvider provideCompileData - */ - public function testCompile($name, $arguments, $prefix, $regex, $variables, $tokens) - { - $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route'); - $route = $r->newInstanceArgs($arguments); - - $compiled = $route->compile(); - $this->assertEquals($prefix, $compiled->getStaticPrefix(), $name.' (static prefix)'); - $this->assertEquals($regex, $compiled->getRegex(), $name.' (regex)'); - $this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)'); - $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); - } - - public function provideCompileData() - { - return array( - array( - 'Static route', - array('/foo'), - '/foo', '#^/foo$#s', array(), array( - array('text', '/foo'), - ), - ), - - array( - 'Route with a variable', - array('/foo/{bar}'), - '/foo', '#^/foo/(?P[^/]++)$#s', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with a variable that has a default value', - array('/foo/{bar}', array('bar' => 'bar')), - '/foo', '#^/foo(?:/(?P[^/]++))?$#s', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with several variables', - array('/foo/{bar}/{foobar}'), - '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with several variables that have default values', - array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => '')), - '/foo', '#^/foo(?:/(?P[^/]++)(?:/(?P[^/]++))?)?$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with several variables but some of them have no default values', - array('/foo/{bar}/{foobar}', array('bar' => 'bar')), - '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]++', 'foobar'), - array('variable', '/', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with an optional variable as the first segment', - array('/{bar}', array('bar' => 'bar')), - '', '#^/(?P[^/]++)?$#s', array('bar'), array( - array('variable', '/', '[^/]++', 'bar'), - ), - ), - - array( - 'Route with a requirement of 0', - array('/{bar}', array('bar' => null), array('bar' => '0')), - '', '#^/(?P0)?$#s', array('bar'), array( - array('variable', '/', '0', 'bar'), - ), - ), - - array( - 'Route with an optional variable as the first segment with requirements', - array('/{bar}', array('bar' => 'bar'), array('bar' => '(foo|bar)')), - '', '#^/(?P(foo|bar))?$#s', array('bar'), array( - array('variable', '/', '(foo|bar)', 'bar'), - ), - ), - - array( - 'Route with only optional variables', - array('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar')), - '', '#^/(?P[^/]++)?(?:/(?P[^/]++))?$#s', array('foo', 'bar'), array( - array('variable', '/', '[^/]++', 'bar'), - array('variable', '/', '[^/]++', 'foo'), - ), - ), - - array( - 'Route with a variable in last position', - array('/foo-{bar}'), - '/foo-', '#^/foo\-(?P[^/]++)$#s', array('bar'), array( - array('variable', '-', '[^/]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Route with nested placeholders', - array('/{static{var}static}'), - '/{static', '#^/\{static(?P[^/]+)static\}$#s', array('var'), array( - array('text', 'static}'), - array('variable', '', '[^/]+', 'var'), - array('text', '/{static'), - ), - ), - - array( - 'Route without separator between variables', - array('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '(y|Y)')), - '', '#^/(?P[^/\.]+)(?P[^/\.]+)(?P(y|Y))(?:(?P[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#s', array('w', 'x', 'y', 'z', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '', '[^/\.]++', 'z'), - array('variable', '', '(y|Y)', 'y'), - array('variable', '', '[^/\.]+', 'x'), - array('variable', '/', '[^/\.]+', 'w'), - ), - ), - - array( - 'Route with a format', - array('/foo/{bar}.{_format}'), - '/foo', '#^/foo/(?P[^/\.]++)\.(?P<_format>[^/]++)$#s', array('bar', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '/', '[^/\.]++', 'bar'), - array('text', '/foo'), - ), - ), - - array( - 'Static non UTF-8 route', - array("/fo\xE9"), - "/fo\xE9", "#^/fo\xE9$#s", array(), array( - array('text', "/fo\xE9"), - ), - ), - - array( - 'Route with an explicit UTF-8 requirement', - array('/{bar}', array('bar' => null), array('bar' => '.'), array('utf8' => true)), - '', '#^/(?P.)?$#su', array('bar'), array( - array('variable', '/', '.', 'bar', true), - ), - ), - ); - } - - /** - * @group legacy - * @dataProvider provideCompileImplicitUtf8Data - * @expectedDeprecation Using UTF-8 route %s without setting the "utf8" option is deprecated %s. - */ - public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $variables, $tokens, $deprecationType) - { - $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route'); - $route = $r->newInstanceArgs($arguments); - - $compiled = $route->compile(); - $this->assertEquals($prefix, $compiled->getStaticPrefix(), $name.' (static prefix)'); - $this->assertEquals($regex, $compiled->getRegex(), $name.' (regex)'); - $this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)'); - $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); - } - - public function provideCompileImplicitUtf8Data() - { - return array( - array( - 'Static UTF-8 route', - array('/foé'), - '/foé', '#^/foé$#su', array(), array( - array('text', '/foé'), - ), - 'patterns', - ), - - array( - 'Route with an implicit UTF-8 requirement', - array('/{bar}', array('bar' => null), array('bar' => 'é')), - '', '#^/(?Pé)?$#su', array('bar'), array( - array('variable', '/', 'é', 'bar', true), - ), - 'requirements', - ), - - array( - 'Route with a UTF-8 class requirement', - array('/{bar}', array('bar' => null), array('bar' => '\pM')), - '', '#^/(?P\pM)?$#su', array('bar'), array( - array('variable', '/', '\pM', 'bar', true), - ), - 'requirements', - ), - - array( - 'Route with a UTF-8 separator', - array('/foo/{bar}§{_format}', array(), array(), array('compiler_class' => Utf8RouteCompiler::class)), - '/foo', '#^/foo/(?P[^/§]++)§(?P<_format>[^/]++)$#su', array('bar', '_format'), array( - array('variable', '§', '[^/]++', '_format', true), - array('variable', '/', '[^/§]++', 'bar', true), - array('text', '/foo'), - ), - 'patterns', - ), - ); - } - - /** - * @expectedException \LogicException - */ - public function testRouteWithSameVariableTwice() - { - $route = new Route('/{name}/{name}'); - - $compiled = $route->compile(); - } - - /** - * @expectedException \LogicException - */ - public function testRouteCharsetMismatch() - { - $route = new Route("/\xE9/{bar}", array(), array('bar' => '.'), array('utf8' => true)); - - $compiled = $route->compile(); - } - - /** - * @expectedException \LogicException - */ - public function testRequirementCharsetMismatch() - { - $route = new Route('/foo/{bar}', array(), array('bar' => "\xE9"), array('utf8' => true)); - - $compiled = $route->compile(); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRouteWithFragmentAsPathParameter() - { - $route = new Route('/{_fragment}'); - - $compiled = $route->compile(); - } - - /** - * @dataProvider getVariableNamesStartingWithADigit - * @expectedException \DomainException - */ - public function testRouteWithVariableNameStartingWithADigit($name) - { - $route = new Route('/{'.$name.'}'); - $route->compile(); - } - - public function getVariableNamesStartingWithADigit() - { - return array( - array('09'), - array('123'), - array('1e2'), - ); - } - - /** - * @dataProvider provideCompileWithHostData - */ - public function testCompileWithHost($name, $arguments, $prefix, $regex, $variables, $pathVariables, $tokens, $hostRegex, $hostVariables, $hostTokens) - { - $r = new \ReflectionClass('Symfony\\Component\\Routing\\Route'); - $route = $r->newInstanceArgs($arguments); - - $compiled = $route->compile(); - $this->assertEquals($prefix, $compiled->getStaticPrefix(), $name.' (static prefix)'); - $this->assertEquals($regex, str_replace(array("\n", ' '), '', $compiled->getRegex()), $name.' (regex)'); - $this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)'); - $this->assertEquals($pathVariables, $compiled->getPathVariables(), $name.' (path variables)'); - $this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)'); - $this->assertEquals($hostRegex, str_replace(array("\n", ' '), '', $compiled->getHostRegex()), $name.' (host regex)'); - $this->assertEquals($hostVariables, $compiled->getHostVariables(), $name.' (host variables)'); - $this->assertEquals($hostTokens, $compiled->getHostTokens(), $name.' (host tokens)'); - } - - public function provideCompileWithHostData() - { - return array( - array( - 'Route with host pattern', - array('/hello', array(), array(), array(), 'www.example.com'), - '/hello', '#^/hello$#s', array(), array(), array( - array('text', '/hello'), - ), - '#^www\.example\.com$#si', array(), array( - array('text', 'www.example.com'), - ), - ), - array( - 'Route with host pattern and some variables', - array('/hello/{name}', array(), array(), array(), 'www.example.{tld}'), - '/hello', '#^/hello/(?P[^/]++)$#s', array('tld', 'name'), array('name'), array( - array('variable', '/', '[^/]++', 'name'), - array('text', '/hello'), - ), - '#^www\.example\.(?P[^\.]++)$#si', array('tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', 'www.example'), - ), - ), - array( - 'Route with variable at beginning of host', - array('/hello', array(), array(), array(), '{locale}.example.{tld}'), - '/hello', '#^/hello$#s', array('locale', 'tld'), array(), array( - array('text', '/hello'), - ), - '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#si', array('locale', 'tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', '.example'), - array('variable', '', '[^\.]++', 'locale'), - ), - ), - array( - 'Route with host variables that has a default value', - array('/hello', array('locale' => 'a', 'tld' => 'b'), array(), array(), '{locale}.example.{tld}'), - '/hello', '#^/hello$#s', array('locale', 'tld'), array(), array( - array('text', '/hello'), - ), - '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#si', array('locale', 'tld'), array( - array('variable', '.', '[^\.]++', 'tld'), - array('text', '.example'), - array('variable', '', '[^\.]++', 'locale'), - ), - ), - ); - } - - /** - * @expectedException \DomainException - */ - public function testRouteWithTooLongVariableName() - { - $route = new Route(sprintf('/{%s}', str_repeat('a', RouteCompiler::VARIABLE_MAXIMUM_LENGTH + 1))); - $route->compile(); - } -} - -class Utf8RouteCompiler extends RouteCompiler -{ - const SEPARATORS = '/§'; -} diff --git a/vendor/symfony/routing/Tests/RouteTest.php b/vendor/symfony/routing/Tests/RouteTest.php deleted file mode 100644 index ff7e320..0000000 --- a/vendor/symfony/routing/Tests/RouteTest.php +++ /dev/null @@ -1,258 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Route; - -class RouteTest extends TestCase -{ - public function testConstructor() - { - $route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'), '{locale}.example.com'); - $this->assertEquals('/{foo}', $route->getPath(), '__construct() takes a path as its first argument'); - $this->assertEquals(array('foo' => 'bar'), $route->getDefaults(), '__construct() takes defaults as its second argument'); - $this->assertEquals(array('foo' => '\d+'), $route->getRequirements(), '__construct() takes requirements as its third argument'); - $this->assertEquals('bar', $route->getOption('foo'), '__construct() takes options as its fourth argument'); - $this->assertEquals('{locale}.example.com', $route->getHost(), '__construct() takes a host pattern as its fifth argument'); - - $route = new Route('/', array(), array(), array(), '', array('Https'), array('POST', 'put'), 'context.getMethod() == "GET"'); - $this->assertEquals(array('https'), $route->getSchemes(), '__construct() takes schemes as its sixth argument and lowercases it'); - $this->assertEquals(array('POST', 'PUT'), $route->getMethods(), '__construct() takes methods as its seventh argument and uppercases it'); - $this->assertEquals('context.getMethod() == "GET"', $route->getCondition(), '__construct() takes a condition as its eight argument'); - - $route = new Route('/', array(), array(), array(), '', 'Https', 'Post'); - $this->assertEquals(array('https'), $route->getSchemes(), '__construct() takes a single scheme as its sixth argument'); - $this->assertEquals(array('POST'), $route->getMethods(), '__construct() takes a single method as its seventh argument'); - } - - public function testPath() - { - $route = new Route('/{foo}'); - $route->setPath('/{bar}'); - $this->assertEquals('/{bar}', $route->getPath(), '->setPath() sets the path'); - $route->setPath(''); - $this->assertEquals('/', $route->getPath(), '->setPath() adds a / at the beginning of the path if needed'); - $route->setPath('bar'); - $this->assertEquals('/bar', $route->getPath(), '->setPath() adds a / at the beginning of the path if needed'); - $this->assertEquals($route, $route->setPath(''), '->setPath() implements a fluent interface'); - $route->setPath('//path'); - $this->assertEquals('/path', $route->getPath(), '->setPath() does not allow two slashes "//" at the beginning of the path as it would be confused with a network path when generating the path from the route'); - } - - public function testOptions() - { - $route = new Route('/{foo}'); - $route->setOptions(array('foo' => 'bar')); - $this->assertEquals(array_merge(array( - 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options'); - $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface'); - - $route->setOptions(array('foo' => 'foo')); - $route->addOptions(array('bar' => 'bar')); - $this->assertEquals($route, $route->addOptions(array()), '->addOptions() implements a fluent interface'); - $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), $route->getOptions(), '->addDefaults() keep previous defaults'); - } - - public function testOption() - { - $route = new Route('/{foo}'); - $this->assertFalse($route->hasOption('foo'), '->hasOption() return false if option is not set'); - $this->assertEquals($route, $route->setOption('foo', 'bar'), '->setOption() implements a fluent interface'); - $this->assertEquals('bar', $route->getOption('foo'), '->setOption() sets the option'); - $this->assertTrue($route->hasOption('foo'), '->hasOption() return true if option is set'); - } - - public function testDefaults() - { - $route = new Route('/{foo}'); - $route->setDefaults(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $route->getDefaults(), '->setDefaults() sets the defaults'); - $this->assertEquals($route, $route->setDefaults(array()), '->setDefaults() implements a fluent interface'); - - $route->setDefault('foo', 'bar'); - $this->assertEquals('bar', $route->getDefault('foo'), '->setDefault() sets a default value'); - - $route->setDefault('foo2', 'bar2'); - $this->assertEquals('bar2', $route->getDefault('foo2'), '->getDefault() return the default value'); - $this->assertNull($route->getDefault('not_defined'), '->getDefault() return null if default value is not set'); - - $route->setDefault('_controller', $closure = function () { return 'Hello'; }); - $this->assertEquals($closure, $route->getDefault('_controller'), '->setDefault() sets a default value'); - - $route->setDefaults(array('foo' => 'foo')); - $route->addDefaults(array('bar' => 'bar')); - $this->assertEquals($route, $route->addDefaults(array()), '->addDefaults() implements a fluent interface'); - $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar'), $route->getDefaults(), '->addDefaults() keep previous defaults'); - } - - public function testRequirements() - { - $route = new Route('/{foo}'); - $route->setRequirements(array('foo' => '\d+')); - $this->assertEquals(array('foo' => '\d+'), $route->getRequirements(), '->setRequirements() sets the requirements'); - $this->assertEquals('\d+', $route->getRequirement('foo'), '->getRequirement() returns a requirement'); - $this->assertNull($route->getRequirement('bar'), '->getRequirement() returns null if a requirement is not defined'); - $route->setRequirements(array('foo' => '^\d+$')); - $this->assertEquals('\d+', $route->getRequirement('foo'), '->getRequirement() removes ^ and $ from the path'); - $this->assertEquals($route, $route->setRequirements(array()), '->setRequirements() implements a fluent interface'); - - $route->setRequirements(array('foo' => '\d+')); - $route->addRequirements(array('bar' => '\d+')); - $this->assertEquals($route, $route->addRequirements(array()), '->addRequirements() implements a fluent interface'); - $this->assertEquals(array('foo' => '\d+', 'bar' => '\d+'), $route->getRequirements(), '->addRequirement() keep previous requirements'); - } - - public function testRequirement() - { - $route = new Route('/{foo}'); - $this->assertFalse($route->hasRequirement('foo'), '->hasRequirement() return false if requirement is not set'); - $route->setRequirement('foo', '^\d+$'); - $this->assertEquals('\d+', $route->getRequirement('foo'), '->setRequirement() removes ^ and $ from the path'); - $this->assertTrue($route->hasRequirement('foo'), '->hasRequirement() return true if requirement is set'); - } - - /** - * @dataProvider getInvalidRequirements - * @expectedException \InvalidArgumentException - */ - public function testSetInvalidRequirement($req) - { - $route = new Route('/{foo}'); - $route->setRequirement('foo', $req); - } - - public function getInvalidRequirements() - { - return array( - array(''), - array(array()), - array('^$'), - array('^'), - array('$'), - ); - } - - public function testHost() - { - $route = new Route('/'); - $route->setHost('{locale}.example.net'); - $this->assertEquals('{locale}.example.net', $route->getHost(), '->setHost() sets the host pattern'); - } - - public function testScheme() - { - $route = new Route('/'); - $this->assertEquals(array(), $route->getSchemes(), 'schemes is initialized with array()'); - $this->assertFalse($route->hasScheme('http')); - $route->setSchemes('hTTp'); - $this->assertEquals(array('http'), $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it'); - $this->assertTrue($route->hasScheme('htTp')); - $this->assertFalse($route->hasScheme('httpS')); - $route->setSchemes(array('HttpS', 'hTTp')); - $this->assertEquals(array('https', 'http'), $route->getSchemes(), '->setSchemes() accepts an array of schemes and lowercases them'); - $this->assertTrue($route->hasScheme('htTp')); - $this->assertTrue($route->hasScheme('httpS')); - } - - public function testMethod() - { - $route = new Route('/'); - $this->assertEquals(array(), $route->getMethods(), 'methods is initialized with array()'); - $route->setMethods('gEt'); - $this->assertEquals(array('GET'), $route->getMethods(), '->setMethods() accepts a single method string and uppercases it'); - $route->setMethods(array('gEt', 'PosT')); - $this->assertEquals(array('GET', 'POST'), $route->getMethods(), '->setMethods() accepts an array of methods and uppercases them'); - } - - public function testCondition() - { - $route = new Route('/'); - $this->assertSame('', $route->getCondition()); - $route->setCondition('context.getMethod() == "GET"'); - $this->assertSame('context.getMethod() == "GET"', $route->getCondition()); - } - - public function testCompile() - { - $route = new Route('/{foo}'); - $this->assertInstanceOf('Symfony\Component\Routing\CompiledRoute', $compiled = $route->compile(), '->compile() returns a compiled route'); - $this->assertSame($compiled, $route->compile(), '->compile() only compiled the route once if unchanged'); - $route->setRequirement('foo', '.*'); - $this->assertNotSame($compiled, $route->compile(), '->compile() recompiles if the route was modified'); - } - - public function testSerialize() - { - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); - - $serialized = serialize($route); - $unserialized = unserialize($serialized); - - $this->assertEquals($route, $unserialized); - $this->assertNotSame($route, $unserialized); - } - - /** - * Tests that the compiled version is also serialized to prevent the overhead - * of compiling it again after unserialize. - */ - public function testSerializeWhenCompiled() - { - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); - $route->setHost('{locale}.example.net'); - $route->compile(); - - $serialized = serialize($route); - $unserialized = unserialize($serialized); - - $this->assertEquals($route, $unserialized); - $this->assertNotSame($route, $unserialized); - } - - /** - * Tests that unserialization does not fail when the compiled Route is of a - * class other than CompiledRoute, such as a subclass of it. - */ - public function testSerializeWhenCompiledWithClass() - { - $route = new Route('/', array(), array(), array('compiler_class' => '\Symfony\Component\Routing\Tests\Fixtures\CustomRouteCompiler')); - $this->assertInstanceOf('\Symfony\Component\Routing\Tests\Fixtures\CustomCompiledRoute', $route->compile(), '->compile() returned a proper route'); - - $serialized = serialize($route); - try { - $unserialized = unserialize($serialized); - $this->assertInstanceOf('\Symfony\Component\Routing\Tests\Fixtures\CustomCompiledRoute', $unserialized->compile(), 'the unserialized route compiled successfully'); - } catch (\Exception $e) { - $this->fail('unserializing a route which uses a custom compiled route class'); - } - } - - /** - * Tests that the serialized representation of a route in one symfony version - * also works in later symfony versions, i.e. the unserialized route is in the - * same state as another, semantically equivalent, route. - */ - public function testSerializedRepresentationKeepsWorking() - { - $serialized = 'C:31:"Symfony\Component\Routing\Route":934:{a:8:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:8:"compiled";C:39:"Symfony\Component\Routing\CompiledRoute":569:{a:8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:30:"#^/prefix(?:/(?P\d+))?$#s";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:39:"#^(?P[^\.]++)\.example\.net$#si";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}}}'; - $unserialized = unserialize($serialized); - - $route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+')); - $route->setHost('{locale}.example.net'); - $route->compile(); - - $this->assertEquals($route, $unserialized); - $this->assertNotSame($route, $unserialized); - } -} diff --git a/vendor/symfony/routing/Tests/RouterTest.php b/vendor/symfony/routing/Tests/RouterTest.php deleted file mode 100644 index 409959e..0000000 --- a/vendor/symfony/routing/Tests/RouterTest.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Router; -use Symfony\Component\HttpFoundation\Request; - -class RouterTest extends TestCase -{ - private $router = null; - - private $loader = null; - - protected function setUp() - { - $this->loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $this->router = new Router($this->loader, 'routing.yml'); - } - - public function testSetOptionsWithSupportedOptions() - { - $this->router->setOptions(array( - 'cache_dir' => './cache', - 'debug' => true, - 'resource_type' => 'ResourceType', - )); - - $this->assertSame('./cache', $this->router->getOption('cache_dir')); - $this->assertTrue($this->router->getOption('debug')); - $this->assertSame('ResourceType', $this->router->getOption('resource_type')); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The Router does not support the following options: "option_foo", "option_bar" - */ - public function testSetOptionsWithUnsupportedOptions() - { - $this->router->setOptions(array( - 'cache_dir' => './cache', - 'option_foo' => true, - 'option_bar' => 'baz', - 'resource_type' => 'ResourceType', - )); - } - - public function testSetOptionWithSupportedOption() - { - $this->router->setOption('cache_dir', './cache'); - - $this->assertSame('./cache', $this->router->getOption('cache_dir')); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The Router does not support the "option_foo" option - */ - public function testSetOptionWithUnsupportedOption() - { - $this->router->setOption('option_foo', true); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The Router does not support the "option_foo" option - */ - public function testGetOptionWithUnsupportedOption() - { - $this->router->getOption('option_foo', true); - } - - public function testThatRouteCollectionIsLoaded() - { - $this->router->setOption('resource_type', 'ResourceType'); - - $routeCollection = $this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock(); - - $this->loader->expects($this->once()) - ->method('load')->with('routing.yml', 'ResourceType') - ->will($this->returnValue($routeCollection)); - - $this->assertSame($routeCollection, $this->router->getRouteCollection()); - } - - /** - * @dataProvider provideMatcherOptionsPreventingCaching - */ - public function testMatcherIsCreatedIfCacheIsNotConfigured($option) - { - $this->router->setOption($option, null); - - $this->loader->expects($this->once()) - ->method('load')->with('routing.yml', null) - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock())); - - $this->assertInstanceOf('Symfony\\Component\\Routing\\Matcher\\UrlMatcher', $this->router->getMatcher()); - } - - public function provideMatcherOptionsPreventingCaching() - { - return array( - array('cache_dir'), - array('matcher_cache_class'), - ); - } - - /** - * @dataProvider provideGeneratorOptionsPreventingCaching - */ - public function testGeneratorIsCreatedIfCacheIsNotConfigured($option) - { - $this->router->setOption($option, null); - - $this->loader->expects($this->once()) - ->method('load')->with('routing.yml', null) - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock())); - - $this->assertInstanceOf('Symfony\\Component\\Routing\\Generator\\UrlGenerator', $this->router->getGenerator()); - } - - public function provideGeneratorOptionsPreventingCaching() - { - return array( - array('cache_dir'), - array('generator_cache_class'), - ); - } - - public function testMatchRequestWithUrlMatcherInterface() - { - $matcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\UrlMatcherInterface')->getMock(); - $matcher->expects($this->once())->method('match'); - - $p = new \ReflectionProperty($this->router, 'matcher'); - $p->setAccessible(true); - $p->setValue($this->router, $matcher); - - $this->router->matchRequest(Request::create('/')); - } - - public function testMatchRequestWithRequestMatcherInterface() - { - $matcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); - $matcher->expects($this->once())->method('matchRequest'); - - $p = new \ReflectionProperty($this->router, 'matcher'); - $p->setAccessible(true); - $p->setValue($this->router, $matcher); - - $this->router->matchRequest(Request::create('/')); - } -} diff --git a/vendor/symfony/routing/composer.json b/vendor/symfony/routing/composer.json deleted file mode 100644 index bb4f6a5..0000000 --- a/vendor/symfony/routing/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "symfony/routing", - "type": "library", - "description": "Symfony Routing Component", - "keywords": ["routing", "router", "URL", "URI"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/config": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0", - "symfony/yaml": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.3", - "symfony/yaml": "<3.3" - }, - "suggest": { - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/yaml": "For using the YAML loader", - "symfony/expression-language": "For using expression matching", - "doctrine/annotations": "For using the annotation loader", - "symfony/dependency-injection": "For loading routes from a service" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Routing\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/routing/phpunit.xml.dist b/vendor/symfony/routing/phpunit.xml.dist deleted file mode 100644 index bcc0959..0000000 --- a/vendor/symfony/routing/phpunit.xml.dist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - - diff --git a/vendor/symfony/twig-bridge/.gitignore b/vendor/symfony/twig-bridge/.gitignore deleted file mode 100644 index c49a5d8..0000000 --- a/vendor/symfony/twig-bridge/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/vendor/symfony/twig-bridge/AppVariable.php b/vendor/symfony/twig-bridge/AppVariable.php deleted file mode 100644 index e8e69d0..0000000 --- a/vendor/symfony/twig-bridge/AppVariable.php +++ /dev/null @@ -1,184 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; - -/** - * Exposes some Symfony parameters and services as an "app" global variable. - * - * @author Fabien Potencier - */ -class AppVariable -{ - private $tokenStorage; - private $requestStack; - private $environment; - private $debug; - - public function setTokenStorage(TokenStorageInterface $tokenStorage) - { - $this->tokenStorage = $tokenStorage; - } - - public function setRequestStack(RequestStack $requestStack) - { - $this->requestStack = $requestStack; - } - - public function setEnvironment($environment) - { - $this->environment = $environment; - } - - public function setDebug($debug) - { - $this->debug = (bool) $debug; - } - - /** - * Returns the current token. - * - * @return TokenInterface|null - * - * @throws \RuntimeException When the TokenStorage is not available - */ - public function getToken() - { - if (null === $tokenStorage = $this->tokenStorage) { - throw new \RuntimeException('The "app.token" variable is not available.'); - } - - return $tokenStorage->getToken(); - } - - /** - * Returns the current user. - * - * @return mixed - * - * @see TokenInterface::getUser() - */ - public function getUser() - { - if (null === $tokenStorage = $this->tokenStorage) { - throw new \RuntimeException('The "app.user" variable is not available.'); - } - - if (!$token = $tokenStorage->getToken()) { - return; - } - - $user = $token->getUser(); - if (is_object($user)) { - return $user; - } - } - - /** - * Returns the current request. - * - * @return Request|null The HTTP request object - */ - public function getRequest() - { - if (null === $this->requestStack) { - throw new \RuntimeException('The "app.request" variable is not available.'); - } - - return $this->requestStack->getCurrentRequest(); - } - - /** - * Returns the current session. - * - * @return Session|null The session - */ - public function getSession() - { - if (null === $this->requestStack) { - throw new \RuntimeException('The "app.session" variable is not available.'); - } - - if ($request = $this->getRequest()) { - return $request->getSession(); - } - } - - /** - * Returns the current app environment. - * - * @return string The current environment string (e.g 'dev') - */ - public function getEnvironment() - { - if (null === $this->environment) { - throw new \RuntimeException('The "app.environment" variable is not available.'); - } - - return $this->environment; - } - - /** - * Returns the current app debug mode. - * - * @return bool The current debug mode - */ - public function getDebug() - { - if (null === $this->debug) { - throw new \RuntimeException('The "app.debug" variable is not available.'); - } - - return $this->debug; - } - - /** - * Returns some or all the existing flash messages: - * * getFlashes() returns all the flash messages - * * getFlashes('notice') returns a simple array with flash messages of that type - * * getFlashes(array('notice', 'error')) returns a nested array of type => messages. - * - * @return array - */ - public function getFlashes($types = null) - { - // needed to avoid starting the session automatically when looking for flash messages - try { - $session = $this->getSession(); - if (null === $session || !$session->isStarted()) { - return array(); - } - } catch (\RuntimeException $e) { - return array(); - } - - if (null === $types || '' === $types || array() === $types) { - return $session->getFlashBag()->all(); - } - - if (is_string($types)) { - return $session->getFlashBag()->get($types); - } - - $result = array(); - foreach ($types as $type) { - $result[$type] = $session->getFlashBag()->get($type); - } - - return $result; - } -} diff --git a/vendor/symfony/twig-bridge/CHANGELOG.md b/vendor/symfony/twig-bridge/CHANGELOG.md deleted file mode 100644 index b59d85e..0000000 --- a/vendor/symfony/twig-bridge/CHANGELOG.md +++ /dev/null @@ -1,90 +0,0 @@ -CHANGELOG -========= - -3.3.0 ------ - - * added a `workflow_has_marked_place` function - * added a `workflow_marked_places` function - -3.2.0 ------ - - * added `AppVariable::getToken()` - * Deprecated the possibility to inject the Form `TwigRenderer` into the `FormExtension`. - * [BC BREAK] Registering the `FormExtension` without configuring a runtime loader for the `TwigRenderer` - doesn't work anymore. - - Before: - - ```php - use Symfony\Bridge\Twig\Extension\FormExtension; - use Symfony\Bridge\Twig\Form\TwigRenderer; - use Symfony\Bridge\Twig\Form\TwigRendererEngine; - - // ... - $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig')); - $rendererEngine->setEnvironment($twig); - $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager))); - ``` - - After: - - ```php - // ... - $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig); - // require Twig 1.30+ - $twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader(array( - TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) { - return new TwigRenderer($rendererEngine, $csrfTokenManager); - }, - ))); - $twig->addExtension(new FormExtension()); - ``` - * Deprecated the `TwigRendererEngineInterface` interface. - * added WorkflowExtension (provides `workflow_can` and `workflow_transitions`) - -2.7.0 ------ - - * added LogoutUrlExtension (provides `logout_url` and `logout_path`) - * added an HttpFoundation extension (provides the `absolute_url` and the `relative_path` functions) - * added AssetExtension (provides the `asset` and `asset_version` functions) - * Added possibility to extract translation messages from a file or files besides extracting from a directory - -2.5.0 ------ - - * moved command `twig:lint` from `TwigBundle` - -2.4.0 ------ - - * added stopwatch tag to time templates with the WebProfilerBundle - -2.3.0 ------ - - * added helpers form(), form_start() and form_end() - * deprecated form_enctype() in favor of form_start() - -2.2.0 ------ - - * added a `controller` function to help generating controller references - * added a `render_esi` and a `render_hinclude` function - * [BC BREAK] restricted the `render` tag to only accept URIs or ControllerReference instances (the signature changed) - * added a `render` function to render a request - * The `app` global variable is now injected even when using the twig service directly. - * Added an optional parameter to the `path` and `url` function which allows to generate - relative paths (e.g. "../parent-file") and scheme-relative URLs (e.g. "//example.com/dir/file"). - -2.1.0 ------ - - * added global variables access in a form theme - * added TwigEngine - * added TwigExtractor - * added a csrf_token function - * added a way to specify a default domain for a Twig template (via the - 'trans_default_domain' tag) diff --git a/vendor/symfony/twig-bridge/Command/DebugCommand.php b/vendor/symfony/twig-bridge/Command/DebugCommand.php deleted file mode 100644 index 010404c..0000000 --- a/vendor/symfony/twig-bridge/Command/DebugCommand.php +++ /dev/null @@ -1,214 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Twig\Environment; - -/** - * Lists twig functions, filters, globals and tests present in the current project. - * - * @author Jordi Boggiano - */ -class DebugCommand extends Command -{ - private $twig; - - /** - * {@inheritdoc} - */ - public function __construct($name = 'debug:twig') - { - parent::__construct($name); - } - - public function setTwigEnvironment(Environment $twig) - { - $this->twig = $twig; - } - - /** - * @return Environment $twig - */ - protected function getTwigEnvironment() - { - return $this->twig; - } - - protected function configure() - { - $this - ->setDefinition(array( - new InputArgument('filter', InputArgument::OPTIONAL, 'Show details for all entries matching this filter'), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'), - )) - ->setDescription('Shows a list of twig functions, filters, globals and tests') - ->setHelp(<<<'EOF' -The %command.name% command outputs a list of twig functions, -filters, globals and tests. Output can be filtered with an optional argument. - - php %command.full_name% - -The command lists all functions, filters, etc. - - php %command.full_name% date - -The command lists everything that contains the word date. - - php %command.full_name% --format=json - -The command lists everything in a machine readable json format. -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new SymfonyStyle($input, $output); - $twig = $this->getTwigEnvironment(); - - if (null === $twig) { - throw new \RuntimeException('The Twig environment needs to be set.'); - } - - $types = array('functions', 'filters', 'tests', 'globals'); - - if ('json' === $input->getOption('format')) { - $data = array(); - foreach ($types as $type) { - foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) { - $data[$type][$name] = $this->getMetadata($type, $entity); - } - } - $data['tests'] = array_keys($data['tests']); - $io->writeln(json_encode($data)); - - return 0; - } - - $filter = $input->getArgument('filter'); - - foreach ($types as $index => $type) { - $items = array(); - foreach ($twig->{'get'.ucfirst($type)}() as $name => $entity) { - if (!$filter || false !== strpos($name, $filter)) { - $items[$name] = $name.$this->getPrettyMetadata($type, $entity); - } - } - - if (!$items) { - continue; - } - - $io->section(ucfirst($type)); - - ksort($items); - $io->listing($items); - } - - return 0; - } - - private function getMetadata($type, $entity) - { - if ('globals' === $type) { - return $entity; - } - if ('tests' === $type) { - return; - } - if ('functions' === $type || 'filters' === $type) { - $cb = $entity->getCallable(); - if (null === $cb) { - return; - } - if (is_array($cb)) { - if (!method_exists($cb[0], $cb[1])) { - return; - } - $refl = new \ReflectionMethod($cb[0], $cb[1]); - } elseif (is_object($cb) && method_exists($cb, '__invoke')) { - $refl = new \ReflectionMethod($cb, '__invoke'); - } elseif (function_exists($cb)) { - $refl = new \ReflectionFunction($cb); - } elseif (is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) { - $refl = new \ReflectionMethod($m[1], $m[2]); - } else { - throw new \UnexpectedValueException('Unsupported callback type'); - } - - $args = $refl->getParameters(); - - // filter out context/environment args - if ($entity->needsEnvironment()) { - array_shift($args); - } - if ($entity->needsContext()) { - array_shift($args); - } - - if ('filters' === $type) { - // remove the value the filter is applied on - array_shift($args); - } - - // format args - $args = array_map(function ($param) { - if ($param->isDefaultValueAvailable()) { - return $param->getName().' = '.json_encode($param->getDefaultValue()); - } - - return $param->getName(); - }, $args); - - return $args; - } - } - - private function getPrettyMetadata($type, $entity) - { - if ('tests' === $type) { - return ''; - } - - try { - $meta = $this->getMetadata($type, $entity); - if (null === $meta) { - return '(unknown?)'; - } - } catch (\UnexpectedValueException $e) { - return ' '.$e->getMessage().''; - } - - if ('globals' === $type) { - if (is_object($meta)) { - return ' = object('.get_class($meta).')'; - } - - return ' = '.substr(@json_encode($meta), 0, 50); - } - - if ('functions' === $type) { - return '('.implode(', ', $meta).')'; - } - - if ('filters' === $type) { - return $meta ? '('.implode(', ', $meta).')' : ''; - } - } -} diff --git a/vendor/symfony/twig-bridge/Command/LintCommand.php b/vendor/symfony/twig-bridge/Command/LintCommand.php deleted file mode 100644 index 8c8dde4..0000000 --- a/vendor/symfony/twig-bridge/Command/LintCommand.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Finder\Finder; -use Twig\Environment; -use Twig\Error\Error; -use Twig\Loader\ArrayLoader; -use Twig\Source; - -/** - * Command that will validate your template syntax and output encountered errors. - * - * @author Marc Weistroff - * @author Jérôme Tamarelle - */ -class LintCommand extends Command -{ - private $twig; - - /** - * {@inheritdoc} - */ - public function __construct($name = 'lint:twig') - { - parent::__construct($name); - } - - public function setTwigEnvironment(Environment $twig) - { - $this->twig = $twig; - } - - /** - * @return Environment $twig - */ - protected function getTwigEnvironment() - { - return $this->twig; - } - - protected function configure() - { - $this - ->setDescription('Lints a template and outputs encountered errors') - ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') - ->addArgument('filename', InputArgument::IS_ARRAY) - ->setHelp(<<<'EOF' -The %command.name% command lints a template and outputs to STDOUT -the first encountered syntax error. - -You can validate the syntax of contents passed from STDIN: - - cat filename | php %command.full_name% - -Or the syntax of a file: - - php %command.full_name% filename - -Or of a whole directory: - - php %command.full_name% dirname - php %command.full_name% dirname --format=json - -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new SymfonyStyle($input, $output); - - if (null === $twig = $this->getTwigEnvironment()) { - throw new \RuntimeException('The Twig environment needs to be set.'); - } - - $filenames = $input->getArgument('filename'); - - if (0 === count($filenames)) { - if (0 !== ftell(STDIN)) { - throw new \RuntimeException('Please provide a filename or pipe template content to STDIN.'); - } - - $template = ''; - while (!feof(STDIN)) { - $template .= fread(STDIN, 1024); - } - - return $this->display($input, $output, $io, array($this->validate($twig, $template, uniqid('sf_', true)))); - } - - $filesInfo = $this->getFilesInfo($twig, $filenames); - - return $this->display($input, $output, $io, $filesInfo); - } - - private function getFilesInfo(Environment $twig, array $filenames) - { - $filesInfo = array(); - foreach ($filenames as $filename) { - foreach ($this->findFiles($filename) as $file) { - $filesInfo[] = $this->validate($twig, file_get_contents($file), $file); - } - } - - return $filesInfo; - } - - protected function findFiles($filename) - { - if (is_file($filename)) { - return array($filename); - } elseif (is_dir($filename)) { - return Finder::create()->files()->in($filename)->name('*.twig'); - } - - throw new \RuntimeException(sprintf('File or directory "%s" is not readable', $filename)); - } - - private function validate(Environment $twig, $template, $file) - { - $realLoader = $twig->getLoader(); - try { - $temporaryLoader = new ArrayLoader(array((string) $file => $template)); - $twig->setLoader($temporaryLoader); - $nodeTree = $twig->parse($twig->tokenize(new Source($template, (string) $file))); - $twig->compile($nodeTree); - $twig->setLoader($realLoader); - } catch (Error $e) { - $twig->setLoader($realLoader); - - return array('template' => $template, 'file' => $file, 'valid' => false, 'exception' => $e); - } - - return array('template' => $template, 'file' => $file, 'valid' => true); - } - - private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, $files) - { - switch ($input->getOption('format')) { - case 'txt': - return $this->displayTxt($output, $io, $files); - case 'json': - return $this->displayJson($output, $files); - default: - throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format'))); - } - } - - private function displayTxt(OutputInterface $output, SymfonyStyle $io, $filesInfo) - { - $errors = 0; - - foreach ($filesInfo as $info) { - if ($info['valid'] && $output->isVerbose()) { - $io->comment('OK'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); - } elseif (!$info['valid']) { - ++$errors; - $this->renderException($io, $info['template'], $info['exception'], $info['file']); - } - } - - if (0 === $errors) { - $io->success(sprintf('All %d Twig files contain valid syntax.', count($filesInfo))); - } else { - $io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', count($filesInfo) - $errors, $errors)); - } - - return min($errors, 1); - } - - private function displayJson(OutputInterface $output, $filesInfo) - { - $errors = 0; - - array_walk($filesInfo, function (&$v) use (&$errors) { - $v['file'] = (string) $v['file']; - unset($v['template']); - if (!$v['valid']) { - $v['message'] = $v['exception']->getMessage(); - unset($v['exception']); - ++$errors; - } - }); - - $output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - - return min($errors, 1); - } - - private function renderException(OutputInterface $output, $template, Error $exception, $file = null) - { - $line = $exception->getTemplateLine(); - - if ($file) { - $output->text(sprintf(' ERROR in %s (line %s)', $file, $line)); - } else { - $output->text(sprintf(' ERROR (line %s)', $line)); - } - - foreach ($this->getContext($template, $line) as $lineNumber => $code) { - $output->text(sprintf( - '%s %-6s %s', - $lineNumber === $line ? ' >> ' : ' ', - $lineNumber, - $code - )); - if ($lineNumber === $line) { - $output->text(sprintf(' >> %s ', $exception->getRawMessage())); - } - } - } - - private function getContext($template, $line, $context = 3) - { - $lines = explode("\n", $template); - - $position = max(0, $line - $context); - $max = min(count($lines), $line - 1 + $context); - - $result = array(); - while ($position < $max) { - $result[$position + 1] = $lines[$position]; - ++$position; - } - - return $result; - } -} diff --git a/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php b/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php deleted file mode 100644 index f28c924..0000000 --- a/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\DataCollector; - -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Twig\Markup; -use Twig\Profiler\Dumper\HtmlDumper; -use Twig\Profiler\Profile; - -/** - * TwigDataCollector. - * - * @author Fabien Potencier - */ -class TwigDataCollector extends DataCollector implements LateDataCollectorInterface -{ - private $profile; - private $computed; - - public function __construct(Profile $profile) - { - $this->profile = $profile; - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - } - - /** - * {@inheritdoc} - */ - public function lateCollect() - { - $this->data['profile'] = serialize($this->profile); - } - - public function getTime() - { - return $this->getProfile()->getDuration() * 1000; - } - - public function getTemplateCount() - { - return $this->getComputedData('template_count'); - } - - public function getTemplates() - { - return $this->getComputedData('templates'); - } - - public function getBlockCount() - { - return $this->getComputedData('block_count'); - } - - public function getMacroCount() - { - return $this->getComputedData('macro_count'); - } - - public function getHtmlCallGraph() - { - $dumper = new HtmlDumper(); - $dump = $dumper->dump($this->getProfile()); - - // needed to remove the hardcoded CSS styles - $dump = str_replace(array( - '', - '', - '', - ), array( - '', - '', - '', - ), $dump); - - return new Markup($dump, 'UTF-8'); - } - - public function getProfile() - { - if (null === $this->profile) { - if (\PHP_VERSION_ID >= 70000) { - $this->profile = unserialize($this->data['profile'], array('allowed_classes' => array('Twig_Profiler_Profile', 'Twig\Profiler\Profile'))); - } else { - $this->profile = unserialize($this->data['profile']); - } - } - - return $this->profile; - } - - private function getComputedData($index) - { - if (null === $this->computed) { - $this->computed = $this->computeData($this->getProfile()); - } - - return $this->computed[$index]; - } - - private function computeData(Profile $profile) - { - $data = array( - 'template_count' => 0, - 'block_count' => 0, - 'macro_count' => 0, - ); - - $templates = array(); - foreach ($profile as $p) { - $d = $this->computeData($p); - - $data['template_count'] += ($p->isTemplate() ? 1 : 0) + $d['template_count']; - $data['block_count'] += ($p->isBlock() ? 1 : 0) + $d['block_count']; - $data['macro_count'] += ($p->isMacro() ? 1 : 0) + $d['macro_count']; - - if ($p->isTemplate()) { - if (!isset($templates[$p->getTemplate()])) { - $templates[$p->getTemplate()] = 1; - } else { - ++$templates[$p->getTemplate()]; - } - } - - foreach ($d['templates'] as $template => $count) { - if (!isset($templates[$template])) { - $templates[$template] = $count; - } else { - $templates[$template] += $count; - } - } - } - $data['templates'] = $templates; - - return $data; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'twig'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/AssetExtension.php b/vendor/symfony/twig-bridge/Extension/AssetExtension.php deleted file mode 100644 index d5d70fb..0000000 --- a/vendor/symfony/twig-bridge/Extension/AssetExtension.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Asset\Packages; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * Twig extension for the Symfony Asset component. - * - * @author Fabien Potencier - */ -class AssetExtension extends AbstractExtension -{ - private $packages; - - public function __construct(Packages $packages) - { - $this->packages = $packages; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('asset', array($this, 'getAssetUrl')), - new TwigFunction('asset_version', array($this, 'getAssetVersion')), - ); - } - - /** - * Returns the public url/path of an asset. - * - * If the package used to generate the path is an instance of - * UrlPackage, you will always get a URL and not a path. - * - * @param string $path A public path - * @param string $packageName The name of the asset package to use - * - * @return string The public path of the asset - */ - public function getAssetUrl($path, $packageName = null) - { - return $this->packages->getUrl($path, $packageName); - } - - /** - * Returns the version of an asset. - * - * @param string $path A public path - * @param string $packageName The name of the asset package to use - * - * @return string The asset version - */ - public function getAssetVersion($path, $packageName = null) - { - return $this->packages->getVersion($path, $packageName); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'asset'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/CodeExtension.php b/vendor/symfony/twig-bridge/Extension/CodeExtension.php deleted file mode 100644 index c2866ab..0000000 --- a/vendor/symfony/twig-bridge/Extension/CodeExtension.php +++ /dev/null @@ -1,264 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; -use Twig\Extension\AbstractExtension; -use Twig\TwigFilter; - -/** - * Twig extension relate to PHP code and used by the profiler and the default exception templates. - * - * @author Fabien Potencier - */ -class CodeExtension extends AbstractExtension -{ - private $fileLinkFormat; - private $rootDir; - private $charset; - - /** - * @param string|FileLinkFormatter $fileLinkFormat The format for links to source files - * @param string $rootDir The project root directory - * @param string $charset The charset - */ - public function __construct($fileLinkFormat, $rootDir, $charset) - { - $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - $this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, dirname($rootDir)).DIRECTORY_SEPARATOR; - $this->charset = $charset; - } - - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new TwigFilter('abbr_class', array($this, 'abbrClass'), array('is_safe' => array('html'))), - new TwigFilter('abbr_method', array($this, 'abbrMethod'), array('is_safe' => array('html'))), - new TwigFilter('format_args', array($this, 'formatArgs'), array('is_safe' => array('html'))), - new TwigFilter('format_args_as_text', array($this, 'formatArgsAsText')), - new TwigFilter('file_excerpt', array($this, 'fileExcerpt'), array('is_safe' => array('html'))), - new TwigFilter('format_file', array($this, 'formatFile'), array('is_safe' => array('html'))), - new TwigFilter('format_file_from_text', array($this, 'formatFileFromText'), array('is_safe' => array('html'))), - new TwigFilter('format_log_message', array($this, 'formatLogMessage'), array('is_safe' => array('html'))), - new TwigFilter('file_link', array($this, 'getFileLink')), - ); - } - - public function abbrClass($class) - { - $parts = explode('\\', $class); - $short = array_pop($parts); - - return sprintf('%s', $class, $short); - } - - public function abbrMethod($method) - { - if (false !== strpos($method, '::')) { - list($class, $method) = explode('::', $method, 2); - $result = sprintf('%s::%s()', $this->abbrClass($class), $method); - } elseif ('Closure' === $method) { - $result = sprintf('%s', $method, $method); - } else { - $result = sprintf('%s()', $method, $method); - } - - return $result; - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - public function formatArgs($args) - { - $result = array(); - foreach ($args as $key => $item) { - if ('object' === $item[0]) { - $parts = explode('\\', $item[1]); - $short = array_pop($parts); - $formattedValue = sprintf('object(%s)', $item[1], $short); - } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); - } elseif ('null' === $item[0]) { - $formattedValue = 'null'; - } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; - } elseif ('resource' === $item[0]) { - $formattedValue = 'resource'; - } else { - $formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset)); - } - - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); - } - - return implode(', ', $result); - } - - /** - * Formats an array as a string. - * - * @param array $args The argument array - * - * @return string - */ - public function formatArgsAsText($args) - { - return strip_tags($this->formatArgs($args)); - } - - /** - * Returns an excerpt of a code file around the given line number. - * - * @param string $file A file path - * @param int $line The selected line number - * @param int $srcContext The number of displayed lines around or -1 for the whole file - * - * @return string An HTML string - */ - public function fileExcerpt($file, $line, $srcContext = 3) - { - if (is_readable($file)) { - // highlight_file could throw warnings - // see https://bugs.php.net/bug.php?id=25725 - $code = @highlight_file($file, true); - // remove main code/span tags - $code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code); - // split multiline spans - $code = preg_replace_callback('#]++)>((?:[^<]*+
    )++[^<]*+)
    #', function ($m) { - return "".str_replace('
    ', "

    ", $m[2]).''; - }, $code); - $content = explode('
    ', $code); - - $lines = array(); - if (0 > $srcContext) { - $srcContext = count($content); - } - - for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, count($content)); $i <= $max; ++$i) { - $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).''; - } - - return '
      '.implode("\n", $lines).'
    '; - } - } - - /** - * Formats a file path. - * - * @param string $file An absolute file path - * @param int $line The line number - * @param string $text Use this text for the link rather than the file path - * - * @return string - */ - public function formatFile($file, $line, $text = null) - { - $file = trim($file); - - if (null === $text) { - $text = str_replace('/', DIRECTORY_SEPARATOR, $file); - if (0 === strpos($text, $this->rootDir)) { - $text = substr($text, strlen($this->rootDir)); - $text = explode(DIRECTORY_SEPARATOR, $text, 2); - $text = sprintf('%s%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : ''); - } - } - - $text = "$text at line $line"; - - if (false !== $link = $this->getFileLink($file, $line)) { - return sprintf('%s', htmlspecialchars($link, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset), $text); - } - - return $text; - } - - /** - * Returns the link for a given file/line pair. - * - * @param string $file An absolute file path - * @param int $line The line number - * - * @return string A link of false - */ - public function getFileLink($file, $line) - { - if ($fmt = $this->fileLinkFormat) { - return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line); - } - - return false; - } - - public function formatFileFromText($text) - { - return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) { - return 'in '.$this->formatFile($match[2], $match[3]); - }, $text); - } - - /** - * @internal - */ - public function formatLogMessage($message, array $context) - { - if ($context && false !== strpos($message, '{')) { - $replacements = array(); - foreach ($context as $key => $val) { - if (is_scalar($val)) { - $replacements['{'.$key.'}'] = $val; - } - } - - if ($replacements) { - $message = strtr($message, $replacements); - } - } - - return htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'code'; - } - - protected static function fixCodeMarkup($line) - { - //
    ending tag from previous line - $opening = strpos($line, ''); - if (false !== $closing && (false === $opening || $closing < $opening)) { - $line = substr_replace($line, '', $closing, 7); - } - - // missing
    tag at the end of line - $opening = strpos($line, ''); - if (false !== $opening && (false === $closing || $closing > $opening)) { - $line .= '
    '; - } - - return $line; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/DumpExtension.php b/vendor/symfony/twig-bridge/Extension/DumpExtension.php deleted file mode 100644 index 767163f..0000000 --- a/vendor/symfony/twig-bridge/Extension/DumpExtension.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Bridge\Twig\TokenParser\DumpTokenParser; -use Symfony\Component\VarDumper\Cloner\ClonerInterface; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Twig\Environment; -use Twig\Extension\AbstractExtension; -use Twig\Template; -use Twig\TwigFunction; - -/** - * Provides integration of the dump() function with Twig. - * - * @author Nicolas Grekas - */ -class DumpExtension extends AbstractExtension -{ - private $cloner; - private $dumper; - - public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null) - { - $this->cloner = $cloner; - $this->dumper = $dumper ?: new HtmlDumper(); - } - - public function getFunctions() - { - return array( - new TwigFunction('dump', array($this, 'dump'), array('is_safe' => array('html'), 'needs_context' => true, 'needs_environment' => true)), - ); - } - - public function getTokenParsers() - { - return array(new DumpTokenParser()); - } - - public function getName() - { - return 'dump'; - } - - public function dump(Environment $env, $context) - { - if (!$env->isDebug()) { - return; - } - - if (2 === func_num_args()) { - $vars = array(); - foreach ($context as $key => $value) { - if (!$value instanceof Template) { - $vars[$key] = $value; - } - } - - $vars = array($vars); - } else { - $vars = func_get_args(); - unset($vars[0], $vars[1]); - } - - $dump = fopen('php://memory', 'r+b'); - $this->dumper->setCharset($env->getCharset()); - - foreach ($vars as $value) { - $this->dumper->dump($this->cloner->cloneVar($value), $dump); - } - - return stream_get_contents($dump, -1, 0); - } -} diff --git a/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php b/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php deleted file mode 100644 index fc64fa3..0000000 --- a/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\ExpressionLanguage\Expression; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * ExpressionExtension gives a way to create Expressions from a template. - * - * @author Fabien Potencier - */ -class ExpressionExtension extends AbstractExtension -{ - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('expression', array($this, 'createExpression')), - ); - } - - public function createExpression($expression) - { - return new Expression($expression); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'expression'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/FormExtension.php b/vendor/symfony/twig-bridge/Extension/FormExtension.php deleted file mode 100644 index 362879e..0000000 --- a/vendor/symfony/twig-bridge/Extension/FormExtension.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; -use Symfony\Bridge\Twig\Form\TwigRendererInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Twig\Environment; -use Twig\Extension\AbstractExtension; -use Twig\Extension\InitRuntimeInterface; -use Twig\TwigFilter; -use Twig\TwigFunction; -use Twig\TwigTest; - -/** - * FormExtension extends Twig with form capabilities. - * - * @author Fabien Potencier - * @author Bernhard Schussek - */ -class FormExtension extends AbstractExtension implements InitRuntimeInterface -{ - /** - * @deprecated since version 3.2, to be removed in 4.0 alongside with magic methods below - */ - private $renderer; - - public function __construct($renderer = null) - { - if ($renderer instanceof TwigRendererInterface) { - @trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED); - } elseif (null !== $renderer && !(is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) { - throw new \InvalidArgumentException(sprintf('Passing any arguments the constructor of %s is reserved for internal use.', __CLASS__)); - } - $this->renderer = $renderer; - } - - /** - * {@inheritdoc} - * - * To be removed in 4.0 - */ - public function initRuntime(Environment $environment) - { - if ($this->renderer instanceof TwigRendererInterface) { - $this->renderer->setEnvironment($environment); - } elseif (null !== $this->renderer) { - $this->renderer[2] = $environment; - } - } - - /** - * {@inheritdoc} - */ - public function getTokenParsers() - { - return array( - // {% form_theme form "SomeBundle::widgets.twig" %} - new FormThemeTokenParser(), - ); - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_row', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_rest', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_start', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('form_end', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))), - new TwigFunction('csrf_token', array('Symfony\Bridge\Twig\Form\TwigRenderer', 'renderCsrfToken')), - ); - } - - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new TwigFilter('humanize', array('Symfony\Bridge\Twig\Form\TwigRenderer', 'humanize')), - ); - } - - /** - * {@inheritdoc} - */ - public function getTests() - { - return array( - new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'), - ); - } - - /** - * @internal - */ - public function __get($name) - { - if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); - - if (is_array($this->renderer)) { - $renderer = $this->renderer[0]->get($this->renderer[1]); - if (isset($this->renderer[2])) { - $renderer->setEnvironment($this->renderer[2]); - } - $this->renderer = $renderer; - } - } - - return $this->$name; - } - - /** - * @internal - */ - public function __set($name, $value) - { - if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); - } - - $this->$name = $value; - } - - /** - * @internal - */ - public function __isset($name) - { - if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); - } - - return isset($this->$name); - } - - /** - * @internal - */ - public function __unset($name) - { - if ('renderer' === $name) { - @trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); - } - - unset($this->$name); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'form'; - } -} - -/** - * Returns whether a choice is selected for a given form value. - * - * This is a function and not callable due to performance reasons. - * - * @param string|array $selectedValue The selected value to compare - * - * @return bool Whether the choice is selected - * - * @see ChoiceView::isSelected() - */ -function twig_is_selected_choice(ChoiceView $choice, $selectedValue) -{ - if (is_array($selectedValue)) { - return in_array($choice->value, $selectedValue, true); - } - - return $choice->value === $selectedValue; -} diff --git a/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php b/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php deleted file mode 100644 index 0dad40c..0000000 --- a/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContext; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * Twig extension for the Symfony HttpFoundation component. - * - * @author Fabien Potencier - */ -class HttpFoundationExtension extends AbstractExtension -{ - private $requestStack; - private $requestContext; - - public function __construct(RequestStack $requestStack, RequestContext $requestContext = null) - { - $this->requestStack = $requestStack; - $this->requestContext = $requestContext; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('absolute_url', array($this, 'generateAbsoluteUrl')), - new TwigFunction('relative_path', array($this, 'generateRelativePath')), - ); - } - - /** - * Returns the absolute URL for the given absolute or relative path. - * - * This method returns the path unchanged if no request is available. - * - * @param string $path The path - * - * @return string The absolute URL - * - * @see Request::getUriForPath() - */ - public function generateAbsoluteUrl($path) - { - if (false !== strpos($path, '://') || '//' === substr($path, 0, 2)) { - return $path; - } - - if (!$request = $this->requestStack->getMasterRequest()) { - if (null !== $this->requestContext && '' !== $host = $this->requestContext->getHost()) { - $scheme = $this->requestContext->getScheme(); - $port = ''; - - if ('http' === $scheme && 80 != $this->requestContext->getHttpPort()) { - $port = ':'.$this->requestContext->getHttpPort(); - } elseif ('https' === $scheme && 443 != $this->requestContext->getHttpsPort()) { - $port = ':'.$this->requestContext->getHttpsPort(); - } - - if ('#' === $path[0]) { - $queryString = $this->requestContext->getQueryString(); - $path = $this->requestContext->getPathInfo().($queryString ? '?'.$queryString : '').$path; - } elseif ('?' === $path[0]) { - $path = $this->requestContext->getPathInfo().$path; - } - - if ('/' !== $path[0]) { - $path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path; - } - - return $scheme.'://'.$host.$port.$path; - } - - return $path; - } - - if ('#' === $path[0]) { - $path = $request->getRequestUri().$path; - } elseif ('?' === $path[0]) { - $path = $request->getPathInfo().$path; - } - - if (!$path || '/' !== $path[0]) { - $prefix = $request->getPathInfo(); - $last = strlen($prefix) - 1; - if ($last !== $pos = strrpos($prefix, '/')) { - $prefix = substr($prefix, 0, $pos).'/'; - } - - return $request->getUriForPath($prefix.$path); - } - - return $request->getSchemeAndHttpHost().$path; - } - - /** - * Returns a relative path based on the current Request. - * - * This method returns the path unchanged if no request is available. - * - * @param string $path The path - * - * @return string The relative path - * - * @see Request::getRelativeUriForPath() - */ - public function generateRelativePath($path) - { - if (false !== strpos($path, '://') || '//' === substr($path, 0, 2)) { - return $path; - } - - if (!$request = $this->requestStack->getMasterRequest()) { - return $path; - } - - return $request->getRelativeUriForPath($path); - } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'request'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php b/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php deleted file mode 100644 index 45142e7..0000000 --- a/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * Provides integration with the HttpKernel component. - * - * @author Fabien Potencier - */ -class HttpKernelExtension extends AbstractExtension -{ - public function getFunctions() - { - return array( - new TwigFunction('render', array(HttpKernelRuntime::class, 'renderFragment'), array('is_safe' => array('html'))), - new TwigFunction('render_*', array(HttpKernelRuntime::class, 'renderFragmentStrategy'), array('is_safe' => array('html'))), - new TwigFunction('controller', static::class.'::controller'), - ); - } - - public static function controller($controller, $attributes = array(), $query = array()) - { - return new ControllerReference($controller, $attributes, $query); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'http_kernel'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php b/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php deleted file mode 100644 index 3c1f1a0..0000000 --- a/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; -use Symfony\Component\HttpKernel\Controller\ControllerReference; - -/** - * Provides integration with the HttpKernel component. - * - * @author Fabien Potencier - */ -class HttpKernelRuntime -{ - private $handler; - - public function __construct(FragmentHandler $handler) - { - $this->handler = $handler; - } - - /** - * Renders a fragment. - * - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param array $options An array of options - * - * @return string The fragment content - * - * @see FragmentHandler::render() - */ - public function renderFragment($uri, $options = array()) - { - $strategy = isset($options['strategy']) ? $options['strategy'] : 'inline'; - unset($options['strategy']); - - return $this->handler->render($uri, $strategy, $options); - } - - /** - * Renders a fragment. - * - * @param string $strategy A strategy name - * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance - * @param array $options An array of options - * - * @return string The fragment content - * - * @see FragmentHandler::render() - */ - public function renderFragmentStrategy($strategy, $uri, $options = array()) - { - return $this->handler->render($uri, $strategy, $options); - } -} diff --git a/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php b/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php deleted file mode 100644 index 17abb77..0000000 --- a/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * LogoutUrlHelper provides generator functions for the logout URL to Twig. - * - * @author Jeremy Mikola - */ -class LogoutUrlExtension extends AbstractExtension -{ - private $generator; - - public function __construct(LogoutUrlGenerator $generator) - { - $this->generator = $generator; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('logout_url', array($this, 'getLogoutUrl')), - new TwigFunction('logout_path', array($this, 'getLogoutPath')), - ); - } - - /** - * Generates the relative logout URL for the firewall. - * - * @param string|null $key The firewall key or null to use the current firewall key - * - * @return string The relative logout URL - */ - public function getLogoutPath($key = null) - { - return $this->generator->getLogoutPath($key); - } - - /** - * Generates the absolute logout URL for the firewall. - * - * @param string|null $key The firewall key or null to use the current firewall key - * - * @return string The absolute logout URL - */ - public function getLogoutUrl($key = null) - { - return $this->generator->getLogoutUrl($key); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'logout_url'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php b/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php deleted file mode 100644 index 21214f8..0000000 --- a/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Stopwatch\Stopwatch; -use Twig\Extension\ProfilerExtension as BaseProfilerExtension; -use Twig\Profiler\Profile; - -/** - * @author Fabien Potencier - */ -class ProfilerExtension extends BaseProfilerExtension -{ - private $stopwatch; - private $events; - - public function __construct(Profile $profile, Stopwatch $stopwatch = null) - { - parent::__construct($profile); - - $this->stopwatch = $stopwatch; - $this->events = new \SplObjectStorage(); - } - - public function enter(Profile $profile) - { - if ($this->stopwatch && $profile->isTemplate()) { - $this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template'); - } - - parent::enter($profile); - } - - public function leave(Profile $profile) - { - parent::leave($profile); - - if ($this->stopwatch && $profile->isTemplate()) { - $this->events[$profile]->stop(); - unset($this->events[$profile]); - } - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'native_profiler'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/RoutingExtension.php b/vendor/symfony/twig-bridge/Extension/RoutingExtension.php deleted file mode 100644 index 97b1ea3..0000000 --- a/vendor/symfony/twig-bridge/Extension/RoutingExtension.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Twig\Extension\AbstractExtension; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Node; -use Twig\TwigFunction; - -/** - * Provides integration of the Routing component with Twig. - * - * @author Fabien Potencier - */ -class RoutingExtension extends AbstractExtension -{ - private $generator; - - public function __construct(UrlGeneratorInterface $generator) - { - $this->generator = $generator; - } - - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array( - new TwigFunction('url', array($this, 'getUrl'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), - new TwigFunction('path', array($this, 'getPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), - ); - } - - /** - * @param string $name - * @param array $parameters - * @param bool $relative - * - * @return string - */ - public function getPath($name, $parameters = array(), $relative = false) - { - return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); - } - - /** - * @param string $name - * @param array $parameters - * @param bool $schemeRelative - * - * @return string - */ - public function getUrl($name, $parameters = array(), $schemeRelative = false) - { - return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); - } - - /** - * Determines at compile time whether the generated URL will be safe and thus - * saving the unneeded automatic escaping for performance reasons. - * - * The URL generation process percent encodes non-alphanumeric characters. So there is no risk - * that malicious/invalid characters are part of the URL. The only character within an URL that - * must be escaped in html is the ampersand ("&") which separates query params. So we cannot mark - * the URL generation as always safe, but only when we are sure there won't be multiple query - * params. This is the case when there are none or only one constant parameter given. - * E.g. we know beforehand this will be safe: - * - path('route') - * - path('route', {'param': 'value'}) - * But the following may not: - * - path('route', var) - * - path('route', {'param': ['val1', 'val2'] }) // a sub-array - * - path('route', {'param1': 'value1', 'param2': 'value2'}) - * If param1 and param2 reference placeholder in the route, it would still be safe. But we don't know. - * - * @param Node $argsNode The arguments of the path/url function - * - * @return array An array with the contexts the URL is safe - * - * To be made @final in 3.4, and the type-hint be changed to "\Twig\Node\Node" in 4.0. - */ - public function isUrlGenerationSafe(\Twig_Node $argsNode) - { - // support named arguments - $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( - $argsNode->hasNode(1) ? $argsNode->getNode(1) : null - ); - - if (null === $paramsNode || $paramsNode instanceof ArrayExpression && count($paramsNode) <= 2 && - (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression) - ) { - return array('html'); - } - - return array(); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'routing'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/SecurityExtension.php b/vendor/symfony/twig-bridge/Extension/SecurityExtension.php deleted file mode 100644 index 193726a..0000000 --- a/vendor/symfony/twig-bridge/Extension/SecurityExtension.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Security\Acl\Voter\FieldVote; -use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; -use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * SecurityExtension exposes security context features. - * - * @author Fabien Potencier - */ -class SecurityExtension extends AbstractExtension -{ - private $securityChecker; - - public function __construct(AuthorizationCheckerInterface $securityChecker = null) - { - $this->securityChecker = $securityChecker; - } - - public function isGranted($role, $object = null, $field = null) - { - if (null === $this->securityChecker) { - return false; - } - - if (null !== $field) { - $object = new FieldVote($object, $field); - } - - try { - return $this->securityChecker->isGranted($role, $object); - } catch (AuthenticationCredentialsNotFoundException $e) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('is_granted', array($this, 'isGranted')), - ); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'security'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php b/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php deleted file mode 100644 index cb91ff4..0000000 --- a/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser; -use Twig\Extension\AbstractExtension; - -/** - * Twig extension for the stopwatch helper. - * - * @author Wouter J - */ -class StopwatchExtension extends AbstractExtension -{ - private $stopwatch; - - /** - * @var bool - */ - private $enabled; - - public function __construct(Stopwatch $stopwatch = null, $enabled = true) - { - $this->stopwatch = $stopwatch; - $this->enabled = $enabled; - } - - public function getStopwatch() - { - return $this->stopwatch; - } - - public function getTokenParsers() - { - return array( - /* - * {% stopwatch foo %} - * Some stuff which will be recorded on the timeline - * {% endstopwatch %} - */ - new StopwatchTokenParser(null !== $this->stopwatch && $this->enabled), - ); - } - - public function getName() - { - return 'stopwatch'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/TranslationExtension.php b/vendor/symfony/twig-bridge/Extension/TranslationExtension.php deleted file mode 100644 index 5155169..0000000 --- a/vendor/symfony/twig-bridge/Extension/TranslationExtension.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Bridge\Twig\TokenParser\TransTokenParser; -use Symfony\Bridge\Twig\TokenParser\TransChoiceTokenParser; -use Symfony\Bridge\Twig\TokenParser\TransDefaultDomainTokenParser; -use Symfony\Component\Translation\TranslatorInterface; -use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; -use Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor; -use Twig\Extension\AbstractExtension; -use Twig\NodeVisitor\NodeVisitorInterface; -use Twig\TokenParser\AbstractTokenParser; -use Twig\TwigFilter; - -/** - * Provides integration of the Translation component with Twig. - * - * @author Fabien Potencier - */ -class TranslationExtension extends AbstractExtension -{ - private $translator; - private $translationNodeVisitor; - - public function __construct(TranslatorInterface $translator, NodeVisitorInterface $translationNodeVisitor = null) - { - if (!$translationNodeVisitor) { - $translationNodeVisitor = new TranslationNodeVisitor(); - } - - $this->translator = $translator; - $this->translationNodeVisitor = $translationNodeVisitor; - } - - public function getTranslator() - { - return $this->translator; - } - - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new TwigFilter('trans', array($this, 'trans')), - new TwigFilter('transchoice', array($this, 'transchoice')), - ); - } - - /** - * Returns the token parser instance to add to the existing list. - * - * @return AbstractTokenParser[] - */ - public function getTokenParsers() - { - return array( - // {% trans %}Symfony is great!{% endtrans %} - new TransTokenParser(), - - // {% transchoice count %} - // {0} There is no apples|{1} There is one apple|]1,Inf] There is {{ count }} apples - // {% endtranschoice %} - new TransChoiceTokenParser(), - - // {% trans_default_domain "foobar" %} - new TransDefaultDomainTokenParser(), - ); - } - - /** - * {@inheritdoc} - */ - public function getNodeVisitors() - { - return array($this->translationNodeVisitor, new TranslationDefaultDomainNodeVisitor()); - } - - public function getTranslationNodeVisitor() - { - return $this->translationNodeVisitor; - } - - public function trans($message, array $arguments = array(), $domain = null, $locale = null) - { - return $this->translator->trans($message, $arguments, $domain, $locale); - } - - public function transchoice($message, $count, array $arguments = array(), $domain = null, $locale = null) - { - return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain, $locale); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'translator'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php b/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php deleted file mode 100644 index 3d90c3b..0000000 --- a/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Fig\Link\GenericLinkProvider; -use Fig\Link\Link; -use Symfony\Component\HttpFoundation\RequestStack; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * Twig extension for the Symfony WebLink component. - * - * @author Kévin Dunglas - */ -class WebLinkExtension extends AbstractExtension -{ - private $requestStack; - - public function __construct(RequestStack $requestStack) - { - $this->requestStack = $requestStack; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() - { - return array( - new TwigFunction('link', array($this, 'link')), - new TwigFunction('preload', array($this, 'preload')), - new TwigFunction('dns_prefetch', array($this, 'dnsPrefetch')), - new TwigFunction('preconnect', array($this, 'preconnect')), - new TwigFunction('prefetch', array($this, 'prefetch')), - new TwigFunction('prerender', array($this, 'prerender')), - ); - } - - /** - * Adds a "Link" HTTP header. - * - * @param string $uri The relation URI - * @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch") - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)") - * - * @return string The relation URI - */ - public function link($uri, $rel, array $attributes = array()) - { - if (!$request = $this->requestStack->getMasterRequest()) { - return $uri; - } - - $link = new Link($rel, $uri); - foreach ($attributes as $key => $value) { - $link = $link->withAttribute($key, $value); - } - - $linkProvider = $request->attributes->get('_links', new GenericLinkProvider()); - $request->attributes->set('_links', $linkProvider->withLink($link)); - - return $uri; - } - - /** - * Preloads a resource. - * - * @param string $uri A public path - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('crossorigin' => 'use-credentials')") - * - * @return string The path of the asset - */ - public function preload($uri, array $attributes = array()) - { - return $this->link($uri, 'preload', $attributes); - } - - /** - * Resolves a resource origin as early as possible. - * - * @param string $uri A public path - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)") - * - * @return string The path of the asset - */ - public function dnsPrefetch($uri, array $attributes = array()) - { - return $this->link($uri, 'dns-prefetch', $attributes); - } - - /** - * Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation). - * - * @param string $uri A public path - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)") - * - * @return string The path of the asset - */ - public function preconnect($uri, array $attributes = array()) - { - return $this->link($uri, 'preconnect', $attributes); - } - - /** - * Indicates to the client that it should prefetch this resource. - * - * @param string $uri A public path - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)") - * - * @return string The path of the asset - */ - public function prefetch($uri, array $attributes = array()) - { - return $this->link($uri, 'prefetch', $attributes); - } - - /** - * Indicates to the client that it should prerender this resource . - * - * @param string $uri A public path - * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)") - * - * @return string The path of the asset - */ - public function prerender($uri, array $attributes = array()) - { - return $this->link($uri, 'prerender', $attributes); - } -} diff --git a/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php b/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php deleted file mode 100644 index 2d19857..0000000 --- a/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Workflow\Registry; -use Symfony\Component\Workflow\Transition; -use Twig\Extension\AbstractExtension; -use Twig\TwigFunction; - -/** - * WorkflowExtension. - * - * @author Grégoire Pineau - */ -class WorkflowExtension extends AbstractExtension -{ - private $workflowRegistry; - - public function __construct(Registry $workflowRegistry) - { - $this->workflowRegistry = $workflowRegistry; - } - - public function getFunctions() - { - return array( - new TwigFunction('workflow_can', array($this, 'canTransition')), - new TwigFunction('workflow_transitions', array($this, 'getEnabledTransitions')), - new TwigFunction('workflow_has_marked_place', array($this, 'hasMarkedPlace')), - new TwigFunction('workflow_marked_places', array($this, 'getMarkedPlaces')), - ); - } - - /** - * Returns true if the transition is enabled. - * - * @param object $subject A subject - * @param string $transitionName A transition - * @param string $name A workflow name - * - * @return bool true if the transition is enabled - */ - public function canTransition($subject, $transitionName, $name = null) - { - return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName); - } - - /** - * Returns all enabled transitions. - * - * @param object $subject A subject - * @param string $name A workflow name - * - * @return Transition[] All enabled transitions - */ - public function getEnabledTransitions($subject, $name = null) - { - return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject); - } - - /** - * Returns true if the place is marked. - * - * @param object $subject A subject - * @param string $placeName A place name - * @param string $name A workflow name - * - * @return bool true if the transition is enabled - */ - public function hasMarkedPlace($subject, $placeName, $name = null) - { - return $this->workflowRegistry->get($subject, $name)->getMarking($subject)->has($placeName); - } - - /** - * Returns marked places. - * - * @param object $subject A subject - * @param string $placesNameOnly If true, returns only places name. If false returns the raw representation - * @param string $name A workflow name - * - * @return string[]|int[] - */ - public function getMarkedPlaces($subject, $placesNameOnly = true, $name = null) - { - $places = $this->workflowRegistry->get($subject, $name)->getMarking($subject)->getPlaces(); - - if ($placesNameOnly) { - return array_keys($places); - } - - return $places; - } - - public function getName() - { - return 'workflow'; - } -} diff --git a/vendor/symfony/twig-bridge/Extension/YamlExtension.php b/vendor/symfony/twig-bridge/Extension/YamlExtension.php deleted file mode 100644 index 79418fb..0000000 --- a/vendor/symfony/twig-bridge/Extension/YamlExtension.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Extension; - -use Symfony\Component\Yaml\Dumper as YamlDumper; -use Symfony\Component\Yaml\Yaml; -use Twig\Extension\AbstractExtension; -use Twig\TwigFilter; - -/** - * Provides integration of the Yaml component with Twig. - * - * @author Fabien Potencier - */ -class YamlExtension extends AbstractExtension -{ - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new TwigFilter('yaml_encode', array($this, 'encode')), - new TwigFilter('yaml_dump', array($this, 'dump')), - ); - } - - public function encode($input, $inline = 0, $dumpObjects = 0) - { - static $dumper; - - if (null === $dumper) { - $dumper = new YamlDumper(); - } - - if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { - if (is_bool($dumpObjects)) { - @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED); - - $flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0; - } else { - $flags = $dumpObjects; - } - - return $dumper->dump($input, $inline, 0, $flags); - } - - return $dumper->dump($input, $inline, 0, false, $dumpObjects); - } - - public function dump($value, $inline = 0, $dumpObjects = false) - { - if (is_resource($value)) { - return '%Resource%'; - } - - if (is_array($value) || is_object($value)) { - return '%'.gettype($value).'% '.$this->encode($value, $inline, $dumpObjects); - } - - return $this->encode($value, $inline, $dumpObjects); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'yaml'; - } -} diff --git a/vendor/symfony/twig-bridge/Form/TwigRenderer.php b/vendor/symfony/twig-bridge/Form/TwigRenderer.php deleted file mode 100644 index 9d28b8c..0000000 --- a/vendor/symfony/twig-bridge/Form/TwigRenderer.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Form; - -use Symfony\Component\Form\FormRenderer; -use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; -use Twig\Environment; - -/** - * @author Bernhard Schussek - */ -class TwigRenderer extends FormRenderer implements TwigRendererInterface -{ - public function __construct(TwigRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null) - { - parent::__construct($engine, $csrfTokenManager); - } - - /** - * Returns the engine used by this renderer. - * - * @return TwigRendererEngineInterface The renderer engine - */ - public function getEngine() - { - return parent::getEngine(); - } - - /** - * {@inheritdoc} - */ - public function setEnvironment(Environment $environment) - { - $this->getEngine()->setEnvironment($environment); - } -} diff --git a/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php b/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php deleted file mode 100644 index 7e375f4..0000000 --- a/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Form; - -use Symfony\Component\Form\AbstractRendererEngine; -use Symfony\Component\Form\FormView; -use Twig\Environment; -use Twig\Template; - -/** - * @author Bernhard Schussek - */ -class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererEngineInterface -{ - /** - * @var Environment - */ - private $environment; - - /** - * @var Template - */ - private $template; - - public function __construct(array $defaultThemes = array(), Environment $environment = null) - { - if (null === $environment) { - @trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED); - } - - parent::__construct($defaultThemes); - $this->environment = $environment; - } - - /** - * {@inheritdoc} - * - * @deprecated since version 3.3, to be removed in 4.0 - */ - public function setEnvironment(Environment $environment) - { - if ($this->environment) { - @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED); - } - - $this->environment = $environment; - } - - /** - * {@inheritdoc} - */ - public function renderBlock(FormView $view, $resource, $blockName, array $variables = array()) - { - $cacheKey = $view->vars[self::CACHE_KEY_VAR]; - - $context = $this->environment->mergeGlobals($variables); - - ob_start(); - - // By contract,This method can only be called after getting the resource - // (which is passed to the method). Getting a resource for the first time - // (with an empty cache) is guaranteed to invoke loadResourcesFromTheme(), - // where the property $template is initialized. - - // We do not call renderBlock here to avoid too many nested level calls - // (XDebug limits the level to 100 by default) - $this->template->displayBlock($blockName, $context, $this->resources[$cacheKey]); - - return ob_get_clean(); - } - - /** - * Loads the cache with the resource for a given block name. - * - * This implementation eagerly loads all blocks of the themes assigned to the given view - * and all of its ancestors views. This is necessary, because Twig receives the - * list of blocks later. At that point, all blocks must already be loaded, for the - * case that the function "block()" is used in the Twig template. - * - * @see getResourceForBlock() - * - * @param string $cacheKey The cache key of the form view - * @param FormView $view The form view for finding the applying themes - * @param string $blockName The name of the block to load - * - * @return bool True if the resource could be loaded, false otherwise - */ - protected function loadResourceForBlockName($cacheKey, FormView $view, $blockName) - { - // The caller guarantees that $this->resources[$cacheKey][$block] is - // not set, but it doesn't have to check whether $this->resources[$cacheKey] - // is set. If $this->resources[$cacheKey] is set, all themes for this - // $cacheKey are already loaded (due to the eager population, see doc comment). - if (isset($this->resources[$cacheKey])) { - // As said in the previous, the caller guarantees that - // $this->resources[$cacheKey][$block] is not set. Since the themes are - // already loaded, it can only be a non-existing block. - $this->resources[$cacheKey][$blockName] = false; - - return false; - } - - // Recursively try to find the block in the themes assigned to $view, - // then of its parent view, then of the parent view of the parent and so on. - // When the root view is reached in this recursion, also the default - // themes are taken into account. - - // Check each theme whether it contains the searched block - if (isset($this->themes[$cacheKey])) { - for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) { - $this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]); - // CONTINUE LOADING (see doc comment) - } - } - - // Check the default themes once we reach the root view without success - if (!$view->parent) { - for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) { - $this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]); - // CONTINUE LOADING (see doc comment) - } - } - - // Proceed with the themes of the parent view - if ($view->parent) { - $parentCacheKey = $view->parent->vars[self::CACHE_KEY_VAR]; - - if (!isset($this->resources[$parentCacheKey])) { - $this->loadResourceForBlockName($parentCacheKey, $view->parent, $blockName); - } - - // EAGER CACHE POPULATION (see doc comment) - foreach ($this->resources[$parentCacheKey] as $nestedBlockName => $resource) { - if (!isset($this->resources[$cacheKey][$nestedBlockName])) { - $this->resources[$cacheKey][$nestedBlockName] = $resource; - } - } - } - - // Even though we loaded the themes, it can happen that none of them - // contains the searched block - if (!isset($this->resources[$cacheKey][$blockName])) { - // Cache that we didn't find anything to speed up further accesses - $this->resources[$cacheKey][$blockName] = false; - } - - return false !== $this->resources[$cacheKey][$blockName]; - } - - /** - * Loads the resources for all blocks in a theme. - * - * @param string $cacheKey The cache key for storing the resource - * @param mixed $theme The theme to load the block from. This parameter - * is passed by reference, because it might be necessary - * to initialize the theme first. Any changes made to - * this variable will be kept and be available upon - * further calls to this method using the same theme. - */ - protected function loadResourcesFromTheme($cacheKey, &$theme) - { - if (!$theme instanceof Template) { - /* @var Template $theme */ - $theme = $this->environment->loadTemplate($theme); - } - - if (null === $this->template) { - // Store the first Template instance that we find so that - // we can call displayBlock() later on. It doesn't matter *which* - // template we use for that, since we pass the used blocks manually - // anyway. - $this->template = $theme; - } - - // Use a separate variable for the inheritance traversal, because - // theme is a reference and we don't want to change it. - $currentTheme = $theme; - - $context = $this->environment->mergeGlobals(array()); - - // The do loop takes care of template inheritance. - // Add blocks from all templates in the inheritance tree, but avoid - // overriding blocks already set. - do { - foreach ($currentTheme->getBlocks() as $block => $blockData) { - if (!isset($this->resources[$cacheKey][$block])) { - // The resource given back is the key to the bucket that - // contains this block. - $this->resources[$cacheKey][$block] = $blockData; - } - } - } while (false !== $currentTheme = $currentTheme->getParent($context)); - } -} diff --git a/vendor/symfony/twig-bridge/Form/TwigRendererEngineInterface.php b/vendor/symfony/twig-bridge/Form/TwigRendererEngineInterface.php deleted file mode 100644 index a58f491..0000000 --- a/vendor/symfony/twig-bridge/Form/TwigRendererEngineInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Form; - -use Symfony\Component\Form\FormRendererEngineInterface; -use Twig\Environment; - -// BC/FC with namespaced Twig -class_exists('Twig\Environment'); - -/** - * @author Bernhard Schussek - * - * @deprecated since version 3.2, to be removed in 4.0. - */ -interface TwigRendererEngineInterface extends FormRendererEngineInterface -{ - public function setEnvironment(Environment $environment); -} diff --git a/vendor/symfony/twig-bridge/Form/TwigRendererInterface.php b/vendor/symfony/twig-bridge/Form/TwigRendererInterface.php deleted file mode 100644 index 3bcbf59..0000000 --- a/vendor/symfony/twig-bridge/Form/TwigRendererInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Form; - -use Symfony\Component\Form\FormRendererInterface; -use Twig\Environment; - -// BC/FC with namespaced Twig -class_exists('Twig\Environment'); - -/** - * @author Bernhard Schussek - * - * @deprecated since version 3.2, to be removed in 4.0. - */ -interface TwigRendererInterface extends FormRendererInterface -{ - public function setEnvironment(Environment $environment); -} diff --git a/vendor/symfony/twig-bridge/LICENSE b/vendor/symfony/twig-bridge/LICENSE deleted file mode 100644 index 17d16a1..0000000 --- a/vendor/symfony/twig-bridge/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2017 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/symfony/twig-bridge/Node/DumpNode.php b/vendor/symfony/twig-bridge/Node/DumpNode.php deleted file mode 100644 index d820d75..0000000 --- a/vendor/symfony/twig-bridge/Node/DumpNode.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Node; - -/** - * @author Julien Galenski - */ -class DumpNode extends Node -{ - private $varPrefix; - - public function __construct($varPrefix, Node $values = null, $lineno, $tag = null) - { - $nodes = array(); - if (null !== $values) { - $nodes['values'] = $values; - } - - parent::__construct($nodes, array(), $lineno, $tag); - $this->varPrefix = $varPrefix; - } - - /** - * {@inheritdoc} - */ - public function compile(Compiler $compiler) - { - $compiler - ->write("if (\$this->env->isDebug()) {\n") - ->indent(); - - if (!$this->hasNode('values')) { - // remove embedded templates (macros) from the context - $compiler - ->write(sprintf('$%svars = array();'."\n", $this->varPrefix)) - ->write(sprintf('foreach ($context as $%1$skey => $%1$sval) {'."\n", $this->varPrefix)) - ->indent() - ->write(sprintf('if (!$%sval instanceof \Twig\Template) {'."\n", $this->varPrefix)) - ->indent() - ->write(sprintf('$%1$svars[$%1$skey] = $%1$sval;'."\n", $this->varPrefix)) - ->outdent() - ->write("}\n") - ->outdent() - ->write("}\n") - ->addDebugInfo($this) - ->write(sprintf('\Symfony\Component\VarDumper\VarDumper::dump($%svars);'."\n", $this->varPrefix)); - } elseif (($values = $this->getNode('values')) && 1 === $values->count()) { - $compiler - ->addDebugInfo($this) - ->write('\Symfony\Component\VarDumper\VarDumper::dump(') - ->subcompile($values->getNode(0)) - ->raw(");\n"); - } else { - $compiler - ->addDebugInfo($this) - ->write('\Symfony\Component\VarDumper\VarDumper::dump(array('."\n") - ->indent(); - foreach ($values as $node) { - $compiler->write(''); - if ($node->hasAttribute('name')) { - $compiler - ->string($node->getAttribute('name')) - ->raw(' => '); - } - $compiler - ->subcompile($node) - ->raw(",\n"); - } - $compiler - ->outdent() - ->write("));\n"); - } - - $compiler - ->outdent() - ->write("}\n"); - } -} diff --git a/vendor/symfony/twig-bridge/Node/FormThemeNode.php b/vendor/symfony/twig-bridge/Node/FormThemeNode.php deleted file mode 100644 index 06d2400..0000000 --- a/vendor/symfony/twig-bridge/Node/FormThemeNode.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Node; - -/** - * @author Fabien Potencier - */ -class FormThemeNode extends Node -{ - public function __construct(Node $form, Node $resources, $lineno, $tag = null) - { - parent::__construct(array('form' => $form, 'resources' => $resources), array(), $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(') - ->subcompile($this->getNode('form')) - ->raw(', ') - ->subcompile($this->getNode('resources')) - ->raw(");\n"); - } -} diff --git a/vendor/symfony/twig-bridge/Node/RenderBlockNode.php b/vendor/symfony/twig-bridge/Node/RenderBlockNode.php deleted file mode 100644 index 0698fd9..0000000 --- a/vendor/symfony/twig-bridge/Node/RenderBlockNode.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Expression\FunctionExpression; - -/** - * Compiles a call to {@link \Symfony\Component\Form\FormRendererInterface::renderBlock()}. - * - * The function name is used as block name. For example, if the function name - * is "foo", the block "foo" will be rendered. - * - * @author Bernhard Schussek - */ -class RenderBlockNode extends FunctionExpression -{ - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - $arguments = iterator_to_array($this->getNode('arguments')); - $compiler->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->renderBlock('); - - if (isset($arguments[0])) { - $compiler->subcompile($arguments[0]); - $compiler->raw(', \''.$this->getAttribute('name').'\''); - - if (isset($arguments[1])) { - $compiler->raw(', '); - $compiler->subcompile($arguments[1]); - } - } - - $compiler->raw(')'); - } -} diff --git a/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php b/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php deleted file mode 100644 index dcdba5c..0000000 --- a/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\FunctionExpression; - -/** - * @author Bernhard Schussek - */ -class SearchAndRenderBlockNode extends FunctionExpression -{ - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - $compiler->raw('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock('); - - preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); - - $label = null; - $arguments = iterator_to_array($this->getNode('arguments')); - $blockNameSuffix = $matches[1]; - - if (isset($arguments[0])) { - $compiler->subcompile($arguments[0]); - $compiler->raw(', \''.$blockNameSuffix.'\''); - - if (isset($arguments[1])) { - if ('label' === $blockNameSuffix) { - // The "label" function expects the label in the second and - // the variables in the third argument - $label = $arguments[1]; - $variables = isset($arguments[2]) ? $arguments[2] : null; - $lineno = $label->getTemplateLine(); - - if ($label instanceof ConstantExpression) { - // If the label argument is given as a constant, we can either - // strip it away if it is empty, or integrate it into the array - // of variables at compile time. - $labelIsExpression = false; - - // Only insert the label into the array if it is not empty - if (!twig_test_empty($label->getAttribute('value'))) { - $originalVariables = $variables; - $variables = new ArrayExpression(array(), $lineno); - $labelKey = new ConstantExpression('label', $lineno); - - if (null !== $originalVariables) { - foreach ($originalVariables->getKeyValuePairs() as $pair) { - // Don't copy the original label attribute over if it exists - if ((string) $labelKey !== (string) $pair['key']) { - $variables->addElement($pair['value'], $pair['key']); - } - } - } - - // Insert the label argument into the array - $variables->addElement($label, $labelKey); - } - } else { - // The label argument is not a constant, but some kind of - // expression. This expression needs to be evaluated at runtime. - // Depending on the result (whether it is null or not), the - // label in the arguments should take precedence over the label - // in the attributes or not. - $labelIsExpression = true; - } - } else { - // All other functions than "label" expect the variables - // in the second argument - $label = null; - $variables = $arguments[1]; - $labelIsExpression = false; - } - - if (null !== $variables || $labelIsExpression) { - $compiler->raw(', '); - - if (null !== $variables) { - $compiler->subcompile($variables); - } - - if ($labelIsExpression) { - if (null !== $variables) { - $compiler->raw(' + '); - } - - // Check at runtime whether the label is empty. - // If not, add it to the array at runtime. - $compiler->raw('(twig_test_empty($_label_ = '); - $compiler->subcompile($label); - $compiler->raw(') ? array() : array("label" => $_label_))'); - } - } - } - } - - $compiler->raw(')'); - } -} diff --git a/vendor/symfony/twig-bridge/Node/StopwatchNode.php b/vendor/symfony/twig-bridge/Node/StopwatchNode.php deleted file mode 100644 index fac770c..0000000 --- a/vendor/symfony/twig-bridge/Node/StopwatchNode.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Expression\AssignNameExpression; -use Twig\Node\Node; - -/** - * Represents a stopwatch node. - * - * @author Wouter J - */ -class StopwatchNode extends Node -{ - public function __construct(Node $name, Node $body, AssignNameExpression $var, $lineno = 0, $tag = null) - { - parent::__construct(array('body' => $body, 'name' => $name, 'var' => $var), array(), $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('var')) - ->raw(' = ') - ->subcompile($this->getNode('name')) - ->write(";\n") - ->write("\$this->env->getExtension('Symfony\Bridge\Twig\Extension\StopwatchExtension')->getStopwatch()->start(") - ->subcompile($this->getNode('var')) - ->raw(", 'template');\n") - ->subcompile($this->getNode('body')) - ->write("\$this->env->getExtension('Symfony\Bridge\Twig\Extension\StopwatchExtension')->getStopwatch()->stop(") - ->subcompile($this->getNode('var')) - ->raw(");\n") - ; - } -} diff --git a/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php b/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php deleted file mode 100644 index c9c82b3..0000000 --- a/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Expression\AbstractExpression; -use Twig\Node\Node; - -/** - * @author Fabien Potencier - */ -class TransDefaultDomainNode extends Node -{ - public function __construct(AbstractExpression $expr, $lineno = 0, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - // noop as this node is just a marker for TranslationDefaultDomainNodeVisitor - } -} diff --git a/vendor/symfony/twig-bridge/Node/TransNode.php b/vendor/symfony/twig-bridge/Node/TransNode.php deleted file mode 100644 index 020810f..0000000 --- a/vendor/symfony/twig-bridge/Node/TransNode.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Node; - -use Twig\Compiler; -use Twig\Node\Expression\AbstractExpression; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Node\Node; -use Twig\Node\TextNode; - -// BC/FC with namespaced Twig -class_exists('Twig\Node\Expression\ArrayExpression'); - -/** - * @author Fabien Potencier - */ -class TransNode extends Node -{ - public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, $lineno = 0, $tag = null) - { - $nodes = array('body' => $body); - if (null !== $domain) { - $nodes['domain'] = $domain; - } - if (null !== $count) { - $nodes['count'] = $count; - } - if (null !== $vars) { - $nodes['vars'] = $vars; - } - if (null !== $locale) { - $nodes['locale'] = $locale; - } - - parent::__construct($nodes, array(), $lineno, $tag); - } - - public function compile(Compiler $compiler) - { - $compiler->addDebugInfo($this); - - $defaults = new ArrayExpression(array(), -1); - if ($this->hasNode('vars') && ($vars = $this->getNode('vars')) instanceof ArrayExpression) { - $defaults = $this->getNode('vars'); - $vars = null; - } - list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults, (bool) $vars); - - $method = !$this->hasNode('count') ? 'trans' : 'transChoice'; - - $compiler - ->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->getTranslator()->'.$method.'(') - ->subcompile($msg) - ; - - $compiler->raw(', '); - - if ($this->hasNode('count')) { - $compiler - ->subcompile($this->getNode('count')) - ->raw(', ') - ; - } - - if (null !== $vars) { - $compiler - ->raw('array_merge(') - ->subcompile($defaults) - ->raw(', ') - ->subcompile($this->getNode('vars')) - ->raw(')') - ; - } else { - $compiler->subcompile($defaults); - } - - $compiler->raw(', '); - - if (!$this->hasNode('domain')) { - $compiler->repr('messages'); - } else { - $compiler->subcompile($this->getNode('domain')); - } - - if ($this->hasNode('locale')) { - $compiler - ->raw(', ') - ->subcompile($this->getNode('locale')) - ; - } - $compiler->raw(");\n"); - } - - protected function compileString(Node $body, ArrayExpression $vars, $ignoreStrictCheck = false) - { - if ($body instanceof ConstantExpression) { - $msg = $body->getAttribute('value'); - } elseif ($body instanceof TextNode) { - $msg = $body->getAttribute('data'); - } else { - return array($body, $vars); - } - - preg_match_all('/(?getTemplateLine()); - if (!$vars->hasElement($key)) { - if ('count' === $var && $this->hasNode('count')) { - $vars->addElement($this->getNode('count'), $key); - } else { - $varExpr = new NameExpression($var, $body->getTemplateLine()); - $varExpr->setAttribute('ignore_strict_check', $ignoreStrictCheck); - $vars->addElement($varExpr, $key); - } - } - } - - return array(new ConstantExpression(str_replace('%%', '%', trim($msg)), $body->getTemplateLine()), $vars); - } -} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/Scope.php b/vendor/symfony/twig-bridge/NodeVisitor/Scope.php deleted file mode 100644 index 1284cf5..0000000 --- a/vendor/symfony/twig-bridge/NodeVisitor/Scope.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\NodeVisitor; - -/** - * @author Jean-François Simon - */ -class Scope -{ - /** - * @var Scope|null - */ - private $parent; - - /** - * @var array - */ - private $data = array(); - - /** - * @var bool - */ - private $left = false; - - /** - * @param Scope $parent - */ - public function __construct(Scope $parent = null) - { - $this->parent = $parent; - } - - /** - * Opens a new child scope. - * - * @return self - */ - public function enter() - { - return new self($this); - } - - /** - * Closes current scope and returns parent one. - * - * @return self|null - */ - public function leave() - { - $this->left = true; - - return $this->parent; - } - - /** - * Stores data into current scope. - * - * @param string $key - * @param mixed $value - * - * @return $this - * - * @throws \LogicException - */ - public function set($key, $value) - { - if ($this->left) { - throw new \LogicException('Left scope is not mutable.'); - } - - $this->data[$key] = $value; - - return $this; - } - - /** - * Tests if a data is visible from current scope. - * - * @param string $key - * - * @return bool - */ - public function has($key) - { - if (array_key_exists($key, $this->data)) { - return true; - } - - if (null === $this->parent) { - return false; - } - - return $this->parent->has($key); - } - - /** - * Returns data visible from current scope. - * - * @param string $key - * @param mixed $default - * - * @return mixed - */ - public function get($key, $default = null) - { - if (array_key_exists($key, $this->data)) { - return $this->data[$key]; - } - - if (null === $this->parent) { - return $default; - } - - return $this->parent->get($key, $default); - } -} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php deleted file mode 100644 index c04ce13..0000000 --- a/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\NodeVisitor; - -use Symfony\Bridge\Twig\Node\TransNode; -use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; -use Twig\Environment; -use Twig\Node\BlockNode; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\AssignNameExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\FilterExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Node\ModuleNode; -use Twig\Node\Node; -use Twig\Node\SetNode; -use Twig\NodeVisitor\AbstractNodeVisitor; - -/** - * @author Fabien Potencier - */ -class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor -{ - /** - * @var Scope - */ - private $scope; - - public function __construct() - { - $this->scope = new Scope(); - } - - /** - * {@inheritdoc} - */ - protected function doEnterNode(Node $node, Environment $env) - { - if ($node instanceof BlockNode || $node instanceof ModuleNode) { - $this->scope = $this->scope->enter(); - } - - if ($node instanceof TransDefaultDomainNode) { - if ($node->getNode('expr') instanceof ConstantExpression) { - $this->scope->set('domain', $node->getNode('expr')); - - return $node; - } else { - $var = $this->getVarName(); - $name = new AssignNameExpression($var, $node->getTemplateLine()); - $this->scope->set('domain', new NameExpression($var, $node->getTemplateLine())); - - return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine()); - } - } - - if (!$this->scope->has('domain')) { - return $node; - } - - if ($node instanceof FilterExpression && in_array($node->getNode('filter')->getAttribute('value'), array('trans', 'transchoice'))) { - $arguments = $node->getNode('arguments'); - $ind = 'trans' === $node->getNode('filter')->getAttribute('value') ? 1 : 2; - if ($this->isNamedArguments($arguments)) { - if (!$arguments->hasNode('domain') && !$arguments->hasNode($ind)) { - $arguments->setNode('domain', $this->scope->get('domain')); - } - } else { - if (!$arguments->hasNode($ind)) { - if (!$arguments->hasNode($ind - 1)) { - $arguments->setNode($ind - 1, new ArrayExpression(array(), $node->getTemplateLine())); - } - - $arguments->setNode($ind, $this->scope->get('domain')); - } - } - } elseif ($node instanceof TransNode) { - if (!$node->hasNode('domain')) { - $node->setNode('domain', $this->scope->get('domain')); - } - } - - return $node; - } - - /** - * {@inheritdoc} - */ - protected function doLeaveNode(Node $node, Environment $env) - { - if ($node instanceof TransDefaultDomainNode) { - return false; - } - - if ($node instanceof BlockNode || $node instanceof ModuleNode) { - $this->scope = $this->scope->leave(); - } - - return $node; - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return -10; - } - - /** - * @return bool - */ - private function isNamedArguments($arguments) - { - foreach ($arguments as $name => $node) { - if (!is_int($name)) { - return true; - } - } - - return false; - } - - private function getVarName() - { - return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); - } -} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php deleted file mode 100644 index 01f230b..0000000 --- a/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\NodeVisitor; - -use Symfony\Bridge\Twig\Node\TransNode; -use Twig\Environment; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\FilterExpression; -use Twig\Node\Node; -use Twig\NodeVisitor\AbstractNodeVisitor; - -/** - * TranslationNodeVisitor extracts translation messages. - * - * @author Fabien Potencier - */ -class TranslationNodeVisitor extends AbstractNodeVisitor -{ - const UNDEFINED_DOMAIN = '_undefined'; - - private $enabled = false; - private $messages = array(); - - public function enable() - { - $this->enabled = true; - $this->messages = array(); - } - - public function disable() - { - $this->enabled = false; - $this->messages = array(); - } - - public function getMessages() - { - return $this->messages; - } - - /** - * {@inheritdoc} - */ - protected function doEnterNode(Node $node, Environment $env) - { - if (!$this->enabled) { - return $node; - } - - if ( - $node instanceof FilterExpression && - 'trans' === $node->getNode('filter')->getAttribute('value') && - $node->getNode('node') instanceof ConstantExpression - ) { - // extract constant nodes with a trans filter - $this->messages[] = array( - $node->getNode('node')->getAttribute('value'), - $this->getReadDomainFromArguments($node->getNode('arguments'), 1), - ); - } elseif ( - $node instanceof FilterExpression && - 'transchoice' === $node->getNode('filter')->getAttribute('value') && - $node->getNode('node') instanceof ConstantExpression - ) { - // extract constant nodes with a trans filter - $this->messages[] = array( - $node->getNode('node')->getAttribute('value'), - $this->getReadDomainFromArguments($node->getNode('arguments'), 2), - ); - } elseif ($node instanceof TransNode) { - // extract trans nodes - $this->messages[] = array( - $node->getNode('body')->getAttribute('data'), - $node->hasNode('domain') ? $this->getReadDomainFromNode($node->getNode('domain')) : null, - ); - } - - return $node; - } - - /** - * {@inheritdoc} - */ - protected function doLeaveNode(Node $node, Environment $env) - { - return $node; - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 0; - } - - /** - * @param Node $arguments - * @param int $index - * - * @return string|null - */ - private function getReadDomainFromArguments(Node $arguments, $index) - { - if ($arguments->hasNode('domain')) { - $argument = $arguments->getNode('domain'); - } elseif ($arguments->hasNode($index)) { - $argument = $arguments->getNode($index); - } else { - return; - } - - return $this->getReadDomainFromNode($argument); - } - - /** - * @param Node $node - * - * @return string|null - */ - private function getReadDomainFromNode(Node $node) - { - if ($node instanceof ConstantExpression) { - return $node->getAttribute('value'); - } - - return self::UNDEFINED_DOMAIN; - } -} diff --git a/vendor/symfony/twig-bridge/README.md b/vendor/symfony/twig-bridge/README.md deleted file mode 100644 index eb08414..0000000 --- a/vendor/symfony/twig-bridge/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Twig Bridge -=========== - -Provides integration for [Twig](http://twig.sensiolabs.org/) with various -Symfony components. - -Resources ---------- - - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig deleted file mode 100644 index 5de20b1..0000000 --- a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig +++ /dev/null @@ -1,81 +0,0 @@ -{% use "bootstrap_3_layout.html.twig" %} - -{% block form_start -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-horizontal')|trim}) %} - {{- parent() -}} -{%- endblock form_start %} - -{# Labels #} - -{% block form_label -%} -{% spaceless %} - {% if label is same as(false) %} -
    - {% else %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} - {{- parent() -}} - {% endif %} -{% endspaceless %} -{%- endblock form_label %} - -{% block form_label_class -%} -col-sm-2 -{%- endblock form_label_class %} - -{# Rows #} - -{% block form_row -%} -
    - {{- form_label(form) -}} -
    - {{- form_widget(form) -}} - {{- form_errors(form) -}} -
    -{##}
    -{%- endblock form_row %} - -{% block checkbox_row -%} - {{- block('checkbox_radio_row') -}} -{%- endblock checkbox_row %} - -{% block radio_row -%} - {{- block('checkbox_radio_row') -}} -{%- endblock radio_row %} - -{% block checkbox_radio_row -%} -{% spaceless %} -
    -
    -
    - {{ form_widget(form) }} - {{ form_errors(form) }} -
    -
    -{% endspaceless %} -{%- endblock checkbox_radio_row %} - -{% block submit_row -%} -{% spaceless %} -
    -
    -
    - {{ form_widget(form) }} -
    -
    -{% endspaceless %} -{% endblock submit_row %} - -{% block reset_row -%} -{% spaceless %} -
    -
    -
    - {{ form_widget(form) }} -
    -
    -{% endspaceless %} -{% endblock reset_row %} - -{% block form_group_class -%} -col-sm-10 -{%- endblock form_group_class %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig deleted file mode 100644 index f2fe8bf..0000000 --- a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig +++ /dev/null @@ -1,283 +0,0 @@ -{% use "form_div_layout.html.twig" %} - -{# Widgets #} - -{% block form_widget_simple -%} - {% if type is not defined or type not in ['file', 'hidden'] %} - {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} - {% endif %} - {{- parent() -}} -{%- endblock form_widget_simple %} - -{% block textarea_widget -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} - {{- parent() -}} -{%- endblock textarea_widget %} - -{% block button_widget -%} - {% set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) %} - {{- parent() -}} -{%- endblock %} - -{% block money_widget -%} -
    - {% set append = money_pattern starts with '{{' %} - {% if not append %} - {{ money_pattern|replace({ '{{ widget }}':''}) }} - {% endif %} - {{- block('form_widget_simple') -}} - {% if append %} - {{ money_pattern|replace({ '{{ widget }}':''}) }} - {% endif %} -
    -{%- endblock money_widget %} - -{% block percent_widget -%} -
    - {{- block('form_widget_simple') -}} - % -
    -{%- endblock percent_widget %} - -{% block datetime_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} -
    - {{- form_errors(form.date) -}} - {{- form_errors(form.time) -}} - {{- form_widget(form.date, { datetime: true } ) -}} - {{- form_widget(form.time, { datetime: true } ) -}} -
    - {%- endif %} -{%- endblock datetime_widget %} - -{% block date_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - {% if datetime is not defined or not datetime -%} -
    - {%- endif %} - {{- date_pattern|replace({ - '{{ year }}': form_widget(form.year), - '{{ month }}': form_widget(form.month), - '{{ day }}': form_widget(form.day), - })|raw -}} - {% if datetime is not defined or not datetime -%} -
    - {%- endif -%} - {% endif %} -{%- endblock date_widget %} - -{% block time_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} - {% if datetime is not defined or false == datetime -%} -
    - {%- endif -%} - {{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %} - {% if datetime is not defined or false == datetime -%} -
    - {%- endif -%} - {% endif %} -{%- endblock time_widget %} - -{%- block dateinterval_widget -%} - {%- if widget == 'single_text' -%} - {{- block('form_widget_simple') -}} - {%- else -%} - {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} -
    - {{- form_errors(form) -}} -
    - - - - {%- if with_years %}{% endif -%} - {%- if with_months %}{% endif -%} - {%- if with_weeks %}{% endif -%} - {%- if with_days %}{% endif -%} - {%- if with_hours %}{% endif -%} - {%- if with_minutes %}{% endif -%} - {%- if with_seconds %}{% endif -%} - - - - - {%- if with_years %}{% endif -%} - {%- if with_months %}{% endif -%} - {%- if with_weeks %}{% endif -%} - {%- if with_days %}{% endif -%} - {%- if with_hours %}{% endif -%} - {%- if with_minutes %}{% endif -%} - {%- if with_seconds %}{% endif -%} - - -
    {{ form_label(form.years) }}{{ form_label(form.months) }}{{ form_label(form.weeks) }}{{ form_label(form.days) }}{{ form_label(form.hours) }}{{ form_label(form.minutes) }}{{ form_label(form.seconds) }}
    {{ form_widget(form.years) }}{{ form_widget(form.months) }}{{ form_widget(form.weeks) }}{{ form_widget(form.days) }}{{ form_widget(form.hours) }}{{ form_widget(form.minutes) }}{{ form_widget(form.seconds) }}
    -
    - {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} -
    - {%- endif -%} -{%- endblock dateinterval_widget -%} - -{% block choice_widget_collapsed -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} - {{- parent() -}} -{%- endblock %} - -{% block choice_widget_expanded -%} - {% if '-inline' in label_attr.class|default('') -%} - {%- for child in form %} - {{- form_widget(child, { - parent_label_class: label_attr.class|default(''), - translation_domain: choice_translation_domain, - }) -}} - {% endfor -%} - {%- else -%} -
    - {%- for child in form %} - {{- form_widget(child, { - parent_label_class: label_attr.class|default(''), - translation_domain: choice_translation_domain, - }) -}} - {% endfor -%} -
    - {%- endif %} -{%- endblock choice_widget_expanded %} - -{% block checkbox_widget -%} - {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} - {% if 'checkbox-inline' in parent_label_class %} - {{- form_label(form, null, { widget: parent() }) -}} - {% else -%} -
    - {{- form_label(form, null, { widget: parent() }) -}} -
    - {%- endif %} -{%- endblock checkbox_widget %} - -{% block radio_widget -%} - {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} - {% if 'radio-inline' in parent_label_class %} - {{- form_label(form, null, { widget: parent() }) -}} - {% else -%} -
    - {{- form_label(form, null, { widget: parent() }) -}} -
    - {%- endif %} -{%- endblock radio_widget %} - -{# Labels #} - -{% block form_label -%} - {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' control-label')|trim}) -%} - {{- parent() -}} -{%- endblock form_label %} - -{% block choice_label -%} - {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} - {%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%} - {{- block('form_label') -}} -{% endblock %} - -{% block checkbox_label -%} - {{- block('checkbox_radio_label') -}} -{%- endblock checkbox_label %} - -{% block radio_label -%} - {{- block('checkbox_radio_label') -}} -{%- endblock radio_label %} - -{% block checkbox_radio_label %} - {# Do not display the label if widget is not defined in order to prevent double label rendering #} - {% if widget is defined %} - {% if required %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} - {% endif %} - {% if parent_label_class is defined %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} - {% endif %} - {% if label is not same as(false) and label is empty %} - {%- if label_format is not empty -%} - {% set label = label_format|replace({ - '%name%': name, - '%id%': id, - }) %} - {%- else -%} - {% set label = name|humanize %} - {%- endif -%} - {% endif %} - - {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} - - {% endif %} -{% endblock checkbox_radio_label %} - -{# Rows #} - -{% block form_row -%} -
    - {{- form_label(form) -}} - {{- form_widget(form) -}} - {{- form_errors(form) -}} -
    -{%- endblock form_row %} - -{% block button_row -%} -
    - {{- form_widget(form) -}} -
    -{%- endblock button_row %} - -{% block choice_row -%} - {% set force_error = true %} - {{- block('form_row') }} -{%- endblock choice_row %} - -{% block date_row -%} - {% set force_error = true %} - {{- block('form_row') }} -{%- endblock date_row %} - -{% block time_row -%} - {% set force_error = true %} - {{- block('form_row') }} -{%- endblock time_row %} - -{% block datetime_row -%} - {% set force_error = true %} - {{- block('form_row') }} -{%- endblock datetime_row %} - -{% block checkbox_row -%} -
    - {{- form_widget(form) -}} - {{- form_errors(form) -}} -
    -{%- endblock checkbox_row %} - -{% block radio_row -%} -
    - {{- form_widget(form) -}} - {{- form_errors(form) -}} -
    -{%- endblock radio_row %} - -{# Errors #} - -{% block form_errors -%} - {% if errors|length > 0 -%} - {% if form.parent %}{% else %}
    {% endif %} -
      - {%- for error in errors -%} -
    • {{ error.message }}
    • - {%- endfor -%} -
    - {% if form.parent %}{% else %}
    {% endif %} - {%- endif %} -{%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig deleted file mode 100644 index 3d8afe2..0000000 --- a/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig +++ /dev/null @@ -1,393 +0,0 @@ -{# Widgets #} - -{%- block form_widget -%} - {% if compound %} - {{- block('form_widget_compound') -}} - {% else %} - {{- block('form_widget_simple') -}} - {% endif %} -{%- endblock form_widget -%} - -{%- block form_widget_simple -%} - {%- set type = type|default('text') -%} - -{%- endblock form_widget_simple -%} - -{%- block form_widget_compound -%} -
    - {%- if form.parent is empty -%} - {{ form_errors(form) }} - {%- endif -%} - {{- block('form_rows') -}} - {{- form_rest(form) -}} -
    -{%- endblock form_widget_compound -%} - -{%- block collection_widget -%} - {% if prototype is defined %} - {%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%} - {% endif %} - {{- block('form_widget') -}} -{%- endblock collection_widget -%} - -{%- block textarea_widget -%} - -{%- endblock textarea_widget -%} - -{%- block choice_widget -%} - {% if expanded %} - {{- block('choice_widget_expanded') -}} - {% else %} - {{- block('choice_widget_collapsed') -}} - {% endif %} -{%- endblock choice_widget -%} - -{%- block choice_widget_expanded -%} -
    - {%- for child in form %} - {{- form_widget(child) -}} - {{- form_label(child, null, {translation_domain: choice_translation_domain}) -}} - {% endfor -%} -
    -{%- endblock choice_widget_expanded -%} - -{%- block choice_widget_collapsed -%} - {%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%} - {% set required = false %} - {%- endif -%} - -{%- endblock choice_widget_collapsed -%} - -{%- block choice_widget_options -%} - {% for group_label, choice in options %} - {%- if choice is iterable -%} - - {% set options = choice %} - {{- block('choice_widget_options') -}} - - {%- else -%} - - {%- endif -%} - {% endfor %} -{%- endblock choice_widget_options -%} - -{%- block checkbox_widget -%} - -{%- endblock checkbox_widget -%} - -{%- block radio_widget -%} - -{%- endblock radio_widget -%} - -{%- block datetime_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {%- else -%} -
    - {{- form_errors(form.date) -}} - {{- form_errors(form.time) -}} - {{- form_widget(form.date) -}} - {{- form_widget(form.time) -}} -
    - {%- endif -%} -{%- endblock datetime_widget -%} - -{%- block date_widget -%} - {%- if widget == 'single_text' -%} - {{ block('form_widget_simple') }} - {%- else -%} -
    - {{- date_pattern|replace({ - '{{ year }}': form_widget(form.year), - '{{ month }}': form_widget(form.month), - '{{ day }}': form_widget(form.day), - })|raw -}} -
    - {%- endif -%} -{%- endblock date_widget -%} - -{%- block time_widget -%} - {%- if widget == 'single_text' -%} - {{ block('form_widget_simple') }} - {%- else -%} - {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%} -
    - {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %} -
    - {%- endif -%} -{%- endblock time_widget -%} - -{%- block dateinterval_widget -%} - {%- if widget == 'single_text' -%} - {{- block('form_widget_simple') -}} - {%- else -%} -
    - {{- form_errors(form) -}} - - - - {%- if with_years %}{% endif -%} - {%- if with_months %}{% endif -%} - {%- if with_weeks %}{% endif -%} - {%- if with_days %}{% endif -%} - {%- if with_hours %}{% endif -%} - {%- if with_minutes %}{% endif -%} - {%- if with_seconds %}{% endif -%} - - - - - {%- if with_years %}{% endif -%} - {%- if with_months %}{% endif -%} - {%- if with_weeks %}{% endif -%} - {%- if with_days %}{% endif -%} - {%- if with_hours %}{% endif -%} - {%- if with_minutes %}{% endif -%} - {%- if with_seconds %}{% endif -%} - - -
    {{ form_label(form.years) }}{{ form_label(form.months) }}{{ form_label(form.weeks) }}{{ form_label(form.days) }}{{ form_label(form.hours) }}{{ form_label(form.minutes) }}{{ form_label(form.seconds) }}
    {{ form_widget(form.years) }}{{ form_widget(form.months) }}{{ form_widget(form.weeks) }}{{ form_widget(form.days) }}{{ form_widget(form.hours) }}{{ form_widget(form.minutes) }}{{ form_widget(form.seconds) }}
    - {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} -
    - {%- endif -%} -{%- endblock dateinterval_widget -%} - -{%- block number_widget -%} - {# type="number" doesn't work with floats #} - {%- set type = type|default('text') -%} - {{ block('form_widget_simple') }} -{%- endblock number_widget -%} - -{%- block integer_widget -%} - {%- set type = type|default('number') -%} - {{ block('form_widget_simple') }} -{%- endblock integer_widget -%} - -{%- block money_widget -%} - {{ money_pattern|replace({ '{{ widget }}': block('form_widget_simple') })|raw }} -{%- endblock money_widget -%} - -{%- block url_widget -%} - {%- set type = type|default('url') -%} - {{ block('form_widget_simple') }} -{%- endblock url_widget -%} - -{%- block search_widget -%} - {%- set type = type|default('search') -%} - {{ block('form_widget_simple') }} -{%- endblock search_widget -%} - -{%- block percent_widget -%} - {%- set type = type|default('text') -%} - {{ block('form_widget_simple') }} % -{%- endblock percent_widget -%} - -{%- block password_widget -%} - {%- set type = type|default('password') -%} - {{ block('form_widget_simple') }} -{%- endblock password_widget -%} - -{%- block hidden_widget -%} - {%- set type = type|default('hidden') -%} - {{ block('form_widget_simple') }} -{%- endblock hidden_widget -%} - -{%- block email_widget -%} - {%- set type = type|default('email') -%} - {{ block('form_widget_simple') }} -{%- endblock email_widget -%} - -{%- block range_widget -%} - {% set type = type|default('range') %} - {{- block('form_widget_simple') -}} -{%- endblock range_widget %} - -{%- block button_widget -%} - {%- if label is empty -%} - {%- if label_format is not empty -%} - {% set label = label_format|replace({ - '%name%': name, - '%id%': id, - }) %} - {%- else -%} - {% set label = name|humanize %} - {%- endif -%} - {%- endif -%} - -{%- endblock button_widget -%} - -{%- block submit_widget -%} - {%- set type = type|default('submit') -%} - {{ block('button_widget') }} -{%- endblock submit_widget -%} - -{%- block reset_widget -%} - {%- set type = type|default('reset') -%} - {{ block('button_widget') }} -{%- endblock reset_widget -%} - -{# Labels #} - -{%- block form_label -%} - {% if label is not same as(false) -%} - {% if not compound -%} - {% set label_attr = label_attr|merge({'for': id}) %} - {%- endif -%} - {% if required -%} - {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} - {%- endif -%} - {% if label is empty -%} - {%- if label_format is not empty -%} - {% set label = label_format|replace({ - '%name%': name, - '%id%': id, - }) %} - {%- else -%} - {% set label = name|humanize %} - {%- endif -%} - {%- endif -%} - {{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }} - {%- endif -%} -{%- endblock form_label -%} - -{%- block button_label -%}{%- endblock -%} - -{# Rows #} - -{%- block repeated_row -%} - {# - No need to render the errors here, as all errors are mapped - to the first child (see RepeatedTypeValidatorExtension). - #} - {{- block('form_rows') -}} -{%- endblock repeated_row -%} - -{%- block form_row -%} -
    - {{- form_label(form) -}} - {{- form_errors(form) -}} - {{- form_widget(form) -}} -
    -{%- endblock form_row -%} - -{%- block button_row -%} -
    - {{- form_widget(form) -}} -
    -{%- endblock button_row -%} - -{%- block hidden_row -%} - {{ form_widget(form) }} -{%- endblock hidden_row -%} - -{# Misc #} - -{%- block form -%} - {{ form_start(form) }} - {{- form_widget(form) -}} - {{ form_end(form) }} -{%- endblock form -%} - -{%- block form_start -%} - {%- do form.setMethodRendered() -%} - {% set method = method|upper %} - {%- if method in ["GET", "POST"] -%} - {% set form_method = method %} - {%- else -%} - {% set form_method = "POST" %} - {%- endif -%} -
    - {%- if form_method != method -%} - - {%- endif -%} -{%- endblock form_start -%} - -{%- block form_end -%} - {%- if not render_rest is defined or render_rest -%} - {{ form_rest(form) }} - {%- endif -%} -
    -{%- endblock form_end -%} - -{%- block form_errors -%} - {%- if errors|length > 0 -%} -
      - {%- for error in errors -%} -
    • {{ error.message }}
    • - {%- endfor -%} -
    - {%- endif -%} -{%- endblock form_errors -%} - -{%- block form_rest -%} - {% for child in form -%} - {% if not child.rendered %} - {{- form_row(child) -}} - {% endif %} - {%- endfor %} - - {% if not form.methodRendered and form.parent is null %} - {%- do form.setMethodRendered() -%} - {% set method = method|upper %} - {%- if method in ["GET", "POST"] -%} - {% set form_method = method %} - {%- else -%} - {% set form_method = "POST" %} - {%- endif -%} - - {%- if form_method != method -%} - - {%- endif -%} - {% endif %} -{% endblock form_rest %} - -{# Support #} - -{%- block form_rows -%} - {% for child in form %} - {{- form_row(child) -}} - {% endfor %} -{%- endblock form_rows -%} - -{%- block widget_attributes -%} - id="{{ id }}" name="{{ full_name }}" - {%- if disabled %} disabled="disabled"{% endif -%} - {%- if required %} required="required"{% endif -%} - {{ block('attributes') }} -{%- endblock widget_attributes -%} - -{%- block widget_container_attributes -%} - {%- if id is not empty %}id="{{ id }}"{% endif -%} - {{ block('attributes') }} -{%- endblock widget_container_attributes -%} - -{%- block button_attributes -%} - id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%} - {{ block('attributes') }} -{%- endblock button_attributes -%} - -{% block attributes -%} - {%- for attrname, attrvalue in attr -%} - {{- " " -}} - {%- if attrname in ['placeholder', 'title'] -%} - {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}" - {%- elseif attrvalue is same as(true) -%} - {{- attrname }}="{{ attrname }}" - {%- elseif attrvalue is not same as(false) -%} - {{- attrname }}="{{ attrvalue }}" - {%- endif -%} - {%- endfor -%} -{%- endblock attributes -%} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig deleted file mode 100644 index c7b3a43..0000000 --- a/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig +++ /dev/null @@ -1,44 +0,0 @@ -{% use "form_div_layout.html.twig" %} - -{%- block form_row -%} - - - {{- form_label(form) -}} - - - {{- form_errors(form) -}} - {{- form_widget(form) -}} - - -{%- endblock form_row -%} - -{%- block button_row -%} - - - - {{- form_widget(form) -}} - - -{%- endblock button_row -%} - -{%- block hidden_row -%} - - - {{- form_widget(form) -}} - - -{%- endblock hidden_row -%} - -{%- block form_widget_compound -%} - - {%- if form.parent is empty and errors|length > 0 -%} - - - - {%- endif -%} - {{- block('form_rows') -}} - {{- form_rest(form) -}} -
    - {{- form_errors(form) -}} -
    -{%- endblock form_widget_compound -%} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig deleted file mode 100644 index dc7bec9..0000000 --- a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig +++ /dev/null @@ -1,328 +0,0 @@ -{% extends "form_div_layout.html.twig" %} - -{# Based on Foundation 5 Doc #} -{# Widgets #} - -{% block form_widget_simple -%} - {% if errors|length > 0 -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {{- parent() -}} -{%- endblock form_widget_simple %} - -{% block textarea_widget -%} - {% if errors|length > 0 -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {{- parent() -}} -{%- endblock textarea_widget %} - -{% block button_widget -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} - {{- parent() -}} -{%- endblock %} - -{% block money_widget -%} -
    - {% set prepend = '{{' == money_pattern[0:2] %} - {% if not prepend %} -
    - {{ money_pattern|replace({ '{{ widget }}':''}) }} -
    - {% endif %} -
    - {{- block('form_widget_simple') -}} -
    - {% if prepend %} -
    - {{ money_pattern|replace({ '{{ widget }}':''}) }} -
    - {% endif %} -
    -{%- endblock money_widget %} - -{% block percent_widget -%} -
    -
    - {{- block('form_widget_simple') -}} -
    -
    - % -
    -
    -{%- endblock percent_widget %} - -{% block datetime_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else %} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} -
    -
    {{ form_errors(form.date) }}
    -
    {{ form_errors(form.time) }}
    -
    -
    -
    {{ form_widget(form.date, { datetime: true } ) }}
    -
    {{ form_widget(form.time, { datetime: true } ) }}
    -
    - {% endif %} -{%- endblock datetime_widget %} - -{% block date_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else %} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} - {% if datetime is not defined or not datetime %} -
    - {% endif %} - {{- date_pattern|replace({ - '{{ year }}': '
    ' ~ form_widget(form.year) ~ '
    ', - '{{ month }}': '
    ' ~ form_widget(form.month) ~ '
    ', - '{{ day }}': '
    ' ~ form_widget(form.day) ~ '
    ', - })|raw -}} - {% if datetime is not defined or not datetime %} -
    - {% endif %} - {% endif %} -{%- endblock date_widget %} - -{% block time_widget -%} - {% if widget == 'single_text' %} - {{- block('form_widget_simple') -}} - {% else %} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} - {% if datetime is not defined or false == datetime %} -
    - {% endif %} - {% if with_seconds %} -
    {{ form_widget(form.hour) }}
    -
    -
    -
    - : -
    -
    - {{ form_widget(form.minute) }} -
    -
    -
    -
    -
    -
    - : -
    -
    - {{ form_widget(form.second) }} -
    -
    -
    - {% else %} -
    {{ form_widget(form.hour) }}
    -
    -
    -
    - : -
    -
    - {{ form_widget(form.minute) }} -
    -
    -
    - {% endif %} - {% if datetime is not defined or false == datetime %} -
    - {% endif %} - {% endif %} -{%- endblock time_widget %} - -{% block choice_widget_collapsed -%} - {% if errors|length > 0 -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - - {% if multiple -%} - {% set attr = attr|merge({style: (attr.style|default('') ~ ' height: auto; background-image: none;')|trim}) %} - {% endif %} - - {% if required and placeholder is none and not placeholder_in_choices and not multiple -%} - {% set required = false %} - {%- endif -%} - -{%- endblock choice_widget_collapsed %} - -{% block choice_widget_expanded -%} - {% if '-inline' in label_attr.class|default('') %} -
      - {% for child in form %} -
    • {{ form_widget(child, { - parent_label_class: label_attr.class|default(''), - }) }}
    • - {% endfor %} -
    - {% else %} -
    - {% for child in form %} - {{ form_widget(child, { - parent_label_class: label_attr.class|default(''), - }) }} - {% endfor %} -
    - {% endif %} -{%- endblock choice_widget_expanded %} - -{% block checkbox_widget -%} - {% set parent_label_class = parent_label_class|default('') %} - {% if errors|length > 0 -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {% if 'checkbox-inline' in parent_label_class %} - {{ form_label(form, null, { widget: parent() }) }} - {% else %} -
    - {{ form_label(form, null, { widget: parent() }) }} -
    - {% endif %} -{%- endblock checkbox_widget %} - -{% block radio_widget -%} - {% set parent_label_class = parent_label_class|default('') %} - {% if 'radio-inline' in parent_label_class %} - {{ form_label(form, null, { widget: parent() }) }} - {% else %} - {% if errors|length > 0 -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} - {% endif %} -
    - {{ form_label(form, null, { widget: parent() }) }} -
    - {% endif %} -{%- endblock radio_widget %} - -{# Labels #} - -{% block form_label -%} - {% if errors|length > 0 -%} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {{- parent() -}} -{%- endblock form_label %} - -{% block choice_label -%} - {% if errors|length > 0 -%} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} - {% set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) %} - {{- block('form_label') -}} -{%- endblock %} - -{% block checkbox_label -%} - {{- block('checkbox_radio_label') -}} -{%- endblock checkbox_label %} - -{% block radio_label -%} - {{- block('checkbox_radio_label') -}} -{%- endblock radio_label %} - -{% block checkbox_radio_label -%} - {% if required %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} - {% endif %} - {% if errors|length > 0 -%} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} - {% endif %} - {% if parent_label_class is defined %} - {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ parent_label_class)|trim}) %} - {% endif %} - {% if label is empty %} - {%- if label_format is not empty -%} - {% set label = label_format|replace({ - '%name%': name, - '%id%': id, - }) %} - {%- else -%} - {% set label = name|humanize %} - {%- endif -%} - {% endif %} - - {{ widget|raw }} - {{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }} - -{%- endblock checkbox_radio_label %} - -{# Rows #} - -{% block form_row -%} -
    -
    - {{ form_label(form) }} - {{ form_widget(form) }} - {{ form_errors(form) }} -
    -
    -{%- endblock form_row %} - -{% block choice_row -%} - {% set force_error = true %} - {{ block('form_row') }} -{%- endblock choice_row %} - -{% block date_row -%} - {% set force_error = true %} - {{ block('form_row') }} -{%- endblock date_row %} - -{% block time_row -%} - {% set force_error = true %} - {{ block('form_row') }} -{%- endblock time_row %} - -{% block datetime_row -%} - {% set force_error = true %} - {{ block('form_row') }} -{%- endblock datetime_row %} - -{% block checkbox_row -%} -
    -
    - {{ form_widget(form) }} - {{ form_errors(form) }} -
    -
    -{%- endblock checkbox_row %} - -{% block radio_row -%} -
    -
    - {{ form_widget(form) }} - {{ form_errors(form) }} -
    -
    -{%- endblock radio_row %} - -{# Errors #} - -{% block form_errors -%} - {% if errors|length > 0 -%} - {% if form.parent %}{% else %}
    {% endif %} - {%- for error in errors -%} - {{ error.message }} - {% if not loop.last %}, {% endif %} - {%- endfor -%} - {% if form.parent %}{% else %}
    {% endif %} - {%- endif %} -{%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Tests/AppVariableTest.php b/vendor/symfony/twig-bridge/Tests/AppVariableTest.php deleted file mode 100644 index 2a97c26..0000000 --- a/vendor/symfony/twig-bridge/Tests/AppVariableTest.php +++ /dev/null @@ -1,270 +0,0 @@ -appVariable = new AppVariable(); - } - - /** - * @dataProvider debugDataProvider - */ - public function testDebug($debugFlag) - { - $this->appVariable->setDebug($debugFlag); - - $this->assertEquals($debugFlag, $this->appVariable->getDebug()); - } - - public function debugDataProvider() - { - return array( - 'debug on' => array(true), - 'debug off' => array(false), - ); - } - - public function testEnvironment() - { - $this->appVariable->setEnvironment('dev'); - - $this->assertEquals('dev', $this->appVariable->getEnvironment()); - } - - public function testGetSession() - { - $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn($session = new Session()); - - $this->setRequestStack($request); - - $this->assertEquals($session, $this->appVariable->getSession()); - } - - public function testGetSessionWithNoRequest() - { - $this->setRequestStack(null); - - $this->assertNull($this->appVariable->getSession()); - } - - public function testGetRequest() - { - $this->setRequestStack($request = new Request()); - - $this->assertEquals($request, $this->appVariable->getRequest()); - } - - public function testGetToken() - { - $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); - $this->appVariable->setTokenStorage($tokenStorage); - - $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); - $tokenStorage->method('getToken')->willReturn($token); - - $this->assertEquals($token, $this->appVariable->getToken()); - } - - public function testGetUser() - { - $this->setTokenStorage($user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()); - - $this->assertEquals($user, $this->appVariable->getUser()); - } - - public function testGetUserWithUsernameAsTokenUser() - { - $this->setTokenStorage($user = 'username'); - - $this->assertNull($this->appVariable->getUser()); - } - - public function testGetTokenWithNoToken() - { - $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); - $this->appVariable->setTokenStorage($tokenStorage); - - $this->assertNull($this->appVariable->getToken()); - } - - public function testGetUserWithNoToken() - { - $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); - $this->appVariable->setTokenStorage($tokenStorage); - - $this->assertNull($this->appVariable->getUser()); - } - - /** - * @expectedException \RuntimeException - */ - public function testEnvironmentNotSet() - { - $this->appVariable->getEnvironment(); - } - - /** - * @expectedException \RuntimeException - */ - public function testDebugNotSet() - { - $this->appVariable->getDebug(); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetTokenWithTokenStorageNotSet() - { - $this->appVariable->getToken(); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetUserWithTokenStorageNotSet() - { - $this->appVariable->getUser(); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetRequestWithRequestStackNotSet() - { - $this->appVariable->getRequest(); - } - - /** - * @expectedException \RuntimeException - */ - public function testGetSessionWithRequestStackNotSet() - { - $this->appVariable->getSession(); - } - - public function testGetFlashesWithNoRequest() - { - $this->setRequestStack(null); - - $this->assertEquals(array(), $this->appVariable->getFlashes()); - } - - public function testGetFlashesWithNoSessionStarted() - { - $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn(new Session()); - - $this->setRequestStack($request); - - $this->assertEquals(array(), $this->appVariable->getFlashes()); - } - - public function testGetFlashes() - { - $flashMessages = $this->setFlashMessages(); - $this->assertEquals($flashMessages, $this->appVariable->getFlashes(null)); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals($flashMessages, $this->appVariable->getFlashes('')); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals($flashMessages, $this->appVariable->getFlashes(array())); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals(array(), $this->appVariable->getFlashes('this-does-not-exist')); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals( - array('this-does-not-exist' => array()), - $this->appVariable->getFlashes(array('this-does-not-exist')) - ); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals($flashMessages['notice'], $this->appVariable->getFlashes('notice')); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals( - array('notice' => $flashMessages['notice']), - $this->appVariable->getFlashes(array('notice')) - ); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals( - array('notice' => $flashMessages['notice'], 'this-does-not-exist' => array()), - $this->appVariable->getFlashes(array('notice', 'this-does-not-exist')) - ); - - $flashMessages = $this->setFlashMessages(); - $this->assertEquals( - array('notice' => $flashMessages['notice'], 'error' => $flashMessages['error']), - $this->appVariable->getFlashes(array('notice', 'error')) - ); - - $this->assertEquals( - array('warning' => $flashMessages['warning']), - $this->appVariable->getFlashes(array('warning')), - 'After getting some flash types (e.g. "notice" and "error"), the rest of flash messages must remain (e.g. "warning").' - ); - - $this->assertEquals( - array('this-does-not-exist' => array()), - $this->appVariable->getFlashes(array('this-does-not-exist')) - ); - } - - protected function setRequestStack($request) - { - $requestStackMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStackMock->method('getCurrentRequest')->willReturn($request); - - $this->appVariable->setRequestStack($requestStackMock); - } - - protected function setTokenStorage($user) - { - $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); - $this->appVariable->setTokenStorage($tokenStorage); - - $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); - $tokenStorage->method('getToken')->willReturn($token); - - $token->method('getUser')->willReturn($user); - } - - private function setFlashMessages() - { - $flashMessages = array( - 'notice' => array('Notice #1 message'), - 'warning' => array('Warning #1 message'), - 'error' => array('Error #1 message', 'Error #2 message'), - ); - $flashBag = new FlashBag(); - $flashBag->initialize($flashMessages); - - $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->getMock(); - $session->method('isStarted')->willReturn(true); - $session->method('getFlashBag')->willReturn($flashBag); - - $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->method('getSession')->willReturn($session); - $this->setRequestStack($request); - - return $flashMessages; - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php b/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php deleted file mode 100644 index ef7698c..0000000 --- a/vendor/symfony/twig-bridge/Tests/Command/LintCommandTest.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Command; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Command\LintCommand; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Tester\CommandTester; -use Twig\Loader\FilesystemLoader; -use Twig\Environment; - -class LintCommandTest extends TestCase -{ - private $files; - - public function testLintCorrectFile() - { - $tester = $this->createCommandTester(); - $filename = $this->createFile('{{ foo }}'); - - $ret = $tester->execute(array('filename' => array($filename)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false)); - - $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('OK in', trim($tester->getDisplay())); - } - - public function testLintIncorrectFile() - { - $tester = $this->createCommandTester(); - $filename = $this->createFile('{{ foo'); - - $ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false)); - - $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); - } - - /** - * @expectedException \RuntimeException - */ - public function testLintFileNotReadable() - { - $tester = $this->createCommandTester(); - $filename = $this->createFile(''); - unlink($filename); - - $ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false)); - } - - public function testLintFileCompileTimeException() - { - $tester = $this->createCommandTester(); - $filename = $this->createFile("{{ 2|number_format(2, decimal_point='.', ',') }}"); - - $ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false)); - - $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); - } - - /** - * @return CommandTester - */ - private function createCommandTester() - { - $twig = new Environment(new FilesystemLoader()); - - $command = new LintCommand(); - $command->setTwigEnvironment($twig); - - $application = new Application(); - $application->add($command); - $command = $application->find('lint:twig'); - - return new CommandTester($command); - } - - /** - * @return string Path to the new file - */ - private function createFile($content) - { - $filename = tempnam(sys_get_temp_dir(), 'sf-'); - file_put_contents($filename, $content); - - $this->files[] = $filename; - - return $filename; - } - - protected function setUp() - { - $this->files = array(); - } - - protected function tearDown() - { - foreach ($this->files as $file) { - if (file_exists($file)) { - unlink($file); - } - } - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/CodeExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/CodeExtensionTest.php deleted file mode 100644 index 336991c..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/CodeExtensionTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\CodeExtension; -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; - -class CodeExtensionTest extends TestCase -{ - public function testFormatFile() - { - $expected = sprintf('%s at line 25', substr(__FILE__, 5), __FILE__); - $this->assertEquals($expected, $this->getExtension()->formatFile(__FILE__, 25)); - } - - /** - * @dataProvider getClassNameProvider - */ - public function testGettingClassAbbreviation($class, $abbr) - { - $this->assertEquals($this->getExtension()->abbrClass($class), $abbr); - } - - /** - * @dataProvider getMethodNameProvider - */ - public function testGettingMethodAbbreviation($method, $abbr) - { - $this->assertEquals($this->getExtension()->abbrMethod($method), $abbr); - } - - public function getClassNameProvider() - { - return array( - array('F\Q\N\Foo', 'Foo'), - array('Bare', 'Bare'), - ); - } - - public function getMethodNameProvider() - { - return array( - array('F\Q\N\Foo::Method', 'Foo::Method()'), - array('Bare::Method', 'Bare::Method()'), - array('Closure', 'Closure'), - array('Method', 'Method()'), - ); - } - - public function testGetName() - { - $this->assertEquals('code', $this->getExtension()->getName()); - } - - protected function getExtension() - { - return new CodeExtension(new FileLinkFormatter('proto://%f#&line=%l&'.substr(__FILE__, 0, 5).'>foobar'), '/root', 'UTF-8'); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/DumpExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/DumpExtensionTest.php deleted file mode 100644 index ce80418..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/DumpExtensionTest.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\DumpExtension; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; -use Symfony\Component\VarDumper\VarDumper; -use Symfony\Component\VarDumper\Cloner\VarCloner; -use Twig\Environment; -use Twig\Loader\ArrayLoader; - -class DumpExtensionTest extends TestCase -{ - /** - * @dataProvider getDumpTags - */ - public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped) - { - $extension = new DumpExtension(new VarCloner()); - $twig = new Environment(new ArrayLoader(array('template' => $template)), array( - 'debug' => $debug, - 'cache' => false, - 'optimizations' => 0, - )); - $twig->addExtension($extension); - - $dumped = null; - $exception = null; - $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) { $dumped = $var; }); - - try { - $this->assertEquals($expectedOutput, $twig->render('template')); - } catch (\Exception $exception) { - } - - VarDumper::setHandler($prevDumper); - - if (null !== $exception) { - throw $exception; - } - - $this->assertSame($expectedDumped, $dumped); - } - - public function getDumpTags() - { - return array( - array('A{% dump %}B', true, 'AB', array()), - array('A{% set foo="bar"%}B{% dump %}C', true, 'ABC', array('foo' => 'bar')), - array('A{% dump %}B', false, 'AB', null), - ); - } - - /** - * @dataProvider getDumpArgs - */ - public function testDump($context, $args, $expectedOutput, $debug = true) - { - $extension = new DumpExtension(new VarCloner()); - $twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array( - 'debug' => $debug, - 'cache' => false, - 'optimizations' => 0, - )); - - array_unshift($args, $context); - array_unshift($args, $twig); - - $dump = call_user_func_array(array($extension, 'dump'), $args); - - if ($debug) { - $this->assertStringStartsWith('\n"), - array( - array(), - array(123, 456), - "
    123\n
    \n" - ."
    456\n
    \n", - ), - array( - array('foo' => 'bar'), - array(), - "
    array:1 [\n"
    -                ."  \"foo\" => \"bar\"\n"
    -                ."]\n"
    -                ."
    \n", - ), - ); - } - - public function testCustomDumper() - { - $output = ''; - $lineDumper = function ($line) use (&$output) { - $output .= $line; - }; - - $dumper = new HtmlDumper($lineDumper); - - $dumper->setDumpHeader(''); - $dumper->setDumpBoundaries( - '
    ',
    -            '
    ' - ); - $extension = new DumpExtension(new VarCloner(), $dumper); - $twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array( - 'debug' => true, - 'cache' => false, - 'optimizations' => 0, - )); - - $dump = $extension->dump($twig, array(), 'foo'); - $dump = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump); - - $this->assertEquals( - '
    "'.
    -            "foo\"\n".
    -            "
    \n", - $dump, - 'Custom dumper should be used to dump data.' - ); - - $this->assertEmpty($output, 'Dumper output should be ignored.'); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/ExpressionExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/ExpressionExtensionTest.php deleted file mode 100644 index b2ee22c..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/ExpressionExtensionTest.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\ExpressionExtension; -use Twig\Environment; -use Twig\Loader\ArrayLoader; - -class ExpressionExtensionTest extends TestCase -{ - public function testExpressionCreation() - { - $template = "{{ expression('1 == 1') }}"; - $twig = new Environment(new ArrayLoader(array('template' => $template)), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0)); - $twig->addExtension(new ExpressionExtension()); - - $output = $twig->render('template'); - $this->assertEquals('1 == 1', $output); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubFilesystemLoader.php b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubFilesystemLoader.php deleted file mode 100644 index 4cbc55b..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubFilesystemLoader.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension\Fixtures; - -use Twig\Loader\FilesystemLoader; - -class StubFilesystemLoader extends FilesystemLoader -{ - protected function findTemplate($name, $throw = true) - { - // strip away bundle name - $parts = explode(':', $name); - - return parent::findTemplate(end($parts), $throw); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubTranslator.php b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubTranslator.php deleted file mode 100644 index b7d011b..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/StubTranslator.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension\Fixtures; - -use Symfony\Component\Translation\TranslatorInterface; - -class StubTranslator implements TranslatorInterface -{ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) - { - return '[trans]'.$id.'[/trans]'; - } - - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) - { - return '[trans]'.$id.'[/trans]'; - } - - public function setLocale($locale) - { - } - - public function getLocale() - { - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/child_label.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/child_label.html.twig deleted file mode 100644 index 8c7c248..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/child_label.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% block form_label %} - -{% endblock form_label %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig deleted file mode 100644 index 4eda8d7..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{% block _text_id_widget %} -{% spaceless %} -
    - {{ form_widget(form) }} -
    -{% endspaceless %} -{% endblock _text_id_widget %} - -{% block _names_entry_label %} -{% spaceless %} - {% if label is empty %} - {% set label = name|humanize %} - {% endif %} - -{% endspaceless %} -{% endblock _names_entry_label %} - -{% block _name_c_entry_label %} -{% spaceless %} - {% if label is empty %} - {% set label = name|humanize %} - {% endif %} - -{% endspaceless %} -{% endblock _name_c_entry_label %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/page_dynamic_extends.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/page_dynamic_extends.html.twig deleted file mode 100644 index ac166b7..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/page_dynamic_extends.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends dynamic_template_name ~ '.html.twig' %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/parent_label.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/parent_label.html.twig deleted file mode 100644 index e96278b..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/parent_label.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% block form_label %} - -{% endblock form_label %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme.html.twig deleted file mode 100644 index da1c1b6..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme.html.twig +++ /dev/null @@ -1,6 +0,0 @@ -{% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} - -{% endspaceless %} -{% endblock form_widget_simple %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig deleted file mode 100644 index 8c71986..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'form_div_layout.html.twig' %} - -{% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} - -{% endspaceless %} -{% endblock form_widget_simple %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_use.html.twig b/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_use.html.twig deleted file mode 100644 index d485b8d..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/Fixtures/templates/form/theme_use.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% use 'form_div_layout.html.twig' %} - -{% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} - -{% endspaceless %} -{% endblock form_widget_simple %} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php deleted file mode 100644 index eb53b12..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; -use Symfony\Component\Form\FormView; -use Symfony\Component\Form\Tests\AbstractBootstrap3HorizontalLayoutTest; -use Twig\Environment; - -class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3HorizontalLayoutTest -{ - use RuntimeLoaderProvider; - - protected $testableFeatures = array( - 'choice_attr', - ); - - private $renderer; - - protected function setUp() - { - parent::setUp(); - - $loader = new StubFilesystemLoader(array( - __DIR__.'/../../Resources/views/Form', - __DIR__.'/Fixtures/templates/form', - )); - - $environment = new Environment($loader, array('strict_variables' => true)); - $environment->addExtension(new TranslationExtension(new StubTranslator())); - $environment->addExtension(new FormExtension()); - - $rendererEngine = new TwigRendererEngine(array( - 'bootstrap_3_horizontal_layout.html.twig', - 'custom_widgets.html.twig', - ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); - $this->registerTwigRuntimeLoader($environment, $this->renderer); - } - - protected function renderForm(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form', $vars); - } - - protected function renderLabel(FormView $view, $label = null, array $vars = array()) - { - if (null !== $label) { - $vars += array('label' => $label); - } - - return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); - } - - protected function renderErrors(FormView $view) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); - } - - protected function renderWidget(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); - } - - protected function renderRow(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); - } - - protected function renderRest(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); - } - - protected function renderStart(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_start', $vars); - } - - protected function renderEnd(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_end', $vars); - } - - protected function setTheme(FormView $view, array $themes) - { - $this->renderer->setTheme($view, $themes); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php deleted file mode 100644 index 03d9c98..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionBootstrap3LayoutTest.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; -use Symfony\Component\Form\FormView; -use Symfony\Component\Form\Tests\AbstractBootstrap3LayoutTest; -use Twig\Environment; - -class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest -{ - use RuntimeLoaderProvider; - - private $renderer; - - protected function setUp() - { - parent::setUp(); - - $loader = new StubFilesystemLoader(array( - __DIR__.'/../../Resources/views/Form', - __DIR__.'/Fixtures/templates/form', - )); - - $environment = new Environment($loader, array('strict_variables' => true)); - $environment->addExtension(new TranslationExtension(new StubTranslator())); - $environment->addExtension(new FormExtension()); - - $rendererEngine = new TwigRendererEngine(array( - 'bootstrap_3_layout.html.twig', - 'custom_widgets.html.twig', - ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); - $this->registerTwigRuntimeLoader($environment, $this->renderer); - } - - public function testStartTagHasNoActionAttributeWhenActionIsEmpty() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('
    ', $html); - } - - public function testStartTagHasActionAttributeWhenActionIsZero() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '0', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('', $html); - } - - protected function renderForm(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form', $vars); - } - - protected function renderLabel(FormView $view, $label = null, array $vars = array()) - { - if (null !== $label) { - $vars += array('label' => $label); - } - - return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); - } - - protected function renderErrors(FormView $view) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); - } - - protected function renderWidget(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); - } - - protected function renderRow(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); - } - - protected function renderRest(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); - } - - protected function renderStart(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_start', $vars); - } - - protected function renderEnd(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_end', $vars); - } - - protected function setTheme(FormView $view, array $themes) - { - $this->renderer->setTheme($view, $themes); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php deleted file mode 100644 index 27a8ee3..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionDivLayoutTest.php +++ /dev/null @@ -1,211 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; -use Symfony\Component\Form\ChoiceList\View\ChoiceView; -use Symfony\Component\Form\FormView; -use Symfony\Component\Form\Tests\AbstractDivLayoutTest; -use Twig\Environment; - -class FormExtensionDivLayoutTest extends AbstractDivLayoutTest -{ - use RuntimeLoaderProvider; - - private $renderer; - - protected function setUp() - { - parent::setUp(); - - $loader = new StubFilesystemLoader(array( - __DIR__.'/../../Resources/views/Form', - __DIR__.'/Fixtures/templates/form', - )); - - $environment = new Environment($loader, array('strict_variables' => true)); - $environment->addExtension(new TranslationExtension(new StubTranslator())); - $environment->addGlobal('global', ''); - // the value can be any template that exists - $environment->addGlobal('dynamic_template_name', 'child_label'); - $environment->addExtension(new FormExtension()); - - $rendererEngine = new TwigRendererEngine(array( - 'form_div_layout.html.twig', - 'custom_widgets.html.twig', - ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); - $this->registerTwigRuntimeLoader($environment, $this->renderer); - } - - public function testThemeBlockInheritanceUsingUse() - { - $view = $this->factory - ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType') - ->createView() - ; - - $this->setTheme($view, array('theme_use.html.twig')); - - $this->assertMatchesXpath( - $this->renderWidget($view), - '/input[@type="email"][@rel="theme"]' - ); - } - - public function testThemeBlockInheritanceUsingExtend() - { - $view = $this->factory - ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType') - ->createView() - ; - - $this->setTheme($view, array('theme_extends.html.twig')); - - $this->assertMatchesXpath( - $this->renderWidget($view), - '/input[@type="email"][@rel="theme"]' - ); - } - - public function testThemeBlockInheritanceUsingDynamicExtend() - { - $view = $this->factory - ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType') - ->createView() - ; - - $this->renderer->setTheme($view, array('page_dynamic_extends.html.twig')); - $this->assertMatchesXpath( - $this->renderer->searchAndRenderBlock($view, 'row'), - '/div/label[text()="child"]' - ); - } - - public function isSelectedChoiceProvider() - { - return array( - array(true, '0', '0'), - array(true, '1', '1'), - array(true, '', ''), - array(true, '1.23', '1.23'), - array(true, 'foo', 'foo'), - array(true, 'foo10', 'foo10'), - array(true, 'foo', array(1, 'foo', 'foo10')), - - array(false, 10, array(1, 'foo', 'foo10')), - array(false, 0, array(1, 'foo', 'foo10')), - ); - } - - /** - * @dataProvider isSelectedChoiceProvider - */ - public function testIsChoiceSelected($expected, $choice, $value) - { - $choice = new ChoiceView($choice, $choice, $choice.' label'); - - $this->assertSame($expected, \Symfony\Bridge\Twig\Extension\twig_is_selected_choice($choice, $value)); - } - - public function testStartTagHasNoActionAttributeWhenActionIsEmpty() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('', $html); - } - - public function testStartTagHasActionAttributeWhenActionIsZero() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '0', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('', $html); - } - - protected function renderForm(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form', $vars); - } - - protected function renderLabel(FormView $view, $label = null, array $vars = array()) - { - if (null !== $label) { - $vars += array('label' => $label); - } - - return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); - } - - protected function renderErrors(FormView $view) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); - } - - protected function renderWidget(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); - } - - protected function renderRow(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); - } - - protected function renderRest(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); - } - - protected function renderStart(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_start', $vars); - } - - protected function renderEnd(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_end', $vars); - } - - protected function setTheme(FormView $view, array $themes) - { - $this->renderer->setTheme($view, $themes); - } - - public static function themeBlockInheritanceProvider() - { - return array( - array(array('theme.html.twig')), - ); - } - - public static function themeInheritanceProvider() - { - return array( - array(array('parent_label.html.twig'), array('child_label.html.twig')), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php b/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php deleted file mode 100644 index f050936..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/FormExtensionTableLayoutTest.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Symfony\Component\Form\FormView; -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Symfony\Bridge\Twig\Form\TwigRendererEngine; -use Symfony\Bridge\Twig\Extension\FormExtension; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Component\Form\Tests\AbstractTableLayoutTest; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator; -use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader; -use Twig\Environment; - -class FormExtensionTableLayoutTest extends AbstractTableLayoutTest -{ - use RuntimeLoaderProvider; - - private $renderer; - - protected function setUp() - { - parent::setUp(); - - $loader = new StubFilesystemLoader(array( - __DIR__.'/../../Resources/views/Form', - __DIR__.'/Fixtures/templates/form', - )); - - $environment = new Environment($loader, array('strict_variables' => true)); - $environment->addExtension(new TranslationExtension(new StubTranslator())); - $environment->addGlobal('global', ''); - $environment->addExtension(new FormExtension()); - - $rendererEngine = new TwigRendererEngine(array( - 'form_table_layout.html.twig', - 'custom_widgets.html.twig', - ), $environment); - $this->renderer = new TwigRenderer($rendererEngine, $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock()); - $this->registerTwigRuntimeLoader($environment, $this->renderer); - } - - public function testStartTagHasNoActionAttributeWhenActionIsEmpty() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('', $html); - } - - public function testStartTagHasActionAttributeWhenActionIsZero() - { - $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array( - 'method' => 'get', - 'action' => '0', - )); - - $html = $this->renderStart($form->createView()); - - $this->assertSame('', $html); - } - - protected function renderForm(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form', $vars); - } - - protected function renderLabel(FormView $view, $label = null, array $vars = array()) - { - if (null !== $label) { - $vars += array('label' => $label); - } - - return (string) $this->renderer->searchAndRenderBlock($view, 'label', $vars); - } - - protected function renderErrors(FormView $view) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'errors'); - } - - protected function renderWidget(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'widget', $vars); - } - - protected function renderRow(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'row', $vars); - } - - protected function renderRest(FormView $view, array $vars = array()) - { - return (string) $this->renderer->searchAndRenderBlock($view, 'rest', $vars); - } - - protected function renderStart(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_start', $vars); - } - - protected function renderEnd(FormView $view, array $vars = array()) - { - return (string) $this->renderer->renderBlock($view, 'form_end', $vars); - } - - protected function setTheme(FormView $view, array $themes) - { - $this->renderer->setTheme($view, $themes); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/HttpFoundationExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/HttpFoundationExtensionTest.php deleted file mode 100644 index fcff0c0..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/HttpFoundationExtensionTest.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\HttpFoundationExtension; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContext; - -class HttpFoundationExtensionTest extends TestCase -{ - /** - * @dataProvider getGenerateAbsoluteUrlData() - */ - public function testGenerateAbsoluteUrl($expected, $path, $pathinfo) - { - $stack = new RequestStack(); - $stack->push(Request::create($pathinfo)); - $extension = new HttpFoundationExtension($stack); - - $this->assertEquals($expected, $extension->generateAbsoluteUrl($path)); - } - - public function getGenerateAbsoluteUrlData() - { - return array( - array('http://localhost/foo.png', '/foo.png', '/foo/bar.html'), - array('http://localhost/foo/foo.png', 'foo.png', '/foo/bar.html'), - array('http://localhost/foo/foo.png', 'foo.png', '/foo/bar'), - array('http://localhost/foo/bar/foo.png', 'foo.png', '/foo/bar/'), - - array('http://example.com/baz', 'http://example.com/baz', '/'), - array('https://example.com/baz', 'https://example.com/baz', '/'), - array('//example.com/baz', '//example.com/baz', '/'), - - array('http://localhost/foo/bar?baz', '?baz', '/foo/bar'), - array('http://localhost/foo/bar?baz=1', '?baz=1', '/foo/bar?foo=1'), - array('http://localhost/foo/baz?baz=1', 'baz?baz=1', '/foo/bar?foo=1'), - - array('http://localhost/foo/bar#baz', '#baz', '/foo/bar'), - array('http://localhost/foo/bar?0#baz', '#baz', '/foo/bar?0'), - array('http://localhost/foo/bar?baz=1#baz', '?baz=1#baz', '/foo/bar?foo=1'), - array('http://localhost/foo/baz?baz=1#baz', 'baz?baz=1#baz', '/foo/bar?foo=1'), - ); - } - - /** - * @dataProvider getGenerateAbsoluteUrlRequestContextData - */ - public function testGenerateAbsoluteUrlWithRequestContext($path, $baseUrl, $host, $scheme, $httpPort, $httpsPort, $expected) - { - if (!class_exists('Symfony\Component\Routing\RequestContext')) { - $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.'); - } - - $requestContext = new RequestContext($baseUrl, 'GET', $host, $scheme, $httpPort, $httpsPort, $path); - $extension = new HttpFoundationExtension(new RequestStack(), $requestContext); - - $this->assertEquals($expected, $extension->generateAbsoluteUrl($path)); - } - - /** - * @dataProvider getGenerateAbsoluteUrlRequestContextData - */ - public function testGenerateAbsoluteUrlWithoutRequestAndRequestContext($path) - { - if (!class_exists('Symfony\Component\Routing\RequestContext')) { - $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.'); - } - - $extension = new HttpFoundationExtension(new RequestStack()); - - $this->assertEquals($path, $extension->generateAbsoluteUrl($path)); - } - - public function getGenerateAbsoluteUrlRequestContextData() - { - return array( - array('/foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo.png'), - array('foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo/foo.png'), - array('foo.png', '/foo/bar/', 'localhost', 'http', 80, 443, 'http://localhost/foo/bar/foo.png'), - array('/foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo.png'), - array('foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo/foo.png'), - array('foo.png', '/foo/bar/', 'localhost', 'https', 80, 443, 'https://localhost/foo/bar/foo.png'), - array('/foo.png', '/foo', 'localhost', 'http', 443, 80, 'http://localhost:443/foo.png'), - array('/foo.png', '/foo', 'localhost', 'https', 443, 80, 'https://localhost:80/foo.png'), - ); - } - - public function testGenerateAbsoluteUrlWithScriptFileName() - { - $request = Request::create('http://localhost/app/web/app_dev.php'); - $request->server->set('SCRIPT_FILENAME', '/var/www/app/web/app_dev.php'); - - $stack = new RequestStack(); - $stack->push($request); - $extension = new HttpFoundationExtension($stack); - - $this->assertEquals( - 'http://localhost/app/web/bundles/framework/css/structure.css', - $extension->generateAbsoluteUrl('/app/web/bundles/framework/css/structure.css') - ); - } - - /** - * @dataProvider getGenerateRelativePathData() - */ - public function testGenerateRelativePath($expected, $path, $pathinfo) - { - if (!method_exists('Symfony\Component\HttpFoundation\Request', 'getRelativeUriForPath')) { - $this->markTestSkipped('Your version of Symfony HttpFoundation is too old.'); - } - - $stack = new RequestStack(); - $stack->push(Request::create($pathinfo)); - $extension = new HttpFoundationExtension($stack); - - $this->assertEquals($expected, $extension->generateRelativePath($path)); - } - - public function getGenerateRelativePathData() - { - return array( - array('../foo.png', '/foo.png', '/foo/bar.html'), - array('../baz/foo.png', '/baz/foo.png', '/foo/bar.html'), - array('baz/foo.png', 'baz/foo.png', '/foo/bar.html'), - - array('http://example.com/baz', 'http://example.com/baz', '/'), - array('https://example.com/baz', 'https://example.com/baz', '/'), - array('//example.com/baz', '//example.com/baz', '/'), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/HttpKernelExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/HttpKernelExtensionTest.php deleted file mode 100644 index 9f19847..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/HttpKernelExtensionTest.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\HttpKernelExtension; -use Symfony\Bridge\Twig\Extension\HttpKernelRuntime; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; -use Twig\Environment; -use Twig\Loader\ArrayLoader; - -class HttpKernelExtensionTest extends TestCase -{ - /** - * @expectedException \Twig\Error\RuntimeError - */ - public function testFragmentWithError() - { - $renderer = $this->getFragmentHandler($this->throwException(new \Exception('foo'))); - - $this->renderTemplate($renderer); - } - - public function testRenderFragment() - { - $renderer = $this->getFragmentHandler($this->returnValue(new Response('html'))); - - $response = $this->renderTemplate($renderer); - - $this->assertEquals('html', $response); - } - - public function testUnknownFragmentRenderer() - { - $context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack') - ->disableOriginalConstructor() - ->getMock() - ; - $renderer = new FragmentHandler($context); - - if (method_exists($this, 'expectException')) { - $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('The "inline" renderer does not exist.'); - } else { - $this->setExpectedException('InvalidArgumentException', 'The "inline" renderer does not exist.'); - } - - $renderer->render('/foo'); - } - - protected function getFragmentHandler($return) - { - $strategy = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface')->getMock(); - $strategy->expects($this->once())->method('getName')->will($this->returnValue('inline')); - $strategy->expects($this->once())->method('render')->will($return); - - $context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack') - ->disableOriginalConstructor() - ->getMock() - ; - - $context->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); - - return new FragmentHandler($context, array($strategy), false); - } - - protected function renderTemplate(FragmentHandler $renderer, $template = '{{ render("foo") }}') - { - $loader = new ArrayLoader(array('index' => $template)); - $twig = new Environment($loader, array('debug' => true, 'cache' => false)); - $twig->addExtension(new HttpKernelExtension()); - - $loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); - $loader->expects($this->any())->method('load')->will($this->returnValueMap(array( - array('Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)), - ))); - $twig->addRuntimeLoader($loader); - - return $twig->render('index'); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/RoutingExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/RoutingExtensionTest.php deleted file mode 100644 index fdff039..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/RoutingExtensionTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\RoutingExtension; -use Twig\Environment; -use Twig\Node\Expression\FilterExpression; -use Twig\Source; - -class RoutingExtensionTest extends TestCase -{ - /** - * @dataProvider getEscapingTemplates - */ - public function testEscaping($template, $mustBeEscaped) - { - $twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0)); - $twig->addExtension(new RoutingExtension($this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock())); - - $nodes = $twig->parse($twig->tokenize(new Source($template, ''))); - - $this->assertSame($mustBeEscaped, $nodes->getNode('body')->getNode(0)->getNode('expr') instanceof FilterExpression); - } - - public function getEscapingTemplates() - { - return array( - array('{{ path("foo") }}', false), - array('{{ path("foo", {}) }}', false), - array('{{ path("foo", { foo: "foo" }) }}', false), - array('{{ path("foo", foo) }}', true), - array('{{ path("foo", { foo: foo }) }}', true), - array('{{ path("foo", { foo: ["foo", "bar"] }) }}', true), - array('{{ path("foo", { foo: "foo", bar: "bar" }) }}', true), - - array('{{ path(name = "foo", parameters = {}) }}', false), - array('{{ path(name = "foo", parameters = { foo: "foo" }) }}', false), - array('{{ path(name = "foo", parameters = foo) }}', true), - array('{{ path(name = "foo", parameters = { foo: ["foo", "bar"] }) }}', true), - array('{{ path(name = "foo", parameters = { foo: foo }) }}', true), - array('{{ path(name = "foo", parameters = { foo: "foo", bar: "bar" }) }}', true), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php b/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php deleted file mode 100644 index 90db2c5..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/RuntimeLoaderProvider.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Symfony\Bridge\Twig\Form\TwigRenderer; -use Twig\Environment; - -trait RuntimeLoaderProvider -{ - protected function registerTwigRuntimeLoader(Environment $environment, TwigRenderer $renderer) - { - $loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); - $loader->expects($this->any())->method('load')->will($this->returnValueMap(array( - array('Symfony\Bridge\Twig\Form\TwigRenderer', $renderer), - ))); - $environment->addRuntimeLoader($loader); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/StopwatchExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/StopwatchExtensionTest.php deleted file mode 100644 index 25b2e02..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/StopwatchExtensionTest.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\StopwatchExtension; -use Twig\Environment; -use Twig\Error\RuntimeError; -use Twig\Loader\ArrayLoader; - -class StopwatchExtensionTest extends TestCase -{ - /** - * @expectedException \Twig\Error\SyntaxError - */ - public function testFailIfStoppingWrongEvent() - { - $this->testTiming('{% stopwatch "foo" %}{% endstopwatch "bar" %}', array()); - } - - /** - * @dataProvider getTimingTemplates - */ - public function testTiming($template, $events) - { - $twig = new Environment(new ArrayLoader(array('template' => $template)), array('debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0)); - $twig->addExtension(new StopwatchExtension($this->getStopwatch($events))); - - try { - $nodes = $twig->render('template'); - } catch (RuntimeError $e) { - throw $e->getPrevious(); - } - } - - public function getTimingTemplates() - { - return array( - array('{% stopwatch "foo" %}something{% endstopwatch %}', 'foo'), - array('{% stopwatch "foo" %}symfony is fun{% endstopwatch %}{% stopwatch "bar" %}something{% endstopwatch %}', array('foo', 'bar')), - array('{% set foo = "foo" %}{% stopwatch foo %}something{% endstopwatch %}', 'foo'), - array('{% set foo = "foo" %}{% stopwatch foo %}something {% set foo = "bar" %}{% endstopwatch %}', 'foo'), - array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'), - array('{% stopwatch "foo" %}something{% endstopwatch %}{% stopwatch "foo" %}something else{% endstopwatch %}', array('foo', 'foo')), - ); - } - - protected function getStopwatch($events = array()) - { - $events = is_array($events) ? $events : array($events); - $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock(); - - $i = -1; - foreach ($events as $eventName) { - $stopwatch->expects($this->at(++$i)) - ->method('start') - ->with($this->equalTo($eventName), 'template') - ; - $stopwatch->expects($this->at(++$i)) - ->method('stop') - ->with($this->equalTo($eventName)) - ; - } - - return $stopwatch; - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php deleted file mode 100644 index 36016d7..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/TranslationExtensionTest.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\MessageSelector; -use Symfony\Component\Translation\Loader\ArrayLoader; -use Twig\Environment; -use Twig\Loader\ArrayLoader as TwigArrayLoader; - -class TranslationExtensionTest extends TestCase -{ - public function testEscaping() - { - $output = $this->getTemplate('{% trans %}Percent: %value%%% (%msg%){% endtrans %}')->render(array('value' => 12, 'msg' => 'approx.')); - - $this->assertEquals('Percent: 12% (approx.)', $output); - } - - /** - * @dataProvider getTransTests - */ - public function testTrans($template, $expected, array $variables = array()) - { - if ($expected != $this->getTemplate($template)->render($variables)) { - echo $template."\n"; - $loader = new TwigArrayLoader(array('index' => $template)); - $twig = new Environment($loader, array('debug' => true, 'cache' => false)); - $twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector()))); - - echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext('index'))))."\n\n"; - $this->assertEquals($expected, $this->getTemplate($template)->render($variables)); - } - - $this->assertEquals($expected, $this->getTemplate($template)->render($variables)); - } - - /** - * @expectedException \Twig\Error\SyntaxError - * @expectedExceptionMessage Unexpected token. Twig was looking for the "with", "from", or "into" keyword in "index" at line 3. - */ - public function testTransUnknownKeyword() - { - $output = $this->getTemplate("{% trans \n\nfoo %}{% endtrans %}")->render(); - } - - /** - * @expectedException \Twig\Error\SyntaxError - * @expectedExceptionMessage A message inside a trans tag must be a simple text in "index" at line 2. - */ - public function testTransComplexBody() - { - $output = $this->getTemplate("{% trans %}\n{{ 1 + 2 }}{% endtrans %}")->render(); - } - - /** - * @expectedException \Twig\Error\SyntaxError - * @expectedExceptionMessage A message inside a transchoice tag must be a simple text in "index" at line 2. - */ - public function testTransChoiceComplexBody() - { - $output = $this->getTemplate("{% transchoice count %}\n{{ 1 + 2 }}{% endtranschoice %}")->render(); - } - - public function getTransTests() - { - return array( - // trans tag - array('{% trans %}Hello{% endtrans %}', 'Hello'), - array('{% trans %}%name%{% endtrans %}', 'Symfony', array('name' => 'Symfony')), - - array('{% trans from elsewhere %}Hello{% endtrans %}', 'Hello'), - - array('{% trans %}Hello %name%{% endtrans %}', 'Hello Symfony', array('name' => 'Symfony')), - array('{% trans with { \'%name%\': \'Symfony\' } %}Hello %name%{% endtrans %}', 'Hello Symfony'), - array('{% set vars = { \'%name%\': \'Symfony\' } %}{% trans with vars %}Hello %name%{% endtrans %}', 'Hello Symfony'), - - array('{% trans into "fr"%}Hello{% endtrans %}', 'Hello'), - - // transchoice - array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), - array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5)), - array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples'), - - // trans filter - array('{{ "Hello"|trans }}', 'Hello'), - array('{{ name|trans }}', 'Symfony', array('name' => 'Symfony')), - array('{{ hello|trans({ \'%name%\': \'Symfony\' }) }}', 'Hello Symfony', array('hello' => 'Hello %name%')), - array('{% set vars = { \'%name%\': \'Symfony\' } %}{{ hello|trans(vars) }}', 'Hello Symfony', array('hello' => 'Hello %name%')), - array('{{ "Hello"|trans({}, "messages", "fr") }}', 'Hello'), - - // transchoice filter - array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count) }}', 'There is 5 apples', array('count' => 5)), - array('{{ text|transchoice(5, {\'%name%\': \'Symfony\'}) }}', 'There is 5 apples (Symfony)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')), - array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count, {}, "messages", "fr") }}', 'There is 5 apples', array('count' => 5)), - ); - } - - public function testDefaultTranslationDomain() - { - $templates = array( - 'index' => ' - {%- extends "base" %} - - {%- trans_default_domain "foo" %} - - {%- block content %} - {%- trans %}foo{% endtrans %} - {%- trans from "custom" %}foo{% endtrans %} - {{- "foo"|trans }} - {{- "foo"|trans({}, "custom") }} - {{- "foo"|transchoice(1) }} - {{- "foo"|transchoice(1, {}, "custom") }} - {% endblock %} - ', - - 'base' => ' - {%- block content "" %} - ', - ); - - $translator = new Translator('en', new MessageSelector()); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (messages)'), 'en'); - $translator->addResource('array', array('foo' => 'foo (custom)'), 'en', 'custom'); - $translator->addResource('array', array('foo' => 'foo (foo)'), 'en', 'foo'); - - $template = $this->getTemplate($templates, $translator); - - $this->assertEquals('foo (foo)foo (custom)foo (foo)foo (custom)foo (foo)foo (custom)', trim($template->render(array()))); - } - - public function testDefaultTranslationDomainWithNamedArguments() - { - $templates = array( - 'index' => ' - {%- trans_default_domain "foo" %} - - {%- block content %} - {{- "foo"|trans(arguments = {}, domain = "custom") }} - {{- "foo"|transchoice(count = 1) }} - {{- "foo"|transchoice(count = 1, arguments = {}, domain = "custom") }} - {{- "foo"|trans({}, domain = "custom") }} - {{- "foo"|trans({}, "custom", locale = "fr") }} - {{- "foo"|transchoice(1, arguments = {}, domain = "custom") }} - {{- "foo"|transchoice(1, {}, "custom", locale = "fr") }} - {% endblock %} - ', - - 'base' => ' - {%- block content "" %} - ', - ); - - $translator = new Translator('en', new MessageSelector()); - $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (messages)'), 'en'); - $translator->addResource('array', array('foo' => 'foo (custom)'), 'en', 'custom'); - $translator->addResource('array', array('foo' => 'foo (foo)'), 'en', 'foo'); - $translator->addResource('array', array('foo' => 'foo (fr)'), 'fr', 'custom'); - - $template = $this->getTemplate($templates, $translator); - - $this->assertEquals('foo (custom)foo (foo)foo (custom)foo (custom)foo (fr)foo (custom)foo (fr)', trim($template->render(array()))); - } - - protected function getTemplate($template, $translator = null) - { - if (null === $translator) { - $translator = new Translator('en', new MessageSelector()); - } - - if (is_array($template)) { - $loader = new TwigArrayLoader($template); - } else { - $loader = new TwigArrayLoader(array('index' => $template)); - } - $twig = new Environment($loader, array('debug' => true, 'cache' => false)); - $twig->addExtension(new TranslationExtension($translator)); - - return $twig->loadTemplate('index'); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/WebLinkExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/WebLinkExtensionTest.php deleted file mode 100644 index 3424b58..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/WebLinkExtensionTest.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use Fig\Link\Link; -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\WebLinkExtension; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; - -/** - * @author Kévin Dunglas - */ -class WebLinkExtensionTest extends TestCase -{ - /** - * @var Request - */ - private $request; - - /** - * @var WebLinkExtension - */ - private $extension; - - protected function setUp() - { - $this->request = new Request(); - - $requestStack = new RequestStack(); - $requestStack->push($this->request); - - $this->extension = new WebLinkExtension($requestStack); - } - - public function testLink() - { - $this->assertEquals('/foo.css', $this->extension->link('/foo.css', 'preload', array('as' => 'style', 'nopush' => true))); - - $link = (new Link('preload', '/foo.css'))->withAttribute('as', 'style')->withAttribute('nopush', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } - - public function testPreload() - { - $this->assertEquals('/foo.css', $this->extension->preload('/foo.css', array('as' => 'style', 'crossorigin' => true))); - - $link = (new Link('preload', '/foo.css'))->withAttribute('as', 'style')->withAttribute('crossorigin', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } - - public function testDnsPrefetch() - { - $this->assertEquals('/foo.css', $this->extension->dnsPrefetch('/foo.css', array('as' => 'style', 'crossorigin' => true))); - - $link = (new Link('dns-prefetch', '/foo.css'))->withAttribute('as', 'style')->withAttribute('crossorigin', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } - - public function testPreconnect() - { - $this->assertEquals('/foo.css', $this->extension->preconnect('/foo.css', array('as' => 'style', 'crossorigin' => true))); - - $link = (new Link('preconnect', '/foo.css'))->withAttribute('as', 'style')->withAttribute('crossorigin', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } - - public function testPrefetch() - { - $this->assertEquals('/foo.css', $this->extension->prefetch('/foo.css', array('as' => 'style', 'crossorigin' => true))); - - $link = (new Link('prefetch', '/foo.css'))->withAttribute('as', 'style')->withAttribute('crossorigin', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } - - public function testPrerender() - { - $this->assertEquals('/foo.css', $this->extension->prerender('/foo.css', array('as' => 'style', 'crossorigin' => true))); - - $link = (new Link('prerender', '/foo.css'))->withAttribute('as', 'style')->withAttribute('crossorigin', true); - $this->assertEquals(array($link), array_values($this->request->attributes->get('_links')->getLinks())); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php b/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php deleted file mode 100644 index 60934c1..0000000 --- a/vendor/symfony/twig-bridge/Tests/Extension/WorkflowExtensionTest.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Extension; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\WorkflowExtension; -use Symfony\Component\Workflow\Definition; -use Symfony\Component\Workflow\Registry; -use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; -use Symfony\Component\Workflow\Transition; -use Symfony\Component\Workflow\Workflow; - -class WorkflowExtensionTest extends TestCase -{ - private $extension; - - protected function setUp() - { - if (!class_exists(Workflow::class)) { - $this->markTestSkipped('The Workflow component is needed to run tests for this extension.'); - } - - $places = array('ordered', 'waiting_for_payment', 'processed'); - $transitions = array( - new Transition('t1', 'ordered', 'waiting_for_payment'), - new Transition('t2', 'waiting_for_payment', 'processed'), - ); - $definition = new Definition($places, $transitions); - $workflow = new Workflow($definition); - - $registry = new Registry(); - $registry->add($workflow, new ClassInstanceSupportStrategy(\stdClass::class)); - - $this->extension = new WorkflowExtension($registry); - } - - public function testCanTransition() - { - $subject = new \stdClass(); - $subject->marking = array(); - - $this->assertTrue($this->extension->canTransition($subject, 't1')); - $this->assertFalse($this->extension->canTransition($subject, 't2')); - } - - public function testGetEnabledTransitions() - { - $subject = new \stdClass(); - $subject->marking = array(); - - $transitions = $this->extension->getEnabledTransitions($subject); - - $this->assertCount(1, $transitions); - $this->assertInstanceOf(Transition::class, $transitions[0]); - $this->assertSame('t1', $transitions[0]->getName()); - } - - public function testHasMarkedPlace() - { - $subject = new \stdClass(); - $subject->marking = array(); - $subject->marking = array('ordered' => 1, 'waiting_for_payment' => 1); - - $this->assertTrue($this->extension->hasMarkedPlace($subject, 'ordered')); - $this->assertTrue($this->extension->hasMarkedPlace($subject, 'waiting_for_payment')); - $this->assertFalse($this->extension->hasMarkedPlace($subject, 'processed')); - } - - public function testGetMarkedPlaces() - { - $subject = new \stdClass(); - $subject->marking = array(); - $subject->marking = array('ordered' => 1, 'waiting_for_payment' => 1); - - $this->assertSame(array('ordered', 'waiting_for_payment'), $this->extension->getMarkedPlaces($subject)); - $this->assertSame($subject->marking, $this->extension->getMarkedPlaces($subject, false)); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/syntax_error.twig b/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/syntax_error.twig deleted file mode 100644 index b3e0698..0000000 --- a/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/syntax_error.twig +++ /dev/null @@ -1 +0,0 @@ -{% syntax error diff --git a/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/with_translations.html.twig b/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/with_translations.html.twig deleted file mode 100644 index 8cdb42d..0000000 --- a/vendor/symfony/twig-bridge/Tests/Fixtures/extractor/with_translations.html.twig +++ /dev/null @@ -1 +0,0 @@ -

    {{ 'Hi!'|trans }}

    diff --git a/vendor/symfony/twig-bridge/Tests/Node/DumpNodeTest.php b/vendor/symfony/twig-bridge/Tests/Node/DumpNodeTest.php deleted file mode 100644 index 7f8737a..0000000 --- a/vendor/symfony/twig-bridge/Tests/Node/DumpNodeTest.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Node; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Node\DumpNode; -use Twig\Compiler; -use Twig\Environment; -use Twig\Node\Expression\NameExpression; -use Twig\Node\Node; - -class DumpNodeTest extends TestCase -{ - public function testNoVar() - { - $node = new DumpNode('bar', null, 7); - - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); - $compiler = new Compiler($env); - - $expected = <<<'EOTXT' -if ($this->env->isDebug()) { - $barvars = array(); - foreach ($context as $barkey => $barval) { - if (!$barval instanceof \Twig\Template) { - $barvars[$barkey] = $barval; - } - } - // line 7 - \Symfony\Component\VarDumper\VarDumper::dump($barvars); -} - -EOTXT; - - $this->assertSame($expected, $compiler->compile($node)->getSource()); - } - - public function testIndented() - { - $node = new DumpNode('bar', null, 7); - - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); - $compiler = new Compiler($env); - - $expected = <<<'EOTXT' - if ($this->env->isDebug()) { - $barvars = array(); - foreach ($context as $barkey => $barval) { - if (!$barval instanceof \Twig\Template) { - $barvars[$barkey] = $barval; - } - } - // line 7 - \Symfony\Component\VarDumper\VarDumper::dump($barvars); - } - -EOTXT; - - $this->assertSame($expected, $compiler->compile($node, 1)->getSource()); - } - - public function testOneVar() - { - $vars = new Node(array( - new NameExpression('foo', 7), - )); - $node = new DumpNode('bar', $vars, 7); - - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); - $compiler = new Compiler($env); - - $expected = <<<'EOTXT' -if ($this->env->isDebug()) { - // line 7 - \Symfony\Component\VarDumper\VarDumper::dump(%foo%); -} - -EOTXT; - - if (\PHP_VERSION_ID >= 70000) { - $expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected); - } else { - $expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected); - } - - $this->assertSame($expected, $compiler->compile($node)->getSource()); - } - - public function testMultiVars() - { - $vars = new Node(array( - new NameExpression('foo', 7), - new NameExpression('bar', 7), - )); - $node = new DumpNode('bar', $vars, 7); - - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); - $compiler = new Compiler($env); - - $expected = <<<'EOTXT' -if ($this->env->isDebug()) { - // line 7 - \Symfony\Component\VarDumper\VarDumper::dump(array( - "foo" => %foo%, - "bar" => %bar%, - )); -} - -EOTXT; - - if (\PHP_VERSION_ID >= 70000) { - $expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected); - } else { - $expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected); - } - - $this->assertSame($expected, $compiler->compile($node)->getSource()); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php b/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php deleted file mode 100644 index c40fcbd..0000000 --- a/vendor/symfony/twig-bridge/Tests/Node/FormThemeTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Node; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Node\FormThemeNode; -use Twig\Compiler; -use Twig\Environment; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Node\Node; - -class FormThemeTest extends TestCase -{ - public function testConstructor() - { - $form = new NameExpression('form', 0); - $resources = new Node(array( - new ConstantExpression('tpl1', 0), - new ConstantExpression('tpl2', 0), - )); - - $node = new FormThemeNode($form, $resources, 0); - - $this->assertEquals($form, $node->getNode('form')); - $this->assertEquals($resources, $node->getNode('resources')); - } - - public function testCompile() - { - $form = new NameExpression('form', 0); - $resources = new ArrayExpression(array( - new ConstantExpression(0, 0), - new ConstantExpression('tpl1', 0), - new ConstantExpression(1, 0), - new ConstantExpression('tpl2', 0), - ), 0); - - $node = new FormThemeNode($form, $resources, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - - $resources = new ConstantExpression('tpl1', 0); - - $node = new FormThemeNode($form, $resources, 0); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, "tpl1");', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - protected function getVariableGetter($name) - { - if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); - } - - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php b/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php deleted file mode 100644 index fe91422..0000000 --- a/vendor/symfony/twig-bridge/Tests/Node/SearchAndRenderBlockNodeTest.php +++ /dev/null @@ -1,280 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Node; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode; -use Twig\Compiler; -use Twig\Environment; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConditionalExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Node\Node; - -class SearchAndRenderBlockNodeTest extends TestCase -{ - public function testCompileWidget() - { - $arguments = new Node(array( - new NameExpression('form', 0), - )); - - $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\')', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileWidgetWithVariables() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ArrayExpression(array( - new ConstantExpression('foo', 0), - new ConstantExpression('bar', 0), - ), 0), - )); - - $node = new SearchAndRenderBlockNode('form_widget', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithLabel() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConstantExpression('my label', 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithNullLabel() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConstantExpression(null, 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - // "label" => null must not be included in the output! - // Otherwise the default label is overwritten with null. - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithEmptyStringLabel() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConstantExpression('', 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - // "label" => null must not be included in the output! - // Otherwise the default label is overwritten with null. - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithDefaultLabel() - { - $arguments = new Node(array( - new NameExpression('form', 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithAttributes() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConstantExpression(null, 0), - new ArrayExpression(array( - new ConstantExpression('foo', 0), - new ConstantExpression('bar', 0), - ), 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - // "label" => null must not be included in the output! - // Otherwise the default label is overwritten with null. - // https://github.com/symfony/symfony/issues/5029 - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithLabelAndAttributes() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConstantExpression('value in argument', 0), - new ArrayExpression(array( - new ConstantExpression('foo', 0), - new ConstantExpression('bar', 0), - new ConstantExpression('label', 0), - new ConstantExpression('value in attributes', 0), - ), 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithLabelThatEvaluatesToNull() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConditionalExpression( - // if - new ConstantExpression(true, 0), - // then - new ConstantExpression(null, 0), - // else - new ConstantExpression(null, 0), - 0 - ), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - // "label" => null must not be included in the output! - // Otherwise the default label is overwritten with null. - // https://github.com/symfony/symfony/issues/5029 - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes() - { - $arguments = new Node(array( - new NameExpression('form', 0), - new ConditionalExpression( - // if - new ConstantExpression(true, 0), - // then - new ConstantExpression(null, 0), - // else - new ConstantExpression(null, 0), - 0 - ), - new ArrayExpression(array( - new ConstantExpression('foo', 0), - new ConstantExpression('bar', 0), - new ConstantExpression('label', 0), - new ConstantExpression('value in attributes', 0), - ), 0), - )); - - $node = new SearchAndRenderBlockNode('form_label', $arguments, 0); - - $compiler = new Compiler(new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock())); - - // "label" => null must not be included in the output! - // Otherwise the default label is overwritten with null. - // https://github.com/symfony/symfony/issues/5029 - $this->assertEquals( - sprintf( - '$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))', - $this->getVariableGetter('form') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - protected function getVariableGetter($name) - { - if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); - } - - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php b/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php deleted file mode 100644 index 56b2770..0000000 --- a/vendor/symfony/twig-bridge/Tests/Node/TransNodeTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Node; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Node\TransNode; -use Twig\Compiler; -use Twig\Environment; -use Twig\Node\Expression\NameExpression; -use Twig\Node\TextNode; - -/** - * @author Asmir Mustafic - */ -class TransNodeTest extends TestCase -{ - public function testCompileStrict() - { - $body = new TextNode('trans %var%', 0); - $vars = new NameExpression('foo', 0); - $node = new TransNode($body, null, null, $vars); - - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('strict_variables' => true)); - $compiler = new Compiler($env); - - $this->assertEquals( - sprintf( - 'echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->getTranslator()->trans("trans %%var%%", array_merge(array("%%var%%" => %s), %s), "messages");', - $this->getVariableGetterWithoutStrictCheck('var'), - $this->getVariableGetterWithStrictCheck('foo') - ), - trim($compiler->compile($node)->getSource()) - ); - } - - protected function getVariableGetterWithoutStrictCheck($name) - { - if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? null)', $name, $name); - } - - return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); - } - - protected function getVariableGetterWithStrictCheck($name) - { - if (Environment::MAJOR_VERSION >= 2) { - return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name); - } - - if (\PHP_VERSION_ID >= 70000) { - return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name); - } - - return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/NodeVisitor/ScopeTest.php b/vendor/symfony/twig-bridge/Tests/NodeVisitor/ScopeTest.php deleted file mode 100644 index fad0e1f..0000000 --- a/vendor/symfony/twig-bridge/Tests/NodeVisitor/ScopeTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\NodeVisitor; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\NodeVisitor\Scope; - -class ScopeTest extends TestCase -{ - public function testScopeInitiation() - { - $scope = new Scope(); - $scope->enter(); - $this->assertNull($scope->get('test')); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php b/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php deleted file mode 100644 index eb4c9a8..0000000 --- a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\NodeVisitor; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor; -use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; -use Twig\Environment; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Node; - -class TranslationDefaultDomainNodeVisitorTest extends TestCase -{ - private static $message = 'message'; - private static $domain = 'domain'; - - /** @dataProvider getDefaultDomainAssignmentTestData */ - public function testDefaultDomainAssignment(Node $node) - { - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $visitor = new TranslationDefaultDomainNodeVisitor(); - - // visit trans_default_domain tag - $defaultDomain = TwigNodeProvider::getTransDefaultDomainTag(self::$domain); - $visitor->enterNode($defaultDomain, $env); - $visitor->leaveNode($defaultDomain, $env); - - // visit tested node - $enteredNode = $visitor->enterNode($node, $env); - $leavedNode = $visitor->leaveNode($node, $env); - $this->assertSame($node, $enteredNode); - $this->assertSame($node, $leavedNode); - - // extracting tested node messages - $visitor = new TranslationNodeVisitor(); - $visitor->enable(); - $visitor->enterNode($node, $env); - $visitor->leaveNode($node, $env); - - $this->assertEquals(array(array(self::$message, self::$domain)), $visitor->getMessages()); - } - - /** @dataProvider getDefaultDomainAssignmentTestData */ - public function testNewModuleWithoutDefaultDomainTag(Node $node) - { - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $visitor = new TranslationDefaultDomainNodeVisitor(); - - // visit trans_default_domain tag - $newModule = TwigNodeProvider::getModule('test'); - $visitor->enterNode($newModule, $env); - $visitor->leaveNode($newModule, $env); - - // visit tested node - $enteredNode = $visitor->enterNode($node, $env); - $leavedNode = $visitor->leaveNode($node, $env); - $this->assertSame($node, $enteredNode); - $this->assertSame($node, $leavedNode); - - // extracting tested node messages - $visitor = new TranslationNodeVisitor(); - $visitor->enable(); - $visitor->enterNode($node, $env); - $visitor->leaveNode($node, $env); - - $this->assertEquals(array(array(self::$message, null)), $visitor->getMessages()); - } - - public function getDefaultDomainAssignmentTestData() - { - return array( - array(TwigNodeProvider::getTransFilter(self::$message)), - array(TwigNodeProvider::getTransChoiceFilter(self::$message)), - array(TwigNodeProvider::getTransTag(self::$message)), - // with named arguments - array(TwigNodeProvider::getTransFilter(self::$message, null, array( - 'arguments' => new ArrayExpression(array(), 0), - ))), - array(TwigNodeProvider::getTransChoiceFilter(self::$message), null, array( - 'arguments' => new ArrayExpression(array(), 0), - )), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationNodeVisitorTest.php b/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationNodeVisitorTest.php deleted file mode 100644 index 9c2d0ab..0000000 --- a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TranslationNodeVisitorTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\NodeVisitor; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; -use Twig\Environment; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\FilterExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Node\Node; - -class TranslationNodeVisitorTest extends TestCase -{ - /** @dataProvider getMessagesExtractionTestData */ - public function testMessagesExtraction(Node $node, array $expectedMessages) - { - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $visitor = new TranslationNodeVisitor(); - $visitor->enable(); - $visitor->enterNode($node, $env); - $visitor->leaveNode($node, $env); - $this->assertEquals($expectedMessages, $visitor->getMessages()); - } - - public function testMessageExtractionWithInvalidDomainNode() - { - $message = 'new key'; - - $node = new FilterExpression( - new ConstantExpression($message, 0), - new ConstantExpression('trans', 0), - new Node(array( - new ArrayExpression(array(), 0), - new NameExpression('variable', 0), - )), - 0 - ); - - $this->testMessagesExtraction($node, array(array($message, TranslationNodeVisitor::UNDEFINED_DOMAIN))); - } - - public function getMessagesExtractionTestData() - { - $message = 'new key'; - $domain = 'domain'; - - return array( - array(TwigNodeProvider::getTransFilter($message), array(array($message, null))), - array(TwigNodeProvider::getTransChoiceFilter($message), array(array($message, null))), - array(TwigNodeProvider::getTransTag($message), array(array($message, null))), - array(TwigNodeProvider::getTransFilter($message, $domain), array(array($message, $domain))), - array(TwigNodeProvider::getTransChoiceFilter($message, $domain), array(array($message, $domain))), - array(TwigNodeProvider::getTransTag($message, $domain), array(array($message, $domain))), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TwigNodeProvider.php b/vendor/symfony/twig-bridge/Tests/NodeVisitor/TwigNodeProvider.php deleted file mode 100644 index 49eac23..0000000 --- a/vendor/symfony/twig-bridge/Tests/NodeVisitor/TwigNodeProvider.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\NodeVisitor; - -use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; -use Symfony\Bridge\Twig\Node\TransNode; -use Twig\Node\BodyNode; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\FilterExpression; -use Twig\Node\ModuleNode; -use Twig\Node\Node; -use Twig\Source; - -class TwigNodeProvider -{ - public static function getModule($content) - { - return new ModuleNode( - new ConstantExpression($content, 0), - null, - new ArrayExpression(array(), 0), - new ArrayExpression(array(), 0), - new ArrayExpression(array(), 0), - null, - new Source('', '') - ); - } - - public static function getTransFilter($message, $domain = null, $arguments = null) - { - if (!$arguments) { - $arguments = $domain ? array( - new ArrayExpression(array(), 0), - new ConstantExpression($domain, 0), - ) : array(); - } - - return new FilterExpression( - new ConstantExpression($message, 0), - new ConstantExpression('trans', 0), - new Node($arguments), - 0 - ); - } - - public static function getTransChoiceFilter($message, $domain = null, $arguments = null) - { - if (!$arguments) { - $arguments = $domain ? array( - new ConstantExpression(0, 0), - new ArrayExpression(array(), 0), - new ConstantExpression($domain, 0), - ) : array(); - } - - return new FilterExpression( - new ConstantExpression($message, 0), - new ConstantExpression('transchoice', 0), - new Node($arguments), - 0 - ); - } - - public static function getTransTag($message, $domain = null) - { - return new TransNode( - new BodyNode(array(), array('data' => $message)), - $domain ? new ConstantExpression($domain, 0) : null - ); - } - - public static function getTransDefaultDomainTag($domain) - { - return new TransDefaultDomainNode( - new ConstantExpression($domain, 0) - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php b/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php deleted file mode 100644 index 0972b15..0000000 --- a/vendor/symfony/twig-bridge/Tests/TokenParser/FormThemeTokenParserTest.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\TokenParser; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; -use Symfony\Bridge\Twig\Node\FormThemeNode; -use Twig\Environment; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Expression\ConstantExpression; -use Twig\Node\Expression\NameExpression; -use Twig\Parser; -use Twig\Source; - -class FormThemeTokenParserTest extends TestCase -{ - /** - * @dataProvider getTestsForFormTheme - */ - public function testCompile($source, $expected) - { - $env = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $env->addTokenParser(new FormThemeTokenParser()); - $stream = $env->tokenize(new Source($source, '')); - $parser = new Parser($env); - - $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)); - } - - public function getTestsForFormTheme() - { - return array( - array( - '{% form_theme form "tpl1" %}', - new FormThemeNode( - new NameExpression('form', 1), - new ArrayExpression(array( - new ConstantExpression(0, 1), - new ConstantExpression('tpl1', 1), - ), 1), - 1, - 'form_theme' - ), - ), - array( - '{% form_theme form "tpl1" "tpl2" %}', - new FormThemeNode( - new NameExpression('form', 1), - new ArrayExpression(array( - new ConstantExpression(0, 1), - new ConstantExpression('tpl1', 1), - new ConstantExpression(1, 1), - new ConstantExpression('tpl2', 1), - ), 1), - 1, - 'form_theme' - ), - ), - array( - '{% form_theme form with "tpl1" %}', - new FormThemeNode( - new NameExpression('form', 1), - new ConstantExpression('tpl1', 1), - 1, - 'form_theme' - ), - ), - array( - '{% form_theme form with ["tpl1"] %}', - new FormThemeNode( - new NameExpression('form', 1), - new ArrayExpression(array( - new ConstantExpression(0, 1), - new ConstantExpression('tpl1', 1), - ), 1), - 1, - 'form_theme' - ), - ), - array( - '{% form_theme form with ["tpl1", "tpl2"] %}', - new FormThemeNode( - new NameExpression('form', 1), - new ArrayExpression(array( - new ConstantExpression(0, 1), - new ConstantExpression('tpl1', 1), - new ConstantExpression(1, 1), - new ConstantExpression('tpl2', 1), - ), 1), - 1, - 'form_theme' - ), - ), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/Translation/TwigExtractorTest.php b/vendor/symfony/twig-bridge/Tests/Translation/TwigExtractorTest.php deleted file mode 100644 index 013598a..0000000 --- a/vendor/symfony/twig-bridge/Tests/Translation/TwigExtractorTest.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests\Translation; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Translation\TwigExtractor; -use Symfony\Component\Translation\MessageCatalogue; -use Twig\Environment; -use Twig\Error\Error; -use Twig\Loader\ArrayLoader; - -class TwigExtractorTest extends TestCase -{ - /** - * @dataProvider getExtractData - */ - public function testExtract($template, $messages) - { - $loader = $this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(); - $twig = new Environment($loader, array( - 'strict_variables' => true, - 'debug' => true, - 'cache' => false, - 'autoescape' => false, - )); - $twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock())); - - $extractor = new TwigExtractor($twig); - $extractor->setPrefix('prefix'); - $catalogue = new MessageCatalogue('en'); - - $m = new \ReflectionMethod($extractor, 'extractTemplate'); - $m->setAccessible(true); - $m->invoke($extractor, $template, $catalogue); - - foreach ($messages as $key => $domain) { - $this->assertTrue($catalogue->has($key, $domain)); - $this->assertEquals('prefix'.$key, $catalogue->get($key, $domain)); - } - } - - public function getExtractData() - { - return array( - array('{{ "new key" | trans() }}', array('new key' => 'messages')), - array('{{ "new key" | trans() | upper }}', array('new key' => 'messages')), - array('{{ "new key" | trans({}, "domain") }}', array('new key' => 'domain')), - array('{{ "new key" | transchoice(1) }}', array('new key' => 'messages')), - array('{{ "new key" | transchoice(1) | upper }}', array('new key' => 'messages')), - array('{{ "new key" | transchoice(1, {}, "domain") }}', array('new key' => 'domain')), - array('{% trans %}new key{% endtrans %}', array('new key' => 'messages')), - array('{% trans %} new key {% endtrans %}', array('new key' => 'messages')), - array('{% trans from "domain" %}new key{% endtrans %}', array('new key' => 'domain')), - array('{% set foo = "new key" | trans %}', array('new key' => 'messages')), - array('{{ 1 ? "new key" | trans : "another key" | trans }}', array('new key' => 'messages', 'another key' => 'messages')), - - // make sure 'trans_default_domain' tag is supported - array('{% trans_default_domain "domain" %}{{ "new key"|trans }}', array('new key' => 'domain')), - array('{% trans_default_domain "domain" %}{{ "new key"|transchoice }}', array('new key' => 'domain')), - array('{% trans_default_domain "domain" %}{% trans %}new key{% endtrans %}', array('new key' => 'domain')), - - // make sure this works with twig's named arguments - array('{{ "new key" | trans(domain="domain") }}', array('new key' => 'domain')), - array('{{ "new key" | transchoice(domain="domain", count=1) }}', array('new key' => 'domain')), - ); - } - - /** - * @expectedException \Twig\Error\Error - * @dataProvider resourcesWithSyntaxErrorsProvider - */ - public function testExtractSyntaxError($resources) - { - $twig = new Environment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock()); - $twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock())); - - $extractor = new TwigExtractor($twig); - - try { - $extractor->extract($resources, new MessageCatalogue('en')); - } catch (Error $e) { - if (method_exists($e, 'getSourceContext')) { - $this->assertSame(dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile()); - $this->assertSame(1, $e->getLine()); - $this->assertSame('Unclosed "block".', $e->getMessage()); - } else { - $this->expectExceptionMessageRegExp('/Unclosed "block" in ".*extractor(\\/|\\\\)syntax_error\\.twig" at line 1/'); - } - throw $e; - } - } - - /** - * @return array - */ - public function resourcesWithSyntaxErrorsProvider() - { - return array( - array(__DIR__.'/../Fixtures'), - array(__DIR__.'/../Fixtures/extractor/syntax_error.twig'), - array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')), - ); - } - - /** - * @dataProvider resourceProvider - */ - public function testExtractWithFiles($resource) - { - $loader = new ArrayLoader(array()); - $twig = new Environment($loader, array( - 'strict_variables' => true, - 'debug' => true, - 'cache' => false, - 'autoescape' => false, - )); - $twig->addExtension(new TranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock())); - - $extractor = new TwigExtractor($twig); - $catalogue = new MessageCatalogue('en'); - $extractor->extract($resource, $catalogue); - - $this->assertTrue($catalogue->has('Hi!', 'messages')); - $this->assertEquals('Hi!', $catalogue->get('Hi!', 'messages')); - } - - /** - * @return array - */ - public function resourceProvider() - { - $directory = __DIR__.'/../Fixtures/extractor/'; - - return array( - array($directory.'with_translations.html.twig'), - array(array($directory.'with_translations.html.twig')), - array(array(new \SplFileInfo($directory.'with_translations.html.twig'))), - array(new \ArrayObject(array($directory.'with_translations.html.twig'))), - array(new \ArrayObject(array(new \SplFileInfo($directory.'with_translations.html.twig')))), - ); - } -} diff --git a/vendor/symfony/twig-bridge/Tests/TwigEngineTest.php b/vendor/symfony/twig-bridge/Tests/TwigEngineTest.php deleted file mode 100644 index a74c59e..0000000 --- a/vendor/symfony/twig-bridge/Tests/TwigEngineTest.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Tests; - -use PHPUnit\Framework\TestCase; -use Symfony\Bridge\Twig\TwigEngine; -use Symfony\Component\Templating\TemplateReference; -use Twig\Environment; -use Twig\Loader\ArrayLoader; - -class TwigEngineTest extends TestCase -{ - public function testExistsWithTemplateInstances() - { - $engine = $this->getTwig(); - - $this->assertTrue($engine->exists($this->getMockForAbstractClass('Twig\Template', array(), '', false))); - } - - public function testExistsWithNonExistentTemplates() - { - $engine = $this->getTwig(); - - $this->assertFalse($engine->exists('foobar')); - $this->assertFalse($engine->exists(new TemplateReference('foorbar'))); - } - - public function testExistsWithTemplateWithSyntaxErrors() - { - $engine = $this->getTwig(); - - $this->assertTrue($engine->exists('error')); - $this->assertTrue($engine->exists(new TemplateReference('error'))); - } - - public function testExists() - { - $engine = $this->getTwig(); - - $this->assertTrue($engine->exists('index')); - $this->assertTrue($engine->exists(new TemplateReference('index'))); - } - - public function testRender() - { - $engine = $this->getTwig(); - - $this->assertSame('foo', $engine->render('index')); - $this->assertSame('foo', $engine->render(new TemplateReference('index'))); - } - - /** - * @expectedException \Twig\Error\SyntaxError - */ - public function testRenderWithError() - { - $engine = $this->getTwig(); - - $engine->render(new TemplateReference('error')); - } - - protected function getTwig() - { - $twig = new Environment(new ArrayLoader(array( - 'index' => 'foo', - 'error' => '{{ foo }', - ))); - $parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock(); - - return new TwigEngine($twig, $parser); - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php deleted file mode 100644 index 7cdbb77..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\DumpNode; -use Twig\Token; -use Twig\TokenParser\AbstractTokenParser; - -/** - * Token Parser for the 'dump' tag. - * - * Dump variables with: - *
    - *  {% dump %}
    - *  {% dump foo %}
    - *  {% dump foo, bar %}
    - * 
    - * - * @author Julien Galenski - */ -class DumpTokenParser extends AbstractTokenParser -{ - /** - * {@inheritdoc} - */ - public function parse(Token $token) - { - $values = null; - if (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE)) { - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - } - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new DumpNode($this->parser->getVarName(), $values, $token->getLine(), $this->getTag()); - } - - /** - * {@inheritdoc} - */ - public function getTag() - { - return 'dump'; - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php deleted file mode 100644 index 12c2541..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\FormThemeNode; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Node; -use Twig\Token; -use Twig\TokenParser\AbstractTokenParser; - -/** - * Token Parser for the 'form_theme' tag. - * - * @author Fabien Potencier - */ -class FormThemeTokenParser extends AbstractTokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Token $token - * - * @return Node - */ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - $form = $this->parser->getExpressionParser()->parseExpression(); - - if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) { - $this->parser->getStream()->next(); - $resources = $this->parser->getExpressionParser()->parseExpression(); - } else { - $resources = new ArrayExpression(array(), $stream->getCurrent()->getLine()); - do { - $resources->addElement($this->parser->getExpressionParser()->parseExpression()); - } while (!$stream->test(Token::BLOCK_END_TYPE)); - } - - $stream->expect(Token::BLOCK_END_TYPE); - - return new FormThemeNode($form, $resources, $lineno, $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'form_theme'; - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php deleted file mode 100644 index 82c58d4..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\StopwatchNode; -use Twig\Node\Expression\AssignNameExpression; -use Twig\Token; -use Twig\TokenParser\AbstractTokenParser; - -/** - * Token Parser for the stopwatch tag. - * - * @author Wouter J - */ -class StopwatchTokenParser extends AbstractTokenParser -{ - protected $stopwatchIsAvailable; - - public function __construct($stopwatchIsAvailable) - { - $this->stopwatchIsAvailable = $stopwatchIsAvailable; - } - - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - // {% stopwatch 'bar' %} - $name = $this->parser->getExpressionParser()->parseExpression(); - - $stream->expect(Token::BLOCK_END_TYPE); - - // {% endstopwatch %} - $body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true); - $stream->expect(Token::BLOCK_END_TYPE); - - if ($this->stopwatchIsAvailable) { - return new StopwatchNode($name, $body, new AssignNameExpression($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag()); - } - - return $body; - } - - public function decideStopwatchEnd(Token $token) - { - return $token->test('endstopwatch'); - } - - public function getTag() - { - return 'stopwatch'; - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php deleted file mode 100644 index 2b4a9f3..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/TransChoiceTokenParser.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\TransNode; -use Twig\Error\SyntaxError; -use Twig\Node\Expression\AbstractExpression; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Node; -use Twig\Node\TextNode; -use Twig\Token; - -/** - * Token Parser for the 'transchoice' tag. - * - * @author Fabien Potencier - */ -class TransChoiceTokenParser extends TransTokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Token $token - * - * @return Node - * - * @throws SyntaxError - */ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - $vars = new ArrayExpression(array(), $lineno); - - $count = $this->parser->getExpressionParser()->parseExpression(); - - $domain = null; - $locale = null; - - if ($stream->test('with')) { - // {% transchoice count with vars %} - $stream->next(); - $vars = $this->parser->getExpressionParser()->parseExpression(); - } - - if ($stream->test('from')) { - // {% transchoice count from "messages" %} - $stream->next(); - $domain = $this->parser->getExpressionParser()->parseExpression(); - } - - if ($stream->test('into')) { - // {% transchoice count into "fr" %} - $stream->next(); - $locale = $this->parser->getExpressionParser()->parseExpression(); - } - - $stream->expect(Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true); - - if (!$body instanceof TextNode && !$body instanceof AbstractExpression) { - throw new SyntaxError('A message inside a transchoice tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName()); - } - - $stream->expect(Token::BLOCK_END_TYPE); - - return new TransNode($body, $domain, $count, $vars, $locale, $lineno, $this->getTag()); - } - - public function decideTransChoiceFork($token) - { - return $token->test(array('endtranschoice')); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'transchoice'; - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php deleted file mode 100644 index 4096a01..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; -use Twig\Node\Node; -use Twig\Token; -use Twig\TokenParser\AbstractTokenParser; - -/** - * Token Parser for the 'trans_default_domain' tag. - * - * @author Fabien Potencier - */ -class TransDefaultDomainTokenParser extends AbstractTokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Token $token - * - * @return Node - */ - public function parse(Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); - - return new TransDefaultDomainNode($expr, $token->getLine(), $this->getTag()); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'trans_default_domain'; - } -} diff --git a/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php deleted file mode 100644 index 848a080..0000000 --- a/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\TokenParser; - -use Symfony\Bridge\Twig\Node\TransNode; -use Twig\Error\SyntaxError; -use Twig\Node\Expression\AbstractExpression; -use Twig\Node\Expression\ArrayExpression; -use Twig\Node\Node; -use Twig\Node\TextNode; -use Twig\Token; -use Twig\TokenParser\AbstractTokenParser; - -/** - * Token Parser for the 'trans' tag. - * - * @author Fabien Potencier - */ -class TransTokenParser extends AbstractTokenParser -{ - /** - * Parses a token and returns a node. - * - * @param Token $token - * - * @return Node - * - * @throws SyntaxError - */ - public function parse(Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - - $vars = new ArrayExpression(array(), $lineno); - $domain = null; - $locale = null; - if (!$stream->test(Token::BLOCK_END_TYPE)) { - if ($stream->test('with')) { - // {% trans with vars %} - $stream->next(); - $vars = $this->parser->getExpressionParser()->parseExpression(); - } - - if ($stream->test('from')) { - // {% trans from "messages" %} - $stream->next(); - $domain = $this->parser->getExpressionParser()->parseExpression(); - } - - if ($stream->test('into')) { - // {% trans into "fr" %} - $stream->next(); - $locale = $this->parser->getExpressionParser()->parseExpression(); - } elseif (!$stream->test(Token::BLOCK_END_TYPE)) { - throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext()->getName()); - } - } - - // {% trans %}message{% endtrans %} - $stream->expect(Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideTransFork'), true); - - if (!$body instanceof TextNode && !$body instanceof AbstractExpression) { - throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName()); - } - - $stream->expect(Token::BLOCK_END_TYPE); - - return new TransNode($body, $domain, null, $vars, $locale, $lineno, $this->getTag()); - } - - public function decideTransFork($token) - { - return $token->test(array('endtrans')); - } - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() - { - return 'trans'; - } -} diff --git a/vendor/symfony/twig-bridge/Translation/TwigExtractor.php b/vendor/symfony/twig-bridge/Translation/TwigExtractor.php deleted file mode 100644 index bd35fe5..0000000 --- a/vendor/symfony/twig-bridge/Translation/TwigExtractor.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig\Translation; - -use Symfony\Component\Finder\Finder; -use Symfony\Component\Finder\SplFileInfo; -use Symfony\Component\Translation\Extractor\AbstractFileExtractor; -use Symfony\Component\Translation\Extractor\ExtractorInterface; -use Symfony\Component\Translation\MessageCatalogue; -use Twig\Environment; -use Twig\Error\Error; -use Twig\Source; - -/** - * TwigExtractor extracts translation messages from a twig template. - * - * @author Michel Salib - * @author Fabien Potencier - */ -class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface -{ - /** - * Default domain for found messages. - * - * @var string - */ - private $defaultDomain = 'messages'; - - /** - * Prefix for found message. - * - * @var string - */ - private $prefix = ''; - - /** - * The twig environment. - * - * @var Environment - */ - private $twig; - - public function __construct(Environment $twig) - { - $this->twig = $twig; - } - - /** - * {@inheritdoc} - */ - public function extract($resource, MessageCatalogue $catalogue) - { - $files = $this->extractFiles($resource); - foreach ($files as $file) { - try { - $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); - } catch (Error $e) { - if ($file instanceof \SplFileInfo) { - $path = $file->getRealPath() ?: $file->getPathname(); - $name = $file instanceof SplFileInfo ? $file->getRelativePathname() : $path; - if (method_exists($e, 'setSourceContext')) { - $e->setSourceContext(new Source('', $name, $path)); - } else { - $e->setTemplateName($name); - } - } - - throw $e; - } - } - } - - /** - * {@inheritdoc} - */ - public function setPrefix($prefix) - { - $this->prefix = $prefix; - } - - protected function extractTemplate($template, MessageCatalogue $catalogue) - { - $visitor = $this->twig->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslationNodeVisitor(); - $visitor->enable(); - - $this->twig->parse($this->twig->tokenize(new Source($template, ''))); - - foreach ($visitor->getMessages() as $message) { - $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain); - } - - $visitor->disable(); - } - - /** - * @param string $file - * - * @return bool - */ - protected function canBeExtracted($file) - { - return $this->isFile($file) && 'twig' === pathinfo($file, PATHINFO_EXTENSION); - } - - /** - * @param string|array $directory - * - * @return array - */ - protected function extractFromDirectory($directory) - { - $finder = new Finder(); - - return $finder->files()->name('*.twig')->in($directory); - } -} diff --git a/vendor/symfony/twig-bridge/TwigEngine.php b/vendor/symfony/twig-bridge/TwigEngine.php deleted file mode 100644 index bc0a4fe..0000000 --- a/vendor/symfony/twig-bridge/TwigEngine.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Twig; - -use Symfony\Component\Templating\EngineInterface; -use Symfony\Component\Templating\StreamingEngineInterface; -use Symfony\Component\Templating\TemplateNameParserInterface; -use Symfony\Component\Templating\TemplateReferenceInterface; -use Twig\Environment; -use Twig\Error\Error; -use Twig\Error\LoaderError; -use Twig\Loader\ExistsLoaderInterface; -use Twig\Template; - -/** - * This engine knows how to render Twig templates. - * - * @author Fabien Potencier - */ -class TwigEngine implements EngineInterface, StreamingEngineInterface -{ - protected $environment; - protected $parser; - - public function __construct(Environment $environment, TemplateNameParserInterface $parser) - { - $this->environment = $environment; - $this->parser = $parser; - } - - /** - * {@inheritdoc} - * - * It also supports Template as name parameter. - * - * @throws Error if something went wrong like a thrown exception while rendering the template - */ - public function render($name, array $parameters = array()) - { - return $this->load($name)->render($parameters); - } - - /** - * {@inheritdoc} - * - * It also supports Template as name parameter. - * - * @throws Error if something went wrong like a thrown exception while rendering the template - */ - public function stream($name, array $parameters = array()) - { - $this->load($name)->display($parameters); - } - - /** - * {@inheritdoc} - * - * It also supports Template as name parameter. - */ - public function exists($name) - { - if ($name instanceof Template) { - return true; - } - - $loader = $this->environment->getLoader(); - - if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) { - return $loader->exists((string) $name); - } - - try { - // cast possible TemplateReferenceInterface to string because the - // EngineInterface supports them but LoaderInterface does not - $loader->getSourceContext((string) $name)->getCode(); - } catch (LoaderError $e) { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - * - * It also supports Template as name parameter. - */ - public function supports($name) - { - if ($name instanceof Template) { - return true; - } - - $template = $this->parser->parse($name); - - return 'twig' === $template->get('engine'); - } - - /** - * Loads the given template. - * - * @param string|TemplateReferenceInterface|Template $name A template name or an instance of - * TemplateReferenceInterface or Template - * - * @return Template - * - * @throws \InvalidArgumentException if the template does not exist - */ - protected function load($name) - { - if ($name instanceof Template) { - return $name; - } - - try { - return $this->environment->loadTemplate((string) $name); - } catch (LoaderError $e) { - throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); - } - } -} diff --git a/vendor/symfony/twig-bridge/composer.json b/vendor/symfony/twig-bridge/composer.json deleted file mode 100644 index e00e3dc..0000000 --- a/vendor/symfony/twig-bridge/composer.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "symfony/twig-bridge", - "type": "symfony-bridge", - "description": "Symfony Twig Bridge", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": "^5.5.9|>=7.0.8", - "twig/twig": "~1.34|~2.4" - }, - "require-dev": { - "fig/link-util": "^1.0", - "symfony/asset": "~2.8|~3.0", - "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.10|^3.3.3", - "symfony/http-kernel": "~3.2", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.8|~3.0", - "symfony/templating": "~2.8|~3.0", - "symfony/translation": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0", - "symfony/security": "~2.8|~3.0", - "symfony/security-acl": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2", - "symfony/expression-language": "~2.8|~3.0", - "symfony/web-link": "~3.3" - }, - "conflict": { - "symfony/form": "<3.2.10|~3.3,<3.3.3" - }, - "suggest": { - "symfony/finder": "", - "symfony/asset": "For using the AssetExtension", - "symfony/form": "For using the FormExtension", - "symfony/http-kernel": "For using the HttpKernelExtension", - "symfony/routing": "For using the RoutingExtension", - "symfony/templating": "For using the TwigEngine", - "symfony/translation": "For using the TranslationExtension", - "symfony/yaml": "For using the YamlExtension", - "symfony/security": "For using the SecurityExtension", - "symfony/stopwatch": "For using the StopwatchExtension", - "symfony/var-dumper": "For using the DumpExtension", - "symfony/expression-language": "For using the ExpressionExtension", - "symfony/web-link": "For using the WebLinkExtension" - }, - "autoload": { - "psr-4": { "Symfony\\Bridge\\Twig\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - } -} diff --git a/vendor/symfony/twig-bridge/phpunit.xml.dist b/vendor/symfony/twig-bridge/phpunit.xml.dist deleted file mode 100644 index 642b7d1..0000000 --- a/vendor/symfony/twig-bridge/phpunit.xml.dist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Resources - ./Tests - ./vendor - - - - diff --git a/vendor/twig/twig/.editorconfig b/vendor/twig/twig/.editorconfig deleted file mode 100644 index 270f1d1..0000000 --- a/vendor/twig/twig/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -; top-most EditorConfig file -root = true - -; Unix-style newlines -[*] -end_of_line = LF - -[*.php] -indent_style = space -indent_size = 4 - -[*.test] -indent_style = space -indent_size = 4 - -[*.rst] -indent_style = space -indent_size = 4 diff --git a/vendor/twig/twig/.gitignore b/vendor/twig/twig/.gitignore deleted file mode 100644 index bc959c5..0000000 --- a/vendor/twig/twig/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/composer.lock -/phpunit.xml -/vendor diff --git a/vendor/twig/twig/.php_cs.dist b/vendor/twig/twig/.php_cs.dist deleted file mode 100644 index cd75923..0000000 --- a/vendor/twig/twig/.php_cs.dist +++ /dev/null @@ -1,15 +0,0 @@ -setRules(array( - '@Symfony' => true, - '@Symfony:risky' => true, - 'array_syntax' => array('syntax' => 'long'), - 'php_unit_fqcn_annotation' => false, - 'no_unreachable_default_argument_value' => false, - 'braces' => array('allow_single_line_closure' => true), - 'heredoc_to_nowdoc' => false, - )) - ->setRiskyAllowed(true) - ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) -; diff --git a/vendor/twig/twig/.travis.yml b/vendor/twig/twig/.travis.yml deleted file mode 100644 index 6be12c0..0000000 --- a/vendor/twig/twig/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php - -sudo: false - -cache: - directories: - - vendor - - $HOME/.composer/cache/files - -matrix: - include: - - php: 7.0 - - php: 7.1 - - php: nightly - fast_finish: true - -before_install: - # turn off XDebug - - phpenv config-rm xdebug.ini || return 0 - -install: - - travis_retry composer install - -script: | - if [[ $TRAVIS_PHP_VERSION = 7.* || $TRAVIS_PHP_VERSION = nightly ]]; then - SYMFONY_PHPUNIT_VERSION=6.1 ./vendor/bin/simple-phpunit - else - ./vendor/bin/simple-phpunit - fi diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG deleted file mode 100644 index 1725c30..0000000 --- a/vendor/twig/twig/CHANGELOG +++ /dev/null @@ -1,1065 +0,0 @@ -* 2.4.4 (2017-09-27) - - * added Twig_Profiler_Profile::reset() - * fixed use TokenParser to return an empty Node - * added RuntimeExtensionInterface - * added circular reference detection when loading templates - * added support for runtime loaders in IntegrationTestCase - * fixed deprecation when using Twig_Profiler_Dumper_Html - * removed @final from Twig_Profiler_Dumper_Text - -* 2.4.3 (2017-06-07) - - * fixed namespaces introduction - -* 2.4.2 (2017-06-05) - - * fixed namespaces introduction - -* 2.4.1 (2017-06-05) - - * fixed namespaces introduction - -* 2.4.0 (2017-06-05) - - * added support for PHPUnit 6 when testing extensions - * fixed PHP 7.2 compatibility - * fixed template name generation in Twig_Environment::createTemplate() - * removed final tag on Twig_TokenParser_Include - * dropped HHVM support - * added namespaced aliases for all (non-deprecated) classes and interfaces - * marked Twig_Filter, Twig_Function, Twig_Test, Twig_Node_Module and Twig_Profiler_Profile as final via the @final annotation - -* 2.3.2 (2017-04-20) - - * fixed edge case in the method cache for Twig attributes - -* 2.3.1 (2017-04-18) - - * fixed the empty() test - -* 2.3.0 (2017-03-22) - - * fixed a race condition handling when writing cache files - * "length" filter now returns string length when applied to an object that does - not implement \Countable but provides __toString() - * "empty" test will now consider the return value of the __toString() method for - objects implement __toString() but not \Countable - * fixed JS escaping for unicode characters with higher code points - * added error message when calling `parent()` in a block that doesn't exist in the parent template - -* 2.2.0 (2017-02-26) - - * added a PSR-11 compatible runtime loader - * added `side` argument to `trim` to allow left or right trimming only. - -* 2.1.0 (2017-01-11) - - * fixed twig_get_attribute() - * added Twig_NodeCaptureInterface for nodes that capture all output - -* 2.0.0 (2017-01-05) - - * removed the C extension - * moved Twig_Environment::getAttribute() to twig_get_attribute() - * removed Twig_Environment::getLexer(), Twig_Environment::getParser(), Twig_Environment::getCompiler() - * removed Twig_Compiler::getFilename() - * added hasser support in Twig_Template::getAttribute() - * sped up the json_encode filter - * removed reserved macro names; all names can be used as macro - * removed Twig_Template::getEnvironment() - * changed _self variable to return the current template name - * made the loader a required argument of Twig_Environment constructor - * removed Twig_Environment::clearTemplateCache() - * removed Twig_Autoloader (use Composer instead) - * removed `true` as an equivalent to `html` for the auto-escaping strategy - * removed pre-1.8 autoescape tag syntax - * dropped support for PHP 5.x - * removed the ability to register a global variable after the runtime or the extensions have been initialized - * improved the performance of the filesystem loader - * removed features that were deprecated in 1.x - -* 1.35.0 (2017-XX-XX) - - * added Twig_Profiler_Profile::reset() - * fixed use TokenParser to return an empty Node - * added RuntimeExtensionInterface - * added circular reference detection when loading templates - -* 1.34.4 (2017-07-04) - - * added support for runtime loaders in IntegrationTestCase - * fixed deprecation when using Twig_Profiler_Dumper_Html - -* 1.34.3 (2017-06-07) - - * fixed namespaces introduction - -* 1.34.2 (2017-06-05) - - * fixed namespaces introduction - -* 1.34.1 (2017-06-05) - - * fixed namespaces introduction - -* 1.34.0 (2017-06-05) - - * added support for PHPUnit 6 when testing extensions - * fixed PHP 7.2 compatibility - * fixed template name generation in Twig_Environment::createTemplate() - * removed final tag on Twig_TokenParser_Include - * added namespaced aliases for all (non-deprecated) classes and interfaces - * dropped HHVM support - * dropped PHP 5.2 support - -* 1.33.2 (2017-04-20) - - * fixed edge case in the method cache for Twig attributes - -* 1.33.1 (2017-04-18) - - * fixed the empty() test - -* 1.33.0 (2017-03-22) - - * fixed a race condition handling when writing cache files - * "length" filter now returns string length when applied to an object that does - not implement \Countable but provides __toString() - * "empty" test will now consider the return value of the __toString() method for - objects implement __toString() but not \Countable - * fixed JS escaping for unicode characters with higher code points - -* 1.32.0 (2017-02-26) - - * fixed deprecation notice in Twig_Util_DeprecationCollector - * added a PSR-11 compatible runtime loader - * added `side` argument to `trim` to allow left or right trimming only. - -* 1.31.0 (2017-01-11) - - * added Twig_NodeCaptureInterface for nodes that capture all output - * fixed marking the environment as initialized too early - * fixed C89 compat for the C extension - * turned fatal error into exception when a previously generated cache is corrupted - * fixed offline cache warm-ups for embedded templates - -* 1.30.0 (2016-12-23) - - * added Twig_FactoryRuntimeLoader - * deprecated function/test/filter/tag overriding - * deprecated the "disable_c_ext" attribute on Twig_Node_Expression_GetAttr - -* 1.29.0 (2016-12-13) - - * fixed sandbox being left enabled if an exception is thrown while rendering - * marked some classes as being final (via @final) - * made Twig_Error report real source path when possible - * added support for {{ _self }} to provide an upgrade path from 1.x to 2.0 (replaces {{ _self.templateName }}) - * deprecated silent display of undefined blocks - * deprecated support for mbstring.func_overload != 0 - -* 1.28.2 (2016-11-23) - - * fixed precedence between getFoo() and isFoo() in Twig_Template::getAttribute() - * improved a deprecation message - -* 1.28.1 (2016-11-18) - - * fixed block() function when used with a template argument - -* 1.28.0 (2016-11-17) - - * added support for the PHP 7 null coalescing operator for the ?? Twig implementation - * exposed a way to access template data and methods in a portable way - * changed context access to use the PHP 7 null coalescing operator when available - * added the "with" tag - * added support for a custom template on the block() function - * added "is defined" support for block() and constant() - * optimized the way attributes are fetched - -* 1.27.0 (2016-10-25) - - * deprecated Twig_Parser::getEnvironment() - * deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor() - * deprecated Twig_Compiler::addIndentation() - * fixed regression when registering two extensions having the same class name - * deprecated Twig_LoaderInterface::getSource() (implement Twig_SourceContextLoaderInterface instead) - * fixed the filesystem loader with relative paths - * deprecated Twig_Node::getLine() in favor of Twig_Node::getTemplateLine() - * deprecated Twig_Template::getSource() in favor of Twig_Template::getSourceContext() - * deprecated Twig_Node::getFilename() in favor of Twig_Node::getTemplateName() - * deprecated the "filename" escaping strategy (use "name" instead) - * added Twig_Source to hold information about the original template - * deprecated Twig_Error::getTemplateFile() and Twig_Error::setTemplateFile() in favor of Twig_Error::getTemplateName() and Twig_Error::setTemplateName() - * deprecated Parser::getFilename() - * fixed template paths when a template name contains a protocol like vfs:// - * improved debugging with Twig_Sandbox_SecurityError exceptions for disallowed methods and properties - -* 1.26.1 (2016-10-05) - - * removed template source code from generated template classes when debug is disabled - * fixed default implementation of Twig_Template::getDebugInfo() for better BC - * fixed regression on static calls for functions/filters/tests - -* 1.26.0 (2016-10-02) - - * added template cache invalidation based on more environment options - * added a missing deprecation notice - * fixed template paths when a template is stored in a PHAR file - * allowed filters/functions/tests implementation to use a different class than the extension they belong to - * deprecated Twig_ExtensionInterface::getName() - -* 1.25.0 (2016-09-21) - - * changed the way we store template source in template classes - * removed usage of realpath in cache keys - * fixed Twig cache sharing when used with different versions of PHP - * removed embed parent workaround for simple use cases - * deprecated the ability to store non Node instances in Node::$nodes - * deprecated Twig_Environment::getLexer(), Twig_Environment::getParser(), Twig_Environment::getCompiler() - * deprecated Twig_Compiler::getFilename() - -* 1.24.2 (2016-09-01) - - * fixed static callables - * fixed a potential PHP warning when loading the cache - * fixed a case where the autoescaping does not work as expected - -* 1.24.1 (2016-05-30) - - * fixed reserved keywords (forbids true, false, null and none keywords for variables names) - * fixed support for PHP7 (Throwable support) - * marked the following methods as being internals on Twig_Environment: - getFunctions(), getFilters(), getTests(), getFunction(), getFilter(), getTest(), - getTokenParsers(), getTags(), getNodeVisitors(), getUnaryOperators(), getBinaryOperators(), - getFunctions(), getFilters(), getGlobals(), initGlobals(), initExtensions(), and initExtension() - -* 1.24.0 (2016-01-25) - - * adding support for the ?? operator - * fixed the defined test when used on a constant, a map, or a sequence - * undeprecated _self (should only be used to get the template name, not the template instance) - * fixed parsing on PHP7 - -* 1.23.3 (2016-01-11) - - * fixed typo - -* 1.23.2 (2015-01-11) - - * added versions in deprecated messages - * made file cache tolerant for trailing (back)slashes on directory configuration - * deprecated unused Twig_Node_Expression_ExtensionReference class - -* 1.23.1 (2015-11-05) - - * fixed some exception messages which triggered PHP warnings - * fixed BC on Twig_Test_NodeTestCase - -* 1.23.0 (2015-10-29) - - * deprecated the possibility to override an extension by registering another one with the same name - * deprecated Twig_ExtensionInterface::getGlobals() (added Twig_Extension_GlobalsInterface for BC) - * deprecated Twig_ExtensionInterface::initRuntime() (added Twig_Extension_InitRuntimeInterface for BC) - * deprecated Twig_Environment::computeAlternatives() - -* 1.22.3 (2015-10-13) - - * fixed regression when using null as a cache strategy - * improved performance when checking template freshness - * fixed warnings when loaded templates do not exist - * fixed template class name generation to prevent possible collisions - * fixed logic for custom escapers to call them even on integers and null values - * changed template cache names to take into account the Twig C extension - -* 1.22.2 (2015-09-22) - - * fixed a race condition in template loading - -* 1.22.1 (2015-09-15) - - * fixed regression in template_from_string - -* 1.22.0 (2015-09-13) - - * made Twig_Test_IntegrationTestCase more flexible - * added an option to force PHP bytecode invalidation when writing a compiled template into the cache - * fixed the profiler duration for the root node - * changed template cache names to take into account enabled extensions - * deprecated Twig_Environment::clearCacheFiles(), Twig_Environment::getCacheFilename(), - Twig_Environment::writeCacheFile(), and Twig_Environment::getTemplateClassPrefix() - * added a way to override the filesystem template cache system - * added a way to get the original template source from Twig_Template - -* 1.21.2 (2015-09-09) - - * fixed variable names for the deprecation triggering code - * fixed escaping strategy detection based on filename - * added Traversable support for replace, merge, and sort - * deprecated support for character by character replacement for the "replace" filter - -* 1.21.1 (2015-08-26) - - * fixed regression when using the deprecated Twig_Test_* classes - -* 1.21.0 (2015-08-24) - - * added deprecation notices for deprecated features - * added a deprecation "framework" for filters/functions/tests and test fixtures - -* 1.20.0 (2015-08-12) - - * forbid access to the Twig environment from templates and internal parts of Twig_Template - * fixed limited RCEs when in sandbox mode - * deprecated Twig_Template::getEnvironment() - * deprecated the _self variable for usage outside of the from and import tags - * added Twig_BaseNodeVisitor to ease the compatibility of node visitors - between 1.x and 2.x - -* 1.19.0 (2015-07-31) - - * fixed wrong error message when including an undefined template in a child template - * added support for variadic filters, functions, and tests - * added support for extra positional arguments in macros - * added ignore_missing flag to the source function - * fixed batch filter with zero items - * deprecated Twig_Environment::clearTemplateCache() - * fixed sandbox disabling when using the include function - -* 1.18.2 (2015-06-06) - - * fixed template/line guessing in exceptions for nested templates - * optimized the number of inodes and the size of realpath cache when using the cache - -* 1.18.1 (2015-04-19) - - * fixed memory leaks in the C extension - * deprecated Twig_Loader_String - * fixed the slice filter when used with a SimpleXMLElement object - * fixed filesystem loader when trying to load non-files (like directories) - -* 1.18.0 (2015-01-25) - - * fixed some error messages where the line was wrong (unknown variables or argument names) - * added a new way to customize the main Module node (via empty nodes) - * added Twig_Environment::createTemplate() to create a template from a string - * added a profiler - * fixed filesystem loader cache when different file paths are used for the same template - -* 1.17.0 (2015-01-14) - - * added a 'filename' autoescaping strategy, which dynamically chooses the - autoescaping strategy for a template based on template file extension. - -* 1.16.3 (2014-12-25) - - * fixed regression for dynamic parent templates - * fixed cache management with statcache - * fixed a regression in the slice filter - -* 1.16.2 (2014-10-17) - - * fixed timezone on dates as strings - * fixed 2-words test names when a custom node class is not used - * fixed macros when using an argument named like a PHP super global (like GET or POST) - * fixed date_modify when working with DateTimeImmutable - * optimized for loops - * fixed multi-byte characters handling in the split filter - * fixed a regression in the in operator - * fixed a regression in the slice filter - -* 1.16.1 (2014-10-10) - - * improved error reporting in a sandboxed template - * fixed missing error file/line information under certain circumstances - * fixed wrong error line number in some error messages - * fixed the in operator to use strict comparisons - * sped up the slice filter - * fixed for mb function overload mb_substr acting different - * fixed the attribute() function when passing a variable for the arguments - -* 1.16.0 (2014-07-05) - - * changed url_encode to always encode according to RFC 3986 - * fixed inheritance in a 'use'-hierarchy - * removed the __toString policy check when the sandbox is disabled - * fixed recursively calling blocks in templates with inheritance - -* 1.15.1 (2014-02-13) - - * fixed the conversion of the special '0000-00-00 00:00' date - * added an error message when trying to import an undefined block from a trait - * fixed a C extension crash when accessing defined but uninitialized property. - -* 1.15.0 (2013-12-06) - - * made ignoreStrictCheck in Template::getAttribute() works with __call() methods throwing BadMethodCallException - * added min and max functions - * added the round filter - * fixed a bug that prevented the optimizers to be enabled/disabled selectively - * fixed first and last filters for UTF-8 strings - * added a source function to include the content of a template without rendering it - * fixed the C extension sandbox behavior when get or set is prepend to method name - -* 1.14.2 (2013-10-30) - - * fixed error filename/line when an error occurs in an included file - * allowed operators that contain whitespaces to have more than one whitespace - * allowed tests to be made of 1 or 2 words (like "same as" or "divisible by") - -* 1.14.1 (2013-10-15) - - * made it possible to use named operators as variables - * fixed the possibility to have a variable named 'matches' - * added support for PHP 5.5 DateTimeInterface - -* 1.14.0 (2013-10-03) - - * fixed usage of the html_attr escaping strategy to avoid double-escaping with the html strategy - * added new operators: ends with, starts with, and matches - * fixed some compatibility issues with HHVM - * added a way to add custom escaping strategies - * fixed the C extension compilation on Windows - * fixed the batch filter when using a fill argument with an exact match of elements to batch - * fixed the filesystem loader cache when a template name exists in several namespaces - * fixed template_from_string when the template includes or extends other ones - * fixed a crash of the C extension on an edge case - -* 1.13.2 (2013-08-03) - - * fixed the error line number for an error occurs in and embedded template - * fixed crashes of the C extension on some edge cases - -* 1.13.1 (2013-06-06) - - * added the possibility to ignore the filesystem constructor argument in Twig_Loader_Filesystem - * fixed Twig_Loader_Chain::exists() for a loader which implements Twig_ExistsLoaderInterface - * adjusted backtrace call to reduce memory usage when an error occurs - * added support for object instances as the second argument of the constant test - * fixed the include function when used in an assignment - -* 1.13.0 (2013-05-10) - - * fixed getting a numeric-like item on a variable ('09' for instance) - * fixed getting a boolean or float key on an array, so it is consistent with PHP's array access: - `{{ array[false] }}` behaves the same as `echo $array[false];` (equals `$array[0]`) - * made the escape filter 20% faster for happy path (escaping string for html with UTF-8) - * changed ☃ to § in tests - * enforced usage of named arguments after positional ones - -* 1.12.3 (2013-04-08) - - * fixed a security issue in the filesystem loader where it was possible to include a template one - level above the configured path - * fixed fatal error that should be an exception when adding a filter/function/test too late - * added a batch filter - * added support for encoding an array as query string in the url_encode filter - -* 1.12.2 (2013-02-09) - - * fixed the timezone used by the date filter and function when the given date contains a timezone (like 2010-01-28T15:00:00+02:00) - * fixed globals when getGlobals is called early on - * added the first and last filter - -* 1.12.1 (2013-01-15) - - * added support for object instances as the second argument of the constant function - * relaxed globals management to avoid a BC break - * added support for {{ some_string[:2] }} - -* 1.12.0 (2013-01-08) - - * added verbatim as an alias for the raw tag to avoid confusion with the raw filter - * fixed registration of tests and functions as anonymous functions - * fixed globals management - -* 1.12.0-RC1 (2012-12-29) - - * added an include function (does the same as the include tag but in a more flexible way) - * added the ability to use any PHP callable to define filters, functions, and tests - * added a syntax error when using a loop variable that is not defined - * added the ability to set default values for macro arguments - * added support for named arguments for filters, tests, and functions - * moved filters/functions/tests syntax errors to the parser - * added support for extended ternary operator syntaxes - -* 1.11.1 (2012-11-11) - - * fixed debug info line numbering (was off by 2) - * fixed escaping when calling a macro inside another one (regression introduced in 1.9.1) - * optimized variable access on PHP 5.4 - * fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX) - -* 1.11.0 (2012-11-07) - - * fixed macro compilation when a variable name is a PHP reserved keyword - * changed the date filter behavior to always apply the default timezone, except if false is passed as the timezone - * fixed bitwise operator precedences - * added the template_from_string function - * fixed default timezone usage for the date function - * optimized the way Twig exceptions are managed (to make them faster) - * added Twig_ExistsLoaderInterface (implementing this interface in your loader make the chain loader much faster) - -* 1.10.3 (2012-10-19) - - * fixed wrong template location in some error messages - * reverted a BC break introduced in 1.10.2 - * added a split filter - -* 1.10.2 (2012-10-15) - - * fixed macro calls on PHP 5.4 - -* 1.10.1 (2012-10-15) - - * made a speed optimization to macro calls when imported via the "import" tag - * fixed C extension compilation on Windows - * fixed a segfault in the C extension when using DateTime objects - -* 1.10.0 (2012-09-28) - - * extracted functional tests framework to make it reusable for third-party extensions - * added namespaced templates support in Twig_Loader_Filesystem - * added Twig_Loader_Filesystem::prependPath() - * fixed an error when a token parser pass a closure as a test to the subparse() method - -* 1.9.2 (2012-08-25) - - * fixed the in operator for objects that contain circular references - * fixed the C extension when accessing a public property of an object implementing the \ArrayAccess interface - -* 1.9.1 (2012-07-22) - - * optimized macro calls when auto-escaping is on - * fixed wrong parent class for Twig_Function_Node - * made Twig_Loader_Chain more explicit about problems - -* 1.9.0 (2012-07-13) - - * made the parsing independent of the template loaders - * fixed exception trace when an error occurs when rendering a child template - * added escaping strategies for CSS, URL, and HTML attributes - * fixed nested embed tag calls - * added the date_modify filter - -* 1.8.3 (2012-06-17) - - * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash - * fixed escaping when a project defines a function named html or js - * fixed chmod mode to apply the umask correctly - -* 1.8.2 (2012-05-30) - - * added the abs filter - * fixed a regression when using a number in template attributes - * fixed compiler when mbstring.func_overload is set to 2 - * fixed DateTimeZone support in date filter - -* 1.8.1 (2012-05-17) - - * fixed a regression when dealing with SimpleXMLElement instances in templates - * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini - * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) - -* 1.8.0 (2012-05-08) - - * enforced interface when adding tests, filters, functions, and node visitors from extensions - * fixed a side-effect of the date filter where the timezone might be changed - * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) - * added a way to dynamically change the auto-escaping strategy according to the template "filename" - * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) - * added an embed tag - -* 1.7.0 (2012-04-24) - - * fixed a PHP warning when using CIFS - * fixed template line number in some exceptions - * added an iterable test - * added an error when defining two blocks with the same name in a template - * added the preserves_safety option for filters - * fixed a PHP notice when trying to access a key on a non-object/array variable - * enhanced error reporting when the template file is an instance of SplFileInfo - * added Twig_Environment::mergeGlobals() - * added compilation checks to avoid misuses of the sandbox tag - * fixed filesystem loader freshness logic for high traffic websites - * fixed random function when charset is null - -* 1.6.5 (2012-04-11) - - * fixed a regression when a template only extends another one without defining any blocks - -* 1.6.4 (2012-04-02) - - * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 - * fixed performance when compiling large files - * optimized parent template creation when the template does not use dynamic inheritance - -* 1.6.3 (2012-03-22) - - * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension - * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot - * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate - -* 1.6.2 (2012-03-18) - - * fixed sandbox mode when used with inheritance - * added preserveKeys support for the slice filter - * fixed the date filter when a DateTime instance is passed with a specific timezone - * added a trim filter - -* 1.6.1 (2012-02-29) - - * fixed Twig C extension - * removed the creation of Twig_Markup instances when not needed - * added a way to set the default global timezone for dates - * fixed the slice filter on strings when the length is not specified - * fixed the creation of the cache directory in case of a race condition - -* 1.6.0 (2012-02-04) - - * fixed raw blocks when used with the whitespace trim option - * made a speed optimization to macro calls when imported via the "from" tag - * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added - * fixed the attribute function when passing arguments - * added slice notation support for the [] operator (syntactic sugar for the slice operator) - * added a slice filter - * added string support for the reverse filter - * fixed the empty test and the length filter for Twig_Markup instances - * added a date function to ease date comparison - * fixed unary operators precedence - * added recursive parsing support in the parser - * added string and integer handling for the random function - -* 1.5.1 (2012-01-05) - - * fixed a regression when parsing strings - -* 1.5.0 (2012-01-04) - - * added Traversable objects support for the join filter - -* 1.5.0-RC2 (2011-12-30) - - * added a way to set the default global date interval format - * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) - * refactored Twig_Template::display() to ease its extension - * added a number_format filter - -* 1.5.0-RC1 (2011-12-26) - - * removed the need to quote hash keys - * allowed hash keys to be any expression - * added a do tag - * added a flush tag - * added support for dynamically named filters and functions - * added a dump function to help debugging templates - * added a nl2br filter - * added a random function - * added a way to change the default format for the date filter - * fixed the lexer when an operator ending with a letter ends a line - * added string interpolation support - * enhanced exceptions for unknown filters, functions, tests, and tags - -* 1.4.0 (2011-12-07) - - * fixed lexer when using big numbers (> PHP_INT_MAX) - * added missing preserveKeys argument to the reverse filter - * fixed macros containing filter tag calls - -* 1.4.0-RC2 (2011-11-27) - - * removed usage of Reflection in Twig_Template::getAttribute() - * added a C extension that can optionally replace Twig_Template::getAttribute() - * added negative timestamp support to the date filter - -* 1.4.0-RC1 (2011-11-20) - - * optimized variable access when using PHP 5.4 - * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby - * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders - * added Twig_Function_Node to allow more complex functions to have their own Node class - * added Twig_Filter_Node to allow more complex filters to have their own Node class - * added Twig_Test_Node to allow more complex tests to have their own Node class - * added a better error message when a template is empty but contain a BOM - * fixed "in" operator for empty strings - * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) - * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) - * added Twig_Environment::display() - * made the escape filter smarter when the encoding is not supported by PHP - * added a convert_encoding filter - * moved all node manipulations outside the compile() Node method - * made several speed optimizations - -* 1.3.0 (2011-10-08) - -no changes - -* 1.3.0-RC1 (2011-10-04) - - * added an optimization for the parent() function - * added cache reloading when auto_reload is true and an extension has been modified - * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) - * allowed empty templates to be used as traits - * added traits support for the "parent" function - -* 1.2.0 (2011-09-13) - -no changes - -* 1.2.0-RC1 (2011-09-10) - - * enhanced the exception when a tag remains unclosed - * added support for empty Countable objects for the "empty" test - * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) - * added better support for encoding problems when escaping a string (available as of PHP 5.4) - * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) - * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) - * added support for bitwise operators in expressions - * added the "attribute" function to allow getting dynamic attributes on variables - * added Twig_Loader_Chain - * added Twig_Loader_Array::setTemplate() - * added an optimization for the set tag when used to capture a large chunk of static text - * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) - * removed the possibility to use the "extends" tag from a block - * added "if" modifier support to "for" loops - -* 1.1.2 (2011-07-30) - - * fixed json_encode filter on PHP 5.2 - * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) - * fixed inheritance when using conditional parents - * fixed compilation of templates when the body of a child template is not empty - * fixed output when a macro throws an exception - * fixed a parsing problem when a large chunk of text is enclosed in a comment tag - * added PHPDoc for all Token parsers and Core extension functions - -* 1.1.1 (2011-07-17) - - * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) - * made some performance improvement for some edge cases - -* 1.1.0 (2011-06-28) - - * fixed json_encode filter - -* 1.1.0-RC3 (2011-06-24) - - * fixed method case-sensitivity when using the sandbox mode - * added timezone support for the date filter - * fixed possible security problems with NUL bytes - -* 1.1.0-RC2 (2011-06-16) - - * added an exception when the template passed to "use" is not a string - * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) - * added {% line \d+ %} directive - -* 1.1.0-RC1 (2011-05-28) - -Flush your cache after upgrading. - - * fixed date filter when using a timestamp - * fixed the defined test for some cases - * fixed a parsing problem when a large chunk of text is enclosed in a raw tag - * added support for horizontal reuse of template blocks (see docs for more information) - * added whitespace control modifier to all tags (see docs for more information) - * added null as an alias for none (the null test is also an alias for the none test now) - * made TRUE, FALSE, NONE equivalent to their lowercase counterparts - * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line - * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) - -* 1.0.0 (2011-03-27) - - * fixed output when using mbstring - * fixed duplicate call of methods when using the sandbox - * made the charset configurable for the escape filter - -* 1.0.0-RC2 (2011-02-21) - - * changed the way {% set %} works when capturing (the content is now marked as safe) - * added support for macro name in the endmacro tag - * make Twig_Error compatible with PHP 5.3.0 > - * fixed an infinite loop on some Windows configurations - * fixed the "length" filter for numbers - * fixed Template::getAttribute() as properties in PHP are case sensitive - * removed coupling between Twig_Node and Twig_Template - * fixed the ternary operator precedence rule - -* 1.0.0-RC1 (2011-01-09) - -Backward incompatibilities: - - * the "items" filter, which has been deprecated for quite a long time now, has been removed - * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) - * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} - * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} - * the "for" tag does not support "joined by" anymore - * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") - * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) - * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) - * removed the grammar and simple token parser (moved to the Twig Extensions repository) - -Changes: - - * added "needs_context" option for filters and functions (the context is then passed as a first argument) - * added global variables support - * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) - * added the "from" tag to import macros as functions - * added support for functions (a function is just syntactic sugar for a getAttribute() call) - * made macros callable when sandbox mode is enabled - * added an exception when a macro uses a reserved name - * the "default" filter now uses the "empty" test instead of just checking for null - * added the "empty" test - -* 0.9.10 (2010-12-16) - -Backward incompatibilities: - - * The Escaper extension is enabled by default, which means that all displayed - variables are now automatically escaped. You can revert to the previous - behavior by removing the extension via $env->removeExtension('escaper') - or just set the 'autoescape' option to 'false'. - * removed the "without loop" attribute for the "for" tag (not needed anymore - as the Optimizer take care of that for most cases) - * arrays and hashes have now a different syntax - * arrays keep the same syntax with square brackets: [1, 2] - * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) - * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) - * the i18n extension is now part of the Twig Extensions repository - -Changes: - - * added the merge filter - * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead - * fixed usage of operators as method names (like is, in, and not) - * changed the order of execution for node visitors - * fixed default() filter behavior when used with strict_variables set to on - * fixed filesystem loader compatibility with PHAR files - * enhanced error messages when an unexpected token is parsed in an expression - * fixed filename not being added to syntax error messages - * added the autoescape option to enable/disable autoescaping - * removed the newline after a comment (mimics PHP behavior) - * added a syntax error exception when parent block is used on a template that does not extend another one - * made the Escaper extension enabled by default - * fixed sandbox extension when used with auto output escaping - * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) - * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) - * added priority to node visitors - -* 0.9.9 (2010-11-28) - -Backward incompatibilities: - * the self special variable has been renamed to _self - * the odd and even filters are now tests: - {{ foo|odd }} must now be written {{ foo is odd }} - * the "safe" filter has been renamed to "raw" - * in Node classes, - sub-nodes are now accessed via getNode() (instead of property access) - attributes via getAttribute() (instead of array access) - * the urlencode filter had been renamed to url_encode - * the include tag now merges the passed variables with the current context by default - (the old behavior is still possible by adding the "only" keyword) - * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) - * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) - * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) - -Changes: - * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template - * changed trans tag to accept any variable for the plural count - * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) - * added the ** (power) operator - * changed the algorithm used for parsing expressions - * added the spaceless tag - * removed trim_blocks option - * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) - * changed all exceptions to extend Twig_Error - * fixed unary expressions ({{ not(1 or 0) }}) - * fixed child templates (with an extend tag) that uses one or more imports - * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) - * escaping has been rewritten - * the implementation of template inheritance has been rewritten - (blocks can now be called individually and still work with inheritance) - * fixed error handling for if tag when a syntax error occurs within a subparse process - * added a way to implement custom logic for resolving token parsers given a tag name - * fixed js escaper to be stricter (now uses a whilelist-based js escaper) - * added the following filers: "constant", "trans", "replace", "json_encode" - * added a "constant" test - * fixed objects with __toString() not being autoescaped - * fixed subscript expressions when calling __call() (methods now keep the case) - * added "test" feature (accessible via the "is" operator) - * removed the debug tag (should be done in an extension) - * fixed trans tag when no vars are used in plural form - * fixed race condition when writing template cache - * added the special _charset variable to reference the current charset - * added the special _context variable to reference the current context - * renamed self to _self (to avoid conflict) - * fixed Twig_Template::getAttribute() for protected properties - -* 0.9.8 (2010-06-28) - -Backward incompatibilities: - * the trans tag plural count is now attached to the plural tag: - old: `{% trans count %}...{% plural %}...{% endtrans %}` - new: `{% trans %}...{% plural count %}...{% endtrans %}` - - * added a way to translate strings coming from a variable ({% trans var %}) - * fixed trans tag when used with the Escaper extension - * fixed default cache umask - * removed Twig_Template instances from the debug tag output - * fixed objects with __isset() defined - * fixed set tag when used with a capture - * fixed type hinting for Twig_Environment::addFilter() method - -* 0.9.7 (2010-06-12) - -Backward incompatibilities: - * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) - * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) - * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) - - * added self as a special variable that refers to the current template (useful for importing macros from the current template) - * added Twig_Template instance support to the include tag - * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) - * added a grammar sub-framework to ease the creation of custom tags - * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) - * removed the Twig_Resource::resolveMissingFilter() method - * fixed the filter tag which did not apply filtering to included files - * added a bunch of unit tests - * added a bunch of phpdoc - * added a sandbox tag in the sandbox extension - * changed the date filter to support any date format supported by DateTime - * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) - * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor - * changed the cache option to only accepts an explicit path to a cache directory or false - * added a way to add token parsers, filters, and visitors without creating an extension - * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface - * changed the generated code to match the new coding standards - * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) - * added an exception when a child template has a non-empty body (as it is always ignored when rendering) - -* 0.9.6 (2010-05-12) - - * fixed variables defined outside a loop and for which the value changes in a for loop - * fixed the test suite for PHP 5.2 and older versions of PHPUnit - * added support for __call() in expression resolution - * fixed node visiting for macros (macros are now visited by visitors as any other node) - * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) - * added the cycle filter - * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII - * added a long-syntax for the set tag ({% set foo %}...{% endset %}) - * unit tests are now powered by PHPUnit - * added support for gettext via the `i18n` extension - * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values - * added a more useful exception if an if tag is not closed properly - * added support for escaping strategy in the autoescape tag - * fixed lexer when a template has a big chunk of text between/in a block - -* 0.9.5 (2010-01-20) - -As for any new release, don't forget to remove all cached templates after -upgrading. - -If you have defined custom filters, you MUST upgrade them for this release. To -upgrade, replace "array" with "new Twig_Filter_Function", and replace the -environment constant by the "needs_environment" option: - - // before - 'even' => array('twig_is_even_filter', false), - 'escape' => array('twig_escape_filter', true), - - // after - 'even' => new Twig_Filter_Function('twig_is_even_filter'), - 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), - -If you have created NodeTransformer classes, you will need to upgrade them to -the new interface (please note that the interface is not yet considered -stable). - - * fixed list nodes that did not extend the Twig_NodeListInterface - * added the "without loop" option to the for tag (it disables the generation of the loop variable) - * refactored node transformers to node visitors - * fixed automatic-escaping for blocks - * added a way to specify variables to pass to an included template - * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) - * improved the filter system to allow object methods to be used as filters - * changed the Array and String loaders to actually make use of the cache mechanism - * included the default filter function definitions in the extension class files directly (Core, Escaper) - * added the // operator (like the floor() PHP function) - * added the .. operator (as a syntactic sugar for the range filter when the step is 1) - * added the in operator (as a syntactic sugar for the in filter) - * added the following filters in the Core extension: in, range - * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) - * enhanced some error messages to provide better feedback in case of parsing errors - -* 0.9.4 (2009-12-02) - -If you have custom loaders, you MUST upgrade them for this release: The -Twig_Loader base class has been removed, and the Twig_LoaderInterface has also -been changed (see the source code for more information or the documentation). - - * added support for DateTime instances for the date filter - * fixed loop.last when the array only has one item - * made it possible to insert newlines in tag and variable blocks - * fixed a bug when a literal '\n' were present in a template text - * fixed bug when the filename of a template contains */ - * refactored loaders - -* 0.9.3 (2009-11-11) - -This release is NOT backward compatible with the previous releases. - - The loaders do not take the cache and autoReload arguments anymore. Instead, - the Twig_Environment class has two new options: cache and auto_reload. - Upgrading your code means changing this kind of code: - - $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); - $twig = new Twig_Environment($loader); - - to something like this: - - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( - 'cache' => '/path/to/compilation_cache', - 'auto_reload' => true, - )); - - * deprecated the "items" filter as it is not needed anymore - * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader - * optimized template loading speed - * removed output when an error occurs in a template and render() is used - * made major speed improvements for loops (up to 300% on even the smallest loops) - * added properties as part of the sandbox mode - * added public properties support (obj.item can now be the item property on the obj object) - * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) - * fixed bug when \ was used in HTML - -* 0.9.2 (2009-10-29) - - * made some speed optimizations - * changed the cache extension to .php - * added a js escaping strategy - * added support for short block tag - * changed the filter tag to allow chained filters - * made lexer more flexible as you can now change the default delimiters - * added set tag - * changed default directory permission when cache dir does not exist (more secure) - * added macro support - * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance - * made Twig_Autoloader::autoload() a static method - * avoid writing template file if an error occurs - * added $ escaping when outputting raw strings - * enhanced some error messages to ease debugging - * fixed empty cache files when the template contains an error - -* 0.9.1 (2009-10-14) - - * fixed a bug in PHP 5.2.6 - * fixed numbers with one than one decimal - * added support for method calls with arguments ({{ foo.bar('a', 43) }}) - * made small speed optimizations - * made minor tweaks to allow better extensibility and flexibility - -* 0.9.0 (2009-10-12) - - * Initial release diff --git a/vendor/twig/twig/LICENSE b/vendor/twig/twig/LICENSE deleted file mode 100644 index b6e17a1..0000000 --- a/vendor/twig/twig/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2009-2017 by the Twig Team. - -Some rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/twig/twig/README.rst b/vendor/twig/twig/README.rst deleted file mode 100644 index 81737b0..0000000 --- a/vendor/twig/twig/README.rst +++ /dev/null @@ -1,15 +0,0 @@ -Twig, the flexible, fast, and secure template language for PHP -============================================================== - -Twig is a template language for PHP, released under the new BSD license (code -and documentation). - -Twig uses a syntax similar to the Django and Jinja template languages which -inspired the Twig runtime environment. - -More Information ----------------- - -Read the `documentation`_ for more information. - -.. _documentation: http://twig.sensiolabs.org/documentation diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json deleted file mode 100644 index d7c9756..0000000 --- a/vendor/twig/twig/composer.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "twig/twig", - "type": "library", - "description": "Twig, the flexible, fast, and secure template language for PHP", - "keywords": ["templating"], - "homepage": "http://twig.sensiolabs.org", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - } - ], - "support": { - "forum": "https://groups.google.com/forum/#!forum/twig-users" - }, - "require": { - "php": "^7.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "~3.3@dev", - "symfony/debug": "~2.7", - "psr/container": "^1.0" - }, - "autoload": { - "psr-0" : { - "Twig_" : "lib/" - }, - "psr-4" : { - "Twig\\" : "src/" - } - }, - "autoload-dev": { - "psr-0" : { - "Twig_Tests_" : "test/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - } -} diff --git a/vendor/twig/twig/doc/advanced.rst b/vendor/twig/twig/doc/advanced.rst deleted file mode 100644 index 8b1dbc1..0000000 --- a/vendor/twig/twig/doc/advanced.rst +++ /dev/null @@ -1,917 +0,0 @@ -Extending Twig -============== - -Twig can be extended in many ways; you can add extra tags, filters, tests, -operators, global variables, and functions. You can even extend the parser -itself with node visitors. - -.. note:: - - The first section of this chapter describes how to extend Twig easily. If - you want to reuse your changes in different projects or if you want to - share them with others, you should then create an extension as described - in the following section. - -.. caution:: - - When extending Twig without creating an extension, Twig won't be able to - recompile your templates when the PHP code is updated. To see your changes - in real-time, either disable template caching or package your code into an - extension (see the next section of this chapter). - -Before extending Twig, you must understand the differences between all the -different possible extension points and when to use them. - -First, remember that Twig has two main language constructs: - -* ``{{ }}``: used to print the result of an expression evaluation; - -* ``{% %}``: used to execute statements. - -To understand why Twig exposes so many extension points, let's see how to -implement a *Lorem ipsum* generator (it needs to know the number of words to -generate). - -You can use a ``lipsum`` *tag*: - -.. code-block:: jinja - - {% lipsum 40 %} - -That works, but using a tag for ``lipsum`` is not a good idea for at least -three main reasons: - -* ``lipsum`` is not a language construct; -* The tag outputs something; -* The tag is not flexible as you cannot use it in an expression: - - .. code-block:: jinja - - {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} - -In fact, you rarely need to create tags; and that's good news because tags are -the most complex extension point of Twig. - -Now, let's use a ``lipsum`` *filter*: - -.. code-block:: jinja - - {{ 40|lipsum }} - -Again, it works, but it looks weird. A filter transforms the passed value to -something else but here we use the value to indicate the number of words to -generate (so, ``40`` is an argument of the filter, not the value we want to -transform). - -Next, let's use a ``lipsum`` *function*: - -.. code-block:: jinja - - {{ lipsum(40) }} - -Here we go. For this specific example, the creation of a function is the -extension point to use. And you can use it anywhere an expression is accepted: - -.. code-block:: jinja - - {{ 'some text' ~ lipsum(40) ~ 'some more text' }} - - {% set lipsum = lipsum(40) %} - -Last but not the least, you can also use a *global* object with a method able -to generate lorem ipsum text: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -As a rule of thumb, use functions for frequently used features and global -objects for everything else. - -Keep in mind the following when you want to extend Twig: - -========== ========================== ========== ========================= -What? Implementation difficulty? How often? When? -========== ========================== ========== ========================= -*macro* trivial frequent Content generation -*global* trivial frequent Helper object -*function* trivial frequent Content generation -*filter* trivial frequent Value transformation -*tag* complex rare DSL language construct -*test* trivial rare Boolean decision -*operator* trivial rare Values transformation -========== ========================== ========== ========================= - -Globals -------- - -A global variable is like any other template variable, except that it's -available in all templates and macros:: - - $twig = new Twig_Environment($loader); - $twig->addGlobal('text', new Text()); - -You can then use the ``text`` variable anywhere in a template: - -.. code-block:: jinja - - {{ text.lipsum(40) }} - -Filters -------- - -Creating a filter is as simple as associating a name with a PHP callable:: - - // an anonymous function - $filter = new Twig_Filter('rot13', function ($string) { - return str_rot13($string); - }); - - // or a simple PHP function - $filter = new Twig_Filter('rot13', 'str_rot13'); - - // or a class static method - $filter = new Twig_Filter('rot13', array('SomeClass', 'rot13Filter')); - $filter = new Twig_Filter('rot13', 'SomeClass::rot13Filter'); - - // or a class method - $filter = new Twig_Filter('rot13', array($this, 'rot13Filter')); - // the one below needs a runtime implementation (see below for more information) - $filter = new Twig_Filter('rot13', array('SomeClass', 'rot13Filter')); - -The first argument passed to the ``Twig_Filter`` constructor is the name of the -filter you will use in templates and the second one is the PHP callable to -associate with it. - -Then, add the filter to your Twig environment:: - - $twig = new Twig_Environment($loader); - $twig->addFilter($filter); - -And here is how to use it in a template: - -.. code-block:: jinja - - {{ 'Twig'|rot13 }} - - {# will output Gjvt #} - -When called by Twig, the PHP callable receives the left side of the filter -(before the pipe ``|``) as the first argument and the extra arguments passed -to the filter (within parentheses ``()``) as extra arguments. - -For instance, the following code: - -.. code-block:: jinja - - {{ 'TWIG'|lower }} - {{ now|date('d/m/Y') }} - -is compiled to something like the following:: - - - - -The ``Twig_Filter`` class takes an array of options as its last argument:: - - $filter = new Twig_Filter('rot13', 'str_rot13', $options); - -Environment-aware Filters -~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you want to access the current environment instance in your filter, set the -``needs_environment`` option to ``true``; Twig will pass the current -environment as the first argument to the filter call:: - - $filter = new Twig_Filter('rot13', function (Twig_Environment $env, $string) { - // get the current charset for instance - $charset = $env->getCharset(); - - return str_rot13($string); - }, array('needs_environment' => true)); - -Context-aware Filters -~~~~~~~~~~~~~~~~~~~~~ - -If you want to access the current context in your filter, set the -``needs_context`` option to ``true``; Twig will pass the current context as -the first argument to the filter call (or the second one if -``needs_environment`` is also set to ``true``):: - - $filter = new Twig_Filter('rot13', function ($context, $string) { - // ... - }, array('needs_context' => true)); - - $filter = new Twig_Filter('rot13', function (Twig_Environment $env, $context, $string) { - // ... - }, array('needs_context' => true, 'needs_environment' => true)); - -Automatic Escaping -~~~~~~~~~~~~~~~~~~ - -If automatic escaping is enabled, the output of the filter may be escaped -before printing. If your filter acts as an escaper (or explicitly outputs HTML -or JavaScript code), you will want the raw output to be printed. In such a -case, set the ``is_safe`` option:: - - $filter = new Twig_Filter('nl2br', 'nl2br', array('is_safe' => array('html'))); - -Some filters may need to work on input that is already escaped or safe, for -example when adding (safe) HTML tags to originally unsafe output. In such a -case, set the ``pre_escape`` option to escape the input data before it is run -through your filter:: - - $filter = new Twig_Filter('somefilter', 'somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); - -Variadic Filters -~~~~~~~~~~~~~~~~ - -When a filter should accept an arbitrary number of arguments, set the -``is_variadic`` option to ``true``; Twig will pass the extra arguments as the -last argument to the filter call as an array:: - - $filter = new Twig_Filter('thumbnail', function ($file, array $options = array()) { - // ... - }, array('is_variadic' => true)); - -Be warned that named arguments passed to a variadic filter cannot be checked -for validity as they will automatically end up in the option array. - -Dynamic Filters -~~~~~~~~~~~~~~~ - -A filter name containing the special ``*`` character is a dynamic filter as -the ``*`` can be any string:: - - $filter = new Twig_Filter('*_path', function ($name, $arguments) { - // ... - }); - -The following filters will be matched by the above defined dynamic filter: - -* ``product_path`` -* ``category_path`` - -A dynamic filter can define more than one dynamic parts:: - - $filter = new Twig_Filter('*_path_*', function ($name, $suffix, $arguments) { - // ... - }); - -The filter will receive all dynamic part values before the normal filter -arguments, but after the environment and the context. For instance, a call to -``'foo'|a_path_b()`` will result in the following arguments to be passed to -the filter: ``('a', 'b', 'foo')``. - -Deprecated Filters -~~~~~~~~~~~~~~~~~~ - -You can mark a filter as being deprecated by setting the ``deprecated`` option -to ``true``. You can also give an alternative filter that replaces the -deprecated one when that makes sense:: - - $filter = new Twig_Filter('obsolete', function () { - // ... - }, array('deprecated' => true, 'alternative' => 'new_one')); - -When a filter is deprecated, Twig emits a deprecation notice when compiling a -template using it. See :ref:`deprecation-notices` for more information. - -Functions ---------- - -Functions are defined in the exact same way as filters, but you need to create -an instance of ``Twig_Function``:: - - $twig = new Twig_Environment($loader); - $function = new Twig_Function('function_name', function () { - // ... - }); - $twig->addFunction($function); - -Functions support the same features as filters, except for the ``pre_escape`` -and ``preserves_safety`` options. - -Tests ------ - -Tests are defined in the exact same way as filters and functions, but you need -to create an instance of ``Twig_Test``:: - - $twig = new Twig_Environment($loader); - $test = new Twig_Test('test_name', function () { - // ... - }); - $twig->addTest($test); - -Tests allow you to create custom application specific logic for evaluating -boolean conditions. As a simple example, let's create a Twig test that checks if -objects are 'red':: - - $twig = new Twig_Environment($loader); - $test = new Twig_Test('red', function ($value) { - if (isset($value->color) && $value->color == 'red') { - return true; - } - if (isset($value->paint) && $value->paint == 'red') { - return true; - } - return false; - }); - $twig->addTest($test); - -Test functions should always return true/false. - -When creating tests you can use the ``node_class`` option to provide custom test -compilation. This is useful if your test can be compiled into PHP primitives. -This is used by many of the tests built into Twig:: - - $twig = new Twig_Environment($loader); - $test = new Twig_Test( - 'odd', - null, - array('node_class' => 'Twig_Node_Expression_Test_Odd')); - $twig->addTest($test); - - class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test - { - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; - } - } - -The above example shows how you can create tests that use a node class. The -node class has access to one sub-node called 'node'. This sub-node contains the -value that is being tested. When the ``odd`` filter is used in code such as: - -.. code-block:: jinja - - {% if my_value is odd %} - -The ``node`` sub-node will contain an expression of ``my_value``. Node-based -tests also have access to the ``arguments`` node. This node will contain the -various other arguments that have been provided to your test. - -If you want to pass a variable number of positional or named arguments to the -test, set the ``is_variadic`` option to ``true``. Tests also support dynamic -name feature as filters and functions. - -Tags ----- - -One of the most exciting features of a template engine like Twig is the -possibility to define new language constructs. This is also the most complex -feature as you need to understand how Twig's internals work. - -Let's create a simple ``set`` tag that allows the definition of simple -variables from within a template. The tag can be used like follows: - -.. code-block:: jinja - - {% set name = "value" %} - - {{ name }} - - {# should output value #} - -.. note:: - - The ``set`` tag is part of the Core extension and as such is always - available. The built-in version is slightly more powerful and supports - multiple assignments by default (cf. the template designers chapter for - more information). - -Three steps are needed to define a new tag: - -* Defining a Token Parser class (responsible for parsing the template code); - -* Defining a Node class (responsible for converting the parsed code to PHP); - -* Registering the tag. - -Registering a new tag -~~~~~~~~~~~~~~~~~~~~~ - -Adding a tag is as simple as calling the ``addTokenParser`` method on the -``Twig_Environment`` instance:: - - $twig = new Twig_Environment($loader); - $twig->addTokenParser(new Project_Set_TokenParser()); - -Defining a Token Parser -~~~~~~~~~~~~~~~~~~~~~~~ - -Now, let's see the actual code of this class:: - - class Project_Set_TokenParser extends Twig_TokenParser - { - public function parse(Twig_Token $token) - { - $parser = $this->parser; - $stream = $parser->getStream(); - - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - $stream->expect(Twig_Token::OPERATOR_TYPE, '='); - $value = $parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'set'; - } - } - -The ``getTag()`` method must return the tag we want to parse, here ``set``. - -The ``parse()`` method is invoked whenever the parser encounters a ``set`` -tag. It should return a ``Twig_Node`` instance that represents the node (the -``Project_Set_Node`` calls creating is explained in the next section). - -The parsing process is simplified thanks to a bunch of methods you can call -from the token stream (``$this->parser->getStream()``): - -* ``getCurrent()``: Gets the current token in the stream. - -* ``next()``: Moves to the next token in the stream, *but returns the old one*. - -* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether - the current token is of a particular type or value (or both). The value may be an - array of several possible values. - -* ``expect($type[, $value[, $message]])``: If the current token isn't of the given - type/value a syntax error is thrown. Otherwise, if the type and value are correct, - the token is returned and the stream moves to the next token. - -* ``look()``: Looks at the next token without consuming it. - -Parsing expressions is done by calling the ``parseExpression()`` like we did for -the ``set`` tag. - -.. tip:: - - Reading the existing ``TokenParser`` classes is the best way to learn all - the nitty-gritty details of the parsing process. - -Defining a Node -~~~~~~~~~~~~~~~ - -The ``Project_Set_Node`` class itself is rather simple:: - - class Project_Set_Node extends Twig_Node - { - public function __construct($name, Twig_Node_Expression $value, $line, $tag = null) - { - parent::__construct(array('value' => $value), array('name' => $name), $line, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('$context[\''.$this->getAttribute('name').'\'] = ') - ->subcompile($this->getNode('value')) - ->raw(";\n") - ; - } - } - -The compiler implements a fluid interface and provides methods that helps the -developer generate beautiful and readable PHP code: - -* ``subcompile()``: Compiles a node. - -* ``raw()``: Writes the given string as is. - -* ``write()``: Writes the given string by adding indentation at the beginning - of each line. - -* ``string()``: Writes a quoted string. - -* ``repr()``: Writes a PHP representation of a given value (see - ``Twig_Node_For`` for a usage example). - -* ``addDebugInfo()``: Adds the line of the original template file related to - the current node as a comment. - -* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a - usage example). - -* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a - usage example). - -.. _creating_extensions: - -Creating an Extension ---------------------- - -The main motivation for writing an extension is to move often used code into a -reusable class like adding support for internationalization. An extension can -define tags, filters, tests, operators, global variables, functions, and node -visitors. - -Most of the time, it is useful to create a single extension for your project, -to host all the specific tags and filters you want to add to Twig. - -.. tip:: - - When packaging your code into an extension, Twig is smart enough to - recompile your templates whenever you make a change to it (when - ``auto_reload`` is enabled). - -.. note:: - - Before writing your own extensions, have a look at the Twig official - extension repository: http://github.com/twigphp/Twig-extensions. - -An extension is a class that implements the following interface:: - - interface Twig_ExtensionInterface - { - /** - * Returns the token parser instances to add to the existing list. - * - * @return Twig_TokenParserInterface[] - */ - public function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] - */ - public function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return Twig_Filter[] - */ - public function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return Twig_Test[] - */ - public function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return Twig_Function[] - */ - public function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array First array of unary operators, second array of binary operators - */ - public function getOperators(); - } - -To keep your extension class clean and lean, inherit from the built-in -``Twig_Extension`` class instead of implementing the interface as it provides -empty implementations for all methods: - - class Project_Twig_Extension extends Twig_Extension - { - } - -Of course, this extension does nothing for now. We will customize it in the -next sections. - -Twig does not care where you save your extension on the filesystem, as all -extensions must be registered explicitly to be available in your templates. - -You can register an extension by using the ``addExtension()`` method on your -main ``Environment`` object:: - - $twig = new Twig_Environment($loader); - $twig->addExtension(new Project_Twig_Extension()); - -.. tip:: - - The Twig core extensions are great examples of how extensions work. - -Globals -~~~~~~~ - -Global variables can be registered in an extension via the ``getGlobals()`` -method:: - - class Project_Twig_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface - { - public function getGlobals() - { - return array( - 'text' => new Text(), - ); - } - - // ... - } - -Functions -~~~~~~~~~ - -Functions can be registered in an extension via the ``getFunctions()`` -method:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFunctions() - { - return array( - new Twig_Function('lipsum', 'generate_lipsum'), - ); - } - - // ... - } - -Filters -~~~~~~~ - -To add a filter to an extension, you need to override the ``getFilters()`` -method. This method must return an array of filters to add to the Twig -environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getFilters() - { - return array( - new Twig_Filter('rot13', 'str_rot13'), - ); - } - - // ... - } - -Tags -~~~~ - -Adding a tag in an extension can be done by overriding the -``getTokenParsers()`` method. This method must return an array of tags to add -to the Twig environment:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTokenParsers() - { - return array(new Project_Set_TokenParser()); - } - - // ... - } - -In the above code, we have added a single new tag, defined by the -``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is -responsible for parsing the tag and compiling it to PHP. - -Operators -~~~~~~~~~ - -The ``getOperators()`` methods lets you add new operators. Here is how to add -``!``, ``||``, and ``&&`` operators:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getOperators() - { - return array( - array( - '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - ), - array( - '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - ), - ); - } - - // ... - } - -Tests -~~~~~ - -The ``getTests()`` method lets you add new test functions:: - - class Project_Twig_Extension extends Twig_Extension - { - public function getTests() - { - return array( - new Twig_Test('even', 'twig_test_even'), - ); - } - - // ... - } - -Definition vs Runtime -~~~~~~~~~~~~~~~~~~~~~ - -Twig filters, functions, and tests runtime implementations can be defined as -any valid PHP callable: - -* **functions/static methods**: Simple to implement and fast (used by all Twig - core extensions); but it is hard for the runtime to depend on external - objects; - -* **closures**: Simple to implement; - -* **object methods**: More flexible and required if your runtime code depends - on external objects. - -The simplest way to use methods is to define them on the extension itself:: - - class Project_Twig_Extension extends Twig_Extension - { - private $rot13Provider; - - public function __construct($rot13Provider) - { - $this->rot13Provider = $rot13Provider; - } - - public function getFunctions() - { - return array( - new Twig_Function('rot13', array($this, 'rot13')), - ); - } - - public function rot13($value) - { - return $rot13Provider->rot13($value); - } - } - -This is very convenient but not recommended as it makes template compilation -depend on runtime dependencies even if they are not needed (think for instance -as a dependency that connects to a database engine). - -You can easily decouple the extension definitions from their runtime -implementations by registering a ``Twig_RuntimeLoaderInterface`` instance on -the environment that knows how to instantiate such runtime classes (runtime -classes must be autoload-able):: - - class RuntimeLoader implements Twig_RuntimeLoaderInterface - { - public function load($class) - { - // implement the logic to create an instance of $class - // and inject its dependencies - // most of the time, it means using your dependency injection container - if ('Project_Twig_RuntimeExtension' === $class) { - return new $class(new Rot13Provider()); - } else { - // ... - } - } - } - - $twig->addRuntimeLoader(new RuntimeLoader()); - -.. note:: - - Twig comes with a PSR-11 compatible runtime loader - (``Twig_ContainerRuntimeLoader``). - -It is now possible to move the runtime logic to a new -``Project_Twig_RuntimeExtension`` class and use it directly in the extension:: - - class Project_Twig_RuntimeExtension - { - private $rot13Provider; - - public function __construct($rot13Provider) - { - $this->rot13Provider = $rot13Provider; - } - - public function rot13($value) - { - return $rot13Provider->rot13($value); - } - } - - class Project_Twig_Extension extends Twig_Extension - { - public function getFunctions() - { - return array( - new Twig_Function('rot13', array('Project_Twig_RuntimeExtension', 'rot13')), - // or - new Twig_Function('rot13', 'Project_Twig_RuntimeExtension::rot13'), - ); - } - } - -Overloading ------------ - -To overload an already defined filter, test, operator, global variable, or -function, re-define it in an extension and register it **as late as -possible** (order matters):: - - class MyCoreExtension extends Twig_Extension - { - public function getFilters() - { - return array( - new Twig_Filter('date', array($this, 'dateFilter')), - ); - } - - public function dateFilter($timestamp, $format = 'F j, Y H:i') - { - // do something different from the built-in date filter - } - } - - $twig = new Twig_Environment($loader); - $twig->addExtension(new MyCoreExtension()); - -Here, we have overloaded the built-in ``date`` filter with a custom one. - -If you do the same on the ``Twig_Environment`` itself, beware that it takes -precedence over any other registered extensions:: - - $twig = new Twig_Environment($loader); - $twig->addFilter(new Twig_Filter('date', function ($timestamp, $format = 'F j, Y H:i') { - // do something different from the built-in date filter - })); - // the date filter will come from the above registration, not - // from the registered extension below - $twig->addExtension(new MyCoreExtension()); - -.. caution:: - - Note that overloading the built-in Twig elements is not recommended as it - might be confusing. - -Testing an Extension --------------------- - -Functional Tests -~~~~~~~~~~~~~~~~ - -You can create functional tests for extensions simply by creating the -following file structure in your test directory:: - - Fixtures/ - filters/ - foo.test - bar.test - functions/ - foo.test - bar.test - tags/ - foo.test - bar.test - IntegrationTest.php - -The ``IntegrationTest.php`` file should look like this:: - - class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase - { - public function getExtensions() - { - return array( - new Project_Twig_Extension1(), - new Project_Twig_Extension2(), - ); - } - - public function getFixturesDir() - { - return dirname(__FILE__).'/Fixtures/'; - } - } - -Fixtures examples can be found within the Twig repository -`tests/Twig/Fixtures`_ directory. - -Node Tests -~~~~~~~~~~ - -Testing the node visitors can be complex, so extend your test cases from -``Twig_Test_NodeTestCase``. Examples can be found in the Twig repository -`tests/Twig/Node`_ directory. - -.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php -.. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Fixtures -.. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/master/test/Twig/Tests/Node diff --git a/vendor/twig/twig/doc/api.rst b/vendor/twig/twig/doc/api.rst deleted file mode 100644 index bca0ed4..0000000 --- a/vendor/twig/twig/doc/api.rst +++ /dev/null @@ -1,569 +0,0 @@ -Twig for Developers -=================== - -This chapter describes the API to Twig and not the template language. It will -be most useful as reference to those implementing the template interface to -the application and not those who are creating Twig templates. - -Basics ------- - -Twig uses a central object called the **environment** (of class -``Twig_Environment``). Instances of this class are used to store the -configuration and extensions, and are used to load templates from the file -system or other locations. - -Most applications will create one ``Twig_Environment`` object on application -initialization and use that to load templates. In some cases it's however -useful to have multiple environments side by side, if different configurations -are in use. - -The simplest way to configure Twig to load templates for your application -looks roughly like this:: - - require_once '/path/to/vendor/autoload.php'; - - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( - 'cache' => '/path/to/compilation_cache', - )); - -This will create a template environment with the default settings and a loader -that looks up the templates in the ``/path/to/templates/`` folder. Different -loaders are available and you can also write your own if you want to load -templates from a database or other resources. - -.. note:: - - Notice that the second argument of the environment is an array of options. - The ``cache`` option is a compilation cache directory, where Twig caches - the compiled templates to avoid the parsing phase for sub-sequent - requests. It is very different from the cache you might want to add for - the evaluated templates. For such a need, you can use any available PHP - cache library. - -Rendering Templates -------------------- - -To load a template from a Twig environment, call the ``load()`` method which -returns a ``Twig_TemplateWrapper`` instance:: - - $template = $twig->load('index.html'); - -To render the template with some variables, call the ``render()`` method:: - - echo $template->render(array('the' => 'variables', 'go' => 'here')); - -.. note:: - - The ``display()`` method is a shortcut to output the template directly. - -You can also load and render the template in one fell swoop:: - - echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); - -If a template defines blocks, they can be rendered individually via the -``renderBlock()`` call:: - - echo $template->renderBlock('block_name', array('the' => 'variables', 'go' => 'here')); - -.. _environment_options: - -Environment Options -------------------- - -When creating a new ``Twig_Environment`` instance, you can pass an array of -options as the constructor second argument:: - - $twig = new Twig_Environment($loader, array('debug' => true)); - -The following options are available: - -* ``debug`` *boolean* - - When set to ``true``, the generated templates have a - ``__toString()`` method that you can use to display the generated nodes - (default to ``false``). - -* ``charset`` *string* (defaults to ``utf-8``) - - The charset used by the templates. - -* ``base_template_class`` *string* (defaults to ``Twig_Template``) - - The base template class to use for generated - templates. - -* ``cache`` *string* or ``false`` - - An absolute path where to store the compiled templates, or - ``false`` to disable caching (which is the default). - -* ``auto_reload`` *boolean* - - When developing with Twig, it's useful to recompile the - template whenever the source code changes. If you don't provide a value for - the ``auto_reload`` option, it will be determined automatically based on the - ``debug`` value. - -* ``strict_variables`` *boolean* - - If set to ``false``, Twig will silently ignore invalid - variables (variables and or attributes/methods that do not exist) and - replace them with a ``null`` value. When set to ``true``, Twig throws an - exception instead (default to ``false``). - -* ``autoescape`` *string* - - Sets the default auto-escaping strategy (``name``, ``html``, ``js``, ``css``, - ``url``, ``html_attr``, or a PHP callback that takes the template "filename" - and returns the escaping strategy to use -- the callback cannot be a function - name to avoid collision with built-in escaping strategies); set it to - ``false`` to disable auto-escaping. The ``name`` escaping strategy determines - the escaping strategy to use for a template based on the template filename - extension (this strategy does not incur any overhead at runtime as - auto-escaping is done at compilation time.) - -* ``optimizations`` *integer* - - A flag that indicates which optimizations to apply - (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to - disable). - -Loaders -------- - -Loaders are responsible for loading templates from a resource such as the file -system. - -Compilation Cache -~~~~~~~~~~~~~~~~~ - -All template loaders can cache the compiled templates on the filesystem for -future reuse. It speeds up Twig a lot as templates are only compiled once; and -the performance boost is even larger if you use a PHP accelerator such as APC. -See the ``cache`` and ``auto_reload`` options of ``Twig_Environment`` above -for more information. - -Built-in Loaders -~~~~~~~~~~~~~~~~ - -Here is a list of the built-in loaders Twig provides: - -``Twig_Loader_Filesystem`` -.......................... - -``Twig_Loader_Filesystem`` loads templates from the file system. This loader -can find templates in folders on the file system and is the preferred way to -load them:: - - $loader = new Twig_Loader_Filesystem($templateDir); - -It can also look for templates in an array of directories:: - - $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); - -With such a configuration, Twig will first look for templates in -``$templateDir1`` and if they do not exist, it will fallback to look for them -in the ``$templateDir2``. - -You can add or prepend paths via the ``addPath()`` and ``prependPath()`` -methods:: - - $loader->addPath($templateDir3); - $loader->prependPath($templateDir4); - -The filesystem loader also supports namespaced templates. This allows to group -your templates under different namespaces which have their own template paths. - -When using the ``setPaths()``, ``addPath()``, and ``prependPath()`` methods, -specify the namespace as the second argument (when not specified, these -methods act on the "main" namespace):: - - $loader->addPath($templateDir, 'admin'); - -Namespaced templates can be accessed via the special -``@namespace_name/template_path`` notation:: - - $twig->render('@admin/index.html', array()); - -``Twig_Loader_Filesystem`` support absolute and relative paths. Using relative -paths is preferred as it makes the cache keys independent of the project root -directory (for instance, it allows warming the cache from a build server where -the directory might be different from the one used on production servers):: - - $loader = new Twig_Loader_Filesystem('templates', getcwd().'/..'); - -.. note:: - - When not passing the root path as a second argument, Twig uses ``getcwd()`` - for relative paths. - -``Twig_Loader_Array`` -..................... - -``Twig_Loader_Array`` loads a template from a PHP array. It's passed an array -of strings bound to template names:: - - $loader = new Twig_Loader_Array(array( - 'index.html' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); - - echo $twig->render('index.html', array('name' => 'Fabien')); - -This loader is very useful for unit testing. It can also be used for small -projects where storing all templates in a single PHP file might make sense. - -.. tip:: - - When using the ``Array`` loader with a cache mechanism, you - should know that a new cache key is generated each time a template content - "changes" (the cache key being the source code of the template). If you - don't want to see your cache grows out of control, you need to take care - of clearing the old cache file by yourself. - -``Twig_Loader_Chain`` -..................... - -``Twig_Loader_Chain`` delegates the loading of templates to other loaders:: - - $loader1 = new Twig_Loader_Array(array( - 'base.html' => '{% block content %}{% endblock %}', - )); - $loader2 = new Twig_Loader_Array(array( - 'index.html' => '{% extends "base.html" %}{% block content %}Hello {{ name }}{% endblock %}', - 'base.html' => 'Will never be loaded', - )); - - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); - - $twig = new Twig_Environment($loader); - -When looking for a template, Twig will try each loader in turn and it will -return as soon as the template is found. When rendering the ``index.html`` -template from the above example, Twig will load it with ``$loader2`` but the -``base.html`` template will be loaded from ``$loader1``. - -``Twig_Loader_Chain`` accepts any loader that implements -``Twig_LoaderInterface``. - -.. note:: - - You can also add loaders via the ``addLoader()`` method. - -Create your own Loader -~~~~~~~~~~~~~~~~~~~~~~ - -All loaders implement the ``Twig_LoaderInterface``:: - - interface Twig_LoaderInterface - { - /** - * Returns the source context for a given template logical name. - * - * @param string $name The template logical name - * - * @return Twig_Source - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getSourceContext($name); - - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template - * - * @return bool true if the template is fresh, false otherwise - * - * @throws Twig_Error_Loader When $name is not found - */ - public function isFresh($name, $time); - - /** - * Check if we have the source code of a template, given its name. - * - * @param string $name The name of the template to check if we can load - * - * @return bool If the template source code is handled by this loader or not - */ - public function exists($name); - } - -The ``isFresh()`` method must return ``true`` if the current cached template -is still fresh, given the last modification time, or ``false`` otherwise. - -The ``getSourceContext()`` method must return an instance of ``Twig_Source``. - -Using Extensions ----------------- - -Twig extensions are packages that add new features to Twig. Using an -extension is as simple as using the ``addExtension()`` method:: - - $twig->addExtension(new Twig_Extension_Sandbox()); - -Twig comes bundled with the following extensions: - -* *Twig_Extension_Core*: Defines all the core features of Twig. - -* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility - to escape/unescape blocks of code. - -* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig - environment, making it safe to evaluate untrusted code. - -* *Twig_Extension_Profiler*: Enabled the built-in Twig profiler. - -* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation. - -The core, escaper, and optimizer extensions do not need to be added to the -Twig environment, as they are registered by default. - -Built-in Extensions -------------------- - -This section describes the features added by the built-in extensions. - -.. tip:: - - Read the chapter about extending Twig to learn how to create your own - extensions. - -Core Extension -~~~~~~~~~~~~~~ - -The ``core`` extension defines all the core features of Twig: - -* :doc:`Tags `; -* :doc:`Filters `; -* :doc:`Functions `; -* :doc:`Tests `. - -Escaper Extension -~~~~~~~~~~~~~~~~~ - -The ``escaper`` extension adds automatic output escaping to Twig. It defines a -tag, ``autoescape``, and a filter, ``raw``. - -When creating the escaper extension, you can switch on or off the global -output escaping strategy:: - - $escaper = new Twig_Extension_Escaper('html'); - $twig->addExtension($escaper); - -If set to ``html``, all variables in templates are escaped (using the ``html`` -escaping strategy), except those using the ``raw`` filter: - -.. code-block:: jinja - - {{ article.to_html|raw }} - -You can also change the escaping mode locally by using the ``autoescape`` tag: - -.. code-block:: jinja - - {% autoescape 'html' %} - {{ var }} - {{ var|raw }} {# var won't be escaped #} - {{ var|escape }} {# var won't be double-escaped #} - {% endautoescape %} - -.. warning:: - - The ``autoescape`` tag has no effect on included files. - -The escaping rules are implemented as follows: - -* Literals (integers, booleans, arrays, ...) used in the template directly as - variables or filter arguments are never automatically escaped: - - .. code-block:: jinja - - {{ "Twig
    " }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ text }} {# will be escaped #} - -* Expressions which the result is always a literal or a variable marked safe - are never automatically escaped: - - .. code-block:: jinja - - {{ foo ? "Twig
    " : "
    Twig" }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text : "
    Twig" }} {# will be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text|raw : "
    Twig" }} {# won't be escaped #} - - {% set text = "Twig
    " %} - {{ foo ? text|escape : "
    Twig" }} {# the result of the expression won't be escaped #} - -* Escaping is applied before printing, after any other filter is applied: - - .. code-block:: jinja - - {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} - -* The `raw` filter should only be used at the end of the filter chain: - - .. code-block:: jinja - - {{ var|raw|upper }} {# will be escaped #} - - {{ var|upper|raw }} {# won't be escaped #} - -* Automatic escaping is not applied if the last filter in the chain is marked - safe for the current context (e.g. ``html`` or ``js``). ``escape`` and - ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked - safe for JavaScript, ``raw`` is marked safe for everything. - - .. code-block:: jinja - - {% autoescape 'js' %} - {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #} - {{ var }} {# will be escaped for JavaScript #} - {{ var|escape('js') }} {# won't be double-escaped #} - {% endautoescape %} - -.. note:: - - Note that autoescaping has some limitations as escaping is applied on - expressions after evaluation. For instance, when working with - concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as - escaping is applied on the result of the concatenation, not on the - individual variables (so, the ``raw`` filter won't have any effect here). - -Sandbox Extension -~~~~~~~~~~~~~~~~~ - -The ``sandbox`` extension can be used to evaluate untrusted code. Access to -unsafe attributes and methods is prohibited. The sandbox security is managed -by a policy instance. By default, Twig comes with one policy class: -``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some -tags, filters, properties, and methods:: - - $tags = array('if'); - $filters = array('upper'); - $methods = array( - 'Article' => array('getTitle', 'getBody'), - ); - $properties = array( - 'Article' => array('title', 'body'), - ); - $functions = array('range'); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); - -With the previous configuration, the security policy will only allow usage of -the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be -able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` -objects, and the ``title`` and ``body`` public properties. Everything else -won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. - -The policy object is the first argument of the sandbox constructor:: - - $sandbox = new Twig_Extension_Sandbox($policy); - $twig->addExtension($sandbox); - -By default, the sandbox mode is disabled and should be enabled when including -untrusted template code by using the ``sandbox`` tag: - -.. code-block:: jinja - - {% sandbox %} - {% include 'user.html' %} - {% endsandbox %} - -You can sandbox all templates by passing ``true`` as the second argument of -the extension constructor:: - - $sandbox = new Twig_Extension_Sandbox($policy, true); - -Profiler Extension -~~~~~~~~~~~~~~~~~~ - -The ``profiler`` extension enables a profiler for Twig templates; it should -only be used on your development machines as it adds some overhead:: - - $profile = new Twig_Profiler_Profile(); - $twig->addExtension(new Twig_Extension_Profiler($profile)); - - $dumper = new Twig_Profiler_Dumper_Text(); - echo $dumper->dump($profile); - -A profile contains information about time and memory consumption for template, -block, and macro executions. - -You can also dump the data in a `Blackfire.io `_ -compatible format:: - - $dumper = new Twig_Profiler_Dumper_Blackfire(); - file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); - -Upload the profile to visualize it (create a `free account -`_ first): - -.. code-block:: sh - - blackfire --slot=7 upload /path/to/profile.prof - -Optimizer Extension -~~~~~~~~~~~~~~~~~~~ - -The ``optimizer`` extension optimizes the node tree before compilation:: - - $twig->addExtension(new Twig_Extension_Optimizer()); - -By default, all optimizations are turned on. You can select the ones you want -to enable by passing them to the constructor:: - - $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); - - $twig->addExtension($optimizer); - -Twig supports the following optimizations: - -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations - (this is the default value). -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations. - This reduces the compilation time, but it can increase the execution time - and the consumed memory. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by - removing the ``loop`` variable creation whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw`` - filter whenever possible. -* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation - and access of variables in the compiled templates whenever possible. - -Exceptions ----------- - -Twig can throw exceptions: - -* ``Twig_Error``: The base exception for all errors. - -* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with - the template syntax. - -* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter - does not exist for instance). - -* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. - -* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or - method is called in a sandboxed template. diff --git a/vendor/twig/twig/doc/coding_standards.rst b/vendor/twig/twig/doc/coding_standards.rst deleted file mode 100644 index bf8ea91..0000000 --- a/vendor/twig/twig/doc/coding_standards.rst +++ /dev/null @@ -1,101 +0,0 @@ -Coding Standards -================ - -When writing Twig templates, we recommend you to follow these official coding -standards: - -* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, - and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): - - .. code-block:: jinja - - {{ foo }} - {# comment #} - {% if foo %}{% endif %} - - When using the whitespace control character, do not put any spaces between - it and the delimiter: - - .. code-block:: jinja - - {{- foo -}} - {#- comment -#} - {%- if foo -%}{%- endif -%} - -* Put one (and only one) space before and after the following operators: - comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math - operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic - operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary - operator (``?:``): - - .. code-block:: jinja - - {{ 1 + 2 }} - {{ foo ~ bar }} - {{ true ? true : false }} - -* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in - arrays and hashes: - - .. code-block:: jinja - - {{ [1, 2, 3] }} - {{ {'foo': 'bar'} }} - -* Do not put any spaces after an opening parenthesis and before a closing - parenthesis in expressions: - - .. code-block:: jinja - - {{ 1 + (2 * 3) }} - -* Do not put any spaces before and after string delimiters: - - .. code-block:: jinja - - {{ 'foo' }} - {{ "foo" }} - -* Do not put any spaces before and after the following operators: ``|``, - ``.``, ``..``, ``[]``: - - .. code-block:: jinja - - {{ foo|upper|lower }} - {{ user.name }} - {{ user[name] }} - {% for i in 1..12 %}{% endfor %} - -* Do not put any spaces before and after the parenthesis used for filter and - function calls: - - .. code-block:: jinja - - {{ foo|default('foo') }} - {{ range(1..10) }} - -* Do not put any spaces before and after the opening and the closing of arrays - and hashes: - - .. code-block:: jinja - - {{ [1, 2, 3] }} - {{ {'foo': 'bar'} }} - -* Use lower cased and underscored variable names: - - .. code-block:: jinja - - {% set foo = 'foo' %} - {% set foo_bar = 'foo' %} - -* Indent your code inside tags (use the same indentation as the one used for - the target language of the rendered template): - - .. code-block:: jinja - - {% block foo %} - {% if true %} - true - {% endif %} - {% endblock %} diff --git a/vendor/twig/twig/doc/deprecated.rst b/vendor/twig/twig/doc/deprecated.rst deleted file mode 100644 index eef5269..0000000 --- a/vendor/twig/twig/doc/deprecated.rst +++ /dev/null @@ -1,18 +0,0 @@ -Deprecated Features -=================== - -This document lists deprecated features in Twig 2.x. Deprecated features are -kept for backward compatibility and removed in the next major release (a -feature that was deprecated in Twig 2.x is removed in Twig 3.0). - -Final Classes -------------- - -The following classes are marked as ``@final`` in Twig 2 and will be final in -3.0: - - * ``Twig_Node_Module`` - * ``Twig_Filter`` - * ``Twig_Function`` - * ``Twig_Test`` - * ``Twig_Profiler_Profile`` diff --git a/vendor/twig/twig/doc/filters/abs.rst b/vendor/twig/twig/doc/filters/abs.rst deleted file mode 100644 index 22fa59d..0000000 --- a/vendor/twig/twig/doc/filters/abs.rst +++ /dev/null @@ -1,18 +0,0 @@ -``abs`` -======= - -The ``abs`` filter returns the absolute value. - -.. code-block:: jinja - - {# number = -5 #} - - {{ number|abs }} - - {# outputs 5 #} - -.. note:: - - Internally, Twig uses the PHP `abs`_ function. - -.. _`abs`: http://php.net/abs diff --git a/vendor/twig/twig/doc/filters/batch.rst b/vendor/twig/twig/doc/filters/batch.rst deleted file mode 100644 index f26feba..0000000 --- a/vendor/twig/twig/doc/filters/batch.rst +++ /dev/null @@ -1,48 +0,0 @@ -``batch`` -========= - -The ``batch`` filter "batches" items by returning a list of lists with the -given number of items. A second parameter can be provided and used to fill in -missing items: - -.. code-block:: jinja - - {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} - - - {% for row in items|batch(3, 'No item') %} - - {% for column in row %} - - {% endfor %} - - {% endfor %} -
    {{ column }}
    - -The above example will be rendered as: - -.. code-block:: jinja - - - - - - - - - - - - - - - - - -
    abc
    def
    gNo itemNo item
    - -Arguments ---------- - -* ``size``: The size of the batch; fractional numbers will be rounded up -* ``fill``: Used to fill in missing items diff --git a/vendor/twig/twig/doc/filters/capitalize.rst b/vendor/twig/twig/doc/filters/capitalize.rst deleted file mode 100644 index 10546a1..0000000 --- a/vendor/twig/twig/doc/filters/capitalize.rst +++ /dev/null @@ -1,11 +0,0 @@ -``capitalize`` -============== - -The ``capitalize`` filter capitalizes a value. The first character will be -uppercase, all others lowercase: - -.. code-block:: jinja - - {{ 'my first car'|capitalize }} - - {# outputs 'My first car' #} diff --git a/vendor/twig/twig/doc/filters/convert_encoding.rst b/vendor/twig/twig/doc/filters/convert_encoding.rst deleted file mode 100644 index 82ea3a7..0000000 --- a/vendor/twig/twig/doc/filters/convert_encoding.rst +++ /dev/null @@ -1,25 +0,0 @@ -``convert_encoding`` -==================== - -The ``convert_encoding`` filter converts a string from one encoding to -another. The first argument is the expected output charset and the second one -is the input charset: - -.. code-block:: jinja - - {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} - -.. note:: - - This filter relies on the `iconv`_ or `mbstring`_ extension, so one of - them must be installed. In case both are installed, `mbstring`_ is used by - default. - -Arguments ---------- - -* ``to``: The output charset -* ``from``: The input charset - -.. _`iconv`: http://php.net/iconv -.. _`mbstring`: http://php.net/mbstring diff --git a/vendor/twig/twig/doc/filters/date.rst b/vendor/twig/twig/doc/filters/date.rst deleted file mode 100644 index d3b0415..0000000 --- a/vendor/twig/twig/doc/filters/date.rst +++ /dev/null @@ -1,82 +0,0 @@ -``date`` -======== - -The ``date`` filter formats a date to a given format: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y") }} - -The format specifier is the same as supported by `date`_, -except when the filtered data is of type `DateInterval`_, when the format must conform to -`DateInterval::format`_ instead. - -The ``date`` filter accepts strings (it must be in a format supported by the -`strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For -instance, to display the current date, filter the word "now": - -.. code-block:: jinja - - {{ "now"|date("m/d/Y") }} - -To escape words and characters in the date format use ``\\`` in front of each -character: - -.. code-block:: jinja - - {{ post.published_at|date("F jS \\a\\t g:ia") }} - -If the value passed to the ``date`` filter is ``null``, it will return the -current date by default. If an empty string is desired instead of the current -date, use a ternary operator: - -.. code-block:: jinja - - {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} - -If no format is provided, Twig will use the default one: ``F j, Y H:i``. This -default can be easily changed by calling the ``setDateFormat()`` method on the -``core`` extension instance. The first argument is the default format for -dates and the second one is the default format for date intervals: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setDateFormat('d/m/Y', '%d days'); - -Timezone --------- - -By default, the date is displayed by applying the default timezone (the one -specified in php.ini or declared in Twig -- see below), but you can override -it by explicitly specifying a timezone: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y", "Europe/Paris") }} - -If the date is already a DateTime object, and if you want to keep its current -timezone, pass ``false`` as the timezone value: - -.. code-block:: jinja - - {{ post.published_at|date("m/d/Y", false) }} - -The default timezone can also be set globally by calling ``setTimezone()``: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setTimezone('Europe/Paris'); - -Arguments ---------- - -* ``format``: The date format -* ``timezone``: The date timezone - -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime -.. _`DateInterval`: http://www.php.net/DateInterval -.. _`date`: http://www.php.net/date -.. _`DateInterval::format`: http://www.php.net/DateInterval.format diff --git a/vendor/twig/twig/doc/filters/date_modify.rst b/vendor/twig/twig/doc/filters/date_modify.rst deleted file mode 100644 index 4db9dfb..0000000 --- a/vendor/twig/twig/doc/filters/date_modify.rst +++ /dev/null @@ -1,20 +0,0 @@ -``date_modify`` -=============== - -The ``date_modify`` filter modifies a date with a given modifier string: - -.. code-block:: jinja - - {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} - -The ``date_modify`` filter accepts strings (it must be in a format supported -by the `strtotime`_ function) or `DateTime`_ instances. You can easily combine -it with the :doc:`date` filter for formatting. - -Arguments ---------- - -* ``modifier``: The modifier - -.. _`strtotime`: http://www.php.net/strtotime -.. _`DateTime`: http://www.php.net/DateTime diff --git a/vendor/twig/twig/doc/filters/default.rst b/vendor/twig/twig/doc/filters/default.rst deleted file mode 100644 index 641ac6e..0000000 --- a/vendor/twig/twig/doc/filters/default.rst +++ /dev/null @@ -1,33 +0,0 @@ -``default`` -=========== - -The ``default`` filter returns the passed default value if the value is -undefined or empty, otherwise the value of the variable: - -.. code-block:: jinja - - {{ var|default('var is not defined') }} - - {{ var.foo|default('foo item on var is not defined') }} - - {{ var['foo']|default('foo item on var is not defined') }} - - {{ ''|default('passed var is empty') }} - -When using the ``default`` filter on an expression that uses variables in some -method calls, be sure to use the ``default`` filter whenever a variable can be -undefined: - -.. code-block:: jinja - - {{ var.method(foo|default('foo'))|default('foo') }} - -.. note:: - - Read the documentation for the :doc:`defined<../tests/defined>` and - :doc:`empty<../tests/empty>` tests to learn more about their semantics. - -Arguments ---------- - -* ``default``: The default value diff --git a/vendor/twig/twig/doc/filters/escape.rst b/vendor/twig/twig/doc/filters/escape.rst deleted file mode 100644 index 7596cb6..0000000 --- a/vendor/twig/twig/doc/filters/escape.rst +++ /dev/null @@ -1,109 +0,0 @@ -``escape`` -========== - -The ``escape`` filter escapes a string for safe insertion into the final -output. It supports different escaping strategies depending on the template -context. - -By default, it uses the HTML escaping strategy: - -.. code-block:: jinja - - {{ user.username|escape }} - -For convenience, the ``e`` filter is defined as an alias: - -.. code-block:: jinja - - {{ user.username|e }} - -The ``escape`` filter can also be used in other contexts than HTML thanks to -an optional argument which defines the escaping strategy to use: - -.. code-block:: jinja - - {{ user.username|e }} - {# is equivalent to #} - {{ user.username|e('html') }} - -And here is how to escape variables included in JavaScript code: - -.. code-block:: jinja - - {{ user.username|escape('js') }} - {{ user.username|e('js') }} - -The ``escape`` filter supports the following escaping strategies: - -* ``html``: escapes a string for the **HTML body** context. - -* ``js``: escapes a string for the **JavaScript context**. - -* ``css``: escapes a string for the **CSS context**. CSS escaping can be - applied to any string being inserted into CSS and escapes everything except - alphanumerics. - -* ``url``: escapes a string for the **URI or parameter contexts**. This should - not be used to escape an entire URI; only a subcomponent being inserted. - -* ``html_attr``: escapes a string for the **HTML attribute** context. - -.. note:: - - Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function - for the HTML escaping strategy. - -.. caution:: - - When using automatic escaping, Twig tries to not double-escape a variable - when the automatic escaping strategy is the same as the one applied by the - escape filter; but that does not work when using a variable as the - escaping strategy: - - .. code-block:: jinja - - {% set strategy = 'html' %} - - {% autoescape 'html' %} - {{ var|escape('html') }} {# won't be double-escaped #} - {{ var|escape(strategy) }} {# will be double-escaped #} - {% endautoescape %} - - When using a variable as the escaping strategy, you should disable - automatic escaping: - - .. code-block:: jinja - - {% set strategy = 'html' %} - - {% autoescape 'html' %} - {{ var|escape(strategy)|raw }} {# won't be double-escaped #} - {% endautoescape %} - -Custom Escapers ---------------- - -You can define custom escapers by calling the ``setEscaper()`` method on the -``core`` extension instance. The first argument is the escaper name (to be -used in the ``escape`` call) and the second one must be a valid PHP callable: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setEscaper('csv', 'csv_escaper'); - -When called by Twig, the callable receives the Twig environment instance, the -string to escape, and the charset. - -.. note:: - - Built-in escapers cannot be overridden mainly they should be considered as - the final implementation and also for better performance. - -Arguments ---------- - -* ``strategy``: The escaping strategy -* ``charset``: The string charset - -.. _`htmlspecialchars`: http://php.net/htmlspecialchars diff --git a/vendor/twig/twig/doc/filters/first.rst b/vendor/twig/twig/doc/filters/first.rst deleted file mode 100644 index 30eb217..0000000 --- a/vendor/twig/twig/doc/filters/first.rst +++ /dev/null @@ -1,22 +0,0 @@ -``first`` -========= - -The ``first`` filter returns the first "element" of a sequence, a mapping, or -a string: - -.. code-block:: jinja - - {{ [1, 2, 3, 4]|first }} - {# outputs 1 #} - - {{ { a: 1, b: 2, c: 3, d: 4 }|first }} - {# outputs 1 #} - - {{ '1234'|first }} - {# outputs 1 #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/vendor/twig/twig/doc/filters/format.rst b/vendor/twig/twig/doc/filters/format.rst deleted file mode 100644 index f8effd9..0000000 --- a/vendor/twig/twig/doc/filters/format.rst +++ /dev/null @@ -1,16 +0,0 @@ -``format`` -========== - -The ``format`` filter formats a given string by replacing the placeholders -(placeholders follows the `sprintf`_ notation): - -.. code-block:: jinja - - {{ "I like %s and %s."|format(foo, "bar") }} - - {# outputs I like foo and bar - if the foo parameter equals to the foo string. #} - -.. _`sprintf`: http://www.php.net/sprintf - -.. seealso:: :doc:`replace` diff --git a/vendor/twig/twig/doc/filters/index.rst b/vendor/twig/twig/doc/filters/index.rst deleted file mode 100644 index 8daa961..0000000 --- a/vendor/twig/twig/doc/filters/index.rst +++ /dev/null @@ -1,37 +0,0 @@ -Filters -======= - -.. toctree:: - :maxdepth: 1 - - abs - batch - capitalize - convert_encoding - date - date_modify - default - escape - first - format - join - json_encode - keys - last - length - lower - merge - nl2br - number_format - raw - replace - reverse - round - slice - sort - split - striptags - title - trim - upper - url_encode diff --git a/vendor/twig/twig/doc/filters/join.rst b/vendor/twig/twig/doc/filters/join.rst deleted file mode 100644 index 2fab945..0000000 --- a/vendor/twig/twig/doc/filters/join.rst +++ /dev/null @@ -1,23 +0,0 @@ -``join`` -======== - -The ``join`` filter returns a string which is the concatenation of the items -of a sequence: - -.. code-block:: jinja - - {{ [1, 2, 3]|join }} - {# returns 123 #} - -The separator between elements is an empty string per default, but you can -define it with the optional first parameter: - -.. code-block:: jinja - - {{ [1, 2, 3]|join('|') }} - {# outputs 1|2|3 #} - -Arguments ---------- - -* ``glue``: The separator diff --git a/vendor/twig/twig/doc/filters/json_encode.rst b/vendor/twig/twig/doc/filters/json_encode.rst deleted file mode 100644 index a39bb47..0000000 --- a/vendor/twig/twig/doc/filters/json_encode.rst +++ /dev/null @@ -1,21 +0,0 @@ -``json_encode`` -=============== - -The ``json_encode`` filter returns the JSON representation of a value: - -.. code-block:: jinja - - {{ data|json_encode() }} - -.. note:: - - Internally, Twig uses the PHP `json_encode`_ function. - -Arguments ---------- - -* ``options``: A bitmask of `json_encode options`_ (``{{ - data|json_encode(constant('JSON_PRETTY_PRINT')) }}``) - -.. _`json_encode`: http://php.net/json_encode -.. _`json_encode options`: http://www.php.net/manual/en/json.constants.php diff --git a/vendor/twig/twig/doc/filters/keys.rst b/vendor/twig/twig/doc/filters/keys.rst deleted file mode 100644 index e4f090c..0000000 --- a/vendor/twig/twig/doc/filters/keys.rst +++ /dev/null @@ -1,11 +0,0 @@ -``keys`` -======== - -The ``keys`` filter returns the keys of an array. It is useful when you want to -iterate over the keys of an array: - -.. code-block:: jinja - - {% for key in array|keys %} - ... - {% endfor %} diff --git a/vendor/twig/twig/doc/filters/last.rst b/vendor/twig/twig/doc/filters/last.rst deleted file mode 100644 index 9c05974..0000000 --- a/vendor/twig/twig/doc/filters/last.rst +++ /dev/null @@ -1,22 +0,0 @@ -``last`` -======== - -The ``last`` filter returns the last "element" of a sequence, a mapping, or -a string: - -.. code-block:: jinja - - {{ [1, 2, 3, 4]|last }} - {# outputs 4 #} - - {{ { a: 1, b: 2, c: 3, d: 4 }|last }} - {# outputs 4 #} - - {{ '1234'|last }} - {# outputs 4 #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php diff --git a/vendor/twig/twig/doc/filters/length.rst b/vendor/twig/twig/doc/filters/length.rst deleted file mode 100644 index 6f5a107..0000000 --- a/vendor/twig/twig/doc/filters/length.rst +++ /dev/null @@ -1,21 +0,0 @@ -``length`` -========== - -.. versionadded:: 2.3 - - Support for the ``__toString()`` magic method has been added in Twig 2.3. - -The ``length`` filter returns the number of items of a sequence or mapping, or -the length of a string. - -For objects that implement the ``Countable`` interface, ``length`` will use the -return value of the ``count()`` method. - -For objects that implement the ``__toString()`` magic method (and not ``Countable``), -it will return the length of the string provided by that method. - -.. code-block:: jinja - - {% if users|length > 10 %} - ... - {% endif %} diff --git a/vendor/twig/twig/doc/filters/lower.rst b/vendor/twig/twig/doc/filters/lower.rst deleted file mode 100644 index ef9faa9..0000000 --- a/vendor/twig/twig/doc/filters/lower.rst +++ /dev/null @@ -1,10 +0,0 @@ -``lower`` -========= - -The ``lower`` filter converts a value to lowercase: - -.. code-block:: jinja - - {{ 'WELCOME'|lower }} - - {# outputs 'welcome' #} diff --git a/vendor/twig/twig/doc/filters/merge.rst b/vendor/twig/twig/doc/filters/merge.rst deleted file mode 100644 index 88780dd..0000000 --- a/vendor/twig/twig/doc/filters/merge.rst +++ /dev/null @@ -1,48 +0,0 @@ -``merge`` -========= - -The ``merge`` filter merges an array with another array: - -.. code-block:: jinja - - {% set values = [1, 2] %} - - {% set values = values|merge(['apple', 'orange']) %} - - {# values now contains [1, 2, 'apple', 'orange'] #} - -New values are added at the end of the existing ones. - -The ``merge`` filter also works on hashes: - -.. code-block:: jinja - - {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} - - {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} - - {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} - -For hashes, the merging process occurs on the keys: if the key does not -already exist, it is added but if the key already exists, its value is -overridden. - -.. tip:: - - If you want to ensure that some values are defined in an array (by given - default values), reverse the two elements in the call: - - .. code-block:: jinja - - {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} - - {% set items = { 'apple': 'unknown' }|merge(items) %} - - {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} - -.. note:: - - Internally, Twig uses the PHP `array_merge`_ function. It supports - Traversable objects by transforming those to arrays. - -.. _`array_merge`: http://php.net/array_merge diff --git a/vendor/twig/twig/doc/filters/nl2br.rst b/vendor/twig/twig/doc/filters/nl2br.rst deleted file mode 100644 index 366ca83..0000000 --- a/vendor/twig/twig/doc/filters/nl2br.rst +++ /dev/null @@ -1,19 +0,0 @@ -``nl2br`` -========= - -The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: - -.. code-block:: jinja - - {{ "I like Twig.\nYou will like it too."|nl2br }} - {# outputs - - I like Twig.
    - You will like it too. - - #} - -.. note:: - - The ``nl2br`` filter pre-escapes the input before applying the - transformation. diff --git a/vendor/twig/twig/doc/filters/number_format.rst b/vendor/twig/twig/doc/filters/number_format.rst deleted file mode 100644 index ec5a2a7..0000000 --- a/vendor/twig/twig/doc/filters/number_format.rst +++ /dev/null @@ -1,50 +0,0 @@ -``number_format`` -================= - -The ``number_format`` filter formats numbers. It is a wrapper around PHP's -`number_format`_ function: - -.. code-block:: jinja - - {{ 200.35|number_format }} - -You can control the number of decimal places, decimal point, and thousands -separator using the additional arguments: - -.. code-block:: jinja - - {{ 9800.333|number_format(2, '.', ',') }} - -To format negative numbers, wrap the number with parentheses (needed because of -Twig's :ref:`precedence of operators `: - -.. code-block:: jinja - - {{ -9800.333|number_format(2, '.', ',') }} {# outputs : -9 #} - {{ (-9800.333)|number_format(2, '.', ',') }} {# outputs : -9,800.33 #} - -If no formatting options are provided then Twig will use the default formatting -options of: - -* 0 decimal places. -* ``.`` as the decimal point. -* ``,`` as the thousands separator. - -These defaults can be easily changed through the core extension: - -.. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setNumberFormat(3, '.', ','); - -The defaults set for ``number_format`` can be over-ridden upon each call using the -additional parameters. - -Arguments ---------- - -* ``decimal``: The number of decimal points to display -* ``decimal_point``: The character(s) to use for the decimal point -* ``thousand_sep``: The character(s) to use for the thousands separator - -.. _`number_format`: http://php.net/number_format diff --git a/vendor/twig/twig/doc/filters/raw.rst b/vendor/twig/twig/doc/filters/raw.rst deleted file mode 100644 index e5e5b12..0000000 --- a/vendor/twig/twig/doc/filters/raw.rst +++ /dev/null @@ -1,36 +0,0 @@ -``raw`` -======= - -The ``raw`` filter marks the value as being "safe", which means that in an -environment with automatic escaping enabled this variable will not be escaped -if ``raw`` is the last filter applied to it: - -.. code-block:: jinja - - {% autoescape %} - {{ var|raw }} {# var won't be escaped #} - {% endautoescape %} - -.. note:: - - Be careful when using the ``raw`` filter inside expressions: - - .. code-block:: jinja - - {% autoescape %} - {% set hello = 'Hello' %} - {% set hola = 'Hola' %} - - {{ false ? 'Hola' : hello|raw }} - does not render the same as - {{ false ? hola : hello|raw }} - but renders the same as - {{ (false ? hola : hello)|raw }} - {% endautoescape %} - - The first ternary statement is not escaped: ``hello`` is marked as being - safe and Twig does not escape static values (see - :doc:`escape<../tags/autoescape>`). In the second ternary statement, even - if ``hello`` is marked as safe, ``hola`` remains unsafe and so is the whole - expression. The third ternary statement is marked as safe and the result is - not escaped. diff --git a/vendor/twig/twig/doc/filters/replace.rst b/vendor/twig/twig/doc/filters/replace.rst deleted file mode 100644 index 8dbb745..0000000 --- a/vendor/twig/twig/doc/filters/replace.rst +++ /dev/null @@ -1,19 +0,0 @@ -``replace`` -=========== - -The ``replace`` filter formats a given string by replacing the placeholders -(placeholders are free-form): - -.. code-block:: jinja - - {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} - - {# outputs I like foo and bar - if the foo parameter equals to the foo string. #} - -Arguments ---------- - -* ``from``: The placeholder values - -.. seealso:: :doc:`format` diff --git a/vendor/twig/twig/doc/filters/reverse.rst b/vendor/twig/twig/doc/filters/reverse.rst deleted file mode 100644 index 7e9508f..0000000 --- a/vendor/twig/twig/doc/filters/reverse.rst +++ /dev/null @@ -1,44 +0,0 @@ -``reverse`` -=========== - -The ``reverse`` filter reverses a sequence, a mapping, or a string: - -.. code-block:: jinja - - {% for user in users|reverse %} - ... - {% endfor %} - - {{ '1234'|reverse }} - - {# outputs 4321 #} - -.. tip:: - - For sequences and mappings, numeric keys are not preserved. To reverse - them as well, pass ``true`` as an argument to the ``reverse`` filter: - - .. code-block:: jinja - - {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse %} - {{ key }}: {{ value }} - {%- endfor %} - - {# output: 0: c 1: b 2: a #} - - {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse(true) %} - {{ key }}: {{ value }} - {%- endfor %} - - {# output: 3: c 2: b 1: a #} - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -Arguments ---------- - -* ``preserve_keys``: Preserve keys when reversing a mapping or a sequence. - -.. _`Traversable`: http://php.net/Traversable diff --git a/vendor/twig/twig/doc/filters/round.rst b/vendor/twig/twig/doc/filters/round.rst deleted file mode 100644 index c14a7a9..0000000 --- a/vendor/twig/twig/doc/filters/round.rst +++ /dev/null @@ -1,34 +0,0 @@ -``round`` -========= - -The ``round`` filter rounds a number to a given precision: - -.. code-block:: jinja - - {{ 42.55|round }} - {# outputs 43 #} - - {{ 42.55|round(1, 'floor') }} - {# outputs 42.5 #} - -The ``round`` filter takes two optional arguments; the first one specifies the -precision (default is ``0``) and the second the rounding method (default is -``common``): - -* ``common`` rounds either up or down (rounds the value up to precision decimal - places away from zero, when it is half way there -- making 1.5 into 2 and - -1.5 into -2); - -* ``ceil`` always rounds up; - -* ``floor`` always rounds down. - -.. note:: - - The ``//`` operator is equivalent to ``|round(0, 'floor')``. - -Arguments ---------- - -* ``precision``: The rounding precision -* ``method``: The rounding method diff --git a/vendor/twig/twig/doc/filters/slice.rst b/vendor/twig/twig/doc/filters/slice.rst deleted file mode 100644 index c255756..0000000 --- a/vendor/twig/twig/doc/filters/slice.rst +++ /dev/null @@ -1,68 +0,0 @@ -``slice`` -=========== - -The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} - {# will iterate over 2 and 3 #} - {% endfor %} - - {{ '12345'|slice(1, 2) }} - - {# outputs 23 #} - -You can use any valid expression for both the start and the length: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5]|slice(start, length) %} - {# ... #} - {% endfor %} - -As syntactic sugar, you can also use the ``[]`` notation: - -.. code-block:: jinja - - {% for i in [1, 2, 3, 4, 5][start:length] %} - {# ... #} - {% endfor %} - - {{ '12345'[1:2] }} {# will display "23" #} - - {# you can omit the first argument -- which is the same as 0 #} - {{ '12345'[:2] }} {# will display "12" #} - - {# you can omit the last argument -- which will select everything till the end #} - {{ '12345'[2:] }} {# will display "345" #} - -The ``slice`` filter works as the `array_slice`_ PHP function for arrays and -`mb_substr`_ for strings with a fallback to `substr`_. - -If the start is non-negative, the sequence will start at that start in the -variable. If start is negative, the sequence will start that far from the end -of the variable. - -If length is given and is positive, then the sequence will have up to that -many elements in it. If the variable is shorter than the length, then only the -available variable elements will be present. If length is given and is -negative then the sequence will stop that many elements from the end of the -variable. If it is omitted, then the sequence will have everything from offset -up until the end of the variable. - -.. note:: - - It also works with objects implementing the `Traversable`_ interface. - -Arguments ---------- - -* ``start``: The start of the slice -* ``length``: The size of the slice -* ``preserve_keys``: Whether to preserve key or not (when the input is an array) - -.. _`Traversable`: http://php.net/manual/en/class.traversable.php -.. _`array_slice`: http://php.net/array_slice -.. _`mb_substr` : http://php.net/mb-substr -.. _`substr`: http://php.net/substr diff --git a/vendor/twig/twig/doc/filters/sort.rst b/vendor/twig/twig/doc/filters/sort.rst deleted file mode 100644 index 350207f..0000000 --- a/vendor/twig/twig/doc/filters/sort.rst +++ /dev/null @@ -1,18 +0,0 @@ -``sort`` -======== - -The ``sort`` filter sorts an array: - -.. code-block:: jinja - - {% for user in users|sort %} - ... - {% endfor %} - -.. note:: - - Internally, Twig uses the PHP `asort`_ function to maintain index - association. It supports Traversable objects by transforming - those to arrays. - -.. _`asort`: http://php.net/asort diff --git a/vendor/twig/twig/doc/filters/split.rst b/vendor/twig/twig/doc/filters/split.rst deleted file mode 100644 index cb82948..0000000 --- a/vendor/twig/twig/doc/filters/split.rst +++ /dev/null @@ -1,50 +0,0 @@ -``split`` -========= - -The ``split`` filter splits a string by the given delimiter and returns a list -of strings: - -.. code-block:: jinja - - {% set foo = "one,two,three"|split(',') %} - {# foo contains ['one', 'two', 'three'] #} - -You can also pass a ``limit`` argument: - - * If ``limit`` is positive, the returned array will contain a maximum of - limit elements with the last element containing the rest of string; - - * If ``limit`` is negative, all components except the last -limit are - returned; - - * If ``limit`` is zero, then this is treated as 1. - -.. code-block:: jinja - - {% set foo = "one,two,three,four,five"|split(',', 3) %} - {# foo contains ['one', 'two', 'three,four,five'] #} - -If the ``delimiter`` is an empty string, then value will be split by equal -chunks. Length is set by the ``limit`` argument (one character by default). - -.. code-block:: jinja - - {% set foo = "123"|split('') %} - {# foo contains ['1', '2', '3'] #} - - {% set bar = "aabbcc"|split('', 2) %} - {# bar contains ['aa', 'bb', 'cc'] #} - -.. note:: - - Internally, Twig uses the PHP `explode`_ or `str_split`_ (if delimiter is - empty) functions for string splitting. - -Arguments ---------- - -* ``delimiter``: The delimiter -* ``limit``: The limit argument - -.. _`explode`: http://php.net/explode -.. _`str_split`: http://php.net/str_split diff --git a/vendor/twig/twig/doc/filters/striptags.rst b/vendor/twig/twig/doc/filters/striptags.rst deleted file mode 100644 index 82953b7..0000000 --- a/vendor/twig/twig/doc/filters/striptags.rst +++ /dev/null @@ -1,29 +0,0 @@ -``striptags`` -============= - -The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace -by one space: - -.. code-block:: jinja - - {{ some_html|striptags }} - -You can also provide tags which should not be stripped: - -.. code-block:: jinja - - {{ some_html|striptags('

    ') }} - -In this example, the ``
    ``, ``
    ``, ``

    ``, and ``

    `` tags won't be -removed from the string. - -.. note:: - - Internally, Twig uses the PHP `strip_tags`_ function. - -Arguments ---------- - -* ``allowable_tags``: Tags which should not be stripped - -.. _`strip_tags`: http://php.net/strip_tags diff --git a/vendor/twig/twig/doc/filters/title.rst b/vendor/twig/twig/doc/filters/title.rst deleted file mode 100644 index c5a318e..0000000 --- a/vendor/twig/twig/doc/filters/title.rst +++ /dev/null @@ -1,11 +0,0 @@ -``title`` -========= - -The ``title`` filter returns a titlecased version of the value. Words will -start with uppercase letters, all remaining characters are lowercase: - -.. code-block:: jinja - - {{ 'my first car'|title }} - - {# outputs 'My First Car' #} diff --git a/vendor/twig/twig/doc/filters/trim.rst b/vendor/twig/twig/doc/filters/trim.rst deleted file mode 100644 index 8604178..0000000 --- a/vendor/twig/twig/doc/filters/trim.rst +++ /dev/null @@ -1,39 +0,0 @@ -``trim`` -======== - -The ``trim`` filter strips whitespace (or other characters) from the beginning -and end of a string: - -.. code-block:: jinja - - {{ ' I like Twig. '|trim }} - - {# outputs 'I like Twig.' #} - - {{ ' I like Twig.'|trim('.') }} - - {# outputs ' I like Twig' #} - - {{ ' I like Twig. '|trim(side='left') }} - - {# outputs 'I like Twig. ' #} - - {{ ' I like Twig. '|trim(' ', 'right') }} - - {# outputs ' I like Twig.' #} - -.. note:: - - Internally, Twig uses the PHP `trim`_, `ltrim`_, and `rtrim`_ functions. - -Arguments ---------- - -* ``character_mask``: The characters to strip - -* ``side``: The default is to strip from the left and the right (`both`) sides, but `left` - and `right` will strip from either the left side or right side only - -.. _`trim`: http://php.net/trim -.. _`ltrim`: http://php.net/ltrim -.. _`rtrim`: http://php.net/rtrim diff --git a/vendor/twig/twig/doc/filters/upper.rst b/vendor/twig/twig/doc/filters/upper.rst deleted file mode 100644 index 561cebe..0000000 --- a/vendor/twig/twig/doc/filters/upper.rst +++ /dev/null @@ -1,10 +0,0 @@ -``upper`` -========= - -The ``upper`` filter converts a value to uppercase: - -.. code-block:: jinja - - {{ 'welcome'|upper }} - - {# outputs 'WELCOME' #} diff --git a/vendor/twig/twig/doc/filters/url_encode.rst b/vendor/twig/twig/doc/filters/url_encode.rst deleted file mode 100644 index d8b8af3..0000000 --- a/vendor/twig/twig/doc/filters/url_encode.rst +++ /dev/null @@ -1,22 +0,0 @@ -``url_encode`` -============== - -The ``url_encode`` filter percent encodes a given string as URL segment -or an array as query string: - -.. code-block:: jinja - - {{ "path-seg*ment"|url_encode }} - {# outputs "path-seg%2Ament" #} - - {{ "string with spaces"|url_encode }} - {# outputs "string%20with%20spaces" #} - - {{ {'param': 'value', 'foo': 'bar'}|url_encode }} - {# outputs "param=value&foo=bar" #} - -.. note:: - - Internally, Twig uses the PHP ``rawurlencode``. - -.. _`rawurlencode`: http://php.net/rawurlencode diff --git a/vendor/twig/twig/doc/functions/attribute.rst b/vendor/twig/twig/doc/functions/attribute.rst deleted file mode 100644 index 5ba2532..0000000 --- a/vendor/twig/twig/doc/functions/attribute.rst +++ /dev/null @@ -1,23 +0,0 @@ -``attribute`` -============= - -The ``attribute`` function can be used to access a "dynamic" attribute of a -variable: - -.. code-block:: jinja - - {{ attribute(object, method) }} - {{ attribute(object, method, arguments) }} - {{ attribute(array, item) }} - -In addition, the ``defined`` test can check for the existence of a dynamic -attribute: - -.. code-block:: jinja - - {{ attribute(object, method) is defined ? 'Method exists' : 'Method does not exist' }} - -.. note:: - - The resolution algorithm is the same as the one used for the ``.`` - notation, except that the item can be any valid expression. diff --git a/vendor/twig/twig/doc/functions/block.rst b/vendor/twig/twig/doc/functions/block.rst deleted file mode 100644 index 6899523..0000000 --- a/vendor/twig/twig/doc/functions/block.rst +++ /dev/null @@ -1,35 +0,0 @@ -``block`` -========= - -When a template uses inheritance and if you want to print a block multiple -times, use the ``block`` function: - -.. code-block:: jinja - - {% block title %}{% endblock %} - -

    {{ block('title') }}

    - - {% block body %}{% endblock %} - -The ``block`` function can also be used to display one block of another -template: - -.. code-block:: jinja - - {{ block("title", "common_blocks.twig") }} - -Use the ``defined`` test to check if a block exists in the context of the -current template: - -.. code-block:: jinja - - {% if block("footer") is defined %} - ... - {% endif %} - - {% if block("footer", "common_blocks.twig") is defined %} - ... - {% endif %} - -.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/vendor/twig/twig/doc/functions/constant.rst b/vendor/twig/twig/doc/functions/constant.rst deleted file mode 100644 index f8410ed..0000000 --- a/vendor/twig/twig/doc/functions/constant.rst +++ /dev/null @@ -1,23 +0,0 @@ -``constant`` -============ - -``constant`` returns the constant value for a given string: - -.. code-block:: jinja - - {{ some_date|date(constant('DATE_W3C')) }} - {{ constant('Namespace\\Classname::CONSTANT_NAME') }} - -You can read constants from object instances as well: - -.. code-block:: jinja - - {{ constant('RSS', date) }} - -Use the ``defined`` test to check if a constant is defined: - -.. code-block:: jinja - - {% if constant('SOME_CONST') is defined %} - ... - {% endif %} diff --git a/vendor/twig/twig/doc/functions/cycle.rst b/vendor/twig/twig/doc/functions/cycle.rst deleted file mode 100644 index e343493..0000000 --- a/vendor/twig/twig/doc/functions/cycle.rst +++ /dev/null @@ -1,28 +0,0 @@ -``cycle`` -========= - -The ``cycle`` function cycles on an array of values: - -.. code-block:: jinja - - {% set start_year = date() | date('Y') %} - {% set end_year = start_year + 5 %} - - {% for year in start_year..end_year %} - {{ cycle(['odd', 'even'], loop.index0) }} - {% endfor %} - -The array can contain any number of values: - -.. code-block:: jinja - - {% set fruits = ['apple', 'orange', 'citrus'] %} - - {% for i in 0..10 %} - {{ cycle(fruits, i) }} - {% endfor %} - -Arguments ---------- - -* ``position``: The cycle position diff --git a/vendor/twig/twig/doc/functions/date.rst b/vendor/twig/twig/doc/functions/date.rst deleted file mode 100644 index 0e4631e..0000000 --- a/vendor/twig/twig/doc/functions/date.rst +++ /dev/null @@ -1,46 +0,0 @@ -``date`` -======== - -Converts an argument to a date to allow date comparison: - -.. code-block:: jinja - - {% if date(user.created_at) < date('-2days') %} - {# do something #} - {% endif %} - -The argument must be in one of PHP’s supported `date and time formats`_. - -You can pass a timezone as the second argument: - -.. code-block:: jinja - - {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} - {# do something #} - {% endif %} - -If no argument is passed, the function returns the current date: - -.. code-block:: jinja - - {% if date(user.created_at) < date() %} - {# always! #} - {% endif %} - -.. note:: - - You can set the default timezone globally by calling ``setTimezone()`` on - the ``core`` extension instance: - - .. code-block:: php - - $twig = new Twig_Environment($loader); - $twig->getExtension('Twig_Extension_Core')->setTimezone('Europe/Paris'); - -Arguments ---------- - -* ``date``: The date -* ``timezone``: The timezone - -.. _`date and time formats`: http://php.net/manual/en/datetime.formats.php diff --git a/vendor/twig/twig/doc/functions/dump.rst b/vendor/twig/twig/doc/functions/dump.rst deleted file mode 100644 index 434a3a9..0000000 --- a/vendor/twig/twig/doc/functions/dump.rst +++ /dev/null @@ -1,66 +0,0 @@ -``dump`` -======== - -The ``dump`` function dumps information about a template variable. This is -mostly useful to debug a template that does not behave as expected by -introspecting its variables: - -.. code-block:: jinja - - {{ dump(user) }} - -.. note:: - - The ``dump`` function is not available by default. You must add the - ``Twig_Extension_Debug`` extension explicitly when creating your Twig - environment:: - - $twig = new Twig_Environment($loader, array( - 'debug' => true, - // ... - )); - $twig->addExtension(new Twig_Extension_Debug()); - - Even when enabled, the ``dump`` function won't display anything if the - ``debug`` option on the environment is not enabled (to avoid leaking debug - information on a production server). - -In an HTML context, wrap the output with a ``pre`` tag to make it easier to -read: - -.. code-block:: jinja - -
    -        {{ dump(user) }}
    -    
    - -.. tip:: - - Using a ``pre`` tag is not needed when `XDebug`_ is enabled and - ``html_errors`` is ``on``; as a bonus, the output is also nicer with - XDebug enabled. - -You can debug several variables by passing them as additional arguments: - -.. code-block:: jinja - - {{ dump(user, categories) }} - -If you don't pass any value, all variables from the current context are -dumped: - -.. code-block:: jinja - - {{ dump() }} - -.. note:: - - Internally, Twig uses the PHP `var_dump`_ function. - -Arguments ---------- - -* ``context``: The context to dump - -.. _`XDebug`: http://xdebug.org/docs/display -.. _`var_dump`: http://php.net/var_dump diff --git a/vendor/twig/twig/doc/functions/include.rst b/vendor/twig/twig/doc/functions/include.rst deleted file mode 100644 index 8a824bf..0000000 --- a/vendor/twig/twig/doc/functions/include.rst +++ /dev/null @@ -1,77 +0,0 @@ -``include`` -=========== - -The ``include`` function returns the rendered content of a template: - -.. code-block:: jinja - - {{ include('template.html') }} - {{ include(some_var) }} - -Included templates have access to the variables of the active context. - -If you are using the filesystem loader, the templates are looked for in the -paths defined by it. - -The context is passed by default to the template but you can also pass -additional variables: - -.. code-block:: jinja - - {# template.html will have access to the variables from the current context and the additional ones provided #} - {{ include('template.html', {foo: 'bar'}) }} - -You can disable access to the context by setting ``with_context`` to -``false``: - -.. code-block:: jinja - - {# only the foo variable will be accessible #} - {{ include('template.html', {foo: 'bar'}, with_context = false) }} - -.. code-block:: jinja - - {# no variables will be accessible #} - {{ include('template.html', with_context = false) }} - -And if the expression evaluates to a ``Twig_Template`` or a -``Twig_TemplateWrapper`` instance, Twig will use it directly:: - - // {{ include(template) }} - - $template = $twig->load('some_template.twig'); - - $twig->display('template.twig', array('template' => $template)); - -When you set the ``ignore_missing`` flag, Twig will return an empty string if -the template does not exist: - -.. code-block:: jinja - - {{ include('sidebar.html', ignore_missing = true) }} - -You can also provide a list of templates that are checked for existence before -inclusion. The first template that exists will be rendered: - -.. code-block:: jinja - - {{ include(['page_detailed.html', 'page.html']) }} - -If ``ignore_missing`` is set, it will fall back to rendering nothing if none -of the templates exist, otherwise it will throw an exception. - -When including a template created by an end user, you should consider -sandboxing it: - -.. code-block:: jinja - - {{ include('page.html', sandboxed = true) }} - -Arguments ---------- - -* ``template``: The template to render -* ``variables``: The variables to pass to the template -* ``with_context``: Whether to pass the current context variables or not -* ``ignore_missing``: Whether to ignore missing templates or not -* ``sandboxed``: Whether to sandbox the template or not diff --git a/vendor/twig/twig/doc/functions/index.rst b/vendor/twig/twig/doc/functions/index.rst deleted file mode 100644 index 07214a7..0000000 --- a/vendor/twig/twig/doc/functions/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -Functions -========= - -.. toctree:: - :maxdepth: 1 - - attribute - block - constant - cycle - date - dump - include - max - min - parent - random - range - source - template_from_string diff --git a/vendor/twig/twig/doc/functions/max.rst b/vendor/twig/twig/doc/functions/max.rst deleted file mode 100644 index bf72843..0000000 --- a/vendor/twig/twig/doc/functions/max.rst +++ /dev/null @@ -1,17 +0,0 @@ -``max`` -======= - -``max`` returns the biggest value of a sequence or a set of values: - -.. code-block:: jinja - - {{ max(1, 3, 2) }} - {{ max([1, 3, 2]) }} - -When called with a mapping, max ignores keys and only compares values: - -.. code-block:: jinja - - {{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }} - {# returns "e" #} - diff --git a/vendor/twig/twig/doc/functions/min.rst b/vendor/twig/twig/doc/functions/min.rst deleted file mode 100644 index 3235191..0000000 --- a/vendor/twig/twig/doc/functions/min.rst +++ /dev/null @@ -1,17 +0,0 @@ -``min`` -======= - -``min`` returns the lowest value of a sequence or a set of values: - -.. code-block:: jinja - - {{ min(1, 3, 2) }} - {{ min([1, 3, 2]) }} - -When called with a mapping, min ignores keys and only compares values: - -.. code-block:: jinja - - {{ min({2: "e", 3: "a", 1: "b", 5: "d", 4: "c"}) }} - {# returns "a" #} - diff --git a/vendor/twig/twig/doc/functions/parent.rst b/vendor/twig/twig/doc/functions/parent.rst deleted file mode 100644 index f5bd200..0000000 --- a/vendor/twig/twig/doc/functions/parent.rst +++ /dev/null @@ -1,20 +0,0 @@ -``parent`` -========== - -When a template uses inheritance, it's possible to render the contents of the -parent block when overriding a block by using the ``parent`` function: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -The ``parent()`` call will return the content of the ``sidebar`` block as -defined in the ``base.html`` template. - -.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/vendor/twig/twig/doc/functions/random.rst b/vendor/twig/twig/doc/functions/random.rst deleted file mode 100644 index 7f2a571..0000000 --- a/vendor/twig/twig/doc/functions/random.rst +++ /dev/null @@ -1,23 +0,0 @@ -``random`` -========== - -The ``random`` function returns a random value depending on the supplied -parameter type: - -* a random item from a sequence; -* a random character from a string; -* a random integer between 0 and the integer parameter (inclusive). - -.. code-block:: jinja - - {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} - {{ random('ABC') }} {# example output: C #} - {{ random() }} {# example output: 15386094 (works as the native PHP mt_rand function) #} - {{ random(5) }} {# example output: 3 #} - -Arguments ---------- - -* ``values``: The values - -.. _`mt_rand`: http://php.net/mt_rand diff --git a/vendor/twig/twig/doc/functions/range.rst b/vendor/twig/twig/doc/functions/range.rst deleted file mode 100644 index 5c9db08..0000000 --- a/vendor/twig/twig/doc/functions/range.rst +++ /dev/null @@ -1,58 +0,0 @@ -``range`` -========= - -Returns a list containing an arithmetic progression of integers: - -.. code-block:: jinja - - {% for i in range(0, 3) %} - {{ i }}, - {% endfor %} - - {# outputs 0, 1, 2, 3, #} - -When step is given (as the third parameter), it specifies the increment (or -decrement for negative values): - -.. code-block:: jinja - - {% for i in range(0, 6, 2) %} - {{ i }}, - {% endfor %} - - {# outputs 0, 2, 4, 6, #} - -.. note:: - - Note that if the start is greater than the end, ``range`` assumes a step of - ``-1``: - - .. code-block:: jinja - - {% for i in range(3, 0) %} - {{ i }}, - {% endfor %} - - {# outputs 3, 2, 1, 0, #} - -The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` -function (with a step of ``1``, or ``-1`` if the start is greater than the end): - -.. code-block:: jinja - - {% for i in 0..3 %} - {{ i }}, - {% endfor %} - -.. tip:: - - The ``range`` function works as the native PHP `range`_ function. - -Arguments ---------- - -* ``low``: The first value of the sequence. -* ``high``: The highest possible value of the sequence. -* ``step``: The increment between elements of the sequence. - -.. _`range`: http://php.net/range diff --git a/vendor/twig/twig/doc/functions/source.rst b/vendor/twig/twig/doc/functions/source.rst deleted file mode 100644 index 16601cb..0000000 --- a/vendor/twig/twig/doc/functions/source.rst +++ /dev/null @@ -1,26 +0,0 @@ -``source`` -========== - -The ``source`` function returns the content of a template without rendering it: - -.. code-block:: jinja - - {{ source('template.html') }} - {{ source(some_var) }} - -When you set the ``ignore_missing`` flag, Twig will return an empty string if -the template does not exist: - -.. code-block:: jinja - - {{ source('template.html', ignore_missing = true) }} - -The function uses the same template loaders as the ones used to include -templates. So, if you are using the filesystem loader, the templates are looked -for in the paths defined by it. - -Arguments ---------- - -* ``name``: The name of the template to read -* ``ignore_missing``: Whether to ignore missing templates or not diff --git a/vendor/twig/twig/doc/functions/template_from_string.rst b/vendor/twig/twig/doc/functions/template_from_string.rst deleted file mode 100644 index 8bc6c78..0000000 --- a/vendor/twig/twig/doc/functions/template_from_string.rst +++ /dev/null @@ -1,29 +0,0 @@ -``template_from_string`` -======================== - -The ``template_from_string`` function loads a template from a string: - -.. code-block:: jinja - - {{ include(template_from_string("Hello {{ name }}")) }} - {{ include(template_from_string(page.template)) }} - -.. note:: - - The ``template_from_string`` function is not available by default. You - must add the ``Twig_Extension_StringLoader`` extension explicitly when - creating your Twig environment:: - - $twig = new Twig_Environment(...); - $twig->addExtension(new Twig_Extension_StringLoader()); - -.. note:: - - Even if you will probably always use the ``template_from_string`` function - with the ``include`` function, you can use it with any tag or function that - takes a template as an argument (like the ``embed`` or ``extends`` tags). - -Arguments ---------- - -* ``template``: The template diff --git a/vendor/twig/twig/doc/index.rst b/vendor/twig/twig/doc/index.rst deleted file mode 100644 index efebcc4..0000000 --- a/vendor/twig/twig/doc/index.rst +++ /dev/null @@ -1,18 +0,0 @@ -Twig -==== - -.. toctree:: - :maxdepth: 2 - - intro - installation - templates - api - advanced - internals - recipes - coding_standards - tags/index - filters/index - functions/index - tests/index diff --git a/vendor/twig/twig/doc/installation.rst b/vendor/twig/twig/doc/installation.rst deleted file mode 100644 index 430042b..0000000 --- a/vendor/twig/twig/doc/installation.rst +++ /dev/null @@ -1,34 +0,0 @@ -Installation -============ - -You have multiple ways to install Twig. - -Installing the Twig PHP package -------------------------------- - -Installing via Composer (recommended) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install `Composer`_ and run the following command to get the latest version: - -.. code-block:: bash - - composer require twig/twig:~2.0 - -Installing from the tarball release -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. Download the most recent tarball from the `download page`_ -2. Verify the integrity of the tarball http://fabien.potencier.org/article/73/signing-project-releases -3. Unpack the tarball -4. Move the files somewhere in your project - -Installing the development version -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. code-block:: bash - - git clone git://github.com/twigphp/Twig.git - -.. _`download page`: https://github.com/twigphp/Twig/tags -.. _`Composer`: https://getcomposer.org/download/ diff --git a/vendor/twig/twig/doc/internals.rst b/vendor/twig/twig/doc/internals.rst deleted file mode 100644 index 8e9bf2d..0000000 --- a/vendor/twig/twig/doc/internals.rst +++ /dev/null @@ -1,138 +0,0 @@ -Twig Internals -============== - -Twig is very extensible and you can easily hack it. Keep in mind that you -should probably try to create an extension before hacking the core, as most -features and enhancements can be handled with extensions. This chapter is also -useful for people who want to understand how Twig works under the hood. - -How does Twig work? -------------------- - -The rendering of a Twig template can be summarized into four key steps: - -* **Load** the template: If the template is already compiled, load it and go - to the *evaluation* step, otherwise: - - * First, the **lexer** tokenizes the template source code into small pieces - for easier processing; - * Then, the **parser** converts the token stream into a meaningful tree - of nodes (the Abstract Syntax Tree); - * Eventually, the *compiler* transforms the AST into PHP code. - -* **Evaluate** the template: It basically means calling the ``display()`` - method of the compiled template and passing it the context. - -The Lexer ---------- - -The lexer tokenizes a template source code into a token stream (each token is -an instance of ``Twig_Token``, and the stream is an instance of -``Twig_TokenStream``). The default lexer recognizes 13 different token types: - -* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) -* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) -* ``Twig_Token::TEXT_TYPE``: A text outside an expression; -* ``Twig_Token::NAME_TYPE``: A name in an expression; -* ``Twig_Token::NUMBER_TYPE``: A number in an expression; -* ``Twig_Token::STRING_TYPE``: A string in an expression; -* ``Twig_Token::OPERATOR_TYPE``: An operator; -* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; -* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE``: Delimiters for string interpolation; -* ``Twig_Token::EOF_TYPE``: Ends of template. - -You can manually convert a source code into a token stream by calling the -``tokenize()`` method of an environment:: - - $stream = $twig->tokenize(new Twig_Source($source, $identifier)); - -As the stream has a ``__toString()`` method, you can have a textual -representation of it by echoing the object:: - - echo $stream."\n"; - -Here is the output for the ``Hello {{ name }}`` template: - -.. code-block:: text - - TEXT_TYPE(Hello ) - VAR_START_TYPE() - NAME_TYPE(name) - VAR_END_TYPE() - EOF_TYPE() - -.. note:: - - The default lexer (``Twig_Lexer``) can be changed by calling - the ``setLexer()`` method:: - - $twig->setLexer($lexer); - -The Parser ----------- - -The parser converts the token stream into an AST (Abstract Syntax Tree), or a -node tree (an instance of ``Twig_Node_Module``). The core extension defines -the basic nodes like: ``for``, ``if``, ... and the expression nodes. - -You can manually convert a token stream into a node tree by calling the -``parse()`` method of an environment:: - - $nodes = $twig->parse($stream); - -Echoing the node object gives you a nice representation of the tree:: - - echo $nodes."\n"; - -Here is the output for the ``Hello {{ name }}`` template: - -.. code-block:: text - - Twig_Node_Module( - Twig_Node_Text(Hello ) - Twig_Node_Print( - Twig_Node_Expression_Name(name) - ) - ) - -.. note:: - - The default parser (``Twig_TokenParser``) can be changed by calling the - ``setParser()`` method:: - - $twig->setParser($parser); - -The Compiler ------------- - -The last step is done by the compiler. It takes a node tree as an input and -generates PHP code usable for runtime execution of the template. - -You can manually compile a node tree to PHP code with the ``compile()`` method -of an environment:: - - $php = $twig->compile($nodes); - -The generated template for a ``Hello {{ name }}`` template reads as follows -(the actual output can differ depending on the version of Twig you are -using):: - - /* Hello {{ name }} */ - class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template - { - protected function doDisplay(array $context, array $blocks = array()) - { - // line 1 - echo "Hello "; - echo twig_escape_filter($this->env, (isset($context["name"]) ? $context["name"] : null), "html", null, true); - } - - // some more code - } - -.. note:: - - The default compiler (``Twig_Compiler``) can be changed by calling the - ``setCompiler()`` method:: - - $twig->setCompiler($compiler); diff --git a/vendor/twig/twig/doc/intro.rst b/vendor/twig/twig/doc/intro.rst deleted file mode 100644 index fb68250..0000000 --- a/vendor/twig/twig/doc/intro.rst +++ /dev/null @@ -1,78 +0,0 @@ -Introduction -============ - -This is the documentation for Twig, the flexible, fast, and secure template -engine for PHP. - -If you have any exposure to other text-based template languages, such as -Smarty, Django, or Jinja, you should feel right at home with Twig. It's both -designer and developer friendly by sticking to PHP's principles and adding -functionality useful for templating environments. - -The key-features are... - -* *Fast*: Twig compiles templates down to plain optimized PHP code. The - overhead compared to regular PHP code was reduced to the very minimum. - -* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This - allows Twig to be used as a template language for applications where users - may modify the template design. - -* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the - developer to define their own custom tags and filters, and to create their own DSL. - -Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, -phpBB, Piwik, OroCRM; and many frameworks have support for it as well like -Slim, Yii, Laravel, Codeigniter and Kohana — just to name a few. - -Prerequisites -------------- - -Twig needs at least **PHP 7.0.0** to run. - -Installation ------------- - -The recommended way to install Twig is via Composer: - -.. code-block:: bash - - composer require "twig/twig:^2.0" - -.. note:: - - To learn more about the other installation methods, read the - :doc:`installation` chapter; it also explains how to install - the Twig C extension. - -Basic API Usage ---------------- - -This section gives you a brief introduction to the PHP API for Twig. - -.. code-block:: php - - require_once '/path/to/vendor/autoload.php'; - - $loader = new Twig_Loader_Array(array( - 'index' => 'Hello {{ name }}!', - )); - $twig = new Twig_Environment($loader); - - echo $twig->render('index', array('name' => 'Fabien')); - -Twig uses a loader (``Twig_Loader_Array``) to locate templates, and an -environment (``Twig_Environment``) to store the configuration. - -The ``render()`` method loads the template passed as a first argument and -renders it with the variables passed as a second argument. - -As templates are generally stored on the filesystem, Twig also comes with a -filesystem loader:: - - $loader = new Twig_Loader_Filesystem('/path/to/templates'); - $twig = new Twig_Environment($loader, array( - 'cache' => '/path/to/compilation_cache', - )); - - echo $twig->render('index.html', array('name' => 'Fabien')); diff --git a/vendor/twig/twig/doc/recipes.rst b/vendor/twig/twig/doc/recipes.rst deleted file mode 100644 index ee94c96..0000000 --- a/vendor/twig/twig/doc/recipes.rst +++ /dev/null @@ -1,527 +0,0 @@ -Recipes -======= - -.. _deprecation-notices: - -Displaying Deprecation Notices ------------------------------- - -Deprecated features generate deprecation notices (via a call to the -``trigger_error()`` PHP function). By default, they are silenced and never -displayed nor logged. - -To easily remove all deprecated feature usages from your templates, write and -run a script along the lines of the following:: - - require_once __DIR__.'/vendor/autoload.php'; - - $twig = create_your_twig_env(); - - $deprecations = new Twig_Util_DeprecationCollector($twig); - - print_r($deprecations->collectDir(__DIR__.'/templates')); - -The ``collectDir()`` method compiles all templates found in a directory, -catches deprecation notices, and return them. - -.. tip:: - - If your templates are not stored on the filesystem, use the ``collect()`` - method instead. ``collect()`` takes a ``Traversable`` which must return - template names as keys and template contents as values (as done by - ``Twig_Util_TemplateDirIterator``). - -However, this code won't find all deprecations (like using deprecated some Twig -classes). To catch all notices, register a custom error handler like the one -below:: - - $deprecations = array(); - set_error_handler(function ($type, $msg) use (&$deprecations) { - if (E_USER_DEPRECATED === $type) { - $deprecations[] = $msg; - } - }); - - // run your application - - print_r($deprecations); - -Note that most deprecation notices are triggered during **compilation**, so -they won't be generated when templates are already cached. - -.. tip:: - - If you want to manage the deprecation notices from your PHPUnit tests, have - a look at the `symfony/phpunit-bridge - `_ package, which eases the - process a lot. - -Making a Layout conditional ---------------------------- - -Working with Ajax means that the same content is sometimes displayed as is, -and sometimes decorated with a layout. As Twig layout template names can be -any valid expression, you can pass a variable that evaluates to ``true`` when -the request is made via Ajax and choose the layout accordingly: - -.. code-block:: jinja - - {% extends request.ajax ? "base_ajax.html" : "base.html" %} - - {% block content %} - This is the content to be displayed. - {% endblock %} - -Making an Include dynamic -------------------------- - -When including a template, its name does not need to be a string. For -instance, the name can depend on the value of a variable: - -.. code-block:: jinja - - {% include var ~ '_foo.html' %} - -If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be -rendered. - -As a matter of fact, the template name can be any valid expression, such as -the following: - -.. code-block:: jinja - - {% include var|default('index') ~ '_foo.html' %} - -Overriding a Template that also extends itself ----------------------------------------------- - -A template can be customized in two different ways: - -* *Inheritance*: A template *extends* a parent template and overrides some - blocks; - -* *Replacement*: If you use the filesystem loader, Twig loads the first - template it finds in a list of configured directories; a template found in a - directory *replaces* another one from a directory further in the list. - -But how do you combine both: *replace* a template that also extends itself -(aka a template in a directory further in the list)? - -Let's say that your templates are loaded from both ``.../templates/mysite`` -and ``.../templates/default`` in this order. The ``page.twig`` template, -stored in ``.../templates/default`` reads as follows: - -.. code-block:: jinja - - {# page.twig #} - {% extends "layout.twig" %} - - {% block content %} - {% endblock %} - -You can replace this template by putting a file with the same name in -``.../templates/mysite``. And if you want to extend the original template, you -might be tempted to write the following: - -.. code-block:: jinja - - {# page.twig in .../templates/mysite #} - {% extends "page.twig" %} {# from .../templates/default #} - -Of course, this will not work as Twig will always load the template from -``.../templates/mysite``. - -It turns out it is possible to get this to work, by adding a directory right -at the end of your template directories, which is the parent of all of the -other directories: ``.../templates`` in our case. This has the effect of -making every template file within our system uniquely addressable. Most of the -time you will use the "normal" paths, but in the special case of wanting to -extend a template with an overriding version of itself we can reference its -parent's full, unambiguous template path in the extends tag: - -.. code-block:: jinja - - {# page.twig in .../templates/mysite #} - {% extends "default/page.twig" %} {# from .../templates #} - -.. note:: - - This recipe was inspired by the following Django wiki page: - http://code.djangoproject.com/wiki/ExtendingTemplates - -Customizing the Syntax ----------------------- - -Twig allows some syntax customization for the block delimiters. It's not -recommended to use this feature as templates will be tied with your custom -syntax. But for specific projects, it can make sense to change the defaults. - -To change the block delimiters, you need to create your own lexer object:: - - $twig = new Twig_Environment(...); - - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'interpolation' => array('#{', '}'), - )); - $twig->setLexer($lexer); - -Here are some configuration example that simulates some other template engines -syntax:: - - // Ruby erb syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('<%#', '%>'), - 'tag_block' => array('<%', '%>'), - 'tag_variable' => array('<%=', '%>'), - )); - - // SGML Comment Syntax - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array(''), - 'tag_block' => array(''), - 'tag_variable' => array('${', '}'), - )); - - // Smarty like - $lexer = new Twig_Lexer($twig, array( - 'tag_comment' => array('{*', '*}'), - 'tag_block' => array('{', '}'), - 'tag_variable' => array('{$', '}'), - )); - -Using dynamic Object Properties -------------------------------- - -When Twig encounters a variable like ``article.title``, it tries to find a -``title`` public property in the ``article`` object. - -It also works if the property does not exist but is rather defined dynamically -thanks to the magic ``__get()`` method; you just need to also implement the -``__isset()`` magic method like shown in the following snippet of code:: - - class Article - { - public function __get($name) - { - if ('title' == $name) { - return 'The title'; - } - - // throw some kind of error - } - - public function __isset($name) - { - if ('title' == $name) { - return true; - } - - return false; - } - } - -Accessing the parent Context in Nested Loops --------------------------------------------- - -Sometimes, when using nested loops, you need to access the parent context. The -parent context is always accessible via the ``loop.parent`` variable. For -instance, if you have the following template data:: - - $data = array( - 'topics' => array( - 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), - 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), - ), - ); - -And the following template to display all messages in all topics: - -.. code-block:: jinja - - {% for topic, messages in topics %} - * {{ loop.index }}: {{ topic }} - {% for message in messages %} - - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} - {% endfor %} - {% endfor %} - -The output will be similar to: - -.. code-block:: text - - * 1: topic1 - - 1.1: The message 1 of topic 1 - - 1.2: The message 2 of topic 1 - * 2: topic2 - - 2.1: The message 1 of topic 2 - - 2.2: The message 2 of topic 2 - -In the inner loop, the ``loop.parent`` variable is used to access the outer -context. So, the index of the current ``topic`` defined in the outer for loop -is accessible via the ``loop.parent.loop.index`` variable. - -Defining undefined Functions and Filters on the Fly ---------------------------------------------------- - -When a function (or a filter) is not defined, Twig defaults to throw a -``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any -valid PHP callable) which should return a function (or a filter). - -For filters, register callbacks with ``registerUndefinedFilterCallback()``. -For functions, use ``registerUndefinedFunctionCallback()``:: - - // auto-register all native PHP functions as Twig functions - // don't try this at home as it's not secure at all! - $twig->registerUndefinedFunctionCallback(function ($name) { - if (function_exists($name)) { - return new Twig_Function($name, $name); - } - - return false; - }); - -If the callable is not able to return a valid function (or filter), it must -return ``false``. - -If you register more than one callback, Twig will call them in turn until one -does not return ``false``. - -.. tip:: - - As the resolution of functions and filters is done during compilation, - there is no overhead when registering these callbacks. - -Validating the Template Syntax ------------------------------- - -When template code is provided by a third-party (through a web interface for -instance), it might be interesting to validate the template syntax before -saving it. If the template code is stored in a `$template` variable, here is -how you can do it:: - - try { - $twig->parse($twig->tokenize(new Twig_Source($template))); - - // the $template is valid - } catch (Twig_Error_Syntax $e) { - // $template contains one or more syntax errors - } - -If you iterate over a set of files, you can pass the filename to the -``tokenize()`` method to get the filename in the exception message:: - - foreach ($files as $file) { - try { - $twig->parse($twig->tokenize(new Twig_Source($template, $file->getFilename(), $file))); - - // the $template is valid - } catch (Twig_Error_Syntax $e) { - // $template contains one or more syntax errors - } - } - -.. note:: - - This method won't catch any sandbox policy violations because the policy - is enforced during template rendering (as Twig needs the context for some - checks like allowed methods on objects). - -Refreshing modified Templates when OPcache or APC is enabled ------------------------------------------------------------- - -When using OPcache with ``opcache.validate_timestamps`` set to ``0`` or APC -with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing the template -cache won't update the cache. - -To get around this, force Twig to invalidate the bytecode cache:: - - $twig = new Twig_Environment($loader, array( - 'cache' => new Twig_Cache_Filesystem('/some/cache/path', Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION), - // ... - )); - -Reusing a stateful Node Visitor -------------------------------- - -When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to -visit *all* templates it compiles. If you need to keep some state information -around, you probably want to reset it when visiting a new template. - -This can be easily achieved with the following code:: - - protected $someTemplateState = array(); - - public function enterNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - // reset the state as we are entering a new template - $this->someTemplateState = array(); - } - - // ... - - return $node; - } - -Using a Database to store Templates ------------------------------------ - -If you are developing a CMS, templates are usually stored in a database. This -recipe gives you a simple PDO template loader you can use as a starting point -for your own. - -First, let's create a temporary in-memory SQLite3 database to work with:: - - $dbh = new PDO('sqlite::memory:'); - $dbh->exec('CREATE TABLE templates (name STRING, source STRING, last_modified INTEGER)'); - $base = '{% block content %}{% endblock %}'; - $index = ' - {% extends "base.twig" %} - {% block content %}Hello {{ name }}{% endblock %} - '; - $now = time(); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('base.twig', '$base', $now)"); - $dbh->exec("INSERT INTO templates (name, source, last_modified) VALUES ('index.twig', '$index', $now)"); - -We have created a simple ``templates`` table that hosts two templates: -``base.twig`` and ``index.twig``. - -Now, let's define a loader able to use this database:: - - class DatabaseTwigLoader implements Twig_LoaderInterface - { - protected $dbh; - - public function __construct(PDO $dbh) - { - $this->dbh = $dbh; - } - - public function getSourceContext($name) - { - if (false === $source = $this->getValue('source', $name)) { - throw new Twig_Error_Loader(sprintf('Template "%s" does not exist.', $name)); - } - - return new Twig_Source($source, $name); - } - - public function exists($name) - { - return $name === $this->getValue('name', $name); - } - - public function getCacheKey($name) - { - return $name; - } - - public function isFresh($name, $time) - { - if (false === $lastModified = $this->getValue('last_modified', $name)) { - return false; - } - - return $lastModified <= $time; - } - - protected function getValue($column, $name) - { - $sth = $this->dbh->prepare('SELECT '.$column.' FROM templates WHERE name = :name'); - $sth->execute(array(':name' => (string) $name)); - - return $sth->fetchColumn(); - } - } - -Finally, here is an example on how you can use it:: - - $loader = new DatabaseTwigLoader($dbh); - $twig = new Twig_Environment($loader); - - echo $twig->render('index.twig', array('name' => 'Fabien')); - -Using different Template Sources --------------------------------- - -This recipe is the continuation of the previous one. Even if you store the -contributed templates in a database, you might want to keep the original/base -templates on the filesystem. When templates can be loaded from different -sources, you need to use the ``Twig_Loader_Chain`` loader. - -As you can see in the previous recipe, we reference the template in the exact -same way as we would have done it with a regular filesystem loader. This is -the key to be able to mix and match templates coming from the database, the -filesystem, or any other loader for that matter: the template name should be a -logical name, and not the path from the filesystem:: - - $loader1 = new DatabaseTwigLoader($dbh); - $loader2 = new Twig_Loader_Array(array( - 'base.twig' => '{% block content %}{% endblock %}', - )); - $loader = new Twig_Loader_Chain(array($loader1, $loader2)); - - $twig = new Twig_Environment($loader); - - echo $twig->render('index.twig', array('name' => 'Fabien')); - -Now that the ``base.twig`` templates is defined in an array loader, you can -remove it from the database, and everything else will still work as before. - -Loading a Template from a String --------------------------------- - -From a template, you can easily load a template stored in a string via the -``template_from_string`` function (via the ``Twig_Extension_StringLoader`` -extension): - -.. code-block:: jinja - - {{ include(template_from_string("Hello {{ name }}")) }} - -From PHP, it's also possible to load a template stored in a string via -``Twig_Environment::createTemplate()``:: - - $template = $twig->createTemplate('hello {{ name }}'); - echo $template->render(array('name' => 'Fabien')); - -Using Twig and AngularJS in the same Templates ----------------------------------------------- - -Mixing different template syntaxes in the same file is not a recommended -practice as both AngularJS and Twig use the same delimiters in their syntax: -``{{`` and ``}}``. - -Still, if you want to use AngularJS and Twig in the same template, there are -two ways to make it work depending on the amount of AngularJS you need to -include in your templates: - -* Escaping the AngularJS delimiters by wrapping AngularJS sections with the - ``{% verbatim %}`` tag or by escaping each delimiter via ``{{ '{{' }}`` and - ``{{ '}}' }}``; - -* Changing the delimiters of one of the template engines (depending on which - engine you introduced last): - - * For AngularJS, change the interpolation tags using the - ``interpolateProvider`` service, for instance at the module initialization - time: - - .. code-block:: javascript - - angular.module('myApp', []).config(function($interpolateProvider) { - $interpolateProvider.startSymbol('{[').endSymbol(']}'); - }); - - * For Twig, change the delimiters via the ``tag_variable`` Lexer option: - - .. code-block:: php - - $env->setLexer(new Twig_Lexer($env, array( - 'tag_variable' => array('{[', ']}'), - ))); - -.. _callback: http://www.php.net/manual/en/function.is-callable.php diff --git a/vendor/twig/twig/doc/tags/autoescape.rst b/vendor/twig/twig/doc/tags/autoescape.rst deleted file mode 100644 index 4887f59..0000000 --- a/vendor/twig/twig/doc/tags/autoescape.rst +++ /dev/null @@ -1,61 +0,0 @@ -``autoescape`` -============== - -Whether automatic escaping is enabled or not, you can mark a section of a -template to be escaped or not by using the ``autoescape`` tag: - -.. code-block:: jinja - - {% autoescape %} - Everything will be automatically escaped in this block - using the HTML strategy - {% endautoescape %} - - {% autoescape 'html' %} - Everything will be automatically escaped in this block - using the HTML strategy - {% endautoescape %} - - {% autoescape 'js' %} - Everything will be automatically escaped in this block - using the js escaping strategy - {% endautoescape %} - - {% autoescape false %} - Everything will be outputted as is in this block - {% endautoescape %} - -When automatic escaping is enabled everything is escaped by default except for -values explicitly marked as safe. Those can be marked in the template by using -the :doc:`raw<../filters/raw>` filter: - -.. code-block:: jinja - - {% autoescape %} - {{ safe_value|raw }} - {% endautoescape %} - -Functions returning template data (like :doc:`macros` and -:doc:`parent<../functions/parent>`) always return safe markup. - -.. note:: - - Twig is smart enough to not escape an already escaped value by the - :doc:`escape<../filters/escape>` filter. - -.. note:: - - Twig does not escape static expressions: - - .. code-block:: jinja - - {% set hello = "Hello" %} - {{ hello }} - {{ "world" }} - - Will be rendered "Hello **world**". - -.. note:: - - The chapter :doc:`Twig for Developers<../api>` gives more information - about when and how automatic escaping is applied. diff --git a/vendor/twig/twig/doc/tags/block.rst b/vendor/twig/twig/doc/tags/block.rst deleted file mode 100644 index e380482..0000000 --- a/vendor/twig/twig/doc/tags/block.rst +++ /dev/null @@ -1,11 +0,0 @@ -``block`` -========= - -Blocks are used for inheritance and act as placeholders and replacements at -the same time. They are documented in detail in the documentation for the -:doc:`extends<../tags/extends>` tag. - -Block names should consist of alphanumeric characters, and underscores. Dashes -are not permitted. - -.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/vendor/twig/twig/doc/tags/do.rst b/vendor/twig/twig/doc/tags/do.rst deleted file mode 100644 index 54be615..0000000 --- a/vendor/twig/twig/doc/tags/do.rst +++ /dev/null @@ -1,9 +0,0 @@ -``do`` -====== - -The ``do`` tag works exactly like the regular variable expression (``{{ ... -}}``) just that it doesn't print anything: - -.. code-block:: jinja - - {% do 1 + 2 %} diff --git a/vendor/twig/twig/doc/tags/embed.rst b/vendor/twig/twig/doc/tags/embed.rst deleted file mode 100644 index 33c5dfe..0000000 --- a/vendor/twig/twig/doc/tags/embed.rst +++ /dev/null @@ -1,175 +0,0 @@ -``embed`` -========= - -The ``embed`` tag combines the behaviour of :doc:`include` and -:doc:`extends`. -It allows you to include another template's contents, just like ``include`` -does. But it also allows you to override any block defined inside the -included template, like when extending a template. - -Think of an embedded template as a "micro layout skeleton". - -.. code-block:: jinja - - {% embed "teasers_skeleton.twig" %} - {# These blocks are defined in "teasers_skeleton.twig" #} - {# and we override them right here: #} - {% block left_teaser %} - Some content for the left teaser box - {% endblock %} - {% block right_teaser %} - Some content for the right teaser box - {% endblock %} - {% endembed %} - -The ``embed`` tag takes the idea of template inheritance to the level of -content fragments. While template inheritance allows for "document skeletons", -which are filled with life by child templates, the ``embed`` tag allows you to -create "skeletons" for smaller units of content and re-use and fill them -anywhere you like. - -Since the use case may not be obvious, let's look at a simplified example. -Imagine a base template shared by multiple HTML pages, defining a single block -named "content": - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ │ │ - │ │ │ │ - │ │ (child template to │ │ - │ │ put content here) │ │ - │ │ │ │ - │ │ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -Some pages ("foo" and "bar") share the same content structure - -two vertically stacked boxes: - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ ┌─ block "top" ───┐ │ │ - │ │ │ │ │ │ - │ │ └─────────────────┘ │ │ - │ │ ┌─ block "bottom" ┐ │ │ - │ │ │ │ │ │ - │ │ └─────────────────┘ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -While other pages ("boom" and "baz") share a different content structure - -two boxes side by side: - -.. code-block:: text - - ┌─── page layout ─────────────────────┐ - │ │ - │ ┌── block "content" ──┐ │ - │ │ │ │ - │ │ ┌ block ┐ ┌ block ┐ │ │ - │ │ │"left" │ │"right"│ │ │ - │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ - │ │ └───────┘ └───────┘ │ │ - │ └─────────────────────┘ │ - │ │ - └─────────────────────────────────────┘ - -Without the ``embed`` tag, you have two ways to design your templates: - - * Create two "intermediate" base templates that extend the master layout - template: one with vertically stacked boxes to be used by the "foo" and - "bar" pages and another one with side-by-side boxes for the "boom" and - "baz" pages. - - * Embed the markup for the top/bottom and left/right boxes into each page - template directly. - -These two solutions do not scale well because they each have a major drawback: - - * The first solution may indeed work for this simplified example. But imagine - we add a sidebar, which may again contain different, recurring structures - of content. Now we would need to create intermediate base templates for - all occurring combinations of content structure and sidebar structure... - and so on. - - * The second solution involves duplication of common code with all its negative - consequences: any change involves finding and editing all affected copies - of the structure, correctness has to be verified for each copy, copies may - go out of sync by careless modifications etc. - -In such a situation, the ``embed`` tag comes in handy. The common layout -code can live in a single base template, and the two different content structures, -let's call them "micro layouts" go into separate templates which are embedded -as necessary: - -Page template ``foo.twig``: - -.. code-block:: jinja - - {% extends "layout_skeleton.twig" %} - - {% block content %} - {% embed "vertical_boxes_skeleton.twig" %} - {% block top %} - Some content for the top box - {% endblock %} - - {% block bottom %} - Some content for the bottom box - {% endblock %} - {% endembed %} - {% endblock %} - -And here is the code for ``vertical_boxes_skeleton.twig``: - -.. code-block:: html+jinja - -
    - {% block top %} - Top box default content - {% endblock %} -
    - -
    - {% block bottom %} - Bottom box default content - {% endblock %} -
    - -The goal of the ``vertical_boxes_skeleton.twig`` template being to factor -out the HTML markup for the boxes. - -The ``embed`` tag takes the exact same arguments as the ``include`` tag: - -.. code-block:: jinja - - {% embed "base" with {'foo': 'bar'} %} - ... - {% endembed %} - - {% embed "base" with {'foo': 'bar'} only %} - ... - {% endembed %} - - {% embed "base" ignore missing %} - ... - {% endembed %} - -.. warning:: - - As embedded templates do not have "names", auto-escaping strategies based - on the template name won't work as expected if you change the context (for - instance, if you embed a CSS/JavaScript template into an HTML one). In that - case, explicitly set the default auto-escaping strategy with the - ``autoescape`` tag. - -.. seealso:: :doc:`include<../tags/include>` diff --git a/vendor/twig/twig/doc/tags/extends.rst b/vendor/twig/twig/doc/tags/extends.rst deleted file mode 100644 index cbb33e1..0000000 --- a/vendor/twig/twig/doc/tags/extends.rst +++ /dev/null @@ -1,265 +0,0 @@ -``extends`` -=========== - -The ``extends`` tag can be used to extend a template from another one. - -.. note:: - - Like PHP, Twig does not support multiple inheritance. So you can only have - one extends tag called per rendering. However, Twig supports horizontal - :doc:`reuse`. - -Let's define a base template, ``base.html``, which defines a simple HTML -skeleton document: - -.. code-block:: html+jinja - - - - - {% block head %} - - {% block title %}{% endblock %} - My Webpage - {% endblock %} - - -
    {% block content %}{% endblock %}
    - - - - -In this example, the :doc:`block` tags define four blocks that child -templates can fill in. - -All the ``block`` tag does is to tell the template engine that a child -template may override those portions of the template. - -Child Template --------------- - -A child template might look like this: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}Index{% endblock %} - {% block head %} - {{ parent() }} - - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome on my awesome homepage. -

    - {% endblock %} - -The ``extends`` tag is the key here. It tells the template engine that this -template "extends" another template. When the template system evaluates this -template, first it locates the parent. The extends tag should be the first tag -in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -You can't define multiple ``block`` tags with the same name in the same -template. This limitation exists because a block tag works in "both" -directions. That is, a block tag doesn't just provide a hole to fill - it also -defines the content that fills the hole in the *parent*. If there were two -similarly-named ``block`` tags in a template, that template's parent wouldn't -know which one of the blocks' content to use. - -If you want to print a block multiple times you can however use the -``block`` function: - -.. code-block:: jinja - - {% block title %}{% endblock %} -

    {{ block('title') }}

    - {% block body %}{% endblock %} - -Parent Blocks -------------- - -It's possible to render the contents of the parent block by using the -:doc:`parent<../functions/parent>` function. This gives back the results of -the parent block: - -.. code-block:: jinja - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -Named Block End-Tags --------------------- - -Twig allows you to put the name of the block after the end tag for better -readability: - -.. code-block:: jinja - - {% block sidebar %} - {% block inner_sidebar %} - ... - {% endblock inner_sidebar %} - {% endblock sidebar %} - -Of course, the name after the ``endblock`` word must match the block name. - -Block Nesting and Scope ------------------------ - -Blocks can be nested for more complex layouts. Per default, blocks have access -to variables from outer scopes: - -.. code-block:: jinja - - {% for item in seq %} -
  • {% block loop_item %}{{ item }}{% endblock %}
  • - {% endfor %} - -Block Shortcuts ---------------- - -For blocks with little content, it's possible to use a shortcut syntax. The -following constructs do the same thing: - -.. code-block:: jinja - - {% block title %} - {{ page_title|title }} - {% endblock %} - -.. code-block:: jinja - - {% block title page_title|title %} - -Dynamic Inheritance -------------------- - -Twig supports dynamic inheritance by using a variable as the base template: - -.. code-block:: jinja - - {% extends some_var %} - -If the variable evaluates to a ``Twig_Template`` or a ``Twig_TemplateWrapper`` -instance, Twig will use it as the parent template:: - - // {% extends layout %} - - $layout = $twig->load('some_layout_template.twig'); - - $twig->display('template.twig', array('layout' => $layout)); - -You can also provide a list of templates that are checked for existence. The -first template that exists will be used as a parent: - -.. code-block:: jinja - - {% extends ['layout.html', 'base_layout.html'] %} - -Conditional Inheritance ------------------------ - -As the template name for the parent can be any valid Twig expression, it's -possible to make the inheritance mechanism conditional: - -.. code-block:: jinja - - {% extends standalone ? "minimum.html" : "base.html" %} - -In this example, the template will extend the "minimum.html" layout template -if the ``standalone`` variable evaluates to ``true``, and "base.html" -otherwise. - -How do blocks work? -------------------- - -A block provides a way to change how a certain part of a template is rendered -but it does not interfere in any way with the logic around it. - -Let's take the following example to illustrate how a block works and more -importantly, how it does not work: - -.. code-block:: jinja - - {# base.twig #} - - {% for post in posts %} - {% block post %} -

    {{ post.title }}

    -

    {{ post.body }}

    - {% endblock %} - {% endfor %} - -If you render this template, the result would be exactly the same with or -without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way -to make it overridable by a child template: - -.. code-block:: jinja - - {# child.twig #} - - {% extends "base.twig" %} - - {% block post %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endblock %} - -Now, when rendering the child template, the loop is going to use the block -defined in the child template instead of the one defined in the base one; the -executed template is then equivalent to the following one: - -.. code-block:: jinja - - {% for post in posts %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endfor %} - -Let's take another example: a block included within an ``if`` statement: - -.. code-block:: jinja - - {% if posts is empty %} - {% block head %} - {{ parent() }} - - - {% endblock head %} - {% endif %} - -Contrary to what you might think, this template does not define a block -conditionally; it just makes overridable by a child template the output of -what will be rendered when the condition is ``true``. - -If you want the output to be displayed conditionally, use the following -instead: - -.. code-block:: jinja - - {% block head %} - {{ parent() }} - - {% if posts is empty %} - - {% endif %} - {% endblock head %} - -.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/vendor/twig/twig/doc/tags/filter.rst b/vendor/twig/twig/doc/tags/filter.rst deleted file mode 100644 index 82ca5c6..0000000 --- a/vendor/twig/twig/doc/tags/filter.rst +++ /dev/null @@ -1,21 +0,0 @@ -``filter`` -========== - -Filter sections allow you to apply regular Twig filters on a block of template -data. Just wrap the code in the special ``filter`` section: - -.. code-block:: jinja - - {% filter upper %} - This text becomes uppercase - {% endfilter %} - -You can also chain filters: - -.. code-block:: jinja - - {% filter lower|escape %} - SOME TEXT - {% endfilter %} - - {# outputs "<strong>some text</strong>" #} diff --git a/vendor/twig/twig/doc/tags/flush.rst b/vendor/twig/twig/doc/tags/flush.rst deleted file mode 100644 index 22f09b1..0000000 --- a/vendor/twig/twig/doc/tags/flush.rst +++ /dev/null @@ -1,14 +0,0 @@ -``flush`` -========= - -The ``flush`` tag tells Twig to flush the output buffer: - -.. code-block:: jinja - - {% flush %} - -.. note:: - - Internally, Twig uses the PHP `flush`_ function. - -.. _`flush`: http://php.net/flush diff --git a/vendor/twig/twig/doc/tags/for.rst b/vendor/twig/twig/doc/tags/for.rst deleted file mode 100644 index 038ef8b..0000000 --- a/vendor/twig/twig/doc/tags/for.rst +++ /dev/null @@ -1,169 +0,0 @@ -``for`` -======= - -Loop over each item in a sequence. For example, to display a list of users -provided in a variable called ``users``: - -.. code-block:: jinja - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -.. note:: - - A sequence can be either an array or an object implementing the - ``Traversable`` interface. - -If you do need to iterate over a sequence of numbers, you can use the ``..`` -operator: - -.. code-block:: jinja - - {% for i in 0..10 %} - * {{ i }} - {% endfor %} - -The above snippet of code would print all numbers from 0 to 10. - -It can be also useful with letters: - -.. code-block:: jinja - - {% for letter in 'a'..'z' %} - * {{ letter }} - {% endfor %} - -The ``..`` operator can take any expression at both sides: - -.. code-block:: jinja - - {% for letter in 'a'|upper..'z'|upper %} - * {{ letter }} - {% endfor %} - -.. tip: - - If you need a step different from 1, you can use the ``range`` function - instead. - -The `loop` variable -------------------- - -Inside of a ``for`` loop block you can access some special variables: - -===================== ============================================================= -Variable Description -===================== ============================================================= -``loop.index`` The current iteration of the loop. (1 indexed) -``loop.index0`` The current iteration of the loop. (0 indexed) -``loop.revindex`` The number of iterations from the end of the loop (1 indexed) -``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) -``loop.first`` True if first iteration -``loop.last`` True if last iteration -``loop.length`` The number of items in the sequence -``loop.parent`` The parent context -===================== ============================================================= - -.. code-block:: jinja - - {% for user in users %} - {{ loop.index }} - {{ user.username }} - {% endfor %} - -.. note:: - - The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and - ``loop.last`` variables are only available for PHP arrays, or objects that - implement the ``Countable`` interface. They are also not available when - looping with a condition. - -Adding a condition ------------------- - -Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You -can however filter the sequence during iteration which allows you to skip -items. The following example skips all the users which are not active: - -.. code-block:: jinja - -
      - {% for user in users if user.active %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -The advantage is that the special loop variable will count correctly thus not -counting the users not iterated over. Keep in mind that properties like -``loop.last`` will not be defined when using loop conditions. - -.. note:: - - Using the ``loop`` variable within the condition is not recommended as it - will probably not be doing what you expect it to. For instance, adding a - condition like ``loop.index > 4`` won't work as the index is only - incremented when the condition is true (so the condition will never - match). - -The `else` Clause ------------------ - -If no iteration took place because the sequence was empty, you can render a -replacement block by using ``else``: - -.. code-block:: jinja - -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% else %} -
    • no user found
    • - {% endfor %} -
    - -Iterating over Keys -------------------- - -By default, a loop iterates over the values of the sequence. You can iterate -on keys by using the ``keys`` filter: - -.. code-block:: jinja - -

    Members

    -
      - {% for key in users|keys %} -
    • {{ key }}
    • - {% endfor %} -
    - -Iterating over Keys and Values ------------------------------- - -You can also access both keys and values: - -.. code-block:: jinja - -

    Members

    -
      - {% for key, user in users %} -
    • {{ key }}: {{ user.username|e }}
    • - {% endfor %} -
    - -Iterating over a Subset ------------------------ - -You might want to iterate over a subset of values. This can be achieved using -the :doc:`slice <../filters/slice>` filter: - -.. code-block:: jinja - -

    Top Ten Members

    -
      - {% for user in users|slice(0, 10) %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    diff --git a/vendor/twig/twig/doc/tags/from.rst b/vendor/twig/twig/doc/tags/from.rst deleted file mode 100644 index 39334fd..0000000 --- a/vendor/twig/twig/doc/tags/from.rst +++ /dev/null @@ -1,8 +0,0 @@ -``from`` -======== - -The ``from`` tag imports :doc:`macro<../tags/macro>` names into the current -namespace. The tag is documented in detail in the documentation for the -:doc:`import<../tags/import>` tag. - -.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/vendor/twig/twig/doc/tags/if.rst b/vendor/twig/twig/doc/tags/if.rst deleted file mode 100644 index 12edf98..0000000 --- a/vendor/twig/twig/doc/tags/if.rst +++ /dev/null @@ -1,76 +0,0 @@ -``if`` -====== - -The ``if`` statement in Twig is comparable with the if statements of PHP. - -In the simplest form you can use it to test if an expression evaluates to -``true``: - -.. code-block:: jinja - - {% if online == false %} -

    Our website is in maintenance mode. Please, come back later.

    - {% endif %} - -You can also test if an array is not empty: - -.. code-block:: jinja - - {% if users %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -.. note:: - - If you want to test if the variable is defined, use ``if users is - defined`` instead. - -You can also use ``not`` to check for values that evaluate to ``false``: - -.. code-block:: jinja - - {% if not user.subscribed %} -

    You are not subscribed to our mailing list.

    - {% endif %} - -For multiple conditions, ``and`` and ``or`` can be used: - -.. code-block:: jinja - - {% if temperature > 18 and temperature < 27 %} -

    It's a nice day for a walk in the park.

    - {% endif %} - -For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can -use more complex ``expressions`` there too: - -.. code-block:: jinja - - {% if kenny.sick %} - Kenny is sick. - {% elseif kenny.dead %} - You killed Kenny! You bastard!!! - {% else %} - Kenny looks okay --- so far - {% endif %} - -.. note:: - - The rules to determine if an expression is ``true`` or ``false`` are the - same as in PHP; here are the edge cases rules: - - ====================== ==================== - Value Boolean evaluation - ====================== ==================== - empty string false - numeric zero false - whitespace-only string true - empty array false - null false - non-empty array true - object true - ====================== ==================== diff --git a/vendor/twig/twig/doc/tags/import.rst b/vendor/twig/twig/doc/tags/import.rst deleted file mode 100644 index 21a1e19..0000000 --- a/vendor/twig/twig/doc/tags/import.rst +++ /dev/null @@ -1,57 +0,0 @@ -``import`` -========== - -Twig supports putting often used code into :doc:`macros<../tags/macro>`. These -macros can go into different templates and get imported from there. - -There are two ways to import templates. You can import the complete template -into a variable or request specific macros from it. - -Imagine we have a helper module that renders forms (called ``forms.html``): - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - - {% macro textarea(name, value, rows, cols) %} - - {% endmacro %} - -The easiest and most flexible is importing the whole module into a variable. -That way you can access the attributes: - -.. code-block:: jinja - - {% import 'forms.html' as forms %} - -
    -
    Username
    -
    {{ forms.input('username') }}
    -
    Password
    -
    {{ forms.input('password', null, 'password') }}
    -
    -

    {{ forms.textarea('comment') }}

    - -Alternatively you can import names from the template into the current -namespace: - -.. code-block:: jinja - - {% from 'forms.html' import input as input_field, textarea %} - -
    -
    Username
    -
    {{ input_field('username') }}
    -
    Password
    -
    {{ input_field('password', '', 'password') }}
    -
    -

    {{ textarea('comment') }}

    - -.. tip:: - - To import macros from the current file, use the special ``_self`` variable - for the source. - -.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/vendor/twig/twig/doc/tags/include.rst b/vendor/twig/twig/doc/tags/include.rst deleted file mode 100644 index 6049fee..0000000 --- a/vendor/twig/twig/doc/tags/include.rst +++ /dev/null @@ -1,80 +0,0 @@ -``include`` -=========== - -The ``include`` statement includes a template and returns the rendered content -of that file into the current namespace: - -.. code-block:: jinja - - {% include 'header.html' %} - Body - {% include 'footer.html' %} - -Included templates have access to the variables of the active context. - -If you are using the filesystem loader, the templates are looked for in the -paths defined by it. - -You can add additional variables by passing them after the ``with`` keyword: - -.. code-block:: jinja - - {# template.html will have access to the variables from the current context and the additional ones provided #} - {% include 'template.html' with {'foo': 'bar'} %} - - {% set vars = {'foo': 'bar'} %} - {% include 'template.html' with vars %} - -You can disable access to the context by appending the ``only`` keyword: - -.. code-block:: jinja - - {# only the foo variable will be accessible #} - {% include 'template.html' with {'foo': 'bar'} only %} - -.. code-block:: jinja - - {# no variables will be accessible #} - {% include 'template.html' only %} - -.. tip:: - - When including a template created by an end user, you should consider - sandboxing it. More information in the :doc:`Twig for Developers<../api>` - chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. - -The template name can be any valid Twig expression: - -.. code-block:: jinja - - {% include some_var %} - {% include ajax ? 'ajax.html' : 'not_ajax.html' %} - -And if the expression evaluates to a ``Twig_Template`` or a -``Twig_TemplateWrapper`` instance, Twig will use it directly:: - - // {% include template %} - - $template = $twig->load('some_template.twig'); - - $twig->display('template.twig', array('template' => $template)); - -You can mark an include with ``ignore missing`` in which case Twig will ignore -the statement if the template to be included does not exist. It has to be -placed just after the template name. Here some valid examples: - -.. code-block:: jinja - - {% include 'sidebar.html' ignore missing %} - {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} - {% include 'sidebar.html' ignore missing only %} - -You can also provide a list of templates that are checked for existence before -inclusion. The first template that exists will be included: - -.. code-block:: jinja - - {% include ['page_detailed.html', 'page.html'] %} - -If ``ignore missing`` is given, it will fall back to rendering nothing if none -of the templates exist, otherwise it will throw an exception. diff --git a/vendor/twig/twig/doc/tags/index.rst b/vendor/twig/twig/doc/tags/index.rst deleted file mode 100644 index dbe2459..0000000 --- a/vendor/twig/twig/doc/tags/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -Tags -==== - -.. toctree:: - :maxdepth: 1 - - autoescape - block - do - embed - extends - filter - flush - for - from - if - import - include - macro - sandbox - set - spaceless - use - verbatim - with diff --git a/vendor/twig/twig/doc/tags/macro.rst b/vendor/twig/twig/doc/tags/macro.rst deleted file mode 100644 index cb2d07b..0000000 --- a/vendor/twig/twig/doc/tags/macro.rst +++ /dev/null @@ -1,96 +0,0 @@ -``macro`` -========= - -Macros are comparable with functions in regular programming languages. They -are useful to put often used HTML idioms into reusable elements to not repeat -yourself. - -Here is a small example of a macro that renders a form element: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - -Macros differ from native PHP functions in a few ways: - -* Default argument values are defined by using the ``default`` filter in the - macro body; - -* Arguments of a macro are always optional. - -* If extra positional arguments are passed to a macro, they end up in the - special ``varargs`` variable as a list of values. - -But as with PHP functions, macros don't have access to the current template -variables. - -.. tip:: - - You can pass the whole context as an argument by using the special - ``_context`` variable. - -Import ------- - -Macros can be defined in any template, and need to be "imported" before being -used (see the documentation for the :doc:`import<../tags/import>` tag for more -information): - -.. code-block:: jinja - - {% import "forms.html" as forms %} - -The above ``import`` call imports the "forms.html" file (which can contain only -macros, or a template and some macros), and import the functions as items of -the ``forms`` variable. - -The macro can then be called at will: - -.. code-block:: jinja - -

    {{ forms.input('username') }}

    -

    {{ forms.input('password', null, 'password') }}

    - -If macros are defined and used in the same template, you can use the -special ``_self`` variable to import them: - -.. code-block:: jinja - - {% import _self as forms %} - -

    {{ forms.input('username') }}

    - -When you want to use a macro in another macro from the same file, you need to -import it locally: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - - {% macro wrapped_input(name, value, type, size) %} - {% import _self as forms %} - -
    - {{ forms.input(name, value, type, size) }} -
    - {% endmacro %} - -Named Macro End-Tags --------------------- - -Twig allows you to put the name of the macro after the end tag for better -readability: - -.. code-block:: jinja - - {% macro input() %} - ... - {% endmacro input %} - -Of course, the name after the ``endmacro`` word must match the macro name. - -.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/vendor/twig/twig/doc/tags/sandbox.rst b/vendor/twig/twig/doc/tags/sandbox.rst deleted file mode 100644 index e186726..0000000 --- a/vendor/twig/twig/doc/tags/sandbox.rst +++ /dev/null @@ -1,30 +0,0 @@ -``sandbox`` -=========== - -The ``sandbox`` tag can be used to enable the sandboxing mode for an included -template, when sandboxing is not enabled globally for the Twig environment: - -.. code-block:: jinja - - {% sandbox %} - {% include 'user.html' %} - {% endsandbox %} - -.. warning:: - - The ``sandbox`` tag is only available when the sandbox extension is - enabled (see the :doc:`Twig for Developers<../api>` chapter). - -.. note:: - - The ``sandbox`` tag can only be used to sandbox an include tag and it - cannot be used to sandbox a section of a template. The following example - won't work: - - .. code-block:: jinja - - {% sandbox %} - {% for i in 1..2 %} - {{ i }} - {% endfor %} - {% endsandbox %} diff --git a/vendor/twig/twig/doc/tags/set.rst b/vendor/twig/twig/doc/tags/set.rst deleted file mode 100644 index 3eba239..0000000 --- a/vendor/twig/twig/doc/tags/set.rst +++ /dev/null @@ -1,78 +0,0 @@ -``set`` -======= - -Inside code blocks you can also assign values to variables. Assignments use -the ``set`` tag and can have multiple targets. - -Here is how you can assign the ``bar`` value to the ``foo`` variable: - -.. code-block:: jinja - - {% set foo = 'bar' %} - -After the ``set`` call, the ``foo`` variable is available in the template like -any other ones: - -.. code-block:: jinja - - {# displays bar #} - {{ foo }} - -The assigned value can be any valid :ref:`Twig expressions -`: - -.. code-block:: jinja - - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - {% set foo = 'foo' ~ 'bar' %} - -Several variables can be assigned in one block: - -.. code-block:: jinja - - {% set foo, bar = 'foo', 'bar' %} - - {# is equivalent to #} - - {% set foo = 'foo' %} - {% set bar = 'bar' %} - -The ``set`` tag can also be used to 'capture' chunks of text: - -.. code-block:: jinja - - {% set foo %} - - {% endset %} - -.. caution:: - - If you enable automatic output escaping, Twig will only consider the - content to be safe when capturing chunks of text. - -.. note:: - - Note that loops are scoped in Twig; therefore a variable declared inside a - ``for`` loop is not accessible outside the loop itself: - - .. code-block:: jinja - - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is NOT available #} - - If you want to access the variable, just declare it before the loop: - - .. code-block:: jinja - - {% set foo = "" %} - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is available #} diff --git a/vendor/twig/twig/doc/tags/spaceless.rst b/vendor/twig/twig/doc/tags/spaceless.rst deleted file mode 100644 index b39cb27..0000000 --- a/vendor/twig/twig/doc/tags/spaceless.rst +++ /dev/null @@ -1,37 +0,0 @@ -``spaceless`` -============= - -Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not -whitespace within HTML tags or whitespace in plain text: - -.. code-block:: jinja - - {% spaceless %} -
    - foo -
    - {% endspaceless %} - - {# output will be
    foo
    #} - -This tag is not meant to "optimize" the size of the generated HTML content but -merely to avoid extra whitespace between HTML tags to avoid browser rendering -quirks under some circumstances. - -.. tip:: - - If you want to optimize the size of the generated HTML content, gzip - compress the output instead. - -.. tip:: - - If you want to create a tag that actually removes all extra whitespace in - an HTML string, be warned that this is not as easy as it seems to be - (think of ``textarea`` or ``pre`` tags for instance). Using a third-party - library like Tidy is probably a better idea. - -.. tip:: - - For more information on whitespace control, read the - :ref:`dedicated section ` of the documentation and learn how - you can also use the whitespace control modifier on your tags. diff --git a/vendor/twig/twig/doc/tags/use.rst b/vendor/twig/twig/doc/tags/use.rst deleted file mode 100644 index e15d4ae..0000000 --- a/vendor/twig/twig/doc/tags/use.rst +++ /dev/null @@ -1,117 +0,0 @@ -``use`` -======= - -.. note:: - - Horizontal reuse is an advanced Twig feature that is hardly ever needed in - regular templates. It is mainly used by projects that need to make - template blocks reusable without using inheritance. - -Template inheritance is one of the most powerful features of Twig but it is -limited to single inheritance; a template can only extend one other template. -This limitation makes template inheritance simple to understand and easy to -debug: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -Horizontal reuse is a way to achieve the same goal as multiple inheritance, -but without the associated complexity: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -The ``use`` statement tells Twig to import the blocks defined in -``blocks.html`` into the current template (it's like macros, but for blocks): - -.. code-block:: jinja - - {# blocks.html #} - - {% block sidebar %}{% endblock %} - -In this example, the ``use`` statement imports the ``sidebar`` block into the -main template. The code is mostly equivalent to the following one (the -imported blocks are not outputted automatically): - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -.. note:: - - The ``use`` tag only imports a template if it does not extend another - template, if it does not define macros, and if the body is empty. But it - can *use* other templates. - -.. note:: - - Because ``use`` statements are resolved independently of the context - passed to the template, the template reference cannot be an expression. - -The main template can also override any imported block. If the template -already defines the ``sidebar`` block, then the one defined in ``blocks.html`` -is ignored. To avoid name conflicts, you can rename imported blocks: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -The ``parent()`` function automatically determines the correct inheritance -tree, so it can be used when overriding a block defined in an imported -template: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block sidebar %} - {{ parent() }} - {% endblock %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -In this example, ``parent()`` will correctly call the ``sidebar`` block from -the ``blocks.html`` template. - -.. tip:: - - Renaming allows you to simulate inheritance by calling the "parent" block: - - .. code-block:: jinja - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as parent_sidebar %} - - {% block sidebar %} - {{ block('parent_sidebar') }} - {% endblock %} - -.. note:: - - You can use as many ``use`` statements as you want in any given template. - If two imported templates define the same block, the latest one wins. diff --git a/vendor/twig/twig/doc/tags/verbatim.rst b/vendor/twig/twig/doc/tags/verbatim.rst deleted file mode 100644 index 64fef20..0000000 --- a/vendor/twig/twig/doc/tags/verbatim.rst +++ /dev/null @@ -1,16 +0,0 @@ -``verbatim`` -============ - -The ``verbatim`` tag marks sections as being raw text that should not be -parsed. For example to put Twig syntax as example into a template you can use -this snippet: - -.. code-block:: jinja - - {% verbatim %} -
      - {% for item in seq %} -
    • {{ item }}
    • - {% endfor %} -
    - {% endverbatim %} diff --git a/vendor/twig/twig/doc/tags/with.rst b/vendor/twig/twig/doc/tags/with.rst deleted file mode 100644 index 41cb727..0000000 --- a/vendor/twig/twig/doc/tags/with.rst +++ /dev/null @@ -1,41 +0,0 @@ -``with`` -======== - -Use the ``with`` tag to create a new inner scope. Variables set within this -scope are not visible outside of the scope: - -.. code-block:: jinja - - {% with %} - {% set foo = 42 %} - {{ foo }} foo is 42 here - {% endwith %} - foo is not visible here any longer - -Instead of defining variables at the beginning of the scope, you can pass a -hash of variables you want to define in the ``with`` tag; the previous example -is equivalent to the following one: - -.. code-block:: jinja - - {% with { foo: 42 } %} - {{ foo }} foo is 42 here - {% endwith %} - foo is not visible here any longer - - {# it works with any expression that resolves to a hash #} - {% set vars = { foo: 42 } %} - {% with vars %} - ... - {% endwith %} - -By default, the inner scope has access to the outer scope context; you can -disable this behavior by appending the ``only`` keyword: - -.. code-block:: jinja - - {% set bar = 'bar' %} - {% with { foo: 42 } only %} - {# only foo is defined #} - {# bar is not defined #} - {% endwith %} diff --git a/vendor/twig/twig/doc/templates.rst b/vendor/twig/twig/doc/templates.rst deleted file mode 100644 index 2cdbbdc..0000000 --- a/vendor/twig/twig/doc/templates.rst +++ /dev/null @@ -1,890 +0,0 @@ -Twig for Template Designers -=========================== - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Twig templates. - -Synopsis --------- - -A template is simply a text file. It can generate any text-based format (HTML, -XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or -``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and **tags**, which control the logic -of the template. - -Below is a minimal template that illustrates a few basics. We will cover further -details later on: - -.. code-block:: html+jinja - - - - - My Webpage - - - - -

    My Webpage

    - {{ a_variable }} - - - -There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops, the latter prints the -result of an expression to the template. - -IDEs Integration ----------------- - -Many IDEs support syntax highlighting and auto-completion for Twig: - -* *Textmate* via the `Twig bundle`_ -* *Vim* via the `Jinja syntax plugin`_ or the `vim-twig plugin`_ -* *Netbeans* via the `Twig syntax plugin`_ (until 7.1, native as of 7.2) -* *PhpStorm* (native as of 2.1) -* *Eclipse* via the `Twig plugin`_ -* *Sublime Text* via the `Twig bundle`_ -* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) -* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ -* *Coda 2* via the `other Twig syntax mode`_ -* *Komodo* and *Komodo Edit* via the Twig highlight/syntax check mode -* *Notepad++* via the `Notepad++ Twig Highlighter`_ -* *Emacs* via `web-mode.el`_ -* *Atom* via the `PHP-twig for atom`_ -* *Visual Studio Code* via the `Twig pack`_ - -Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates -from a browser; it supports all versions of Twig. - -Variables ---------- - -The application passes variables to the templates for manipulation in the -template. Variables may have attributes or elements you can access, -too. The visual representation of a variable depends heavily on the application providing -it. - -You can use a dot (``.``) to access attributes of a variable (methods or -properties of a PHP object, or items of a PHP array), or the so-called -"subscript" syntax (``[]``): - -.. code-block:: jinja - - {{ foo.bar }} - {{ foo['bar'] }} - -When the attribute contains special characters (like ``-`` that would be -interpreted as the minus operator), use the ``attribute`` function instead to -access the variable attribute: - -.. code-block:: jinja - - {# equivalent to the non-working foo.data-foo #} - {{ attribute(foo, 'data-foo') }} - -.. note:: - - It's important to know that the curly braces are *not* part of the - variable but the print statement. When accessing variables inside tags, - don't put the braces around them. - -If a variable or attribute does not exist, you will receive a ``null`` value -when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` -is set, Twig will throw an error (see :ref:`environment options`). - -.. sidebar:: Implementation - - For convenience's sake ``foo.bar`` does the following things on the PHP - layer: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid method - (even if ``bar`` is the constructor - use ``__construct()`` instead); - * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; - * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; - * if not, and if ``foo`` is an object, check that ``hasBar`` is a valid method; - * if not, return a ``null`` value. - - ``foo['bar']`` on the other hand only works with PHP arrays: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, return a ``null`` value. - -.. note:: - - If you want to access a dynamic attribute of a variable, use the - :doc:`attribute` function instead. - -Global Variables -~~~~~~~~~~~~~~~~ - -The following variables are always available in templates: - -* ``_self``: references the current template name; -* ``_context``: references the current context; -* ``_charset``: references the current charset. - -Setting Variables -~~~~~~~~~~~~~~~~~ - -You can assign values to variables inside code blocks. Assignments use the -:doc:`set` tag: - -.. code-block:: jinja - - {% set foo = 'foo' %} - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - -Filters -------- - -Variables can be modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. - -The following example removes all HTML tags from the ``name`` and title-cases -it: - -.. code-block:: jinja - - {{ name|striptags|title }} - -Filters that accept arguments have parentheses around the arguments. This -example will join a list by commas: - -.. code-block:: jinja - - {{ list|join(', ') }} - -To apply a filter on a section of code, wrap it in the -:doc:`filter` tag: - -.. code-block:: jinja - - {% filter upper %} - This text becomes uppercase - {% endfilter %} - -Go to the :doc:`filters` page to learn more about built-in -filters. - -Functions ---------- - -Functions can be called to generate content. Functions are called by their -name followed by parentheses (``()``) and may have arguments. - -For instance, the ``range`` function returns a list containing an arithmetic -progression of integers: - -.. code-block:: jinja - - {% for i in range(0, 3) %} - {{ i }}, - {% endfor %} - -Go to the :doc:`functions` page to learn more about the -built-in functions. - -Named Arguments ---------------- - -.. code-block:: jinja - - {% for i in range(low=1, high=10, step=2) %} - {{ i }}, - {% endfor %} - -Using named arguments makes your templates more explicit about the meaning of -the values you pass as arguments: - -.. code-block:: jinja - - {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} - - {# versus #} - - {{ data|convert_encoding(from='iso-2022-jp', to='UTF-8') }} - -Named arguments also allow you to skip some arguments for which you don't want -to change the default value: - -.. code-block:: jinja - - {# the first argument is the date format, which defaults to the global date format if null is passed #} - {{ "now"|date(null, "Europe/Paris") }} - - {# or skip the format value by using a named argument for the time zone #} - {{ "now"|date(timezone="Europe/Paris") }} - -You can also use both positional and named arguments in one call, in which -case positional arguments must always come before named arguments: - -.. code-block:: jinja - - {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} - -.. tip:: - - Each function and filter documentation page has a section where the names - of all arguments are listed when supported. - -Control Structure ------------------ - -A control structure refers to all those things that control the flow of a -program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as -well as things like blocks. Control structures appear inside ``{% ... %}`` -blocks. - -For example, to display a list of users provided in a variable called -``users``, use the :doc:`for` tag: - -.. code-block:: jinja - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -The :doc:`if` tag can be used to test an expression: - -.. code-block:: jinja - - {% if users|length > 0 %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -Go to the :doc:`tags` page to learn more about the built-in tags. - -Comments --------- - -To comment-out part of a line in a template, use the comment syntax ``{# ... -#}``. This is useful for debugging or to add information for other template -designers or yourself: - -.. code-block:: jinja - - {# note: disabled template because we no longer use this - {% for user in users %} - ... - {% endfor %} - #} - -Including other Templates -------------------------- - -The :doc:`include` function is useful to include a template -and return the rendered content of that template into the current one: - -.. code-block:: jinja - - {{ include('sidebar.html') }} - -By default, included templates have access to the same context as the template -which includes them. This means that any variable defined in the main template -will be available in the included template too: - -.. code-block:: jinja - - {% for box in boxes %} - {{ include('render_box.html') }} - {% endfor %} - -The included template ``render_box.html`` is able to access the ``box`` variable. - -The filename of the template depends on the template loader. For instance, the -``Twig_Loader_Filesystem`` allows you to access other templates by giving the -filename. You can access templates in subdirectories with a slash: - -.. code-block:: jinja - - {{ include('sections/articles/sidebar.html') }} - -This behavior depends on the application embedding Twig. - -Template Inheritance --------------------- - -The most powerful part of Twig is template inheritance. Template inheritance -allows you to build a base "skeleton" template that contains all the common -elements of your site and defines **blocks** that child templates can -override. - -Sounds complicated but it is very basic. It's easier to understand it by -starting with an example. - -Let's define a base template, ``base.html``, which defines a simple HTML -skeleton document that you might use for a simple two-column page: - -.. code-block:: html+jinja - - - - - {% block head %} - - {% block title %}{% endblock %} - My Webpage - {% endblock %} - - -
    {% block content %}{% endblock %}
    - - - - -In this example, the :doc:`block` tags define four blocks that -child templates can fill in. All the ``block`` tag does is to tell the -template engine that a child template may override those portions of the -template. - -A child template might look like this: - -.. code-block:: jinja - - {% extends "base.html" %} - - {% block title %}Index{% endblock %} - {% block head %} - {{ parent() }} - - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome to my awesome homepage. -

    - {% endblock %} - -The :doc:`extends` tag is the key here. It tells the template -engine that this template "extends" another template. When the template system -evaluates this template, first it locates the parent. The extends tag should -be the first tag in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -It's possible to render the contents of the parent block by using the -:doc:`parent` function. This gives back the results of the -parent block: - -.. code-block:: jinja - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -.. tip:: - - The documentation page for the :doc:`extends` tag describes - more advanced features like block nesting, scope, dynamic inheritance, and - conditional inheritance. - -.. note:: - - Twig also supports multiple inheritance with the so called horizontal reuse - with the help of the :doc:`use` tag. This is an advanced feature - hardly ever needed in regular templates. - -HTML Escaping -------------- - -When generating HTML from templates, there's always a risk that a variable -will include characters that affect the resulting HTML. There are two -approaches: manually escaping each variable or automatically escaping -everything by default. - -Twig supports both, automatic escaping is enabled by default. - -The automatic escaping strategy can be configured via the -:ref:`autoescape` option and defaults to ``html``. - -Working with Manual Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If manual escaping is enabled, it is **your** responsibility to escape -variables if needed. What to escape? Any variable you don't trust. - -Escaping works by piping the variable through the -:doc:`escape` or ``e`` filter: - -.. code-block:: jinja - - {{ user.username|e }} - -By default, the ``escape`` filter uses the ``html`` strategy, but depending on -the escaping context, you might want to explicitly use any other available -strategies: - -.. code-block:: jinja - - {{ user.username|e('js') }} - {{ user.username|e('css') }} - {{ user.username|e('url') }} - {{ user.username|e('html_attr') }} - -Working with Automatic Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Whether automatic escaping is enabled or not, you can mark a section of a -template to be escaped or not by using the :doc:`autoescape` -tag: - -.. code-block:: jinja - - {% autoescape %} - Everything will be automatically escaped in this block (using the HTML strategy) - {% endautoescape %} - -By default, auto-escaping uses the ``html`` escaping strategy. If you output -variables in other contexts, you need to explicitly escape them with the -appropriate escaping strategy: - -.. code-block:: jinja - - {% autoescape 'js' %} - Everything will be automatically escaped in this block (using the JS strategy) - {% endautoescape %} - -Escaping --------- - -It is sometimes desirable or even necessary to have Twig ignore parts it would -otherwise handle as variables or blocks. For example if the default syntax is -used and you want to use ``{{`` as raw string in the template and not start a -variable you have to use a trick. - -The easiest way is to output the variable delimiter (``{{``) by using a variable -expression: - -.. code-block:: jinja - - {{ '{{' }} - -For bigger sections it makes sense to mark a block -:doc:`verbatim`. - -Macros ------- - -Macros are comparable with functions in regular programming languages. They -are useful to reuse often used HTML fragments to not repeat yourself. - -A macro is defined via the :doc:`macro` tag. Here is a small example -(subsequently called ``forms.html``) of a macro that renders a form element: - -.. code-block:: jinja - - {% macro input(name, value, type, size) %} - - {% endmacro %} - -Macros can be defined in any template, and need to be "imported" via the -:doc:`import` tag before being used: - -.. code-block:: jinja - - {% import "forms.html" as forms %} - -

    {{ forms.input('username') }}

    - -Alternatively, you can import individual macro names from a template into the -current namespace via the :doc:`from` tag and optionally alias them: - -.. code-block:: jinja - - {% from 'forms.html' import input as input_field %} - -
    -
    Username
    -
    {{ input_field('username') }}
    -
    Password
    -
    {{ input_field('password', '', 'password') }}
    -
    - -A default value can also be defined for macro arguments when not provided in a -macro call: - -.. code-block:: jinja - - {% macro input(name, value = "", type = "text", size = 20) %} - - {% endmacro %} - -If extra positional arguments are passed to a macro call, they end up in the -special ``varargs`` variable as a list of values. - -.. _twig-expressions: - -Expressions ------------ - -Twig allows expressions everywhere. These work very similar to regular PHP and -even if you're not working with PHP you should feel comfortable with it. - -.. note:: - - The operator precedence is as follows, with the lowest-precedence - operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, - ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``matches``, - ``starts with``, ``ends with``, ``..``, ``+``, ``-``, ``~``, ``*``, ``/``, - ``//``, ``%``, ``is``, ``**``, ``|``, ``[]``, and ``.``: - - .. code-block:: jinja - - {% set greeting = 'Hello ' %} - {% set name = 'Fabien' %} - - {{ greeting ~ name|lower }} {# Hello fabien #} - - {# use parenthesis to change precedence #} - {{ (greeting ~ name)|lower }} {# hello fabien #} - -Literals -~~~~~~~~ - -The simplest form of expressions are literals. Literals are representations -for PHP types such as strings, numbers, and arrays. The following literals -exist: - -* ``"Hello World"``: Everything between two double or single quotes is a - string. They are useful whenever you need a string in the template (for - example as arguments to function calls, filters or just to extend or include - a template). A string can contain a delimiter if it is preceded by a - backslash (``\``) -- like in ``'It\'s good'``. If the string contains a - backslash (e.g. ``'c:\Program Files'``) escape it by doubling it - (e.g. ``'c:\\Program Files'``). - -* ``42`` / ``42.23``: Integers and floating point numbers are created by just - writing the number down. If a dot is present the number is a float, - otherwise an integer. - -* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions - separated by a comma (``,``) and wrapped with squared brackets (``[]``). - -* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values - separated by a comma (``,``) and wrapped with curly braces (``{}``): - - .. code-block:: jinja - - {# keys as string #} - { 'foo': 'foo', 'bar': 'bar' } - - {# keys as names (equivalent to the previous hash) #} - { foo: 'foo', bar: 'bar' } - - {# keys as integer #} - { 2: 'foo', 4: 'bar' } - - {# keys as expressions (the expression must be enclosed into parentheses) #} - {% set foo = 'foo' %} - { (foo): 'foo', (1 + 1): 'bar', (foo ~ 'b'): 'baz' } - -* ``true`` / ``false``: ``true`` represents the true value, ``false`` - represents the false value. - -* ``null``: ``null`` represents no specific value. This is the value returned - when a variable does not exist. ``none`` is an alias for ``null``. - -Arrays and hashes can be nested: - -.. code-block:: jinja - - {% set foo = [1, {"foo": "bar"}] %} - -.. tip:: - - Using double-quoted or single-quoted strings has no impact on performance - but string interpolation is only supported in double-quoted strings. - -Math -~~~~ - -Twig allows you to calculate with values. This is rarely useful in templates -but exists for completeness' sake. The following operators are supported: - -* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ - 1 + 1 }}`` is ``2``. - -* ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is - ``1``. - -* ``/``: Divides two numbers. The returned value will be a floating point - number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. - -* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is - ``4``. - -* ``//``: Divides two numbers and returns the floored integer result. ``{{ 20 - // 7 }}`` is ``2``, ``{{ -20 // 7 }}`` is ``-3`` (this is just syntactic - sugar for the :doc:`round` filter). - -* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would - return ``4``. - -* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** - 3 }}`` would return ``8``. - -Logic -~~~~~ - -You can combine multiple expressions with the following operators: - -* ``and``: Returns true if the left and the right operands are both true. - -* ``or``: Returns true if the left or the right operand is true. - -* ``not``: Negates a statement. - -* ``(expr)``: Groups an expression. - -.. note:: - - Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). - -.. note:: - - Operators are case sensitive. - -Comparisons -~~~~~~~~~~~ - -The following comparison operators are supported in any expression: ``==``, -``!=``, ``<``, ``>``, ``>=``, and ``<=``. - -You can also check if a string ``starts with`` or ``ends with`` another -string: - -.. code-block:: jinja - - {% if 'Fabien' starts with 'F' %} - {% endif %} - - {% if 'Fabien' ends with 'n' %} - {% endif %} - -.. note:: - - For complex string comparisons, the ``matches`` operator allows you to use - `regular expressions`_: - - .. code-block:: jinja - - {% if phone matches '/^[\\d\\.]+$/' %} - {% endif %} - -Containment Operator -~~~~~~~~~~~~~~~~~~~~ - -The ``in`` operator performs containment test. - -It returns ``true`` if the left operand is contained in the right: - -.. code-block:: jinja - - {# returns true #} - - {{ 1 in [1, 2, 3] }} - - {{ 'cd' in 'abcde' }} - -.. tip:: - - You can use this filter to perform a containment test on strings, arrays, - or objects implementing the ``Traversable`` interface. - -To perform a negative test, use the ``not in`` operator: - -.. code-block:: jinja - - {% if 1 not in [1, 2, 3] %} - - {# is equivalent to #} - {% if not (1 in [1, 2, 3]) %} - -Test Operator -~~~~~~~~~~~~~ - -The ``is`` operator performs tests. Tests can be used to test a variable against -a common expression. The right operand is name of the test: - -.. code-block:: jinja - - {# find out if a variable is odd #} - - {{ name is odd }} - -Tests can accept arguments too: - -.. code-block:: jinja - - {% if post.status is constant('Post::PUBLISHED') %} - -Tests can be negated by using the ``is not`` operator: - -.. code-block:: jinja - - {% if post.status is not constant('Post::PUBLISHED') %} - - {# is equivalent to #} - {% if not (post.status is constant('Post::PUBLISHED')) %} - -Go to the :doc:`tests` page to learn more about the built-in -tests. - -Other Operators -~~~~~~~~~~~~~~~ - -The following operators don't fit into any of the other categories: - -* ``|``: Applies a filter. - -* ``..``: Creates a sequence based on the operand before and after the operator - (this is just syntactic sugar for the :doc:`range` function): - - .. code-block:: jinja - - {{ 1..5 }} - - {# equivalent to #} - {{ range(1, 5) }} - - Note that you must use parentheses when combining it with the filter operator - due to the :ref:`operator precedence rules `: - - .. code-block:: jinja - - (1..5)|join(', ') - -* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello - " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello - John!``. - -* ``.``, ``[]``: Gets an attribute of an object. - -* ``?:``: The ternary operator: - - .. code-block:: jinja - - {{ foo ? 'yes' : 'no' }} - {{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }} - {{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }} - -* ``??``: The null-coalescing operator: - - .. code-block:: jinja - - {# returns the value of foo if it is defined and not null, 'no' otherwise #} - {{ foo ?? 'no' }} - -String Interpolation -~~~~~~~~~~~~~~~~~~~~ - -String interpolation (``#{expression}``) allows any valid expression to appear -within a *double-quoted string*. The result of evaluating that expression is -inserted into the string: - -.. code-block:: jinja - - {{ "foo #{bar} baz" }} - {{ "foo #{1 + 2} baz" }} - -.. _templates-whitespace-control: - -Whitespace Control ------------------- - -The first newline after a template tag is removed automatically (like in PHP.) -Whitespace is not further modified by the template engine, so each whitespace -(spaces, tabs, newlines etc.) is returned unchanged. - -Use the ``spaceless`` tag to remove whitespace *between HTML tags*: - -.. code-block:: jinja - - {% spaceless %} -
    - foo bar -
    - {% endspaceless %} - - {# output will be
    foo bar
    #} - -In addition to the spaceless tag you can also control whitespace on a per tag -level. By using the whitespace control modifier on your tags, you can trim -leading and or trailing whitespace: - -.. code-block:: jinja - - {% set value = 'no spaces' %} - {#- No leading/trailing whitespace -#} - {%- if true -%} - {{- value -}} - {%- endif -%} - - {# output 'no spaces' #} - -The above sample shows the default whitespace control modifier, and how you can -use it to remove whitespace around tags. Trimming space will consume all whitespace -for that side of the tag. It is possible to use whitespace trimming on one side -of a tag: - -.. code-block:: jinja - - {% set value = 'no spaces' %} -
  • {{- value }}
  • - - {# outputs '
  • no spaces
  • ' #} - -Extensions ----------- - -Twig can be easily extended. - -If you are looking for new tags, filters, or functions, have a look at the Twig official -`extension repository`_. - -If you want to create your own, read the :ref:`Creating an -Extension` chapter. - -.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle -.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim -.. _`vim-twig plugin`: https://github.com/lumiliet/vim-twig -.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig -.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin -.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language -.. _`extension repository`: http://github.com/twigphp/Twig-extensions -.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode -.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode -.. _`Notepad++ Twig Highlighter`: https://github.com/Banane9/notepadplusplus-twig -.. _`web-mode.el`: http://web-mode.org/ -.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php -.. _`PHP-twig for atom`: https://github.com/reesef/php-twig -.. _`TwigFiddle`: http://twigfiddle.com/ -.. _`Twig pack`: https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-twig-pack diff --git a/vendor/twig/twig/doc/tests/constant.rst b/vendor/twig/twig/doc/tests/constant.rst deleted file mode 100644 index 79f37c1..0000000 --- a/vendor/twig/twig/doc/tests/constant.rst +++ /dev/null @@ -1,19 +0,0 @@ -``constant`` -============ - -``constant`` checks if a variable has the exact same value as a constant. You -can use either global constants or class constants: - -.. code-block:: jinja - - {% if post.status is constant('Post::PUBLISHED') %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} - -You can test constants from object instances as well: - -.. code-block:: jinja - - {% if post.status is constant('PUBLISHED', post) %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} diff --git a/vendor/twig/twig/doc/tests/defined.rst b/vendor/twig/twig/doc/tests/defined.rst deleted file mode 100644 index 702ce72..0000000 --- a/vendor/twig/twig/doc/tests/defined.rst +++ /dev/null @@ -1,30 +0,0 @@ -``defined`` -=========== - -``defined`` checks if a variable is defined in the current context. This is very -useful if you use the ``strict_variables`` option: - -.. code-block:: jinja - - {# defined works with variable names #} - {% if foo is defined %} - ... - {% endif %} - - {# and attributes on variables names #} - {% if foo.bar is defined %} - ... - {% endif %} - - {% if foo['bar'] is defined %} - ... - {% endif %} - -When using the ``defined`` test on an expression that uses variables in some -method calls, be sure that they are all defined first: - -.. code-block:: jinja - - {% if var is defined and foo.method(var) is defined %} - ... - {% endif %} diff --git a/vendor/twig/twig/doc/tests/divisibleby.rst b/vendor/twig/twig/doc/tests/divisibleby.rst deleted file mode 100644 index a125840..0000000 --- a/vendor/twig/twig/doc/tests/divisibleby.rst +++ /dev/null @@ -1,10 +0,0 @@ -``divisible by`` -================ - -``divisible by`` checks if a variable is divisible by a number: - -.. code-block:: jinja - - {% if loop.index is divisible by(3) %} - ... - {% endif %} diff --git a/vendor/twig/twig/doc/tests/empty.rst b/vendor/twig/twig/doc/tests/empty.rst deleted file mode 100644 index 1a54957..0000000 --- a/vendor/twig/twig/doc/tests/empty.rst +++ /dev/null @@ -1,22 +0,0 @@ -``empty`` -========= - -.. versionadded:: 2.3 - - Support for the ``__toString()`` magic method has been added in Twig 2.3. - -``empty`` checks if a variable is an empty string, an empty array, an empty -hash, exactly ``false``, or exactly ``null``. - -For objects that implement the ``Countable`` interface, ``empty`` will check the -return value of the ``count()`` method. - -For objects that implement the ``__toString()`` magic method (and not ``Countable``), -it will check if an empty string is returned. - -.. code-block:: jinja - - {% if foo is empty %} - ... - {% endif %} - diff --git a/vendor/twig/twig/doc/tests/even.rst b/vendor/twig/twig/doc/tests/even.rst deleted file mode 100644 index 6ab5cc3..0000000 --- a/vendor/twig/twig/doc/tests/even.rst +++ /dev/null @@ -1,10 +0,0 @@ -``even`` -======== - -``even`` returns ``true`` if the given number is even: - -.. code-block:: jinja - - {{ var is even }} - -.. seealso:: :doc:`odd<../tests/odd>` diff --git a/vendor/twig/twig/doc/tests/index.rst b/vendor/twig/twig/doc/tests/index.rst deleted file mode 100644 index c63208e..0000000 --- a/vendor/twig/twig/doc/tests/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Tests -===== - -.. toctree:: - :maxdepth: 1 - - constant - defined - divisibleby - empty - even - iterable - null - odd - sameas diff --git a/vendor/twig/twig/doc/tests/iterable.rst b/vendor/twig/twig/doc/tests/iterable.rst deleted file mode 100644 index f562ccc..0000000 --- a/vendor/twig/twig/doc/tests/iterable.rst +++ /dev/null @@ -1,16 +0,0 @@ -``iterable`` -============ - -``iterable`` checks if a variable is an array or a traversable object: - -.. code-block:: jinja - - {# evaluates to true if the foo variable is iterable #} - {% if users is iterable %} - {% for user in users %} - Hello {{ user }}! - {% endfor %} - {% else %} - {# users is probably a string #} - Hello {{ users }}! - {% endif %} diff --git a/vendor/twig/twig/doc/tests/null.rst b/vendor/twig/twig/doc/tests/null.rst deleted file mode 100644 index 44eec62..0000000 --- a/vendor/twig/twig/doc/tests/null.rst +++ /dev/null @@ -1,12 +0,0 @@ -``null`` -======== - -``null`` returns ``true`` if the variable is ``null``: - -.. code-block:: jinja - - {{ var is null }} - -.. note:: - - ``none`` is an alias for ``null``. diff --git a/vendor/twig/twig/doc/tests/odd.rst b/vendor/twig/twig/doc/tests/odd.rst deleted file mode 100644 index 9eece77..0000000 --- a/vendor/twig/twig/doc/tests/odd.rst +++ /dev/null @@ -1,10 +0,0 @@ -``odd`` -======= - -``odd`` returns ``true`` if the given number is odd: - -.. code-block:: jinja - - {{ var is odd }} - -.. seealso:: :doc:`even<../tests/even>` diff --git a/vendor/twig/twig/doc/tests/sameas.rst b/vendor/twig/twig/doc/tests/sameas.rst deleted file mode 100644 index e4151ca..0000000 --- a/vendor/twig/twig/doc/tests/sameas.rst +++ /dev/null @@ -1,11 +0,0 @@ -``same as`` -=========== - -``same as`` checks if a variable is the same as another variable. -This is the equivalent to ``===`` in PHP: - -.. code-block:: jinja - - {% if foo.attribute is same as(false) %} - the foo attribute really is the 'false' PHP value - {% endif %} diff --git a/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php b/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php deleted file mode 100644 index 1e1e13e..0000000 --- a/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ -abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface -{ - final public function enterNode(Twig_Node $node, Twig_Environment $env) - { - return $this->doEnterNode($node, $env); - } - - final public function leaveNode(Twig_Node $node, Twig_Environment $env) - { - return $this->doLeaveNode($node, $env); - } - - /** - * Called before child nodes are visited. - * - * @return Twig_Node The modified node - */ - abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env); - - /** - * Called after child nodes are visited. - * - * @return Twig_Node|false The modified node or false if the node must be removed - */ - abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env); -} - -class_alias('Twig_BaseNodeVisitor', 'Twig\NodeVisitor\AbstractNodeVisitor', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php b/vendor/twig/twig/lib/Twig/Cache/Filesystem.php deleted file mode 100644 index 5b0acc0..0000000 --- a/vendor/twig/twig/lib/Twig/Cache/Filesystem.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ -class Twig_Cache_Filesystem implements Twig_CacheInterface -{ - const FORCE_BYTECODE_INVALIDATION = 1; - - private $directory; - private $options; - - /** - * @param $directory string The root cache directory - * @param $options int A set of options - */ - public function __construct($directory, $options = 0) - { - $this->directory = rtrim($directory, '\/').'/'; - $this->options = $options; - } - - public function generateKey($name, $className) - { - $hash = hash('sha256', $className); - - return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; - } - - public function load($key) - { - if (file_exists($key)) { - @include_once $key; - } - } - - public function write($key, $content) - { - $dir = dirname($key); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - clearstatcache(true, $dir); - if (!is_dir($dir)) { - throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); - } - } - } elseif (!is_writable($dir)) { - throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); - } - - $tmpFile = tempnam($dir, basename($key)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { - @chmod($key, 0666 & ~umask()); - - if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { - // Compile cached file into bytecode cache - if (function_exists('opcache_invalidate')) { - opcache_invalidate($key, true); - } elseif (function_exists('apc_compile_file')) { - apc_compile_file($key); - } - } - - return; - } - - throw new RuntimeException(sprintf('Failed to write cache file "%s".', $key)); - } - - public function getTimestamp($key) - { - if (!file_exists($key)) { - return 0; - } - - return (int) @filemtime($key); - } -} - -class_alias('Twig_Cache_Filesystem', 'Twig\Cache\FilesystemCache', false); diff --git a/vendor/twig/twig/lib/Twig/Cache/Null.php b/vendor/twig/twig/lib/Twig/Cache/Null.php deleted file mode 100644 index 224048d..0000000 --- a/vendor/twig/twig/lib/Twig/Cache/Null.php +++ /dev/null @@ -1,38 +0,0 @@ - - */ -final class Twig_Cache_Null implements Twig_CacheInterface -{ - public function generateKey($name, $className) - { - return ''; - } - - public function write($key, $content) - { - } - - public function load($key) - { - } - - public function getTimestamp($key) - { - return 0; - } -} - -class_alias('Twig_Cache_Null', 'Twig\Cache\NullCache', false); diff --git a/vendor/twig/twig/lib/Twig/CacheInterface.php b/vendor/twig/twig/lib/Twig/CacheInterface.php deleted file mode 100644 index 776808b..0000000 --- a/vendor/twig/twig/lib/Twig/CacheInterface.php +++ /dev/null @@ -1,58 +0,0 @@ - - */ -interface Twig_CacheInterface -{ - /** - * Generates a cache key for the given template class name. - * - * @param string $name The template name - * @param string $className The template class name - * - * @return string - */ - public function generateKey($name, $className); - - /** - * Writes the compiled template to cache. - * - * @param string $key The cache key - * @param string $content The template representation as a PHP class - */ - public function write($key, $content); - - /** - * Loads a template from the cache. - * - * @param string $key The cache key - */ - public function load($key); - - /** - * Returns the modification timestamp of a key. - * - * @param string $key The cache key - * - * @return int - */ - public function getTimestamp($key); -} - -class_alias('Twig_CacheInterface', 'Twig\Cache\CacheInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Compiler.php b/vendor/twig/twig/lib/Twig/Compiler.php deleted file mode 100644 index fd851cc..0000000 --- a/vendor/twig/twig/lib/Twig/Compiler.php +++ /dev/null @@ -1,241 +0,0 @@ - - */ -class Twig_Compiler -{ - private $lastLine; - private $source; - private $indentation; - private $env; - private $debugInfo = array(); - private $sourceOffset; - private $sourceLine; - - public function __construct(Twig_Environment $env) - { - $this->env = $env; - } - - /** - * Returns the environment instance related to this compiler. - * - * @return Twig_Environment - */ - public function getEnvironment() - { - return $this->env; - } - - /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code - */ - public function getSource() - { - return $this->source; - } - - /** - * Compiles a node. - * - * @param Twig_Node $node The node to compile - * @param int $indentation The current indentation - * - * @return $this - */ - public function compile(Twig_Node $node, $indentation = 0) - { - $this->lastLine = null; - $this->source = ''; - $this->debugInfo = array(); - $this->sourceOffset = 0; - // source code starts at 1 (as we then increment it when we encounter new lines) - $this->sourceLine = 1; - $this->indentation = $indentation; - - $node->compile($this); - - return $this; - } - - public function subcompile(Twig_Node $node, $raw = true) - { - if (false === $raw) { - $this->source .= str_repeat(' ', $this->indentation * 4); - } - - $node->compile($this); - - return $this; - } - - /** - * Adds a raw string to the compiled code. - * - * @param string $string The string - * - * @return $this - */ - public function raw($string) - { - $this->source .= $string; - - return $this; - } - - /** - * Writes a string to the compiled code by adding indentation. - * - * @return $this - */ - public function write(...$strings) - { - foreach ($strings as $string) { - $this->source .= str_repeat(' ', $this->indentation * 4).$string; - } - - return $this; - } - - /** - * Adds a quoted string to the compiled code. - * - * @param string $value The string - * - * @return $this - */ - public function string($value) - { - $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); - - return $this; - } - - /** - * Returns a PHP representation of a given value. - * - * @param mixed $value The value to convert - * - * @return $this - */ - public function repr($value) - { - if (is_int($value) || is_float($value)) { - if (false !== $locale = setlocale(LC_NUMERIC, '0')) { - setlocale(LC_NUMERIC, 'C'); - } - - $this->raw($value); - - if (false !== $locale) { - setlocale(LC_NUMERIC, $locale); - } - } elseif (null === $value) { - $this->raw('null'); - } elseif (is_bool($value)) { - $this->raw($value ? 'true' : 'false'); - } elseif (is_array($value)) { - $this->raw('array('); - $first = true; - foreach ($value as $key => $v) { - if (!$first) { - $this->raw(', '); - } - $first = false; - $this->repr($key); - $this->raw(' => '); - $this->repr($v); - } - $this->raw(')'); - } else { - $this->string($value); - } - - return $this; - } - - /** - * Adds debugging information. - * - * @return $this - */ - public function addDebugInfo(Twig_Node $node) - { - if ($node->getTemplateLine() != $this->lastLine) { - $this->write(sprintf("// line %d\n", $node->getTemplateLine())); - - $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); - $this->sourceOffset = strlen($this->source); - $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); - - $this->lastLine = $node->getTemplateLine(); - } - - return $this; - } - - public function getDebugInfo() - { - ksort($this->debugInfo); - - return $this->debugInfo; - } - - /** - * Indents the generated code. - * - * @param int $step The number of indentation to add - * - * @return $this - */ - public function indent($step = 1) - { - $this->indentation += $step; - - return $this; - } - - /** - * Outdents the generated code. - * - * @param int $step The number of indentation to remove - * - * @return $this - * - * @throws LogicException When trying to outdent too much so the indentation would become negative - */ - public function outdent($step = 1) - { - // can't outdent by more steps than the current indentation level - if ($this->indentation < $step) { - throw new LogicException('Unable to call outdent() as the indentation would become negative.'); - } - - $this->indentation -= $step; - - return $this; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); - } -} - -class_alias('Twig_Compiler', 'Twig\Compiler', false); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php b/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php deleted file mode 100644 index 814ab58..0000000 --- a/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @author Robin Chalas - */ -class Twig_ContainerRuntimeLoader implements Twig_RuntimeLoaderInterface -{ - private $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - public function load($class) - { - if ($this->container->has($class)) { - return $this->container->get($class); - } - } -} - -class_alias('Twig_ContainerRuntimeLoader', 'Twig\RuntimeLoader\ContainerRuntimeLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php deleted file mode 100644 index 7658cca..0000000 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ /dev/null @@ -1,965 +0,0 @@ - - */ -class Twig_Environment -{ - const VERSION = '2.4.4'; - const VERSION_ID = 20404; - const MAJOR_VERSION = 2; - const MINOR_VERSION = 4; - const RELEASE_VERSION = 4; - const EXTRA_VERSION = ''; - - private $charset; - private $loader; - private $debug; - private $autoReload; - private $cache; - private $lexer; - private $parser; - private $compiler; - private $baseTemplateClass; - private $globals = array(); - private $resolvedGlobals; - private $loadedTemplates; - private $strictVariables; - private $templateClassPrefix = '__TwigTemplate_'; - private $originalCache; - private $extensionSet; - private $runtimeLoaders = array(); - private $runtimes = array(); - private $optionsHash; - private $loading = array(); - - /** - * Constructor. - * - * Available options: - * - * * debug: When set to true, it automatically set "auto_reload" to true as - * well (default to false). - * - * * charset: The charset used by the templates (default to UTF-8). - * - * * base_template_class: The base template class to use for generated - * templates (default to Twig_Template). - * - * * cache: An absolute path where to store the compiled templates, - * a Twig_Cache_Interface implementation, - * or false to disable compilation cache (default). - * - * * auto_reload: Whether to reload the template if the original source changed. - * If you don't provide the auto_reload option, it will be - * determined automatically based on the debug value. - * - * * strict_variables: Whether to ignore invalid variables in templates - * (default to false). - * - * * autoescape: Whether to enable auto-escaping (default to html): - * * false: disable auto-escaping - * * html, js: set the autoescaping to one of the supported strategies - * * name: set the autoescaping strategy based on the template name extension - * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" - * - * * optimizations: A flag that indicates which optimizations to apply - * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable). - * - * @param Twig_LoaderInterface $loader - * @param array $options An array of options - */ - public function __construct(Twig_LoaderInterface $loader, $options = array()) - { - $this->setLoader($loader); - - $options = array_merge(array( - 'debug' => false, - 'charset' => 'UTF-8', - 'base_template_class' => 'Twig_Template', - 'strict_variables' => false, - 'autoescape' => 'html', - 'cache' => false, - 'auto_reload' => null, - 'optimizations' => -1, - ), $options); - - $this->debug = (bool) $options['debug']; - $this->setCharset($options['charset']); - $this->baseTemplateClass = $options['base_template_class']; - $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->strictVariables = (bool) $options['strict_variables']; - $this->setCache($options['cache']); - $this->extensionSet = new Twig_ExtensionSet(); - - $this->addExtension(new Twig_Extension_Core()); - $this->addExtension(new Twig_Extension_Escaper($options['autoescape'])); - $this->addExtension(new Twig_Extension_Optimizer($options['optimizations'])); - } - - /** - * Gets the base template class for compiled templates. - * - * @return string The base template class name - */ - public function getBaseTemplateClass() - { - return $this->baseTemplateClass; - } - - /** - * Sets the base template class for compiled templates. - * - * @param string $class The base template class name - */ - public function setBaseTemplateClass($class) - { - $this->baseTemplateClass = $class; - $this->updateOptionsHash(); - } - - /** - * Enables debugging mode. - */ - public function enableDebug() - { - $this->debug = true; - $this->updateOptionsHash(); - } - - /** - * Disables debugging mode. - */ - public function disableDebug() - { - $this->debug = false; - $this->updateOptionsHash(); - } - - /** - * Checks if debug mode is enabled. - * - * @return bool true if debug mode is enabled, false otherwise - */ - public function isDebug() - { - return $this->debug; - } - - /** - * Enables the auto_reload option. - */ - public function enableAutoReload() - { - $this->autoReload = true; - } - - /** - * Disables the auto_reload option. - */ - public function disableAutoReload() - { - $this->autoReload = false; - } - - /** - * Checks if the auto_reload option is enabled. - * - * @return bool true if auto_reload is enabled, false otherwise - */ - public function isAutoReload() - { - return $this->autoReload; - } - - /** - * Enables the strict_variables option. - */ - public function enableStrictVariables() - { - $this->strictVariables = true; - $this->updateOptionsHash(); - } - - /** - * Disables the strict_variables option. - */ - public function disableStrictVariables() - { - $this->strictVariables = false; - $this->updateOptionsHash(); - } - - /** - * Checks if the strict_variables option is enabled. - * - * @return bool true if strict_variables is enabled, false otherwise - */ - public function isStrictVariables() - { - return $this->strictVariables; - } - - /** - * Gets the current cache implementation. - * - * @param bool $original Whether to return the original cache option or the real cache instance - * - * @return Twig_CacheInterface|string|false A Twig_CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function getCache($original = true) - { - return $original ? $this->originalCache : $this->cache; - } - - /** - * Sets the current cache implementation. - * - * @param Twig_CacheInterface|string|false $cache A Twig_CacheInterface implementation, - * an absolute path to the compiled templates, - * or false to disable cache - */ - public function setCache($cache) - { - if (is_string($cache)) { - $this->originalCache = $cache; - $this->cache = new Twig_Cache_Filesystem($cache); - } elseif (false === $cache) { - $this->originalCache = $cache; - $this->cache = new Twig_Cache_Null(); - } elseif ($cache instanceof Twig_CacheInterface) { - $this->originalCache = $this->cache = $cache; - } else { - throw new LogicException(sprintf('Cache can only be a string, false, or a Twig_CacheInterface implementation.')); - } - } - - /** - * Gets the template class associated with the given string. - * - * The generated template class is based on the following parameters: - * - * * The cache key for the given template; - * * The currently enabled extensions; - * * Whether the Twig C extension is available or not; - * * PHP version; - * * Twig version; - * * Options with what environment was created. - * - * @param string $name The name for which to calculate the template class name - * @param int|null $index The index if it is an embedded template - * - * @return string The template class name - */ - public function getTemplateClass($name, $index = null) - { - $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; - - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index); - } - - /** - * Renders a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - * @throws Twig_Error_Runtime When an error occurred during rendering - */ - public function render($name, array $context = array()) - { - return $this->loadTemplate($name)->render($context); - } - - /** - * Displays a template. - * - * @param string $name The template name - * @param array $context An array of parameters to pass to the template - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - * @throws Twig_Error_Runtime When an error occurred during rendering - */ - public function display($name, array $context = array()) - { - $this->loadTemplate($name)->display($context); - } - - /** - * Loads a template. - * - * @param string|Twig_TemplateWrapper|Twig_Template $name The template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Runtime When a previously generated cache is corrupted - * @throws Twig_Error_Syntax When an error occurred during compilation - * - * @return Twig_TemplateWrapper - */ - public function load($name) - { - if ($name instanceof Twig_TemplateWrapper) { - return $name; - } - - if ($name instanceof Twig_Template) { - return new Twig_TemplateWrapper($this, $name); - } - - return new Twig_TemplateWrapper($this, $this->loadTemplate($name)); - } - - /** - * Loads a template internal representation. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The template name - * @param int $index The index if it is an embedded template - * - * @return Twig_Template A template instance representing the given template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Runtime When a previously generated cache is corrupted - * @throws Twig_Error_Syntax When an error occurred during compilation - * - * @internal - */ - public function loadTemplate($name, $index = null) - { - $cls = $mainCls = $this->getTemplateClass($name); - if (null !== $index) { - $cls .= '_'.$index; - } - - if (isset($this->loadedTemplates[$cls])) { - return $this->loadedTemplates[$cls]; - } - - if (!class_exists($cls, false)) { - $key = $this->cache->generateKey($name, $mainCls); - - if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { - $this->cache->load($key); - } - - if (!class_exists($cls, false)) { - $source = $this->getLoader()->getSourceContext($name); - $content = $this->compileSource($source); - $this->cache->write($key, $content); - $this->cache->load($key); - - if (!class_exists($mainCls, false)) { - /* Last line of defense if either $this->bcWriteCacheFile was used, - * $this->cache is implemented as a no-op or we have a race condition - * where the cache was cleared between the above calls to write to and load from - * the cache. - */ - eval('?>'.$content); - } - - if (!class_exists($cls, false)) { - throw new Twig_Error_Runtime(sprintf('Failed to load Twig template "%s", index "%s": cache is corrupted.', $name, $index), -1, $source); - } - } - } - - // to be removed in 3.0 - $this->extensionSet->initRuntime($this); - - if (isset($this->loading[$cls])) { - throw new Twig_Error_Runtime(sprintf('Circular reference detected for Twig template "%s", path: %s.', $name, implode(' -> ', array_merge($this->loading, array($name))))); - } - - $this->loading[$cls] = $name; - - try { - $this->loadedTemplates[$cls] = new $cls($this); - } finally { - unset($this->loading[$cls]); - } - - return $this->loadedTemplates[$cls]; - } - - /** - * Creates a template from source. - * - * This method should not be used as a generic way to load templates. - * - * @param string $template The template name - * - * @return Twig_Template A template instance representing the given template name - * - * @throws Twig_Error_Loader When the template cannot be found - * @throws Twig_Error_Syntax When an error occurred during compilation - */ - public function createTemplate($template) - { - $name = sprintf('__string_template__%s', hash('sha256', $template, false)); - - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array($name => $template)), - $current = $this->getLoader(), - )); - - $this->setLoader($loader); - try { - $template = $this->loadTemplate($name); - } finally { - $this->setLoader($current); - } - - return $template; - } - - /** - * Returns true if the template is still fresh. - * - * Besides checking the loader for freshness information, - * this method also checks if the enabled extensions have - * not changed. - * - * @param string $name The template name - * @param int $time The last modification time of the cached template - * - * @return bool true if the template is fresh, false otherwise - */ - public function isTemplateFresh($name, $time) - { - return $this->extensionSet->getLastModified() <= $time && $this->getLoader()->isFresh($name, $time); - } - - /** - * Tries to load a template consecutively from an array. - * - * Similar to loadTemplate() but it also accepts Twig_Template instances and an array - * of templates where each is tried to be loaded. - * - * @param string|Twig_Template|array $names A template or an array of templates to try consecutively - * - * @return Twig_Template - * - * @throws Twig_Error_Loader When none of the templates can be found - * @throws Twig_Error_Syntax When an error occurred during compilation - */ - public function resolveTemplate($names) - { - if (!is_array($names)) { - $names = array($names); - } - - foreach ($names as $name) { - if ($name instanceof Twig_Template) { - return $name; - } - - try { - return $this->loadTemplate($name); - } catch (Twig_Error_Loader $e) { - } - } - - if (1 === count($names)) { - throw $e; - } - - throw new Twig_Error_Loader(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); - } - - public function setLexer(Twig_Lexer $lexer) - { - $this->lexer = $lexer; - } - - /** - * Tokenizes a source code. - * - * @return Twig_TokenStream - * - * @throws Twig_Error_Syntax When the code is syntactically wrong - */ - public function tokenize(Twig_Source $source) - { - if (null === $this->lexer) { - $this->lexer = new Twig_Lexer($this); - } - - return $this->lexer->tokenize($source); - } - - public function setParser(Twig_Parser $parser) - { - $this->parser = $parser; - } - - /** - * Converts a token stream to a node tree. - * - * @return Twig_Node_Module - * - * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong - */ - public function parse(Twig_TokenStream $stream) - { - if (null === $this->parser) { - $this->parser = new Twig_Parser($this); - } - - return $this->parser->parse($stream); - } - - public function setCompiler(Twig_Compiler $compiler) - { - $this->compiler = $compiler; - } - - /** - * Compiles a node and returns the PHP code. - * - * @return string The compiled PHP source code - */ - public function compile(Twig_Node $node) - { - if (null === $this->compiler) { - $this->compiler = new Twig_Compiler($this); - } - - return $this->compiler->compile($node)->getSource(); - } - - /** - * Compiles a template source code. - * - * @return string The compiled PHP source code - * - * @throws Twig_Error_Syntax When there was an error during tokenizing, parsing or compiling - */ - public function compileSource(Twig_Source $source) - { - try { - return $this->compile($this->parse($this->tokenize($source))); - } catch (Twig_Error $e) { - $e->setSourceContext($source); - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Syntax(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); - } - } - - public function setLoader(Twig_LoaderInterface $loader) - { - $this->loader = $loader; - } - - /** - * Gets the Loader instance. - * - * @return Twig_LoaderInterface - */ - public function getLoader() - { - return $this->loader; - } - - /** - * Sets the default template charset. - * - * @param string $charset The default charset - */ - public function setCharset($charset) - { - if ('UTF8' === $charset = strtoupper($charset)) { - // iconv on Windows requires "UTF-8" instead of "UTF8" - $charset = 'UTF-8'; - } - - $this->charset = $charset; - } - - /** - * Gets the default template charset. - * - * @return string The default charset - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Returns true if the given extension is registered. - * - * @param string $class The extension class name - * - * @return bool Whether the extension is registered or not - */ - public function hasExtension($class) - { - return $this->extensionSet->hasExtension($class); - } - - /** - * Adds a runtime loader. - */ - public function addRuntimeLoader(Twig_RuntimeLoaderInterface $loader) - { - $this->runtimeLoaders[] = $loader; - } - - /** - * Gets an extension by class name. - * - * @param string $class The extension class name - * - * @return Twig_ExtensionInterface - */ - public function getExtension($class) - { - return $this->extensionSet->getExtension($class); - } - - /** - * Returns the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class name - * - * @return object The runtime implementation - * - * @throws Twig_Error_Runtime When the template cannot be found - */ - public function getRuntime($class) - { - if (isset($this->runtimes[$class])) { - return $this->runtimes[$class]; - } - - foreach ($this->runtimeLoaders as $loader) { - if (null !== $runtime = $loader->load($class)) { - return $this->runtimes[$class] = $runtime; - } - } - - throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class)); - } - - public function addExtension(Twig_ExtensionInterface $extension) - { - $this->extensionSet->addExtension($extension); - $this->updateOptionsHash(); - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - $this->extensionSet->setExtensions($extensions); - } - - /** - * Returns all registered extensions. - * - * @return Twig_ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) - */ - public function getExtensions() - { - return $this->extensionSet->getExtensions(); - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - $this->extensionSet->addTokenParser($parser); - } - - /** - * Gets the registered Token Parsers. - * - * @return Twig_TokenParserInterface[] - * - * @internal - */ - public function getTokenParsers() - { - return $this->extensionSet->getTokenParsers(); - } - - /** - * Gets registered tags. - * - * @return Twig_TokenParserInterface[] - * - * @internal - */ - public function getTags() - { - $tags = array(); - foreach ($this->getTokenParsers() as $parser) { - $tags[$parser->getTag()] = $parser; - } - - return $tags; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - $this->extensionSet->addNodeVisitor($visitor); - } - - /** - * Gets the registered Node Visitors. - * - * @return Twig_NodeVisitorInterface[] - * - * @internal - */ - public function getNodeVisitors() - { - return $this->extensionSet->getNodeVisitors(); - } - - public function addFilter(Twig_Filter $filter) - { - $this->extensionSet->addFilter($filter); - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist - * - * @internal - */ - public function getFilter($name) - { - return $this->extensionSet->getFilter($name); - } - - public function registerUndefinedFilterCallback(callable $callable) - { - $this->extensionSet->registerUndefinedFilterCallback($callable); - } - - /** - * Gets the registered Filters. - * - * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. - * - * @return Twig_Filter[] - * - * @see registerUndefinedFilterCallback - * - * @internal - */ - public function getFilters() - { - return $this->extensionSet->getFilters(); - } - - /** - * Registers a Test. - * - * @param Twig_Test $test A Twig_Test instance - */ - public function addTest(Twig_Test $test) - { - $this->extensionSet->addTest($test); - } - - /** - * Gets the registered Tests. - * - * @return Twig_Test[] - * - * @internal - */ - public function getTests() - { - return $this->extensionSet->getTests(); - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return Twig_Test|false A Twig_Test instance or false if the test does not exist - * - * @internal - */ - public function getTest($name) - { - return $this->extensionSet->getTest($name); - } - - public function addFunction(Twig_Function $function) - { - $this->extensionSet->addFunction($function); - } - - /** - * Get a function by name. - * - * Subclasses may override this method and load functions differently; - * so no list of functions is available. - * - * @param string $name function name - * - * @return Twig_Function|false A Twig_Function instance or false if the function does not exist - * - * @internal - */ - public function getFunction($name) - { - return $this->extensionSet->getFunction($name); - } - - public function registerUndefinedFunctionCallback(callable $callable) - { - $this->extensionSet->registerUndefinedFunctionCallback($callable); - } - - /** - * Gets registered functions. - * - * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. - * - * @return Twig_Function[] - * - * @see registerUndefinedFunctionCallback - * - * @internal - */ - public function getFunctions() - { - return $this->extensionSet->getFunctions(); - } - - /** - * Registers a Global. - * - * New globals can be added before compiling or rendering a template; - * but after, you can only update existing globals. - * - * @param string $name The global name - * @param mixed $value The global value - */ - public function addGlobal($name, $value) - { - if ($this->extensionSet->isInitialized() && !array_key_exists($name, $this->getGlobals())) { - throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); - } - - if (null !== $this->resolvedGlobals) { - $this->resolvedGlobals[$name] = $value; - } else { - $this->globals[$name] = $value; - } - } - - /** - * Gets the registered Globals. - * - * @return array An array of globals - * - * @internal - */ - public function getGlobals() - { - if ($this->extensionSet->isInitialized()) { - if (null === $this->resolvedGlobals) { - $this->resolvedGlobals = array_merge($this->extensionSet->getGlobals(), $this->globals); - } - - return $this->resolvedGlobals; - } - - return array_merge($this->extensionSet->getGlobals(), $this->globals); - } - - /** - * Merges a context with the defined globals. - * - * @param array $context An array representing the context - * - * @return array The context merged with the globals - */ - public function mergeGlobals(array $context) - { - // we don't use array_merge as the context being generally - // bigger than globals, this code is faster. - foreach ($this->getGlobals() as $key => $value) { - if (!array_key_exists($key, $context)) { - $context[$key] = $value; - } - } - - return $context; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - * - * @internal - */ - public function getUnaryOperators() - { - return $this->extensionSet->getUnaryOperators(); - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - * - * @internal - */ - public function getBinaryOperators() - { - return $this->extensionSet->getBinaryOperators(); - } - - private function updateOptionsHash() - { - $this->optionsHash = implode(':', array( - $this->extensionSet->getSignature(), - PHP_MAJOR_VERSION, - PHP_MINOR_VERSION, - self::VERSION, - (int) $this->debug, - $this->baseTemplateClass, - (int) $this->strictVariables, - )); - } -} - -class_alias('Twig_Environment', 'Twig\Environment', false); diff --git a/vendor/twig/twig/lib/Twig/Error.php b/vendor/twig/twig/lib/Twig/Error.php deleted file mode 100644 index 77b0813..0000000 --- a/vendor/twig/twig/lib/Twig/Error.php +++ /dev/null @@ -1,265 +0,0 @@ - - */ -class Twig_Error extends Exception -{ - private $lineno; - private $name; - private $rawMessage; - private $sourcePath; - private $sourceCode; - - /** - * Constructor. - * - * Set both the line number and the name to false to - * disable automatic guessing of the original template name - * and line number. - * - * Set the line number to -1 to enable its automatic guessing. - * Set the name to null to enable its automatic guessing. - * - * By default, automatic guessing is enabled. - * - * @param string $message The error message - * @param int $lineno The template line where the error occurred - * @param Twig_Source|string|null $source The source context where the error occurred - * @param Exception $previous The previous exception - */ - public function __construct($message, $lineno = -1, $source = null, Exception $previous = null) - { - parent::__construct('', 0, $previous); - - if (null === $source) { - $name = null; - } elseif (!$source instanceof Twig_Source) { - // for compat with the Twig C ext., passing the template name as string is accepted - $name = $source; - } else { - $name = $source->getName(); - $this->sourceCode = $source->getCode(); - $this->sourcePath = $source->getPath(); - } - - $this->lineno = $lineno; - $this->name = $name; - - if (-1 === $lineno || null === $name || null === $this->sourcePath) { - $this->guessTemplateInfo(); - } - - $this->rawMessage = $message; - - $this->updateRepr(); - } - - /** - * Gets the raw message. - * - * @return string The raw message - */ - public function getRawMessage() - { - return $this->rawMessage; - } - - /** - * Gets the template line where the error occurred. - * - * @return int The template line - */ - public function getTemplateLine() - { - return $this->lineno; - } - - /** - * Sets the template line where the error occurred. - * - * @param int $lineno The template line - */ - public function setTemplateLine($lineno) - { - $this->lineno = $lineno; - - $this->updateRepr(); - } - - /** - * Gets the source context of the Twig template where the error occurred. - * - * @return Twig_Source|null - */ - public function getSourceContext() - { - return $this->name ? new Twig_Source($this->sourceCode, $this->name, $this->sourcePath) : null; - } - - /** - * Sets the source context of the Twig template where the error occurred. - */ - public function setSourceContext(Twig_Source $source = null) - { - if (null === $source) { - $this->sourceCode = $this->name = $this->sourcePath = null; - } else { - $this->sourceCode = $source->getCode(); - $this->name = $source->getName(); - $this->sourcePath = $source->getPath(); - } - - $this->updateRepr(); - } - - public function guess() - { - $this->guessTemplateInfo(); - $this->updateRepr(); - } - - public function appendMessage($rawMessage) - { - $this->rawMessage .= $rawMessage; - $this->updateRepr(); - } - - private function updateRepr() - { - $this->message = $this->rawMessage; - - if ($this->sourcePath && $this->lineno > 0) { - $this->file = $this->sourcePath; - $this->line = $this->lineno; - - return; - } - - $dot = false; - if ('.' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - $questionMark = false; - if ('?' === substr($this->message, -1)) { - $this->message = substr($this->message, 0, -1); - $questionMark = true; - } - - if ($this->name) { - if (is_string($this->name) || (is_object($this->name) && method_exists($this->name, '__toString'))) { - $name = sprintf('"%s"', $this->name); - } else { - $name = json_encode($this->name); - } - $this->message .= sprintf(' in %s', $name); - } - - if ($this->lineno && $this->lineno >= 0) { - $this->message .= sprintf(' at line %d', $this->lineno); - } - - if ($dot) { - $this->message .= '.'; - } - - if ($questionMark) { - $this->message .= '?'; - } - } - - private function guessTemplateInfo() - { - $template = null; - $templateClass = null; - - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); - foreach ($backtrace as $trace) { - if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { - $currentClass = get_class($trace['object']); - $isEmbedContainer = 0 === strpos($templateClass, $currentClass); - if (null === $this->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) { - $template = $trace['object']; - $templateClass = get_class($trace['object']); - } - } - } - - // update template name - if (null !== $template && null === $this->name) { - $this->name = $template->getTemplateName(); - } - - // update template path if any - if (null !== $template && null === $this->sourcePath) { - $src = $template->getSourceContext(); - $this->sourceCode = $src->getCode(); - $this->sourcePath = $src->getPath(); - } - - if (null === $template || $this->lineno > -1) { - return; - } - - $r = new ReflectionObject($template); - $file = $r->getFileName(); - - $exceptions = array($e = $this); - while ($e = $e->getPrevious()) { - $exceptions[] = $e; - } - - while ($e = array_pop($exceptions)) { - $traces = $e->getTrace(); - array_unshift($traces, array('file' => $e->getFile(), 'line' => $e->getLine())); - - while ($trace = array_shift($traces)) { - if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { - continue; - } - - foreach ($template->getDebugInfo() as $codeLine => $templateLine) { - if ($codeLine <= $trace['line']) { - // update template line - $this->lineno = $templateLine; - - return; - } - } - } - } - } -} - -class_alias('Twig_Error', 'Twig\Error\Error', false); -class_exists('Twig_Source'); diff --git a/vendor/twig/twig/lib/Twig/Error/Loader.php b/vendor/twig/twig/lib/Twig/Error/Loader.php deleted file mode 100644 index aec5b33..0000000 --- a/vendor/twig/twig/lib/Twig/Error/Loader.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ -class Twig_Error_Loader extends Twig_Error -{ - public function __construct($message, $lineno = -1, $source = null, Exception $previous = null) - { - Exception::__construct('', 0, $previous); - $this->appendMessage($message); - $this->setTemplateLine(false); - } -} - -class_alias('Twig_Error_Loader', 'Twig\Error\LoaderError', false); diff --git a/vendor/twig/twig/lib/Twig/Error/Runtime.php b/vendor/twig/twig/lib/Twig/Error/Runtime.php deleted file mode 100644 index 3b24ad3..0000000 --- a/vendor/twig/twig/lib/Twig/Error/Runtime.php +++ /dev/null @@ -1,22 +0,0 @@ - - */ -class Twig_Error_Runtime extends Twig_Error -{ -} - -class_alias('Twig_Error_Runtime', 'Twig\Error\RuntimeError', false); diff --git a/vendor/twig/twig/lib/Twig/Error/Syntax.php b/vendor/twig/twig/lib/Twig/Error/Syntax.php deleted file mode 100644 index aadd45e..0000000 --- a/vendor/twig/twig/lib/Twig/Error/Syntax.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ -class Twig_Error_Syntax extends Twig_Error -{ - /** - * Tweaks the error message to include suggestions. - * - * @param string $name The original name of the item that does not exist - * @param array $items An array of possible items - */ - public function addSuggestions($name, array $items) - { - $alternatives = array(); - foreach ($items as $item) { - $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { - $alternatives[$item] = $lev; - } - } - - if (!$alternatives) { - return; - } - - asort($alternatives); - - $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', array_keys($alternatives)))); - } -} - -class_alias('Twig_Error_Syntax', 'Twig\Error\SyntaxError', false); diff --git a/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php b/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php deleted file mode 100644 index 544a831..0000000 --- a/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * @internal - */ -class Twig_ExpressionParser -{ - const OPERATOR_LEFT = 1; - const OPERATOR_RIGHT = 2; - - private $parser; - private $env; - private $unaryOperators; - private $binaryOperators; - - public function __construct(Twig_Parser $parser, Twig_Environment $env) - { - $this->parser = $parser; - $this->env = $env; - $this->unaryOperators = $env->getUnaryOperators(); - $this->binaryOperators = $env->getBinaryOperators(); - } - - public function parseExpression($precedence = 0) - { - $expr = $this->getPrimary(); - $token = $this->parser->getCurrentToken(); - while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { - $op = $this->binaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - - if ('is not' === $token->getValue()) { - $expr = $this->parseNotTestExpression($expr); - } elseif ('is' === $token->getValue()) { - $expr = $this->parseTestExpression($expr); - } elseif (isset($op['callable'])) { - $expr = $op['callable']($this->parser, $expr); - } else { - $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); - $class = $op['class']; - $expr = new $class($expr, $expr1, $token->getLine()); - } - - $token = $this->parser->getCurrentToken(); - } - - if (0 === $precedence) { - return $this->parseConditionalExpression($expr); - } - - return $expr; - } - - private function getPrimary() - { - $token = $this->parser->getCurrentToken(); - - if ($this->isUnary($token)) { - $operator = $this->unaryOperators[$token->getValue()]; - $this->parser->getStream()->next(); - $expr = $this->parseExpression($operator['precedence']); - $class = $operator['class']; - - return $this->parsePostfixExpression(new $class($expr, $token->getLine())); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $this->parser->getStream()->next(); - $expr = $this->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed'); - - return $this->parsePostfixExpression($expr); - } - - return $this->parsePrimaryExpression(); - } - - private function parseConditionalExpression($expr) - { - while ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, '?')) { - if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $expr2 = $this->parseExpression(); - if ($this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $expr3 = $this->parseExpression(); - } else { - $expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine()); - } - } else { - $expr2 = $expr; - $expr3 = $this->parseExpression(); - } - - $expr = new Twig_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); - } - - return $expr; - } - - private function isUnary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->unaryOperators[$token->getValue()]); - } - - private function isBinary(Twig_Token $token) - { - return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); - } - - public function parsePrimaryExpression() - { - $token = $this->parser->getCurrentToken(); - switch ($token->getType()) { - case Twig_Token::NAME_TYPE: - $this->parser->getStream()->next(); - switch ($token->getValue()) { - case 'true': - case 'TRUE': - $node = new Twig_Node_Expression_Constant(true, $token->getLine()); - break; - - case 'false': - case 'FALSE': - $node = new Twig_Node_Expression_Constant(false, $token->getLine()); - break; - - case 'none': - case 'NONE': - case 'null': - case 'NULL': - $node = new Twig_Node_Expression_Constant(null, $token->getLine()); - break; - - default: - if ('(' === $this->parser->getCurrentToken()->getValue()) { - $node = $this->getFunctionNode($token->getValue(), $token->getLine()); - } else { - $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine()); - } - } - break; - - case Twig_Token::NUMBER_TYPE: - $this->parser->getStream()->next(); - $node = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - break; - - case Twig_Token::STRING_TYPE: - case Twig_Token::INTERPOLATION_START_TYPE: - $node = $this->parseStringExpression(); - break; - - case Twig_Token::OPERATOR_TYPE: - if (preg_match(Twig_Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { - // in this context, string operators are variable names - $this->parser->getStream()->next(); - $node = new Twig_Node_Expression_Name($token->getValue(), $token->getLine()); - break; - } elseif (isset($this->unaryOperators[$token->getValue()])) { - $class = $this->unaryOperators[$token->getValue()]['class']; - - $ref = new ReflectionClass($class); - $negClass = 'Twig_Node_Expression_Unary_Neg'; - $posClass = 'Twig_Node_Expression_Unary_Pos'; - if (!(in_array($ref->getName(), array($negClass, $posClass)) || $ref->isSubclassOf($negClass) || $ref->isSubclassOf($posClass))) { - throw new Twig_Error_Syntax(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - - $this->parser->getStream()->next(); - $expr = $this->parsePrimaryExpression(); - - $node = new $class($expr, $token->getLine()); - break; - } - - default: - if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) { - $node = $this->parseArrayExpression(); - } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { - $node = $this->parseHashExpression(); - } else { - throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); - } - } - - return $this->parsePostfixExpression($node); - } - - public function parseStringExpression() - { - $stream = $this->parser->getStream(); - - $nodes = array(); - // a string cannot be followed by another string in a single expression - $nextCanBeString = true; - while (true) { - if ($nextCanBeString && $token = $stream->nextIf(Twig_Token::STRING_TYPE)) { - $nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - $nextCanBeString = false; - } elseif ($stream->nextIf(Twig_Token::INTERPOLATION_START_TYPE)) { - $nodes[] = $this->parseExpression(); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $nextCanBeString = true; - } else { - break; - } - } - - $expr = array_shift($nodes); - foreach ($nodes as $node) { - $expr = new Twig_Node_Expression_Binary_Concat($expr, $node, $node->getTemplateLine()); - } - - return $expr; - } - - public function parseArrayExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - break; - } - } - $first = false; - - $node->addElement($this->parseExpression()); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - - return $node; - } - - public function parseHashExpression() - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - - $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); - $first = true; - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - if (!$first) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); - - // trailing ,? - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - break; - } - } - $first = false; - - // a hash key can be: - // - // * a number -- 12 - // * a string -- 'a' - // * a name, which is equivalent to a string -- a - // * an expression, which must be enclosed in parentheses -- (1 + 2) - if (($token = $stream->nextIf(Twig_Token::STRING_TYPE)) || ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) || $token = $stream->nextIf(Twig_Token::NUMBER_TYPE)) { - $key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - } elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $key = $this->parseExpression(); - } else { - $current = $stream->getCurrent(); - - throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Twig_Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $value = $this->parseExpression(); - - $node->addElement($value, $key); - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - - return $node; - } - - public function parsePostfixExpression($node) - { - while (true) { - $token = $this->parser->getCurrentToken(); - if ($token->getType() == Twig_Token::PUNCTUATION_TYPE) { - if ('.' == $token->getValue() || '[' == $token->getValue()) { - $node = $this->parseSubscriptExpression($node); - } elseif ('|' == $token->getValue()) { - $node = $this->parseFilterExpression($node); - } else { - break; - } - } else { - break; - } - } - - return $node; - } - - public function getFunctionNode($name, $line) - { - switch ($name) { - case 'parent': - $this->parseArguments(); - if (!count($this->parser->getBlockStack())) { - throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - if (!$this->parser->getParent() && !$this->parser->hasTraits()) { - throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line); - case 'block': - $args = $this->parseArguments(); - if (count($args) < 1) { - throw new Twig_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_BlockReference($args->getNode(0), count($args) > 1 ? $args->getNode(1) : null, $line); - case 'attribute': - $args = $this->parseArguments(); - if (count($args) < 2) { - throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); - } - - return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : null, Twig_Template::ANY_CALL, $line); - default: - if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { - $arguments = new Twig_Node_Expression_Array(array(), $line); - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - - $node = new Twig_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line); - $node->setAttribute('safe', true); - - return $node; - } - - $args = $this->parseArguments(true); - $class = $this->getFunctionNodeClass($name, $line); - - return new $class($name, $args, $line); - } - } - - public function parseSubscriptExpression($node) - { - $stream = $this->parser->getStream(); - $token = $stream->next(); - $lineno = $token->getLine(); - $arguments = new Twig_Node_Expression_Array(array(), $lineno); - $type = Twig_Template::ANY_CALL; - if ($token->getValue() == '.') { - $token = $stream->next(); - if ( - $token->getType() == Twig_Token::NAME_TYPE - || - $token->getType() == Twig_Token::NUMBER_TYPE - || - ($token->getType() == Twig_Token::OPERATOR_TYPE && preg_match(Twig_Lexer::REGEX_NAME, $token->getValue())) - ) { - $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); - - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $type = Twig_Template::METHOD_CALL; - foreach ($this->parseArguments() as $n) { - $arguments->addElement($n); - } - } - } else { - throw new Twig_Error_Syntax('Expected name or number.', $lineno, $stream->getSourceContext()); - } - - if ($node instanceof Twig_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { - if (!$arg instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); - } - - $name = $arg->getAttribute('value'); - - $node = new Twig_Node_Expression_MethodCall($node, 'macro_'.$name, $arguments, $lineno); - $node->setAttribute('safe', true); - - return $node; - } - } else { - $type = Twig_Template::ARRAY_CALL; - - // slice? - $slice = false; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - $arg = new Twig_Node_Expression_Constant(0, $token->getLine()); - } else { - $arg = $this->parseExpression(); - } - - if ($stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ':')) { - $slice = true; - } - - if ($slice) { - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - $length = new Twig_Node_Expression_Constant(null, $token->getLine()); - } else { - $length = $this->parseExpression(); - } - - $class = $this->getFilterNodeClass('slice', $token->getLine()); - $arguments = new Twig_Node(array($arg, $length)); - $filter = new $class($node, new Twig_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine()); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - - return $filter; - } - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); - } - - return new Twig_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno); - } - - public function parseFilterExpression($node) - { - $this->parser->getStream()->next(); - - return $this->parseFilterExpressionRaw($node); - } - - public function parseFilterExpressionRaw($node, $tag = null) - { - while (true) { - $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE); - - $name = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = new Twig_Node(); - } else { - $arguments = $this->parseArguments(true); - } - - $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); - - $node = new $class($node, $name, $arguments, $token->getLine(), $tag); - - if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '|')) { - break; - } - - $this->parser->getStream()->next(); - } - - return $node; - } - - /** - * Parses arguments. - * - * @param bool $namedArguments Whether to allow named arguments or not - * @param bool $definition Whether we are parsing arguments for a function definition - * - * @return Twig_Node - * - * @throws Twig_Error_Syntax - */ - public function parseArguments($namedArguments = false, $definition = false) - { - $args = array(); - $stream = $this->parser->getStream(); - - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); - while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ')')) { - if (!empty($args)) { - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); - } - - if ($definition) { - $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'An argument must be a name'); - $value = new Twig_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine()); - } else { - $value = $this->parseExpression(); - } - - $name = null; - if ($namedArguments && $token = $stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { - if (!$value instanceof Twig_Node_Expression_Name) { - throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given.', get_class($value)), $token->getLine(), $stream->getSourceContext()); - } - $name = $value->getAttribute('name'); - - if ($definition) { - $value = $this->parsePrimaryExpression(); - - if (!$this->checkConstantExpression($value)) { - throw new Twig_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $stream->getSourceContext()); - } - } else { - $value = $this->parseExpression(); - } - } - - if ($definition) { - if (null === $name) { - $name = $value->getAttribute('name'); - $value = new Twig_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine()); - } - $args[$name] = $value; - } else { - if (null === $name) { - $args[] = $value; - } else { - $args[$name] = $value; - } - } - } - $stream->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); - - return new Twig_Node($args); - } - - public function parseAssignmentExpression() - { - $stream = $this->parser->getStream(); - $targets = array(); - while (true) { - $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to'); - $value = $token->getValue(); - if (in_array(strtolower($value), array('true', 'false', 'none', 'null'))) { - throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); - } - $targets[] = new Twig_Node_Expression_AssignName($value, $token->getLine()); - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Twig_Node($targets); - } - - public function parseMultitargetExpression() - { - $targets = array(); - while (true) { - $targets[] = $this->parseExpression(); - if (!$this->parser->getStream()->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } - - return new Twig_Node($targets); - } - - private function parseNotTestExpression(Twig_Node $node) - { - return new Twig_Node_Expression_Unary_Not($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); - } - - private function parseTestExpression(Twig_Node $node) - { - $stream = $this->parser->getStream(); - list($name, $test) = $this->getTest($node->getTemplateLine()); - - $class = $this->getTestNodeClass($test); - $arguments = null; - if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = $this->parser->getExpressionParser()->parseArguments(true); - } - - return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); - } - - private function getTest($line) - { - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - if ($test = $this->env->getTest($name)) { - return array($name, $test); - } - - if ($stream->test(Twig_Token::NAME_TYPE)) { - // try 2-words tests - $name = $name.' '.$this->parser->getCurrentToken()->getValue(); - - if ($test = $this->env->getTest($name)) { - $stream->next(); - - return array($name, $test); - } - } - - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getTests())); - - throw $e; - } - - private function getTestNodeClass($test) - { - if ($test->isDeprecated()) { - $stream = $this->parser->getStream(); - $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); - - if (!is_bool($test->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); - } - if ($test->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $test->getAlternative()); - } - $src = $stream->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine()); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $test->getNodeClass(); - } - - private function getFunctionNodeClass($name, $line) - { - if (false === $function = $this->env->getFunction($name)) { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFunctions())); - - throw $e; - } - - if ($function->isDeprecated()) { - $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); - if (!is_bool($function->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); - } - if ($function->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $function->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $function->getNodeClass(); - } - - private function getFilterNodeClass($name, $line) - { - if (false === $filter = $this->env->getFilter($name)) { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); - $e->addSuggestions($name, array_keys($this->env->getFilters())); - - throw $e; - } - - if ($filter->isDeprecated()) { - $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); - if (!is_bool($filter->getDeprecatedVersion())) { - $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); - } - if ($filter->getAlternative()) { - $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); - } - $src = $this->parser->getStream()->getSourceContext(); - $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); - - @trigger_error($message, E_USER_DEPRECATED); - } - - return $filter->getNodeClass(); - } - - // checks that the node only contains "constant" elements - private function checkConstantExpression(Twig_Node $node) - { - if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array - || $node instanceof Twig_Node_Expression_Unary_Neg || $node instanceof Twig_Node_Expression_Unary_Pos - )) { - return false; - } - - foreach ($node as $n) { - if (!$this->checkConstantExpression($n)) { - return false; - } - } - - return true; - } -} - -class_alias('Twig_ExpressionParser', 'Twig\ExpressionParser', false); diff --git a/vendor/twig/twig/lib/Twig/Extension.php b/vendor/twig/twig/lib/Twig/Extension.php deleted file mode 100644 index e8916b4..0000000 --- a/vendor/twig/twig/lib/Twig/Extension.php +++ /dev/null @@ -1,46 +0,0 @@ -escapers[$strategy] = $callable; - } - - /** - * Gets all defined escapers. - * - * @return callable[] An array of escapers - */ - public function getEscapers() - { - return $this->escapers; - } - - /** - * Sets the default format to be used by the date filter. - * - * @param string $format The default date format string - * @param string $dateIntervalFormat The default date interval format string - */ - public function setDateFormat($format = null, $dateIntervalFormat = null) - { - if (null !== $format) { - $this->dateFormats[0] = $format; - } - - if (null !== $dateIntervalFormat) { - $this->dateFormats[1] = $dateIntervalFormat; - } - } - - /** - * Gets the default format to be used by the date filter. - * - * @return array The default date format string and the default date interval format string - */ - public function getDateFormat() - { - return $this->dateFormats; - } - - /** - * Sets the default timezone to be used by the date filter. - * - * @param DateTimeZone|string $timezone The default timezone string or a DateTimeZone object - */ - public function setTimezone($timezone) - { - $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); - } - - /** - * Gets the default timezone to be used by the date filter. - * - * @return DateTimeZone The default timezone currently in use - */ - public function getTimezone() - { - if (null === $this->timezone) { - $this->timezone = new DateTimeZone(date_default_timezone_get()); - } - - return $this->timezone; - } - - /** - * Sets the default format to be used by the number_format filter. - * - * @param int $decimal the number of decimal places to use - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - */ - public function setNumberFormat($decimal, $decimalPoint, $thousandSep) - { - $this->numberFormat = array($decimal, $decimalPoint, $thousandSep); - } - - /** - * Get the default format used by the number_format filter. - * - * @return array The arguments for number_format() - */ - public function getNumberFormat() - { - return $this->numberFormat; - } - - public function getTokenParsers() - { - return array( - new Twig_TokenParser_For(), - new Twig_TokenParser_If(), - new Twig_TokenParser_Extends(), - new Twig_TokenParser_Include(), - new Twig_TokenParser_Block(), - new Twig_TokenParser_Use(), - new Twig_TokenParser_Filter(), - new Twig_TokenParser_Macro(), - new Twig_TokenParser_Import(), - new Twig_TokenParser_From(), - new Twig_TokenParser_Set(), - new Twig_TokenParser_Spaceless(), - new Twig_TokenParser_Flush(), - new Twig_TokenParser_Do(), - new Twig_TokenParser_Embed(), - new Twig_TokenParser_With(), - ); - } - - public function getFilters() - { - return array( - // formatting filters - new Twig_Filter('date', 'twig_date_format_filter', array('needs_environment' => true)), - new Twig_Filter('date_modify', 'twig_date_modify_filter', array('needs_environment' => true)), - new Twig_Filter('format', 'sprintf'), - new Twig_Filter('replace', 'twig_replace_filter'), - new Twig_Filter('number_format', 'twig_number_format_filter', array('needs_environment' => true)), - new Twig_Filter('abs', 'abs'), - new Twig_Filter('round', 'twig_round'), - - // encoding - new Twig_Filter('url_encode', 'twig_urlencode_filter'), - new Twig_Filter('json_encode', 'json_encode'), - new Twig_Filter('convert_encoding', 'twig_convert_encoding'), - - // string filters - new Twig_Filter('title', 'twig_title_string_filter', array('needs_environment' => true)), - new Twig_Filter('capitalize', 'twig_capitalize_string_filter', array('needs_environment' => true)), - new Twig_Filter('upper', 'twig_upper_filter', array('needs_environment' => true)), - new Twig_Filter('lower', 'twig_lower_filter', array('needs_environment' => true)), - new Twig_Filter('striptags', 'strip_tags'), - new Twig_Filter('trim', 'twig_trim_filter'), - new Twig_Filter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), - - // array helpers - new Twig_Filter('join', 'twig_join_filter'), - new Twig_Filter('split', 'twig_split_filter', array('needs_environment' => true)), - new Twig_Filter('sort', 'twig_sort_filter'), - new Twig_Filter('merge', 'twig_array_merge'), - new Twig_Filter('batch', 'twig_array_batch'), - - // string/array filters - new Twig_Filter('reverse', 'twig_reverse_filter', array('needs_environment' => true)), - new Twig_Filter('length', 'twig_length_filter', array('needs_environment' => true)), - new Twig_Filter('slice', 'twig_slice', array('needs_environment' => true)), - new Twig_Filter('first', 'twig_first', array('needs_environment' => true)), - new Twig_Filter('last', 'twig_last', array('needs_environment' => true)), - - // iteration and runtime - new Twig_Filter('default', '_twig_default_filter', array('node_class' => 'Twig_Node_Expression_Filter_Default')), - new Twig_Filter('keys', 'twig_get_array_keys_filter'), - - // escaping - new Twig_Filter('escape', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - new Twig_Filter('e', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - ); - } - - public function getFunctions() - { - return array( - new Twig_Function('max', 'max'), - new Twig_Function('min', 'min'), - new Twig_Function('range', 'range'), - new Twig_Function('constant', 'twig_constant'), - new Twig_Function('cycle', 'twig_cycle'), - new Twig_Function('random', 'twig_random', array('needs_environment' => true)), - new Twig_Function('date', 'twig_date_converter', array('needs_environment' => true)), - new Twig_Function('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))), - new Twig_Function('source', 'twig_source', array('needs_environment' => true, 'is_safe' => array('all'))), - ); - } - - public function getTests() - { - return array( - new Twig_Test('even', null, array('node_class' => 'Twig_Node_Expression_Test_Even')), - new Twig_Test('odd', null, array('node_class' => 'Twig_Node_Expression_Test_Odd')), - new Twig_Test('defined', null, array('node_class' => 'Twig_Node_Expression_Test_Defined')), - new Twig_Test('same as', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas')), - new Twig_Test('none', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_Test('null', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), - new Twig_Test('divisible by', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby')), - new Twig_Test('constant', null, array('node_class' => 'Twig_Node_Expression_Test_Constant')), - new Twig_Test('empty', 'twig_test_empty'), - new Twig_Test('iterable', 'twig_test_iterable'), - ); - } - - public function getOperators() - { - return array( - array( - 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), - '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), - ), - array( - 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'matches' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Matches', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'starts with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_StartsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'ends with' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_EndsWith', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mul', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Div', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '//' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_FloorDiv', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'is not' => array('precedence' => 100, 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), - '??' => array('precedence' => 300, 'class' => 'Twig_Node_Expression_NullCoalesce', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), - ), - ); - } -} - -/** - * Cycles over a value. - * - * @param ArrayAccess|array $values - * @param int $position The cycle position - * - * @return string The next value in the cycle - */ -function twig_cycle($values, $position) -{ - if (!is_array($values) && !$values instanceof ArrayAccess) { - return $values; - } - - return $values[$position % count($values)]; -} - -/** - * Returns a random value depending on the supplied parameter type: - * - a random item from a Traversable or array - * - a random character from a string - * - a random integer between 0 and the integer parameter. - * - * @param Twig_Environment $env - * @param Traversable|array|int|float|string $values The values to pick a random item from - * - * @throws Twig_Error_Runtime when $values is an empty array (does not apply to an empty string which is returned as is) - * - * @return mixed A random value from the given sequence - */ -function twig_random(Twig_Environment $env, $values = null) -{ - if (null === $values) { - return mt_rand(); - } - - if (is_int($values) || is_float($values)) { - return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values); - } - - if ($values instanceof Traversable) { - $values = iterator_to_array($values); - } elseif (is_string($values)) { - if ('' === $values) { - return ''; - } - - $charset = $env->getCharset(); - - if ('UTF-8' !== $charset) { - $values = iconv($charset, 'UTF-8', $values); - } - - // unicode version of str_split() - // split at all positions, but not after the start and not before the end - $values = preg_split('/(? $value) { - $values[$i] = iconv('UTF-8', $charset, $value); - } - } - } - - if (!is_array($values)) { - return $values; - } - - if (0 === count($values)) { - throw new Twig_Error_Runtime('The random function cannot pick from an empty array.'); - } - - return $values[array_rand($values, 1)]; -} - -/** - * Converts a date to the given format. - * - *
    - *   {{ post.published_at|date("m/d/Y") }}
    - * 
    - * - * @param Twig_Environment $env - * @param DateTimeInterface|DateInterval|string $date A date - * @param string|null $format The target format, null to use the default - * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return string The formatted date - */ -function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null) -{ - if (null === $format) { - $formats = $env->getExtension('Twig_Extension_Core')->getDateFormat(); - $format = $date instanceof DateInterval ? $formats[1] : $formats[0]; - } - - if ($date instanceof DateInterval) { - return $date->format($format); - } - - return twig_date_converter($env, $date, $timezone)->format($format); -} - -/** - * Returns a new date object modified. - * - *
    - *   {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
    - * 
    - * - * @param Twig_Environment $env - * @param DateTimeInterface|string $date A date - * @param string $modifier A modifier string - * - * @return DateTimeInterface A new date object - */ -function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) -{ - $date = twig_date_converter($env, $date, false); - - return $date->modify($modifier); -} - -/** - * Converts an input to a DateTime instance. - * - *
    - *    {% if date(user.created_at) < date('+2days') %}
    - *      {# do something #}
    - *    {% endif %}
    - * 
    - * - * @param Twig_Environment $env - * @param DateTimeInterface|string|null $date A date or null to use the current time - * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged - * - * @return DateTime A DateTime instance - */ -function twig_date_converter(Twig_Environment $env, $date = null, $timezone = null) -{ - // determine the timezone - if (false !== $timezone) { - if (null === $timezone) { - $timezone = $env->getExtension('Twig_Extension_Core')->getTimezone(); - } elseif (!$timezone instanceof DateTimeZone) { - $timezone = new DateTimeZone($timezone); - } - } - - // immutable dates - if ($date instanceof DateTimeImmutable) { - return false !== $timezone ? $date->setTimezone($timezone) : $date; - } - - if ($date instanceof DateTimeInterface) { - $date = clone $date; - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; - } - - if (null === $date || 'now' === $date) { - return new DateTime($date, false !== $timezone ? $timezone : $env->getExtension('Twig_Extension_Core')->getTimezone()); - } - - $asString = (string) $date; - if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { - $date = new DateTime('@'.$date); - } else { - $date = new DateTime($date, $env->getExtension('Twig_Extension_Core')->getTimezone()); - } - - if (false !== $timezone) { - $date->setTimezone($timezone); - } - - return $date; -} - -/** - * Replaces strings within a string. - * - * @param string $str String to replace in - * @param array|Traversable $from Replace values - * - * @return string - */ -function twig_replace_filter($str, $from) -{ - if ($from instanceof Traversable) { - $from = iterator_to_array($from); - } elseif (!is_array($from)) { - throw new Twig_Error_Runtime(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', is_object($from) ? get_class($from) : gettype($from))); - } - - return strtr($str, $from); -} - -/** - * Rounds a number. - * - * @param int|float $value The value to round - * @param int|float $precision The rounding precision - * @param string $method The method to use for rounding - * - * @return int|float The rounded number - */ -function twig_round($value, $precision = 0, $method = 'common') -{ - if ('common' == $method) { - return round($value, $precision); - } - - if ('ceil' != $method && 'floor' != $method) { - throw new Twig_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.'); - } - - return $method($value * pow(10, $precision)) / pow(10, $precision); -} - -/** - * Number format filter. - * - * All of the formatting options can be left null, in that case the defaults will - * be used. Supplying any of the parameters will override the defaults set in the - * environment object. - * - * @param Twig_Environment $env - * @param mixed $number A float/int/string of the number to format - * @param int $decimal the number of decimal points to display - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator - * - * @return string The formatted number - */ -function twig_number_format_filter(Twig_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) -{ - $defaults = $env->getExtension('Twig_Extension_Core')->getNumberFormat(); - if (null === $decimal) { - $decimal = $defaults[0]; - } - - if (null === $decimalPoint) { - $decimalPoint = $defaults[1]; - } - - if (null === $thousandSep) { - $thousandSep = $defaults[2]; - } - - return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); -} - -/** - * URL encodes (RFC 3986) a string as a path segment or an array as a query string. - * - * @param string|array $url A URL or an array of query parameters - * - * @return string The URL encoded value - */ -function twig_urlencode_filter($url) -{ - if (is_array($url)) { - return http_build_query($url, '', '&', PHP_QUERY_RFC3986); - } - - return rawurlencode($url); -} - -/** - * Merges an array with another one. - * - *
    - *  {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
    - *
    - *  {% set items = items|merge({ 'peugeot': 'car' }) %}
    - *
    - *  {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
    - * 
    - * - * @param array|Traversable $arr1 An array - * @param array|Traversable $arr2 An array - * - * @return array The merged array - */ -function twig_array_merge($arr1, $arr2) -{ - if ($arr1 instanceof Traversable) { - $arr1 = iterator_to_array($arr1); - } elseif (!is_array($arr1)) { - throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', gettype($arr1))); - } - - if ($arr2 instanceof Traversable) { - $arr2 = iterator_to_array($arr2); - } elseif (!is_array($arr2)) { - throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', gettype($arr2))); - } - - return array_merge($arr1, $arr2); -} - -/** - * Slices a variable. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * @param int $start Start of the slice - * @param int $length Size of the slice - * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) - * - * @return mixed The sliced variable - */ -function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false) -{ - if ($item instanceof Traversable) { - while ($item instanceof IteratorAggregate) { - $item = $item->getIterator(); - } - - if ($start >= 0 && $length >= 0 && $item instanceof Iterator) { - try { - return iterator_to_array(new LimitIterator($item, $start, $length === null ? -1 : $length), $preserveKeys); - } catch (OutOfBoundsException $exception) { - return array(); - } - } - - $item = iterator_to_array($item, $preserveKeys); - } - - if (is_array($item)) { - return array_slice($item, $start, $length, $preserveKeys); - } - - $item = (string) $item; - - return (string) mb_substr($item, $start, $length, $env->getCharset()); -} - -/** - * Returns the first element of the item. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * - * @return mixed The first element of the item - */ -function twig_first(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, 0, 1, false); - - return is_string($elements) ? $elements : current($elements); -} - -/** - * Returns the last element of the item. - * - * @param Twig_Environment $env - * @param mixed $item A variable - * - * @return mixed The last element of the item - */ -function twig_last(Twig_Environment $env, $item) -{ - $elements = twig_slice($env, $item, -1, 1, false); - - return is_string($elements) ? $elements : current($elements); -} - -/** - * Joins the values to a string. - * - * The separator between elements is an empty string per default, you can define it with the optional parameter. - * - *
    - *  {{ [1, 2, 3]|join('|') }}
    - *  {# returns 1|2|3 #}
    - *
    - *  {{ [1, 2, 3]|join }}
    - *  {# returns 123 #}
    - * 
    - * - * @param array $value An array - * @param string $glue The separator - * - * @return string The concatenated string - */ -function twig_join_filter($value, $glue = '') -{ - if ($value instanceof Traversable) { - $value = iterator_to_array($value, false); - } - - return implode($glue, (array) $value); -} - -/** - * Splits the string into an array. - * - *
    - *  {{ "one,two,three"|split(',') }}
    - *  {# returns [one, two, three] #}
    - *
    - *  {{ "one,two,three,four,five"|split(',', 3) }}
    - *  {# returns [one, two, "three,four,five"] #}
    - *
    - *  {{ "123"|split('') }}
    - *  {# returns [1, 2, 3] #}
    - *
    - *  {{ "aabbcc"|split('', 2) }}
    - *  {# returns [aa, bb, cc] #}
    - * 
    - * - * @param Twig_Environment $env - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit - * - * @return array The split string as an array - */ -function twig_split_filter(Twig_Environment $env, $value, $delimiter, $limit = null) -{ - if (!empty($delimiter)) { - return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); - } - - if ($limit <= 1) { - return preg_split('/(?getCharset()); - if ($length < $limit) { - return array($value); - } - - $r = array(); - for ($i = 0; $i < $length; $i += $limit) { - $r[] = mb_substr($value, $i, $limit, $env->getCharset()); - } - - return $r; -} - -// The '_default' filter is used internally to avoid using the ternary operator -// which costs a lot for big contexts (before PHP 5.4). So, on average, -// a function call is cheaper. -/** - * @internal - */ -function _twig_default_filter($value, $default = '') -{ - if (twig_test_empty($value)) { - return $default; - } - - return $value; -} - -/** - * Returns the keys for the given array. - * - * It is useful when you want to iterate over the keys of an array: - * - *
    - *  {% for key in array|keys %}
    - *      {# ... #}
    - *  {% endfor %}
    - * 
    - * - * @param array $array An array - * - * @return array The keys - */ -function twig_get_array_keys_filter($array) -{ - if ($array instanceof Traversable) { - while ($array instanceof IteratorAggregate) { - $array = $array->getIterator(); - } - - if ($array instanceof Iterator) { - $keys = array(); - $array->rewind(); - while ($array->valid()) { - $keys[] = $array->key(); - $array->next(); - } - - return $keys; - } - - $keys = array(); - foreach ($array as $key => $item) { - $keys[] = $key; - } - - return $keys; - } - - if (!is_array($array)) { - return array(); - } - - return array_keys($array); -} - -/** - * Reverses a variable. - * - * @param Twig_Environment $env - * @param array|Traversable|string $item An array, a Traversable instance, or a string - * @param bool $preserveKeys Whether to preserve key or not - * - * @return mixed The reversed input - */ -function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false) -{ - if ($item instanceof Traversable) { - return array_reverse(iterator_to_array($item), $preserveKeys); - } - - if (is_array($item)) { - return array_reverse($item, $preserveKeys); - } - - $string = (string) $item; - - $charset = $env->getCharset(); - - if ('UTF-8' !== $charset) { - $item = iconv($charset, 'UTF-8', $string); - } - - preg_match_all('/./us', $item, $matches); - - $string = implode('', array_reverse($matches[0])); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; -} - -/** - * Sorts an array. - * - * @param array|Traversable $array - * - * @return array - */ -function twig_sort_filter($array) -{ - if ($array instanceof Traversable) { - $array = iterator_to_array($array); - } elseif (!is_array($array)) { - throw new Twig_Error_Runtime(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', gettype($array))); - } - - asort($array); - - return $array; -} - -/** - * @internal - */ -function twig_in_filter($value, $compare) -{ - if (is_array($compare)) { - return in_array($value, $compare, is_object($value) || is_resource($value)); - } elseif (is_string($compare) && (is_string($value) || is_int($value) || is_float($value))) { - return '' === $value || false !== strpos($compare, (string) $value); - } elseif ($compare instanceof Traversable) { - if (is_object($value) || is_resource($value)) { - foreach ($compare as $item) { - if ($item === $value) { - return true; - } - } - } else { - foreach ($compare as $item) { - if ($item == $value) { - return true; - } - } - } - - return false; - } - - return false; -} - -/** - * Returns a trimmed string. - * - * @return string - * - * @throws Twig_Error_Runtime When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') - */ -function twig_trim_filter($string, $characterMask = null, $side = 'both') -{ - if (null === $characterMask) { - $characterMask = " \t\n\r\0\x0B"; - } - - switch ($side) { - case 'both': - return trim($string, $characterMask); - case 'left': - return ltrim($string, $characterMask); - case 'right': - return rtrim($string, $characterMask); - default: - throw new Twig_Error_Runtime('Trimming side must be "left", "right" or "both".'); - } -} - -/** - * Escapes a string. - * - * @param Twig_Environment $env - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) - * - * @return string - */ -function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) -{ - if ($autoescape && $string instanceof Twig_Markup) { - return $string; - } - - if (!is_string($string)) { - if (is_object($string) && method_exists($string, '__toString')) { - $string = (string) $string; - } elseif (in_array($strategy, array('html', 'js', 'css', 'html_attr', 'url'))) { - return $string; - } - } - - if (null === $charset) { - $charset = $env->getCharset(); - } - - switch ($strategy) { - case 'html': - // see http://php.net/htmlspecialchars - - // Using a static variable to avoid initializing the array - // each time the function is called. Moving the declaration on the - // top of the function slow downs other escaping strategies. - static $htmlspecialcharsCharsets = array( - 'ISO-8859-1' => true, 'ISO8859-1' => true, - 'ISO-8859-15' => true, 'ISO8859-15' => true, - 'utf-8' => true, 'UTF-8' => true, - 'CP866' => true, 'IBM866' => true, '866' => true, - 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, - '1251' => true, - 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, - 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, - 'BIG5' => true, '950' => true, - 'GB2312' => true, '936' => true, - 'BIG5-HKSCS' => true, - 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, - 'EUC-JP' => true, 'EUCJP' => true, - 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, - ); - - if (isset($htmlspecialcharsCharsets[$charset])) { - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { - // cache the lowercase variant for future iterations - $htmlspecialcharsCharsets[$charset] = true; - - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); - } - - $string = iconv($charset, 'UTF-8', $string); - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); - - return iconv('UTF-8', $charset, $string); - - case 'js': - // escape all non-alphanumeric characters - // into their \xHH or \uHHHH representations - if ('UTF-8' !== $charset) { - $string = iconv($charset, 'UTF-8', $string); - } - - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', function ($matches) { - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - $char = strtoupper(bin2hex($char)); - - if (4 >= strlen($char)) { - return sprintf('\u%04s', $char); - } - - return sprintf('\u%04s\u%04s', substr($char, 0, -4), substr($char, -4)); - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'css': - if ('UTF-8' !== $charset) { - $string = iconv($charset, 'UTF-8', $string); - } - - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) { - $char = $matches[0]; - - // \xHH - if (!isset($char[1])) { - $hex = ltrim(strtoupper(bin2hex($char)), '0'); - if (0 === strlen($hex)) { - $hex = '0'; - } - - return '\\'.$hex.' '; - } - - // \uHHHH - $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - - return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'html_attr': - if ('UTF-8' !== $charset) { - $string = iconv($charset, 'UTF-8', $string); - } - - if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) { - throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); - } - - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', function ($matches) { - /** - * This function is adapted from code coming from Zend Framework. - * - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - /* - * While HTML supports far more named entities, the lowest common denominator - * has become HTML5's XML Serialisation which is restricted to the those named - * entities that XML supports. Using HTML entities would result in this error: - * XML Parsing Error: undefined entity - */ - static $entityMap = array( - 34 => 'quot', /* quotation mark */ - 38 => 'amp', /* ampersand */ - 60 => 'lt', /* less-than sign */ - 62 => 'gt', /* greater-than sign */ - ); - - $chr = $matches[0]; - $ord = ord($chr); - - /* - * The following replaces characters undefined in HTML with the - * hex entity for the Unicode replacement character. - */ - if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) { - return '�'; - } - - /* - * Check if the current character to escape has a name entity we should - * replace it with while grabbing the hex value of the character. - */ - if (strlen($chr) == 1) { - $hex = strtoupper(substr('00'.bin2hex($chr), -2)); - } else { - $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); - $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); - } - - $int = hexdec($hex); - if (array_key_exists($int, $entityMap)) { - return sprintf('&%s;', $entityMap[$int]); - } - - /* - * Per OWASP recommendations, we'll use hex entities for any other - * characters where a named entity does not exist. - */ - return sprintf('&#x%s;', $hex); - }, $string); - - if ('UTF-8' !== $charset) { - $string = iconv('UTF-8', $charset, $string); - } - - return $string; - - case 'url': - return rawurlencode($string); - - default: - static $escapers; - - if (null === $escapers) { - $escapers = $env->getExtension('Twig_Extension_Core')->getEscapers(); - } - - if (isset($escapers[$strategy])) { - return $escapers[$strategy]($env, $string, $charset); - } - - $validStrategies = implode(', ', array_merge(array('html', 'js', 'url', 'css', 'html_attr'), array_keys($escapers))); - - throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); - } -} - -/** - * @internal - */ -function twig_escape_filter_is_safe(Twig_Node $filterArgs) -{ - foreach ($filterArgs as $arg) { - if ($arg instanceof Twig_Node_Expression_Constant) { - return array($arg->getAttribute('value')); - } - - return array(); - } - - return array('html'); -} - -function twig_convert_encoding($string, $to, $from) -{ - return iconv($from, $to, $string); -} - -/** - * Returns the length of a variable. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $thing A variable - * - * @return int The length of the value - */ -function twig_length_filter(Twig_Environment $env, $thing) -{ - if (null === $thing) { - return 0; - } - - if (is_scalar($thing)) { - return mb_strlen($thing, $env->getCharset()); - } - - if (method_exists($thing, '__toString') && !$thing instanceof \Countable) { - return mb_strlen((string) $thing, $env->getCharset()); - } - - if ($thing instanceof \Countable || is_array($thing)) { - return count($thing); - } - - return 1; -} - -/** - * Converts a string to uppercase. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The uppercased string - */ -function twig_upper_filter(Twig_Environment $env, $string) -{ - return mb_strtoupper($string, $env->getCharset()); -} - -/** - * Converts a string to lowercase. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The lowercased string - */ -function twig_lower_filter(Twig_Environment $env, $string) -{ - return mb_strtolower($string, $env->getCharset()); -} - -/** - * Returns a titlecased string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The titlecased string - */ -function twig_title_string_filter(Twig_Environment $env, $string) -{ - if (null !== $charset = $env->getCharset()) { - return mb_convert_case($string, MB_CASE_TITLE, $charset); - } - - return ucwords(strtolower($string)); -} - -/** - * Returns a capitalized string. - * - * @param Twig_Environment $env - * @param string $string A string - * - * @return string The capitalized string - */ -function twig_capitalize_string_filter(Twig_Environment $env, $string) -{ - $charset = $env->getCharset(); - - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, null, $charset), $charset); -} - -/** - * @internal - */ -function twig_ensure_traversable($seq) -{ - if ($seq instanceof Traversable || is_array($seq)) { - return $seq; - } - - return array(); -} - -/** - * Checks if a variable is empty. - * - *
    - * {# evaluates to true if the foo variable is null, false, or the empty string #}
    - * {% if foo is empty %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    - * - * @param mixed $value A variable - * - * @return bool true if the value is empty, false otherwise - */ -function twig_test_empty($value) -{ - if ($value instanceof Countable) { - return 0 == count($value); - } - - if (is_object($value) && method_exists($value, '__toString')) { - return '' === (string) $value; - } - - return '' === $value || false === $value || null === $value || array() === $value; -} - -/** - * Checks if a variable is traversable. - * - *
    - * {# evaluates to true if the foo variable is an array or a traversable object #}
    - * {% if foo is traversable %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    - * - * @param mixed $value A variable - * - * @return bool true if the value is traversable - */ -function twig_test_iterable($value) -{ - return $value instanceof Traversable || is_array($value); -} - -/** - * Renders a template. - * - * @param Twig_Environment $env - * @param array $context - * @param string|array $template The template to render or an array of templates to try consecutively - * @param array $variables The variables to pass to the template - * @param bool $withContext - * @param bool $ignoreMissing Whether to ignore missing templates or not - * @param bool $sandboxed Whether to sandbox the template or not - * - * @return string The rendered template - */ -function twig_include(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false) -{ - $alreadySandboxed = false; - $sandbox = null; - if ($withContext) { - $variables = array_merge($context, $variables); - } - - if ($isSandboxed = $sandboxed && $env->hasExtension('Twig_Extension_Sandbox')) { - $sandbox = $env->getExtension('Twig_Extension_Sandbox'); - if (!$alreadySandboxed = $sandbox->isSandboxed()) { - $sandbox->enableSandbox(); - } - } - - $result = null; - try { - $result = $env->resolveTemplate($template)->render($variables); - } catch (Twig_Error_Loader $e) { - if (!$ignoreMissing) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - } catch (Throwable $e) { - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - throw $e; - } - - if ($isSandboxed && !$alreadySandboxed) { - $sandbox->disableSandbox(); - } - - return $result; -} - -/** - * Returns a template content without rendering it. - * - * @param Twig_Environment $env - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not - * - * @return string The template source - */ -function twig_source(Twig_Environment $env, $name, $ignoreMissing = false) -{ - $loader = $env->getLoader(); - try { - return $loader->getSourceContext($name)->getCode(); - } catch (Twig_Error_Loader $e) { - if (!$ignoreMissing) { - throw $e; - } - } -} - -/** - * Provides the ability to get constants from instances as well as class/global constants. - * - * @param string $constant The name of the constant - * @param null|object $object The object to get the constant from - * - * @return string - */ -function twig_constant($constant, $object = null) -{ - if (null !== $object) { - $constant = get_class($object).'::'.$constant; - } - - return constant($constant); -} - -/** - * Checks if a constant exists. - * - * @param string $constant The name of the constant - * @param null|object $object The object to get the constant from - * - * @return bool - */ -function twig_constant_is_defined($constant, $object = null) -{ - if (null !== $object) { - $constant = get_class($object).'::'.$constant; - } - - return defined($constant); -} - -/** - * Batches item. - * - * @param array $items An array of items - * @param int $size The size of the batch - * @param mixed $fill A value used to fill missing items - * - * @return array - */ -function twig_array_batch($items, $size, $fill = null) -{ - if ($items instanceof Traversable) { - $items = iterator_to_array($items, false); - } - - $size = ceil($size); - - $result = array_chunk($items, $size, true); - - if (null !== $fill && !empty($result)) { - $last = count($result) - 1; - if ($fillCount = $size - count($result[$last])) { - $result[$last] = array_merge( - $result[$last], - array_fill(0, $fillCount, $fill) - ); - } - } - - return $result; -} - -/** - * Returns the attribute value for a given array/object. - * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see Twig_Template constants) - * @param bool $isDefinedTest Whether this is only a defined check - * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not - * - * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true - * - * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false - * - * @internal - */ -function twig_get_attribute(Twig_Environment $env, Twig_Source $source, $object, $item, array $arguments = array(), $type = Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) -{ - // array - if (Twig_Template::METHOD_CALL !== $type) { - $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; - - if ((is_array($object) && (isset($object[$arrayItem]) || array_key_exists($arrayItem, $object))) - || ($object instanceof ArrayAccess && isset($object[$arrayItem])) - ) { - if ($isDefinedTest) { - return true; - } - - return $object[$arrayItem]; - } - - if (Twig_Template::ARRAY_CALL === $type || !is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - if ($object instanceof ArrayAccess) { - $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, get_class($object)); - } elseif (is_object($object)) { - $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, get_class($object)); - } elseif (is_array($object)) { - if (empty($object)) { - $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); - } else { - $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); - } - } elseif (Twig_Template::ARRAY_CALL === $type) { - if (null === $object) { - $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - } elseif (null === $object) { - $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - - throw new Twig_Error_Runtime($message, -1, $source); - } - } - - if (!is_object($object)) { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - if (null === $object) { - $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); - } else { - $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, gettype($object), $object); - } - - throw new Twig_Error_Runtime($message, -1, $source); - } - - if ($object instanceof Twig_Template) { - throw new Twig_Error_Runtime('Accessing Twig_Template attributes is forbidden.'); - } - - // object property - if (Twig_Template::METHOD_CALL !== $type) { - if (isset($object->$item) || array_key_exists((string) $item, $object)) { - if ($isDefinedTest) { - return true; - } - - if ($env->hasExtension('Twig_Extension_Sandbox')) { - $env->getExtension('Twig_Extension_Sandbox')->checkPropertyAllowed($object, $item); - } - - return $object->$item; - } - } - - static $cache = array(); - - $class = get_class($object); - - // object method - // precedence: getXxx() > isXxx() > hasXxx() - if (!isset($cache[$class])) { - $methods = get_class_methods($object); - sort($methods); - $lcMethods = array_map('strtolower', $methods); - $classCache = array(); - foreach ($methods as $i => $method) { - $classCache[$method] = $method; - $classCache[$lcName = $lcMethods[$i]] = $method; - - if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { - $name = substr($method, 2); - $lcName = substr($lcName, 2); - } elseif ('h' === $lcName[0] && 0 === strpos($lcName, 'has')) { - $name = substr($method, 3); - $lcName = substr($lcName, 3); - if (in_array('is'.$lcName, $lcMethods)) { - continue; - } - } else { - continue; - } - - // skip get() and is() methods (in which case, $name is empty) - if ($name) { - if (!isset($classCache[$name])) { - $classCache[$name] = $method; - } - - if (!isset($classCache[$lcName])) { - $classCache[$lcName] = $method; - } - } - } - $cache[$class] = $classCache; - } - - $call = false; - if (isset($cache[$class][$item])) { - $method = $cache[$class][$item]; - } elseif (isset($cache[$class][$lcItem = strtolower($item)])) { - $method = $cache[$class][$lcItem]; - } elseif (isset($cache[$class]['__call'])) { - $method = $item; - $call = true; - } else { - if ($isDefinedTest) { - return false; - } - - if ($ignoreStrictCheck || !$env->isStrictVariables()) { - return; - } - - throw new Twig_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $source); - } - - if ($isDefinedTest) { - return true; - } - - if ($env->hasExtension('Twig_Extension_Sandbox')) { - $env->getExtension('Twig_Extension_Sandbox')->checkMethodAllowed($object, $method); - } - - // Some objects throw exceptions when they have __call, and the method we try - // to call is not supported. If ignoreStrictCheck is true, we should return null. - try { - $ret = $object->$method(...$arguments); - } catch (BadMethodCallException $e) { - if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) { - return; - } - throw $e; - } - - return $ret; -} - -class_alias('Twig_Extension_Core', 'Twig\Extension\CoreExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Debug.php b/vendor/twig/twig/lib/Twig/Extension/Debug.php deleted file mode 100644 index a4f7b3c..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Debug.php +++ /dev/null @@ -1,56 +0,0 @@ - $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), - ); - } -} - -function twig_var_dump(Twig_Environment $env, $context, ...$vars) -{ - if (!$env->isDebug()) { - return; - } - - ob_start(); - - if (!$vars) { - $vars = array(); - foreach ($context as $key => $value) { - if (!$value instanceof Twig_Template) { - $vars[$key] = $value; - } - } - - var_dump($vars); - } else { - var_dump(...$vars); - } - - return ob_get_clean(); -} - -class_alias('Twig_Extension_Debug', 'Twig\Extension\DebugExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Escaper.php b/vendor/twig/twig/lib/Twig/Extension/Escaper.php deleted file mode 100644 index c0fd667..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Escaper.php +++ /dev/null @@ -1,91 +0,0 @@ -setDefaultStrategy($defaultStrategy); - } - - public function getTokenParsers() - { - return array(new Twig_TokenParser_AutoEscape()); - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Escaper()); - } - - public function getFilters() - { - return array( - new Twig_Filter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), - ); - } - - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * name as an argument and returns the strategy to use. - * - * @param string|false|callable $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) - { - if ('name' === $defaultStrategy) { - $defaultStrategy = array('Twig_FileExtensionEscapingStrategy', 'guess'); - } - - $this->defaultStrategy = $defaultStrategy; - } - - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $name The template name - * - * @return string|false The default strategy to use for the template - */ - public function getDefaultStrategy($name) - { - // disable string callables to avoid calling a function named html or js, - // or any other upcoming escaping strategy - if (!is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { - return call_user_func($this->defaultStrategy, $name); - } - - return $this->defaultStrategy; - } -} - -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - * - * @return string - */ -function twig_raw_filter($string) -{ - return $string; -} - -class_alias('Twig_Extension_Escaper', 'Twig\Extension\EscaperExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php b/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php deleted file mode 100644 index 518e3ca..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - */ -interface Twig_Extension_GlobalsInterface -{ - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals(); -} - -class_alias('Twig_Extension_GlobalsInterface', 'Twig\Extension\GlobalsInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php b/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php deleted file mode 100644 index eab6191..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ -interface Twig_Extension_InitRuntimeInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - public function initRuntime(Twig_Environment $environment); -} - -class_alias('Twig_Extension_InitRuntimeInterface', 'Twig\Extension\InitRuntimeInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php b/vendor/twig/twig/lib/Twig/Extension/Optimizer.php deleted file mode 100644 index 8b5bba5..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Optimizer.php +++ /dev/null @@ -1,27 +0,0 @@ -optimizers = $optimizers; - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); - } -} - -class_alias('Twig_Extension_Optimizer', 'Twig\Extension\OptimizerExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Profiler.php b/vendor/twig/twig/lib/Twig/Extension/Profiler.php deleted file mode 100644 index ffad77c..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Profiler.php +++ /dev/null @@ -1,44 +0,0 @@ -actives[] = $profile; - } - - public function enter(Twig_Profiler_Profile $profile) - { - $this->actives[0]->addProfile($profile); - array_unshift($this->actives, $profile); - } - - public function leave(Twig_Profiler_Profile $profile) - { - $profile->leave(); - array_shift($this->actives); - - if (1 === count($this->actives)) { - $this->actives[0]->leave(); - } - } - - public function getNodeVisitors() - { - return array(new Twig_Profiler_NodeVisitor_Profiler(get_class($this))); - } -} - -class_alias('Twig_Extension_Profiler', 'Twig\Extension\ProfilerExtension', false); -class_exists('Twig_Profiler_Profile'); diff --git a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php b/vendor/twig/twig/lib/Twig/Extension/Sandbox.php deleted file mode 100644 index 3ab71c3..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Sandbox.php +++ /dev/null @@ -1,95 +0,0 @@ -policy = $policy; - $this->sandboxedGlobally = $sandboxed; - } - - public function getTokenParsers() - { - return array(new Twig_TokenParser_Sandbox()); - } - - public function getNodeVisitors() - { - return array(new Twig_NodeVisitor_Sandbox()); - } - - public function enableSandbox() - { - $this->sandboxed = true; - } - - public function disableSandbox() - { - $this->sandboxed = false; - } - - public function isSandboxed() - { - return $this->sandboxedGlobally || $this->sandboxed; - } - - public function isSandboxedGlobally() - { - return $this->sandboxedGlobally; - } - - public function setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy) - { - $this->policy = $policy; - } - - public function getSecurityPolicy() - { - return $this->policy; - } - - public function checkSecurity($tags, $filters, $functions) - { - if ($this->isSandboxed()) { - $this->policy->checkSecurity($tags, $filters, $functions); - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkMethodAllowed($obj, $method); - } - } - - public function checkPropertyAllowed($obj, $method) - { - if ($this->isSandboxed()) { - $this->policy->checkPropertyAllowed($obj, $method); - } - } - - public function ensureToStringAllowed($obj) - { - if ($this->isSandboxed() && is_object($obj)) { - $this->policy->checkMethodAllowed($obj, '__toString'); - } - - return $obj; - } -} - -class_alias('Twig_Extension_Sandbox', 'Twig\Extension\SandboxExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/Staging.php b/vendor/twig/twig/lib/Twig/Extension/Staging.php deleted file mode 100644 index 926b2b7..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/Staging.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * @internal - */ -final class Twig_Extension_Staging extends Twig_Extension -{ - private $functions = array(); - private $filters = array(); - private $visitors = array(); - private $tokenParsers = array(); - private $tests = array(); - - public function addFunction(Twig_Function $function) - { - if (isset($this->functions[$function->getName()])) { - throw new LogicException(sprintf('Function "%s" is already registered.', $function->getName())); - } - - $this->functions[$function->getName()] = $function; - } - - public function getFunctions() - { - return $this->functions; - } - - public function addFilter(Twig_Filter $filter) - { - if (isset($this->filters[$filter->getName()])) { - throw new LogicException(sprintf('Filter "%s" is already registered.', $filter->getName())); - } - - $this->filters[$filter->getName()] = $filter; - } - - public function getFilters() - { - return $this->filters; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - $this->visitors[] = $visitor; - } - - public function getNodeVisitors() - { - return $this->visitors; - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - if (isset($this->tokenParsers[$parser->getTag()])) { - throw new LogicException(sprintf('Tag "%s" is already registered.', $parser->getTag())); - } - - $this->tokenParsers[$parser->getTag()] = $parser; - } - - public function getTokenParsers() - { - return $this->tokenParsers; - } - - public function addTest(Twig_Test $test) - { - if (isset($this->tests[$test->getName()])) { - throw new LogicException(sprintf('Test "%s" is already registered.', $test->getTag())); - } - - $this->tests[$test->getName()] = $test; - } - - public function getTests() - { - return $this->tests; - } -} - -class_alias('Twig_Extension_Staging', 'Twig\Extension\StagingExtension', false); diff --git a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php b/vendor/twig/twig/lib/Twig/Extension/StringLoader.php deleted file mode 100644 index de3593d..0000000 --- a/vendor/twig/twig/lib/Twig/Extension/StringLoader.php +++ /dev/null @@ -1,39 +0,0 @@ - true)), - ); - } -} - -/** - * Loads a template from a string. - * - *
    - * {{ include(template_from_string("Hello {{ name }}")) }}
    - * 
    - * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $template A template as a string or object implementing __toString() - * - * @return Twig_Template - */ -function twig_template_from_string(Twig_Environment $env, $template) -{ - return $env->createTemplate((string) $template); -} - -class_alias('Twig_Extension_StringLoader', 'Twig\Extension\StringLoaderExtension', false); diff --git a/vendor/twig/twig/lib/Twig/ExtensionInterface.php b/vendor/twig/twig/lib/Twig/ExtensionInterface.php deleted file mode 100644 index 66d2b99..0000000 --- a/vendor/twig/twig/lib/Twig/ExtensionInterface.php +++ /dev/null @@ -1,63 +0,0 @@ - - */ -interface Twig_ExtensionInterface -{ - /** - * Returns the token parser instances to add to the existing list. - * - * @return Twig_TokenParserInterface[] - */ - public function getTokenParsers(); - - /** - * Returns the node visitor instances to add to the existing list. - * - * @return Twig_NodeVisitorInterface[] - */ - public function getNodeVisitors(); - - /** - * Returns a list of filters to add to the existing list. - * - * @return Twig_Filter[] - */ - public function getFilters(); - - /** - * Returns a list of tests to add to the existing list. - * - * @return Twig_Test[] - */ - public function getTests(); - - /** - * Returns a list of functions to add to the existing list. - * - * @return Twig_Function[] - */ - public function getFunctions(); - - /** - * Returns a list of operators to add to the existing list. - * - * @return array First array of unary operators, second array of binary operators - */ - public function getOperators(); -} - -class_alias('Twig_ExtensionInterface', 'Twig\Extension\ExtensionInterface', false); -class_exists('Twig_Environment'); diff --git a/vendor/twig/twig/lib/Twig/ExtensionSet.php b/vendor/twig/twig/lib/Twig/ExtensionSet.php deleted file mode 100644 index da29912..0000000 --- a/vendor/twig/twig/lib/Twig/ExtensionSet.php +++ /dev/null @@ -1,483 +0,0 @@ - - * - * @internal - */ -final class Twig_ExtensionSet -{ - private $extensions; - private $initialized = false; - private $runtimeInitialized = false; - private $staging; - private $parsers; - private $visitors; - private $filters; - private $tests; - private $functions; - private $unaryOperators; - private $binaryOperators; - private $globals; - private $functionCallbacks = array(); - private $filterCallbacks = array(); - private $lastModified = 0; - - public function __construct() - { - $this->staging = new Twig_Extension_Staging(); - } - - /** - * Initializes the runtime environment. - */ - public function initRuntime(Twig_Environment $env) - { - if ($this->runtimeInitialized) { - return; - } - - $this->runtimeInitialized = true; - - foreach ($this->extensions as $extension) { - if ($extension instanceof Twig_Extension_InitRuntimeInterface) { - $extension->initRuntime($env); - } - } - } - - /** - * Returns true if the given extension is registered. - * - * @param string $class The extension class name - * - * @return bool Whether the extension is registered or not - */ - public function hasExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensions[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = (new ReflectionClass($class))->name; - } - - return isset($this->extensions[$class]); - } - - /** - * Gets an extension by class name. - * - * @param string $class The extension class name - * - * @return Twig_ExtensionInterface A Twig_ExtensionInterface instance - */ - public function getExtension($class) - { - $class = ltrim($class, '\\'); - if (!isset($this->extensions[$class]) && class_exists($class, false)) { - // For BC/FC with namespaced aliases - $class = (new ReflectionClass($class))->name; - } - - if (!isset($this->extensions[$class])) { - throw new Twig_Error_Runtime(sprintf('The "%s" extension is not enabled.', $class)); - } - - return $this->extensions[$class]; - } - - /** - * Registers an array of extensions. - * - * @param array $extensions An array of extensions - */ - public function setExtensions(array $extensions) - { - foreach ($extensions as $extension) { - $this->addExtension($extension); - } - } - - /** - * Returns all registered extensions. - * - * @return array An array of extensions - */ - public function getExtensions() - { - return $this->extensions; - } - - public function getSignature() - { - return json_encode(array_keys($this->extensions)); - } - - public function isInitialized() - { - return $this->initialized || $this->runtimeInitialized; - } - - public function getLastModified() - { - if (0 !== $this->lastModified) { - return $this->lastModified; - } - - foreach ($this->extensions as $extension) { - $r = new ReflectionObject($extension); - if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) { - $this->lastModified = $extensionTime; - } - } - - return $this->lastModified; - } - - /** - * Registers an extension. - * - * @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance - */ - public function addExtension(Twig_ExtensionInterface $extension) - { - $class = get_class($extension); - - if ($this->initialized) { - throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class)); - } - - if (isset($this->extensions[$class])) { - throw new LogicException(sprintf('Unable to register extension "%s" as it is already registered.', $class)); - } - - $this->extensions[$class] = $extension; - } - - public function addFunction(Twig_Function $function) - { - if ($this->initialized) { - throw new LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $function->getName())); - } - - $this->staging->addFunction($function); - } - - public function getFunctions() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->functions; - } - - /** - * Get a function by name. - * - * @param string $name function name - * - * @return Twig_Function|false A Twig_Function instance or false if the function does not exist - */ - public function getFunction($name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->functions[$name])) { - return $this->functions[$name]; - } - - foreach ($this->functions as $pattern => $function) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $function->setArguments($matches); - - return $function; - } - } - - foreach ($this->functionCallbacks as $callback) { - if (false !== $function = $callback($name)) { - return $function; - } - } - - return false; - } - - public function registerUndefinedFunctionCallback(callable $callable) - { - $this->functionCallbacks[] = $callable; - } - - public function addFilter(Twig_Filter $filter) - { - if ($this->initialized) { - throw new LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $filter->getName())); - } - - $this->staging->addFilter($filter); - } - - public function getFilters() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->filters; - } - - /** - * Get a filter by name. - * - * Subclasses may override this method and load filters differently; - * so no list of filters is available. - * - * @param string $name The filter name - * - * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist - */ - public function getFilter($name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->filters[$name])) { - return $this->filters[$name]; - } - - foreach ($this->filters as $pattern => $filter) { - $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); - - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { - array_shift($matches); - $filter->setArguments($matches); - - return $filter; - } - } - - foreach ($this->filterCallbacks as $callback) { - if (false !== $filter = $callback($name)) { - return $filter; - } - } - - return false; - } - - public function registerUndefinedFilterCallback(callable $callable) - { - $this->filterCallbacks[] = $callable; - } - - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) - { - if ($this->initialized) { - throw new LogicException('Unable to add a node visitor as extensions have already been initialized.'); - } - - $this->staging->addNodeVisitor($visitor); - } - - public function getNodeVisitors() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->visitors; - } - - public function addTokenParser(Twig_TokenParserInterface $parser) - { - if ($this->initialized) { - throw new LogicException('Unable to add a token parser as extensions have already been initialized.'); - } - - $this->staging->addTokenParser($parser); - } - - public function getTokenParsers() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->parsers; - } - - public function getGlobals() - { - if (null !== $this->globals) { - return $this->globals; - } - - $globals = array(); - foreach ($this->extensions as $extension) { - if (!$extension instanceof Twig_Extension_GlobalsInterface) { - continue; - } - - $extGlobals = $extension->getGlobals(); - if (!is_array($extGlobals)) { - throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension))); - } - - $globals = array_merge($globals, $extGlobals); - } - - if ($this->initialized) { - $this->globals = $globals; - } - - return $globals; - } - - public function addTest(Twig_Test $test) - { - if ($this->initialized) { - throw new LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $test->getName())); - } - - $this->staging->addTest($test); - } - - public function getTests() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->tests; - } - - /** - * Gets a test by name. - * - * @param string $name The test name - * - * @return Twig_Test|false A Twig_Test instance or false if the test does not exist - */ - public function getTest($name) - { - if (!$this->initialized) { - $this->initExtensions(); - } - - if (isset($this->tests[$name])) { - return $this->tests[$name]; - } - - return false; - } - - /** - * Gets the registered unary Operators. - * - * @return array An array of unary operators - */ - public function getUnaryOperators() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->unaryOperators; - } - - /** - * Gets the registered binary Operators. - * - * @return array An array of binary operators - */ - public function getBinaryOperators() - { - if (!$this->initialized) { - $this->initExtensions(); - } - - return $this->binaryOperators; - } - - private function initExtensions() - { - $this->parsers = array(); - $this->filters = array(); - $this->functions = array(); - $this->tests = array(); - $this->visitors = array(); - $this->unaryOperators = array(); - $this->binaryOperators = array(); - - foreach ($this->extensions as $extension) { - $this->initExtension($extension); - } - $this->initExtension($this->staging); - // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception - $this->initialized = true; - } - - private function initExtension(Twig_ExtensionInterface $extension) - { - // filters - foreach ($extension->getFilters() as $filter) { - $this->filters[$filter->getName()] = $filter; - } - - // functions - foreach ($extension->getFunctions() as $function) { - $this->functions[$function->getName()] = $function; - } - - // tests - foreach ($extension->getTests() as $test) { - $this->tests[$test->getName()] = $test; - } - - // token parsers - foreach ($extension->getTokenParsers() as $parser) { - if (!$parser instanceof Twig_TokenParserInterface) { - throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface.'); - } - - $this->parsers[] = $parser; - } - - // node visitors - foreach ($extension->getNodeVisitors() as $visitor) { - $this->visitors[] = $visitor; - } - - // operators - if ($operators = $extension->getOperators()) { - if (!is_array($operators)) { - throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', get_class($extension), is_object($operators) ? get_class($operators) : gettype($operators).(is_resource($operators) ? '' : '#'.$operators))); - } - - if (2 !== count($operators)) { - throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', get_class($extension), count($operators))); - } - - $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); - $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); - } - } -} - -class_alias('Twig_ExtensionSet', 'Twig\ExtensionSet', false); diff --git a/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php b/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php deleted file mode 100644 index 2cdaded..0000000 --- a/vendor/twig/twig/lib/Twig/FactoryRuntimeLoader.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Twig_FactoryRuntimeLoader implements Twig_RuntimeLoaderInterface -{ - private $map; - - /** - * @param array $map An array where keys are class names and values factory callables - */ - public function __construct($map = array()) - { - $this->map = $map; - } - - public function load($class) - { - if (isset($this->map[$class])) { - $runtimeFactory = $this->map[$class]; - - return $runtimeFactory(); - } - } -} - -class_alias('Twig_FactoryRuntimeLoader', 'Twig\RuntimeLoader\FactoryRuntimeLoader', false); diff --git a/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php b/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php deleted file mode 100644 index 8f8cd2e..0000000 --- a/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php +++ /dev/null @@ -1,60 +0,0 @@ - - */ -class Twig_FileExtensionEscapingStrategy -{ - /** - * Guesses the best autoescaping strategy based on the file name. - * - * @param string $name The template name - * - * @return string|false The escaping strategy name to use or false to disable - */ - public static function guess($name) - { - if (in_array(substr($name, -1), array('/', '\\'))) { - return 'html'; // return html for directories - } - - if ('.twig' === substr($name, -5)) { - $name = substr($name, 0, -5); - } - - $extension = pathinfo($name, PATHINFO_EXTENSION); - - switch ($extension) { - case 'js': - return 'js'; - - case 'css': - return 'css'; - - case 'txt': - return false; - - default: - return 'html'; - } - } -} - -class_alias('Twig_FileExtensionEscapingStrategy', 'Twig\FileExtensionEscapingStrategy', false); diff --git a/vendor/twig/twig/lib/Twig/Filter.php b/vendor/twig/twig/lib/Twig/Filter.php deleted file mode 100644 index e310767..0000000 --- a/vendor/twig/twig/lib/Twig/Filter.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * @see http://twig.sensiolabs.org/doc/templates.html#filters - */ -class Twig_Filter -{ - private $name; - private $callable; - private $options; - private $arguments = array(); - - /** - * Creates a template filter. - * - * @param string $name Name of this filter - * @param callable|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = array()) - { - if (__CLASS__ !== get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'pre_escape' => null, - 'preserves_safety' => null, - 'node_class' => 'Twig_Node_Expression_Filter', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this filter. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $filterArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return $this->options['is_safe_callback']($filterArgs); - } - } - - public function getPreservesSafety() - { - return $this->options['preserves_safety']; - } - - public function getPreEscape() - { - return $this->options['pre_escape']; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig_Filter', 'Twig_SimpleFilter', false); - -class_alias('Twig_Filter', 'Twig\TwigFilter', false); diff --git a/vendor/twig/twig/lib/Twig/Function.php b/vendor/twig/twig/lib/Twig/Function.php deleted file mode 100644 index 22ab415..0000000 --- a/vendor/twig/twig/lib/Twig/Function.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * @see http://twig.sensiolabs.org/doc/templates.html#functions - */ -class Twig_Function -{ - private $name; - private $callable; - private $options; - private $arguments = array(); - - /** - * Creates a template function. - * - * @param string $name Name of this function - * @param callable|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = array()) - { - if (__CLASS__ !== get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - 'is_variadic' => false, - 'is_safe' => null, - 'is_safe_callback' => null, - 'node_class' => 'Twig_Node_Expression_Function', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this function. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - public function getArguments() - { - return $this->arguments; - } - - public function needsEnvironment() - { - return $this->options['needs_environment']; - } - - public function needsContext() - { - return $this->options['needs_context']; - } - - public function getSafe(Twig_Node $functionArgs) - { - if (null !== $this->options['is_safe']) { - return $this->options['is_safe']; - } - - if (null !== $this->options['is_safe_callback']) { - return $this->options['is_safe_callback']($functionArgs); - } - - return array(); - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig_Function', 'Twig_SimpleFunction', false); - -class_alias('Twig_Function', 'Twig\TwigFunction', false); diff --git a/vendor/twig/twig/lib/Twig/Lexer.php b/vendor/twig/twig/lib/Twig/Lexer.php deleted file mode 100644 index bac1cc8..0000000 --- a/vendor/twig/twig/lib/Twig/Lexer.php +++ /dev/null @@ -1,395 +0,0 @@ - - */ -class Twig_Lexer -{ - private $tokens; - private $code; - private $cursor; - private $lineno; - private $end; - private $state; - private $states; - private $brackets; - private $env; - private $source; - private $options; - private $regexes; - private $position; - private $positions; - private $currentVarBlockLine; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - const STATE_STRING = 3; - const STATE_INTERPOLATION = 4; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; - const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const REGEX_DQ_STRING_DELIM = '/"/A'; - const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; - const PUNCTUATION = '()[]{}?:.,|'; - - public function __construct(Twig_Environment $env, array $options = array()) - { - $this->env = $env; - - $this->options = array_merge(array( - 'tag_comment' => array('{#', '#}'), - 'tag_block' => array('{%', '%}'), - 'tag_variable' => array('{{', '}}'), - 'whitespace_trim' => '-', - 'interpolation' => array('#{', '}'), - ), $options); - - $this->regexes = array( - 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', - 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', - 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:endverbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', - 'operator' => $this->getOperatorRegex(), - 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', - 'lex_block_raw' => '/\s*verbatim\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As', - 'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', - 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', - 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', - 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', - ); - } - - public function tokenize(Twig_Source $source) - { - $this->source = $source; - $this->code = str_replace(array("\r\n", "\r"), "\n", $source->getCode()); - $this->cursor = 0; - $this->lineno = 1; - $this->end = strlen($this->code); - $this->tokens = array(); - $this->state = self::STATE_DATA; - $this->states = array(); - $this->brackets = array(); - $this->position = -1; - - // find all token starts in one go - preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); - $this->positions = $matches; - - while ($this->cursor < $this->end) { - // dispatch to the lexing functions depending - // on the current state - switch ($this->state) { - case self::STATE_DATA: - $this->lexData(); - break; - - case self::STATE_BLOCK: - $this->lexBlock(); - break; - - case self::STATE_VAR: - $this->lexVar(); - break; - - case self::STATE_STRING: - $this->lexString(); - break; - - case self::STATE_INTERPOLATION: - $this->lexInterpolation(); - break; - } - } - - $this->pushToken(Twig_Token::EOF_TYPE); - - if (!empty($this->brackets)) { - list($expect, $lineno) = array_pop($this->brackets); - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - return new Twig_TokenStream($this->tokens, $this->source); - } - - private function lexData() - { - // if no matches are left we return the rest of the template as simple text token - if ($this->position == count($this->positions[0]) - 1) { - $this->pushToken(Twig_Token::TEXT_TYPE, substr($this->code, $this->cursor)); - $this->cursor = $this->end; - - return; - } - - // Find the first token after the current cursor - $position = $this->positions[0][++$this->position]; - while ($position[1] < $this->cursor) { - if ($this->position == count($this->positions[0]) - 1) { - return; - } - $position = $this->positions[0][++$this->position]; - } - - // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); - if (isset($this->positions[2][$this->position][0])) { - $text = rtrim($text); - } - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - $this->moveCursor($textContent.$position[0]); - - switch ($this->positions[1][$this->position][0]) { - case $this->options['tag_comment'][0]: - $this->lexComment(); - break; - - case $this->options['tag_block'][0]: - // raw data? - if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lexRawData(); - // {% line \d+ %} - } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - $this->lineno = (int) $match[1]; - } else { - $this->pushToken(Twig_Token::BLOCK_START_TYPE); - $this->pushState(self::STATE_BLOCK); - $this->currentVarBlockLine = $this->lineno; - } - break; - - case $this->options['tag_variable'][0]: - $this->pushToken(Twig_Token::VAR_START_TYPE); - $this->pushState(self::STATE_VAR); - $this->currentVarBlockLine = $this->lineno; - break; - } - } - - private function lexBlock() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::BLOCK_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function lexVar() - { - if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::VAR_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function lexExpression() - { - // whitespace - if (preg_match('/\s+/A', $this->code, $match, null, $this->cursor)) { - $this->moveCursor($match[0]); - - if ($this->cursor >= $this->end) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); - } - } - - // operators - if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::OPERATOR_TYPE, preg_replace('/\s+/', ' ', $match[0])); - $this->moveCursor($match[0]); - } - // names - elseif (preg_match(self::REGEX_NAME, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::NAME_TYPE, $match[0]); - $this->moveCursor($match[0]); - } - // numbers - elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { - $number = (float) $match[0]; // floats - if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { - $number = (int) $match[0]; // integers lower than the maximum - } - $this->pushToken(Twig_Token::NUMBER_TYPE, $number); - $this->moveCursor($match[0]); - } - // punctuation - elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { - // opening bracket - if (false !== strpos('([{', $this->code[$this->cursor])) { - $this->brackets[] = array($this->code[$this->cursor], $this->lineno); - } - // closing bracket - elseif (false !== strpos(')]}', $this->code[$this->cursor])) { - if (empty($this->brackets)) { - throw new Twig_Error_Syntax(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - } - - $this->pushToken(Twig_Token::PUNCTUATION_TYPE, $this->code[$this->cursor]); - ++$this->cursor; - } - // strings - elseif (preg_match(self::REGEX_STRING, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); - $this->moveCursor($match[0]); - } - // opening double quoted string - elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array('"', $this->lineno); - $this->pushState(self::STATE_STRING); - $this->moveCursor($match[0]); - } - // unlexable - else { - throw new Twig_Error_Syntax(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); - } - } - - private function lexRawData() - { - if (!preg_match($this->regexes['lex_raw_data'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax('Unexpected end of file: Unclosed "verbatim" block.', $this->lineno, $this->source); - } - - $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->moveCursor($text.$match[0][0]); - - if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { - $text = rtrim($text); - } - - $this->pushToken(Twig_Token::TEXT_TYPE, $text); - } - - private function lexComment() - { - if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax('Unclosed comment.', $this->lineno, $this->source); - } - - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); - } - - private function lexString() - { - if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) { - $this->brackets[] = array($this->options['interpolation'][0], $this->lineno); - $this->pushToken(Twig_Token::INTERPOLATION_START_TYPE); - $this->moveCursor($match[0]); - $this->pushState(self::STATE_INTERPOLATION); - } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) { - $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0])); - $this->moveCursor($match[0]); - } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { - list($expect, $lineno) = array_pop($this->brackets); - if ($this->code[$this->cursor] != '"') { - throw new Twig_Error_Syntax(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); - } - - $this->popState(); - ++$this->cursor; - } - } - - private function lexInterpolation() - { - $bracket = end($this->brackets); - if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) { - array_pop($this->brackets); - $this->pushToken(Twig_Token::INTERPOLATION_END_TYPE); - $this->moveCursor($match[0]); - $this->popState(); - } else { - $this->lexExpression(); - } - } - - private function pushToken($type, $value = '') - { - // do not push empty text tokens - if (Twig_Token::TEXT_TYPE === $type && '' === $value) { - return; - } - - $this->tokens[] = new Twig_Token($type, $value, $this->lineno); - } - - private function moveCursor($text) - { - $this->cursor += strlen($text); - $this->lineno += substr_count($text, "\n"); - } - - private function getOperatorRegex() - { - $operators = array_merge( - array('='), - array_keys($this->env->getUnaryOperators()), - array_keys($this->env->getBinaryOperators()) - ); - - $operators = array_combine($operators, array_map('strlen', $operators)); - arsort($operators); - - $regex = array(); - foreach ($operators as $operator => $length) { - // an operator that ends with a character must be followed by - // a whitespace or a parenthesis - if (ctype_alpha($operator[$length - 1])) { - $r = preg_quote($operator, '/').'(?=[\s()])'; - } else { - $r = preg_quote($operator, '/'); - } - - // an operator with a space can be any amount of whitespaces - $r = preg_replace('/\s+/', '\s+', $r); - - $regex[] = $r; - } - - return '/'.implode('|', $regex).'/A'; - } - - private function pushState($state) - { - $this->states[] = $this->state; - $this->state = $state; - } - - private function popState() - { - if (0 === count($this->states)) { - throw new LogicException('Cannot pop state without a previous state.'); - } - - $this->state = array_pop($this->states); - } -} - -class_alias('Twig_Lexer', 'Twig\Lexer', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/Array.php b/vendor/twig/twig/lib/Twig/Loader/Array.php deleted file mode 100644 index ba23bfa..0000000 --- a/vendor/twig/twig/lib/Twig/Loader/Array.php +++ /dev/null @@ -1,81 +0,0 @@ - - */ -final class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - private $templates = array(); - - /** - * @param array $templates An array of templates (keys are the names, and values are the source code) - */ - public function __construct(array $templates = array()) - { - $this->templates = $templates; - } - - /** - * Adds or overrides a template. - * - * @param string $name The template name - * @param string $template The template source - */ - public function setTemplate($name, $template) - { - $this->templates[$name] = $template; - } - - public function getSourceContext($name) - { - $name = (string) $name; - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return new Twig_Source($this->templates[$name], $name); - } - - public function exists($name) - { - return isset($this->templates[$name]); - } - - public function getCacheKey($name) - { - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return $name.':'.$this->templates[$name]; - } - - public function isFresh($name, $time) - { - if (!isset($this->templates[$name])) { - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); - } - - return true; - } -} - -class_alias('Twig_Loader_Array', 'Twig\Loader\ArrayLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/Chain.php b/vendor/twig/twig/lib/Twig/Loader/Chain.php deleted file mode 100644 index dba9b77..0000000 --- a/vendor/twig/twig/lib/Twig/Loader/Chain.php +++ /dev/null @@ -1,108 +0,0 @@ - - */ -final class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - private $hasSourceCache = array(); - private $loaders = array(); - - /** - * @param Twig_LoaderInterface[] $loaders - */ - public function __construct(array $loaders = array()) - { - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - public function addLoader(Twig_LoaderInterface $loader) - { - $this->loaders[] = $loader; - $this->hasSourceCache = array(); - } - - public function getSourceContext($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->getSourceContext($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = $e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function exists($name) - { - if (isset($this->hasSourceCache[$name])) { - return $this->hasSourceCache[$name]; - } - - foreach ($this->loaders as $loader) { - if ($loader->exists($name)) { - return $this->hasSourceCache[$name] = true; - } - } - - return $this->hasSourceCache[$name] = false; - } - - public function getCacheKey($name) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->getCacheKey($name); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } - - public function isFresh($name, $time) - { - $exceptions = array(); - foreach ($this->loaders as $loader) { - if (!$loader->exists($name)) { - continue; - } - - try { - return $loader->isFresh($name, $time); - } catch (Twig_Error_Loader $e) { - $exceptions[] = get_class($loader).': '.$e->getMessage(); - } - } - - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); - } -} - -class_alias('Twig_Loader_Chain', 'Twig\Loader\ChainLoader', false); diff --git a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php b/vendor/twig/twig/lib/Twig/Loader/Filesystem.php deleted file mode 100644 index 6b38897..0000000 --- a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php +++ /dev/null @@ -1,284 +0,0 @@ - - */ -class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface, Twig_SourceContextLoaderInterface -{ - /** Identifier of the main namespace. */ - const MAIN_NAMESPACE = '__main__'; - - protected $paths = array(); - protected $cache = array(); - protected $errorCache = array(); - - private $rootPath; - - /** - * @param string|array $paths A path or an array of paths where to look for templates - * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) - */ - public function __construct($paths = array(), $rootPath = null) - { - $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).DIRECTORY_SEPARATOR; - if (false !== $realPath = realpath($rootPath)) { - $this->rootPath = $realPath.DIRECTORY_SEPARATOR; - } - - if ($paths) { - $this->setPaths($paths); - } - } - - /** - * Returns the paths to the templates. - * - * @param string $namespace A path namespace - * - * @return array The array of paths where to look for templates - */ - public function getPaths($namespace = self::MAIN_NAMESPACE) - { - return isset($this->paths[$namespace]) ? $this->paths[$namespace] : array(); - } - - /** - * Returns the path namespaces. - * - * The main namespace is always defined. - * - * @return array The array of defined namespaces - */ - public function getNamespaces() - { - return array_keys($this->paths); - } - - /** - * Sets the paths where templates are stored. - * - * @param string|array $paths A path or an array of paths where to look for templates - * @param string $namespace A path namespace - */ - public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) - { - if (!is_array($paths)) { - $paths = array($paths); - } - - $this->paths[$namespace] = array(); - foreach ($paths as $path) { - $this->addPath($path, $namespace); - } - } - - /** - * Adds a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws Twig_Error_Loader - */ - public function addPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = array(); - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $this->paths[$namespace][] = rtrim($path, '/\\'); - } - - /** - * Prepends a path where templates are stored. - * - * @param string $path A path where to look for templates - * @param string $namespace A path namespace - * - * @throws Twig_Error_Loader - */ - public function prependPath($path, $namespace = self::MAIN_NAMESPACE) - { - // invalidate the cache - $this->cache = $this->errorCache = array(); - - $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; - if (!is_dir($checkPath)) { - throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); - } - - $path = rtrim($path, '/\\'); - - if (!isset($this->paths[$namespace])) { - $this->paths[$namespace][] = $path; - } else { - array_unshift($this->paths[$namespace], $path); - } - } - - public function getSourceContext($name) - { - $path = $this->findTemplate($name); - - return new Twig_Source(file_get_contents($path), $name, $path); - } - - public function getCacheKey($name) - { - $path = $this->findTemplate($name); - $len = strlen($this->rootPath); - if (0 === strncmp($this->rootPath, $path, $len)) { - return substr($path, $len); - } - - return $path; - } - - public function exists($name) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return true; - } - - return false !== $this->findTemplate($name, false); - } - - public function isFresh($name, $time) - { - return filemtime($this->findTemplate($name)) <= $time; - } - - /** - * Checks if the template can be found. - * - * @param string $name The template name - * @param bool $throw Whether to throw an exception when an error occurs - * - * @return string|false The template name or false - */ - protected function findTemplate($name, $throw = true) - { - $name = $this->normalizeName($name); - - if (isset($this->cache[$name])) { - return $this->cache[$name]; - } - - if (isset($this->errorCache[$name])) { - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - $this->validateName($name); - - list($namespace, $shortname) = $this->parseName($name); - - if (!isset($this->paths[$namespace])) { - $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); - - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - foreach ($this->paths[$namespace] as $path) { - if (!$this->isAbsolutePath($path)) { - $path = $this->rootPath.'/'.$path; - } - - if (is_file($path.'/'.$shortname)) { - if (false !== $realpath = realpath($path.'/'.$shortname)) { - return $this->cache[$name] = $realpath; - } - - return $this->cache[$name] = $path.'/'.$shortname; - } - } - - $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); - - if (!$throw) { - return false; - } - - throw new Twig_Error_Loader($this->errorCache[$name]); - } - - private function normalizeName($name) - { - return preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name)); - } - - private function parseName($name, $default = self::MAIN_NAMESPACE) - { - if (isset($name[0]) && '@' == $name[0]) { - if (false === $pos = strpos($name, '/')) { - throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); - } - - $namespace = substr($name, 1, $pos - 1); - $shortname = substr($name, $pos + 1); - - return array($namespace, $shortname); - } - - return array($default, $name); - } - - private function validateName($name) - { - if (false !== strpos($name, "\0")) { - throw new Twig_Error_Loader('A template name cannot contain NUL bytes.'); - } - - $name = ltrim($name, '/'); - $parts = explode('/', $name); - $level = 0; - foreach ($parts as $part) { - if ('..' === $part) { - --$level; - } elseif ('.' !== $part) { - ++$level; - } - - if ($level < 0) { - throw new Twig_Error_Loader(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); - } - } - } - - private function isAbsolutePath($file) - { - return strspn($file, '/\\', 0, 1) - || (strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === $file[1] - && strspn($file, '/\\', 2, 1) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ; - } -} - -class_alias('Twig_Loader_Filesystem', 'Twig\Loader\FilesystemLoader', false); diff --git a/vendor/twig/twig/lib/Twig/LoaderInterface.php b/vendor/twig/twig/lib/Twig/LoaderInterface.php deleted file mode 100644 index e2f2ede..0000000 --- a/vendor/twig/twig/lib/Twig/LoaderInterface.php +++ /dev/null @@ -1,64 +0,0 @@ - - */ -interface Twig_LoaderInterface -{ - /** - * Returns the source context for a given template logical name. - * - * @param string $name The template logical name - * - * @return Twig_Source - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getSourceContext($name); - - /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key - * - * @throws Twig_Error_Loader When $name is not found - */ - public function getCacheKey($name); - - /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param int $time Timestamp of the last modification time of the - * cached template - * - * @return bool true if the template is fresh, false otherwise - * - * @throws Twig_Error_Loader When $name is not found - */ - public function isFresh($name, $time); - - /** - * Check if we have the source code of a template, given its name. - * - * @param string $name The name of the template to check if we can load - * - * @return bool If the template source code is handled by this loader or not - */ - public function exists($name); -} - -class_alias('Twig_LoaderInterface', 'Twig\Loader\LoaderInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Markup.php b/vendor/twig/twig/lib/Twig/Markup.php deleted file mode 100644 index f542169..0000000 --- a/vendor/twig/twig/lib/Twig/Markup.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class Twig_Markup implements Countable, JsonSerializable -{ - private $content; - private $charset; - - public function __construct($content, $charset) - { - $this->content = (string) $content; - $this->charset = $charset; - } - - public function __toString() - { - return $this->content; - } - - public function count() - { - return mb_strlen($this->content, $this->charset); - } - - public function jsonSerialize() - { - return $this->content; - } -} - -class_alias('Twig_Markup', 'Twig\Markup', false); diff --git a/vendor/twig/twig/lib/Twig/Node.php b/vendor/twig/twig/lib/Twig/Node.php deleted file mode 100644 index a8749cb..0000000 --- a/vendor/twig/twig/lib/Twig/Node.php +++ /dev/null @@ -1,185 +0,0 @@ - - */ -class Twig_Node implements Countable, IteratorAggregate -{ - protected $nodes; - protected $attributes; - protected $lineno; - protected $tag; - - private $name; - - /** - * Constructor. - * - * The nodes are automatically made available as properties ($this->node). - * The attributes are automatically made available as array items ($this['name']). - * - * @param array $nodes An array of named nodes - * @param array $attributes An array of attributes (should not be nodes) - * @param int $lineno The line number - * @param string $tag The tag name associated with the Node - */ - public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) - { - foreach ($nodes as $name => $node) { - if (!$node instanceof self) { - throw new InvalidArgumentException(sprintf('Using "%s" for the value of node "%s" of "%s" is not supported. You must pass a Twig_Node instance.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this))); - } - } - $this->nodes = $nodes; - $this->attributes = $attributes; - $this->lineno = $lineno; - $this->tag = $tag; - } - - public function __toString() - { - $attributes = array(); - foreach ($this->attributes as $name => $value) { - $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); - } - - $repr = array(get_class($this).'('.implode(', ', $attributes)); - - if (count($this->nodes)) { - foreach ($this->nodes as $name => $node) { - $len = strlen($name) + 4; - $noderepr = array(); - foreach (explode("\n", (string) $node) as $line) { - $noderepr[] = str_repeat(' ', $len).$line; - } - - $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); - } - - $repr[] = ')'; - } else { - $repr[0] .= ')'; - } - - return implode("\n", $repr); - } - - public function compile(Twig_Compiler $compiler) - { - foreach ($this->nodes as $node) { - $node->compile($compiler); - } - } - - public function getTemplateLine() - { - return $this->lineno; - } - - public function getNodeTag() - { - return $this->tag; - } - - /** - * @return bool - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->attributes); - } - - /** - * @return mixed - */ - public function getAttribute($name) - { - if (!array_key_exists($name, $this->attributes)) { - throw new LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->attributes[$name]; - } - - /** - * @param string $name - * @param mixed $value - */ - public function setAttribute($name, $value) - { - $this->attributes[$name] = $value; - } - - public function removeAttribute($name) - { - unset($this->attributes[$name]); - } - - /** - * @return bool - */ - public function hasNode($name) - { - return isset($this->nodes[$name]); - } - - /** - * @return Twig_Node - */ - public function getNode($name) - { - if (!isset($this->nodes[$name])) { - throw new LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, get_class($this))); - } - - return $this->nodes[$name]; - } - - public function setNode($name, Twig_Node $node) - { - $this->nodes[$name] = $node; - } - - public function removeNode($name) - { - unset($this->nodes[$name]); - } - - public function count() - { - return count($this->nodes); - } - - public function getIterator() - { - return new ArrayIterator($this->nodes); - } - - public function setTemplateName($name) - { - $this->name = $name; - foreach ($this->nodes as $node) { - $node->setTemplateName($name); - } - } - - public function getTemplateName() - { - return $this->name; - } -} - -class_alias('Twig_Node', 'Twig\Node\Node', false); -class_exists('Twig_Compiler'); diff --git a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php b/vendor/twig/twig/lib/Twig/Node/AutoEscape.php deleted file mode 100644 index 36a982b..0000000 --- a/vendor/twig/twig/lib/Twig/Node/AutoEscape.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class Twig_Node_AutoEscape extends Twig_Node -{ - public function __construct($value, Twig_Node $body, $lineno, $tag = 'autoescape') - { - parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('body')); - } -} - -class_alias('Twig_Node_AutoEscape', 'Twig\Node\AutoEscapeNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Block.php b/vendor/twig/twig/lib/Twig/Node/Block.php deleted file mode 100644 index be87ef6..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Block.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -class Twig_Node_Block extends Twig_Node -{ - public function __construct($name, Twig_Node $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") - ->indent() - ; - - $compiler - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig_Node_Block', 'Twig\Node\BlockNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/BlockReference.php deleted file mode 100644 index 92a9f39..0000000 --- a/vendor/twig/twig/lib/Twig/Node/BlockReference.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) - ; - } -} - -class_alias('Twig_Node_BlockReference', 'Twig\Node\BlockReferenceNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Body.php b/vendor/twig/twig/lib/Twig/Node/Body.php deleted file mode 100644 index 07dfef8..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Body.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -class Twig_Node_Body extends Twig_Node -{ -} - -class_alias('Twig_Node_Body', 'Twig\Node\BodyNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php b/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php deleted file mode 100644 index d57bd6f..0000000 --- a/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ -class Twig_Node_CheckSecurity extends Twig_Node -{ - private $usedFilters; - private $usedTags; - private $usedFunctions; - - public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) - { - $this->usedFilters = $usedFilters; - $this->usedTags = $usedTags; - $this->usedFunctions = $usedFunctions; - - parent::__construct(); - } - - public function compile(Twig_Compiler $compiler) - { - $tags = $filters = $functions = array(); - foreach (array('tags', 'filters', 'functions') as $type) { - foreach ($this->{'used'.ucfirst($type)} as $name => $node) { - if ($node instanceof Twig_Node) { - ${$type}[$name] = $node->getTemplateLine(); - } else { - ${$type}[$node] = null; - } - } - } - - $compiler - ->write('$tags = ')->repr(array_filter($tags))->raw(";\n") - ->write('$filters = ')->repr(array_filter($filters))->raw(";\n") - ->write('$functions = ')->repr(array_filter($functions))->raw(";\n\n") - ->write("try {\n") - ->indent() - ->write("\$this->env->getExtension('Twig_Extension_Sandbox')->checkSecurity(\n") - ->indent() - ->write(!$tags ? "array(),\n" : "array('".implode("', '", array_keys($tags))."'),\n") - ->write(!$filters ? "array(),\n" : "array('".implode("', '", array_keys($filters))."'),\n") - ->write(!$functions ? "array()\n" : "array('".implode("', '", array_keys($functions))."')\n") - ->outdent() - ->write(");\n") - ->outdent() - ->write("} catch (Twig_Sandbox_SecurityError \$e) {\n") - ->indent() - ->write("\$e->setSourceContext(\$this->getSourceContext());\n\n") - ->write("if (\$e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n") - ->outdent() - ->write("} elseif (\$e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n") - ->indent() - ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n") - ->outdent() - ->write("}\n\n") - ->write("throw \$e;\n") - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig_Node_CheckSecurity', 'Twig\Node\CheckSecurityNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Do.php b/vendor/twig/twig/lib/Twig/Node/Do.php deleted file mode 100644 index cdd7e77..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Do.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ -class Twig_Node_Do extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} - -class_alias('Twig_Node_Do', 'Twig\Node\DoNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Embed.php b/vendor/twig/twig/lib/Twig/Node/Embed.php deleted file mode 100644 index 880216f..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Embed.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class Twig_Node_Embed extends Twig_Node_Include -{ - // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) - public function __construct($name, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); - - $this->setAttribute('name', $name); - $this->setAttribute('index', $index); - } - - protected function addGetTemplate(Twig_Compiler $compiler) - { - $compiler - ->write('$this->loadTemplate(') - ->string($this->getAttribute('name')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(', ') - ->string($this->getAttribute('index')) - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Embed', 'Twig\Node\EmbedNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression.php b/vendor/twig/twig/lib/Twig/Node/Expression.php deleted file mode 100644 index a99c4e6..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression.php +++ /dev/null @@ -1,22 +0,0 @@ - - */ -abstract class Twig_Node_Expression extends Twig_Node -{ -} - -class_alias('Twig_Node_Expression', 'Twig\Node\Expression\AbstractExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php b/vendor/twig/twig/lib/Twig/Node/Expression/Array.php deleted file mode 100644 index 5c71f5e..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Array.php +++ /dev/null @@ -1,83 +0,0 @@ -index = -1; - foreach ($this->getKeyValuePairs() as $pair) { - if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { - $this->index = $pair['key']->getAttribute('value'); - } - } - } - - public function getKeyValuePairs() - { - $pairs = array(); - - foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array( - 'key' => $pair[0], - 'value' => $pair[1], - ); - } - - return $pairs; - } - - public function hasElement(Twig_Node_Expression $key) - { - foreach ($this->getKeyValuePairs() as $pair) { - // we compare the string representation of the keys - // to avoid comparing the line numbers which are not relevant here. - if ((string) $key === (string) $pair['key']) { - return true; - } - } - - return false; - } - - public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null) - { - if (null === $key) { - $key = new Twig_Node_Expression_Constant(++$this->index, $value->getTemplateLine()); - } - - array_push($this->nodes, $key, $value); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('array('); - $first = true; - foreach ($this->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ->subcompile($pair['value']) - ; - } - $compiler->raw(')'); - } -} - -class_alias('Twig_Node_Expression_Array', 'Twig\Node\Expression\ArrayExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php b/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php deleted file mode 100644 index 2e6b4c7..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php +++ /dev/null @@ -1,25 +0,0 @@ -raw('$context[') - ->string($this->getAttribute('name')) - ->raw(']') - ; - } -} - -class_alias('Twig_Node_Expression_AssignName', 'Twig\Node\Expression\AssignNameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php deleted file mode 100644 index 2401bc1..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php +++ /dev/null @@ -1,37 +0,0 @@ - $left, 'right' => $right), array(), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('left')) - ->raw(' ') - ; - $this->operator($compiler); - $compiler - ->raw(' ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - abstract public function operator(Twig_Compiler $compiler); -} - -class_alias('Twig_Node_Expression_Binary', 'Twig\Node\Expression\Binary\AbstractBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php deleted file mode 100644 index 5a09d83..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('+'); - } -} - -class_alias('Twig_Node_Expression_Binary_Add', 'Twig\Node\Expression\Binary\AddBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php deleted file mode 100644 index 9ffddce..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('&&'); - } -} - -class_alias('Twig_Node_Expression_Binary_And', 'Twig\Node\Expression\Binary\AndBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php deleted file mode 100644 index e46e9eb..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('&'); - } -} - -class_alias('Twig_Node_Expression_Binary_BitwiseAnd', 'Twig\Node\Expression\Binary\BitwiseAndBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php deleted file mode 100644 index 5d7f1b7..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('|'); - } -} - -class_alias('Twig_Node_Expression_Binary_BitwiseOr', 'Twig\Node\Expression\Binary\BitwiseOrBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php deleted file mode 100644 index 82edf51..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('^'); - } -} - -class_alias('Twig_Node_Expression_Binary_BitwiseXor', 'Twig\Node\Expression\Binary\BitwiseXorBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php deleted file mode 100644 index 91abca6..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('.'); - } -} - -class_alias('Twig_Node_Expression_Binary_Concat', 'Twig\Node\Expression\Binary\ConcatBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php deleted file mode 100644 index 38ffa30..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('/'); - } -} - -class_alias('Twig_Node_Expression_Binary_Div', 'Twig\Node\Expression\Binary\DivBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php deleted file mode 100644 index 85c5293..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php +++ /dev/null @@ -1,32 +0,0 @@ -getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig_Node_Expression_Binary_EndsWith', 'Twig\Node\Expression\Binary\EndsWithBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php deleted file mode 100644 index a6a6946..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('=='); - } -} - -class_alias('Twig_Node_Expression_Binary_Equal', 'Twig\Node\Expression\Binary\EqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php deleted file mode 100644 index 7393bcb..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +++ /dev/null @@ -1,26 +0,0 @@ -raw('(int) floor('); - parent::compile($compiler); - $compiler->raw(')'); - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('/'); - } -} - -class_alias('Twig_Node_Expression_Binary_FloorDiv', 'Twig\Node\Expression\Binary\FloorDivBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php deleted file mode 100644 index 832f979..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('>'); - } -} - -class_alias('Twig_Node_Expression_Binary_Greater', 'Twig\Node\Expression\Binary\GreaterBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php deleted file mode 100644 index c5f7624..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('>='); - } -} - -class_alias('Twig_Node_Expression_Binary_GreaterEqual', 'Twig\Node\Expression\Binary\GreaterEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php deleted file mode 100644 index af11244..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php +++ /dev/null @@ -1,30 +0,0 @@ -raw('twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('in'); - } -} - -class_alias('Twig_Node_Expression_Binary_In', 'Twig\Node\Expression\Binary\InBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php deleted file mode 100644 index ab8fc1f..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('<'); - } -} - -class_alias('Twig_Node_Expression_Binary_Less', 'Twig\Node\Expression\Binary\LessBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php deleted file mode 100644 index 71a279e..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('<='); - } -} - -class_alias('Twig_Node_Expression_Binary_LessEqual', 'Twig\Node\Expression\Binary\LessEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php deleted file mode 100644 index 5cb8558..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php +++ /dev/null @@ -1,30 +0,0 @@ -raw('preg_match(') - ->subcompile($this->getNode('right')) - ->raw(', ') - ->subcompile($this->getNode('left')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig_Node_Expression_Binary_Matches', 'Twig\Node\Expression\Binary\MatchesBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php deleted file mode 100644 index 2810963..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('%'); - } -} - -class_alias('Twig_Node_Expression_Binary_Mod', 'Twig\Node\Expression\Binary\ModBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php deleted file mode 100644 index 790c6a2..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('*'); - } -} - -class_alias('Twig_Node_Expression_Binary_Mul', 'Twig\Node\Expression\Binary\MulBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php deleted file mode 100644 index bb45c9e..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('!='); - } -} - -class_alias('Twig_Node_Expression_Binary_NotEqual', 'Twig\Node\Expression\Binary\NotEqualBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php deleted file mode 100644 index 9dedf92..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php +++ /dev/null @@ -1,30 +0,0 @@ -raw('!twig_in_filter(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('not in'); - } -} - -class_alias('Twig_Node_Expression_Binary_NotIn', 'Twig\Node\Expression\Binary\NotInBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php deleted file mode 100644 index dc9eece..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('||'); - } -} - -class_alias('Twig_Node_Expression_Binary_Or', 'Twig\Node\Expression\Binary\OrBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php deleted file mode 100644 index b8cac78..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php +++ /dev/null @@ -1,19 +0,0 @@ -raw('**'); - } -} - -class_alias('Twig_Node_Expression_Binary_Power', 'Twig\Node\Expression\Binary\PowerBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php deleted file mode 100644 index 187f676..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php +++ /dev/null @@ -1,30 +0,0 @@ -raw('range(') - ->subcompile($this->getNode('left')) - ->raw(', ') - ->subcompile($this->getNode('right')) - ->raw(')') - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw('..'); - } -} - -class_alias('Twig_Node_Expression_Binary_Range', 'Twig\Node\Expression\Binary\RangeBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php deleted file mode 100644 index 7e43b8d..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php +++ /dev/null @@ -1,32 +0,0 @@ -getVarName(); - $right = $compiler->getVarName(); - $compiler - ->raw(sprintf('(is_string($%s = ', $left)) - ->subcompile($this->getNode('left')) - ->raw(sprintf(') && is_string($%s = ', $right)) - ->subcompile($this->getNode('right')) - ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) - ; - } - - public function operator(Twig_Compiler $compiler) - { - return $compiler->raw(''); - } -} - -class_alias('Twig_Node_Expression_Binary_StartsWith', 'Twig\Node\Expression\Binary\StartsWithBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php b/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php deleted file mode 100644 index cff8ed0..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('-'); - } -} - -class_alias('Twig_Node_Expression_Binary_Sub', 'Twig\Node\Expression\Binary\SubBinary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php b/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php deleted file mode 100644 index 48c982c..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php +++ /dev/null @@ -1,84 +0,0 @@ - - */ -class Twig_Node_Expression_BlockReference extends Twig_Node_Expression -{ - public function __construct(Twig_Node $name, Twig_Node $template = null, $lineno, $tag = null) - { - $nodes = array('name' => $name); - if (null !== $template) { - $nodes['template'] = $template; - } - - parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('is_defined_test')) { - $this->compileTemplateCall($compiler, 'hasBlock'); - } else { - if ($this->getAttribute('output')) { - $compiler->addDebugInfo($this); - - $this - ->compileTemplateCall($compiler, 'displayBlock') - ->raw(";\n"); - } else { - $this->compileTemplateCall($compiler, 'renderBlock'); - } - } - } - - private function compileTemplateCall(Twig_Compiler $compiler, $method) - { - if (!$this->hasNode('template')) { - $compiler->write('$this'); - } else { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('template')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - $compiler->raw(sprintf('->%s', $method)); - $this->compileBlockArguments($compiler); - - return $compiler; - } - - private function compileBlockArguments(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('name')) - ->raw(', $context'); - - if (!$this->hasNode('template')) { - $compiler->raw(', $blocks'); - } - - return $compiler->raw(')'); - } -} - -class_alias('Twig_Node_Expression_BlockReference', 'Twig\Node\Expression\BlockReferenceExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php b/vendor/twig/twig/lib/Twig/Node/Expression/Call.php deleted file mode 100644 index 727646f..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php +++ /dev/null @@ -1,286 +0,0 @@ -getAttribute('callable'); - - $closingParenthesis = false; - if (is_string($callable) && false === strpos($callable, '::')) { - $compiler->raw($callable); - } else { - list($r, $callable) = $this->reflectCallable($callable); - if ($r instanceof ReflectionMethod && is_string($callable[0])) { - if ($r->isStatic()) { - $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); - } else { - $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); - } - } elseif ($r instanceof ReflectionMethod && $callable[0] instanceof Twig_ExtensionInterface) { - $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', get_class($callable[0]), $callable[1])); - } else { - $closingParenthesis = true; - $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); - } - } - - $this->compileArguments($compiler); - - if ($closingParenthesis) { - $compiler->raw(')'); - } - } - - protected function compileArguments(Twig_Compiler $compiler) - { - $compiler->raw('('); - - $first = true; - - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - $compiler->raw('$this->env'); - $first = false; - } - - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->raw('$context'); - $first = false; - } - - if ($this->hasAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->string($argument); - $first = false; - } - } - - if ($this->hasNode('node')) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($this->getNode('node')); - $first = false; - } - - if ($this->hasNode('arguments')) { - $callable = $this->getAttribute('callable'); - $arguments = $this->getArguments($callable, $this->getNode('arguments')); - foreach ($arguments as $node) { - if (!$first) { - $compiler->raw(', '); - } - $compiler->subcompile($node); - $first = false; - } - } - - $compiler->raw(')'); - } - - protected function getArguments($callable = null, $arguments) - { - $callType = $this->getAttribute('type'); - $callName = $this->getAttribute('name'); - - $parameters = array(); - $named = false; - foreach ($arguments as $name => $node) { - if (!is_int($name)) { - $named = true; - $name = $this->normalizeName($name); - } elseif ($named) { - throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName)); - } - - $parameters[$name] = $node; - } - - $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); - if (!$named && !$isVariadic) { - return $parameters; - } - - if (!$callable) { - if ($named) { - $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); - } else { - $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); - } - - throw new LogicException($message); - } - - $callableParameters = $this->getCallableParameters($callable, $isVariadic); - $arguments = array(); - $names = array(); - $missingArguments = array(); - $optionalArguments = array(); - $pos = 0; - foreach ($callableParameters as $callableParameter) { - $names[] = $name = $this->normalizeName($callableParameter->name); - - if (array_key_exists($name, $parameters)) { - if (array_key_exists($pos, $parameters)) { - throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName)); - } - - if (count($missingArguments)) { - throw new Twig_Error_Syntax(sprintf( - 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".', - $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments)) - ); - } - - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$name]; - unset($parameters[$name]); - $optionalArguments = array(); - } elseif (array_key_exists($pos, $parameters)) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $parameters[$pos]; - unset($parameters[$pos]); - $optionalArguments = array(); - ++$pos; - } elseif ($callableParameter->isDefaultValueAvailable()) { - $optionalArguments[] = new Twig_Node_Expression_Constant($callableParameter->getDefaultValue(), -1); - } elseif ($callableParameter->isOptional()) { - if (empty($parameters)) { - break; - } else { - $missingArguments[] = $name; - } - } else { - throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName)); - } - } - - if ($isVariadic) { - $arbitraryArguments = new Twig_Node_Expression_Array(array(), -1); - foreach ($parameters as $key => $value) { - if (is_int($key)) { - $arbitraryArguments->addElement($value); - } else { - $arbitraryArguments->addElement($value, new Twig_Node_Expression_Constant($key, -1)); - } - unset($parameters[$key]); - } - - if ($arbitraryArguments->count()) { - $arguments = array_merge($arguments, $optionalArguments); - $arguments[] = $arbitraryArguments; - } - } - - if (!empty($parameters)) { - $unknownParameter = null; - foreach ($parameters as $parameter) { - if ($parameter instanceof Twig_Node) { - $unknownParameter = $parameter; - break; - } - } - - throw new Twig_Error_Syntax(sprintf( - 'Unknown argument%s "%s" for %s "%s(%s)".', - count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names) - ), $unknownParameter ? $unknownParameter->getTemplateLine() : -1); - } - - return $arguments; - } - - protected function normalizeName($name) - { - return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $name)); - } - - private function getCallableParameters($callable, $isVariadic) - { - list($r) = $this->reflectCallable($callable); - if (null === $r) { - return array(); - } - - $parameters = $r->getParameters(); - if ($this->hasNode('node')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { - array_shift($parameters); - } - if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { - array_shift($parameters); - } - if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { - foreach ($this->getAttribute('arguments') as $argument) { - array_shift($parameters); - } - } - if ($isVariadic) { - $argument = end($parameters); - if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && array() === $argument->getDefaultValue()) { - array_pop($parameters); - } else { - $callableName = $r->name; - if ($r instanceof ReflectionMethod) { - $callableName = $r->getDeclaringClass()->name.'::'.$callableName; - } - - throw new LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = array()".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); - } - } - - return $parameters; - } - - private function reflectCallable($callable) - { - if (null !== $this->reflector) { - return $this->reflector; - } - - if (is_array($callable)) { - if (!method_exists($callable[0], $callable[1])) { - // __call() - return array(null, array()); - } - $r = new ReflectionMethod($callable[0], $callable[1]); - } elseif (is_object($callable) && !$callable instanceof Closure) { - $r = new ReflectionObject($callable); - $r = $r->getMethod('__invoke'); - $callable = array($callable, '__invoke'); - } elseif (is_string($callable) && false !== $pos = strpos($callable, '::')) { - $class = substr($callable, 0, $pos); - $method = substr($callable, $pos + 2); - if (!method_exists($class, $method)) { - // __staticCall() - return array(null, array()); - } - $r = new ReflectionMethod($callable); - $callable = array($class, $method); - } else { - $r = new ReflectionFunction($callable); - } - - return $this->reflector = array($r, $callable); - } -} - -class_alias('Twig_Node_Expression_Call', 'Twig\Node\Expression\CallExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php b/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php deleted file mode 100644 index c339d77..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php +++ /dev/null @@ -1,33 +0,0 @@ - $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('((') - ->subcompile($this->getNode('expr1')) - ->raw(') ? (') - ->subcompile($this->getNode('expr2')) - ->raw(') : (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } -} - -class_alias('Twig_Node_Expression_Conditional', 'Twig\Node\Expression\ConditionalExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php b/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php deleted file mode 100644 index bf4d031..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php +++ /dev/null @@ -1,25 +0,0 @@ - $value), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->repr($this->getAttribute('value')); - } -} - -class_alias('Twig_Node_Expression_Constant', 'Twig\Node\Expression\ConstantExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php b/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php deleted file mode 100644 index efa91c5..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php +++ /dev/null @@ -1,36 +0,0 @@ - $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getNode('filter')->getAttribute('value'); - $filter = $compiler->getEnvironment()->getFilter($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'filter'); - $this->setAttribute('needs_environment', $filter->needsEnvironment()); - $this->setAttribute('needs_context', $filter->needsContext()); - $this->setAttribute('arguments', $filter->getArguments()); - $this->setAttribute('callable', $filter->getCallable()); - $this->setAttribute('is_variadic', $filter->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig_Node_Expression_Filter', 'Twig\Node\Expression\FilterExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php b/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php deleted file mode 100644 index f073dd2..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php +++ /dev/null @@ -1,45 +0,0 @@ - - * {{ var.foo|default('foo item on var is not defined') }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter -{ - public function __construct(Twig_Node $node, Twig_Node_Expression_Constant $filterName, Twig_Node $arguments, $lineno, $tag = null) - { - $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); - - if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { - $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getTemplateLine()); - $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getTemplateLine()); - - $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getTemplateLine()); - } else { - $node = $default; - } - - parent::__construct($node, $filterName, $arguments, $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} - -class_alias('Twig_Node_Expression_Filter_Default', 'Twig\Node\Expression\Filter\DefaultFilter', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Function.php b/vendor/twig/twig/lib/Twig/Node/Expression/Function.php deleted file mode 100644 index 6f4e872..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Function.php +++ /dev/null @@ -1,39 +0,0 @@ - $arguments), array('name' => $name, 'is_defined_test' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $function = $compiler->getEnvironment()->getFunction($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'function'); - $this->setAttribute('needs_environment', $function->needsEnvironment()); - $this->setAttribute('needs_context', $function->needsContext()); - $this->setAttribute('arguments', $function->getArguments()); - $callable = $function->getCallable(); - if ('constant' === $name && $this->getAttribute('is_defined_test')) { - $callable = 'twig_constant_is_defined'; - } - $this->setAttribute('callable', $callable); - $this->setAttribute('is_variadic', $function->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig_Node_Expression_Function', 'Twig\Node\Expression\FunctionExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php b/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php deleted file mode 100644 index d3fd5a0..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php +++ /dev/null @@ -1,66 +0,0 @@ - $node, 'attribute' => $attribute); - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } - - parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->raw('twig_get_attribute($this->env, $this->getSourceContext(), '); - - if ($this->getAttribute('ignore_strict_check')) { - $this->getNode('node')->setAttribute('ignore_strict_check', true); - } - - $compiler->subcompile($this->getNode('node')); - - $compiler->raw(', ')->subcompile($this->getNode('attribute')); - - // only generate optional arguments when needed (to make generated code more readable) - $needFourth = $this->getAttribute('ignore_strict_check'); - $needThird = $needFourth || $this->getAttribute('is_defined_test'); - $needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type'); - $needFirst = $needSecond || $this->hasNode('arguments'); - - if ($needFirst) { - if ($this->hasNode('arguments')) { - $compiler->raw(', ')->subcompile($this->getNode('arguments')); - } else { - $compiler->raw(', array()'); - } - } - - if ($needSecond) { - $compiler->raw(', ')->repr($this->getAttribute('type')); - } - - if ($needThird) { - $compiler->raw(', ')->repr($this->getAttribute('is_defined_test')); - } - - if ($needFourth) { - $compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check')); - } - - $compiler->raw(')'); - } -} - -class_alias('Twig_Node_Expression_GetAttr', 'Twig\Node\Expression\GetAttrExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php b/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php deleted file mode 100644 index 709016e..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php +++ /dev/null @@ -1,43 +0,0 @@ - $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); - - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('always_defined', true); - } - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->subcompile($this->getNode('node')) - ->raw('->') - ->raw($this->getAttribute('method')) - ->raw('(') - ; - $first = true; - foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { - if (!$first) { - $compiler->raw(', '); - } - $first = false; - - $compiler->subcompile($pair['value']); - } - $compiler->raw(')'); - } -} - -class_alias('Twig_Node_Expression_MethodCall', 'Twig\Node\Expression\MethodCallExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Name.php b/vendor/twig/twig/lib/Twig/Node/Expression/Name.php deleted file mode 100644 index ace0e17..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Name.php +++ /dev/null @@ -1,82 +0,0 @@ - '$this->getTemplateName()', - '_context' => '$context', - '_charset' => '$this->env->getCharset()', - ); - - public function __construct($name, $lineno) - { - parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - - $compiler->addDebugInfo($this); - - if ($this->getAttribute('is_defined_test')) { - if ($this->isSpecial()) { - $compiler->repr(true); - } else { - $compiler->raw('array_key_exists(')->repr($name)->raw(', $context)'); - } - } elseif ($this->isSpecial()) { - $compiler->raw($this->specialVars[$name]); - } elseif ($this->getAttribute('always_defined')) { - $compiler - ->raw('$context[') - ->string($name) - ->raw(']') - ; - } else { - if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { - $compiler - ->raw('($context[') - ->string($name) - ->raw('] ?? null)') - ; - } else { - $compiler - ->raw('(isset($context[') - ->string($name) - ->raw(']) || array_key_exists(') - ->string($name) - ->raw(', $context) ? $context[') - ->string($name) - ->raw('] : (function () { throw new Twig_Error_Runtime(\'Variable ') - ->string($name) - ->raw(' does not exist.\', ') - ->repr($this->lineno) - ->raw(', $this->getSourceContext()); })()') - ->raw(')') - ; - } - } - } - - public function isSpecial() - { - return isset($this->specialVars[$this->getAttribute('name')]); - } - - public function isSimple() - { - return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); - } -} - -class_alias('Twig_Node_Expression_Name', 'Twig\Node\Expression\NameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php b/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php deleted file mode 100644 index 46ea208..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php +++ /dev/null @@ -1,48 +0,0 @@ -getTemplateLine()), - new Twig_Node_Expression_Unary_Not(new Twig_Node_Expression_Test_Null($left, 'null', new Twig_Node(), $left->getTemplateLine()), $left->getTemplateLine()), - $left->getTemplateLine() - ); - - parent::__construct($test, $left, $right, $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - /* - * This optimizes only one case. PHP 7 also supports more complex expressions - * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, - * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced - * cases might be implemented as an optimizer node visitor, but has not been done - * as benefits are probably not worth the added complexity. - */ - if ($this->getNode('expr2') instanceof Twig_Node_Expression_Name) { - $this->getNode('expr2')->setAttribute('always_defined', true); - $compiler - ->raw('((') - ->subcompile($this->getNode('expr2')) - ->raw(') ?? (') - ->subcompile($this->getNode('expr3')) - ->raw('))') - ; - } else { - parent::compile($compiler); - } - } -} - -class_alias('Twig_Node_Expression_NullCoalesce', 'Twig\Node\Expression\NullCoalesceExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php b/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php deleted file mode 100644 index 78692db..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class Twig_Node_Expression_Parent extends Twig_Node_Expression -{ - public function __construct($name, $lineno, $tag = null) - { - parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('output')) { - $compiler - ->addDebugInfo($this) - ->write('$this->displayParentBlock(') - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks);\n") - ; - } else { - $compiler - ->raw('$this->renderParentBlock(') - ->string($this->getAttribute('name')) - ->raw(', $context, $blocks)') - ; - } - } -} - -class_alias('Twig_Node_Expression_Parent', 'Twig\Node\Expression\ParentExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php b/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php deleted file mode 100644 index 0a86e00..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php +++ /dev/null @@ -1,28 +0,0 @@ - $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('$_') - ->raw($this->getAttribute('name')) - ->raw('_') - ; - } -} - -class_alias('Twig_Node_Expression_TempName', 'Twig\Node\Expression\TempNameExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test.php deleted file mode 100644 index 7a1aed8..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test.php +++ /dev/null @@ -1,37 +0,0 @@ - $node); - if (null !== $arguments) { - $nodes['arguments'] = $arguments; - } - - parent::__construct($nodes, array('name' => $name), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $name = $this->getAttribute('name'); - $test = $compiler->getEnvironment()->getTest($name); - - $this->setAttribute('name', $name); - $this->setAttribute('type', 'test'); - $this->setAttribute('callable', $test->getCallable()); - $this->setAttribute('is_variadic', $test->isVariadic()); - - $this->compileCallable($compiler); - } -} - -class_alias('Twig_Node_Expression_Test', 'Twig\Node\Expression\TestExpression', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php deleted file mode 100644 index a51a4ba..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php +++ /dev/null @@ -1,48 +0,0 @@ - - * {% if post.status is constant('Post::PUBLISHED') %} - * the status attribute is exactly the same as Post::PUBLISHED - * {% endif %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === constant(') - ; - - if ($this->getNode('arguments')->hasNode(1)) { - $compiler - ->raw('get_class(') - ->subcompile($this->getNode('arguments')->getNode(1)) - ->raw(')."::".') - ; - } - - $compiler - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw('))') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Constant', 'Twig\Node\Expression\Test\ConstantTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php deleted file mode 100644 index 0eb34d5..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php +++ /dev/null @@ -1,61 +0,0 @@ - - * {# defined works with variable names and variable attributes #} - * {% if foo is defined %} - * {# ... #} - * {% endif %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test -{ - public function __construct(Twig_Node $node, $name, Twig_Node $arguments = null, $lineno) - { - if ($node instanceof Twig_Node_Expression_Name) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_GetAttr) { - $node->setAttribute('is_defined_test', true); - $this->changeIgnoreStrictCheck($node); - } elseif ($node instanceof Twig_Node_Expression_BlockReference) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_Function && 'constant' === $node->getAttribute('name')) { - $node->setAttribute('is_defined_test', true); - } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) { - $node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine()); - } else { - throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getTemplateLine()); - } - - parent::__construct($node, $name, $arguments, $lineno); - } - - private function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node) - { - $node->setAttribute('ignore_strict_check', true); - - if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) { - $this->changeIgnoreStrictCheck($node->getNode('node')); - } - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('node')); - } -} - -class_alias('Twig_Node_Expression_Test_Defined', 'Twig\Node\Expression\Test\DefinedTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php deleted file mode 100644 index a5d7196..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php +++ /dev/null @@ -1,35 +0,0 @@ - - * {% if loop.index is divisible by(3) %} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(0 == ') - ->subcompile($this->getNode('node')) - ->raw(' % ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Divisibleby', 'Twig\Node\Expression\Test\DivisiblebyTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php deleted file mode 100644 index 7e198be..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php +++ /dev/null @@ -1,34 +0,0 @@ - - * {{ var is even }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 0') - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Even', 'Twig\Node\Expression\Test\EvenTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php deleted file mode 100644 index 3746e4c..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php +++ /dev/null @@ -1,33 +0,0 @@ - - * {{ var is none }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(null === ') - ->subcompile($this->getNode('node')) - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Null', 'Twig\Node\Expression\Test\NullTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php deleted file mode 100644 index 0c6c099..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php +++ /dev/null @@ -1,34 +0,0 @@ - - * {{ var is odd }} - * - * - * @author Fabien Potencier - */ -class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Odd', 'Twig\Node\Expression\Test\OddTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php b/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php deleted file mode 100644 index e95ff1f..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->raw('(') - ->subcompile($this->getNode('node')) - ->raw(' === ') - ->subcompile($this->getNode('arguments')->getNode(0)) - ->raw(')') - ; - } -} - -class_alias('Twig_Node_Expression_Test_Sameas', 'Twig\Node\Expression\Test\SameasTest', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php deleted file mode 100644 index 135d3cc..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php +++ /dev/null @@ -1,29 +0,0 @@ - $node), array(), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->raw(' '); - $this->operator($compiler); - $compiler->subcompile($this->getNode('node')); - } - - abstract public function operator(Twig_Compiler $compiler); -} - -class_alias('Twig_Node_Expression_Unary', 'Twig\Node\Expression\Unary\AbstractUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php deleted file mode 100644 index 039d933..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('-'); - } -} - -class_alias('Twig_Node_Expression_Unary_Neg', 'Twig\Node\Expression\Unary\NegUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php deleted file mode 100644 index a0860b1..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('!'); - } -} - -class_alias('Twig_Node_Expression_Unary_Not', 'Twig\Node\Expression\Unary\NotUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php b/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php deleted file mode 100644 index eeff545..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php +++ /dev/null @@ -1,20 +0,0 @@ -raw('+'); - } -} - -class_alias('Twig_Node_Expression_Unary_Pos', 'Twig\Node\Expression\Unary\PosUnary', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Flush.php b/vendor/twig/twig/lib/Twig/Node/Flush.php deleted file mode 100644 index fcc461a..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Flush.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Node_Flush extends Twig_Node -{ - public function __construct($lineno, $tag) - { - parent::__construct(array(), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("flush();\n") - ; - } -} - -class_alias('Twig_Node_Flush', 'Twig\Node\FlushNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/For.php b/vendor/twig/twig/lib/Twig/Node/For.php deleted file mode 100644 index 4745c5a..0000000 --- a/vendor/twig/twig/lib/Twig/Node/For.php +++ /dev/null @@ -1,113 +0,0 @@ - - */ -class Twig_Node_For extends Twig_Node -{ - private $loop; - - public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_Node $body, Twig_Node $else = null, $lineno, $tag = null) - { - $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag))); - - if (null !== $ifexpr) { - $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag); - } - - $nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body); - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("\$context['_parent'] = \$context;\n") - ->write("\$context['_seq'] = twig_ensure_traversable(") - ->subcompile($this->getNode('seq')) - ->raw(");\n") - ; - - if ($this->hasNode('else')) { - $compiler->write("\$context['_iterated'] = false;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("\$context['loop'] = array(\n") - ->write(" 'parent' => \$context['_parent'],\n") - ->write(" 'index0' => 0,\n") - ->write(" 'index' => 1,\n") - ->write(" 'first' => true,\n") - ->write(");\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) {\n") - ->indent() - ->write("\$length = count(\$context['_seq']);\n") - ->write("\$context['loop']['revindex0'] = \$length - 1;\n") - ->write("\$context['loop']['revindex'] = \$length;\n") - ->write("\$context['loop']['length'] = \$length;\n") - ->write("\$context['loop']['last'] = 1 === \$length;\n") - ->outdent() - ->write("}\n") - ; - } - } - - $this->loop->setAttribute('else', $this->hasNode('else')); - $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); - $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); - - $compiler - ->write("foreach (\$context['_seq'] as ") - ->subcompile($this->getNode('key_target')) - ->raw(' => ') - ->subcompile($this->getNode('value_target')) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->outdent() - ->write("}\n") - ; - - if ($this->hasNode('else')) { - $compiler - ->write("if (!\$context['_iterated']) {\n") - ->indent() - ->subcompile($this->getNode('else')) - ->outdent() - ->write("}\n") - ; - } - - $compiler->write("\$_parent = \$context['_parent'];\n"); - - // remove some "private" loop variables (needed for nested loops) - $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); - - // keep the values set in the inner context for variables defined in the outer context - $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); - } -} - -class_alias('Twig_Node_For', 'Twig\Node\ForNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/ForLoop.php b/vendor/twig/twig/lib/Twig/Node/ForLoop.php deleted file mode 100644 index 06477cf..0000000 --- a/vendor/twig/twig/lib/Twig/Node/ForLoop.php +++ /dev/null @@ -1,52 +0,0 @@ - - */ -class Twig_Node_ForLoop extends Twig_Node -{ - public function __construct($lineno, $tag = null) - { - parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - if ($this->getAttribute('else')) { - $compiler->write("\$context['_iterated'] = true;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("++\$context['loop']['index0'];\n") - ->write("++\$context['loop']['index'];\n") - ->write("\$context['loop']['first'] = false;\n") - ; - - if (!$this->getAttribute('ifexpr')) { - $compiler - ->write("if (isset(\$context['loop']['length'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } - } -} - -class_alias('Twig_Node_ForLoop', 'Twig\Node\ForLoopNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/If.php b/vendor/twig/twig/lib/Twig/Node/If.php deleted file mode 100644 index dcea344..0000000 --- a/vendor/twig/twig/lib/Twig/Node/If.php +++ /dev/null @@ -1,68 +0,0 @@ - - */ -class Twig_Node_If extends Twig_Node -{ - public function __construct(Twig_Node $tests, Twig_Node $else = null, $lineno, $tag = null) - { - $nodes = array('tests' => $tests); - if (null !== $else) { - $nodes['else'] = $else; - } - - parent::__construct($nodes, array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (') - ; - } else { - $compiler - ->write('if (') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(") {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} - -class_alias('Twig_Node_If', 'Twig\Node\IfNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Import.php b/vendor/twig/twig/lib/Twig/Node/Import.php deleted file mode 100644 index c77e320..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Import.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -class Twig_Node_Import extends Twig_Node -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('') - ->subcompile($this->getNode('var')) - ->raw(' = ') - ; - - if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { - $compiler->raw('$this'); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - $compiler->raw(";\n"); - } -} - -class_alias('Twig_Node_Import', 'Twig\Node\ImportNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Include.php b/vendor/twig/twig/lib/Twig/Node/Include.php deleted file mode 100644 index 2a5114c..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Include.php +++ /dev/null @@ -1,90 +0,0 @@ - - */ -class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) - { - $nodes = array('expr' => $expr); - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->write("try {\n") - ->indent() - ; - } - - $this->addGetTemplate($compiler); - - $compiler->raw('->display('); - - $this->addTemplateArguments($compiler); - - $compiler->raw(");\n"); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n\n") - ; - } - } - - protected function addGetTemplate(Twig_Compiler $compiler) - { - $compiler - ->write('$this->loadTemplate(') - ->subcompile($this->getNode('expr')) - ->raw(', ') - ->repr($this->getTemplateName()) - ->raw(', ') - ->repr($this->getTemplateLine()) - ->raw(')') - ; - } - - protected function addTemplateArguments(Twig_Compiler $compiler) - { - if (!$this->hasNode('variables')) { - $compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()'); - } elseif (false === $this->getAttribute('only')) { - $compiler - ->raw('array_merge($context, ') - ->subcompile($this->getNode('variables')) - ->raw(')') - ; - } else { - $compiler->subcompile($this->getNode('variables')); - } - } -} - -class_alias('Twig_Node_Include', 'Twig\Node\IncludeNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Macro.php b/vendor/twig/twig/lib/Twig/Node/Macro.php deleted file mode 100644 index 9649be0..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Macro.php +++ /dev/null @@ -1,106 +0,0 @@ - - */ -class Twig_Node_Macro extends Twig_Node -{ - const VARARGS_NAME = 'varargs'; - - public function __construct($name, Twig_Node $body, Twig_Node $arguments, $lineno, $tag = null) - { - foreach ($arguments as $argumentName => $argument) { - if (self::VARARGS_NAME === $argumentName) { - throw new Twig_Error_Syntax(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine()); - } - } - - parent::__construct(array('body' => $body, 'arguments' => $arguments), array('name' => $name), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write(sprintf('public function macro_%s(', $this->getAttribute('name'))) - ; - - $count = count($this->getNode('arguments')); - $pos = 0; - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->raw('$__'.$name.'__ = ') - ->subcompile($default) - ; - - if (++$pos < $count) { - $compiler->raw(', '); - } - } - - if ($count) { - $compiler->raw(', '); - } - - $compiler - ->raw('...$__varargs__') - ->raw(")\n") - ->write("{\n") - ->indent() - ; - - $compiler - ->write("\$context = \$this->env->mergeGlobals(array(\n") - ->indent() - ; - - foreach ($this->getNode('arguments') as $name => $default) { - $compiler - ->write('') - ->string($name) - ->raw(' => $__'.$name.'__') - ->raw(",\n") - ; - } - - $compiler - ->write('') - ->string(self::VARARGS_NAME) - ->raw(' => ') - ; - - $compiler - ->raw("\$__varargs__,\n") - ->outdent() - ->write("));\n\n") - ->write("\$blocks = array();\n\n") - ->write("ob_start();\n") - ->write("try {\n") - ->indent() - ->subcompile($this->getNode('body')) - ->raw("\n") - ->write("return ('' === \$tmp = ob_get_contents()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n") - ->outdent() - ->write("} finally {\n") - ->indent() - ->write("ob_end_clean();\n") - ->outdent() - ->write("}\n") - ->outdent() - ->write("}\n\n") - ; - } -} - -class_alias('Twig_Node_Macro', 'Twig\Node\MacroNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Module.php b/vendor/twig/twig/lib/Twig/Node/Module.php deleted file mode 100644 index c7263e6..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Module.php +++ /dev/null @@ -1,452 +0,0 @@ - - * - * @final since version 2.4.0 - */ -class Twig_Node_Module extends Twig_Node -{ - private $source; - - public function __construct(Twig_Node $body, Twig_Node_Expression $parent = null, Twig_Node $blocks, Twig_Node $macros, Twig_Node $traits, $embeddedTemplates, Twig_Source $source) - { - if (__CLASS__ !== get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->source = $source; - - $nodes = array( - 'body' => $body, - 'blocks' => $blocks, - 'macros' => $macros, - 'traits' => $traits, - 'display_start' => new Twig_Node(), - 'display_end' => new Twig_Node(), - 'constructor_start' => new Twig_Node(), - 'constructor_end' => new Twig_Node(), - 'class_end' => new Twig_Node(), - ); - if (null !== $parent) { - $nodes['parent'] = $parent; - } - - // embedded templates are set as attributes so that they are only visited once by the visitors - parent::__construct($nodes, array( - 'index' => null, - 'embedded_templates' => $embeddedTemplates, - ), 1); - - // populate the template name of all node children - $this->setTemplateName($this->source->getName()); - } - - public function setIndex($index) - { - $this->setAttribute('index', $index); - } - - public function compile(Twig_Compiler $compiler) - { - $this->compileTemplate($compiler); - - foreach ($this->getAttribute('embedded_templates') as $template) { - $compiler->subcompile($template); - } - } - - protected function compileTemplate(Twig_Compiler $compiler) - { - if (!$this->getAttribute('index')) { - $compiler->write('compileClassHeader($compiler); - - if ( - count($this->getNode('blocks')) - || count($this->getNode('traits')) - || !$this->hasNode('parent') - || $this->getNode('parent') instanceof Twig_Node_Expression_Constant - || count($this->getNode('constructor_start')) - || count($this->getNode('constructor_end')) - ) { - $this->compileConstructor($compiler); - } - - $this->compileGetParent($compiler); - - $this->compileDisplay($compiler); - - $compiler->subcompile($this->getNode('blocks')); - - $this->compileMacros($compiler); - - $this->compileGetTemplateName($compiler); - - $this->compileIsTraitable($compiler); - - $this->compileDebugInfo($compiler); - - $this->compileGetSourceContext($compiler); - - $this->compileClassFooter($compiler); - } - - protected function compileGetParent(Twig_Compiler $compiler) - { - if (!$this->hasNode('parent')) { - return; - } - $parent = $this->getNode('parent'); - - $compiler - ->write("protected function doGetParent(array \$context)\n", "{\n") - ->indent() - ->addDebugInfo($parent) - ->write('return ') - ; - - if ($parent instanceof Twig_Node_Expression_Constant) { - $compiler->subcompile($parent); - } else { - $compiler - ->raw('$this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->source->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(')') - ; - } - - $compiler - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassHeader(Twig_Compiler $compiler) - { - $compiler - ->write("\n\n") - // if the template name contains */, add a blank to avoid a PHP parse error - ->write('/* '.str_replace('*/', '* /', $this->source->getName())." */\n") - ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->source->getName(), $this->getAttribute('index'))) - ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass())) - ->write("{\n") - ->indent() - ; - } - - protected function compileConstructor(Twig_Compiler $compiler) - { - $compiler - ->write("public function __construct(Twig_Environment \$env)\n", "{\n") - ->indent() - ->subcompile($this->getNode('constructor_start')) - ->write("parent::__construct(\$env);\n\n") - ; - - // parent - if (!$this->hasNode('parent')) { - $compiler->write("\$this->parent = false;\n\n"); - } elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_Node_Expression_Constant) { - $compiler - ->addDebugInfo($parent) - ->write('$this->parent = $this->loadTemplate(') - ->subcompile($parent) - ->raw(', ') - ->repr($this->source->getName()) - ->raw(', ') - ->repr($parent->getTemplateLine()) - ->raw(");\n") - ; - } - - $countTraits = count($this->getNode('traits')); - if ($countTraits) { - // traits - foreach ($this->getNode('traits') as $i => $trait) { - $node = $trait->getNode('template'); - - $compiler - ->write(sprintf('$_trait_%s = $this->loadTemplate(', $i)) - ->subcompile($node) - ->raw(', ') - ->repr($node->getTemplateName()) - ->raw(', ') - ->repr($node->getTemplateLine()) - ->raw(");\n") - ; - - $compiler - ->addDebugInfo($trait->getNode('template')) - ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) - ->indent() - ->write("throw new Twig_Error_Runtime('Template \"'.") - ->subcompile($trait->getNode('template')) - ->raw(".'\" cannot be used as a trait.');\n") - ->outdent() - ->write("}\n") - ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) - ; - - foreach ($trait->getNode('targets') as $key => $value) { - $compiler - ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("])) {\n") - ->indent() - ->write("throw new Twig_Error_Runtime(sprintf('Block ") - ->string($key) - ->raw(' is not defined in trait ') - ->subcompile($trait->getNode('template')) - ->raw(".'));\n") - ->outdent() - ->write("}\n\n") - - ->write(sprintf('$_trait_%s_blocks[', $i)) - ->subcompile($value) - ->raw(sprintf('] = $_trait_%s_blocks[', $i)) - ->string($key) - ->raw(sprintf(']; unset($_trait_%s_blocks[', $i)) - ->string($key) - ->raw("]);\n\n") - ; - } - } - - if ($countTraits > 1) { - $compiler - ->write("\$this->traits = array_merge(\n") - ->indent() - ; - - for ($i = 0; $i < $countTraits; ++$i) { - $compiler - ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i)) - ; - } - - $compiler - ->outdent() - ->write(");\n\n") - ; - } else { - $compiler - ->write("\$this->traits = \$_trait_0_blocks;\n\n") - ; - } - - $compiler - ->write("\$this->blocks = array_merge(\n") - ->indent() - ->write("\$this->traits,\n") - ->write("array(\n") - ; - } else { - $compiler - ->write("\$this->blocks = array(\n") - ; - } - - // blocks - $compiler - ->indent() - ; - - foreach ($this->getNode('blocks') as $name => $node) { - $compiler - ->write(sprintf("'%s' => array(\$this, 'block_%s'),\n", $name, $name)) - ; - } - - if ($countTraits) { - $compiler - ->outdent() - ->write(")\n") - ; - } - - $compiler - ->outdent() - ->write(");\n") - ->outdent() - ->subcompile($this->getNode('constructor_end')) - ->write("}\n\n") - ; - } - - protected function compileDisplay(Twig_Compiler $compiler) - { - $compiler - ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n") - ->indent() - ->subcompile($this->getNode('display_start')) - ->subcompile($this->getNode('body')) - ; - - if ($this->hasNode('parent')) { - $parent = $this->getNode('parent'); - $compiler->addDebugInfo($parent); - if ($parent instanceof Twig_Node_Expression_Constant) { - $compiler->write('$this->parent'); - } else { - $compiler->write('$this->getParent($context)'); - } - $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); - } - - $compiler - ->subcompile($this->getNode('display_end')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileClassFooter(Twig_Compiler $compiler) - { - $compiler - ->subcompile($this->getNode('class_end')) - ->outdent() - ->write("}\n") - ; - } - - protected function compileMacros(Twig_Compiler $compiler) - { - $compiler->subcompile($this->getNode('macros')); - } - - protected function compileGetTemplateName(Twig_Compiler $compiler) - { - $compiler - ->write("public function getTemplateName()\n", "{\n") - ->indent() - ->write('return ') - ->repr($this->source->getName()) - ->raw(";\n") - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileIsTraitable(Twig_Compiler $compiler) - { - // A template can be used as a trait if: - // * it has no parent - // * it has no macros - // * it has no body - // - // Put another way, a template can be used as a trait if it - // only contains blocks and use statements. - $traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros')); - if ($traitable) { - if ($this->getNode('body') instanceof Twig_Node_Body) { - $nodes = $this->getNode('body')->getNode(0); - } else { - $nodes = $this->getNode('body'); - } - - if (!count($nodes)) { - $nodes = new Twig_Node(array($nodes)); - } - - foreach ($nodes as $node) { - if (!count($node)) { - continue; - } - - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if ($node instanceof Twig_Node_BlockReference) { - continue; - } - - $traitable = false; - break; - } - } - - if ($traitable) { - return; - } - - $compiler - ->write("public function isTraitable()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileDebugInfo(Twig_Compiler $compiler) - { - $compiler - ->write("public function getDebugInfo()\n", "{\n") - ->indent() - ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) - ->outdent() - ->write("}\n\n") - ; - } - - protected function compileGetSourceContext(Twig_Compiler $compiler) - { - $compiler - ->write("public function getSourceContext()\n", "{\n") - ->indent() - ->write('return new Twig_Source(') - ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '') - ->raw(', ') - ->string($this->source->getName()) - ->raw(', ') - ->string($this->source->getPath()) - ->raw(");\n") - ->outdent() - ->write("}\n") - ; - } - - protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) - { - if ($node instanceof Twig_Node_Expression_Constant) { - $compiler - ->write(sprintf('%s = $this->loadTemplate(', $var)) - ->subcompile($node) - ->raw(', ') - ->repr($node->getTemplateName()) - ->raw(', ') - ->repr($node->getTemplateLine()) - ->raw(");\n") - ; - } else { - throw new LogicException('Trait templates can only be constant nodes.'); - } - } -} - -class_alias('Twig_Node_Module', 'Twig\Node\ModuleNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Print.php b/vendor/twig/twig/lib/Twig/Node/Print.php deleted file mode 100644 index 374db89..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Print.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) - { - parent::__construct(array('expr' => $expr), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->subcompile($this->getNode('expr')) - ->raw(";\n") - ; - } -} - -class_alias('Twig_Node_Print', 'Twig\Node\PrintNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Sandbox.php b/vendor/twig/twig/lib/Twig/Node/Sandbox.php deleted file mode 100644 index 130e608..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Sandbox.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -class Twig_Node_Sandbox extends Twig_Node -{ - public function __construct(Twig_Node $body, $lineno, $tag = null) - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("\$sandbox = \$this->env->getExtension('Twig_Extension_Sandbox');\n") - ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") - ->indent() - ->write("\$sandbox->enableSandbox();\n") - ->outdent() - ->write("}\n") - ->subcompile($this->getNode('body')) - ->write("if (!\$alreadySandboxed) {\n") - ->indent() - ->write("\$sandbox->disableSandbox();\n") - ->outdent() - ->write("}\n") - ; - } -} - -class_alias('Twig_Node_Sandbox', 'Twig\Node\SandboxNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php b/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php deleted file mode 100644 index 6738ddc..0000000 --- a/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php +++ /dev/null @@ -1,51 +0,0 @@ - - */ -class Twig_Node_SandboxedPrint extends Twig_Node_Print -{ - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo $this->env->getExtension(\'Twig_Extension_Sandbox\')->ensureToStringAllowed(') - ->subcompile($this->getNode('expr')) - ->raw(");\n") - ; - } - - /** - * Removes node filters. - * - * This is mostly needed when another visitor adds filters (like the escaper one). - * - * @return Twig_Node - */ - private function removeNodeFilter(Twig_Node $node) - { - if ($node instanceof Twig_Node_Expression_Filter) { - return $this->removeNodeFilter($node->getNode('node')); - } - - return $node; - } -} - -class_alias('Twig_Node_SandboxedPrint', 'Twig\Node\SandboxedPrintNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Set.php b/vendor/twig/twig/lib/Twig/Node/Set.php deleted file mode 100644 index 02a8a2c..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Set.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ -class Twig_Node_Set extends Twig_Node implements Twig_NodeCaptureInterface -{ - public function __construct($capture, Twig_Node $names, Twig_Node $values, $lineno, $tag = null) - { - parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag); - - /* - * Optimizes the node when capture is used for a large block of text. - * - * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig_Markup("foo"); - */ - if ($this->getAttribute('capture')) { - $this->setAttribute('safe', true); - - $values = $this->getNode('values'); - if ($values instanceof Twig_Node_Text) { - $this->setNode('values', new Twig_Node_Expression_Constant($values->getAttribute('data'), $values->getTemplateLine())); - $this->setAttribute('capture', false); - } - } - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if (count($this->getNode('names')) > 1) { - $compiler->write('list('); - foreach ($this->getNode('names') as $idx => $node) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($node); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('capture')) { - $compiler - ->write("ob_start();\n") - ->subcompile($this->getNode('values')) - ; - } - - $compiler->subcompile($this->getNode('names'), false); - - if ($this->getAttribute('capture')) { - $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())"); - } - } - - if (!$this->getAttribute('capture')) { - $compiler->raw(' = '); - - if (count($this->getNode('names')) > 1) { - $compiler->write('array('); - foreach ($this->getNode('values') as $idx => $value) { - if ($idx) { - $compiler->raw(', '); - } - - $compiler->subcompile($value); - } - $compiler->raw(')'); - } else { - if ($this->getAttribute('safe')) { - $compiler - ->raw("('' === \$tmp = ") - ->subcompile($this->getNode('values')) - ->raw(") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())") - ; - } else { - $compiler->subcompile($this->getNode('values')); - } - } - } - - $compiler->raw(";\n"); - } -} - -class_alias('Twig_Node_Set', 'Twig\Node\SetNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Spaceless.php b/vendor/twig/twig/lib/Twig/Node/Spaceless.php deleted file mode 100644 index 1d01069..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Spaceless.php +++ /dev/null @@ -1,37 +0,0 @@ - - */ -class Twig_Node_Spaceless extends Twig_Node -{ - public function __construct(Twig_Node $body, $lineno, $tag = 'spaceless') - { - parent::__construct(array('body' => $body), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write("ob_start();\n") - ->subcompile($this->getNode('body')) - ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") - ; - } -} - -class_alias('Twig_Node_Spaceless', 'Twig\Node\SpacelessNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/Text.php b/vendor/twig/twig/lib/Twig/Node/Text.php deleted file mode 100644 index f4577fe..0000000 --- a/vendor/twig/twig/lib/Twig/Node/Text.php +++ /dev/null @@ -1,36 +0,0 @@ - - */ -class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface -{ - public function __construct($data, $lineno) - { - parent::__construct(array(), array('data' => $data), $lineno); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->addDebugInfo($this) - ->write('echo ') - ->string($this->getAttribute('data')) - ->raw(";\n") - ; - } -} - -class_alias('Twig_Node_Text', 'Twig\Node\TextNode', false); diff --git a/vendor/twig/twig/lib/Twig/Node/With.php b/vendor/twig/twig/lib/Twig/Node/With.php deleted file mode 100644 index 2ab0ea5..0000000 --- a/vendor/twig/twig/lib/Twig/Node/With.php +++ /dev/null @@ -1,64 +0,0 @@ - - */ -class Twig_Node_With extends Twig_Node -{ - public function __construct(Twig_Node $body, Twig_Node $variables = null, $only = false, $lineno, $tag = null) - { - $nodes = array('body' => $body); - if (null !== $variables) { - $nodes['variables'] = $variables; - } - - parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - if ($this->hasNode('variables')) { - $varsName = $compiler->getVarName(); - $compiler - ->write(sprintf('$%s = ', $varsName)) - ->subcompile($this->getNode('variables')) - ->raw(";\n") - ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName)) - ->indent() - ->write("throw new Twig_Error_Runtime('Variables passed to the \"with\" tag must be a hash.');\n") - ->outdent() - ->write("}\n") - ; - - if ($this->getAttribute('only')) { - $compiler->write("\$context = array('_parent' => \$context);\n"); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler->write(sprintf("\$context = array_merge(\$context, \$%s);\n", $varsName)); - } else { - $compiler->write("\$context['_parent'] = \$context;\n"); - } - - $compiler - ->subcompile($this->getNode('body')) - ->write("\$context = \$context['_parent'];\n") - ; - } -} - -class_alias('Twig_Node_With', 'Twig\Node\WithNode', false); diff --git a/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php b/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php deleted file mode 100644 index 6638834..0000000 --- a/vendor/twig/twig/lib/Twig/NodeCaptureInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -interface Twig_NodeCaptureInterface -{ -} - -class_alias('Twig_NodeCaptureInterface', 'Twig\Node\NodeCaptureInterface', false); diff --git a/vendor/twig/twig/lib/Twig/NodeOutputInterface.php b/vendor/twig/twig/lib/Twig/NodeOutputInterface.php deleted file mode 100644 index 5a8eaa9..0000000 --- a/vendor/twig/twig/lib/Twig/NodeOutputInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -interface Twig_NodeOutputInterface -{ -} - -class_alias('Twig_NodeOutputInterface', 'Twig\Node\NodeOutputInterface', false); diff --git a/vendor/twig/twig/lib/Twig/NodeTraverser.php b/vendor/twig/twig/lib/Twig/NodeTraverser.php deleted file mode 100644 index e8d5085..0000000 --- a/vendor/twig/twig/lib/Twig/NodeTraverser.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -final class Twig_NodeTraverser -{ - private $env; - private $visitors = array(); - - /** - * @param Twig_Environment $env - * @param Twig_NodeVisitorInterface[] $visitors - */ - public function __construct(Twig_Environment $env, array $visitors = array()) - { - $this->env = $env; - foreach ($visitors as $visitor) { - $this->addVisitor($visitor); - } - } - - public function addVisitor(Twig_NodeVisitorInterface $visitor) - { - if (!isset($this->visitors[$visitor->getPriority()])) { - $this->visitors[$visitor->getPriority()] = array(); - } - - $this->visitors[$visitor->getPriority()][] = $visitor; - } - - /** - * Traverses a node and calls the registered visitors. - * - * @return Twig_Node - */ - public function traverse(Twig_Node $node) - { - ksort($this->visitors); - foreach ($this->visitors as $visitors) { - foreach ($visitors as $visitor) { - $node = $this->traverseForVisitor($visitor, $node); - } - } - - return $node; - } - - private function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_Node $node) - { - $node = $visitor->enterNode($node, $this->env); - - foreach ($node as $k => $n) { - if (false !== $n = $this->traverseForVisitor($visitor, $n)) { - $node->setNode($k, $n); - } else { - $node->removeNode($k); - } - } - - return $visitor->leaveNode($node, $this->env); - } -} - -class_alias('Twig_NodeTraverser', 'Twig\NodeTraverser', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php deleted file mode 100644 index a6d28de..0000000 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php +++ /dev/null @@ -1,152 +0,0 @@ - - */ -final class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor -{ - private $statusStack = array(); - private $blocks = array(); - private $safeAnalysis; - private $traverser; - private $defaultStrategy = false; - private $safeVars = array(); - - public function __construct() - { - $this->safeAnalysis = new Twig_NodeVisitor_SafeAnalysis(); - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - if ($env->hasExtension('Twig_Extension_Escaper') && $defaultStrategy = $env->getExtension('Twig_Extension_Escaper')->getDefaultStrategy($node->getTemplateName())) { - $this->defaultStrategy = $defaultStrategy; - } - $this->safeVars = array(); - $this->blocks = array(); - } elseif ($node instanceof Twig_Node_AutoEscape) { - $this->statusStack[] = $node->getAttribute('value'); - } elseif ($node instanceof Twig_Node_Block) { - $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); - } elseif ($node instanceof Twig_Node_Import) { - $this->safeVars[] = $node->getNode('var')->getAttribute('name'); - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->defaultStrategy = false; - $this->safeVars = array(); - $this->blocks = array(); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - return $this->preEscapeFilterNode($node, $env); - } elseif ($node instanceof Twig_Node_Print) { - return $this->escapePrintNode($node, $env, $this->needEscaping($env)); - } - - if ($node instanceof Twig_Node_AutoEscape || $node instanceof Twig_Node_Block) { - array_pop($this->statusStack); - } elseif ($node instanceof Twig_Node_BlockReference) { - $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); - } - - return $node; - } - - private function escapePrintNode(Twig_Node_Print $node, Twig_Environment $env, $type) - { - if (false === $type) { - return $node; - } - - $expression = $node->getNode('expr'); - - if ($this->isSafeFor($type, $expression, $env)) { - return $node; - } - - $class = get_class($node); - - return new $class( - $this->getEscaperFilter($type, $expression), - $node->getTemplateLine() - ); - } - - private function preEscapeFilterNode(Twig_Node_Expression_Filter $filter, Twig_Environment $env) - { - $name = $filter->getNode('filter')->getAttribute('value'); - - $type = $env->getFilter($name)->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); - - return $filter; - } - - private function isSafeFor($type, Twig_Node $expression, $env) - { - $safe = $this->safeAnalysis->getSafe($expression); - - if (null === $safe) { - if (null === $this->traverser) { - $this->traverser = new Twig_NodeTraverser($env, array($this->safeAnalysis)); - } - - $this->safeAnalysis->setSafeVars($this->safeVars); - - $this->traverser->traverse($expression); - $safe = $this->safeAnalysis->getSafe($expression); - } - - return in_array($type, $safe) || in_array('all', $safe); - } - - private function needEscaping(Twig_Environment $env) - { - if (count($this->statusStack)) { - return $this->statusStack[count($this->statusStack) - 1]; - } - - return $this->defaultStrategy ? $this->defaultStrategy : false; - } - - private function getEscaperFilter($type, Twig_Node $node) - { - $line = $node->getTemplateLine(); - $name = new Twig_Node_Expression_Constant('escape', $line); - $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line), new Twig_Node_Expression_Constant(null, $line), new Twig_Node_Expression_Constant(true, $line))); - - return new Twig_Node_Expression_Filter($node, $name, $args, $line); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig_NodeVisitor_Escaper', 'Twig\NodeVisitor\EscaperNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php deleted file mode 100644 index b3433c0..0000000 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php +++ /dev/null @@ -1,207 +0,0 @@ - - */ -final class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor -{ - const OPTIMIZE_ALL = -1; - const OPTIMIZE_NONE = 0; - const OPTIMIZE_FOR = 2; - const OPTIMIZE_RAW_FILTER = 4; - // obsolete, does not do anything - const OPTIMIZE_VAR_ACCESS = 8; - - private $loops = array(); - private $loopsTargets = array(); - private $optimizers; - - /** - * @param int $optimizers The optimizer mode - */ - public function __construct($optimizers = -1) - { - if (!is_int($optimizers) || $optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER | self::OPTIMIZE_VAR_ACCESS)) { - throw new InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); - } - - $this->optimizers = $optimizers; - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->enterOptimizeFor($node, $env); - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { - $this->leaveOptimizeFor($node, $env); - } - - if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { - $node = $this->optimizeRawFilter($node, $env); - } - - $node = $this->optimizePrintNode($node, $env); - - return $node; - } - - /** - * Optimizes print nodes. - * - * It replaces: - * - * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" - * - * @return Twig_Node - */ - private function optimizePrintNode(Twig_Node $node, Twig_Environment $env) - { - if (!$node instanceof Twig_Node_Print) { - return $node; - } - - $exprNode = $node->getNode('expr'); - if ( - $exprNode instanceof Twig_Node_Expression_BlockReference || - $exprNode instanceof Twig_Node_Expression_Parent - ) { - $exprNode->setAttribute('output', true); - - return $exprNode; - } - - return $node; - } - - /** - * Removes "raw" filters. - * - * @return Twig_Node - */ - private function optimizeRawFilter(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_Filter && 'raw' == $node->getNode('filter')->getAttribute('value')) { - return $node->getNode('node'); - } - - return $node; - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - private function enterOptimizeFor(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_For) { - // disable the loop variable by default - $node->setAttribute('with_loop', false); - array_unshift($this->loops, $node); - array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); - array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); - } elseif (!$this->loops) { - // we are outside a loop - return; - } - - // when do we need to add the loop variable back? - - // the loop variable is referenced for the current loop - elseif ($node instanceof Twig_Node_Expression_Name && 'loop' === $node->getAttribute('name')) { - $node->setAttribute('always_defined', true); - $this->addLoopToCurrent(); - } - - // optimize access to loop targets - elseif ($node instanceof Twig_Node_Expression_Name && in_array($node->getAttribute('name'), $this->loopsTargets)) { - $node->setAttribute('always_defined', true); - } - - // block reference - elseif ($node instanceof Twig_Node_BlockReference || $node instanceof Twig_Node_Expression_BlockReference) { - $this->addLoopToCurrent(); - } - - // include without the only attribute - elseif ($node instanceof Twig_Node_Include && !$node->getAttribute('only')) { - $this->addLoopToAll(); - } - - // include function without the with_context=false parameter - elseif ($node instanceof Twig_Node_Expression_Function - && 'include' === $node->getAttribute('name') - && (!$node->getNode('arguments')->hasNode('with_context') - || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value') - ) - ) { - $this->addLoopToAll(); - } - - // the loop variable is referenced via an attribute - elseif ($node instanceof Twig_Node_Expression_GetAttr - && (!$node->getNode('attribute') instanceof Twig_Node_Expression_Constant - || 'parent' === $node->getNode('attribute')->getAttribute('value') - ) - && (true === $this->loops[0]->getAttribute('with_loop') - || ($node->getNode('node') instanceof Twig_Node_Expression_Name - && 'loop' === $node->getNode('node')->getAttribute('name') - ) - ) - ) { - $this->addLoopToAll(); - } - } - - /** - * Optimizes "for" tag by removing the "loop" variable creation whenever possible. - */ - private function leaveOptimizeFor(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_For) { - array_shift($this->loops); - array_shift($this->loopsTargets); - array_shift($this->loopsTargets); - } - } - - private function addLoopToCurrent() - { - $this->loops[0]->setAttribute('with_loop', true); - } - - private function addLoopToAll() - { - foreach ($this->loops as $loop) { - $loop->setAttribute('with_loop', true); - } - } - - public function getPriority() - { - return 255; - } -} - -class_alias('Twig_NodeVisitor_Optimizer', 'Twig\NodeVisitor\OptimizerNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php deleted file mode 100644 index 48ae293..0000000 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php +++ /dev/null @@ -1,146 +0,0 @@ -safeVars = $safeVars; - } - - public function getSafe(Twig_Node $node) - { - $hash = spl_object_hash($node); - if (!isset($this->data[$hash])) { - return; - } - - foreach ($this->data[$hash] as $bucket) { - if ($bucket['key'] !== $node) { - continue; - } - - if (in_array('html_attr', $bucket['value'])) { - $bucket['value'][] = 'html'; - } - - return $bucket['value']; - } - } - - private function setSafe(Twig_Node $node, array $safe) - { - $hash = spl_object_hash($node); - if (isset($this->data[$hash])) { - foreach ($this->data[$hash] as &$bucket) { - if ($bucket['key'] === $node) { - $bucket['value'] = $safe; - - return; - } - } - } - $this->data[$hash][] = array( - 'key' => $node, - 'value' => $safe, - ); - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Expression_Constant) { - // constants are marked safe for all - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_BlockReference) { - // blocks are safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Parent) { - // parent block is safe by definition - $this->setSafe($node, array('all')); - } elseif ($node instanceof Twig_Node_Expression_Conditional) { - // intersect safeness of both operands - $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); - $this->setSafe($node, $safe); - } elseif ($node instanceof Twig_Node_Expression_Filter) { - // filter expression is safe when the filter is safe - $name = $node->getNode('filter')->getAttribute('value'); - $args = $node->getNode('arguments'); - if (false !== $filter = $env->getFilter($name)) { - $safe = $filter->getSafe($args); - if (null === $safe) { - $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); - } - $this->setSafe($node, $safe); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_Function) { - // function expression is safe when the function is safe - $name = $node->getAttribute('name'); - $args = $node->getNode('arguments'); - $function = $env->getFunction($name); - if (false !== $function) { - $this->setSafe($node, $function->getSafe($args)); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_MethodCall) { - if ($node->getAttribute('safe')) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } elseif ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name) { - $name = $node->getNode('node')->getAttribute('name'); - if (in_array($name, $this->safeVars)) { - $this->setSafe($node, array('all')); - } else { - $this->setSafe($node, array()); - } - } else { - $this->setSafe($node, array()); - } - - return $node; - } - - private function intersectSafe(array $a = null, array $b = null) - { - if (null === $a || null === $b) { - return array(); - } - - if (in_array('all', $a)) { - return $b; - } - - if (in_array('all', $b)) { - return $a; - } - - return array_intersect($a, $b); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig_NodeVisitor_SafeAnalysis', 'Twig\NodeVisitor\SafeAnalysisNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php b/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php deleted file mode 100644 index c8f87bd..0000000 --- a/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php +++ /dev/null @@ -1,75 +0,0 @@ - - */ -final class Twig_NodeVisitor_Sandbox extends Twig_BaseNodeVisitor -{ - private $inAModule = false; - private $tags; - private $filters; - private $functions; - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = true; - $this->tags = array(); - $this->filters = array(); - $this->functions = array(); - - return $node; - } elseif ($this->inAModule) { - // look for tags - if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { - $this->tags[$node->getNodeTag()] = $node; - } - - // look for filters - if ($node instanceof Twig_Node_Expression_Filter && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { - $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; - } - - // look for functions - if ($node instanceof Twig_Node_Expression_Function && !isset($this->functions[$node->getAttribute('name')])) { - $this->functions[$node->getAttribute('name')] = $node; - } - - // wrap print to check __toString() calls - if ($node instanceof Twig_Node_Print) { - return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getTemplateLine(), $node->getNodeTag()); - } - } - - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $this->inAModule = false; - - $node->setNode('display_start', new Twig_Node(array(new Twig_Node_CheckSecurity($this->filters, $this->tags, $this->functions), $node->getNode('display_start')))); - } - - return $node; - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig_NodeVisitor_Sandbox', 'Twig\NodeVisitor\SandboxNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php b/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php deleted file mode 100644 index 6276a31..0000000 --- a/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -interface Twig_NodeVisitorInterface -{ - /** - * Called before child nodes are visited. - * - * @return Twig_Node The modified node - */ - public function enterNode(Twig_Node $node, Twig_Environment $env); - - /** - * Called after child nodes are visited. - * - * @return Twig_Node|false The modified node or false if the node must be removed - */ - public function leaveNode(Twig_Node $node, Twig_Environment $env); - - /** - * Returns the priority for this visitor. - * - * Priority should be between -10 and 10 (0 is the default). - * - * @return int The priority level - */ - public function getPriority(); -} - -class_alias('Twig_NodeVisitorInterface', 'Twig\NodeVisitor\NodeVisitorInterface', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Parser.php b/vendor/twig/twig/lib/Twig/Parser.php deleted file mode 100644 index 8e50bb1..0000000 --- a/vendor/twig/twig/lib/Twig/Parser.php +++ /dev/null @@ -1,350 +0,0 @@ - - */ -class Twig_Parser -{ - private $stack = array(); - private $stream; - private $parent; - private $handlers; - private $visitors; - private $expressionParser; - private $blocks; - private $blockStack; - private $macros; - private $env; - private $importedSymbols; - private $traits; - private $embeddedTemplates = array(); - - public function __construct(Twig_Environment $env) - { - $this->env = $env; - } - - public function getVarName() - { - return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); - } - - public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false) - { - $vars = get_object_vars($this); - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); - $this->stack[] = $vars; - - // tag handlers - if (null === $this->handlers) { - $this->handlers = array(); - foreach ($this->env->getTokenParsers() as $handler) { - $handler->setParser($this); - - $this->handlers[$handler->getTag()] = $handler; - } - } - - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); - } - - if (null === $this->expressionParser) { - $this->expressionParser = new Twig_ExpressionParser($this, $this->env); - } - - $this->stream = $stream; - $this->parent = null; - $this->blocks = array(); - $this->macros = array(); - $this->traits = array(); - $this->blockStack = array(); - $this->importedSymbols = array(array()); - $this->embeddedTemplates = array(); - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { - $body = new Twig_Node(); - } - } catch (Twig_Error_Syntax $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->stream->getSourceContext()); - } - - if (!$e->getTemplateLine()) { - $e->setTemplateLine($this->stream->getCurrent()->getLine()); - } - - throw $e; - } - - $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); - - $traverser = new Twig_NodeTraverser($this->env, $this->visitors); - - $node = $traverser->traverse($node); - - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } - - return $node; - } - - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = array(); - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case Twig_Token::TEXT_TYPE: - $token = $this->stream->next(); - $rv[] = new Twig_Node_Text($token->getValue(), $token->getLine()); - break; - - case Twig_Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Twig_Token::VAR_END_TYPE); - $rv[] = new Twig_Node_Print($expr, $token->getLine()); - break; - - case Twig_Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if ($token->getType() !== Twig_Token::NAME_TYPE) { - throw new Twig_Error_Syntax('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); - } - - if (null !== $test && $test($token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - if (!isset($this->handlers[$token->getValue()])) { - if (null !== $test) { - $e = new Twig_Error_Syntax(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - - if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) { - $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); - } - } else { - $e = new Twig_Error_Syntax(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); - $e->addSuggestions($token->getValue(), array_keys($this->env->getTags())); - } - - throw $e; - } - - $this->stream->next(); - - $subparser = $this->handlers[$token->getValue()]; - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); - } - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - public function getBlockStack() - { - return $this->blockStack; - } - - public function peekBlockStack() - { - return $this->blockStack[count($this->blockStack) - 1]; - } - - public function popBlockStack() - { - array_pop($this->blockStack); - } - - public function pushBlockStack($name) - { - $this->blockStack[] = $name; - } - - public function hasBlock($name) - { - return isset($this->blocks[$name]); - } - - public function getBlock($name) - { - return $this->blocks[$name]; - } - - public function setBlock($name, Twig_Node_Block $value) - { - $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getTemplateLine()); - } - - public function hasMacro($name) - { - return isset($this->macros[$name]); - } - - public function setMacro($name, Twig_Node_Macro $node) - { - $this->macros[$name] = $node; - } - - public function isReservedMacroName($name) - { - return false; - } - - public function addTrait($trait) - { - $this->traits[] = $trait; - } - - public function hasTraits() - { - return count($this->traits) > 0; - } - - public function embedTemplate(Twig_Node_Module $template) - { - $template->setIndex(mt_rand()); - - $this->embeddedTemplates[] = $template; - } - - public function addImportedSymbol($type, $alias, $name = null, Twig_Node_Expression $node = null) - { - $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node); - } - - public function getImportedSymbol($type, $alias) - { - foreach ($this->importedSymbols as $functions) { - if (isset($functions[$type][$alias])) { - return $functions[$type][$alias]; - } - } - } - - public function isMainScope() - { - return 1 === count($this->importedSymbols); - } - - public function pushLocalScope() - { - array_unshift($this->importedSymbols, array()); - } - - public function popLocalScope() - { - array_shift($this->importedSymbols); - } - - /** - * @return Twig_ExpressionParser - */ - public function getExpressionParser() - { - return $this->expressionParser; - } - - public function getParent() - { - return $this->parent; - } - - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return Twig_TokenStream - */ - public function getStream() - { - return $this->stream; - } - - /** - * @return Twig_Token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); - } - - private function filterBodyNodes(Twig_Node $node) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof Twig_Node_Text && !ctype_space($node->getAttribute('data'))) - || - (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface) - ) { - if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) { - throw new Twig_Error_Syntax('A template that extends another one cannot start with a byte order mark (BOM); it must be removed.', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - throw new Twig_Error_Syntax('A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); - } - - // bypass nodes that will "capture" the output - if ($node instanceof Twig_NodeCaptureInterface) { - return $node; - } - - if ($node instanceof Twig_NodeOutputInterface) { - return; - } - - foreach ($node as $k => $n) { - if (null !== $n && null === $this->filterBodyNodes($n)) { - $node->removeNode($k); - } - } - - return $node; - } -} - -class_alias('Twig_Parser', 'Twig\Parser', false); -class_exists('Twig_Node'); -class_exists('Twig_TokenStream'); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php deleted file mode 100644 index 913afd4..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Base.php +++ /dev/null @@ -1,62 +0,0 @@ - - */ -abstract class Twig_Profiler_Dumper_Base -{ - private $root; - - public function dump(Twig_Profiler_Profile $profile) - { - return $this->dumpProfile($profile); - } - - abstract protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix); - - abstract protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix); - - abstract protected function formatTime(Twig_Profiler_Profile $profile, $percent); - - private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false) - { - if ($profile->isRoot()) { - $this->root = $profile->getDuration(); - $start = $profile->getName(); - } else { - if ($profile->isTemplate()) { - $start = $this->formatTemplate($profile, $prefix); - } else { - $start = $this->formatNonTemplate($profile, $prefix); - } - $prefix .= $sibling ? '│ ' : ' '; - } - - $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; - - if ($profile->getDuration() * 1000 < 1) { - $str = $start."\n"; - } else { - $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); - } - - $nCount = count($profile->getProfiles()); - foreach ($profile as $i => $p) { - $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); - } - - return $str; - } -} - -class_alias('Twig_Profiler_Dumper_Base', 'Twig\Profiler\Dumper\BaseDumper', false); -class_exists('Twig_Profiler_Profile'); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php deleted file mode 100644 index cdcdea2..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php +++ /dev/null @@ -1,70 +0,0 @@ - - */ -final class Twig_Profiler_Dumper_Blackfire -{ - public function dump(Twig_Profiler_Profile $profile) - { - $data = array(); - $this->dumpProfile('main()', $profile, $data); - $this->dumpChildren('main()', $profile, $data); - - $start = sprintf('%f', microtime(true)); - $str = << $values) { - $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; - } - - return $str; - } - - private function dumpChildren($parent, Twig_Profiler_Profile $profile, &$data) - { - foreach ($profile as $p) { - if ($p->isTemplate()) { - $name = $p->getTemplate(); - } else { - $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); - } - $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); - $this->dumpChildren($name, $p, $data); - } - } - - private function dumpProfile($edge, Twig_Profiler_Profile $profile, &$data) - { - if (isset($data[$edge])) { - $data[$edge]['ct'] += 1; - $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); - $data[$edge]['mu'] += $profile->getMemoryUsage(); - $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); - } else { - $data[$edge] = array( - 'ct' => 1, - 'wt' => floor($profile->getDuration() * 1000000), - 'mu' => $profile->getMemoryUsage(), - 'pmu' => $profile->getPeakMemoryUsage(), - ); - } - } -} - -class_alias('Twig_Profiler_Dumper_Blackfire', 'Twig\Profiler\Dumper\BlackfireDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php deleted file mode 100644 index 7c2f791..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php +++ /dev/null @@ -1,45 +0,0 @@ - - */ -final class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Base -{ - private static $colors = array( - 'block' => '#dfd', - 'macro' => '#ddf', - 'template' => '#ffd', - 'big' => '#d44', - ); - - public function dump(Twig_Profiler_Profile $profile) - { - return '
    '.parent::dump($profile).'
    '; - } - - protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); - } - - protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); - } - - protected function formatTime(Twig_Profiler_Profile $profile, $percent) - { - return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); - } -} - -class_alias('Twig_Profiler_Dumper_Html', 'Twig\Profiler\Dumper\HtmlDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php b/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php deleted file mode 100644 index 863112d..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -final class Twig_Profiler_Dumper_Text extends Twig_Profiler_Dumper_Base -{ - protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s', $prefix, $profile->getTemplate()); - } - - protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) - { - return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); - } - - protected function formatTime(Twig_Profiler_Profile $profile, $percent) - { - return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); - } -} - -class_alias('Twig_Profiler_Dumper_Text', 'Twig\Profiler\Dumper\TextDumper', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php b/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php deleted file mode 100644 index 69c8f79..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -class Twig_Profiler_Node_EnterProfile extends Twig_Node -{ - public function __construct($extensionName, $type, $name, $varName) - { - parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName)); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name'))) - ->repr($this->getAttribute('extension_name')) - ->raw(");\n") - ->write(sprintf('$%s->enter($%s = new Twig_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ->repr($this->getAttribute('type')) - ->raw(', ') - ->repr($this->getAttribute('name')) - ->raw("));\n\n") - ; - } -} - -class_alias('Twig_Profiler_Node_EnterProfile', 'Twig\Profiler\Node\EnterProfileNode', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php deleted file mode 100644 index d1d6a7c..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Profiler_Node_LeaveProfile extends Twig_Node -{ - public function __construct($varName) - { - parent::__construct(array(), array('var_name' => $varName)); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler - ->write("\n") - ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) - ; - } -} - -class_alias('Twig_Profiler_Node_LeaveProfile', 'Twig\Profiler\Node\LeaveProfileNode', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php deleted file mode 100644 index be775f4..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ -final class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor -{ - private $extensionName; - - public function __construct($extensionName) - { - $this->extensionName = $extensionName; - } - - protected function doEnterNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) - { - if ($node instanceof Twig_Node_Module) { - $varName = $this->getVarName(); - $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getTemplateName(), $varName), $node->getNode('display_start')))); - $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end')))); - } elseif ($node instanceof Twig_Node_Block) { - $varName = $this->getVarName(); - $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new Twig_Profiler_Node_LeaveProfile($varName), - ))); - } elseif ($node instanceof Twig_Node_Macro) { - $varName = $this->getVarName(); - $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName), - $node->getNode('body'), - new Twig_Profiler_Node_LeaveProfile($varName), - ))); - } - - return $node; - } - - private function getVarName() - { - return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); - } - - public function getPriority() - { - return 0; - } -} - -class_alias('Twig_Profiler_NodeVisitor_Profiler', 'Twig\Profiler\NodeVisitor\ProfilerNodeVisitor', false); diff --git a/vendor/twig/twig/lib/Twig/Profiler/Profile.php b/vendor/twig/twig/lib/Twig/Profiler/Profile.php deleted file mode 100644 index 2177f60..0000000 --- a/vendor/twig/twig/lib/Twig/Profiler/Profile.php +++ /dev/null @@ -1,174 +0,0 @@ - - * - * @final since version 2.4.0 - */ -class Twig_Profiler_Profile implements IteratorAggregate, Serializable -{ - const ROOT = 'ROOT'; - const BLOCK = 'block'; - const TEMPLATE = 'template'; - const MACRO = 'macro'; - - private $template; - private $name; - private $type; - private $starts = array(); - private $ends = array(); - private $profiles = array(); - - public function __construct($template = 'main', $type = self::ROOT, $name = 'main') - { - if (__CLASS__ !== get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->template = $template; - $this->type = $type; - $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; - $this->enter(); - } - - public function getTemplate() - { - return $this->template; - } - - public function getType() - { - return $this->type; - } - - public function getName() - { - return $this->name; - } - - public function isRoot() - { - return self::ROOT === $this->type; - } - - public function isTemplate() - { - return self::TEMPLATE === $this->type; - } - - public function isBlock() - { - return self::BLOCK === $this->type; - } - - public function isMacro() - { - return self::MACRO === $this->type; - } - - public function getProfiles() - { - return $this->profiles; - } - - public function addProfile(Twig_Profiler_Profile $profile) - { - $this->profiles[] = $profile; - } - - /** - * Returns the duration in microseconds. - * - * @return int - */ - public function getDuration() - { - if ($this->isRoot() && $this->profiles) { - // for the root node with children, duration is the sum of all child durations - $duration = 0; - foreach ($this->profiles as $profile) { - $duration += $profile->getDuration(); - } - - return $duration; - } - - return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; - } - - /** - * Returns the memory usage in bytes. - * - * @return int - */ - public function getMemoryUsage() - { - return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; - } - - /** - * Returns the peak memory usage in bytes. - * - * @return int - */ - public function getPeakMemoryUsage() - { - return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; - } - - /** - * Starts the profiling. - */ - public function enter() - { - $this->starts = array( - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ); - } - - /** - * Stops the profiling. - */ - public function leave() - { - $this->ends = array( - 'wt' => microtime(true), - 'mu' => memory_get_usage(), - 'pmu' => memory_get_peak_usage(), - ); - } - - public function reset() - { - $this->starts = $this->ends = $this->profiles = array(); - $this->enter(); - } - - public function getIterator() - { - return new ArrayIterator($this->profiles); - } - - public function serialize() - { - return serialize(array($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles)); - } - - public function unserialize($data) - { - list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = unserialize($data); - } -} - -class_alias('Twig_Profiler_Profile', 'Twig\Profiler\Profile', false); diff --git a/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php b/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php deleted file mode 100644 index f5eb14e..0000000 --- a/vendor/twig/twig/lib/Twig/RuntimeLoaderInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -interface Twig_RuntimeLoaderInterface -{ - /** - * Creates the runtime implementation of a Twig element (filter/function/test). - * - * @param string $class A runtime class - * - * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class - */ - public function load($class); -} - -class_alias('Twig_RuntimeLoaderInterface', 'Twig\RuntimeLoader\RuntimeLoaderInterface', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php deleted file mode 100644 index b6707e3..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -class Twig_Sandbox_SecurityError extends Twig_Error -{ -} - -class_alias('Twig_Sandbox_SecurityError', 'Twig\Sandbox\SecurityError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php deleted file mode 100644 index 0ba3327..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Sandbox_SecurityNotAllowedFilterError extends Twig_Sandbox_SecurityError -{ - private $filterName; - - public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, $lineno, $filename, $previous); - $this->filterName = $functionName; - } - - public function getFilterName() - { - return $this->filterName; - } -} - -class_alias('Twig_Sandbox_SecurityNotAllowedFilterError', 'Twig\Sandbox\SecurityNotAllowedFilterError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php deleted file mode 100644 index aa39142..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Sandbox_SecurityNotAllowedFunctionError extends Twig_Sandbox_SecurityError -{ - private $functionName; - - public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, $lineno, $filename, $previous); - $this->functionName = $functionName; - } - - public function getFunctionName() - { - return $this->functionName; - } -} - -class_alias('Twig_Sandbox_SecurityNotAllowedFunctionError', 'Twig\Sandbox\SecurityNotAllowedFunctionError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php deleted file mode 100644 index 93012fe..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedMethodError.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class Twig_Sandbox_SecurityNotAllowedMethodError extends Twig_Sandbox_SecurityError -{ - private $className; - private $methodName; - - public function __construct($message, $className, $methodName, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->methodName = $methodName; - } - - public function getClassName() - { - return $this->className; - } - - public function getMethodName() - { - return $this->methodName; - } -} - -class_alias('Twig_Sandbox_SecurityNotAllowedMethodError', 'Twig\Sandbox\SecurityNotAllowedMethodError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php deleted file mode 100644 index f27969c..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedPropertyError.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -class Twig_Sandbox_SecurityNotAllowedPropertyError extends Twig_Sandbox_SecurityError -{ - private $className; - private $propertyName; - - public function __construct($message, $className, $propertyName, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, $lineno, $filename, $previous); - $this->className = $className; - $this->propertyName = $propertyName; - } - - public function getClassName() - { - return $this->className; - } - - public function getPropertyName() - { - return $this->propertyName; - } -} - -class_alias('Twig_Sandbox_SecurityNotAllowedPropertyError', 'Twig\Sandbox\SecurityNotAllowedPropertyError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php deleted file mode 100644 index 4bbd223..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Twig_Sandbox_SecurityNotAllowedTagError extends Twig_Sandbox_SecurityError -{ - private $tagName; - - public function __construct($message, $tagName, $lineno = -1, $filename = null, Exception $previous = null) - { - parent::__construct($message, $lineno, $filename, $previous); - $this->tagName = $tagName; - } - - public function getTagName() - { - return $this->tagName; - } -} - -class_alias('Twig_Sandbox_SecurityNotAllowedTagError', 'Twig\Sandbox\SecurityNotAllowedTagError', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php deleted file mode 100644 index 175b2e4..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php +++ /dev/null @@ -1,123 +0,0 @@ - - */ -final class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface -{ - private $allowedTags; - private $allowedFilters; - private $allowedMethods; - private $allowedProperties; - private $allowedFunctions; - - public function __construct(array $allowedTags = array(), array $allowedFilters = array(), array $allowedMethods = array(), array $allowedProperties = array(), array $allowedFunctions = array()) - { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; - $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; - } - - public function setAllowedTags(array $tags) - { - $this->allowedTags = $tags; - } - - public function setAllowedFilters(array $filters) - { - $this->allowedFilters = $filters; - } - - public function setAllowedMethods(array $methods) - { - $this->allowedMethods = array(); - foreach ($methods as $class => $m) { - $this->allowedMethods[$class] = array_map('strtolower', is_array($m) ? $m : array($m)); - } - } - - public function setAllowedProperties(array $properties) - { - $this->allowedProperties = $properties; - } - - public function setAllowedFunctions(array $functions) - { - $this->allowedFunctions = $functions; - } - - public function checkSecurity($tags, $filters, $functions) - { - foreach ($tags as $tag) { - if (!in_array($tag, $this->allowedTags)) { - throw new Twig_Sandbox_SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); - } - } - - foreach ($filters as $filter) { - if (!in_array($filter, $this->allowedFilters)) { - throw new Twig_Sandbox_SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); - } - } - - foreach ($functions as $function) { - if (!in_array($function, $this->allowedFunctions)) { - throw new Twig_Sandbox_SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); - } - } - } - - public function checkMethodAllowed($obj, $method) - { - if ($obj instanceof Twig_Template || $obj instanceof Twig_Markup) { - return true; - } - - $allowed = false; - $method = strtolower($method); - foreach ($this->allowedMethods as $class => $methods) { - if ($obj instanceof $class) { - $allowed = in_array($method, $methods); - - break; - } - } - - if (!$allowed) { - $class = get_class($obj); - throw new Twig_Sandbox_SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); - } - } - - public function checkPropertyAllowed($obj, $property) - { - $allowed = false; - foreach ($this->allowedProperties as $class => $properties) { - if ($obj instanceof $class) { - $allowed = in_array($property, is_array($properties) ? $properties : array($properties)); - - break; - } - } - - if (!$allowed) { - $class = get_class($obj); - throw new Twig_Sandbox_SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); - } - } -} - -class_alias('Twig_Sandbox_SecurityPolicy', 'Twig\Sandbox\SecurityPolicy', false); diff --git a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php b/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php deleted file mode 100644 index 88f6444..0000000 --- a/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -interface Twig_Sandbox_SecurityPolicyInterface -{ - public function checkSecurity($tags, $filters, $functions); - - public function checkMethodAllowed($obj, $method); - - public function checkPropertyAllowed($obj, $method); -} - -class_alias('Twig_Sandbox_SecurityPolicyInterface', 'Twig\Sandbox\SecurityPolicyInterface', false); diff --git a/vendor/twig/twig/lib/Twig/SimpleFilter.php b/vendor/twig/twig/lib/Twig/SimpleFilter.php deleted file mode 100644 index 840453e..0000000 --- a/vendor/twig/twig/lib/Twig/SimpleFilter.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -final class Twig_Source -{ - private $code; - private $name; - private $path; - - /** - * @param string $code The template source code - * @param string $name The template logical name - * @param string $path The filesystem path of the template if any - */ - public function __construct($code, $name, $path = '') - { - $this->code = $code; - $this->name = $name; - $this->path = $path; - } - - public function getCode() - { - return $this->code; - } - - public function getName() - { - return $this->name; - } - - public function getPath() - { - return $this->path; - } -} - -class_alias('Twig_Source', 'Twig\Source', false); diff --git a/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php b/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php deleted file mode 100644 index dd5608a..0000000 --- a/vendor/twig/twig/lib/Twig/SourceContextLoaderInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -load() - * instead, which returns an instance of Twig_TemplateWrapper. - * - * @author Fabien Potencier - * - * @internal - */ -abstract class Twig_Template -{ - const ANY_CALL = 'any'; - const ARRAY_CALL = 'array'; - const METHOD_CALL = 'method'; - - /** - * @internal - */ - protected static $cache = array(); - - protected $parent; - protected $parents = array(); - protected $env; - protected $blocks = array(); - protected $traits = array(); - - public function __construct(Twig_Environment $env) - { - $this->env = $env; - } - - /** - * @internal this method will be removed in 2.0 and is only used internally to provide an upgrade path from 1.x to 2.0 - */ - public function __toString() - { - return $this->getTemplateName(); - } - - /** - * Returns the template name. - * - * @return string The template name - */ - abstract public function getTemplateName(); - - /** - * Returns debug information about the template. - * - * @return array Debug information - * - * @internal - */ - abstract public function getDebugInfo(); - - /** - * Returns information about the original template source code. - * - * @return Twig_Source - */ - public function getSourceContext() - { - return new Twig_Source('', $this->getTemplateName()); - } - - /** - * Returns the parent template. - * - * This method is for internal use only and should never be called - * directly. - * - * @param array $context - * - * @return Twig_Template|false The parent template or false if there is no parent - * - * @internal - */ - public function getParent(array $context) - { - if (null !== $this->parent) { - return $this->parent; - } - - try { - $parent = $this->doGetParent($context); - - if (false === $parent) { - return false; - } - - if ($parent instanceof self) { - return $this->parents[$parent->getTemplateName()] = $parent; - } - - if (!isset($this->parents[$parent])) { - $this->parents[$parent] = $this->loadTemplate($parent); - } - } catch (Twig_Error_Loader $e) { - $e->setSourceContext(null); - $e->guess(); - - throw $e; - } - - return $this->parents[$parent]; - } - - protected function doGetParent(array $context) - { - return false; - } - - public function isTraitable() - { - return true; - } - - /** - * Displays a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @internal - */ - public function displayParentBlock($name, array $context, array $blocks = array()) - { - if (isset($this->traits[$name])) { - $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, $blocks, false); - } else { - throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); - } - } - - /** - * Displays a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to display - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @internal - */ - public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true) - { - if ($useBlocks && isset($blocks[$name])) { - $template = $blocks[$name][0]; - $block = $blocks[$name][1]; - } elseif (isset($this->blocks[$name])) { - $template = $this->blocks[$name][0]; - $block = $this->blocks[$name][1]; - } else { - $template = null; - $block = null; - } - - // avoid RCEs when sandbox is enabled - if (null !== $template && !$template instanceof self) { - throw new LogicException('A block must be a method on a Twig_Template instance.'); - } - - if (null !== $template) { - try { - $template->$block($context, $blocks); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($template->getSourceContext()); - } - - // this is mostly useful for Twig_Error_Loader exceptions - // see Twig_Error_Loader - if (false === $e->getTemplateLine()) { - $e->setTemplateLine(-1); - $e->guess(); - } - - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); - } - } elseif (false !== $parent = $this->getParent($context)) { - $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false); - } elseif (isset($blocks[$name])) { - throw new Twig_Error_Runtime(sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getTemplateName()); - } else { - throw new Twig_Error_Runtime(sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, $this->getTemplateName()); - } - } - - /** - * Renders a parent block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render from the parent - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return string The rendered block - * - * @internal - */ - public function renderParentBlock($name, array $context, array $blocks = array()) - { - ob_start(); - $this->displayParentBlock($name, $context, $blocks); - - return ob_get_clean(); - } - - /** - * Renders a block. - * - * This method is for internal use only and should never be called - * directly. - * - * @param string $name The block name to render - * @param array $context The context - * @param array $blocks The current set of blocks - * @param bool $useBlocks Whether to use the current set of blocks - * - * @return string The rendered block - * - * @internal - */ - public function renderBlock($name, array $context, array $blocks = array(), $useBlocks = true) - { - ob_start(); - $this->displayBlock($name, $context, $blocks, $useBlocks); - - return ob_get_clean(); - } - - /** - * Returns whether a block exists or not in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param string $name The block name - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return bool true if the block exists, false otherwise - * - * @internal - */ - public function hasBlock($name, array $context, array $blocks = array()) - { - if (isset($blocks[$name])) { - return $blocks[$name][0] instanceof self; - } - - if (isset($this->blocks[$name])) { - return true; - } - - if (false !== $parent = $this->getParent($context)) { - return $parent->hasBlock($name, $context); - } - - return false; - } - - /** - * Returns all block names in the current context of the template. - * - * This method checks blocks defined in the current template - * or defined in "used" traits or defined in parent templates. - * - * @param array $context The context - * @param array $blocks The current set of blocks - * - * @return array An array of block names - * - * @internal - */ - public function getBlockNames(array $context, array $blocks = array()) - { - $names = array_merge(array_keys($blocks), array_keys($this->blocks)); - - if (false !== $parent = $this->getParent($context)) { - $names = array_merge($names, $parent->getBlockNames($context)); - } - - return array_unique($names); - } - - protected function loadTemplate($template, $templateName = null, $line = null, $index = null) - { - try { - if (is_array($template)) { - return $this->env->resolveTemplate($template); - } - - if ($template instanceof self) { - return $template; - } - - if ($template instanceof Twig_TemplateWrapper) { - return $template; - } - - return $this->env->loadTemplate($template, $index); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($templateName ? new Twig_Source('', $templateName) : $this->getSourceContext()); - } - - if ($e->getTemplateLine()) { - throw $e; - } - - if (!$line) { - $e->guess(); - } else { - $e->setTemplateLine($line); - } - - throw $e; - } - } - - /** - * Returns all blocks. - * - * This method is for internal use only and should never be called - * directly. - * - * @return array An array of blocks - * - * @internal - */ - public function getBlocks() - { - return $this->blocks; - } - - public function display(array $context, array $blocks = array()) - { - $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); - } - - public function render(array $context) - { - $level = ob_get_level(); - ob_start(); - try { - $this->display($context); - } catch (Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - protected function displayWithErrorHandling(array $context, array $blocks = array()) - { - try { - $this->doDisplay($context, $blocks); - } catch (Twig_Error $e) { - if (!$e->getSourceContext()) { - $e->setSourceContext($this->getSourceContext()); - } - - // this is mostly useful for Twig_Error_Loader exceptions - // see Twig_Error_Loader - if (false === $e->getTemplateLine()) { - $e->setTemplateLine(-1); - $e->guess(); - } - - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); - } - } - - /** - * Auto-generated method to display the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template - */ - abstract protected function doDisplay(array $context, array $blocks = array()); -} - -class_alias('Twig_Template', 'Twig\Template', false); diff --git a/vendor/twig/twig/lib/Twig/TemplateWrapper.php b/vendor/twig/twig/lib/Twig/TemplateWrapper.php deleted file mode 100644 index 4748184..0000000 --- a/vendor/twig/twig/lib/Twig/TemplateWrapper.php +++ /dev/null @@ -1,127 +0,0 @@ - - */ -final class Twig_TemplateWrapper -{ - private $env; - private $template; - - /** - * This method is for internal use only and should never be called - * directly (use Twig_Environment::load() instead). - * - * @internal - */ - public function __construct(Twig_Environment $env, Twig_Template $template) - { - $this->env = $env; - $this->template = $template; - } - - /** - * Renders the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template - */ - public function render($context = array()) - { - return $this->template->render($context); - } - - /** - * Displays the template. - * - * @param array $context An array of parameters to pass to the template - */ - public function display($context = array()) - { - $this->template->display($context); - } - - /** - * Checks if a block is defined. - * - * @param string $name The block name - * @param array $context An array of parameters to pass to the template - * - * @return bool - */ - public function hasBlock($name, $context = array()) - { - return $this->template->hasBlock($name, $context); - } - - /** - * Returns defined block names in the template. - * - * @param array $context An array of parameters to pass to the template - * - * @return string[] An array of defined template block names - */ - public function getBlockNames($context = array()) - { - return $this->template->getBlockNames($context); - } - - /** - * Renders a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered block - */ - public function renderBlock($name, $context = array()) - { - $context = $this->env->mergeGlobals($context); - $level = ob_get_level(); - ob_start(); - try { - $this->template->displayBlock($name, $context); - } catch (Throwable $e) { - while (ob_get_level() > $level) { - ob_end_clean(); - } - - throw $e; - } - - return ob_get_clean(); - } - - /** - * Displays a template block. - * - * @param string $name The block name to render - * @param array $context An array of parameters to pass to the template - */ - public function displayBlock($name, $context = array()) - { - $this->template->displayBlock($name, $this->env->mergeGlobals($context)); - } - - /** - * @return Twig_Source - */ - public function getSourceContext() - { - return $this->template->getSourceContext(); - } -} - -class_alias('Twig_TemplateWrapper', 'Twig\TemplateWrapper', false); diff --git a/vendor/twig/twig/lib/Twig/Test.php b/vendor/twig/twig/lib/Twig/Test.php deleted file mode 100644 index 095b3da..0000000 --- a/vendor/twig/twig/lib/Twig/Test.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * @see http://twig.sensiolabs.org/doc/templates.html#test-operator - */ -class Twig_Test -{ - private $name; - private $callable; - private $options; - - /** - * Creates a template test. - * - * @param string $name Name of this test - * @param callable|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. - * @param array $options Options array - */ - public function __construct(string $name, $callable = null, array $options = array()) - { - if (__CLASS__ !== get_class($this)) { - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); - } - - $this->name = $name; - $this->callable = $callable; - $this->options = array_merge(array( - 'is_variadic' => false, - 'node_class' => 'Twig_Node_Expression_Test', - 'deprecated' => false, - 'alternative' => null, - ), $options); - } - - public function getName() - { - return $this->name; - } - - /** - * Returns the callable to execute for this test. - * - * @return callable|null - */ - public function getCallable() - { - return $this->callable; - } - - public function getNodeClass() - { - return $this->options['node_class']; - } - - public function isVariadic() - { - return $this->options['is_variadic']; - } - - public function isDeprecated() - { - return (bool) $this->options['deprecated']; - } - - public function getDeprecatedVersion() - { - return $this->options['deprecated']; - } - - public function getAlternative() - { - return $this->options['alternative']; - } -} - -// For Twig 1.x compatibility -class_alias('Twig_Test', 'Twig_SimpleTest', false); - -class_alias('Twig_Test', 'Twig\TwigTest', false); diff --git a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php b/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php deleted file mode 100644 index e4518a0..0000000 --- a/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php +++ /dev/null @@ -1,240 +0,0 @@ - - * @author Karma Dordrak - */ -abstract class Twig_Test_IntegrationTestCase extends TestCase -{ - /** - * @return string - */ - abstract protected function getFixturesDir(); - - /** - * @return Twig_RuntimeLoaderInterface[] - */ - protected function getRuntimeLoaders() - { - return array(); - } - - /** - * @return Twig_ExtensionInterface[] - */ - protected function getExtensions() - { - return array(); - } - - /** - * @return Twig_Filter[] - */ - protected function getTwigFilters() - { - return array(); - } - - /** - * @return Twig_Function[] - */ - protected function getTwigFunctions() - { - return array(); - } - - /** - * @return Twig_Test[] - */ - protected function getTwigTests() - { - return array(); - } - - /** - * @dataProvider getTests - */ - public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); - } - - /** - * @dataProvider getLegacyTests - * @group legacy - */ - public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs) - { - $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); - } - - public function getTests($name, $legacyTests = false) - { - $fixturesDir = realpath($this->getFixturesDir()); - $tests = array(); - - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fixturesDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { - if (!preg_match('/\.test$/', $file)) { - continue; - } - - if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) { - continue; - } - - $test = file_get_contents($file->getRealpath()); - - if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = self::parseTemplates($match[3]); - $exception = $match[5]; - $outputs = array(array(null, $match[4], null, '')); - } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { - $message = $match[1]; - $condition = $match[2]; - $templates = self::parseTemplates($match[3]); - $exception = false; - preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); - } else { - throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); - } - - $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); - } - - if ($legacyTests && empty($tests)) { - // add a dummy test to avoid a PHPUnit message - return array(array('not', '-', '', array(), '', array())); - } - - return $tests; - } - - public function getLegacyTests() - { - return $this->getTests('testLegacyIntegration', true); - } - - protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs) - { - if (!$outputs) { - $this->markTestSkipped('no legacy tests to run'); - } - - if ($condition) { - eval('$ret = '.$condition.';'); - if (!$ret) { - $this->markTestSkipped($condition); - } - } - - $loader = new Twig_Loader_Array($templates); - - foreach ($outputs as $i => $match) { - $config = array_merge(array( - 'cache' => false, - 'strict_variables' => true, - ), $match[2] ? eval($match[2].';') : array()); - $twig = new Twig_Environment($loader, $config); - $twig->addGlobal('global', 'global'); - foreach ($this->getRuntimeLoaders() as $runtimeLoader) { - $twig->addRuntimeLoader($runtimeLoader); - } - - foreach ($this->getExtensions() as $extension) { - $twig->addExtension($extension); - } - - foreach ($this->getTwigFilters() as $filter) { - $twig->addFilter($filter); - } - - foreach ($this->getTwigTests() as $test) { - $twig->addTest($test); - } - - foreach ($this->getTwigFunctions() as $function) { - $twig->addFunction($function); - } - - // avoid using the same PHP class name for different cases - $p = new ReflectionProperty($twig, 'templateClassPrefix'); - $p->setAccessible(true); - $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); - - try { - $template = $twig->loadTemplate('index.twig'); - } catch (Exception $e) { - if (false !== $exception) { - $message = $e->getMessage(); - $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $message))); - $last = substr($message, strlen($message) - 1); - $this->assertTrue('.' === $last || '?' === $last, $message, 'Exception message must end with a dot or a question mark.'); - - return; - } - - throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - } - - try { - $output = trim($template->render(eval($match[1].';')), "\n "); - } catch (Exception $e) { - if (false !== $exception) { - $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); - - return; - } - - $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); - - $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); - } - - if (false !== $exception) { - list($class) = explode(':', $exception); - $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; - $this->assertThat(null, new $constraintClass($class)); - } - - $expected = trim($match[3], "\n "); - - if ($expected !== $output) { - printf("Compiled templates that failed on case %d:\n", $i + 1); - - foreach (array_keys($templates) as $name) { - echo "Template: $name\n"; - echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); - } - } - $this->assertEquals($expected, $output, $message.' (in '.$file.')'); - } - } - - protected static function parseTemplates($test) - { - $templates = array(); - preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; - } - - return $templates; - } -} - -class_alias('Twig_Test_IntegrationTestCase', 'Twig\Test\IntegrationTestCase', false); diff --git a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php b/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php deleted file mode 100644 index 44cd302..0000000 --- a/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php +++ /dev/null @@ -1,63 +0,0 @@ -assertNodeCompilation($source, $node, $environment, $isPattern); - } - - public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false) - { - $compiler = $this->getCompiler($environment); - $compiler->compile($node); - - if ($isPattern) { - $this->assertStringMatchesFormat($source, trim($compiler->getSource())); - } else { - $this->assertEquals($source, trim($compiler->getSource())); - } - } - - protected function getCompiler(Twig_Environment $environment = null) - { - return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); - } - - protected function getEnvironment() - { - return new Twig_Environment(new Twig_Loader_Array(array())); - } - - protected function getVariableGetter($name, $line = false) - { - $line = $line > 0 ? "// line {$line}\n" : ''; - - return sprintf('%s($context["%s"] ?? null)', $line, $name, $name); - } - - protected function getAttributeGetter() - { - return 'twig_get_attribute($this->env, $this->getSourceContext(), '; - } -} - -class_alias('Twig_Test_NodeTestCase', 'Twig\Test\NodeTestCase', false); -class_exists('Twig_Environment'); -class_exists('Twig_Node'); diff --git a/vendor/twig/twig/lib/Twig/Token.php b/vendor/twig/twig/lib/Twig/Token.php deleted file mode 100644 index 24f1feb..0000000 --- a/vendor/twig/twig/lib/Twig/Token.php +++ /dev/null @@ -1,205 +0,0 @@ - - */ -final class Twig_Token -{ - private $value; - private $type; - private $lineno; - - const EOF_TYPE = -1; - const TEXT_TYPE = 0; - const BLOCK_START_TYPE = 1; - const VAR_START_TYPE = 2; - const BLOCK_END_TYPE = 3; - const VAR_END_TYPE = 4; - const NAME_TYPE = 5; - const NUMBER_TYPE = 6; - const STRING_TYPE = 7; - const OPERATOR_TYPE = 8; - const PUNCTUATION_TYPE = 9; - const INTERPOLATION_START_TYPE = 10; - const INTERPOLATION_END_TYPE = 11; - - /** - * @param int $type The type of the token - * @param string $value The token value - * @param int $lineno The line position in the source - */ - public function __construct($type, $value, $lineno) - { - $this->type = $type; - $this->value = $value; - $this->lineno = $lineno; - } - - public function __toString() - { - return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value); - } - - /** - * Tests the current token for a type and/or a value. - * - * Parameters may be: - * * just type - * * type and value (or array of possible values) - * * just value (or array of possible values) (NAME_TYPE is used as type) - * - * @param array|int $type The type to test - * @param array|string|null $values The token value - * - * @return bool - */ - public function test($type, $values = null) - { - if (null === $values && !is_int($type)) { - $values = $type; - $type = self::NAME_TYPE; - } - - return ($this->type === $type) && ( - null === $values || - (is_array($values) && in_array($this->value, $values)) || - $this->value == $values - ); - } - - /** - * @return int - */ - public function getLine() - { - return $this->lineno; - } - - /** - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Returns the constant representation (internal) of a given type. - * - * @param int $type The type as an integer - * @param bool $short Whether to return a short representation or not - * - * @return string The string representation - */ - public static function typeToString($type, $short = false) - { - switch ($type) { - case self::EOF_TYPE: - $name = 'EOF_TYPE'; - break; - case self::TEXT_TYPE: - $name = 'TEXT_TYPE'; - break; - case self::BLOCK_START_TYPE: - $name = 'BLOCK_START_TYPE'; - break; - case self::VAR_START_TYPE: - $name = 'VAR_START_TYPE'; - break; - case self::BLOCK_END_TYPE: - $name = 'BLOCK_END_TYPE'; - break; - case self::VAR_END_TYPE: - $name = 'VAR_END_TYPE'; - break; - case self::NAME_TYPE: - $name = 'NAME_TYPE'; - break; - case self::NUMBER_TYPE: - $name = 'NUMBER_TYPE'; - break; - case self::STRING_TYPE: - $name = 'STRING_TYPE'; - break; - case self::OPERATOR_TYPE: - $name = 'OPERATOR_TYPE'; - break; - case self::PUNCTUATION_TYPE: - $name = 'PUNCTUATION_TYPE'; - break; - case self::INTERPOLATION_START_TYPE: - $name = 'INTERPOLATION_START_TYPE'; - break; - case self::INTERPOLATION_END_TYPE: - $name = 'INTERPOLATION_END_TYPE'; - break; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - - return $short ? $name : 'Twig_Token::'.$name; - } - - /** - * Returns the English representation of a given type. - * - * @param int $type The type as an integer - * - * @return string The string representation - */ - public static function typeToEnglish($type) - { - switch ($type) { - case self::EOF_TYPE: - return 'end of template'; - case self::TEXT_TYPE: - return 'text'; - case self::BLOCK_START_TYPE: - return 'begin of statement block'; - case self::VAR_START_TYPE: - return 'begin of print statement'; - case self::BLOCK_END_TYPE: - return 'end of statement block'; - case self::VAR_END_TYPE: - return 'end of print statement'; - case self::NAME_TYPE: - return 'name'; - case self::NUMBER_TYPE: - return 'number'; - case self::STRING_TYPE: - return 'string'; - case self::OPERATOR_TYPE: - return 'operator'; - case self::PUNCTUATION_TYPE: - return 'punctuation'; - case self::INTERPOLATION_START_TYPE: - return 'begin of string interpolation'; - case self::INTERPOLATION_END_TYPE: - return 'end of string interpolation'; - default: - throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); - } - } -} - -class_alias('Twig_Token', 'Twig\Token', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser.php b/vendor/twig/twig/lib/Twig/TokenParser.php deleted file mode 100644 index 1b4de14..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -abstract class Twig_TokenParser implements Twig_TokenParserInterface -{ - /** - * @var Twig_Parser - */ - protected $parser; - - /** - * Sets the parser associated with this token parser. - */ - public function setParser(Twig_Parser $parser) - { - $this->parser = $parser; - } -} - -class_alias('Twig_TokenParser', 'Twig\TokenParser\AbstractTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php b/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php deleted file mode 100644 index 88e68e1..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php +++ /dev/null @@ -1,50 +0,0 @@ -getLine(); - $stream = $this->parser->getStream(); - - if ($stream->test(Twig_Token::BLOCK_END_TYPE)) { - $value = 'html'; - } else { - $expr = $this->parser->getExpressionParser()->parseExpression(); - if (!$expr instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('An escaping strategy must be a string or false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $value = $expr->getAttribute('value'); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_AutoEscape($value, $body, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endautoescape'); - } - - public function getTag() - { - return 'autoescape'; - } -} - -class_alias('Twig_TokenParser_AutoEscape', 'Twig\TokenParser\AutoEscapeTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Block.php b/vendor/twig/twig/lib/Twig/TokenParser/Block.php deleted file mode 100644 index 84d5625..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Block.php +++ /dev/null @@ -1,71 +0,0 @@ - - * {% block head %} - * - * {% block title %}{% endblock %} - My Webpage - * {% endblock %} - * - */ -final class Twig_TokenParser_Block extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - if ($this->parser->hasBlock($name)) { - throw new Twig_Error_Syntax(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno)); - $this->parser->pushLocalScope(); - $this->parser->pushBlockStack($name); - - if ($stream->nextIf(Twig_Token::BLOCK_END_TYPE)) { - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - } else { - $body = new Twig_Node(array( - new Twig_Node_Print($this->parser->getExpressionParser()->parseExpression(), $lineno), - )); - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $block->setNode('body', $body); - $this->parser->popBlockStack(); - $this->parser->popLocalScope(); - - return new Twig_Node_BlockReference($name, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endblock'); - } - - public function getTag() - { - return 'block'; - } -} - -class_alias('Twig_TokenParser_Block', 'Twig\TokenParser\BlockTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Do.php b/vendor/twig/twig/lib/Twig/TokenParser/Do.php deleted file mode 100644 index a1d2670..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Do.php +++ /dev/null @@ -1,32 +0,0 @@ -parser->getExpressionParser()->parseExpression(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'do'; - } -} - -class_alias('Twig_TokenParser_Do', 'Twig\TokenParser\DoTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php b/vendor/twig/twig/lib/Twig/TokenParser/Embed.php deleted file mode 100644 index 4ab787c..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Embed.php +++ /dev/null @@ -1,65 +0,0 @@ -parser->getStream(); - - $parent = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - $parentToken = $fakeParentToken = new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine()); - if ($parent instanceof Twig_Node_Expression_Constant) { - $parentToken = new Twig_Token(Twig_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine()); - } elseif ($parent instanceof Twig_Node_Expression_Name) { - $parentToken = new Twig_Token(Twig_Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine()); - } - - // inject a fake parent to make the parent() function work - $stream->injectTokens(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()), - $parentToken, - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()), - )); - - $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true); - - // override the parent with the correct one - if ($fakeParentToken === $parentToken) { - $module->setNode('parent', $parent); - } - - $this->parser->embedTemplate($module); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Embed($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endembed'); - } - - public function getTag() - { - return 'embed'; - } -} - -class_alias('Twig_TokenParser_Embed', 'Twig\TokenParser\EmbedTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php b/vendor/twig/twig/lib/Twig/TokenParser/Extends.php deleted file mode 100644 index c1dd7fb..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Extends.php +++ /dev/null @@ -1,44 +0,0 @@ - - * {% extends "base.html" %} - * - */ -final class Twig_TokenParser_Extends extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - - if (!$this->parser->isMainScope()) { - throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext()); - } - - if (null !== $this->parser->getParent()) { - throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); - } - $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - public function getTag() - { - return 'extends'; - } -} - -class_alias('Twig_TokenParser_Extends', 'Twig\TokenParser\ExtendsTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php b/vendor/twig/twig/lib/Twig/TokenParser/Filter.php deleted file mode 100644 index f3f9ad4..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Filter.php +++ /dev/null @@ -1,51 +0,0 @@ - - * {% filter upper %} - * This text becomes uppercase - * {% endfilter %} - * - */ -final class Twig_TokenParser_Filter extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $name = $this->parser->getVarName(); - $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), null, $token->getLine(), $this->getTag()); - - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $block = new Twig_Node_Block($name, $body, $token->getLine()); - $this->parser->setBlock($name, $block); - - return new Twig_Node_Print($filter, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endfilter'); - } - - public function getTag() - { - return 'filter'; - } -} - -class_alias('Twig_TokenParser_Filter', 'Twig\TokenParser\FilterTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php b/vendor/twig/twig/lib/Twig/TokenParser/Flush.php deleted file mode 100644 index 9939e83..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Flush.php +++ /dev/null @@ -1,32 +0,0 @@ -parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Flush($token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'flush'; - } -} - -class_alias('Twig_TokenParser_Flush', 'Twig\TokenParser\FlushTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/For.php b/vendor/twig/twig/lib/Twig/TokenParser/For.php deleted file mode 100644 index 551d500..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/For.php +++ /dev/null @@ -1,125 +0,0 @@ - - *
      - * {% for user in users %} - *
    • {{ user.username|e }}
    • - * {% endfor %} - *
    - * - */ -final class Twig_TokenParser_For extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'in'); - $seq = $this->parser->getExpressionParser()->parseExpression(); - - $ifexpr = null; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'if')) { - $ifexpr = $this->parser->getExpressionParser()->parseExpression(); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideForFork')); - if ($stream->next()->getValue() == 'else') { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideForEnd'), true); - } else { - $else = null; - } - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($targets) > 1) { - $keyTarget = $targets->getNode(0); - $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); - $valueTarget = $targets->getNode(1); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } else { - $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno); - $valueTarget = $targets->getNode(0); - $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); - } - - if ($ifexpr) { - $this->checkLoopUsageCondition($stream, $ifexpr); - $this->checkLoopUsageBody($stream, $body); - } - - return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); - } - - public function decideForFork(Twig_Token $token) - { - return $token->test(array('else', 'endfor')); - } - - public function decideForEnd(Twig_Token $token) - { - return $token->test('endfor'); - } - - // the loop variable cannot be used in the condition - private function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_Node $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition.', $node->getTemplateLine(), $stream->getSourceContext()); - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageCondition($stream, $n); - } - } - - // check usage of non-defined loop-items - // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) - private function checkLoopUsageBody(Twig_TokenStream $stream, Twig_Node $node) - { - if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { - $attribute = $node->getNode('attribute'); - if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) { - throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition.', $attribute->getAttribute('value')), $node->getTemplateLine(), $stream->getSourceContext()); - } - } - - // should check for parent.loop.XXX usage - if ($node instanceof Twig_Node_For) { - return; - } - - foreach ($node as $n) { - if (!$n) { - continue; - } - - $this->checkLoopUsageBody($stream, $n); - } - } - - public function getTag() - { - return 'for'; - } -} - -class_alias('Twig_TokenParser_For', 'Twig\TokenParser\ForTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/From.php b/vendor/twig/twig/lib/Twig/TokenParser/From.php deleted file mode 100644 index 75c4342..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/From.php +++ /dev/null @@ -1,60 +0,0 @@ - - * {% from 'forms.html' import forms %} - * - */ -final class Twig_TokenParser_From extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect('import'); - - $targets = array(); - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = $alias; - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } while (true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); - - foreach ($targets as $name => $alias) { - $this->parser->addImportedSymbol('function', $alias, 'macro_'.$name, $node->getNode('var')); - } - - return $node; - } - - public function getTag() - { - return 'from'; - } -} - -class_alias('Twig_TokenParser_From', 'Twig\TokenParser\FromTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/If.php b/vendor/twig/twig/lib/Twig/TokenParser/If.php deleted file mode 100644 index 5606a41..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/If.php +++ /dev/null @@ -1,84 +0,0 @@ - - * {% if users %} - *
      - * {% for user in users %} - *
    • {{ user.username|e }}
    • - * {% endfor %} - *
    - * {% endif %} - * - */ -final class Twig_TokenParser_If extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elseif': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endif': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('elseif', 'else', 'endif')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endif')); - } - - public function getTag() - { - return 'if'; - } -} - -class_alias('Twig_TokenParser_If', 'Twig\TokenParser\IfTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Import.php b/vendor/twig/twig/lib/Twig/TokenParser/Import.php deleted file mode 100644 index 8545951..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Import.php +++ /dev/null @@ -1,39 +0,0 @@ - - * {% import 'forms.html' as forms %} - * - */ -final class Twig_TokenParser_Import extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $macro = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect('as'); - $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addImportedSymbol('template', $var->getAttribute('name')); - - return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); - } - - public function getTag() - { - return 'import'; - } -} - -class_alias('Twig_TokenParser_Import', 'Twig\TokenParser\ImportTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Include.php b/vendor/twig/twig/lib/Twig/TokenParser/Include.php deleted file mode 100644 index 309f11d..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Include.php +++ /dev/null @@ -1,65 +0,0 @@ - - * {% include 'header.html' %} - * Body - * {% include 'footer.html' %} - * - */ -class Twig_TokenParser_Include extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $expr = $this->parser->getExpressionParser()->parseExpression(); - - list($variables, $only, $ignoreMissing) = $this->parseArguments(); - - return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); - } - - protected function parseArguments() - { - $stream = $this->parser->getStream(); - - $ignoreMissing = false; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) { - $stream->expect(Twig_Token::NAME_TYPE, 'missing'); - - $ignoreMissing = true; - } - - $variables = null; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - } - - $only = false; - if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) { - $only = true; - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return array($variables, $only, $ignoreMissing); - } - - public function getTag() - { - return 'include'; - } -} - -class_alias('Twig_TokenParser_Include', 'Twig\TokenParser\IncludeTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php b/vendor/twig/twig/lib/Twig/TokenParser/Macro.php deleted file mode 100644 index a924a29..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Macro.php +++ /dev/null @@ -1,58 +0,0 @@ - - * {% macro input(name, value, type, size) %} - * - * {% endmacro %} - * - */ -final class Twig_TokenParser_Macro extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $this->parser->pushLocalScope(); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) { - $value = $token->getValue(); - - if ($value != $name) { - throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } - $this->parser->popLocalScope(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag())); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endmacro'); - } - - public function getTag() - { - return 'macro'; - } -} - -class_alias('Twig_TokenParser_Macro', 'Twig\TokenParser\MacroTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php b/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php deleted file mode 100644 index 957f928..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php +++ /dev/null @@ -1,59 +0,0 @@ - - * {% sandbox %} - * {% include 'user.html' %} - * {% endsandbox %} - * - * - * @see http://www.twig-project.org/doc/api.html#sandbox-extension for details - */ -final class Twig_TokenParser_Sandbox extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - // in a sandbox tag, only include tags are allowed - if (!$body instanceof Twig_Node_Include) { - foreach ($body as $node) { - if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { - continue; - } - - if (!$node instanceof Twig_Node_Include) { - throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); - } - } - } - - return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endsandbox'); - } - - public function getTag() - { - return 'sandbox'; - } -} - -class_alias('Twig_TokenParser_Sandbox', 'Twig\TokenParser\SandboxTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Set.php b/vendor/twig/twig/lib/Twig/TokenParser/Set.php deleted file mode 100644 index 9e3daf6..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Set.php +++ /dev/null @@ -1,73 +0,0 @@ - - * {% set foo = 'foo' %} - * - * {% set foo = [1, 2] %} - * - * {% set foo = {'foo': 'bar'} %} - * - * {% set foo = 'foo' ~ 'bar' %} - * - * {% set foo, bar = 'foo', 'bar' %} - * - * {% set foo %}Some content{% endset %} - * - */ -final class Twig_TokenParser_Set extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - $stream = $this->parser->getStream(); - $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); - - $capture = false; - if ($stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { - $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - if (count($names) !== count($values)) { - throw new Twig_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - } else { - $capture = true; - - if (count($names) > 1) { - throw new Twig_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - } - - return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag()); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test('endset'); - } - - public function getTag() - { - return 'set'; - } -} - -class_alias('Twig_TokenParser_Set', 'Twig\TokenParser\SetTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php b/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php deleted file mode 100644 index 335b83f..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php +++ /dev/null @@ -1,49 +0,0 @@ - - * {% spaceless %} - *
    - * foo - *
    - * {% endspaceless %} - * - * {# output will be
    foo
    #} - * - */ -final class Twig_TokenParser_Spaceless extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $lineno = $token->getLine(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); - } - - public function decideSpacelessEnd(Twig_Token $token) - { - return $token->test('endspaceless'); - } - - public function getTag() - { - return 'spaceless'; - } -} - -class_alias('Twig_TokenParser_Spaceless', 'Twig\TokenParser\SpacelessTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/Use.php b/vendor/twig/twig/lib/Twig/TokenParser/Use.php deleted file mode 100644 index 0f35c9d..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/Use.php +++ /dev/null @@ -1,68 +0,0 @@ - - * {% extends "base.html" %} - * - * {% use "blocks.html" %} - * - * {% block title %}{% endblock %} - * {% block content %}{% endblock %} - * - * - * @see http://www.twig-project.org/doc/templates.html#horizontal-reuse for details. - */ -final class Twig_TokenParser_Use extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $template = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - - if (!$template instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); - } - - $targets = array(); - if ($stream->nextIf('with')) { - do { - $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - - $alias = $name; - if ($stream->nextIf('as')) { - $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - } - - $targets[$name] = new Twig_Node_Expression_Constant($alias, -1); - - if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { - break; - } - } while (true); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); - - return new Twig_Node(); - } - - public function getTag() - { - return 'use'; - } -} - -class_alias('Twig_TokenParser_Use', 'Twig\TokenParser\UseTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParser/With.php b/vendor/twig/twig/lib/Twig/TokenParser/With.php deleted file mode 100644 index 1ec86f8..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParser/With.php +++ /dev/null @@ -1,50 +0,0 @@ - - */ -final class Twig_TokenParser_With extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - - $variables = null; - $only = false; - if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) { - $variables = $this->parser->getExpressionParser()->parseExpression(); - $only = $stream->nextIf(Twig_Token::NAME_TYPE, 'only'); - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideWithEnd'), true); - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_With($body, $variables, $only, $token->getLine(), $this->getTag()); - } - - public function decideWithEnd(Twig_Token $token) - { - return $token->test('endwith'); - } - - public function getTag() - { - return 'with'; - } -} - -class_alias('Twig_TokenParser_With', 'Twig\TokenParser\WithTokenParser', false); diff --git a/vendor/twig/twig/lib/Twig/TokenParserInterface.php b/vendor/twig/twig/lib/Twig/TokenParserInterface.php deleted file mode 100644 index ee5e09e..0000000 --- a/vendor/twig/twig/lib/Twig/TokenParserInterface.php +++ /dev/null @@ -1,43 +0,0 @@ - - */ -interface Twig_TokenParserInterface -{ - /** - * Sets the parser associated with this token parser. - */ - public function setParser(Twig_Parser $parser); - - /** - * Parses a token and returns a node. - * - * @return Twig_Node A Twig_Node instance - * - * @throws Twig_Error_Syntax - */ - public function parse(Twig_Token $token); - - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag(); -} - -class_alias('Twig_TokenParserInterface', 'Twig\TokenParser\TokenParserInterface', false); -class_exists('Twig_Parser'); -class_exists('Twig_Token'); diff --git a/vendor/twig/twig/lib/Twig/TokenStream.php b/vendor/twig/twig/lib/Twig/TokenStream.php deleted file mode 100644 index c32180c..0000000 --- a/vendor/twig/twig/lib/Twig/TokenStream.php +++ /dev/null @@ -1,150 +0,0 @@ - - */ -final class Twig_TokenStream -{ - private $tokens; - private $current = 0; - private $source; - - /** - * @param array $tokens An array of tokens - * @param Twig_Source $source - */ - public function __construct(array $tokens, Twig_Source $source = null) - { - $this->tokens = $tokens; - $this->source = $source ?: new Twig_Source('', ''); - } - - public function __toString() - { - return implode("\n", $this->tokens); - } - - public function injectTokens(array $tokens) - { - $this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current)); - } - - /** - * Sets the pointer to the next token and returns the old one. - * - * @return Twig_Token - */ - public function next() - { - if (!isset($this->tokens[++$this->current])) { - throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current - 1]; - } - - /** - * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. - * - * @return Twig_Token|null The next token if the condition is true, null otherwise - */ - public function nextIf($primary, $secondary = null) - { - if ($this->tokens[$this->current]->test($primary, $secondary)) { - return $this->next(); - } - } - - /** - * Tests a token and returns it or throws a syntax error. - * - * @return Twig_Token - */ - public function expect($type, $value = null, $message = null) - { - $token = $this->tokens[$this->current]; - if (!$token->test($type, $value)) { - $line = $token->getLine(); - throw new Twig_Error_Syntax(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s).', - $message ? $message.'. ' : '', - Twig_Token::typeToEnglish($token->getType()), $token->getValue(), - Twig_Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), - $line, - $this->source - ); - } - $this->next(); - - return $token; - } - - /** - * Looks at the next token. - * - * @param int $number - * - * @return Twig_Token - */ - public function look($number = 1) - { - if (!isset($this->tokens[$this->current + $number])) { - throw new Twig_Error_Syntax('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); - } - - return $this->tokens[$this->current + $number]; - } - - /** - * Tests the current token. - * - * @return bool - */ - public function test($primary, $secondary = null) - { - return $this->tokens[$this->current]->test($primary, $secondary); - } - - /** - * Checks if end of stream was reached. - * - * @return bool - */ - public function isEOF() - { - return $this->tokens[$this->current]->getType() === Twig_Token::EOF_TYPE; - } - - /** - * @return Twig_Token - */ - public function getCurrent() - { - return $this->tokens[$this->current]; - } - - /** - * Gets the source associated with this stream. - * - * @return Twig_Source - * - * @internal - */ - public function getSourceContext() - { - return $this->source; - } -} - -class_alias('Twig_TokenStream', 'Twig\TokenStream', false); diff --git a/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php b/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php deleted file mode 100644 index c3971ef..0000000 --- a/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ -final class Twig_Util_DeprecationCollector -{ - private $twig; - - public function __construct(Twig_Environment $twig) - { - $this->twig = $twig; - } - - /** - * Returns deprecations for templates contained in a directory. - * - * @param string $dir A directory where templates are stored - * @param string $ext Limit the loaded templates by extension - * - * @return array An array of deprecations - */ - public function collectDir($dir, $ext = '.twig') - { - $iterator = new RegexIterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY - ), '{'.preg_quote($ext).'$}' - ); - - return $this->collect(new Twig_Util_TemplateDirIterator($iterator)); - } - - /** - * Returns deprecations for passed templates. - * - * @param Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template) - * - * @return array An array of deprecations - */ - public function collect(Traversable $iterator) - { - $deprecations = array(); - set_error_handler(function ($type, $msg) use (&$deprecations) { - if (E_USER_DEPRECATED === $type) { - $deprecations[] = $msg; - } - }); - - foreach ($iterator as $name => $contents) { - try { - $this->twig->parse($this->twig->tokenize(new Twig_Source($contents, $name))); - } catch (Twig_Error_Syntax $e) { - // ignore templates containing syntax errors - } - } - - restore_error_handler(); - - return $deprecations; - } -} - -class_alias('Twig_Util_DeprecationCollector', 'Twig\Util\DeprecationCollector', false); diff --git a/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php b/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php deleted file mode 100644 index c868233..0000000 --- a/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php +++ /dev/null @@ -1,28 +0,0 @@ - - */ -class Twig_Util_TemplateDirIterator extends IteratorIterator -{ - public function current() - { - return file_get_contents(parent::current()); - } - - public function key() - { - return (string) parent::key(); - } -} - -class_alias('Twig_Util_TemplateDirIterator', 'Twig\Util\TemplateDirIterator', false); diff --git a/vendor/twig/twig/phpunit.xml.dist b/vendor/twig/twig/phpunit.xml.dist deleted file mode 100644 index ce77327..0000000 --- a/vendor/twig/twig/phpunit.xml.dist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - ./test/Twig/ - - - - - - - - - - - - - - ./lib/Twig/ - - - diff --git a/vendor/twig/twig/src/Cache/CacheInterface.php b/vendor/twig/twig/src/Cache/CacheInterface.php deleted file mode 100644 index 2e35e3b..0000000 --- a/vendor/twig/twig/src/Cache/CacheInterface.php +++ /dev/null @@ -1,11 +0,0 @@ - - */ -interface RuntimeExtensionInterface -{ -} diff --git a/vendor/twig/twig/src/Extension/SandboxExtension.php b/vendor/twig/twig/src/Extension/SandboxExtension.php deleted file mode 100644 index 0c244ff..0000000 --- a/vendor/twig/twig/src/Extension/SandboxExtension.php +++ /dev/null @@ -1,11 +0,0 @@ -classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; - $this->directory = sys_get_temp_dir().'/twig-test'; - $this->cache = new Twig_Cache_Filesystem($this->directory); - } - - protected function tearDown() - { - if (file_exists($this->directory)) { - Twig_Tests_FilesystemHelper::removeDir($this->directory); - } - } - - public function testLoad() - { - $key = $this->directory.'/cache/cachefile.php'; - - $dir = dirname($key); - @mkdir($dir, 0777, true); - $this->assertTrue(is_dir($dir)); - $this->assertFalse(class_exists($this->classname, false)); - - $content = $this->generateSource(); - file_put_contents($key, $content); - - $this->cache->load($key); - - $this->assertTrue(class_exists($this->classname, false)); - } - - public function testLoadMissing() - { - $key = $this->directory.'/cache/cachefile.php'; - - $this->assertFalse(class_exists($this->classname, false)); - - $this->cache->load($key); - - $this->assertFalse(class_exists($this->classname, false)); - } - - public function testWrite() - { - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFileNotExists($key); - $this->assertFileNotExists($this->directory); - - $this->cache->write($key, $content); - - $this->assertFileExists($this->directory); - $this->assertFileExists($key); - $this->assertSame(file_get_contents($key), $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Unable to create the cache directory - */ - public function testWriteFailMkdir() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Read-only directories not possible on Windows.'); - } - - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFileNotExists($key); - - // Create read-only root directory. - @mkdir($this->directory, 0555, true); - $this->assertTrue(is_dir($this->directory)); - - $this->cache->write($key, $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Unable to write in the cache directory - */ - public function testWriteFailDirWritable() - { - if (defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->markTestSkipped('Read-only directories not possible on Windows.'); - } - - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFileNotExists($key); - - // Create root directory. - @mkdir($this->directory, 0777, true); - // Create read-only subdirectory. - @mkdir($this->directory.'/cache', 0555); - $this->assertTrue(is_dir($this->directory.'/cache')); - - $this->cache->write($key, $content); - } - - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Failed to write cache file - */ - public function testWriteFailWriteFile() - { - $key = $this->directory.'/cache/cachefile.php'; - $content = $this->generateSource(); - - $this->assertFileNotExists($key); - - // Create a directory in the place of the cache file. - @mkdir($key, 0777, true); - $this->assertTrue(is_dir($key)); - - $this->cache->write($key, $content); - } - - public function testGetTimestamp() - { - $key = $this->directory.'/cache/cachefile.php'; - - $dir = dirname($key); - @mkdir($dir, 0777, true); - $this->assertTrue(is_dir($dir)); - - // Create the file with a specific modification time. - touch($key, 1234567890); - - $this->assertSame(1234567890, $this->cache->getTimestamp($key)); - } - - public function testGetTimestampMissingFile() - { - $key = $this->directory.'/cache/cachefile.php'; - $this->assertSame(0, $this->cache->getTimestamp($key)); - } - - /** - * Test file cache is tolerant towards trailing (back)slashes on the configured cache directory. - * - * @dataProvider provideDirectories - */ - public function testGenerateKey($expected, $input) - { - $cache = new Twig_Cache_Filesystem($input); - $this->assertRegExp($expected, $cache->generateKey('_test_', get_class($this))); - } - - public function provideDirectories() - { - $pattern = '#a/b/[a-zA-Z0-9]+/[a-zA-Z0-9]+.php$#'; - - return array( - array($pattern, 'a/b'), - array($pattern, 'a/b/'), - array($pattern, 'a/b\\'), - array($pattern, 'a/b\\/'), - array($pattern, 'a/b\\//'), - array('#/'.substr($pattern, 1), '/a/b'), - ); - } - - private function generateSource() - { - return strtr(' $this->classname, - )); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/vendor/twig/twig/test/Twig/Tests/CompilerTest.php deleted file mode 100644 index 4d4b8df..0000000 --- a/vendor/twig/twig/test/Twig/Tests/CompilerTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock())); - - $locale = setlocale(LC_NUMERIC, 0); - if (false === $locale) { - $this->markTestSkipped('Your platform does not support locales.'); - } - - $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); - if (false === setlocale(LC_NUMERIC, $required_locales)) { - $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales)); - } - - $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); - $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); - - setlocale(LC_NUMERIC, $locale); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php b/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php deleted file mode 100644 index a4a3e35..0000000 --- a/vendor/twig/twig/test/Twig/Tests/ContainerRuntimeLoaderTest.php +++ /dev/null @@ -1,35 +0,0 @@ -getMockBuilder(ContainerInterface::class)->getMock(); - $container->expects($this->once())->method('has')->with('stdClass')->willReturn(true); - $container->expects($this->once())->method('get')->with('stdClass')->willReturn(new \stdClass()); - - $loader = new Twig_ContainerRuntimeLoader($container); - - $this->assertInstanceOf('stdClass', $loader->load('stdClass')); - } - - public function testLoadUnknownRuntimeReturnsNull() - { - $container = $this->getMockBuilder(ContainerInterface::class)->getMock(); - $container->expects($this->once())->method('has')->with('Foo'); - $container->expects($this->never())->method('get'); - - $this->assertNull((new Twig_ContainerRuntimeLoader($container))->load('Foo')); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php b/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php deleted file mode 100644 index 313b790..0000000 --- a/vendor/twig/twig/test/Twig/Tests/CustomExtensionTest.php +++ /dev/null @@ -1,78 +0,0 @@ -expectException('InvalidArgumentException'); - $this->expectExceptionMessage($expectedExceptionMessage); - } else { - $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage); - } - - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $env->addExtension($extension); - $env->getUnaryOperators(); - } - - public function provideInvalidExtensions() - { - return array( - array(new InvalidOperatorExtension(new stdClass()), '"InvalidOperatorExtension::getOperators()" must return an array with operators, got "stdClass".'), - array(new InvalidOperatorExtension(array(1, 2, 3)), '"InvalidOperatorExtension::getOperators()" must return an array of 2 elements, got 3.'), - ); - } -} - -class InvalidOperatorExtension implements Twig_ExtensionInterface -{ - private $operators; - - public function __construct($operators) - { - $this->operators = $operators; - } - - public function getTokenParsers() - { - return array(); - } - - public function getNodeVisitors() - { - return array(); - } - - public function getFilters() - { - return array(); - } - - public function getTests() - { - return array(); - } - - public function getFunctions() - { - return array(); - } - - public function getOperators() - { - return $this->operators; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php deleted file mode 100644 index e2fb0df..0000000 --- a/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +++ /dev/null @@ -1,549 +0,0 @@ - '{{ foo }} {{ foo }}', - 'js' => '{{ bar }} {{ bar }}', - )); - - $twig = new Twig_Environment($loader, array( - 'debug' => true, - 'cache' => false, - 'autoescape' => array($this, 'escapingStrategyCallback'), - )); - - $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo
    '))); - $this->assertEquals('foo\x3Cbr\x2F\x20\x3E foo\x3Cbr\x2F\x20\x3E', $twig->render('js', array('bar' => 'foo
    '))); - } - - public function escapingStrategyCallback($name) - { - return $name; - } - - public function testGlobals() - { - $loader = $this->getMockBuilder('Twig_LoaderInterface')->getMock(); - $loader->expects($this->any())->method('getSourceContext')->will($this->returnValue(new Twig_Source('', ''))); - - // globals can be added after calling getGlobals - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after a template has been loaded - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->loadTemplate('index'); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after extensions init - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - // globals can be modified after extensions and a template has been loaded - $arrayLoader = new Twig_Loader_Array(array('index' => '{{foo}}')); - $twig = new Twig_Environment($arrayLoader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->loadTemplate('index'); - $twig->addGlobal('foo', 'bar'); - $globals = $twig->getGlobals(); - $this->assertEquals('bar', $globals['foo']); - - $twig = new Twig_Environment($arrayLoader); - $twig->getGlobals(); - $twig->addGlobal('foo', 'bar'); - $template = $twig->loadTemplate('index'); - $this->assertEquals('bar', $template->render(array())); - - // globals cannot be added after a template has been loaded - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertArrayNotHasKey('bar', $twig->getGlobals()); - } - - // globals cannot be added after extensions init - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertArrayNotHasKey('bar', $twig->getGlobals()); - } - - // globals cannot be added after extensions and a template has been loaded - $twig = new Twig_Environment($loader); - $twig->addGlobal('foo', 'foo'); - $twig->getGlobals(); - $twig->getFunctions(); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertArrayNotHasKey('bar', $twig->getGlobals()); - } - - // test adding globals after a template has been loaded without call to getGlobals - $twig = new Twig_Environment($loader); - $twig->loadTemplate('index'); - try { - $twig->addGlobal('bar', 'bar'); - $this->fail(); - } catch (LogicException $e) { - $this->assertArrayNotHasKey('bar', $twig->getGlobals()); - } - } - - public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate() - { - $cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig'); - $options = array('cache' => $cache, 'auto_reload' => false, 'debug' => false); - - // force compilation - $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{ foo }}')), $options); - - $key = $cache->generateKey('index', $twig->getTemplateClass('index')); - $cache->write($key, $twig->compileSource(new Twig_Source('{{ foo }}', 'index'))); - - // check that extensions won't be initialized when rendering a template that is already in the cache - $twig = $this - ->getMockBuilder('Twig_Environment') - ->setConstructorArgs(array($loader, $options)) - ->setMethods(array('initExtensions')) - ->getMock() - ; - - $twig->expects($this->never())->method('initExtensions'); - - // render template - $output = $twig->render('index', array('foo' => 'bar')); - $this->assertEquals('bar', $output); - - Twig_Tests_FilesystemHelper::removeDir($dir); - } - - public function testAutoReloadCacheMiss() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - // Cache miss: getTimestamp returns 0 and as a result the load() is - // skipped. - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue(0)); - $loader->expects($this->never()) - ->method('isFresh'); - $cache->expects($this->once()) - ->method('write'); - $cache->expects($this->once()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testAutoReloadCacheHit() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - $now = time(); - - // Cache hit: getTimestamp returns something > extension timestamps and - // the loader returns true for isFresh(). - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue($now)); - $loader->expects($this->once()) - ->method('isFresh') - ->will($this->returnValue(true)); - $cache->expects($this->atLeastOnce()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testAutoReloadOutdatedCacheHit() - { - $templateName = __FUNCTION__; - $templateContent = __FUNCTION__; - - $cache = $this->getMockBuilder('Twig_CacheInterface')->getMock(); - $loader = $this->getMockLoader($templateName, $templateContent); - $twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); - - $now = time(); - - $cache->expects($this->once()) - ->method('generateKey') - ->will($this->returnValue('key')); - $cache->expects($this->once()) - ->method('getTimestamp') - ->will($this->returnValue($now)); - $loader->expects($this->once()) - ->method('isFresh') - ->will($this->returnValue(false)); - $cache->expects($this->once()) - ->method('write'); - $cache->expects($this->once()) - ->method('load'); - - $twig->loadTemplate($templateName); - } - - public function testHasGetExtensionByClassName() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->addExtension($ext = new Twig_Tests_EnvironmentTest_Extension()); - $this->assertTrue($twig->hasExtension('Twig_Tests_EnvironmentTest_Extension')); - $this->assertTrue($twig->hasExtension('\Twig_Tests_EnvironmentTest_Extension')); - - $this->assertSame($ext, $twig->getExtension('Twig_Tests_EnvironmentTest_Extension')); - $this->assertSame($ext, $twig->getExtension('\Twig_Tests_EnvironmentTest_Extension')); - - $this->assertTrue($twig->hasExtension('Twig\Tests\EnvironmentTest\Extension')); - $this->assertSame($ext, $twig->getExtension('Twig\Tests\EnvironmentTest\Extension')); - } - - public function testAddExtension() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - - $this->assertArrayHasKey('test', $twig->getTags()); - $this->assertArrayHasKey('foo_filter', $twig->getFilters()); - $this->assertArrayHasKey('foo_function', $twig->getFunctions()); - $this->assertArrayHasKey('foo_test', $twig->getTests()); - $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators()); - $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators()); - $this->assertArrayHasKey('foo_global', $twig->getGlobals()); - $visitors = $twig->getNodeVisitors(); - $found = false; - foreach ($visitors as $visitor) { - if ($visitor instanceof Twig_Tests_EnvironmentTest_NodeVisitor) { - $found = true; - } - } - $this->assertTrue($found); - } - - public function testAddMockExtension() - { - $extension = $this->getMockBuilder('Twig_ExtensionInterface')->getMock(); - - $loader = new Twig_Loader_Array(array('page' => 'hey')); - - $twig = new Twig_Environment($loader); - $twig->addExtension($extension); - - $this->assertInstanceOf('Twig_ExtensionInterface', $twig->getExtension(get_class($extension))); - $this->assertTrue($twig->isTemplateFresh('page', time())); - } - - public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation() - { - $loader = $this->getMockBuilder('Twig_LoaderInterface')->getMock(); - $twig = new Twig_Environment($loader); - $loader->expects($this->once())->method('getSourceContext')->will($this->returnValue(new Twig_Source('', ''))); - $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime()); - $twig->loadTemplate(''); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any deprecations - $this->addToAssertionCount(1); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage Unable to register extension "Twig_Tests_EnvironmentTest_Extension" as it is already registered. - */ - public function testOverrideExtension() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - $twig->addExtension(new Twig_Tests_EnvironmentTest_Extension()); - } - - public function testAddRuntimeLoader() - { - $runtimeLoader = $this->getMockBuilder('Twig_RuntimeLoaderInterface')->getMock(); - $runtimeLoader->expects($this->any())->method('load')->will($this->returnValue(new Twig_Tests_EnvironmentTest_Runtime())); - - $loader = new Twig_Loader_Array(array( - 'func_array' => '{{ from_runtime_array("foo") }}', - 'func_array_default' => '{{ from_runtime_array() }}', - 'func_array_named_args' => '{{ from_runtime_array(name="foo") }}', - 'func_string' => '{{ from_runtime_string("foo") }}', - 'func_string_default' => '{{ from_runtime_string() }}', - 'func_string_named_args' => '{{ from_runtime_string(name="foo") }}', - )); - - $twig = new Twig_Environment($loader); - $twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime()); - $twig->addRuntimeLoader($runtimeLoader); - - $this->assertEquals('foo', $twig->render('func_array')); - $this->assertEquals('bar', $twig->render('func_array_default')); - $this->assertEquals('foo', $twig->render('func_array_named_args')); - $this->assertEquals('foo', $twig->render('func_string')); - $this->assertEquals('bar', $twig->render('func_string_default')); - $this->assertEquals('foo', $twig->render('func_string_named_args')); - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Failed to load Twig template "testFailLoadTemplate.twig", index "abc": cache is corrupted in "testFailLoadTemplate.twig". - */ - public function testFailLoadTemplate() - { - $template = 'testFailLoadTemplate.twig'; - $twig = new Twig_Environment(new Twig_Loader_Array(array($template => false))); - //$twig->setCache(new CorruptCache()); - $twig->loadTemplate($template, 'abc'); - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Circular reference detected for Twig template "base.html.twig", path: base.html.twig -> base.html.twig in "base.html.twig" at line 1 - */ - public function testFailLoadTemplateOnCircularReference() - { - $twig = new Twig_Environment(new Twig_Loader_Array(array( - 'base.html.twig' => '{% extends "base.html.twig" %}', - ))); - - $twig->loadTemplate('base.html.twig'); - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Circular reference detected for Twig template "base1.html.twig", path: base1.html.twig -> base2.html.twig -> base1.html.twig in "base1.html.twig" at line 1 - */ - public function testFailLoadTemplateOnComplexCircularReference() - { - $twig = new Twig_Environment(new Twig_Loader_Array(array( - 'base1.html.twig' => '{% extends "base2.html.twig" %}', - 'base2.html.twig' => '{% extends "base1.html.twig" %}', - ))); - - $twig->loadTemplate('base1.html.twig'); - } - - protected function getMockLoader($templateName, $templateContent) - { - $loader = $this->getMockBuilder('Twig_LoaderInterface')->getMock(); - $loader->expects($this->any()) - ->method('getSourceContext') - ->with($templateName) - ->will($this->returnValue(new Twig_Source($templateContent, $templateName))); - $loader->expects($this->any()) - ->method('getCacheKey') - ->with($templateName) - ->will($this->returnValue($templateName)); - - return $loader; - } -} - -class CorruptCache implements Twig_CacheInterface -{ - public function generateKey($name, $className) - { - return $name.':'.$className; - } - - public function write($key, $content) - { - } - - public function load($key) - { - } - - public function getTimestamp($key) - { - time(); - } -} - -class Twig_Tests_EnvironmentTest_Extension_WithGlobals extends Twig_Extension -{ - public function getGlobals() - { - return array( - 'foo_global' => 'foo_global', - ); - } -} - -class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface -{ - public function getTokenParsers() - { - return array( - new Twig_Tests_EnvironmentTest_TokenParser(), - ); - } - - public function getNodeVisitors() - { - return array( - new Twig_Tests_EnvironmentTest_NodeVisitor(), - ); - } - - public function getFilters() - { - return array( - new Twig_Filter('foo_filter'), - ); - } - - public function getTests() - { - return array( - new Twig_Test('foo_test'), - ); - } - - public function getFunctions() - { - return array( - new Twig_Function('foo_function'), - ); - } - - public function getOperators() - { - return array( - array('foo_unary' => array()), - array('foo_binary' => array()), - ); - } - - public function getGlobals() - { - return array( - 'foo_global' => 'foo_global', - ); - } -} -class_alias('Twig_Tests_EnvironmentTest_Extension', 'Twig\Tests\EnvironmentTest\Extension', false); - -class Twig_Tests_EnvironmentTest_TokenParser extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - } - - public function getTag() - { - return 'test'; - } -} - -class Twig_Tests_EnvironmentTest_NodeVisitor implements Twig_NodeVisitorInterface -{ - public function enterNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - public function leaveNode(Twig_Node $node, Twig_Environment $env) - { - return $node; - } - - public function getPriority() - { - return 0; - } -} - -class Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime extends Twig_Extension -{ - public function initRuntime(Twig_Environment $env) - { - } -} - -class Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime extends Twig_Extension implements Twig_Extension_InitRuntimeInterface -{ - public function initRuntime(Twig_Environment $env) - { - } -} - -class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends Twig_Extension -{ - public function getFunctions() - { - return array( - new Twig_Function('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')), - new Twig_Function('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), - ); - } - - public function getName() - { - return 'from_runtime'; - } -} - -class Twig_Tests_EnvironmentTest_Runtime -{ - public function fromRuntime($name = 'bar') - { - return $name; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/vendor/twig/twig/test/Twig/Tests/ErrorTest.php deleted file mode 100644 index 7ba7a34..0000000 --- a/vendor/twig/twig/test/Twig/Tests/ErrorTest.php +++ /dev/null @@ -1,212 +0,0 @@ -setSourceContext(new Twig_Source('', new SplFileInfo(__FILE__))); - - $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); - } - - public function testErrorWithArrayFilename() - { - $error = new Twig_Error('foo'); - $error->setSourceContext(new Twig_Source('', array('foo' => 'bar'))); - - $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); - } - - public function testTwigExceptionGuessWithMissingVarAndArrayLoader() - { - $loader = new Twig_Loader_Array(array( - 'base.html' => '{% block content %}{% endblock %}', - 'index.html' => << true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index.html'); - try { - $template->render(array()); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); - $this->assertEquals('index.html', $e->getSourceContext()->getName()); - } - } - - public function testTwigExceptionGuessWithExceptionAndArrayLoader() - { - $loader = new Twig_Loader_Array(array( - 'base.html' => '{% block content %}{% endblock %}', - 'index.html' => << true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index.html'); - try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); - $this->assertEquals('index.html', $e->getSourceContext()->getName()); - } - } - - public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader() - { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index.html'); - try { - $template->render(array()); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals('Variable "foo" does not exist.', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); - $this->assertEquals('index.html', $e->getSourceContext()->getName()); - $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); - } - } - - public function testTwigExceptionGuessWithExceptionAndFilesystemLoader() - { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index.html'); - try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); - $this->assertEquals('index.html', $e->getSourceContext()->getName()); - $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); - } - } - - /** - * @dataProvider getErroredTemplates - */ - public function testTwigExceptionAddsFileAndLine($templates, $name, $line) - { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); - - $template = $twig->loadTemplate('index'); - - try { - $template->render(array()); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage()); - $this->assertEquals($line, $e->getTemplateLine()); - $this->assertEquals($name, $e->getSourceContext()->getName()); - } - - try { - $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); - - $this->fail(); - } catch (Twig_Error_Runtime $e) { - $this->assertEquals(sprintf('An exception has been thrown during the rendering of a template ("Runtime error...") in "%s" at line %d.', $name, $line), $e->getMessage()); - $this->assertEquals($line, $e->getTemplateLine()); - $this->assertEquals($name, $e->getSourceContext()->getName()); - } - } - - public function getErroredTemplates() - { - return array( - // error occurs in a template - array( - array( - 'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}", - ), - 'index', 3, - ), - - // error occurs in an included template - array( - array( - 'index' => "{% include 'partial' %}", - 'partial' => '{{ foo.bar }}', - ), - 'partial', 1, - ), - - // error occurs in a parent block when called via parent() - array( - array( - 'index' => "{% extends 'base' %} - {% block content %} - {{ parent() }} - {% endblock %}", - 'base' => '{% block content %}{{ foo.bar }}{% endblock %}', - ), - 'base', 1, - ), - - // error occurs in a block from the child - array( - array( - 'index' => "{% extends 'base' %} - {% block content %} - {{ foo.bar }} - {% endblock %} - {% block foo %} - {{ foo.bar }} - {% endblock %}", - 'base' => '{% block content %}{% endblock %}', - ), - 'index', 3, - ), - ); - } -} - -class Twig_Tests_ErrorTest_Foo -{ - public function bar() - { - throw new Exception('Runtime error...'); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php deleted file mode 100644 index 3a173f0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php +++ /dev/null @@ -1,377 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); - } - - public function getFailingTestsForAssignment() - { - return array( - array('{% set false = "foo" %}'), - array('{% set FALSE = "foo" %}'), - array('{% set true = "foo" %}'), - array('{% set TRUE = "foo" %}'), - array('{% set none = "foo" %}'), - array('{% set NONE = "foo" %}'), - array('{% set null = "foo" %}'), - array('{% set NULL = "foo" %}'), - array('{% set 3 = "foo" %}'), - array('{% set 1 + 2 = "foo" %}'), - array('{% set "bar" = "foo" %}'), - array('{% set %}{% endset %}'), - ); - } - - /** - * @dataProvider getTestsForArray - */ - public function testArrayExpression($template, $expected) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $stream = $env->tokenize(new Twig_Source($template, '')); - $parser = new Twig_Parser($env); - - $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); - } - - /** - * @expectedException Twig_Error_Syntax - * @dataProvider getFailingTestsForArray - */ - public function testArraySyntaxError($template) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); - } - - public function getFailingTestsForArray() - { - return array( - array('{{ [1, "a": "b"] }}'), - array('{{ {"a": "b", 2} }}'), - ); - } - - public function getTestsForArray() - { - return array( - // simple array - array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), - - // array with trailing , - array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - ), - - // simple hash - array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - - // hash with trailing , - array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - - // hash in an array - array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Constant('b', 1), - - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), 1), - ), - - // array in a hash - array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant('a', 1), - new Twig_Node_Expression_Array(array( - new Twig_Node_Expression_Constant(0, 1), - new Twig_Node_Expression_Constant(1, 1), - - new Twig_Node_Expression_Constant(1, 1), - new Twig_Node_Expression_Constant(2, 1), - ), 1), - new Twig_Node_Expression_Constant('b', 1), - new Twig_Node_Expression_Constant('c', 1), - ), 1), - ), - ); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize(new Twig_Source('{{ "a" "b" }}', 'index')); - $parser = new Twig_Parser($env); - - $parser->parse($stream); - } - - /** - * @dataProvider getTestsForString - */ - public function testStringExpression($template, $expected) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); - $stream = $env->tokenize(new Twig_Source($template, '')); - $parser = new Twig_Parser($env); - - $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); - } - - public function getTestsForString() - { - return array( - array( - '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), - ), - array( - '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - ), - array( - '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - ), - - array( - '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Binary_Concat( - new Twig_Node_Expression_Constant('foo ', 1), - new Twig_Node_Expression_Name('bar', 1), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - 1 - ), - new Twig_Node_Expression_Constant(' baz', 1), - 1 - ), - ), - ); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testAttributeCallDoesNotSupportNamedArguments() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ foo.bar(name="Foo") }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - */ - public function testMacroCallDoesNotSupportNamedArguments() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. - */ - public function testMacroDefinitionDoesNotSupportNonNameVariableName() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{% macro foo("a") %}{% endmacro %}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 - * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues - */ - public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); - } - - public function getMacroDefinitionDoesNotSupportNonConstantDefaultValues() - { - return array( - array('{% macro foo(name = "a #{foo} a") %}{% endmacro %}'), - array('{% macro foo(name = [["b", "a #{foo} a"]]) %}{% endmacro %}'), - ); - } - - /** - * @dataProvider getMacroDefinitionSupportsConstantDefaultValues - */ - public function testMacroDefinitionSupportsConstantDefaultValues($template) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source($template, 'index'))); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function getMacroDefinitionSupportsConstantDefaultValues() - { - return array( - array('{% macro foo(name = "aa") %}{% endmacro %}'), - array('{% macro foo(name = 12) %}{% endmacro %}'), - array('{% macro foo(name = true) %}{% endmacro %}'), - array('{% macro foo(name = ["a"]) %}{% endmacro %}'), - array('{% macro foo(name = [["a"]]) %}{% endmacro %}'), - array('{% macro foo(name = {a: "a"}) %}{% endmacro %}'), - array('{% macro foo(name = {a: {b: "a"}}) %}{% endmacro %}'), - ); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? - */ - public function testUnknownFunction() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ cycl() }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. - */ - public function testUnknownFunctionWithoutSuggestions() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ foobar() }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? - */ - public function testUnknownFilter() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ 1|lowe }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. - */ - public function testUnknownFilterWithoutSuggestions() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ 1|foobar }}', 'index'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 - */ - public function testUnknownTest() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - $stream = $env->tokenize(new Twig_Source('{{ 1 is nul }}', 'index')); - $parser->parse($stream); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. - */ - public function testUnknownTestWithoutSuggestions() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - $parser = new Twig_Parser($env); - - $parser->parse($env->tokenize(new Twig_Source('{{ 1 is foobar }}', 'index'))); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php deleted file mode 100644 index 9a4d6d1..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php +++ /dev/null @@ -1,347 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock()); - - for ($i = 0; $i < 100; ++$i) { - $this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type - } - } - - public function getRandomFunctionTestData() - { - return array( - array(// array - array('apple', 'orange', 'citrus'), - array('apple', 'orange', 'citrus'), - ), - array(// Traversable - new ArrayObject(array('apple', 'orange', 'citrus')), - array('apple', 'orange', 'citrus'), - ), - array(// unicode string - 'Ä€é', - array('Ä', '€', 'é'), - ), - array(// numeric but string - '123', - array('1', '2', '3'), - ), - array(// integer - 5, - range(0, 5, 1), - ), - array(// float - 5.9, - range(0, 5, 1), - ), - array(// negative - -2, - array(0, -1, -2), - ), - ); - } - - public function testRandomFunctionWithoutParameter() - { - $max = mt_getrandmax(); - - for ($i = 0; $i < 100; ++$i) { - $val = twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); - } - } - - public function testRandomFunctionReturnsAsIs() - { - $this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), '')); - $this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('charset' => null)), '')); - - $instance = new stdClass(); - $this->assertSame($instance, twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $instance)); - } - - /** - * @expectedException Twig_Error_Runtime - */ - public function testRandomFunctionOfEmptyArrayThrowsException() - { - twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), array()); - } - - public function testRandomFunctionOnNonUTF8String() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->setCharset('ISO-8859-1'); - - $text = iconv('UTF-8', 'ISO-8859-1', 'Äé'); - for ($i = 0; $i < 30; ++$i) { - $rand = twig_random($twig, $text); - $this->assertTrue(in_array(iconv('ISO-8859-1', 'UTF-8', $rand), array('Ä', 'é'), true)); - } - } - - public function testReverseFilterOnNonUTF8String() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->setCharset('ISO-8859-1'); - - $input = iconv('UTF-8', 'ISO-8859-1', 'Äé'); - $output = iconv('ISO-8859-1', 'UTF-8', twig_reverse_filter($twig, $input)); - - $this->assertEquals($output, 'éÄ'); - } - - /** - * @dataProvider provideCustomEscaperCases - */ - public function testCustomEscaper($expected, $string, $strategy) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->getExtension('Twig_Extension_Core')->setEscaper('foo', 'foo_escaper_for_test'); - - $this->assertSame($expected, twig_escape_filter($twig, $string, $strategy)); - } - - public function provideCustomEscaperCases() - { - return array( - array('fooUTF-8', 'foo', 'foo'), - array('UTF-8', null, 'foo'), - array('42UTF-8', 42, 'foo'), - ); - } - - /** - * @expectedException Twig_Error_Runtime - */ - public function testUnknownCustomEscaper() - { - twig_escape_filter(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), 'foo', 'bar'); - } - - /** - * @dataProvider provideTwigFirstCases - */ - public function testTwigFirst($expected, $input) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $this->assertSame($expected, twig_first($twig, $input)); - } - - public function provideTwigFirstCases() - { - $i = array(1 => 'a', 2 => 'b', 3 => 'c'); - - return array( - array('a', 'abc'), - array(1, array(1, 2, 3)), - array('', null), - array('', ''), - array('a', new CoreTestIterator($i, array_keys($i), true, 3)), - ); - } - - /** - * @dataProvider provideTwigLastCases - */ - public function testTwigLast($expected, $input) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $this->assertSame($expected, twig_last($twig, $input)); - } - - public function provideTwigLastCases() - { - $i = array(1 => 'a', 2 => 'b', 3 => 'c'); - - return array( - array('c', 'abc'), - array(3, array(1, 2, 3)), - array('', null), - array('', ''), - array('c', new CoreTestIterator($i, array_keys($i), true)), - ); - } - - /** - * @dataProvider provideArrayKeyCases - */ - public function testArrayKeysFilter(array $expected, $input) - { - $this->assertSame($expected, twig_get_array_keys_filter($input)); - } - - public function provideArrayKeyCases() - { - $array = array('a' => 'a1', 'b' => 'b1', 'c' => 'c1'); - $keys = array_keys($array); - - return array( - array($keys, $array), - array($keys, new CoreTestIterator($array, $keys)), - array($keys, new CoreTestIteratorAggregate($array, $keys)), - array($keys, new CoreTestIteratorAggregateAggregate($array, $keys)), - array(array(), null), - array(array('a'), new SimpleXMLElement('')), - ); - } - - /** - * @dataProvider provideInFilterCases - */ - public function testInFilter($expected, $value, $compare) - { - $this->assertSame($expected, twig_in_filter($value, $compare)); - } - - public function provideInFilterCases() - { - $array = array(1, 2, 'a' => 3, 5, 6, 7); - $keys = array_keys($array); - - return array( - array(true, 1, $array), - array(true, '3', $array), - array(true, '3', 'abc3def'), - array(true, 1, new CoreTestIterator($array, $keys, true, 1)), - array(true, '3', new CoreTestIterator($array, $keys, true, 3)), - array(true, '3', new CoreTestIteratorAggregateAggregate($array, $keys, true, 3)), - array(false, 4, $array), - array(false, 4, new CoreTestIterator($array, $keys, true)), - array(false, 4, new CoreTestIteratorAggregateAggregate($array, $keys, true)), - array(false, 1, 1), - array(true, 'b', new SimpleXMLElement('b')), - ); - } - - /** - * @dataProvider provideSliceFilterCases - */ - public function testSliceFilter($expected, $input, $start, $length = null, $preserveKeys = false) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $this->assertSame($expected, twig_slice($twig, $input, $start, $length, $preserveKeys)); - } - - public function provideSliceFilterCases() - { - $i = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4); - $keys = array_keys($i); - - return array( - array(array('a' => 1), $i, 0, 1, true), - array(array('a' => 1), $i, 0, 1, false), - array(array('b' => 2, 'c' => 3), $i, 1, 2), - array(array(1), array(1, 2, 3, 4), 0, 1), - array(array(2, 3), array(1, 2, 3, 4), 1, 2), - array(array(2, 3), new CoreTestIterator($i, $keys, true), 1, 2), - array(array('c' => 3, 'd' => 4), new CoreTestIteratorAggregate($i, $keys, true), 2, null, true), - array($i, new CoreTestIterator($i, $keys, true), 0, count($keys) + 10, true), - array(array(), new CoreTestIterator($i, $keys, true), count($keys) + 10), - array('de', 'abcdef', 3, 2), - array(array(), new SimpleXMLElement('12'), 3), - array(array(), new ArrayIterator(array(1, 2)), 3), - ); - } -} - -function foo_escaper_for_test(Twig_Environment $env, $string, $charset) -{ - return $string.$charset; -} - -final class CoreTestIteratorAggregate implements IteratorAggregate -{ - private $iterator; - - public function __construct(array $array, array $keys, $allowAccess = false, $maxPosition = false) - { - $this->iterator = new CoreTestIterator($array, $keys, $allowAccess, $maxPosition); - } - - public function getIterator() - { - return $this->iterator; - } -} - -final class CoreTestIteratorAggregateAggregate implements IteratorAggregate -{ - private $iterator; - - public function __construct(array $array, array $keys, $allowValueAccess = false, $maxPosition = false) - { - $this->iterator = new CoreTestIteratorAggregate($array, $keys, $allowValueAccess, $maxPosition); - } - - public function getIterator() - { - return $this->iterator; - } -} - -final class CoreTestIterator implements Iterator -{ - private $position; - private $array; - private $arrayKeys; - private $allowValueAccess; - private $maxPosition; - - public function __construct(array $values, array $keys, $allowValueAccess = false, $maxPosition = false) - { - $this->array = $values; - $this->arrayKeys = $keys; - $this->position = 0; - $this->allowValueAccess = $allowValueAccess; - $this->maxPosition = false === $maxPosition ? count($values) + 1 : $maxPosition; - } - - public function rewind() - { - $this->position = 0; - } - - public function current() - { - if ($this->allowValueAccess) { - return $this->array[$this->key()]; - } - - throw new LogicException('Code should only use the keys, not the values provided by iterator.'); - } - - public function key() - { - return $this->arrayKeys[$this->position]; - } - - public function next() - { - ++$this->position; - if ($this->position === $this->maxPosition) { - throw new LogicException(sprintf('Code should not iterate beyond %d.', $this->maxPosition)); - } - } - - public function valid() - { - return isset($this->arrayKeys[$this->position]); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php deleted file mode 100644 index 122afc4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php +++ /dev/null @@ -1,303 +0,0 @@ - 'Fabien', - 'obj' => new FooObject(), - 'arr' => array('obj' => new FooObject()), - ); - - self::$templates = array( - '1_basic1' => '{{ obj.foo }}', - '1_basic2' => '{{ name|upper }}', - '1_basic3' => '{% if name %}foo{% endif %}', - '1_basic4' => '{{ obj.bar }}', - '1_basic5' => '{{ obj }}', - '1_basic6' => '{{ arr.obj }}', - '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', - '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', - '1_basic9' => '{{ obj.foobar }}{{ obj.fooBar }}', - '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - '1_layout' => '{% block content %}{% endblock %}', - '1_child' => "{% extends \"1_layout\" %}\n{% block content %}\n{{ \"a\"|json_encode }}\n{% endblock %}", - '1_include' => '{{ include("1_basic1", sandboxed=true) }}', - ); - } - - /** - * @expectedException Twig_Sandbox_SecurityError - * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. - */ - public function testSandboxWithInheritance() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); - $twig->loadTemplate('1_child')->render(array()); - } - - public function testSandboxGloballySet() - { - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); - } - - public function testSandboxUnallowedMethodAccessor() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic1')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); - $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); - $this->assertEquals('foo', $e->getMethodName(), 'Exception should be raised on the "foo" method'); - } - } - - public function testSandboxUnallowedFilter() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic2')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFilterError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFilterError'); - $this->assertEquals('upper', $e->getFilterName(), 'Exception should be raised on the "upper" filter'); - } - } - - public function testSandboxUnallowedTag() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic3')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); - $this->assertEquals('if', $e->getTagName(), 'Exception should be raised on the "if" tag'); - } - } - - public function testSandboxUnallowedProperty() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic4')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedPropertyError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedPropertyError'); - $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); - $this->assertEquals('bar', $e->getPropertyName(), 'Exception should be raised on the "bar" property'); - } - } - - public function testSandboxUnallowedToString() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic5')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); - $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); - $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method'); - } - } - - public function testSandboxUnallowedToStringArray() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic6')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError'); - $this->assertEquals('FooObject', $e->getClassName(), 'Exception should be raised on the "FooObject" class'); - $this->assertEquals('__tostring', $e->getMethodName(), 'Exception should be raised on the "__toString" method'); - } - } - - public function testSandboxUnallowedFunction() - { - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('1_basic7')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError'); - $this->assertEquals('cycle', $e->getFunctionName(), 'Exception should be raised on the "cycle" function'); - } - } - - public function testSandboxAllowMethodFoo() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); - $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); - } - - public function testSandboxAllowMethodToString() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods'); - $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); - } - - public function testSandboxAllowMethodToStringDisabled() - { - $twig = $this->getEnvironment(false, array(), self::$templates); - FooObject::reset(); - $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled'); - $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); - } - - public function testSandboxAllowFilter() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper')); - $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters'); - } - - public function testSandboxAllowTag() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); - $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); - } - - public function testSandboxAllowProperty() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); - } - - public function testSandboxAllowFunction() - { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); - $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); - } - - public function testSandboxAllowFunctionsCaseInsensitive() - { - foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { - $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); - FooObject::reset(); - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); - $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); - - $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic9')->render(self::$params), 'Sandbox allow methods via shortcut names (ie. without get/set)'); - } - } - - public function testSandboxLocallySetForAnInclude() - { - self::$templates = array( - '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', - '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); - - $twig = $this->getEnvironment(false, array(), self::$templates); - $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); - - self::$templates = array( - '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', - '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', - ); - - $twig = $this->getEnvironment(true, array(), self::$templates); - try { - $twig->loadTemplate('3_basic')->render(self::$params); - $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); - } catch (Twig_Sandbox_SecurityError $e) { - $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedTagError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedTagError'); - $this->assertEquals('sandbox', $e->getTagName()); - } - } - - public function testMacrosInASandbox() - { - $twig = $this->getEnvironment(true, array('autoescape' => 'html'), array('index' => <<{{ text }}

    {% endmacro %} - -{{- macros.test('username') }} -EOF - ), array('macro', 'import'), array('escape')); - - $this->assertEquals('

    username

    ', $twig->loadTemplate('index')->render(array())); - } - - public function testSandboxDisabledAfterIncludeFunctionError() - { - $twig = $this->getEnvironment(false, array(), self::$templates); - - $e = null; - try { - $twig->loadTemplate('1_include')->render(self::$params); - } catch (Throwable $e) { - } - if ($e === null) { - $this->fail('An exception should be thrown for this test to be valid.'); - } - - $this->assertFalse($twig->getExtension('Twig_Extension_Sandbox')->isSandboxed(), 'Sandboxed include() function call should not leave Sandbox enabled when an error occurs.'); - } - - protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) - { - $loader = new Twig_Loader_Array($templates); - $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); - $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); - $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); - - return $twig; - } -} - -class FooObject -{ - public static $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); - - public $bar = 'bar'; - - public static function reset() - { - self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); - } - - public function __toString() - { - ++self::$called['__toString']; - - return 'foo'; - } - - public function foo() - { - ++self::$called['foo']; - - return 'foo'; - } - - public function getFooBar() - { - ++self::$called['getFooBar']; - - return 'foobar'; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php b/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php deleted file mode 100644 index f97d306..0000000 --- a/vendor/twig/twig/test/Twig/Tests/FactoryRuntimeLoaderTest.php +++ /dev/null @@ -1,32 +0,0 @@ - 'getRuntime')); - - $this->assertInstanceOf('stdClass', $loader->load('stdClass')); - } - - public function testLoadReturnsNullForUnmappedRuntime() - { - $loader = new Twig_FactoryRuntimeLoader(); - - $this->assertNull($loader->load('stdClass')); - } -} - -function getRuntime() -{ - return new stdClass(); -} diff --git a/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php b/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php deleted file mode 100644 index a983a47..0000000 --- a/vendor/twig/twig/test/Twig/Tests/FileExtensionEscapingStrategyTest.php +++ /dev/null @@ -1,51 +0,0 @@ -assertSame($strategy, Twig_FileExtensionEscapingStrategy::guess($filename)); - } - - public function getGuessData() - { - return array( - // default - array('html', 'foo.html'), - array('html', 'foo.html.twig'), - array('html', 'foo'), - array('html', 'foo.bar.twig'), - array('html', 'foo.txt/foo'), - array('html', 'foo.txt/foo.js/'), - - // css - array('css', 'foo.css'), - array('css', 'foo.css.twig'), - array('css', 'foo.twig.css'), - array('css', 'foo.js.css'), - array('css', 'foo.js.css.twig'), - - // js - array('js', 'foo.js'), - array('js', 'foo.js.twig'), - array('js', 'foo.txt/foo.js'), - array('js', 'foo.txt.twig/foo.js'), - - // txt - array(false, 'foo.txt'), - array(false, 'foo.txt.twig'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php b/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php deleted file mode 100644 index d9c782f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/FilesystemHelper.php +++ /dev/null @@ -1,26 +0,0 @@ - $fileInfo) { - if ($fileInfo->isDir()) { - rmdir($filename); - } else { - unlink($filename); - } - } - rmdir($dir); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test deleted file mode 100644 index 1290973..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -blocks and autoescape ---TEMPLATE-- -{{ include('unrelated.txt.twig') -}} -{{ include('template.html.twig') -}} ---TEMPLATE(unrelated.txt.twig)-- -{% block content %}{% endblock %} ---TEMPLATE(template.html.twig)-- -{% extends 'parent.html.twig' %} -{% block content %} -{{ br -}} -{% endblock %} ---TEMPLATE(parent.html.twig)-- -{% set _content = block('content')|raw %} -{{ _content|raw }} ---DATA-- -return array('br' => '
    ') ---CONFIG-- -return array('autoescape' => 'name') ---EXPECT-- -<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test deleted file mode 100644 index 04299be..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/autoescape/name.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"name" autoescape strategy ---TEMPLATE-- -{{ br -}} -{{ include('index.js.twig') -}} -{{ include('index.html.twig') -}} -{{ include('index.txt.twig') -}} ---TEMPLATE(index.js.twig)-- -{{ br -}} ---TEMPLATE(index.html.twig)-- -{{ br -}} ---TEMPLATE(index.txt.twig)-- -{{ br -}} ---DATA-- -return array('br' => '
    ') ---CONFIG-- -return array('autoescape' => 'name') ---EXPECT-- -<br /> -\x3Cbr\x20\x2F\x3E -<br /> -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html deleted file mode 100644 index cb0dbe4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html +++ /dev/null @@ -1 +0,0 @@ -{% block content %}{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html deleted file mode 100644 index df57c82..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'base.html' %} -{% block content %} - {{ foo.bar }} -{% endblock %} -{% block foo %} - {{ foo.bar }} -{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test deleted file mode 100644 index a3f0b50..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/child_contents_outside_blocks.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Exception for child templates defining contents outside blocks defined by parent ---TEMPLATE-- -{% extends 'base.twig' %} - -Content outside a block. - -{% block sidebar %} - Content inside a block. -{% endblock %} ---TEMPLATE(base.twig)-- -{% block sidebar %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: A template that extends another one cannot include contents outside Twig blocks. Did you forget to put the contents inside a {% block %} tag in "index.twig" at line 3? diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test deleted file mode 100644 index 7ff2eed..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Exception for multiline array with undefined variable ---TEMPLATE-- -{% set foo = { - foo: 'foo', - bar: 'bar', - - - foobar: foobar, - - - - foo2: foo2, -} %} ---DATA-- -return array('foobar' => 'foobar') ---EXCEPTION-- -Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test deleted file mode 100644 index c425069..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_array_with_undefined_variable_again.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Exception for multiline array with undefined variable ---TEMPLATE-- -{% set foo = { - foo: 'foo', - bar: 'bar', - - - foobar: foobar, - - - - foo2: foo2, -} %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test deleted file mode 100644 index 2f94a5e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_undefined_variable.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Exception for multile function with undefined variable ---TEMPLATE-- -{{ include('foo', - with_context=with_context -) }} ---TEMPLATE(foo)-- -Foo ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test deleted file mode 100644 index 64761fc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_function_with_unknown_argument.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -Exception for multiline function with unknown argument ---TEMPLATE-- -{{ include('foo', - with_context=True, - invalid=False -) }} ---EXCEPTION-- -Twig_Error_Syntax: Unknown argument "invalid" for function "include(template, variables, with_context, ignore_missing, sandboxed)" in "index.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test deleted file mode 100644 index 7b3b1da..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/multiline_tag_with_undefined_variable.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Exception for multiline tag with undefined variable ---TEMPLATE-- -{% include 'foo' - with vars -%} ---TEMPLATE(foo)-- -Foo ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test deleted file mode 100644 index 9ca418b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/syntax_error_in_reused_template.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Exception for syntax error in reused template ---TEMPLATE-- -{% use 'foo.twig' %} ---TEMPLATE(foo.twig)-- -{% block bar %} - {% do node.data = 5 %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "=" ("end of statement block" expected) in "foo.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test deleted file mode 100644 index 2c35ad5..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Exception for an unclosed tag ---TEMPLATE-- -{% block foo %} - {% if foo %} - - - - - {% for i in fo %} - - - - {% endfor %} - - - -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Unexpected "endblock" tag (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test deleted file mode 100644 index c8e7a09..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_parent.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Exception for an undefined parent ---TEMPLATE-- -{% extends 'foo.html' %} - -{% set foo = "foo" %} ---EXCEPTION-- -Twig_Error_Loader: Template "foo.html" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test deleted file mode 100644 index 1992510..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_template_in_child_template.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Exception for an undefined template in a child template ---TEMPLATE-- -{% extends 'base.twig' %} - -{% block sidebar %} - {{ include('include.twig') }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block sidebar %} -{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test deleted file mode 100644 index 6679fbe..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/undefined_trait.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -Exception for an undefined trait ---TEMPLATE-- -{% use 'foo' with foobar as bar %} ---TEMPLATE(foo)-- -{% block bar %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Runtime: Block "foobar" is not defined in trait "foo" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test deleted file mode 100644 index 32fed8f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/_self.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -_self returns the template name ---TEMPLATE-- -{{ _self }} ---DATA-- -return array() ---EXPECT-- -index.twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test deleted file mode 100644 index c69b119..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Twig supports array notation ---TEMPLATE-- -{# empty array #} -{{ []|join(',') }} - -{{ [1, 2]|join(',') }} -{{ ['foo', "bar"]|join(',') }} -{{ {0: 1, 'foo': 'bar'}|join(',') }} -{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} - -{{ {0: 1, foo: 'bar'}|join(',') }} -{{ {0: 1, foo: 'bar'}|keys|join(',') }} - -{# nested arrays #} -{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} -{{ a[2]|join(',') }} -{{ a[3]["foo"]|join(',') }} - -{# works even if [] is used inside the array #} -{{ [foo[bar]]|join(',') }} - -{# elements can be any expression #} -{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} - -{# arrays can have a trailing , like in PHP #} -{{ - [ - 1, - 2, - ]|join(',') -}} - -{# keys can be any expression #} -{% set a = 1 %} -{% set b = "foo" %} -{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} -{{ ary|keys|join(',') }} -{{ ary|join(',') }} ---DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) ---EXPECT-- -1,2 -foo,bar -1,bar -0,foo - -1,bar -0,foo - -1,2 -bar - -bar - -FOO,BAR, - -1,2 - -1,foo,c,1foo -a,b,c,d diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test deleted file mode 100644 index f3df328..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports method calls ---TEMPLATE-- -{{ items.foo }} -{{ items['foo'] }} -{{ items[foo] }} -{{ items[items[foo]] }} ---DATA-- -return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) ---EXPECT-- -bar -bar -foo -bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test deleted file mode 100644 index f5e6845..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Twig supports binary operations (+, -, *, /, ~, %, and, or) ---TEMPLATE-- -{{ 1 + 1 }} -{{ 2 - 1 }} -{{ 2 * 2 }} -{{ 2 / 2 }} -{{ 3 % 2 }} -{{ 1 and 1 }} -{{ 1 and 0 }} -{{ 0 and 1 }} -{{ 0 and 0 }} -{{ 1 or 1 }} -{{ 1 or 0 }} -{{ 0 or 1 }} -{{ 0 or 0 }} -{{ 0 or 1 and 0 }} -{{ 1 or 0 and 1 }} -{{ "foo" ~ "bar" }} -{{ foo ~ "bar" }} -{{ "foo" ~ bar }} -{{ foo ~ bar }} -{{ 20 // 7 }} ---DATA-- -return array('foo' => 'bar', 'bar' => 'foo') ---EXPECT-- -2 -1 -4 -1 -1 -1 - - - -1 -1 -1 - - -1 -foobar -barbar -foofoo -barfoo -2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test deleted file mode 100644 index 74fe6ca..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports bitwise operations ---TEMPLATE-- -{{ 1 b-and 5 }} -{{ 1 b-or 5 }} -{{ 1 b-xor 5 }} -{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }} ---DATA-- -return array() ---EXPECT-- -1 -5 -4 -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test deleted file mode 100644 index 726b850..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig supports comparison operators (==, !=, <, >, >=, <=) ---TEMPLATE-- -{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} -{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} -{{ 1 == 1 }}/{{ 1 == 2 }} -{{ 1 != 1 }}/{{ 1 != 2 }} ---DATA-- -return array() ---EXPECT-- -///1 -1//1/1 -1/ -/1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test deleted file mode 100644 index 238dd27..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/divisibleby.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Twig supports the "divisible by" operator ---TEMPLATE-- -{{ 8 is divisible by(2) ? 'OK' }} -{{ 8 is not divisible by(3) ? 'OK' }} -{{ 8 is divisible by (2) ? 'OK' }} -{{ 8 is not - divisible - by - (3) ? 'OK' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test deleted file mode 100644 index 9cd0676..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Twig supports the .. operator ---TEMPLATE-- -{% for i in 0..10 %}{{ i }} {% endfor %} - -{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} - -{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} - -{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} - -{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} ---DATA-- -return array('foo' => array(1, 10)) ---EXPECT-- -0 1 2 3 4 5 6 7 8 9 10 -a b c d e f g h i j k l m n o p q r s t u v w x y z -A B C D E F G H I J K L M N O P Q R S T U V W X Y Z -1 2 3 4 5 6 7 8 9 10 -1 2 3 4 5 6 7 8 9 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test deleted file mode 100644 index 9ad5e5e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ends_with.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Twig supports the "ends with" operator ---TEMPLATE-- -{{ 'foo' ends with 'o' ? 'OK' : 'KO' }} -{{ not ('foo' ends with 'f') ? 'OK' : 'KO' }} -{{ not ('foo' ends with 'foowaytoolong') ? 'OK' : 'KO' }} -{{ 'foo' ends with '' ? 'OK' : 'KO' }} -{{ '1' ends with true ? 'OK' : 'KO' }} -{{ 1 ends with true ? 'OK' : 'KO' }} -{{ 0 ends with false ? 'OK' : 'KO' }} -{{ '' ends with false ? 'OK' : 'KO' }} -{{ false ends with false ? 'OK' : 'KO' }} -{{ false ends with '' ? 'OK' : 'KO' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK -KO -KO -KO -KO -KO -KO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test deleted file mode 100644 index 79f8e0b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig supports grouping of expressions ---TEMPLATE-- -{{ (2 + 2) / 2 }} ---DATA-- -return array() ---EXPECT-- -2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test deleted file mode 100644 index 7ae3bae..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig supports literals ---TEMPLATE-- -1 {{ true }} -2 {{ TRUE }} -3 {{ false }} -4 {{ FALSE }} -5 {{ none }} -6 {{ NONE }} -7 {{ null }} -8 {{ NULL }} ---DATA-- -return array() ---EXPECT-- -1 1 -2 1 -3 -4 -5 -6 -7 -8 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test deleted file mode 100644 index 1a27a2d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Twig supports __call() for attributes ---TEMPLATE-- -{{ foo.foo }} -{{ foo.bar }} ---DATA-- -class TestClassForMagicCallAttributes -{ - public function getBar() - { - return 'bar_from_getbar'; - } - - public function __call($method, $arguments) - { - if ('foo' === $method) { - return 'foo_from_call'; - } - - return false; - } -} - -return array('foo' => new TestClassForMagicCallAttributes()) ---EXPECT-- -foo_from_call -bar_from_getbar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test deleted file mode 100644 index b6c7716..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/matches.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Twig supports the "matches" operator ---TEMPLATE-- -{{ 'foo' matches '/o/' ? 'OK' : 'KO' }} -{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }} -{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test deleted file mode 100644 index 5f801e6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Twig supports method calls ---TEMPLATE-- -{{ items.foo.foo }} -{{ items.foo.getFoo() }} -{{ items.foo.bar }} -{{ items.foo['bar'] }} -{{ items.foo.bar('a', 43) }} -{{ items.foo.bar(foo) }} -{{ items.foo.self.foo() }} -{{ items.foo.is }} -{{ items.foo.in }} -{{ items.foo.not }} ---DATA-- -return array('foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo')) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -foo -foo -bar - -bar_a-43 -bar_bar -foo -is -in -not diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test deleted file mode 100644 index 1853b1b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/negative_numbers.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Twig manages negative numbers correctly ---TEMPLATE-- -{{ -1 }} -{{ - 1 }} -{{ 5 - 1 }} -{{ 5-1 }} -{{ 5 + -1 }} -{{ 5 + - 1 }} ---DATA-- -return array() ---EXPECT-- --1 --1 -4 -4 -4 -4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test deleted file mode 100644 index fe29d08..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/operators_as_variables.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Twig allows to use named operators as variable names ---TEMPLATE-- -{% for match in matches %} - {{- match }} -{% endfor %} -{{ in }} -{{ is }} ---DATA-- -return array('matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is') ---EXPECT-- -1 -2 -3 -in -is diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test deleted file mode 100644 index 542c350..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig parses postfix expressions ---TEMPLATE-- -{% import _self as macros %} - -{% macro foo() %}foo{% endmacro %} - -{{ 'a' }} -{{ 'a'|upper }} -{{ ('a')|upper }} -{{ -1|upper }} -{{ macros.foo() }} -{{ (macros).foo() }} ---DATA-- -return array(); ---EXPECT-- -a -A -A --1 -foo -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test deleted file mode 100644 index eacc98f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Twig parses power expressions ---TEMPLATE-- -{{ 2**3 }} -{{ (-2)**3 }} -{{ (-2)**(-3) }} -{{ a ** a }} -{{ a ** b }} -{{ b ** a }} -{{ b ** b }} ---DATA-- -return array('a' => 4, 'b' => -2); ---EXPECT-- -8 --8 --0.125 -256 -0.0625 -16 -0.25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test deleted file mode 100644 index 601201d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/sameas.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Twig supports the "same as" operator ---TEMPLATE-- -{{ 1 is same as(1) ? 'OK' }} -{{ 1 is not same as(true) ? 'OK' }} -{{ 1 is same as(1) ? 'OK' }} -{{ 1 is not same as(true) ? 'OK' }} -{{ 1 is same as (1) ? 'OK' }} -{{ 1 is not - same - as - (true) ? 'OK' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK -OK -OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test deleted file mode 100644 index 75d331e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/starts_with.test +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Twig supports the "starts with" operator ---TEMPLATE-- -{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} -{{ not ('foo' starts with 'oo') ? 'OK' : 'KO' }} -{{ not ('foo' starts with 'foowaytoolong') ? 'OK' : 'KO' }} -{{ 'foo' starts with 'f' ? 'OK' : 'KO' }} -{{ 'foo' starts -with 'f' ? 'OK' : 'KO' }} -{{ 'foo' starts with '' ? 'OK' : 'KO' }} -{{ '1' starts with true ? 'OK' : 'KO' }} -{{ '' starts with false ? 'OK' : 'KO' }} -{{ 'a' starts with false ? 'OK' : 'KO' }} -{{ false starts with '' ? 'OK' : 'KO' }} ---DATA-- -return array() ---EXPECT-- -OK -OK -OK -OK -OK -OK -KO -KO -KO -KO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test deleted file mode 100644 index a911661..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports string interpolation ---TEMPLATE-- -{{ "foo #{"foo #{bar} baz"} baz" }} -{{ "foo #{bar}#{bar} baz" }} ---DATA-- -return array('bar' => 'BAR'); ---EXPECT-- -foo foo BAR baz baz -foo BARBAR baz diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test deleted file mode 100644 index 0e6fa96..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 1 ? 'YES' : 'NO' }} -{{ 0 ? 'YES' : 'NO' }} -{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} -{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} -{{ 1 == 1 ? 'foo
    ':'' }} -{{ foo ~ (bar ? ('-' ~ bar) : '') }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---EXPECT-- -YES -NO -YES1 -NO1 -foo
    -foo-bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test deleted file mode 100644 index fdc660f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_noelse.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 1 ? 'YES' }} -{{ 0 ? 'YES' }} ---DATA-- -return array() ---EXPECT-- -YES - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test deleted file mode 100644 index 9057e83..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator_nothen.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig supports the ternary operator ---TEMPLATE-- -{{ 'YES' ?: 'NO' }} -{{ 0 ?: 'NO' }} ---DATA-- -return array() ---EXPECT-- -YES -NO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test deleted file mode 100644 index 0eaabb4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/two_word_operators_as_variables.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig does not allow to use two-word named operators as variable names ---TEMPLATE-- -{{ starts with }} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: Unexpected token "operator" of value "starts with" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test deleted file mode 100644 index b79219a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Twig supports unary operators (not, -, +) ---TEMPLATE-- -{{ not 1 }}/{{ not 0 }} -{{ +1 + 1 }}/{{ -1 - 1 }} -{{ not (false or true) }} ---DATA-- -return array() ---EXPECT-- -/1 -2/-2 - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test deleted file mode 100644 index ad84a9c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_macro_arguments.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Twig manages negative numbers as default parameters ---TEMPLATE-- -{% import _self as macros %} -{{ macros.negative_number1() }} -{{ macros.negative_number2() }} -{{ macros.negative_number3() }} -{{ macros.positive_number1() }} -{{ macros.positive_number2() }} -{% macro negative_number1(nb=-1) %}{{ nb }}{% endmacro %} -{% macro negative_number2(nb = --1) %}{{ nb }}{% endmacro %} -{% macro negative_number3(nb = - 1) %}{{ nb }}{% endmacro %} -{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %} -{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- --1 -1 --1 -1 -1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test deleted file mode 100644 index cc6eef8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Twig unary operators precedence ---TEMPLATE-- -{{ -1 - 1 }} -{{ -1 - -1 }} -{{ -1 * -1 }} -{{ 4 / -1 * 5 }} ---DATA-- -return array() ---EXPECT-- --2 -0 -1 --20 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/extensions/anonymous_functions.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/extensions/anonymous_functions.test deleted file mode 100644 index 842ecf7..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/extensions/anonymous_functions.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -use an anonymous function as a function ---TEMPLATE-- -{{ anon_foo('bar') }} -{{ 'bar'|anon_foo }} ---DATA-- -return array() ---EXPECT-- -*bar* -*bar* diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test deleted file mode 100644 index 27e93fd..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -"abs" filter ---TEMPLATE-- -{{ (-5.5)|abs }} -{{ (-5)|abs }} -{{ (-0)|abs }} -{{ 0|abs }} -{{ 5|abs }} -{{ 5.5|abs }} -{{ number1|abs }} -{{ number2|abs }} -{{ number3|abs }} -{{ number4|abs }} -{{ number5|abs }} -{{ number6|abs }} ---DATA-- -return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) ---EXPECT-- -5.5 -5 -0 -0 -5 -5.5 -5.5 -5 -0 -0 -5 -5.5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test deleted file mode 100644 index cb6de7f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch.test +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- -{% for row in items|batch(3) %} -
    - {% for column in row %} -
    {{ column }}
    - {% endfor %} -
    -{% endfor %} ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- -
    -
    a
    -
    b
    -
    c
    -
    -
    -
    d
    -
    e
    -
    f
    -
    -
    -
    g
    -
    h
    -
    i
    -
    -
    -
    j
    -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test deleted file mode 100644 index e2ec4be..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_float.test +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- -{% for row in items|batch(3.1) %} -
    - {% for column in row %} -
    {{ column }}
    - {% endfor %} -
    -{% endfor %} ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- -
    -
    a
    -
    b
    -
    c
    -
    d
    -
    -
    -
    e
    -
    f
    -
    g
    -
    h
    -
    -
    -
    i
    -
    j
    -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test deleted file mode 100644 index af996f2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_empty_fill.test +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- - -{% for row in items|batch(3, '') %} - - {% for column in row %} - - {% endfor %} - -{% endfor %} -
    {{ column }}
    ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- - - - - - - - - - - - - - - - - - - - - - -
    abc
    def
    ghi
    j
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test deleted file mode 100644 index 72483f4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_exact_elements.test +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- -{% for row in items|batch(3, 'fill') %} -
    - {% for column in row %} -
    {{ column }}
    - {% endfor %} -
    -{% endfor %} ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l')) ---EXPECT-- -
    -
    a
    -
    b
    -
    c
    -
    -
    -
    d
    -
    e
    -
    f
    -
    -
    -
    g
    -
    h
    -
    i
    -
    -
    -
    j
    -
    k
    -
    l
    -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test deleted file mode 100644 index 746295f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_fill.test +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -"batch" filter ---TEMPLATE-- - -{% for row in items|batch(3, 'fill') %} - - {% for column in row %} - - {% endfor %} - -{% endfor %} -
    {{ column }}
    ---DATA-- -return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')) ---EXPECT-- - - - - - - - - - - - - - - - - - - - - - -
    abc
    def
    ghi
    jfillfill
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test deleted file mode 100644 index 6015380..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_keys.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"batch" filter preserves array keys ---TEMPLATE-- -{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }} -{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }} ---DATA-- -return array() ---EXPECT-- -foo,key -foo,key,0,1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test deleted file mode 100644 index b9c058d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/batch_with_zero_elements.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"batch" filter with zero elements ---TEMPLATE-- -{{ []|batch(3)|length }} -{{ []|batch(3, 'fill')|length }} ---DATA-- -return array() ---EXPECT-- -0 -0 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test deleted file mode 100644 index b386d4e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"convert_encoding" filter ---TEMPLATE-- -{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} ---DATA-- -return array() ---EXPECT-- -愛していますか? diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test deleted file mode 100644 index d17e5e2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} -{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} -{{ date1|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} -{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} -{{ date1|date('e') }} -{{ date1|date('d/m/Y H:i:s') }} - -{{ date2|date }} -{{ date2|date('d/m/Y') }} -{{ date2|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} -{{ date2|date('d/m/Y H:i:s', timezone1) }} -{{ date2|date('d/m/Y H:i:s') }} - -{{ date3|date }} -{{ date3|date('d/m/Y') }} - -{{ date4|date }} -{{ date4|date('d/m/Y') }} - -{{ date5|date }} -{{ date5|date('d/m/Y') }} - -{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} -{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} -{{ date6|date('d/m/Y H:i:s P', false) }} -{{ date6|date('e', 'Europe/Paris') }} -{{ date6|date('e', false) }} - -{{ date7|date }} -{{ date7|date(timezone='Europe/Paris') }} -{{ date7|date(timezone='Asia/Hong_Kong') }} -{{ date7|date(timezone=false) }} -{{ date7|date(timezone='Indian/Mauritius') }} - -{{ '2010-01-28 15:00:00'|date(timezone="Europe/Paris") }} -{{ '2010-01-28 15:00:00'|date(timezone="Asia/Hong_Kong") }} ---DATA-- -date_default_timezone_set('Europe/Paris'); -return array( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), - 'date3' => '2010-10-04 13:45', - 'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT - 'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(), - 'date6' => new DateTime('2010-10-04 13:45', new DateTimeZone('America/New_York')), - 'date7' => '2010-01-28T15:00:00+04:00', - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -October 4, 2010 13:45 -04/10/2010 -04/10/2010 19:45:00 -04/10/2010 19:45:00 +08:00 -04/10/2010 06:45:00 -05:00 -Europe/Paris -04/10/2010 13:45:00 - -October 4, 2010 13:45 -04/10/2010 -04/10/2010 19:45:00 -04/10/2010 07:45:00 -04/10/2010 13:45:00 - -October 4, 2010 13:45 -04/10/2010 - -October 4, 2010 15:45 -04/10/2010 - -January 2, 1964 04:04 -02/01/1964 - -04/10/2010 19:45:00 +02:00 -05/10/2010 01:45:00 +08:00 -04/10/2010 13:45:00 -04:00 -Europe/Paris -America/New_York - -January 28, 2010 12:00 -January 28, 2010 12:00 -January 28, 2010 19:00 -January 28, 2010 15:00 -January 28, 2010 15:00 - -January 28, 2010 15:00 -January 28, 2010 22:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test deleted file mode 100644 index 6ad504c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} ---DATA-- -date_default_timezone_set('UTC'); -$twig->getExtension('Twig_Extension_Core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), -) ---EXPECT-- -2010-10-04 -04/10/2010 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test deleted file mode 100644 index 627ce56..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"date" filter (interval support) ---TEMPLATE-- -{{ date2|date }} -{{ date2|date('%d days') }} ---DATA-- -date_default_timezone_set('UTC'); -$twig->getExtension('Twig_Extension_Core')->setDateFormat('Y-m-d', '%d days %h hours'); -return array( - 'date2' => new DateInterval('P2D'), -) ---EXPECT-- -2 days 0 hours -2 days diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test deleted file mode 100644 index 6aad1fe..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_immutable.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('d/m/Y') }} -{{ date1|date('d/m/Y H:i:s', 'Asia/Hong_Kong') }} -{{ date1|date('d/m/Y H:i:s', timezone1) }} -{{ date1|date('d/m/Y H:i:s') }} -{{ date1|date_modify('+1 hour')|date('d/m/Y H:i:s') }} - -{{ date2|date('d/m/Y H:i:s P', 'Europe/Paris') }} -{{ date2|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} -{{ date2|date('d/m/Y H:i:s P', false) }} -{{ date2|date('e', 'Europe/Paris') }} -{{ date2|date('e', false) }} ---DATA-- -date_default_timezone_set('Europe/Paris'); -return array( - 'date1' => new DateTimeImmutable('2010-10-04 13:45'), - 'date2' => new DateTimeImmutable('2010-10-04 13:45', new DateTimeZone('America/New_York')), - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -October 4, 2010 13:45 -04/10/2010 -04/10/2010 19:45:00 -04/10/2010 07:45:00 -04/10/2010 13:45:00 -04/10/2010 14:45:00 - -04/10/2010 19:45:00 +02:00 -05/10/2010 01:45:00 +08:00 -04/10/2010 13:45:00 -04:00 -Europe/Paris -America/New_York diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test deleted file mode 100644 index a5a89f4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"date" filter (interval support) ---TEMPLATE-- -{{ date1|date }} -{{ date1|date('%d days %h hours') }} -{{ date1|date('%d days %h hours', timezone1) }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => new DateInterval('P2D'), - // This should have no effect on DateInterval formatting - 'timezone1' => new DateTimeZone('America/New_York'), -) ---EXPECT-- -2 days -2 days 0 hours -2 days 0 hours diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test deleted file mode 100644 index 53d3a69..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"date_modify" filter ---TEMPLATE-- -{{ date1|date_modify('-1day')|date('Y-m-d H:i:s') }} -{{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => '2010-10-04 13:45', - 'date2' => new DateTime('2010-10-04 13:45'), -) ---EXPECT-- -2010-10-03 13:45:00 -2010-10-03 13:45:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test deleted file mode 100644 index 4ecde8a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_namedargs.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"date" filter ---TEMPLATE-- -{{ date|date(format='d/m/Y H:i:s P', timezone='America/Chicago') }} -{{ date|date(timezone='America/Chicago', format='d/m/Y H:i:s P') }} -{{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }} ---DATA-- -date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) ---EXPECT-- -04/10/2010 08:45:00 -05:00 -04/10/2010 08:45:00 -05:00 -04/10/2010 08:45:00 -05:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test deleted file mode 100644 index b8d1d66..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test +++ /dev/null @@ -1,150 +0,0 @@ ---TEST-- -"default" filter ---TEMPLATE-- -Variable: -{{ definedVar |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ nullVar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }} -Array access: -{{ nested.definedVar |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ nested['definedVar'] |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ nested.zeroVar |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ nested.emptyVar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ nested.nullVar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ nested.undefinedVar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ nested['undefinedVar'] |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ undefinedVar.foo |default('default') is same as('default') ? 'ok' : 'ko' }} -Plain values: -{{ 'defined' |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ 0 |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ '' |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ null |default('default') is same as('default') ? 'ok' : 'ko' }} -Precedence: -{{ 'o' ~ nullVar |default('k') }} -{{ 'o' ~ nested.nullVar |default('k') }} -Object methods: -{{ object.foo |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ object.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ object.getFoo() |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ object.getFoo('a') |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ object.undefinedMethod() |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ object.undefinedMethod('a') |default('default') is same as('default') ? 'ok' : 'ko' }} -Deep nested: -{{ nested.undefinedVar.foo.bar |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ nested.definedArray.0 |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ nested['definedArray'][0] |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ object.self.foo |default('default') is same as('default') ? 'ko' : 'ok' }} -{{ object.self.undefinedMethod |default('default') is same as('default') ? 'ok' : 'ko' }} -{{ object.undefinedMethod.self |default('default') is same as('default') ? 'ok' : 'ko' }} ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -Variable: -ok -ok -ok -ok -ok -Array access: -ok -ok -ok -ok -ok -ok -ok -ok -Plain values: -ok -ok -ok -ok -Precedence: -ok -ok -Object methods: -ok -ok -ok -ok -ok -ok -Deep nested: -ok -ok -ok -ok -ok -ok ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'emptyVar' => '', - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -) ---CONFIG-- -return array('strict_variables' => true) ---EXPECT-- -Variable: -ok -ok -ok -ok -ok -Array access: -ok -ok -ok -ok -ok -ok -ok -ok -Plain values: -ok -ok -ok -ok -Precedence: -ok -ok -Object methods: -ok -ok -ok -ok -ok -ok -Deep nested: -ok -ok -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test deleted file mode 100644 index 93c5913..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -dynamic filter ---TEMPLATE-- -{{ 'bar'|foo_path }} -{{ 'bar'|a_foo_b_bar }} ---DATA-- -return array() ---EXPECT-- -foo/bar -a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test deleted file mode 100644 index a606c10..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{{ "foo
    "|e }} ---DATA-- -return array() ---EXPECT-- -foo <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test deleted file mode 100644 index 009a245..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_html_attr.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter does not escape with the html strategy when using the html_attr strategy ---TEMPLATE-- -{{ '
    '|escape('html_attr') }} ---DATA-- -return array() ---EXPECT-- -<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test deleted file mode 100644 index 647147a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_javascript.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{{ "é ♜ 𝌆"|e('js') }} ---DATA-- -return array() ---EXPECT-- -\u00E9\x20\u265C\x20\uD834\uDF06 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test deleted file mode 100644 index bba26a0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{{ "愛していますか?
    "|e }} ---DATA-- -return array() ---EXPECT-- -愛していますか? <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test deleted file mode 100644 index aa54645..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/first.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"first" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|first }} -{{ {a: 1, b: 2, c: 3, d: 4}|first }} -{{ '1234'|first }} -{{ arr|first }} -{{ 'Ä€é'|first }} -{{ ''|first }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -1 -1 -1 -1 -Ä diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test deleted file mode 100644 index 85a9b71..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"escape" filter ---TEMPLATE-- -{% set foo %} - foo
    -{% endset %} - -{{ foo|e('html') -}} -{{ foo|e('js') }} -{% autoescape true %} - {{ foo }} -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - foo<br /> -\x20\x20\x20\x20foo\x3Cbr\x20\x2F\x3E\x0A - foo
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test deleted file mode 100644 index 97221ff..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"format" filter ---TEMPLATE-- -{{ string|format(foo, 3) }} ---DATA-- -return array('string' => '%s/%d', 'foo' => 'bar') ---EXPECT-- -bar/3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test deleted file mode 100644 index b342c17..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"join" filter ---TEMPLATE-- -{{ ["foo", "bar"]|join(', ') }} -{{ foo|join(', ') }} -{{ bar|join(', ') }} ---DATA-- -return array('foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4))) ---EXPECT-- -foo, bar -1, 2 -3, 4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test deleted file mode 100644 index 1738d40..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"json_encode" filter ---TEMPLATE-- -{{ "foo"|json_encode|raw }} -{{ foo|json_encode|raw }} -{{ [foo, "foo"]|json_encode|raw }} ---DATA-- -return array('foo' => new Twig_Markup('foo', 'UTF-8')) ---EXPECT-- -"foo" -"foo" -["foo","foo"] diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test deleted file mode 100644 index 1b8031e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/last.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"last" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|last }} -{{ {a: 1, b: 2, c: 3, d: 4}|last }} -{{ '1234'|last }} -{{ arr|last }} -{{ 'Ä€é'|last }} -{{ ''|last }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -4 -4 -4 -4 -é diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test deleted file mode 100644 index a7f1e50..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -"length" filter ---TEMPLATE-- -{{ array|length }} -{{ string|length }} -{{ number|length }} -{{ to_string_able|length }} -{{ countable|length }} -{{ null|length }} -{{ magic|length }} -{{ non_countable|length }} ---DATA-- -return array( - 'array' => array(1, 4), - 'string' => 'foo', - 'number' => 1000, - 'to_string_able' => new ToStringStub('foobar'), - 'countable' => new CountableStub(42), /* also asserts we do *not* call __toString() */ - 'null' => null, - 'magic' => new MagicCallStub(), /* used to assert we do *not* call __call */ - 'non_countable' => new \StdClass(), -); ---EXPECT-- -2 -3 -4 -6 -42 -0 -1 -1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test deleted file mode 100644 index e5b1b10..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"length" filter ---TEMPLATE-- -{{ string|length }} -{{ markup|length }} ---DATA-- -return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) ---EXPECT-- -3 -3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test deleted file mode 100644 index 81371a4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"merge" filter ---TEMPLATE-- -{{ items|merge({'bar': 'foo'})|join }} -{{ items|merge({'bar': 'foo'})|keys|join }} -{{ {'bar': 'foo'}|merge(items)|join }} -{{ {'bar': 'foo'}|merge(items)|keys|join }} -{{ numerics|merge([4, 5, 6])|join }} -{{ traversable.a|merge(traversable.b)|join }} ---DATA-- -return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b')))) ---EXPECT-- -barfoo -foobar -foobar -barfoo -123456 -123b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test deleted file mode 100644 index 6545a9b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"nl2br" filter ---TEMPLATE-- -{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} -{{ text|nl2br }} ---DATA-- -return array('text' => "If you have some HTML\nit will be escaped.") ---EXPECT-- -I like Twig.
    -You will like it too.
    -
    -Everybody like it! -If you have some <strong>HTML</strong>
    -it will be escaped. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test deleted file mode 100644 index 639a865..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"number_format" filter ---TEMPLATE-- -{{ 20|number_format }} -{{ 20.25|number_format }} -{{ 20.25|number_format(2) }} -{{ 20.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',', '.') }} ---DATA-- -return array(); ---EXPECT-- -20 -20 -20.25 -20,25 -1,020,25 -1.020,25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test deleted file mode 100644 index 65c1cdb..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -"number_format" filter with defaults. ---TEMPLATE-- -{{ 20|number_format }} -{{ 20.25|number_format }} -{{ 20.25|number_format(1) }} -{{ 20.25|number_format(2, ',') }} -{{ 1020.25|number_format }} -{{ 1020.25|number_format(2, ',') }} -{{ 1020.25|number_format(2, ',', '.') }} ---DATA-- -$twig->getExtension('Twig_Extension_Core')->setNumberFormat(2, '!', '='); -return array(); ---EXPECT-- -20!00 -20!25 -20!3 -20,25 -1=020!25 -1=020,25 -1.020,25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test deleted file mode 100644 index 06be7e2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"replace" filter ---TEMPLATE-- -{{ "I liké %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} -{{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }} -{{ 'I like %this% and %that%.'|replace(traversable) }} ---DATA-- -return array('traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar'))) ---EXPECT-- -I liké foo and bar. -I like single replace operation only %that%1 -I like foo and bar. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test deleted file mode 100644 index 2143a86..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace_invalid_arg.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Exception for invalid argument type in replace call ---TEMPLATE-- -{{ 'test %foo%'|replace(stdClass) }} ---DATA-- -return array('stdClass' => new stdClass()) ---EXCEPTION-- -Twig_Error_Runtime: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test deleted file mode 100644 index 7948ac4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"reverse" filter ---TEMPLATE-- -{{ [1, 2, 3, 4]|reverse|join('') }} -{{ '1234évènement'|reverse }} -{{ arr|reverse|join('') }} -{{ {'a': 'c', 'b': 'a'}|reverse()|join(',') }} -{{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }} -{{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }} ---DATA-- -return array('arr' => new ArrayObject(array(1, 2, 3, 4))) ---EXPECT-- -4321 -tnemenèvé4321 -4321 -a,c -a,c -a,c diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test deleted file mode 100644 index 57806b6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/round.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"round" filter ---TEMPLATE-- -{{ 2.7|round }} -{{ 2.1|round }} -{{ 2.1234|round(3, 'floor') }} -{{ 2.1|round(0, 'ceil') }} - -{{ 21.3|round(-1)}} -{{ 21.3|round(-1, 'ceil')}} -{{ 21.3|round(-1, 'floor')}} ---DATA-- -return array() ---EXPECT-- -3 -2 -2.123 -3 - -20 -30 -20 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test deleted file mode 100644 index b49b89f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -"slice" filter ---TEMPLATE-- -{{ [1, 2, 3, 4][1:2]|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} -{{ [1, 2, 3, 4][start:length]|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} -{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} -{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} -{{ '1234'|slice(1, 2) }} -{{ '1234'[1:2] }} -{{ arr|slice(1, 2)|join('') }} -{{ arr[1:2]|join('') }} -{{ arr[4:1]|join('') }} -{{ arr[3:2]|join('') }} - -{{ [1, 2, 3, 4]|slice(1)|join('') }} -{{ [1, 2, 3, 4][1:]|join('') }} -{{ '1234'|slice(1) }} -{{ '1234'[1:] }} -{{ '1234'[:1] }} - -{{ arr|slice(3)|join('') }} -{{ arr[2:]|join('') }} -{{ xml|slice(1)|join('')}} ---DATA-- -return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('12')) ---EXPECT-- -23 -23 -23 -23 -01 -12 -23 -bc -23 -23 -23 -23 - -4 - -234 -234 -234 -234 -1 - -4 -34 -2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test deleted file mode 100644 index c67c18e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"sort" filter ---TEMPLATE-- -{{ array1|sort|join }} -{{ array2|sort|join }} -{{ traversable|sort|join }} ---DATA-- -return array('array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1))) ---EXPECT-- -14 -barfoo -123 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test deleted file mode 100644 index dbaf7dc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom filter ---TEMPLATE-- -{{ 'foo'|§ }} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test deleted file mode 100644 index a093ed7..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"split" filter ---TEMPLATE-- -{{ "one,two,three,four,five"|split(',')|join('-') }} -{{ foo|split(',')|join('-') }} -{{ foo|split(',', 3)|join('-') }} -{{ baz|split('')|join('-') }} -{{ baz|split('', 1)|join('-') }} -{{ baz|split('', 2)|join('-') }} -{{ foo|split(',', -2)|join('-') }} ---DATA-- -return array('foo' => "one,two,three,four,five", 'baz' => '12345',) ---EXPECT-- -one-two-three-four-five -one-two-three-four-five -one-two-three,four,five -1-2-3-4-5 -1-2-3-4-5 -12-34-5 -one-two-three \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test deleted file mode 100644 index 5757aba..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/split_utf8.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"split" filter ---TEMPLATE-- -{{ "é"|split('', 10)|join('-') }} -{{ foo|split(',')|join('-') }} -{{ foo|split(',', 1)|join('-') }} -{{ foo|split(',', 2)|join('-') }} -{{ foo|split(',', 3)|join('-') }} -{{ baz|split('')|join('-') }} -{{ baz|split('', 1)|join('-') }} -{{ baz|split('', 2)|join('-') }} ---DATA-- -return array('foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',) ---EXPECT-- -é -Ä-é-Äほ -Ä,é,Äほ -Ä-é,Äほ -Ä-é-Äほ -é-Ä-ß-ご-a -é-Ä-ß-ご-a -éÄ-ßご-a \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test deleted file mode 100644 index 4e17b77..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/static_calls.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Filters as static method calls ---TEMPLATE-- -{{ 'foo'|static_call_string }} -{{ 'foo'|static_call_array }} ---DATA-- -return array('foo' => 'foo') ---EXPECT-- -*foo* -*foo* diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test deleted file mode 100644 index b1ef7b4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"trim" filter ---TEMPLATE-- -{{ " I like Twig. "|trim }} -{{ text|trim }} -{{ " foo/"|trim("/") }} -{{ "xxxI like Twig.xxx"|trim(character_mask="x", side="left") }} -{{ "xxxI like Twig.xxx"|trim(side="right", character_mask="x") }} -{{ "xxxI like Twig.xxx"|trim("x", "right") }} -{{ "/ foo/"|trim("/", "left") }} -{{ "/ foo/"|trim(character_mask="/", side="left") }} -{{ " do nothing. "|trim("", "right") }} ---DATA-- -return array('text' => " If you have some HTML it will be escaped. ") ---EXPECT-- -I like Twig. -If you have some <strong>HTML</strong> it will be escaped. - foo -I like Twig.xxx -xxxI like Twig. -xxxI like Twig. - foo/ - foo/ - do nothing. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test deleted file mode 100644 index 83a384c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/urlencode.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"url_encode" filter ---TEMPLATE-- -{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode }} -{{ {foo: "bar", number: 3, "spéßi%l": "e%c0d@d", "spa ce": ""}|url_encode|raw }} -{{ {}|url_encode|default("default") }} -{{ 'spéßi%le%c0d@dspa ce'|url_encode }} ---DATA-- -return array() ---EXPECT-- -foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= -foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce= -default -sp%C3%A9%C3%9Fi%25le%25c0d%40dspa%20ce diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test deleted file mode 100644 index 71b2038..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"attribute" function ---TEMPLATE-- -{{ attribute(obj, method) }} -{{ attribute(array, item) }} -{{ attribute(obj, "bar", ["a", "b"]) }} -{{ attribute(obj, "bar", arguments) }} -{{ attribute(obj, method) is defined ? 'ok' : 'ko' }} -{{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }} ---DATA-- -return array('obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => array('a', 'b')) ---EXPECT-- -foo -bar -bar_a-b -bar_a-b -ok -ko diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test deleted file mode 100644 index 8e54059..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"block" function ---TEMPLATE-- -{% extends 'base.twig' %} -{% block bar %}BAR{% endblock %} ---TEMPLATE(base.twig)-- -{% block foo %}{{ block('bar') }}{% endblock %} -{% block bar %}BAR_BASE{% endblock %} ---DATA-- -return array() ---EXPECT-- -BARBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test deleted file mode 100644 index 8305eb6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"block" function with a template argument ---TEMPLATE-- -{{ block('foo', 'included.twig') }} -{{ block('foo', included_loaded) }} -{{ block('foo', included_loaded_internal) }} -{% set output = block('foo', 'included.twig') %} -{{ output }} -{% block foo %}NOT FOO{% endblock %} ---TEMPLATE(included.twig)-- -{% block foo %}FOO{% endblock %} ---DATA-- -return array( - 'included_loaded' => $twig->load('included.twig'), - 'included_loaded_internal' => $twig->loadTemplate('included.twig'), -) ---EXPECT-- -FOO -FOO -FOO -FOO -NOT FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test deleted file mode 100644 index 665cc87..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"block" function without arguments ---TEMPLATE-- -{% extends 'base.twig' %} -{% block bar %}BAR{% endblock %} ---TEMPLATE(base.twig)-- -{% block foo %}{{ block() }}{% endblock %} -{% block bar %}BAR_BASE{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: The "block" function takes one argument (the block name) in "base.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_parent.test deleted file mode 100644 index 756c6b1..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_parent.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"block" calling parent() with no definition in parent template ---TEMPLATE-- -{% extends "parent.twig" %} -{% block label %}{{ parent() }}{% endblock %} ---TEMPLATE(parent.twig)-- -{{ block('label') }} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Block "label" should not call parent() in "index.twig" as the block does not exist in the parent template "parent.twig" in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test deleted file mode 100644 index 6312879..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"constant" function ---TEMPLATE-- -{{ constant('DATE_W3C') == expect ? 'true' : 'false' }} -{{ constant('ARRAY_AS_PROPS', object) }} ---DATA-- -return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); ---EXPECT-- -true -2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test deleted file mode 100644 index 522a63b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"cycle" function ---TEMPLATE-- -{% for i in 0..6 %} -{{ cycle(array1, i) }}-{{ cycle(array2, i) }} -{% endfor %} ---DATA-- -return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) ---EXPECT-- -odd-apple -even-orange -odd-citrus -even-apple -odd-orange -even-citrus -odd-apple diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test deleted file mode 100644 index c9f4644..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -"date" function ---TEMPLATE-- -{{ date().format('r') == date('now').format('r') ? 'OK' : 'KO' }} -{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} -{{ date(date5) == date('1964-01-02 03:04') ? 'OK' : 'KO' }} -{{ date() > date('-1day') ? 'OK' : 'KO' }} ---DATA-- -date_default_timezone_set('UTC'); -return array( - 'date1' => mktime(13, 45, 0, 10, 4, 2010), - 'date2' => new DateTime('2010-10-04 13:45'), - 'date3' => '2010-10-04 13:45', - 'date4' => 1286199900, // DateTime::createFromFormat('Y-m-d H:i', '2010-10-04 13:45', new DateTimeZone('UTC'))->getTimestamp() -- A unixtimestamp is always GMT - 'date5' => -189291360, // DateTime::createFromFormat('Y-m-d H:i', '1964-01-02 03:04', new DateTimeZone('UTC'))->getTimestamp(), -) ---EXPECT-- -OK -OK -OK -OK -OK -OK -OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test deleted file mode 100644 index b9dd9e3..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date_namedargs.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"date" function ---TEMPLATE-- -{{ date(date, "America/New_York")|date('d/m/Y H:i:s P', false) }} -{{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }} ---DATA-- -date_default_timezone_set('UTC'); -return array('date' => mktime(13, 45, 0, 10, 4, 2010)) ---EXPECT-- -04/10/2010 09:45:00 -04:00 -04/10/2010 09:45:00 -04:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test deleted file mode 100644 index f407237..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"dump" function ---CONDITION-- -!extension_loaded('xdebug') ---TEMPLATE-- -{{ dump('foo') }} -{{ dump('foo', 'bar') }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---CONFIG-- -return array('debug' => true, 'autoescape' => false); ---EXPECT-- -string(3) "foo" - -string(3) "foo" -string(3) "bar" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test deleted file mode 100644 index 889b7a9..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded ---CONDITION-- -!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) ---TEMPLATE-- -{{ dump() }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---CONFIG-- -return array('debug' => true, 'autoescape' => false); ---EXPECT-- -array(3) { - ["foo"]=> - string(3) "foo" - ["bar"]=> - string(3) "bar" - ["global"]=> - string(6) "global" -} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test deleted file mode 100644 index 913fbc9..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -dynamic function ---TEMPLATE-- -{{ foo_path('bar') }} -{{ a_foo_b_bar('bar') }} ---DATA-- -return array() ---EXPECT-- -foo/bar -a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test deleted file mode 100644 index b7653b4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/assignment.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{% set tmp = include("foo.twig") %} - -FOO{{ tmp }}BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO -FOOBARBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test deleted file mode 100644 index 56f8f3b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/autoescaping.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function is safe for auto-escaping ---TEMPLATE-- -{{ include("foo.twig") }} ---TEMPLATE(foo.twig)-- -

    Test

    ---DATA-- -return array() ---EXPECT-- -

    Test

    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test deleted file mode 100644 index a434182..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/basic.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -FOO -{{ include("foo.twig") }} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO - -FOOBAR - -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test deleted file mode 100644 index aba30ce..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/expression.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"include" function allows expressions for the template to include ---TEMPLATE-- -FOO -{{ include(foo) }} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO - -FOOBAR - -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test deleted file mode 100644 index 43a2ccc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/ignore_missing.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include(["foo.twig", "bar.twig"], ignore_missing = true) }} -{{ include("foo.twig", ignore_missing = true) }} -{{ include("foo.twig", ignore_missing = true, variables = {}) }} -{{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }} ---DATA-- -return array() ---EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test deleted file mode 100644 index 4d2f6cf..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include("foo.twig") }} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test deleted file mode 100644 index 78fddc7..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/missing_nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{% extends "base.twig" %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %} - {{ include("foo.twig") }} -{% endblock %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test deleted file mode 100644 index 7b9ccac..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("foo.twig", sandboxed = true) }} ---TEMPLATE(foo.twig)-- - - -{{ foo|e }} -{{ foo|e }} ---DATA-- -return array() ---EXCEPTION-- -Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test deleted file mode 100644 index 8ffc492..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("foo.twig", sandboxed = true) }} -{{ include("bar.twig") }} ---TEMPLATE(foo.twig)-- -foo ---TEMPLATE(bar.twig)-- -{{ foo|e }} ---DATA-- -return array('foo' => 'bar
    ') ---EXPECT-- -foo - - -bar<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test deleted file mode 100644 index 8bf6e10..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/sandbox_disabling_ignore_missing.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"include" tag sandboxed ---TEMPLATE-- -{{ include("unknown.twig", sandboxed = true, ignore_missing = true) }} -{{ include("bar.twig") }} ---TEMPLATE(bar.twig)-- -{{ foo|e }} ---DATA-- -return array('foo' => 'bar
    ') ---EXPECT-- - - -bar<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test deleted file mode 100644 index 18d405a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/template_instance.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" function accepts Twig_Template instance ---TEMPLATE-- -{{ include(foo) }} FOO ---TEMPLATE(foo.twig)-- -BAR ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BAR FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test deleted file mode 100644 index 1a81006..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/templates_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" function ---TEMPLATE-- -{{ include(["foo.twig", "bar.twig"]) }} -{{- include(["bar.twig", "foo.twig"]) }} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test deleted file mode 100644 index 35611fb..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_context.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" function accept variables and with_context ---TEMPLATE-- -{{ include("foo.twig") }} -{{- include("foo.twig", with_context = false) }} -{{- include("foo.twig", {'foo1': 'bar'}) }} -{{- include("foo.twig", {'foo1': 'bar'}, with_context = false) }} ---TEMPLATE(foo.twig)-- -{% for k, v in _context %}{{ k }},{% endfor %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -foo,global,_parent, -global,_parent, -foo,global,foo1,_parent, -foo1,global,_parent, diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test deleted file mode 100644 index b2ace94..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/include/with_variables.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" function accept variables ---TEMPLATE-- -{{ include("foo.twig", {'foo': 'bar'}) }} -{{- include("foo.twig", vars) }} ---TEMPLATE(foo.twig)-- -{{ foo }} ---DATA-- -return array('vars' => array('foo' => 'bar')) ---EXPECT-- -bar -bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test deleted file mode 100644 index 9335443..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_call.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -__call calls ---TEMPLATE-- -{{ 'foo'|magic_call }} ---DATA-- -return array() ---EXPECT-- -magic_foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_static_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_static_call.test deleted file mode 100644 index 521a317..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/magic_static_call.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -__staticCall calls ---TEMPLATE-- -{{ 'foo'|magic_call_string }} -{{ 'foo'|magic_call_array }} ---DATA-- -return array() ---EXPECT-- -static_magic_foo -static_magic_foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test deleted file mode 100644 index e6c94af..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/max.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"max" function ---TEMPLATE-- -{{ max([2, 1, 3, 5, 4]) }} -{{ max(2, 1, 3, 5, 4) }} -{{ max({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} ---DATA-- -return array() ---EXPECT-- -5 -5 -two diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test deleted file mode 100644 index 660471c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/min.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"min" function ---TEMPLATE-- -{{ min(2, 1, 3, 5, 4) }} -{{ min([2, 1, 3, 5, 4]) }} -{{ min({2:"two", 1:"one", 3:"three", 5:"five", 4:"for"}) }} ---DATA-- -return array() ---EXPECT-- -1 -1 -five diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test deleted file mode 100644 index e0377c8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/range.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"range" function ---TEMPLATE-- -{{ range(low=0+1, high=10+0, step=2)|join(',') }} ---DATA-- -return array() ---EXPECT-- -1,3,5,7,9 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test deleted file mode 100644 index bf0556d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/recursive_block_with_inheritance.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -"block" function recursively called in a parent template ---TEMPLATE-- -{% extends "ordered_menu.twig" %} -{% block label %}"{{ parent() }}"{% endblock %} -{% block list %}{% set class = 'b' %}{{ parent() }}{% endblock %} ---TEMPLATE(ordered_menu.twig)-- -{% extends "menu.twig" %} -{% block list %}{% set class = class|default('a') %}
      {{ block('children') }}
    {% endblock %} ---TEMPLATE(menu.twig)-- -{% extends "base.twig" %} -{% block list %}
      {{ block('children') }}
    {% endblock %} -{% block children %}{% set currentItem = item %}{% for item in currentItem %}{{ block('item') }}{% endfor %}{% set item = currentItem %}{% endblock %} -{% block item %}
  • {% if item is not iterable %}{{ block('label') }}{% else %}{{ block('list') }}{% endif %}
  • {% endblock %} -{% block label %}{{ item }}{% endblock %} ---TEMPLATE(base.twig)-- -{{ block('list') }} ---DATA-- -return array('item' => array('1', '2', array('3.1', array('3.2.1', '3.2.2'), '3.4'))) ---EXPECT-- -
    1. "1"
    2. "2"
      1. "3.1"
        1. "3.2.1"
        2. "3.2.2"
      2. "3.4"
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test deleted file mode 100644 index 0e094c3..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/source.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"source" function ---TEMPLATE-- -FOO -{{ source("foo.twig") }} - -BAR ---TEMPLATE(foo.twig)-- -{{ foo }}
    ---DATA-- -return array() ---EXPECT-- -FOO - -{{ foo }}
    - -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test deleted file mode 100644 index 30c3df5..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom function ---TEMPLATE-- -{{ §('foo') }} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test deleted file mode 100644 index 57e5be3..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/static_calls.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Functions as static method calls ---TEMPLATE-- -{{ static_call_string('foo') }} -{{ static_call_array('foo') }} ---DATA-- -return array('foo' => 'foo') ---EXPECT-- -*foo* -*foo* diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test deleted file mode 100644 index 3d3b958..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/template_from_string.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -"template_from_string" function ---TEMPLATE-- -{% include template_from_string(template) %} - -{% include template_from_string("Hello {{ name }}") %} -{% include template_from_string('{% extends "parent.twig" %}{% block content %}Hello {{ name }}{% endblock %}') %} ---TEMPLATE(parent.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('name' => 'Fabien', 'template' => "Hello {{ name }}") ---EXPECT-- -Hello Fabien -Hello Fabien -Hello Fabien diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test deleted file mode 100644 index 4ccff7b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/default_values.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% from _self import test %} - -{% macro test(a, b = 'bar') -%} -{{ a }}{{ b }} -{%- endmacro %} - -{{ test('foo') }} -{{ test('bar', 'foo') }} ---DATA-- -return array(); ---EXPECT-- -foobar -barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test deleted file mode 100644 index cd25428..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/nested_calls.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% import _self as macros %} - -{% macro foo(data) %} - {{ data }} -{% endmacro %} - -{% macro bar() %} -
    -{% endmacro %} - -{{ macros.foo(macros.bar()) }} ---DATA-- -return array(); ---EXPECT-- -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test deleted file mode 100644 index cbfb921..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/reserved_variables.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% from _self import test %} - -{% macro test(this) -%} - {{ this }} -{%- endmacro %} - -{{ test(this) }} ---DATA-- -return array('this' => 'foo'); ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test deleted file mode 100644 index 6a366cd..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -macro ---TEMPLATE-- -{% import _self as test %} -{% from _self import test %} - -{% macro test(a, b) -%} - {{ a|default('a') }}
    - {{- b|default('b') }}
    -{%- endmacro %} - -{{ test.test() }} -{{ test() }} -{{ test.test(1, "c") }} -{{ test(1, "c") }} ---DATA-- -return array(); ---EXPECT-- -a
    b
    -a
    b
    -1
    c
    -1
    c
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test deleted file mode 100644 index 412c90f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -macro with arbitrary arguments ---TEMPLATE-- -{% from _self import test1, test2 %} - -{% macro test1(var) %} - {{- var }}: {{ varargs|join(", ") }} -{% endmacro %} - -{% macro test2() %} - {{- varargs|join(", ") }} -{% endmacro %} - -{{ test1("foo", "bar", "foobar") }} -{{ test2("foo", "bar", "foobar") }} ---DATA-- -return array(); ---EXPECT-- -foo: bar, foobar - -foo, bar, foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test deleted file mode 100644 index 800c262..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/varargs_argument.test +++ /dev/null @@ -1,7 +0,0 @@ ---TEST-- -macro with varargs argument ---TEMPLATE-- -{% macro test(varargs) %} -{% endmacro %} ---EXCEPTION-- -Twig_Error_Syntax: The argument "varargs" in macro "test" cannot be defined because the variable "varargs" is reserved for arbitrary arguments in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test deleted file mode 100644 index 685626f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -macro with a filter ---TEMPLATE-- -{% import _self as test %} - -{% macro test() %} - {% filter escape %}foo
    {% endfilter %} -{% endmacro %} - -{{ test.test() }} ---DATA-- -return array(); ---EXPECT-- -foo<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test deleted file mode 100644 index ff977ad..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/combined_debug_info.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Exception with bad line number ---TEMPLATE-- -{% block content %} - {{ foo }} - {{ include("foo") }} -{% endblock %} -index ---TEMPLATE(foo)-- -foo -{{ foo.bar }} ---DATA-- -return array('foo' => 'foo'); ---EXCEPTION-- -Twig_Error_Runtime: Impossible to access an attribute ("bar") on a string variable ("foo") in "foo" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test deleted file mode 100644 index 65f6cd2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig outputs 0 nodes correctly ---TEMPLATE-- -{{ foo }}0{{ foo }} ---DATA-- -return array('foo' => 'foo') ---EXPECT-- -foo0foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test deleted file mode 100644 index ff7c8bb..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/issue_1143.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -error in twig extension ---TEMPLATE-- -{{ object.region is not null ? object.regionChoices[object.region] }} ---DATA-- -class House -{ - const REGION_S = 1; - const REGION_P = 2; - - public static $regionChoices = array(self::REGION_S => 'house.region.s', self::REGION_P => 'house.region.p'); - - public function getRegionChoices() - { - return self::$regionChoices; - } -} - -$object = new House(); -$object->region = 1; -return array('object' => $object) ---EXPECT-- -house.region.s diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test deleted file mode 100644 index 269a305..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/multi_word_tests.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Twig allows multi-word tests without a custom node class ---TEMPLATE-- -{{ 'foo' is multi word ? 'yes' : 'no' }} -{{ 'foo bar' is multi word ? 'yes' : 'no' }} ---DATA-- -return array() ---EXPECT-- -no -yes diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test deleted file mode 100644 index 2a80c1e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Twig is able to deal with SimpleXMLElement instances as variables ---TEMPLATE-- -Hello '{{ images.image.0.group }}'! -{{ images.image.0.group.attributes.myattr }} -{{ images.children().image.count() }} -{% for image in images %} - - {{ image.group }} -{% endfor %} ---DATA-- -return array('images' => new SimpleXMLElement('foobar')) ---EXPECT-- -Hello 'foo'! -example -2 - - foo - - bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test deleted file mode 100644 index e18e110..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Twig does not confuse strings with integers in getAttribute() ---TEMPLATE-- -{{ hash['2e2'] }} ---DATA-- -return array('hash' => array('2e2' => 'works')) ---EXPECT-- -works diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test deleted file mode 100644 index 703d935..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping on its children ---TEMPLATE-- -{% autoescape %} -{{ var }}
    -{% endautoescape %} -{% autoescape 'html' %} -{{ var }}
    -{% endautoescape %} -{% autoescape false %} -{{ var }}
    -{% endautoescape %} -{% autoescape false %} -{{ var }}
    -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br />
    -<br />
    -

    -

    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test deleted file mode 100644 index 05ab83c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping on embedded blocks ---TEMPLATE-- -{% autoescape 'html' %} - {% block foo %} - {{ var }} - {% endblock %} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test deleted file mode 100644 index 9c09724..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"autoescape" tag does not double-escape ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|escape }} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test deleted file mode 100644 index ce7ea78..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test +++ /dev/null @@ -1,83 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling functions ---TEMPLATE-- - -autoescape false -{% autoescape false %} - -safe_br -{{ safe_br() }} - -unsafe_br -{{ unsafe_br() }} - -{% endautoescape %} - -autoescape 'html' -{% autoescape 'html' %} - -safe_br -{{ safe_br() }} - -unsafe_br -{{ unsafe_br() }} - -unsafe_br()|raw -{{ (unsafe_br())|raw }} - -safe_br()|escape -{{ (safe_br())|escape }} - -safe_br()|raw -{{ (safe_br())|raw }} - -unsafe_br()|escape -{{ (unsafe_br())|escape }} - -{% endautoescape %} - -autoescape js -{% autoescape 'js' %} - -safe_br -{{ safe_br() }} - -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - -autoescape false - -safe_br -
    - -unsafe_br -
    - - -autoescape 'html' - -safe_br -
    - -unsafe_br -<br /> - -unsafe_br()|raw -
    - -safe_br()|escape -<br /> - -safe_br()|raw -
    - -unsafe_br()|escape -<br /> - - -autoescape js - -safe_br -\x3Cbr\x20\x2F\x3E diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test deleted file mode 100644 index e389d4d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -"autoescape" tag does not apply escaping on literals ---TEMPLATE-- -{% autoescape 'html' %} - -1. Simple literal -{{ "
    " }} - -2. Conditional expression with only literals -{{ true ? "
    " : "
    " }} - -3. Conditional expression with a variable -{{ true ? "
    " : someVar }} - -4. Nested conditionals with only literals -{{ true ? (true ? "
    " : "
    ") : "\n" }} - -5. Nested conditionals with a variable -{{ true ? (true ? "
    " : someVar) : "\n" }} - -6. Nested conditionals with a variable marked safe -{{ true ? (true ? "
    " : someVar|raw) : "\n" }} - -{% endautoescape %} ---DATA-- -return array() ---EXPECT-- - -1. Simple literal -
    - -2. Conditional expression with only literals -
    - -3. Conditional expression with a variable -<br /> - -4. Nested conditionals with only literals -
    - -5. Nested conditionals with a variable -<br /> - -6. Nested conditionals with a variable marked safe -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test deleted file mode 100644 index 798e6fe..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -"autoescape" tags can be nested at will ---TEMPLATE-- -{{ var }} -{% autoescape 'html' %} - {{ var }} - {% autoescape false %} - {{ var }} - {% autoescape 'html' %} - {{ var }} - {% endautoescape %} - {{ var }} - {% endautoescape %} - {{ var }} -{% endautoescape %} -{{ var }} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -<br /> - <br /> -
    - <br /> -
    - <br /> -<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test deleted file mode 100644 index e896aa4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping to object method calls ---TEMPLATE-- -{% autoescape 'html' %} -{{ user.name }} -{{ user.name|lower }} -{{ user }} -{% endautoescape %} ---DATA-- -class UserForAutoEscapeTest -{ - public function getName() - { - return 'Fabien
    '; - } - - public function __toString() - { - return 'Fabien
    '; - } -} -return array('user' => new UserForAutoEscapeTest()) ---EXPECT-- -Fabien<br /> -fabien<br /> -Fabien<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test deleted file mode 100644 index 9f1cedd..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"autoescape" tag does not escape when raw is used as a filter ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|raw }} -{% endautoescape %} ---DATA-- -return array('var' => '
    ') ---EXPECT-- -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test deleted file mode 100644 index e496f60..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"autoescape" tag accepts an escaping strategy ---TEMPLATE-- -{% autoescape 'js' %}{{ var }}{% endautoescape %} - -{% autoescape 'html' %}{{ var }}{% endautoescape %} ---DATA-- -return array('var' => '
    "') ---EXPECT-- -\x3Cbr\x20\x2F\x3E\x22 -<br />" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test deleted file mode 100644 index 4f41520..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -escape types ---TEMPLATE-- - -1. autoescape 'html' |escape('js') - -{% autoescape 'html' %} - -{% endautoescape %} - -2. autoescape 'html' |escape('js') - -{% autoescape 'html' %} - -{% endautoescape %} - -3. autoescape 'js' |escape('js') - -{% autoescape 'js' %} - -{% endautoescape %} - -4. no escape - -{% autoescape false %} - -{% endautoescape %} - -5. |escape('js')|escape('html') - -{% autoescape false %} - -{% endautoescape %} - -6. autoescape 'html' |escape('js')|escape('html') - -{% autoescape 'html' %} - -{% endautoescape %} - ---DATA-- -return array('msg' => "<>\n'\"") ---EXPECT-- - -1. autoescape 'html' |escape('js') - - - -2. autoescape 'html' |escape('js') - - - -3. autoescape 'js' |escape('js') - - - -4. no escape - - - -5. |escape('js')|escape('html') - - - -6. autoescape 'html' |escape('js')|escape('html') - - - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test deleted file mode 100644 index 7821a9a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test +++ /dev/null @@ -1,131 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling filters ---TEMPLATE-- -{% autoescape 'html' %} - -(escape_and_nl2br is an escaper filter) - -1. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped ) -{{ var|escape_and_nl2br }} - -2. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped, |raw is redundant ) -{{ var|escape_and_nl2br|raw }} - -3. Explicit escape -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is explicitly escaped by |escape ) -{{ var|escape_and_nl2br|escape }} - -4. Escape non-escaper filter output -( var is upper-cased by |upper, - the output is auto-escaped ) -{{ var|upper }} - -5. Escape if last filter is not an escaper -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is upper-cased by |upper, - the output is auto-escaped as |upper is not an escaper ) -{{ var|escape_and_nl2br|upper }} - -6. Don't escape escaper filter output -( var is upper cased by upper, - the output is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped as |escape_and_nl2br is an escaper ) -{{ var|upper|escape_and_nl2br }} - -7. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - the output is auto-escaped ) -{{ "%s"|format(var) }} - -8. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - |raw is redundant, - the output is auto-escaped ) -{{ "%s"|raw|format(var) }} - -9. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end ) -{{ "%s"|format(var)|raw }} - -10. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end, - the |raw filter on var is redundant ) -{{ "%s"|format(var|raw)|raw }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(escape_and_nl2br is an escaper filter) - -1. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped ) -<Fabien>
    -Twig - -2. Don't escape escaper filter output -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped, |raw is redundant ) -<Fabien>
    -Twig - -3. Explicit escape -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is explicitly escaped by |escape ) -&lt;Fabien&gt;<br /> -Twig - -4. Escape non-escaper filter output -( var is upper-cased by |upper, - the output is auto-escaped ) -<FABIEN> -TWIG - -5. Escape if last filter is not an escaper -( var is escaped by |escape_and_nl2br, line-breaks are added, - the output is upper-cased by |upper, - the output is auto-escaped as |upper is not an escaper ) -&LT;FABIEN&GT;<BR /> -TWIG - -6. Don't escape escaper filter output -( var is upper cased by upper, - the output is escaped by |escape_and_nl2br, line-breaks are added, - the output is not escaped as |escape_and_nl2br is an escaper ) -<FABIEN>
    -TWIG - -7. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - the output is auto-escaped ) -<b><Fabien> -Twig</b> - -8. Escape if last filter is not an escaper -( the output of |format is "" ~ var ~ "", - |raw is redundant, - the output is auto-escaped ) -<b><Fabien> -Twig</b> - -9. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end ) - -Twig - -10. Don't escape escaper filter output -( the output of |format is "" ~ var ~ "", - the output is not escaped due to |raw filter at the end, - the |raw filter on var is redundant ) - -Twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test deleted file mode 100644 index f58a1e0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"autoescape" tag do not applies escaping on filter arguments ---TEMPLATE-- -{% autoescape 'html' %} -{{ var|nl2br("
    ") }} -{{ var|nl2br("
    "|escape) }} -{{ var|nl2br(sep) }} -{{ var|nl2br(sep|raw) }} -{{ var|nl2br(sep|escape) }} -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig", 'sep' => '
    ') ---EXPECT-- -<Fabien>
    -Twig -<Fabien><br /> -Twig -<Fabien>
    -Twig -<Fabien>
    -Twig -<Fabien><br /> -Twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test deleted file mode 100644 index 134c77e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters ---TEMPLATE-- -{% autoescape 'html' %} - -(nl2br is pre_escaped for "html" and declared safe for "html") - -1. Pre-escape and don't post-escape -( var|escape|nl2br ) -{{ var|nl2br }} - -2. Don't double-pre-escape -( var|escape|nl2br ) -{{ var|escape|nl2br }} - -3. Don't escape safe values -( var|raw|nl2br ) -{{ var|raw|nl2br }} - -4. Don't escape safe values -( var|escape|nl2br|nl2br ) -{{ var|nl2br|nl2br }} - -5. Re-escape values that are escaped for an other contexts -( var|escape_something|escape|nl2br ) -{{ var|escape_something|nl2br }} - -6. Still escape when using filters not declared safe -( var|escape|nl2br|upper|escape ) -{{ var|nl2br|upper }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(nl2br is pre_escaped for "html" and declared safe for "html") - -1. Pre-escape and don't post-escape -( var|escape|nl2br ) -<Fabien>
    -Twig - -2. Don't double-pre-escape -( var|escape|nl2br ) -<Fabien>
    -Twig - -3. Don't escape safe values -( var|raw|nl2br ) -
    -Twig - -4. Don't escape safe values -( var|escape|nl2br|nl2br ) -<Fabien>

    -Twig - -5. Re-escape values that are escaped for an other contexts -( var|escape_something|escape|nl2br ) -<FABIEN>
    -TWIG - -6. Still escape when using filters not declared safe -( var|escape|nl2br|upper|escape ) -&LT;FABIEN&GT;<BR /> -TWIG - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test deleted file mode 100644 index 32d3943..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -"autoescape" tag handles filters preserving the safety ---TEMPLATE-- -{% autoescape 'html' %} - -(preserves_safety is preserving safety for "html") - -1. Unsafe values are still unsafe -( var|preserves_safety|escape ) -{{ var|preserves_safety }} - -2. Safe values are still safe -( var|escape|preserves_safety ) -{{ var|escape|preserves_safety }} - -3. Re-escape values that are escaped for an other contexts -( var|escape_something|preserves_safety|escape ) -{{ var|escape_something|preserves_safety }} - -4. Still escape when using filters not declared safe -( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) -{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} - -{% endautoescape %} ---DATA-- -return array('var' => "\nTwig") ---EXPECT-- - -(preserves_safety is preserving safety for "html") - -1. Unsafe values are still unsafe -( var|preserves_safety|escape ) -<FABIEN> -TWIG - -2. Safe values are still safe -( var|escape|preserves_safety ) -<FABIEN> -TWIG - -3. Re-escape values that are escaped for an other contexts -( var|escape_something|preserves_safety|escape ) -<FABIEN> -TWIG - -4. Still escape when using filters not declared safe -( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) -&LT;FABPOT&GT; -TWIG - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test deleted file mode 100644 index 360dcf0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block title1 %}FOO{% endblock %} -{% block title2 foo|lower %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -FOObar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test deleted file mode 100644 index bc89ec8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block content %} - {% block content %} - {% endblock %} -{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test deleted file mode 100644 index be17fed..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"§" special chars in a block name ---TEMPLATE-- -{% block § %} -§ -{% endblock § %} ---DATA-- -return array() ---EXPECT-- -§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test deleted file mode 100644 index f44296e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test deleted file mode 100644 index de5ea7e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed foo ~ ".twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array('foo' => 'foo') ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test deleted file mode 100644 index 2a125e6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed foo %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test deleted file mode 100644 index 4314737..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/error_line.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE(index.twig)-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ nothing }} - {% endblock %} -{% endembed %} -BAR ---TEMPLATE(foo.twig)-- -{% block c1 %}{% endblock %} ---DATA-- -return array() ---EXCEPTION-- -Twig_Error_Runtime: Variable "nothing" does not exist in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test deleted file mode 100644 index da161e6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -FOO -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} -{% endembed %} - -BAR ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -FOO - -A - block1 - - block1extended - B - block2 -C - -A - block1 - - block1extended - B - block2 -C -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test deleted file mode 100644 index 81563dc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -{% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - {% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} - {% endembed %} - - {% endblock %} -{% endembed %} ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -A - block1 - - -A - block1 - - block1extended - B - block2 -C - B - block2 -C diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test deleted file mode 100644 index 2c1dd58..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -"embed" tag ---TEMPLATE-- -{% extends "base.twig" %} - -{% block c1 %} - {{ parent() }} - blockc1baseextended -{% endblock %} - -{% block c2 %} - {{ parent() }} - - {% embed "foo.twig" %} - {% block c1 %} - {{ parent() }} - block1extended - {% endblock %} - {% endembed %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -A -{% block c1 %} - blockc1base -{% endblock %} -{% block c2 %} - blockc2base -{% endblock %} -B ---TEMPLATE(foo.twig)-- -A -{% block c1 %} - block1 -{% endblock %} -B -{% block c2 %} - block2 -{% endblock %} -C ---DATA-- -return array() ---EXPECT-- -A - blockc1base - - blockc1baseextended - blockc2base - - - -A - block1 - - block1extended - B - block2 -C blockc2base - -B \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test deleted file mode 100644 index 82094f2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"filter" tag applies a filter on its children ---TEMPLATE-- -{% filter upper %} -Some text with a {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'var') ---EXPECT-- -SOME TEXT WITH A VAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test deleted file mode 100644 index 3e7148b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"filter" tag applies a filter on its children ---TEMPLATE-- -{% filter json_encode|raw %}test{% endfilter %} ---DATA-- -return array() ---EXPECT-- -"test" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test deleted file mode 100644 index 75512ef..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"filter" tags accept multiple chained filters ---TEMPLATE-- -{% filter lower|title %} - {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'VAR') ---EXPECT-- - Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test deleted file mode 100644 index 7e4e4eb..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"filter" tags can be nested at will ---TEMPLATE-- -{% filter lower|title %} - {{ var }} - {% filter upper %} - {{ var }} - {% endfilter %} - {{ var }} -{% endfilter %} ---DATA-- -return array('var' => 'var') ---EXPECT-- - Var - Var - Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test deleted file mode 100644 index 22745ea..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"filter" tag applies the filter on "for" tags ---TEMPLATE-- -{% filter upper %} -{% for item in items %} -{{ item }} -{% endfor %} -{% endfilter %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- -A -B diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test deleted file mode 100644 index afd95b2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -"filter" tag applies the filter on "if" tags ---TEMPLATE-- -{% filter upper %} -{% if items %} -{{ items|join(', ') }} -{% endif %} - -{% if items.3 is defined %} -FOO -{% else %} -{{ items.1 }} -{% endif %} - -{% if items.3 is defined %} -FOO -{% elseif items.1 %} -{{ items.0 }} -{% endif %} - -{% endfilter %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- -A, B - -B - -A diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test deleted file mode 100644 index 380531f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"for" tag takes a condition ---TEMPLATE-- -{% for i in 1..5 if i is odd -%} - {{ loop.index }}.{{ i }}{{ foo.bar }} -{% endfor %} ---DATA-- -return array('foo' => array('bar' => 'X')) ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -1.1X -2.3X -3.5X diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test deleted file mode 100644 index ddc6930..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"for" tag keeps the context safe ---TEMPLATE-- -{% for item in items %} - {% for item in items %} - * {{ item }} - {% endfor %} - * {{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b - * a - * a - * b - * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test deleted file mode 100644 index 20ccc88..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"for" tag can use an "else" clause ---TEMPLATE-- -{% for item in items %} - * {{ item }} -{% else %} - no item -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b ---DATA-- -return array('items' => array()) ---EXPECT-- - no item ---DATA-- -return array() ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- - no item diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test deleted file mode 100644 index 49fb9ca..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"for" tag does not reset inner variables ---TEMPLATE-- -{% for i in 1..2 %} - {% for j in 0..2 %} - {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} - {% endfor %} -{% endfor %} ---DATA-- -return array('k' => 0) ---EXPECT-- - 0 1 - 1 1 - 2 1 - 3 2 - 4 2 - 5 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test deleted file mode 100644 index 4e22cb4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag can iterate over keys ---TEMPLATE-- -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 0 - * 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test deleted file mode 100644 index 4c21168..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag can iterate over keys and values ---TEMPLATE-- -{% for key, item in items %} - * {{ key }}/{{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 0/a - * 1/b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test deleted file mode 100644 index 93bc76a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"for" tag adds a loop variable to the context ---TEMPLATE-- -{% for item in items %} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.revindex }}/{{ loop.revindex0 }} - * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} - -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * 1/0 - * 2/1 - * 1//2 - - * 2/1 - * 1/0 - * /1/2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test deleted file mode 100644 index 58af2c3..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"for" tag adds a loop variable to the context locally ---TEMPLATE-- -{% for item in items %} -{% endfor %} -{% if loop is not defined %}WORKS{% endif %} ---DATA-- -return array('items' => array()) ---EXPECT-- -WORKS diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test deleted file mode 100644 index 6a2af63..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"for" tag ---TEMPLATE-- -{% for i, item in items if i > 0 %} - {{ loop.last }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXCEPTION-- -Twig_Error_Syntax: The "loop.last" variable is not defined when looping with a condition in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test deleted file mode 100644 index 1e819ca..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_not_defined_cond.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -"for" tag ---TEMPLATE-- -{% for i, item in items if loop.last > 0 %} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXCEPTION-- -Twig_Error_Syntax: The "loop" variable cannot be used in a looping condition in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test deleted file mode 100644 index f8b9f6b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"for" tag can use an "else" clause ---TEMPLATE-- -{% for item in items %} - {% for item in items1 %} - * {{ item }} - {% else %} - no {{ item }} - {% endfor %} -{% else %} - no item1 -{% endfor %} ---DATA-- -return array('items' => array('a', 'b'), 'items1' => array()) ---EXPECT-- -no a - no b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test deleted file mode 100644 index 5034437..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -"for" tag iterates over iterable objects ---TEMPLATE-- -{% for item in items %} - * {{ item }} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.first }} - -{% endfor %} - -{% for key, value in items %} - * {{ key }}/{{ value }} -{% endfor %} - -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -class ItemsIterator implements Iterator -{ - protected $values = array('foo' => 'bar', 'bar' => 'foo'); - public function current() { return current($this->values); } - public function key() { return key($this->values); } - public function next() { return next($this->values); } - public function rewind() { return reset($this->values); } - public function valid() { return false !== current($this->values); } -} -return array('items' => new ItemsIterator()) ---EXPECT-- - * bar - * 1/0 - * 1 - - * foo - * 2/1 - * - - - * foo/bar - * bar/foo - - * foo - * bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test deleted file mode 100644 index 4a1ff61..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -"for" tag iterates over iterable and countable objects ---TEMPLATE-- -{% for item in items %} - * {{ item }} - * {{ loop.index }}/{{ loop.index0 }} - * {{ loop.revindex }}/{{ loop.revindex0 }} - * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} - -{% endfor %} - -{% for key, value in items %} - * {{ key }}/{{ value }} -{% endfor %} - -{% for key in items|keys %} - * {{ key }} -{% endfor %} ---DATA-- -class ItemsIteratorCountable implements Iterator, Countable -{ - protected $values = array('foo' => 'bar', 'bar' => 'foo'); - public function current() { return current($this->values); } - public function key() { return key($this->values); } - public function next() { return next($this->values); } - public function rewind() { return reset($this->values); } - public function valid() { return false !== current($this->values); } - public function count() { return count($this->values); } -} -return array('items' => new ItemsIteratorCountable()) ---EXPECT-- - * bar - * 1/0 - * 2/1 - * 1//2 - - * foo - * 2/1 - * 1/0 - * /1/2 - - - * foo/bar - * bar/foo - - * foo - * bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test deleted file mode 100644 index 17b2e22..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"for" tags can be nested ---TEMPLATE-- -{% for key, item in items %} -* {{ key }} ({{ loop.length }}): -{% for value in item %} - * {{ value }} ({{ loop.length }}) -{% endfor %} -{% endfor %} ---DATA-- -return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) ---EXPECT-- -* a (2): - * a1 (3) - * a2 (3) - * a3 (3) -* b (2): - * b1 (1) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test deleted file mode 100644 index 82f2ae8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -"for" tag iterates over item values ---TEMPLATE-- -{% for item in items %} - * {{ item }} -{% endfor %} ---DATA-- -return array('items' => array('a', 'b')) ---EXPECT-- - * a - * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test deleted file mode 100644 index 5f5da0e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -global variables ---TEMPLATE-- -{% include "included.twig" %} -{% from "included.twig" import foobar %} -{{ foobar() }} ---TEMPLATE(included.twig)-- -{% macro foobar() %} -called foobar -{% endmacro %} ---DATA-- -return array(); ---EXPECT-- -called foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test deleted file mode 100644 index c1c3d27..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"if" creates a condition ---TEMPLATE-- -{% if a is defined %} - {{ a }} -{% elseif b is defined %} - {{ b }} -{% else %} - NOTHING -{% endif %} ---DATA-- -return array('a' => 'a') ---EXPECT-- - a ---DATA-- -return array('b' => 'b') ---EXPECT-- - b ---DATA-- -return array() ---EXPECT-- - NOTHING diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test deleted file mode 100644 index edfb73d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"if" takes an expression as a test ---TEMPLATE-- -{% if a < 2 %} - A1 -{% elseif a > 10 %} - A2 -{% else %} - A3 -{% endif %} ---DATA-- -return array('a' => 1) ---EXPECT-- - A1 ---DATA-- -return array('a' => 12) ---EXPECT-- - A2 ---DATA-- -return array('a' => 7) ---EXPECT-- - A3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test deleted file mode 100644 index 8fe1a6c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -FOO -{% include "foo.twig" %} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array() ---EXPECT-- -FOO - -FOOBAR -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test deleted file mode 100644 index eaeeb11..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag allows expressions for the template to include ---TEMPLATE-- -FOO -{% include foo %} - -BAR ---TEMPLATE(foo.twig)-- -FOOBAR ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO - -FOOBAR -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test deleted file mode 100644 index 24aed06..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include ["foo.twig", "bar.twig"] ignore missing %} -{% include "foo.twig" ignore missing %} -{% include "foo.twig" ignore missing with {} %} -{% include "foo.twig" ignore missing with {} only %} ---DATA-- -return array() ---EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test deleted file mode 100644 index f25e871..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include "foo.twig" %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test deleted file mode 100644 index 86c1864..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/missing_nested.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% extends "base.twig" %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %} - {% include "foo.twig" %} -{% endblock %} ---DATA-- -return array(); ---EXCEPTION-- -Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test deleted file mode 100644 index 77760a0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"include" tag accept variables and only ---TEMPLATE-- -{% include "foo.twig" %} -{% include "foo.twig" only %} -{% include "foo.twig" with {'foo1': 'bar'} %} -{% include "foo.twig" with {'foo1': 'bar'} only %} ---TEMPLATE(foo.twig)-- -{% for k, v in _context %}{{ k }},{% endfor %} ---DATA-- -return array('foo' => 'bar') ---EXPECT-- -foo,global,_parent, -global,_parent, -foo,global,foo1,_parent, -foo1,global,_parent, diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test deleted file mode 100644 index 6ba064a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"include" tag accepts Twig_Template instance ---TEMPLATE-- -{% include foo %} FOO ---TEMPLATE(foo.twig)-- -BAR ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BAR FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test deleted file mode 100644 index ab670ee..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" tag ---TEMPLATE-- -{% include ["foo.twig", "bar.twig"] %} -{% include ["bar.twig", "foo.twig"] %} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test deleted file mode 100644 index 41384ac..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"include" tag accept variables ---TEMPLATE-- -{% include "foo.twig" with {'foo': 'bar'} %} -{% include "foo.twig" with vars %} ---TEMPLATE(foo.twig)-- -{{ foo }} ---DATA-- -return array('vars' => array('foo' => 'bar')) ---EXPECT-- -bar -bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test deleted file mode 100644 index 0778a4b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} -FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array() ---EXPECT-- -FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test deleted file mode 100644 index 9a81499..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -block_expr ---TEMPLATE-- -{% extends "base.twig" %} - -{% block element -%} - Element: - {{- parent() -}} -{% endblock %} ---TEMPLATE(base.twig)-- -{% spaceless %} -{% block element -%} -
    - {%- if item.children is defined %} - {%- for item in item.children %} - {{- block('element') -}} - {% endfor %} - {%- endif -%} -
    -{%- endblock %} -{% endspaceless %} ---DATA-- -return array( - 'item' => array( - 'children' => array( - null, - null, - ) - ) -) ---EXPECT-- -Element:
    Element:
    Element:
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test deleted file mode 100644 index 3e868c0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -block_expr2 ---TEMPLATE-- -{% extends "base2.twig" %} - -{% block element -%} - Element: - {{- parent() -}} -{% endblock %} ---TEMPLATE(base2.twig)-- -{% extends "base.twig" %} ---TEMPLATE(base.twig)-- -{% spaceless %} -{% block element -%} -
    - {%- if item.children is defined %} - {%- for item in item.children %} - {{- block('element') -}} - {% endfor %} - {%- endif -%} -
    -{%- endblock %} -{% endspaceless %} ---DATA-- -return array( - 'item' => array( - 'children' => array( - null, - null, - ) - ) -) ---EXPECT-- -Element:
    Element:
    Element:
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test deleted file mode 100644 index 8576e77..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends standalone ? foo : 'bar.twig' %} - -{% block content %}{{ parent() }}FOO{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}FOO{% endblock %} ---TEMPLATE(bar.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array('foo' => 'foo.twig', 'standalone' => true) ---EXPECT-- -FOOFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test deleted file mode 100644 index ee06ddc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends foo %} - -{% block content %} -FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}{% endblock %} ---DATA-- -return array('foo' => 'foo.twig') ---EXPECT-- -FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test deleted file mode 100644 index 784f357..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} ---TEMPLATE(foo.twig)-- -{% block content %}FOO{% endblock %} ---DATA-- -return array() ---EXPECT-- -FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test deleted file mode 100644 index a1cb1ce..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends ["foo.twig", "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test deleted file mode 100644 index acc74f6..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_empty_name.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends ["", "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test deleted file mode 100644 index cfa648d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array_with_null_name.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends [null, "bar.twig"] %} ---TEMPLATE(bar.twig)-- -{% block content %} -foo -{% endblock %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test deleted file mode 100644 index dfc2b6c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} ---TEMPLATE(layout.twig)-- -{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} ---TEMPLATE(base.twig)-- -{% block content %}base {% endblock %} ---DATA-- -return array() ---EXPECT-- -base layout index diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test deleted file mode 100644 index 1d3e639..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple_dynamic.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% set foo = 1 %} -{{ include('parent.twig') }} -{{ include('parent.twig') }} -{% set foo = 2 %} -{{ include('parent.twig') }} ---TEMPLATE(parent.twig)-- -{% extends foo~'_parent.twig' %}{% block content %}{{ parent() }} parent{% endblock %} ---TEMPLATE(1_parent.twig)-- -{% block content %}1{% endblock %} ---TEMPLATE(2_parent.twig)-- -{% block content %}2{% endblock %} ---DATA-- -return array() ---EXPECT-- -1 parent - -1 parent - -2 parent diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test deleted file mode 100644 index faca925..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} - {% block subcontent %} - {% block subsubcontent %} - SUBSUBCONTENT - {% endblock %} - {% endblock %} -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %} - {% block subcontent %} - SUBCONTENT - {% endblock %} -{% endblock %} ---DATA-- -return array() ---EXPECT-- -SUBSUBCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test deleted file mode 100644 index 0ad11d0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -"block" tag ---TEMPLATE-- -{% block content %} - CONTENT - {%- block subcontent -%} - SUBCONTENT - {%- endblock -%} - ENDCONTENT -{% endblock %} ---TEMPLATE(foo.twig)-- ---DATA-- -return array() ---EXPECT-- -CONTENTSUBCONTENTENDCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test deleted file mode 100644 index 71e3cdf..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "layout.twig" %} -{% block inside %}INSIDE{% endblock inside %} ---TEMPLATE(layout.twig)-- -{% extends "base.twig" %} -{% block body %} - {% block inside '' %} -{% endblock body %} ---TEMPLATE(base.twig)-- -{% block body '' %} ---DATA-- -return array() ---EXPECT-- -INSIDE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test deleted file mode 100644 index 4f975db..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array() ---EXPECT-- -BARFOOBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test deleted file mode 100644 index a8bc90c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends foo ? 'foo.twig' : 'bar.twig' %} ---TEMPLATE(foo.twig)-- -FOO ---TEMPLATE(bar.twig)-- -BAR ---DATA-- -return array('foo' => true) ---EXPECT-- -FOO ---DATA-- -return array('foo' => false) ---EXPECT-- -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test deleted file mode 100644 index cca6dbc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% block content %} - {% extends "foo.twig" %} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test deleted file mode 100644 index 6281671..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "base.twig" %} -{% block content %}{% include "included.twig" %}{% endblock %} - -{% block footer %}Footer{% endblock %} ---TEMPLATE(included.twig)-- -{% extends "base.twig" %} -{% block content %}Included Content{% endblock %} ---TEMPLATE(base.twig)-- -{% block content %}Default Content{% endblock %} - -{% block footer %}Default Footer{% endblock %} ---DATA-- -return array() ---EXPECT-- -Included Content -Default Footer -Footer diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test deleted file mode 100644 index 71e7c20..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -"extends" tag ---TEMPLATE-- -{% extends "foo.twig" %} - -{% block content %} - {% block inside %} - INSIDE OVERRIDDEN - {% endblock %} - - BEFORE - {{ parent() }} - AFTER -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %} - BAR -{% endblock %} ---DATA-- -return array() ---EXPECT-- - -INSIDE OVERRIDDEN - - BEFORE - BAR - - AFTER diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test deleted file mode 100644 index e29b1ac..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"parent" tag ---TEMPLATE-- -{% block content %} - {{ parent() }} -{% endblock %} ---EXCEPTION-- -Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test deleted file mode 100644 index 63c7305..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"parent" tag ---TEMPLATE-- -{% use 'foo.twig' %} - -{% block content %} - {{ parent() }} -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array() ---EXPECT-- -BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test deleted file mode 100644 index d1876a5..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"extends" tag accepts Twig_Template instance ---TEMPLATE-- -{% extends foo %} - -{% block content %} -{{ parent() }}FOO -{% endblock %} ---TEMPLATE(foo.twig)-- -{% block content %}BAR{% endblock %} ---DATA-- -return array('foo' => $twig->loadTemplate('foo.twig')) ---EXPECT-- -BARFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test deleted file mode 100644 index 8f9ece7..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -"parent" function ---TEMPLATE-- -{% extends "parent.twig" %} - -{% use "use1.twig" %} -{% use "use2.twig" %} - -{% block content_parent %} - {{ parent() }} -{% endblock %} - -{% block content_use1 %} - {{ parent() }} -{% endblock %} - -{% block content_use2 %} - {{ parent() }} -{% endblock %} - -{% block content %} - {{ block('content_use1_only') }} - {{ block('content_use2_only') }} -{% endblock %} ---TEMPLATE(parent.twig)-- -{% block content_parent 'content_parent' %} -{% block content_use1 'content_parent' %} -{% block content_use2 'content_parent' %} -{% block content '' %} ---TEMPLATE(use1.twig)-- -{% block content_use1 'content_use1' %} -{% block content_use2 'content_use1' %} -{% block content_use1_only 'content_use1_only' %} ---TEMPLATE(use2.twig)-- -{% block content_use2 'content_use2' %} -{% block content_use2_only 'content_use2_only' %} ---DATA-- -return array() ---EXPECT-- - content_parent - content_use1 - content_use2 - content_use1_only - content_use2_only diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test deleted file mode 100644 index eef0c10..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.input('username') }} -{{ macros.input('password', null, 'password', 1) }} - -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test deleted file mode 100644 index ae6203b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -"macro" tag supports name for endmacro ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.foo() }} -{{ macros.bar() }} - -{% macro foo() %}foo{% endmacro %} -{% macro bar() %}bar{% endmacro bar %} ---DATA-- -return array() ---EXPECT-- -foo -bar - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test deleted file mode 100644 index 5cd3dae..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import 'forms.twig' as forms %} - -{{ forms.input('username') }} -{{ forms.input('password', null, 'password', 1) }} ---TEMPLATE(forms.twig)-- -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test deleted file mode 100644 index 205f591..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% from 'forms.twig' import foo %} -{% from 'forms.twig' import foo as foobar, bar %} - -{{ foo('foo') }} -{{ foobar('foo') }} -{{ bar('foo') }} ---TEMPLATE(forms.twig)-- -{% macro foo(name) %}foo{{ name }}{% endmacro %} -{% macro bar(name) %}bar{{ name }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- -foofoo -foofoo -barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test deleted file mode 100644 index 6b37176..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% from 'forms.twig' import foo %} - -{{ foo('foo') }} -{{ foo() }} ---TEMPLATE(forms.twig)-- -{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} ---DATA-- -return array() ---EXPECT-- -fooglobal -fooglobal diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test deleted file mode 100644 index 17756cb..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"macro" tag ---TEMPLATE-- -{% import _self as forms %} - -{{ forms.input('username') }} -{{ forms.input('password', null, 'password', 1) }} - -{% macro input(name, value, type, size) %} - -{% endmacro %} ---DATA-- -return array() ---EXPECT-- - - - diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test deleted file mode 100644 index 3721770..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"§" as a macro name ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.§('foo') }} - -{% macro §(foo) %} - §{{ foo }}§ -{% endmacro %} ---DATA-- -return array() ---EXPECT-- -§foo§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test deleted file mode 100644 index 5679462..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/super_globals.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Super globals as macro arguments ---TEMPLATE-- -{% import _self as macros %} - -{{ macros.foo('foo') }} - -{% macro foo(GET) %} - {{ GET }} -{% endmacro %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test deleted file mode 100644 index dfddc15..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} - a -{%- endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test deleted file mode 100644 index a33a13e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} - - {% if 1 %} - {%- include "foo.twig" %} - {% endif %} -{%- endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---EXCEPTION-- -Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test deleted file mode 100644 index de20f3d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -sandbox tag ---TEMPLATE-- -{%- sandbox %} - {%- include "foo.twig" %} -{%- endsandbox %} - -{%- sandbox %} - {%- include "foo.twig" %} - {%- include "foo.twig" %} -{%- endsandbox %} - -{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} ---TEMPLATE(foo.twig)-- -foo ---DATA-- -return array() ---EXPECT-- -foo -foo -foo -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test deleted file mode 100644 index a5a9f83..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -"set" tag ---TEMPLATE-- -{% set foo = 'foo' %} -{% set bar = 'foo
    ' %} - -{{ foo }} -{{ bar }} - -{% set foo, bar = 'foo', 'bar' %} - -{{ foo }}{{ bar }} ---DATA-- -return array() ---EXPECT-- -foo -foo<br /> - - -foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test deleted file mode 100644 index ec657f0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -"set" tag block empty capture ---TEMPLATE-- -{% set foo %}{% endset %} - -{% if foo %}FAIL{% endif %} ---DATA-- -return array() ---EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test deleted file mode 100644 index f156a1a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"set" tag block capture ---TEMPLATE-- -{% set foo %}f
    o
    o{% endset %} - -{{ foo }} ---DATA-- -return array() ---EXPECT-- -f
    o
    o diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test deleted file mode 100644 index 8ff434a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"set" tag ---TEMPLATE-- -{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} - -{{ foo }} -{{ bar }} ---DATA-- -return array() ---EXPECT-- -foobar -barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test deleted file mode 100644 index dd06dec..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"spaceless" tag removes whites between HTML tags ---TEMPLATE-- -{% spaceless %} - -
    foo
    - -{% endspaceless %} ---DATA-- -return array() ---EXPECT-- -
    foo
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test deleted file mode 100644 index 789b4ba..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -"§" custom tag ---TEMPLATE-- -{% § %} ---DATA-- -return array() ---EXPECT-- -§ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test deleted file mode 100644 index 1d2273f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -Whitespace trimming on tags. ---TEMPLATE-- -{{ 5 * '{#-'|length }} -{{ '{{-'|length * 5 + '{%-'|length }} - -Trim on control tag: -{% for i in range(1, 9) -%} - {{ i }} -{%- endfor %} - - -Trim on output tag: -{% for i in range(1, 9) %} - {{- i -}} -{% endfor %} - - -Trim comments: - -{#- Invisible -#} - -After the comment. - -Trim leading space: -{% if leading %} - - {{- leading }} -{% endif %} - -{%- if leading %} - {{- leading }} - -{%- endif %} - - -Trim trailing space: -{% if trailing -%} - {{ trailing -}} - -{% endif -%} - -Combined: - -{%- if both -%} -
      -
    • {{- both -}}
    • -
    - -{%- endif -%} - -end ---DATA-- -return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') ---EXPECT-- -15 -18 - -Trim on control tag: -123456789 - -Trim on output tag: -123456789 - -Trim comments:After the comment. - -Trim leading space: -leading space -leading space - -Trim trailing space: -trailing spaceCombined:
      -
    • both
    • -
    end diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test deleted file mode 100644 index f887006..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "blocks.twig" with content as foo %} - -{{ block('foo') }} ---TEMPLATE(blocks.twig)-- -{% block content 'foo' %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test deleted file mode 100644 index 7364d76..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "blocks.twig" %} - -{{ block('content') }} ---TEMPLATE(blocks.twig)-- -{% block content 'foo' %} ---DATA-- -return array() ---EXPECT-- -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test deleted file mode 100644 index b551a1e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} ---TEMPLATE(foo.twig)-- -{% use "bar.twig" %} - -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -foo -foo -bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test deleted file mode 100644 index 05cca68..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} ---TEMPLATE(foo.twig)-- -{% use "bar.twig" %} ---TEMPLATE(bar.twig)-- ---DATA-- -return array() ---EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test deleted file mode 100644 index 0d0d470..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance.test +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "parent.twig" %} - -{{ block('container') }} ---TEMPLATE(parent.twig)-- -{% use "ancestor.twig" %} - -{% block sub_container %} -
    overridden sub_container
    -{% endblock %} ---TEMPLATE(ancestor.twig)-- -{% block container %} -
    {{ block('sub_container') }}
    -{% endblock %} - -{% block sub_container %} -
    sub_container
    -{% endblock %} ---DATA-- -return array() ---EXPECT-- -
    overridden sub_container
    -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test deleted file mode 100644 index df95599..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/inheritance2.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "ancestor.twig" %} -{% use "parent.twig" %} - -{{ block('container') }} ---TEMPLATE(parent.twig)-- -{% block sub_container %} -
    overridden sub_container
    -{% endblock %} ---TEMPLATE(ancestor.twig)-- -{% block container %} -
    {{ block('sub_container') }}
    -{% endblock %} - -{% block sub_container %} -
    sub_container
    -{% endblock %} ---DATA-- -return array() ---EXPECT-- -
    overridden sub_container
    -
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test deleted file mode 100644 index 198be0c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" %} -{% use "bar.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} ---TEMPLATE(foo.twig)-- -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -bar -foo -bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test deleted file mode 100644 index 8de871a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use "foo.twig" with content as foo_content %} -{% use "bar.twig" %} - -{{ block('content') }} -{{ block('foo') }} -{{ block('bar') }} -{{ block('foo_content') }} ---TEMPLATE(foo.twig)-- -{% block content 'foo' %} -{% block foo 'foo' %} ---TEMPLATE(bar.twig)-- -{% block content 'bar' %} -{% block bar 'bar' %} ---DATA-- -return array() ---EXPECT-- -bar -foo -bar -foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test deleted file mode 100644 index 59db23d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use 'file2.html.twig' with foobar as base_base_foobar %} -{% block foobar %} - {{- block('base_base_foobar') -}} - Content of block (second override) -{% endblock foobar %} ---TEMPLATE(file2.html.twig)-- -{% use 'file1.html.twig' with foobar as base_foobar %} -{% block foobar %} - {{- block('base_foobar') -}} - Content of block (first override) -{% endblock foobar %} ---TEMPLATE(file1.html.twig)-- -{% block foobar -%} - Content of block -{% endblock foobar %} ---DATA-- -return array() ---EXPECT-- -Content of block -Content of block (first override) -Content of block (second override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test deleted file mode 100644 index d3f302d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block2.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use 'file2.html.twig'%} -{% block foobar %} - {{- parent() -}} - Content of block (second override) -{% endblock foobar %} ---TEMPLATE(file2.html.twig)-- -{% use 'file1.html.twig' %} -{% block foobar %} - {{- parent() -}} - Content of block (first override) -{% endblock foobar %} ---TEMPLATE(file1.html.twig)-- -{% block foobar -%} - Content of block -{% endblock foobar %} ---DATA-- -return array() ---EXPECT-- -Content of block -Content of block (first override) -Content of block (second override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test deleted file mode 100644 index 95b55a4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/parent_block3.test +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -"use" tag ---TEMPLATE-- -{% use 'file2.html.twig' %} -{% use 'file1.html.twig' with foo %} -{% block foo %} - {{- parent() -}} - Content of foo (second override) -{% endblock foo %} -{% block bar %} - {{- parent() -}} - Content of bar (second override) -{% endblock bar %} ---TEMPLATE(file2.html.twig)-- -{% use 'file1.html.twig' %} -{% block foo %} - {{- parent() -}} - Content of foo (first override) -{% endblock foo %} -{% block bar %} - {{- parent() -}} - Content of bar (first override) -{% endblock bar %} ---TEMPLATE(file1.html.twig)-- -{% block foo -%} - Content of foo -{% endblock foo %} -{% block bar -%} - Content of bar -{% endblock bar %} ---DATA-- -return array() ---EXPECT-- -Content of foo -Content of foo (first override) -Content of foo (second override) -Content of bar -Content of bar (second override) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test deleted file mode 100644 index 3fe2ad8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/use_with_parent.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -"use" tag with a parent block ---TEMPLATE-- -{% extends "parent.twig" %} - -{% use 'blocks.twig' %} - -{% block body %} - {{ parent() -}} - CHILD - {{ block('content') }} -{% endblock %} ---TEMPLATE(parent.twig)-- -{% block body %} - PARENT -{% endblock %} ---TEMPLATE(blocks.twig)-- -{% block content 'BLOCK' %} ---DATA-- -return array() ---EXPECT-- -PARENT -CHILD - BLOCK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test deleted file mode 100644 index a95be55..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/basic.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"verbatim" tag ---TEMPLATE-- -{% verbatim %} -{{ foo }} -{% endverbatim %} ---DATA-- -return array() ---EXPECT-- -{{ foo }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test deleted file mode 100644 index eb61044..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/verbatim/whitespace_control.test +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -"verbatim" tag ---TEMPLATE-- -1*** - -{%- verbatim %} - {{ 'bla' }} -{% endverbatim %} - -1*** -2*** - -{%- verbatim -%} - {{ 'bla' }} -{% endverbatim %} - -2*** -3*** - -{%- verbatim -%} - {{ 'bla' }} -{% endverbatim -%} - -3*** -4*** - -{%- verbatim -%} - {{ 'bla' }} -{%- endverbatim %} - -4*** -5*** - -{%- verbatim -%} - {{ 'bla' }} -{%- endverbatim -%} - -5*** ---DATA-- -return array() ---EXPECT-- -1*** - {{ 'bla' }} - - -1*** -2***{{ 'bla' }} - - -2*** -3***{{ 'bla' }} -3*** -4***{{ 'bla' }} - -4*** -5***{{ 'bla' }}5*** diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test deleted file mode 100644 index 264ca5e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -"with" tag ---TEMPLATE-- -{% with %} - {% set bar = 'BAZ' %} - {{ foo }}{{ bar }} -{% endwith %} -{{ foo }}{{ bar }} ---DATA-- -return array('foo' => 'foo', 'bar' => 'bar') ---EXPECT-- -fooBAZ -foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test deleted file mode 100644 index 32ed091..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"with" tag with expression ---TEMPLATE-- -{% with {foo: 'foo', bar: 'BAZ'} %} - {{ foo }}{{ bar }} -{% endwith %} ---DATA-- -return array('foo' => 'baz') ---EXPECT-- -fooBAZ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test deleted file mode 100644 index 98e3aef..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -nested "with" tags ---TEMPLATE-- -{% set foo, bar = 'foo', 'bar' %} -{% with {bar: 'BAZ'} %} - {% with {foo: 'FOO'} %} - {{ foo }}{{ bar }} - {% endwith %} -{% endwith %} -{{ foo }}{{ bar }} ---DATA-- -return array() ---EXPECT-- -FOOBAZ - foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test deleted file mode 100644 index 93689f4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"with" tag with an expression that is not a hash ---TEMPLATE-- -{% with vars %} - {{ foo }}{{ bar }} -{% endwith %} ---DATA-- -return array('vars' => 'no-hash') ---EXCEPTION-- -Twig_Error_Runtime: Variables passed to the "with" tag must be a hash in "index.twig" at line 2. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test deleted file mode 100644 index 6247617..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"with" tag with expression and only ---TEMPLATE-- -{% with {foo: 'foo', bar: 'BAZ'} only %} - {{ foo }}{{ bar }}{{ baz }} -{% endwith %} ---DATA-- -return array('foo' => 'baz', 'baz' => 'baz') ---EXCEPTION-- -Twig_Error_Runtime: Variable "baz" does not exist in "index.twig" at line 3. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test deleted file mode 100644 index 1429d37..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -array index test ---TEMPLATE-- -{% for key, value in days %} -{{ key }} -{% endfor %} ---DATA-- -return array('days' => array( - 1 => array('money' => 9), - 2 => array('money' => 21), - 3 => array('money' => 38), - 4 => array('money' => 6), - 18 => array('money' => 6), - 19 => array('money' => 3), - 31 => array('money' => 11), -)); ---EXPECT-- -1 -2 -3 -4 -18 -19 -31 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test deleted file mode 100644 index 60218ac..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"const" test ---TEMPLATE-- -{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} -{{ 'bar' is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} -{{ value is constant('TwigTestFoo::BAR_NAME') ? 'ok' : 'no' }} -{{ 2 is constant('ARRAY_AS_PROPS', object) ? 'ok' : 'no' }} ---DATA-- -return array('value' => 'bar', 'object' => new ArrayObject(array('hi'))); ---EXPECT-- -ok -ok -ok -ok \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test deleted file mode 100644 index d4e204e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test +++ /dev/null @@ -1,129 +0,0 @@ ---TEST-- -"defined" test ---TEMPLATE-- -{{ definedVar is defined ? 'ok' : 'ko' }} -{{ definedVar is not defined ? 'ko' : 'ok' }} -{{ undefinedVar is defined ? 'ko' : 'ok' }} -{{ undefinedVar is not defined ? 'ok' : 'ko' }} -{{ zeroVar is defined ? 'ok' : 'ko' }} -{{ nullVar is defined ? 'ok' : 'ko' }} -{{ nested.definedVar is defined ? 'ok' : 'ko' }} -{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} -{{ nested.definedVar is not defined ? 'ko' : 'ok' }} -{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} -{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} -{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} -{{ nested.zeroVar is defined ? 'ok' : 'ko' }} -{{ nested.nullVar is defined ? 'ok' : 'ko' }} -{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} -{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} -{{ object.foo is defined ? 'ok' : 'ko' }} -{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} -{{ object.getFoo() is defined ? 'ok' : 'ko' }} -{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} -{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} -{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} -{{ object.self.foo is defined ? 'ok' : 'ko' }} -{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} -{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} -{{ 0 is defined ? 'ok' : 'ko' }} -{{ "foo" is defined ? 'ok' : 'ko' }} -{{ true is defined ? 'ok' : 'ko' }} -{{ false is defined ? 'ok' : 'ko' }} -{{ null is defined ? 'ok' : 'ko' }} -{{ [1, 2] is defined ? 'ok' : 'ko' }} -{{ { foo: "bar" } is defined ? 'ok' : 'ko' }} ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -); ---EXPECT-- -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok ---DATA-- -return array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'nested' => array( - 'definedVar' => 'defined', - 'zeroVar' => 0, - 'nullVar' => null, - 'definedArray' => array(0), - ), - 'object' => new TwigTestFoo(), -); ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test deleted file mode 100644 index 4a5b8dc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -"defined" support for attribute ---TEMPLATE-- -{{ attribute(nested, "definedVar") is defined ? 'ok' : 'ko' }} -{{ attribute(nested, "undefinedVar") is not defined ? 'ok' : 'ko' }} -{{ attribute(nested, definedVarName) is defined ? 'ok' : 'ko' }} -{{ attribute(nested, undefinedVarName) is not defined ? 'ok' : 'ko' }} ---DATA-- -return array( - 'nested' => array( - 'definedVar' => 'defined', - ), - 'definedVarName' => 'definedVar', - 'undefinedVarName' => 'undefinedVar', -); ---EXPECT-- -ok -ok -ok -ok ---DATA-- -return array( - 'nested' => array( - 'definedVar' => 'defined', - ), - 'definedVarName' => 'definedVar', - 'undefinedVarName' => 'undefinedVar', -); ---CONFIG-- -return array('strict_variables' => false) ---EXPECT-- -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test deleted file mode 100644 index 64d7d04..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -"defined" support for blocks ---TEMPLATE-- -{% extends 'parent' %} -{% block icon %}icon{% endblock %} -{% block body %} - {{ parent() }} - {{ block('foo') is defined ? 'ok' : 'ko' }} - {{ block('footer') is defined ? 'ok' : 'ko' }} - {{ block('icon') is defined ? 'ok' : 'ko' }} - {{ block('block1') is defined ? 'ok' : 'ko' }} - {%- embed 'embed' %} - {% block content %}content{% endblock %} - {% endembed %} -{% endblock %} -{% use 'blocks' %} ---TEMPLATE(parent)-- -{% block body %} - {{ block('icon') is defined ? 'ok' : 'ko' -}} -{% endblock %} -{% block footer %}{% endblock %} ---TEMPLATE(embed)-- -{{ block('icon') is defined ? 'ok' : 'ko' }} -{{ block('content') is defined ? 'ok' : 'ko' }} -{{ block('block1') is defined ? 'ok' : 'ko' }} ---TEMPLATE(blocks)-- -{% block block1 %}{%endblock %} ---DATA-- -return array() ---EXPECT-- -ok - ko - ok - ok - ok -ko -ok -ko diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test deleted file mode 100644 index 2c65165..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -"defined" support for blocks with a template argument ---TEMPLATE-- -{{ block('foo', 'included.twig') is defined ? 'ok' : 'ko' }} -{{ block('foo', included_loaded) is defined ? 'ok' : 'ko' }} -{{ block('foo', included_loaded_internal) is defined ? 'ok' : 'ko' }} ---TEMPLATE(included.twig)-- -{% block foo %}FOO{% endblock %} ---DATA-- -return array( - 'included_loaded' => $twig->load('included.twig'), - 'included_loaded_internal' => $twig->loadTemplate('included.twig'), -) ---EXPECT-- -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test deleted file mode 100644 index 2fa9929..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"defined" support for constants ---TEMPLATE-- -{{ constant('DATE_W3C') is defined ? 'ok' : 'ko' }} -{{ constant('ARRAY_AS_PROPS', object) is defined ? 'ok' : 'ko' }} -{{ constant('FOOBAR') is not defined ? 'ok' : 'ko' }} -{{ constant('FOOBAR', object) is not defined ? 'ok' : 'ko' }} ---DATA-- -return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))); ---EXPECT-- -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test deleted file mode 100644 index 807c0ed..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -"empty" test ---TEMPLATE-- -{{ string_empty is empty ? 'ok' : 'ko' }} -{{ string_zero is empty ? 'ko' : 'ok' }} -{{ value_null is empty ? 'ok' : 'ko' }} -{{ value_false is empty ? 'ok' : 'ko' }} -{{ value_int_zero is empty ? 'ko' : 'ok' }} -{{ array_empty is empty ? 'ok' : 'ko' }} -{{ array_not_empty is empty ? 'ko' : 'ok' }} -{{ magically_callable is empty ? 'ko' : 'ok' }} -{{ countable_empty is empty ? 'ok' : 'ko' }} -{{ countable_not_empty is empty ? 'ko' : 'ok' }} -{{ tostring_empty is empty ? 'ok' : 'ko' }} -{{ tostring_not_empty is empty ? 'ko' : 'ok' }} -{{ markup_empty is empty ? 'ok' : 'ko' }} -{{ markup_not_empty is empty ? 'ko' : 'ok' }} ---DATA-- -return array( - 'string_empty' => '', 'string_zero' => '0', - 'value_null' => null, 'value_false' => false, 'value_int_zero' => 0, - 'array_empty' => array(), 'array_not_empty' => array(1, 2), - 'magically_callable' => new MagicCallStub(), - 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), - 'tostring_empty' => new ToStringStub(''), 'tostring_not_empty' => new ToStringStub('0' /* edge case of using "0" as the string */), - 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), -); ---EXPECT-- -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test deleted file mode 100644 index 695b4c2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -"even" test ---TEMPLATE-- -{{ 1 is even ? 'ko' : 'ok' }} -{{ 2 is even ? 'ok' : 'ko' }} -{{ 1 is not even ? 'ok' : 'ko' }} -{{ 2 is not even ? 'ko' : 'ok' }} ---DATA-- -return array() ---EXPECT-- -ok -ok -ok -ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test deleted file mode 100644 index fc7c3b2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test +++ /dev/null @@ -1,128 +0,0 @@ ---TEST-- -Twig supports the in operator ---TEMPLATE-- -{% if bar in foo %} -TRUE -{% endif %} -{% if not (bar in foo) %} -{% else %} -TRUE -{% endif %} -{% if bar not in foo %} -{% else %} -TRUE -{% endif %} -{% if 'a' in bar %} -TRUE -{% endif %} -{% if 'c' not in bar %} -TRUE -{% endif %} -{% if '' in bar %} -TRUE -{% endif %} -{% if '' in '' %} -TRUE -{% endif %} -{% if '0' not in '' %} -TRUE -{% endif %} -{% if 'a' not in '0' %} -TRUE -{% endif %} -{% if '0' in '0' %} -TRUE -{% endif %} - -{{ false in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ true in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }} - -{{ '' in 'foo' ? 'TRUE' : 'FALSE' }} -{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in '100' ? 'TRUE' : 'FALSE' }} -{{ true in '100' ? 'TRUE' : 'FALSE' }} - -{{ [] in [true, false] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, []] ? 'TRUE' : 'FALSE' }} - -{{ resource ? 'TRUE' : 'FALSE' }} -{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }} -{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }} -{{ [] in 'Array' ? 'TRUE' : 'FALSE' }} -{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }} - -{{ ''~resource in resource ? 'TRUE' : 'FALSE' }} -{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }} -{{ 'Array' in [] ? 'TRUE' : 'FALSE' }} -{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }} - -{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }} -{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }} -{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }} - -{{ 5 in 125 ? 'TRUE' : 'FALSE' }} -{{ 5 in '125' ? 'TRUE' : 'FALSE' }} -{{ '5' in 125 ? 'TRUE' : 'FALSE' }} -{{ '5' in '125' ? 'TRUE' : 'FALSE' }} - -{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }} -{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} -{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} ---DATA-- -return array('bar' => 'bar', 'foo' => array('bar' => 'bar'), 'dir_object' => new SplFileInfo(__DIR__), 'object' => new stdClass(), 'resource' => opendir(__DIR__)) ---EXPECT-- -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -TRUE -FALSE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE - -FALSE -TRUE -FALSE -TRUE - -FALSE -TRUE -FALSE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test deleted file mode 100644 index 8e08061..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in_with_objects.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Twig supports the in operator when using objects ---TEMPLATE-- -{% if object in object_list %} -TRUE -{% endif %} ---DATA-- -$foo = new TwigTestFoo(); -$foo1 = new TwigTestFoo(); - -$foo->position = $foo1; -$foo1->position = $foo; - -return array( - 'object' => $foo, - 'object_list' => array($foo1, $foo), -); ---EXPECT-- -TRUE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test deleted file mode 100644 index ec52550..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -"iterable" test ---TEMPLATE-- -{{ foo is iterable ? 'ok' : 'ko' }} -{{ traversable is iterable ? 'ok' : 'ko' }} -{{ obj is iterable ? 'ok' : 'ko' }} -{{ val is iterable ? 'ok' : 'ko' }} ---DATA-- -return array( - 'foo' => array(), - 'traversable' => new ArrayIterator(array()), - 'obj' => new stdClass(), - 'val' => 'test', -); ---EXPECT-- -ok -ok -ko -ko \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test deleted file mode 100644 index 3d148c8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Twig supports the ?? operator ---TEMPLATE-- -{{ 'OK' ?? 'KO' }} -{{ null ?? 'OK' }} -{{ bar ?? 'KO' }} -{{ baz ?? 'OK' }} -{{ foo.bar ?? 'KO' }} -{{ foo.missing ?? 'OK' }} -{{ foo.bar.baz.missing ?? 'OK' }} -{{ foo['bar'] ?? 'KO' }} -{{ foo['missing'] ?? 'OK' }} -{{ nope ?? nada ?? 'OK' }} -{{ 1 + nope ?? nada ?? 2 }} -{{ 1 + nope ?? 3 + nada ?? 2 }} ---DATA-- -return array('bar' => 'OK', 'foo' => array('bar' => 'OK')) ---EXPECT-- -OK -OK -OK -OK -OK -OK -OK -OK -OK -OK -3 -6 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test deleted file mode 100644 index 1b8311e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -"odd" test ---TEMPLATE-- -{{ 1 is odd ? 'ok' : 'ko' }} -{{ 2 is odd ? 'ko' : 'ok' }} ---DATA-- -return array() ---EXPECT-- -ok -ok \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php b/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php deleted file mode 100644 index 8124491..0000000 --- a/vendor/twig/twig/test/Twig/Tests/IntegrationTest.php +++ /dev/null @@ -1,311 +0,0 @@ -position = 0; - } - - public function current() - { - return $this->array[$this->position]; - } - - public function key() - { - return 'a'; - } - - public function next() - { - ++$this->position; - } - - public function valid() - { - return isset($this->array[$this->position]); - } -} - -class TwigTestTokenParser_§ extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Print(new Twig_Node_Expression_Constant('§', -1), -1); - } - - public function getTag() - { - return '§'; - } -} - -class TwigTestExtension extends Twig_Extension -{ - public function getTokenParsers() - { - return array( - new TwigTestTokenParser_§(), - ); - } - - public function getFilters() - { - return array( - new Twig_Filter('§', array($this, '§Filter')), - new Twig_Filter('escape_and_nl2br', array($this, 'escape_and_nl2br'), array('needs_environment' => true, 'is_safe' => array('html'))), - new Twig_Filter('nl2br', array($this, 'nl2br'), array('pre_escape' => 'html', 'is_safe' => array('html'))), - new Twig_Filter('escape_something', array($this, 'escape_something'), array('is_safe' => array('something'))), - new Twig_Filter('preserves_safety', array($this, 'preserves_safety'), array('preserves_safety' => array('html'))), - new Twig_Filter('static_call_string', 'TwigTestExtension::staticCall'), - new Twig_Filter('static_call_array', array('TwigTestExtension', 'staticCall')), - new Twig_Filter('magic_call', array($this, 'magicCall')), - new Twig_Filter('magic_call_string', 'TwigTestExtension::magicStaticCall'), - new Twig_Filter('magic_call_array', array('TwigTestExtension', 'magicStaticCall')), - new Twig_Filter('*_path', array($this, 'dynamic_path')), - new Twig_Filter('*_foo_*_bar', array($this, 'dynamic_foo')), - new Twig_Filter('anon_foo', function ($name) { return '*'.$name.'*'; }), - ); - } - - public function getFunctions() - { - return array( - new Twig_Function('§', array($this, '§Function')), - new Twig_Function('safe_br', array($this, 'br'), array('is_safe' => array('html'))), - new Twig_Function('unsafe_br', array($this, 'br')), - new Twig_Function('static_call_string', 'TwigTestExtension::staticCall'), - new Twig_Function('static_call_array', array('TwigTestExtension', 'staticCall')), - new Twig_Function('*_path', array($this, 'dynamic_path')), - new Twig_Function('*_foo_*_bar', array($this, 'dynamic_foo')), - new Twig_Function('anon_foo', function ($name) { return '*'.$name.'*'; }), - ); - } - - public function getTests() - { - return array( - new Twig_Test('multi word', array($this, 'is_multi_word')), - ); - } - - public function §Filter($value) - { - return "§{$value}§"; - } - - public function §Function($value) - { - return "§{$value}§"; - } - - /** - * nl2br which also escapes, for testing escaper filters. - */ - public function escape_and_nl2br($env, $value, $sep = '
    ') - { - return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); - } - - /** - * nl2br only, for testing filters with pre_escape. - */ - public function nl2br($value, $sep = '
    ') - { - // not secure if $value contains html tags (not only entities) - // don't use - return str_replace("\n", "$sep\n", $value); - } - - public function dynamic_path($element, $item) - { - return $element.'/'.$item; - } - - public function dynamic_foo($foo, $bar, $item) - { - return $foo.'/'.$bar.'/'.$item; - } - - public function escape_something($value) - { - return strtoupper($value); - } - - public function preserves_safety($value) - { - return strtoupper($value); - } - - public static function staticCall($value) - { - return "*$value*"; - } - - public function br() - { - return '
    '; - } - - public function is_multi_word($value) - { - return false !== strpos($value, ' '); - } - - public function __call($method, $arguments) - { - if ('magicCall' !== $method) { - throw new BadMethodCallException('Unexpected call to __call'); - } - - return 'magic_'.$arguments[0]; - } - - public static function __callStatic($method, $arguments) - { - if ('magicStaticCall' !== $method) { - throw new BadMethodCallException('Unexpected call to __callStatic'); - } - - return 'static_magic_'.$arguments[0]; - } -} - -/** - * This class is used in tests for the "length" filter and "empty" test. It asserts that __call is not - * used to convert such objects to strings. - */ -class MagicCallStub -{ - public function __call($name, $args) - { - throw new Exception('__call shall not be called'); - } -} - -class ToStringStub -{ - /** - * @var string - */ - private $string; - - public function __construct($string) - { - $this->string = $string; - } - - public function __toString() - { - return $this->string; - } -} - -/** - * This class is used in tests for the length filter and empty test to show - * that when \Countable is implemented, it is preferred over the __toString() - * method. - */ -class CountableStub implements \Countable -{ - private $count; - - public function __construct($count) - { - $this->count = $count; - } - - public function count() - { - return $this->count; - } - - public function __toString() - { - throw new Exception('__toString shall not be called on \Countables'); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test deleted file mode 100644 index b091ad3..0000000 --- a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/autoescape/filename.legacy.test +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -"filename" autoescape strategy ---TEMPLATE-- -{{ br -}} -{{ include('index.html.twig') -}} -{{ include('index.txt.twig') -}} ---TEMPLATE(index.html.twig)-- -{{ br -}} ---TEMPLATE(index.txt.twig)-- -{{ br -}} ---DATA-- -return array('br' => '
    ') ---CONFIG-- -return array('autoescape' => 'filename') ---EXPECT-- -<br /> -<br /> -
    diff --git a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test b/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test deleted file mode 100644 index 62e24f0..0000000 --- a/vendor/twig/twig/test/Twig/Tests/LegacyFixtures/functions/undefined_block.legacy.test +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -"block" function with undefined block ---TEMPLATE-- -{% extends "base.twig" %} -{% block foo %}{{ parent() }}{{ block('unknown') }}{{ block('bar') }}{% endblock %} ---TEMPLATE(base.twig)-- -{% block foo %}Foo{% endblock %} -{% block bar %}Bar{% endblock %} ---DATA-- -return array() ---EXPECT-- -FooBarBar diff --git a/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/vendor/twig/twig/test/Twig/Tests/LexerTest.php deleted file mode 100644 index b99ba74..0000000 --- a/vendor/twig/twig/test/Twig/Tests/LexerTest.php +++ /dev/null @@ -1,337 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); - } - - public function testNameLabelForFunction() - { - $template = '{{ §() }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - - $stream->expect(Twig_Token::VAR_START_TYPE); - $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); - } - - public function testBracketsNesting() - { - $template = '{{ {"a":{"b":"c"}} }}'; - - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); - $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); - } - - protected function countToken($template, $type, $value = null) - { - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - - $count = 0; - while (!$stream->isEOF()) { - $token = $stream->next(); - if ($type === $token->getType()) { - if (null === $value || $value === $token->getValue()) { - ++$count; - } - } - } - - return $count; - } - - public function testLineDirective() - { - $template = "foo\n" - ."bar\n" - ."{% line 10 %}\n" - ."{{\n" - ."baz\n" - ."}}\n"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - - // foo\nbar\n - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // \n (after {% line %}) - $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // {{ - $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); - // baz - $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); - } - - public function testLineDirectiveInline() - { - $template = "foo\n" - ."bar{% line 10 %}{{\n" - ."baz\n" - ."}}\n"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - - // foo\nbar - $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); - // {{ - $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); - // baz - $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); - } - - public function testLongComments() - { - $template = '{# '.str_repeat('*', 100000).' #}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testLongVerbatim() - { - $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testLongVar() - { - $template = '{{ '.str_repeat('x', 100000).' }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testLongBlock() - { - $template = '{% '.str_repeat('x', 100000).' %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testBigNumbers() - { - $template = '{{ 922337203685477580700 }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->next(); - $node = $stream->next(); - $this->assertEquals('922337203685477580700', $node->getValue()); - } - - public function testStringWithEscapedDelimiter() - { - $tests = array( - "{{ 'foo \' bar' }}" => 'foo \' bar', - '{{ "foo \" bar" }}' => 'foo " bar', - ); - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - foreach ($tests as $template => $expected) { - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, $expected); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - } - - public function testStringWithInterpolation() - { - $template = 'foo {{ "bar #{ baz + 1 }" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'baz'); - $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); - $stream->expect(Twig_Token::NUMBER_TYPE, '1'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testStringWithEscapedInterpolation() - { - $template = '{{ "bar \#{baz+1}" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); - $stream->expect(Twig_Token::VAR_END_TYPE); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testStringWithHash() - { - $template = '{{ "bar # baz" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); - $stream->expect(Twig_Token::VAR_END_TYPE); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed """ - */ - public function testStringWithUnterminatedInterpolation() - { - $template = '{{ "bar #{x" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - } - - public function testStringWithNestedInterpolations() - { - $template = '{{ "bar #{ "foo#{bar}" }" }}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::VAR_END_TYPE); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testStringWithNestedInterpolationsInBlock() - { - $template = '{% foo "bar #{ "foo#{bar}" }" %}'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::BLOCK_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'foo'); - $stream->expect(Twig_Token::STRING_TYPE, 'bar '); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::STRING_TYPE, 'foo'); - $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); - $stream->expect(Twig_Token::NAME_TYPE, 'bar'); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - public function testOperatorEndingWithALetterAtTheEndOfALine() - { - $template = "{{ 1 and\n0}}"; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $stream = $lexer->tokenize(new Twig_Source($template, 'index')); - $stream->expect(Twig_Token::VAR_START_TYPE); - $stream->expect(Twig_Token::NUMBER_TYPE, 1); - $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); - - // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above - // can be executed without throwing any exceptions - $this->addToAssertionCount(1); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed "variable" in "index" at line 3 - */ - public function testUnterminatedVariable() - { - $template = ' - -{{ - -bar - - -'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unclosed "block" in "index" at line 3 - */ - public function testUnterminatedBlock() - { - $template = ' - -{% - -bar - - -'; - - $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $lexer->tokenize(new Twig_Source($template, 'index')); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php deleted file mode 100644 index 1fc9d2d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php +++ /dev/null @@ -1,86 +0,0 @@ -getSourceContext('foo'); - } - - public function testGetCacheKey() - { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); - - $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); - } - - public function testGetCacheKeyWhenTemplateHasDuplicateContent() - { - $loader = new Twig_Loader_Array(array( - 'foo' => 'bar', - 'baz' => 'bar', - )); - - $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); - $this->assertEquals('baz:bar', $loader->getCacheKey('baz')); - } - - public function testGetCacheKeyIsProtectedFromEdgeCollisions() - { - $loader = new Twig_Loader_Array(array( - 'foo__' => 'bar', - 'foo' => '__bar', - )); - - $this->assertEquals('foo__:bar', $loader->getCacheKey('foo__')); - $this->assertEquals('foo:__bar', $loader->getCacheKey('foo')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetCacheKeyWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Array(array()); - - $loader->getCacheKey('foo'); - } - - public function testSetTemplate() - { - $loader = new Twig_Loader_Array(array()); - $loader->setTemplate('foo', 'bar'); - - $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); - } - - public function testIsFresh() - { - $loader = new Twig_Loader_Array(array('foo' => 'bar')); - $this->assertTrue($loader->isFresh('foo', time())); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testIsFreshWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Array(array()); - - $loader->isFresh('foo', time()); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php deleted file mode 100644 index 44f01ae..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php +++ /dev/null @@ -1,90 +0,0 @@ - 'bar')), - new Twig_Loader_Array(array('errors/index.html' => 'baz')), - new Twig_Loader_Filesystem(array($path)), - )); - - $this->assertEquals('foo', $loader->getSourceContext('foo')->getName()); - $this->assertSame('', $loader->getSourceContext('foo')->getPath()); - - $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); - $this->assertSame('', $loader->getSourceContext('errors/index.html')->getPath()); - $this->assertEquals('baz', $loader->getSourceContext('errors/index.html')->getCode()); - - $this->assertEquals('errors/base.html', $loader->getSourceContext('errors/base.html')->getName()); - $this->assertEquals(realpath($path.'/errors/base.html'), realpath($loader->getSourceContext('errors/base.html')->getPath())); - $this->assertNotEquals('baz', $loader->getSourceContext('errors/base.html')->getCode()); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetSourceContextWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Chain(array()); - - $loader->getSourceContext('foo'); - } - - public function testGetCacheKey() - { - $loader = new Twig_Loader_Chain(array( - new Twig_Loader_Array(array('foo' => 'bar')), - new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), - )); - - $this->assertEquals('foo:bar', $loader->getCacheKey('foo')); - $this->assertEquals('bar:foo', $loader->getCacheKey('bar')); - } - - /** - * @expectedException Twig_Error_Loader - */ - public function testGetCacheKeyWhenTemplateDoesNotExist() - { - $loader = new Twig_Loader_Chain(array()); - - $loader->getCacheKey('foo'); - } - - public function testAddLoader() - { - $loader = new Twig_Loader_Chain(); - $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); - - $this->assertEquals('bar', $loader->getSourceContext('foo')->getCode()); - } - - public function testExists() - { - $loader1 = $this->getMockBuilder('Twig_LoaderInterface')->getMock(); - $loader1->expects($this->once())->method('exists')->will($this->returnValue(false)); - $loader1->expects($this->never())->method('getSourceContext'); - - $loader2 = $this->getMockBuilder('Twig_LoaderInterface')->getMock(); - $loader2->expects($this->once())->method('exists')->will($this->returnValue(true)); - $loader2->expects($this->never())->method('getSourceContext'); - - $loader = new Twig_Loader_Chain(); - $loader->addLoader($loader1); - $loader->addLoader($loader2); - - $this->assertTrue($loader->exists('foo')); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php deleted file mode 100644 index 02c47a8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +++ /dev/null @@ -1,223 +0,0 @@ -assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); - $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath())); - } - - /** - * @dataProvider getSecurityTests - */ - public function testSecurity($template) - { - $loader = new Twig_Loader_Filesystem(array(__DIR__.'/../Fixtures')); - - try { - $loader->getCacheKey($template); - $this->fail(); - } catch (Twig_Error_Loader $e) { - $this->assertNotContains('Unable to find template', $e->getMessage()); - } - } - - public function getSecurityTests() - { - return array( - array("AutoloaderTest\0.php"), - array('..\\AutoloaderTest.php'), - array('..\\\\\\AutoloaderTest.php'), - array('../AutoloaderTest.php'), - array('..////AutoloaderTest.php'), - array('./../AutoloaderTest.php'), - array('.\\..\\AutoloaderTest.php'), - array('././././././../AutoloaderTest.php'), - array('.\\./.\\./.\\./../AutoloaderTest.php'), - array('foo/../../AutoloaderTest.php'), - array('foo\\..\\..\\AutoloaderTest.php'), - array('foo/../bar/../../AutoloaderTest.php'), - array('foo/bar/../../../AutoloaderTest.php'), - array('filters/../../AutoloaderTest.php'), - array('filters//..//..//AutoloaderTest.php'), - array('filters\\..\\..\\AutoloaderTest.php'), - array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), - array('filters\\//../\\/\\..\\AutoloaderTest.php'), - array('/../AutoloaderTest.php'), - ); - } - - /** - * @dataProvider getBasePaths - */ - public function testPaths($basePath, $cacheKey, $rootPath) - { - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis'), $rootPath); - $loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named'); - $loader->addPath($basePath.'/named_ter', 'named'); - $loader->addPath($basePath.'/normal_ter'); - $loader->prependPath($basePath.'/normal_final'); - $loader->prependPath($basePath.'/named/../named_quater', 'named'); - $loader->prependPath($basePath.'/named_final', 'named'); - - $this->assertEquals(array( - $basePath.'/normal_final', - $basePath.'/normal', - $basePath.'/normal_bis', - $basePath.'/normal_ter', - ), $loader->getPaths()); - $this->assertEquals(array( - $basePath.'/named_final', - $basePath.'/named/../named_quater', - $basePath.'/named', - $basePath.'/named_bis', - $basePath.'/named_ter', - ), $loader->getPaths('named')); - - // do not use realpath here as it would make the test unuseful - $this->assertEquals($cacheKey, str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html'))); - $this->assertEquals("path (final)\n", $loader->getSourceContext('index.html')->getCode()); - $this->assertEquals("path (final)\n", $loader->getSourceContext('@__main__/index.html')->getCode()); - $this->assertEquals("named path (final)\n", $loader->getSourceContext('@named/index.html')->getCode()); - } - - public function getBasePaths() - { - return array( - array( - __DIR__.'/Fixtures', - 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', - null, - ), - array( - __DIR__.'/Fixtures/../Fixtures', - 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', - null, - ), - array( - 'test/Twig/Tests/Loader/Fixtures', - 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', - getcwd(), - ), - array( - 'Fixtures', - 'Fixtures/named_quater/named_absolute.html', - getcwd().'/test/Twig/Tests/Loader', - ), - array( - 'Fixtures', - 'Fixtures/named_quater/named_absolute.html', - getcwd().'/test/../test/Twig/Tests/Loader', - ), - ); - } - - public function testEmptyConstructor() - { - $loader = new Twig_Loader_Filesystem(); - $this->assertEquals(array(), $loader->getPaths()); - } - - public function testGetNamespaces() - { - $loader = new Twig_Loader_Filesystem(sys_get_temp_dir()); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE), $loader->getNamespaces()); - - $loader->addPath(sys_get_temp_dir(), 'named'); - $this->assertEquals(array(Twig_Loader_Filesystem::MAIN_NAMESPACE, 'named'), $loader->getNamespaces()); - } - - public function testFindTemplateExceptionNamespace() - { - $basePath = __DIR__.'/Fixtures'; - - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); - $loader->addPath($basePath.'/named', 'named'); - - try { - $loader->getSourceContext('@named/nowhere.html'); - } catch (Exception $e) { - $this->assertInstanceof('Twig_Error_Loader', $e); - $this->assertContains('Unable to find template "@named/nowhere.html"', $e->getMessage()); - } - } - - public function testFindTemplateWithCache() - { - $basePath = __DIR__.'/Fixtures'; - - $loader = new Twig_Loader_Filesystem(array($basePath.'/normal')); - $loader->addPath($basePath.'/named', 'named'); - - // prime the cache for index.html in the named namespace - $namedSource = $loader->getSourceContext('@named/index.html')->getCode(); - $this->assertEquals("named path\n", $namedSource); - - // get index.html from the main namespace - $this->assertEquals("path\n", $loader->getSourceContext('index.html')->getCode()); - } - - public function testLoadTemplateAndRenderBlockWithCache() - { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(__DIR__.'/Fixtures/themes/theme2'); - $loader->addPath(__DIR__.'/Fixtures/themes/theme1'); - $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme'); - - $twig = new Twig_Environment($loader); - - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 1', $template->renderBlock('b1', array())); - - $template = $twig->loadTemplate('blocks.html.twig'); - $this->assertSame('block from theme 2', $template->renderBlock('b2', array())); - } - - public function getArrayInheritanceTests() - { - return array( - 'valid array inheritance' => array('array_inheritance_valid_parent.html.twig'), - 'array inheritance with null first template' => array('array_inheritance_null_parent.html.twig'), - 'array inheritance with empty first template' => array('array_inheritance_empty_parent.html.twig'), - 'array inheritance with non-existent first template' => array('array_inheritance_nonexistent_parent.html.twig'), - ); - } - - /** - * @dataProvider getArrayInheritanceTests - * - * @param $templateName string Template name with array inheritance - */ - public function testArrayInheritance($templateName) - { - $loader = new Twig_Loader_Filesystem(array()); - $loader->addPath(__DIR__.'/Fixtures/inheritance'); - - $twig = new Twig_Environment($loader); - - $template = $twig->loadTemplate($templateName); - $this->assertSame('VALID Child', $template->renderBlock('body', array())); - } - - public function testLoadTemplateFromPhar() - { - $loader = new Twig_Loader_Filesystem(array()); - // phar-sample.phar was created with the following script: - // $f = new Phar('phar-test.phar'); - // $f->addFromString('hello.twig', 'hello from phar'); - $loader->addPath('phar://'.dirname(__FILE__).'/Fixtures/phar/phar-sample.phar'); - $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode()); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig deleted file mode 100644 index 6977ebf..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_empty_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['','parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig deleted file mode 100644 index 5b50a8b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_nonexistent_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['nonexistent.html.twig','parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig deleted file mode 100644 index a16b3ad..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_null_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends [null,'parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig deleted file mode 100644 index 4940dad..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/array_inheritance_valid_parent.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% extends ['parent.html.twig','spare_parent.html.twig'] %} - -{% block body %}{{ parent() }} Child{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig deleted file mode 100644 index d594c0e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/parent.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% block body %}VALID{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig deleted file mode 100644 index 70b7360..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/inheritance/spare_parent.html.twig +++ /dev/null @@ -1 +0,0 @@ -{% block body %}SPARE PARENT{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html deleted file mode 100644 index 9e5449c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named/index.html +++ /dev/null @@ -1 +0,0 @@ -named path diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html deleted file mode 100644 index d3a272b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_bis/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (bis) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html deleted file mode 100644 index 9f05d15..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_final/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (final) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html deleted file mode 100644 index b1fb5f5..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html +++ /dev/null @@ -1 +0,0 @@ -named path (quater) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html deleted file mode 100644 index 24fb68a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/named_ter/index.html +++ /dev/null @@ -1 +0,0 @@ -named path (ter) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html deleted file mode 100644 index e7a8fd4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal/index.html +++ /dev/null @@ -1 +0,0 @@ -path diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html deleted file mode 100644 index bfa9160..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_bis/index.html +++ /dev/null @@ -1 +0,0 @@ -path (bis) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html deleted file mode 100644 index 73a089b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_final/index.html +++ /dev/null @@ -1 +0,0 @@ -path (final) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html deleted file mode 100644 index b7ad97d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/normal_ter/index.html +++ /dev/null @@ -1 +0,0 @@ -path (ter) diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/phar/phar-sample.phar deleted file mode 100644 index 092bbfae3e4c98b308dc98bf7653ead68ae3ee6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6786 zcmb_hOLN=E5q5IqWh?g_#w@G>Mx-dx&rq@~*-JkvlEqM5ZLJv>0s=!4E4&r}B}(hP zu&2!Q zBabh)K{9u1HGj%1KeC-Pb*?NknLDZ3WLchaC$wigw=YvCNqCxBjRw1SkGX-9Wj0^> zS)N(uK(g;(@4Ff;dObhNdFt{cf9VJO@V}w zadTVhIUOAiN4vF@=ZiGjt$i4sBa?mjz}5||unkU5M`lALde!||Y~|^KBX%S7L!RM;DW<2Eh9F$qo(Np_{kp$|P=Z;JZ%l z$5DIP`o_6%GB@>;oK%Lsr_$prJU?!WwWLdxx5%-|y&_{t%<+X}#s{Cbzg_t5d5&Tf zd&&J3MOczVqCA#|5~={jZxP8VJ@M2LltUpRR3*B2Wbm{EHM^{k$mX$oe(7BB))akg zPJH?5;bJM2ir=M_YC43=(a;h~mJ?MA(gj))6(u25hzg-qvxaM0n{&tGsa1dBxO3im z5l49%2R#7h?{wI4e8D|7;A!YYJj#PB z^Cq?CQ7o@WkI_(CZ^t4}*pV{?wjhf^nA6BG97K+p8HnLlkv7PE@n+b6fvNWO%7Bx4 z#0fzOLQ)|k{dA(1;ov;>G_^vrI4)HlI@%rfVCMmQ8|Un0yofxClDqSm)%U3J?EfKR zdn7?0*k11E0pF)_eIucW#MsuHdz09^k|OiYJ{f2+Ayr55Bzcq7OY&{72x%n*HDtM7 zN*Q4hN|zr^V+vE9tQxA5v585=qYO<8la!8E2T3;ur`H-?CA`N<1FdwJn&*f|vwSX( zbczr&|61mh3fJ+7ByH=H6nIEZelbqR#;PaM72=ZPc5NT^_>^_X-{PJ)H&K5|uqy)f zXY&C6b9>#t>Lj3IH@Ne2API}dtQVmI=2Lw!w5ZrpxBzWz`CBja`W)LGJ*yWt=wxw+mS-@9K5XOZu$ckZ6v4b!? zpIc^sI6N8l7#gTQ?f#|I;*1 zd+a*!C#+~N%+D}>bA};02{0jA6oknNd8@&+au#v!fn^$}LP^Vw!zAVC7#_o$%1JXB zlzK*#JVn)Sc6D;?ajj|H+sU<`bU*2CS;q#CC)eGNI4mx5aSnNy5C+gSaaZnQLf!Q< zJPZAta%D+SAj&pF7I6Ehrwb)wWoLj}^34ZL)c#N$03zt0C4LN#-Fk!FMe9`8wY*E( z1gf|#v{}_wM_Ic|EmT)TS!siYErmisu51*w@0szR$>{jy>FZ3E^~zEw6%4o2Y!kPVY@6E}eU&?ts3%e=FGiu1bQDC@ZjmFrmEB8^ z4(uR27f}&olkGfy{J6>VBT+a|0xR+W)x}!Pmh^Q4a0$JKay;o)Dj%on4yPPX0X_6Ltez1B^mjZ>a#xRo3j8g)V~Wo(A#dxoZD$eP?| z2B{XsN`P%8S|m&YE)}(gd8lS;?JA`oWYb7xzf`GS(fE9BW_@U>e-u z*z)leK?^x)0`7dzIHnq!+NW}*#N@H4a-%b`)P~3i#@aLyQM&Um#zb4s0W3dy^oT5r ze>M3)SS=nkb48a^Zv<&qeZ@keYqMIn84T!~?qCgG5A2gu9P3wa-U8d-GzNq$Fw}*U z%97{Ng=LP82jF@}1y)-3Zq|KbAjcFeFd$E{kS^5&%r-?0HRucS{%A@`4&@~=zTP7x zN~h>tS}7S=brAT!(gh`5)=X}YqP1j|W+MR_H8;!nL_fbm99WYHR01RbPc|@hG?&0G zCF#xsyuXY9I0dd4^tI9k4TS<4;lOwXYCa`|A{1m$02+c616;DuJ*7J;Rv7O9Kk~wY z7oWDaDC02BBXDdmE6u17mCY>}-Gv~{96g5Aa}@c|5~Np$C0vD=qCuE3=`32uxKM=K zDZf>-@hD%Qp%qR!?XyYy%x#}}?K9p!!70eif2a zY}5~RK6da`w1npMH<9?ph>5S@BPWn}l+lC$>cYd9aRR@1r*9Vz52J-!82Nj$#F)uGaeJ3q1ba)V<%e^m|15jfyCh>Q8eK-+j5~*&>u~YU3y&d@s+0 zTH(#@$DUn{H4Fue=;e27SQRK?7Q_?F{0(|OfrP29CNWdh-#9=OWQ7yK^Nby&p@3Id z^w_~73jBzkjz|_A^DSxmtBFRLQr8BEG+n_*YRqa=G@77)9aE^#bg-&a`zwFpz;hU~ zw*C6>Xk@=QIUeB8Eklslv;8M`?%eqW{{Kq-#xMNT@PE#OAl}X|{n=+&{rQLgenr2R zUq3wj2MORuaIk3_hXVQj>yQ8J|L^Zl{`Bz2U;pj!umAb+FF!2*{Y$XDdVc);|E1Ux AZ~y=R diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig deleted file mode 100644 index dd0cbc2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme1/blocks.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% block b1 %}block from theme 1{% endblock %} - -{% block b2 %}block from theme 1{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig b/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig deleted file mode 100644 index 07cf9db..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Loader/Fixtures/themes/theme2/blocks.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% use '@default_theme/blocks.html.twig' %} - -{% block b2 %}block from theme 2{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php b/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php deleted file mode 100644 index c89285e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +++ /dev/null @@ -1,29 +0,0 @@ - '{{ d1.date }}{{ d2.date }}')), array( - 'debug' => true, - 'cache' => false, - 'autoescape' => false, - )); - - $d1 = new DateTime(); - $d2 = new DateTime(); - $output = $twig->render('index', compact('d1', 'd2')); - - // If it fails, PHP will crash. - $this->assertEquals($output, $d1->date.$d2->date); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php deleted file mode 100644 index 25d1602..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertTrue($node->getAttribute('value')); - } - - public function getTests() - { - $body = new Twig_Node(array(new Twig_Node_Text('foo', 1))); - $node = new Twig_Node_AutoEscape(true, $body, 1); - - return array( - array($node, "// line 1\necho \"foo\";"), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php deleted file mode 100644 index 84dac9b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - return array( - array(new Twig_Node_BlockReference('foo', 1), <<displayBlock('foo', \$context, \$blocks); -EOF - ), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php deleted file mode 100644 index e7246dc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Block('foo', $body, 1); - - return array( - array($node, <<assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Do($expr, 1); - $tests[] = array($node, "// line 1\n\"foo\";"); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php deleted file mode 100644 index 4f83ab1..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertEquals($foo, $node->getNode(1)); - } - - public function getTests() - { - $elements = array( - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('bar', 1), - - new Twig_Node_Expression_Constant('bar', 1), - new Twig_Node_Expression_Constant('foo', 1), - ); - $node = new Twig_Node_Expression_Array($elements, 1); - - return array( - array($node, 'array("foo" => "bar", "bar" => "foo")'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php deleted file mode 100644 index bf365de..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php +++ /dev/null @@ -1,29 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_AssignName('foo', 1); - - return array( - array($node, '$context["foo"]'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php deleted file mode 100644 index 02310a1..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Add($left, $right, 1); - - return array( - array($node, '(1 + 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php deleted file mode 100644 index 2df3c8e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_And($left, $right, 1); - - return array( - array($node, '(1 && 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php deleted file mode 100644 index 759e482..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Concat($left, $right, 1); - - return array( - array($node, '(1 . 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php deleted file mode 100644 index 0e54b10..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Div($left, $right, 1); - - return array( - array($node, '(1 / 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php deleted file mode 100644 index 5813dce..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1); - - return array( - array($node, '(int) floor((1 / 2))'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php deleted file mode 100644 index 4c663c7..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mod($left, $right, 1); - - return array( - array($node, '(1 % 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php deleted file mode 100644 index e92c95e..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Mul($left, $right, 1); - - return array( - array($node, '(1 * 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php deleted file mode 100644 index ec37c83..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Or($left, $right, 1); - - return array( - array($node, '(1 || 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php deleted file mode 100644 index 061cb27..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertEquals($left, $node->getNode('left')); - $this->assertEquals($right, $node->getNode('right')); - } - - public function getTests() - { - $left = new Twig_Node_Expression_Constant(1, 1); - $right = new Twig_Node_Expression_Constant(2, 1); - $node = new Twig_Node_Expression_Binary_Sub($left, $right, 1); - - return array( - array($node, '(1 - 2)'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php deleted file mode 100644 index 7b9ea92..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +++ /dev/null @@ -1,151 +0,0 @@ - 'function', 'name' => 'date')); - $this->assertEquals(array('U', null), $this->getArguments($node, array('date', array('format' => 'U', 'timestamp' => null)))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". - */ - public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $this->getArguments($node, array('date', array('timestamp' => 123456, 'Y-m-d'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Argument "format" is defined twice for function "date". - */ - public function testGetArgumentsWhenArgumentIsDefinedTwice() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $this->getArguments($node, array('date', array('Y-m-d', 'format' => 'U'))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". - */ - public function testGetArgumentsWithWrongNamedArgumentName() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $this->getArguments($node, array('date', array('Y-m-d', 'timestamp' => null, 'unknown' => ''))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". - */ - public function testGetArgumentsWithWrongNamedArgumentNames() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'date')); - $this->getArguments($node, array('date', array('Y-m-d', 'timestamp' => null, 'unknown1' => '', 'unknown2' => ''))); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". - */ - public function testResolveArgumentsWithMissingValueForOptionalArgument() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'substr_compare')); - $this->getArguments($node, array('substr_compare', array('abcd', 'bc', 'offset' => 1, 'case_sensitivity' => true))); - } - - public function testResolveArgumentsOnlyNecessaryArgumentsForCustomFunction() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_function')); - - $this->assertEquals(array('arg1'), $this->getArguments($node, array(array($this, 'customFunction'), array('arg1' => 'arg1')))); - } - - public function testGetArgumentsForStaticMethod() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'custom_static_function')); - $this->assertEquals(array('arg1'), $this->getArguments($node, array(__CLASS__.'::customStaticFunction', array('arg1' => 'arg1')))); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = array()". - */ - public function testResolveArgumentsWithMissingParameterForArbitraryArguments() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $this->getArguments($node, array(array($this, 'customFunctionWithArbitraryArguments'), array())); - } - - public static function customStaticFunction($arg1, $arg2 = 'default', $arg3 = array()) - { - } - - public function customFunction($arg1, $arg2 = 'default', $arg3 = array()) - { - } - - private function getArguments($call, $args) - { - $m = new ReflectionMethod($call, 'getArguments'); - $m->setAccessible(true); - - return $m->invokeArgs($call, $args); - } - - public function customFunctionWithArbitraryArguments() - { - } - - /** - * @expectedException LogicException - * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$# - */ - public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', array()); - } - - /** - * @expectedException LogicException - * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$# - */ - public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject() - { - $node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true)); - $node->getArguments(new CallableTestClass(), array()); - } -} - -class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call -{ - public function getArguments($callable = null, $arguments) - { - return parent::getArguments($callable, $arguments); - } -} - -class CallableTestClass -{ - public function __invoke($required) - { - } -} - -function custom_Twig_Tests_Node_Expression_CallTest_function($required) -{ -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php deleted file mode 100644 index a3e8bad..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php +++ /dev/null @@ -1,38 +0,0 @@ -assertEquals($expr1, $node->getNode('expr1')); - $this->assertEquals($expr2, $node->getNode('expr2')); - $this->assertEquals($expr3, $node->getNode('expr3')); - } - - public function getTests() - { - $tests = array(); - - $expr1 = new Twig_Node_Expression_Constant(1, 1); - $expr2 = new Twig_Node_Expression_Constant(2, 1); - $expr3 = new Twig_Node_Expression_Constant(3, 1); - $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 1); - $tests[] = array($node, '((1) ? (2) : (3))'); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php deleted file mode 100644 index 2ff9318..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertEquals('foo', $node->getAttribute('value')); - } - - public function getTests() - { - $tests = array(); - - $node = new Twig_Node_Expression_Constant('foo', 1); - $tests[] = array($node, '"foo"'); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php deleted file mode 100644 index e089456..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +++ /dev/null @@ -1,151 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - $this->assertEquals($name, $node->getNode('filter')); - $this->assertEquals($args, $node->getNode('arguments')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addFilter(new Twig_Filter('bar', 'twig_tests_filter_dummy', array('needs_environment' => true))); - $environment->addFilter(new Twig_Filter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); - - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = $this->createFilter($expr, 'upper'); - $node = $this->createFilter($node, 'number_format', array(new Twig_Node_Expression_Constant(2, 1), new Twig_Node_Expression_Constant('.', 1), new Twig_Node_Expression_Constant(',', 1))); - - $tests[] = array($node, 'twig_number_format_filter($this->env, twig_upper_filter($this->env, "foo"), 2, ".", ",")'); - - // named arguments - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'format' => new Twig_Node_Expression_Constant('d/m/Y H:i:s P', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, "d/m/Y H:i:s P", "America/Chicago")'); - - // skip an optional argument - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); - $tests[] = array($node, 'twig_date_format_filter($this->env, 0, null, "America/Chicago")'); - - // underscores vs camelCase for named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); - $node = $this->createFilter($string, 'reverse', array( - 'preserve_keys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); - $node = $this->createFilter($string, 'reverse', array( - 'preserveKeys' => new Twig_Node_Expression_Constant(true, 1), - )); - $tests[] = array($node, 'twig_reverse_filter($this->env, "abc", true)'); - - // filter as an anonymous function - $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 1), 'anonymous'); - $tests[] = array($node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), array("foo"))'); - - // needs environment - $node = $this->createFilter($string, 'bar'); - $tests[] = array($node, 'twig_tests_filter_dummy($this->env, "abc")', $environment); - - $node = $this->createFilter($string, 'bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_dummy($this->env, "abc", "bar")', $environment); - - // arbitrary named arguments - $node = $this->createFilter($string, 'barbar'); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc")', $environment); - - $node = $this->createFilter($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, null, array("foo" => "bar"))', $environment); - - $node = $this->createFilter($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", null, "bar")', $environment); - - $node = $this->createFilter($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_filter_barbar($context, "abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - return $tests; - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. - */ - public function testCompileWithWrongNamedArgumentName() - { - $date = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($date, 'date', array( - 'foobar' => new Twig_Node_Expression_Constant('America/Chicago', 1), - )); - - $compiler = $this->getCompiler(); - $compiler->compile($node); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Value for argument "from" is required for filter "replace". - */ - public function testCompileWithMissingNamedArgument() - { - $value = new Twig_Node_Expression_Constant(0, 1); - $node = $this->createFilter($value, 'replace', array( - 'to' => new Twig_Node_Expression_Constant('foo', 1), - )); - - $compiler = $this->getCompiler(); - $compiler->compile($node); - } - - protected function createFilter($node, $name, array $arguments = array()) - { - $name = new Twig_Node_Expression_Constant($name, 1); - $arguments = new Twig_Node($arguments); - - return new Twig_Node_Expression_Filter($node, $name, $arguments, 1); - } - - protected function getEnvironment() - { - $env = new Twig_Environment(new Twig_Loader_Array(array())); - $env->addFilter(new Twig_Filter('anonymous', function () {})); - - return $env; - } -} - -function twig_tests_filter_dummy() -{ -} - -function twig_tests_filter_barbar($context, $string, $arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php deleted file mode 100644 index 5824bde..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +++ /dev/null @@ -1,111 +0,0 @@ -assertEquals($name, $node->getAttribute('name')); - $this->assertEquals($args, $node->getNode('arguments')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addFunction(new Twig_Function('foo', 'twig_tests_function_dummy', array())); - $environment->addFunction(new Twig_Function('bar', 'twig_tests_function_dummy', array('needs_environment' => true))); - $environment->addFunction(new Twig_Function('foofoo', 'twig_tests_function_dummy', array('needs_context' => true))); - $environment->addFunction(new Twig_Function('foobar', 'twig_tests_function_dummy', array('needs_environment' => true, 'needs_context' => true))); - $environment->addFunction(new Twig_Function('barbar', 'twig_tests_function_barbar', array('is_variadic' => true))); - - $tests = array(); - - $node = $this->createFunction('foo'); - $tests[] = array($node, 'twig_tests_function_dummy()', $environment); - - $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 1), new Twig_Node_Expression_Constant('foobar', 1))); - $tests[] = array($node, 'twig_tests_function_dummy("bar", "foobar")', $environment); - - $node = $this->createFunction('bar'); - $tests[] = array($node, 'twig_tests_function_dummy($this->env)', $environment); - - $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_dummy($this->env, "bar")', $environment); - - $node = $this->createFunction('foofoo'); - $tests[] = array($node, 'twig_tests_function_dummy($context)', $environment); - - $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_dummy($context, "bar")', $environment); - - $node = $this->createFunction('foobar'); - $tests[] = array($node, 'twig_tests_function_dummy($this->env, $context)', $environment); - - $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_dummy($this->env, $context, "bar")', $environment); - - // named arguments - $node = $this->createFunction('date', array( - 'timezone' => new Twig_Node_Expression_Constant('America/Chicago', 1), - 'date' => new Twig_Node_Expression_Constant(0, 1), - )); - $tests[] = array($node, 'twig_date_converter($this->env, 0, "America/Chicago")'); - - // arbitrary named arguments - $node = $this->createFunction('barbar'); - $tests[] = array($node, 'twig_tests_function_barbar()', $environment); - - $node = $this->createFunction('barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, null, array("foo" => "bar"))', $environment); - - $node = $this->createFunction('barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_function_barbar(null, "bar")', $environment); - - $node = $this->createFunction('barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_function_barbar("1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - // function as an anonymous function - $node = $this->createFunction('anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), array("foo"))'); - - return $tests; - } - - protected function createFunction($name, array $arguments = array()) - { - return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 1); - } - - protected function getEnvironment() - { - $env = new Twig_Environment(new Twig_Loader_Array(array())); - $env->addFunction(new Twig_Function('anonymous', function () {})); - - return $env; - } -} - -function twig_tests_function_dummy() -{ -} - -function twig_tests_function_barbar($arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php deleted file mode 100644 index 2764478..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php +++ /dev/null @@ -1,50 +0,0 @@ -addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); - - $this->assertEquals($expr, $node->getNode('node')); - $this->assertEquals($attr, $node->getNode('attribute')); - $this->assertEquals($args, $node->getNode('arguments')); - $this->assertEquals(Twig_Template::ARRAY_CALL, $node->getAttribute('type')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Name('foo', 1); - $attr = new Twig_Node_Expression_Constant('bar', 1); - $args = new Twig_Node_Expression_Array(array(), 1); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ANY_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array())', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); - - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::ARRAY_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1))); - - $args = new Twig_Node_Expression_Array(array(), 1); - $args->addElement(new Twig_Node_Expression_Name('foo', 1)); - $args->addElement(new Twig_Node_Expression_Constant('bar', 1)); - $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_Template::METHOD_CALL, 1); - $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo', 1), $this->getVariableGetter('foo'))); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php deleted file mode 100644 index 46b3574..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Name('foo', 1); - $self = new Twig_Node_Expression_Name('_self', 1); - $context = new Twig_Node_Expression_Name('_context', 1); - - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)); - $env1 = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => false)); - - $output = '(isset($context["foo"]) || array_key_exists("foo", $context) ? $context["foo"] : (function () { throw new Twig_Error_Runtime(\'Variable "foo" does not exist.\', 1, $this->getSourceContext()); })())'; - - return array( - array($node, "// line 1\n".$output, $env), - array($node, $this->getVariableGetter('foo', 1), $env1), - array($self, "// line 1\n\$this->getTemplateName()"), - array($context, "// line 1\n\$context"), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php deleted file mode 100644 index 01ddb79..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php +++ /dev/null @@ -1,22 +0,0 @@ -assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Expression_Parent('foo', 1), '$this->renderParentBlock("foo", $context, $blocks)'); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php deleted file mode 100644 index 7282b68..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +++ /dev/null @@ -1,79 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - $this->assertEquals($args, $node->getNode('arguments')); - $this->assertEquals($name, $node->getAttribute('name')); - } - - public function getTests() - { - $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addTest(new Twig_Test('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); - - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo', 1); - $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 1); - $tests[] = array($node, '(null === "foo")'); - - // test as an anonymous function - $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 1), 'anonymous', array(new Twig_Node_Expression_Constant('foo', 1))); - $tests[] = array($node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), array("foo", "foo"))'); - - // arbitrary named arguments - $string = new Twig_Node_Expression_Constant('abc', 1); - $node = $this->createTest($string, 'barbar'); - $tests[] = array($node, 'twig_tests_test_barbar("abc")', $environment); - - $node = $this->createTest($string, 'barbar', array('foo' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, null, array("foo" => "bar"))', $environment); - - $node = $this->createTest($string, 'barbar', array('arg2' => new Twig_Node_Expression_Constant('bar', 1))); - $tests[] = array($node, 'twig_tests_test_barbar("abc", null, "bar")', $environment); - - $node = $this->createTest($string, 'barbar', array( - new Twig_Node_Expression_Constant('1', 1), - new Twig_Node_Expression_Constant('2', 1), - new Twig_Node_Expression_Constant('3', 1), - 'foo' => new Twig_Node_Expression_Constant('bar', 1), - )); - $tests[] = array($node, 'twig_tests_test_barbar("abc", "1", "2", array(0 => "3", "foo" => "bar"))', $environment); - - return $tests; - } - - protected function createTest($node, $name, array $arguments = array()) - { - return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 1); - } - - protected function getEnvironment() - { - $env = new Twig_Environment(new Twig_Loader_Array(array())); - $env->addTest(new Twig_Test('anonymous', function () {})); - - return $env; - } -} - -function twig_tests_test_barbar($string, $arg1 = null, $arg2 = null, array $args = array()) -{ -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php deleted file mode 100644 index b633371..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Neg($node, 1); - - return array( - array($node, '-1'), - array(new Twig_Node_Expression_Unary_Neg($node, 1), '- -1'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php deleted file mode 100644 index d7c6f85..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Not($node, 1); - - return array( - array($node, '!1'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php deleted file mode 100644 index 057250f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals($expr, $node->getNode('node')); - } - - public function getTests() - { - $node = new Twig_Node_Expression_Constant(1, 1); - $node = new Twig_Node_Expression_Unary_Pos($node, 1); - - return array( - array($node, '+1'), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php deleted file mode 100644 index 2bf4c7b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php +++ /dev/null @@ -1,191 +0,0 @@ -setAttribute('with_loop', false); - - $this->assertEquals($keyTarget, $node->getNode('key_target')); - $this->assertEquals($valueTarget, $node->getNode('value_target')); - $this->assertEquals($seq, $node->getNode('seq')); - $this->assertTrue($node->getAttribute('ifexpr')); - $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); - $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); - $this->assertFalse($node->hasNode('else')); - - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', false); - $this->assertEquals($else, $node->getNode('else')); - } - - public function getTests() - { - $tests = array(); - - $keyTarget = new Twig_Node_Expression_AssignName('key', 1); - $valueTarget = new Twig_Node_Expression_AssignName('item', 1); - $seq = new Twig_Node_Expression_Name('items', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', false); - - $tests[] = array($node, <<getVariableGetter('items')}); -foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { - echo {$this->getVariableGetter('foo')}; -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { - \$length = count(\$context['_seq']); - \$context['loop']['revindex0'] = \$length - 1; - \$context['loop']['revindex'] = \$length; - \$context['loop']['length'] = \$length; - \$context['loop']['last'] = 1 === \$length; -} -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - echo {$this->getVariableGetter('foo')}; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - if (isset(\$context['loop']['length'])) { - --\$context['loop']['revindex0']; - --\$context['loop']['revindex']; - \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; - } -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = new Twig_Node_Expression_Constant(true, 1); - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = null; - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - if (true) { - echo {$this->getVariableGetter('foo')}; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - } -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - $keyTarget = new Twig_Node_Expression_AssignName('k', 1); - $valueTarget = new Twig_Node_Expression_AssignName('v', 1); - $seq = new Twig_Node_Expression_Name('values', 1); - $ifexpr = null; - $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1)), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1); - $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1); - $node->setAttribute('with_loop', true); - - $tests[] = array($node, <<getVariableGetter('values')}); -\$context['_iterated'] = false; -\$context['loop'] = array( - 'parent' => \$context['_parent'], - 'index0' => 0, - 'index' => 1, - 'first' => true, -); -if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { - \$length = count(\$context['_seq']); - \$context['loop']['revindex0'] = \$length - 1; - \$context['loop']['revindex'] = \$length; - \$context['loop']['length'] = \$length; - \$context['loop']['last'] = 1 === \$length; -} -foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { - echo {$this->getVariableGetter('foo')}; - \$context['_iterated'] = true; - ++\$context['loop']['index0']; - ++\$context['loop']['index']; - \$context['loop']['first'] = false; - if (isset(\$context['loop']['length'])) { - --\$context['loop']['revindex0']; - --\$context['loop']['revindex']; - \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; - } -} -if (!\$context['_iterated']) { - echo {$this->getVariableGetter('foo')}; -} -\$_parent = \$context['_parent']; -unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); -\$context = array_intersect_key(\$context, \$_parent) + \$_parent; -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php deleted file mode 100644 index 4ab0e4c..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php +++ /dev/null @@ -1,88 +0,0 @@ -assertEquals($t, $node->getNode('tests')); - $this->assertFalse($node->hasNode('else')); - - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); - $this->assertEquals($else, $node->getNode('else')); - } - - public function getTests() - { - $tests = array(); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); - $else = null; - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} -EOF - ); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - new Twig_Node_Expression_Constant(false, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1), - ), array(), 1); - $else = null; - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} elseif (false) { - echo {$this->getVariableGetter('bar')}; -} -EOF - ); - - $t = new Twig_Node(array( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1), - ), array(), 1); - $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1); - $node = new Twig_Node_If($t, $else, 1); - - $tests[] = array($node, <<getVariableGetter('foo')}; -} else { - echo {$this->getVariableGetter('bar')}; -} -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php deleted file mode 100644 index 36525b2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertEquals($macro, $node->getNode('expr')); - $this->assertEquals($var, $node->getNode('var')); - } - - public function getTests() - { - $tests = array(); - - $macro = new Twig_Node_Expression_Constant('foo.twig', 1); - $var = new Twig_Node_Expression_AssignName('macro', 1); - $node = new Twig_Node_Import($macro, $var, 1); - - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1); -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php deleted file mode 100644 index d801f33..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php +++ /dev/null @@ -1,83 +0,0 @@ -assertFalse($node->hasNode('variables')); - $this->assertEquals($expr, $node->getNode('expr')); - $this->assertFalse($node->getAttribute('only')); - - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, true, false, 1); - $this->assertEquals($vars, $node->getNode('variables')); - $this->assertTrue($node->getAttribute('only')); - } - - public function getTests() - { - $tests = array(); - - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(\$context); -EOF - ); - - $expr = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 1), - new Twig_Node_Expression_Constant('foo', 1), - new Twig_Node_Expression_Constant('foo', 1), - 0 - ); - $node = new Twig_Node_Include($expr, null, false, false, 1); - $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), null, 1)->display(\$context); -EOF - ); - - $expr = new Twig_Node_Expression_Constant('foo.twig', 1); - $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Constant(true, 1)), 1); - $node = new Twig_Node_Include($expr, $vars, false, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array_merge(\$context, array("foo" => true))); -EOF - ); - - $node = new Twig_Node_Include($expr, $vars, true, false, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); -EOF - ); - - $node = new Twig_Node_Include($expr, $vars, true, true, 1); - $tests[] = array($node, <<loadTemplate("foo.twig", null, 1)->display(array("foo" => true)); -} catch (Twig_Error_Loader \$e) { - // ignore missing template -} -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php deleted file mode 100644 index f7beda2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php +++ /dev/null @@ -1,60 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals($arguments, $node->getNode('arguments')); - $this->assertEquals('foo', $node->getAttribute('name')); - } - - public function getTests() - { - $body = new Twig_Node_Text('foo', 1); - $arguments = new Twig_Node(array( - 'foo' => new Twig_Node_Expression_Constant(null, 1), - 'bar' => new Twig_Node_Expression_Constant('Foo', 1), - ), array(), 1); - $node = new Twig_Node_Macro('foo', $body, $arguments, 1); - - return array( - array($node, <<env->mergeGlobals(array( - "foo" => \$__foo__, - "bar" => \$__bar__, - "varargs" => \$__varargs__, - )); - - \$blocks = array(); - - ob_start(); - try { - echo "foo"; - - return ('' === \$tmp = ob_get_contents()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset()); - } finally { - ob_end_clean(); - } -} -EOF - ), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php deleted file mode 100644 index 4974d3d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +++ /dev/null @@ -1,199 +0,0 @@ -assertEquals($body, $node->getNode('body')); - $this->assertEquals($blocks, $node->getNode('blocks')); - $this->assertEquals($macros, $node->getNode('macros')); - $this->assertEquals($parent, $node->getNode('parent')); - $this->assertEquals($source->getName(), $node->getTemplateName()); - } - - public function getTests() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - - $tests = array(); - - $body = new Twig_Node_Text('foo', 1); - $extends = null; - $blocks = new Twig_Node(); - $macros = new Twig_Node(); - $traits = new Twig_Node(); - $source = new Twig_Source('{{ foo }}', 'foo.twig'); - - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<parent = false; - - \$this->blocks = array( - ); - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 1 - echo "foo"; - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function getDebugInfo() - { - return array ( 19 => 1,); - } - - public function getSourceContext() - { - return new Twig_Source("", "foo.twig", ""); - } -} -EOF - , $twig, true); - - $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 1), new Twig_Node_Expression_AssignName('macro', 1), 2); - - $body = new Twig_Node(array($import)); - $extends = new Twig_Node_Expression_Constant('layout.twig', 1); - - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); - \$this->blocks = array( - ); - } - - protected function doGetParent(array \$context) - { - return "layout.twig"; - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 2 - \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2); - // line 1 - \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function isTraitable() - { - return false; - } - - public function getDebugInfo() - { - return array ( 26 => 1, 24 => 2, 11 => 1,); - } - - public function getSourceContext() - { - return new Twig_Source("", "foo.twig", ""); - } -} -EOF - , $twig, true); - - $set = new Twig_Node_Set(false, new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 4))), new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 4))), 4); - $body = new Twig_Node(array($set)); - $extends = new Twig_Node_Expression_Conditional( - new Twig_Node_Expression_Constant(true, 2), - new Twig_Node_Expression_Constant('foo', 2), - new Twig_Node_Expression_Constant('foo', 2), - 2 - ); - - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('debug' => true)); - $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $source); - $tests[] = array($node, <<loadTemplate(((true) ? ("foo") : ("foo")), "foo.twig", 2); - } - - protected function doDisplay(array \$context, array \$blocks = array()) - { - // line 4 - \$context["foo"] = "foo"; - // line 2 - \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); - } - - public function getTemplateName() - { - return "foo.twig"; - } - - public function isTraitable() - { - return false; - } - - public function getDebugInfo() - { - return array ( 17 => 2, 15 => 4, 9 => 2,); - } - - public function getSourceContext() - { - return new Twig_Source("{{ foo }}", "foo.twig", ""); - } -} -EOF - , $twig, true); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php deleted file mode 100644 index 4e0990f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php +++ /dev/null @@ -1,29 +0,0 @@ -assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 1), 1), "// line 1\necho \"foo\";"); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php deleted file mode 100644 index 56f4877..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php +++ /dev/null @@ -1,44 +0,0 @@ -assertEquals($body, $node->getNode('body')); - } - - public function getTests() - { - $tests = array(); - - $body = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Sandbox($body, 1); - - $tests[] = array($node, <<env->getExtension('Twig_Extension_Sandbox'); -if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { - \$sandbox->enableSandbox(); -} -echo "foo"; -if (!\$alreadySandboxed) { - \$sandbox->disableSandbox(); -} -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php deleted file mode 100644 index 8bc8a75..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php +++ /dev/null @@ -1,33 +0,0 @@ -assertEquals($expr, $node->getNode('expr')); - } - - public function getTests() - { - $tests = array(); - - $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 1), 1), <<env->getExtension('Twig_Extension_Sandbox')->ensureToStringAllowed("foo"); -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php deleted file mode 100644 index 62ad280..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php +++ /dev/null @@ -1,69 +0,0 @@ -assertEquals($names, $node->getNode('names')); - $this->assertEquals($values, $node->getNode('values')); - $this->assertFalse($node->getAttribute('capture')); - } - - public function getTests() - { - $tests = array(); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<env->getCharset()); -EOF - ); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1)), array(), 1); - $values = new Twig_Node_Text('foo', 1); - $node = new Twig_Node_Set(true, $names, $values, 1); - $tests[] = array($node, <<env->getCharset()); -EOF - ); - - $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 1), new Twig_Node_Expression_AssignName('bar', 1)), array(), 1); - $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 1), new Twig_Node_Expression_Name('bar', 1)), array(), 1); - $node = new Twig_Node_Set(false, $names, $values, 1); - $tests[] = array($node, <<getVariableGetter('bar')}); -EOF - ); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php deleted file mode 100644 index 222ca09..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php +++ /dev/null @@ -1,37 +0,0 @@ -
    foo
    ', 1))); - $node = new Twig_Node_Spaceless($body, 1); - - $this->assertEquals($body, $node->getNode('body')); - } - - public function getTests() - { - $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 1))); - $node = new Twig_Node_Spaceless($body, 1); - - return array( - array($node, <<
    foo
    "; -echo trim(preg_replace('/>\s+<', ob_get_clean())); -EOF - ), - ); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php deleted file mode 100644 index ceaf67f..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals('foo', $node->getAttribute('data')); - } - - public function getTests() - { - $tests = array(); - $tests[] = array(new Twig_Node_Text('foo', 1), "// line 1\necho \"foo\";"); - - return $tests; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php deleted file mode 100644 index 3baa628..0000000 --- a/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +++ /dev/null @@ -1,105 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - - $stream = $env->parse($env->tokenize(new Twig_Source('{{ block("foo") }}', 'index'))); - - $node = $stream->getNode('body')->getNode(0); - - $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); - $this->assertTrue($node->getAttribute('output')); - } - - public function testRenderParentBlockOptimizer() - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false)); - - $stream = $env->parse($env->tokenize(new Twig_Source('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'))); - - $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); - - $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); - $this->assertTrue($node->getAttribute('output')); - } - - /** - * @dataProvider getTestsForForOptimizer - */ - public function testForOptimizer($template, $expected) - { - $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false)); - - $stream = $env->parse($env->tokenize(new Twig_Source($template, 'index'))); - - foreach ($expected as $target => $withLoop) { - $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); - } - } - - public function getTestsForForOptimizer() - { - return array( - array('{% for i in foo %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), - - array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => true)), - - array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), - - array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), - - array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), - - array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), - - array('{% for i in foo %}{{ include("foo") }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}', array('i' => true)), - - array('{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}', array('i' => false)), - - array('{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}', array('i' => true)), - ); - } - - public function checkForConfiguration(Twig_Node $node, $target, $withLoop) - { - foreach ($node as $n) { - if ($n instanceof Twig_Node_For) { - if ($target === $n->getNode('value_target')->getAttribute('name')) { - return $withLoop == $n->getAttribute('with_loop'); - } - } - - $ret = $this->checkForConfiguration($n, $target, $withLoop); - if (null !== $ret) { - return $ret; - } - } - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/vendor/twig/twig/test/Twig/Tests/ParserTest.php deleted file mode 100644 index 72d19d8..0000000 --- a/vendor/twig/twig/test/Twig/Tests/ParserTest.php +++ /dev/null @@ -1,190 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock())); - $parser->parse($stream); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unknown "foobar" tag at line 1. - */ - public function testUnknownTagWithoutSuggestions() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foobar', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - )); - $parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $parser->parse($stream); - } - - /** - * @dataProvider getFilterBodyNodesData - */ - public function testFilterBodyNodes($input, $expected) - { - $parser = $this->getParser(); - $m = new ReflectionMethod($parser, 'filterBodyNodes'); - $m->setAccessible(true); - - $this->assertEquals($expected, $m->invoke($parser, $input)); - } - - public function getFilterBodyNodesData() - { - return array( - array( - new Twig_Node(array(new Twig_Node_Text(' ', 1))), - new Twig_Node(array()), - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 1))), - $input, - ), - array( - $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1))))), 1))), - $input, - ), - ); - } - - /** - * @dataProvider getFilterBodyNodesDataThrowsException - * @expectedException Twig_Error_Syntax - */ - public function testFilterBodyNodesThrowsException($input) - { - $parser = $this->getParser(); - - $m = new ReflectionMethod($parser, 'filterBodyNodes'); - $m->setAccessible(true); - - $m->invoke($parser, $input); - } - - public function getFilterBodyNodesDataThrowsException() - { - return array( - array(new Twig_Node_Text('foo', 1)), - array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 1)))))), - ); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage A template that extends another one cannot start with a byte order mark (BOM); it must be removed at line 1 - */ - public function testFilterBodyNodesWithBOM() - { - $parser = $this->getParser(); - - $m = new ReflectionMethod($parser, 'filterBodyNodes'); - $m->setAccessible(true); - $m->invoke($parser, new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 1)); - } - - public function testParseIsReentrant() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array( - 'autoescape' => false, - 'optimizations' => 0, - )); - $twig->addTokenParser(new TestTokenParser()); - - $parser = new Twig_Parser($twig); - - $parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), - new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); - - $this->assertNull($parser->getParent()); - } - - public function testGetVarName() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array( - 'autoescape' => false, - 'optimizations' => 0, - )); - - $twig->parse($twig->tokenize(new Twig_Source(<<addToAssertionCount(1); - } - - protected function getParser() - { - $parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock())); - $parser->setParent(new Twig_Node()); - - $p = new ReflectionProperty($parser, 'stream'); - $p->setAccessible(true); - $p->setValue($parser, new Twig_TokenStream(array())); - - return $parser; - } -} - -class TestTokenParser extends Twig_TokenParser -{ - public function parse(Twig_Token $token) - { - // simulate the parsing of another template right in the middle of the parsing of the current template - $this->parser->parse(new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), - new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 1), - new Twig_Token(Twig_Token::STRING_TYPE, 'base', 1), - new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), - new Twig_Token(Twig_Token::EOF_TYPE, '', 1), - ))); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node(array()); - } - - public function getTag() - { - return 'test'; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php deleted file mode 100644 index a71b97b..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/AbstractTest.php +++ /dev/null @@ -1,101 +0,0 @@ -getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); - - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(true)); - $profile->expects($this->any())->method('getName')->will($this->returnValue('main')); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue(1)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - - $subProfiles = array( - $this->getIndexProfile( - array( - $this->getEmbeddedBlockProfile(), - $this->getEmbeddedTemplateProfile( - array( - $this->getIncludedTemplateProfile(), - ) - ), - $this->getMacroProfile(), - $this->getEmbeddedTemplateProfile( - array( - $this->getIncludedTemplateProfile(), - ) - ), - ) - ), - ); - - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); - - return $profile; - } - - private function getIndexProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 1, true, 'template', 'index.twig', $subProfiles); - } - - private function getEmbeddedBlockProfile(array $subProfiles = array()) - { - return $this->generateProfile('body', 0.0001, false, 'block', 'embedded.twig', $subProfiles); - } - - private function getEmbeddedTemplateProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 0.0001, true, 'template', 'embedded.twig', $subProfiles); - } - - private function getIncludedTemplateProfile(array $subProfiles = array()) - { - return $this->generateProfile('main', 0.0001, true, 'template', 'included.twig', $subProfiles); - } - - private function getMacroProfile(array $subProfiles = array()) - { - return $this->generateProfile('foo', 0.0001, false, 'macro', 'index.twig', $subProfiles); - } - - /** - * @param string $name - * @param float $duration - * @param bool $isTemplate - * @param string $type - * @param string $templateName - * @param array $subProfiles - * - * @return Twig_Profiler_Profile - */ - private function generateProfile($name, $duration, $isTemplate, $type, $templateName, array $subProfiles = array()) - { - $profile = $this->getMockBuilder('Twig_Profiler_Profile')->disableOriginalConstructor()->getMock(); - - $profile->expects($this->any())->method('isRoot')->will($this->returnValue(false)); - $profile->expects($this->any())->method('getName')->will($this->returnValue($name)); - $profile->expects($this->any())->method('getDuration')->will($this->returnValue($duration)); - $profile->expects($this->any())->method('getMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('getPeakMemoryUsage')->will($this->returnValue(0)); - $profile->expects($this->any())->method('isTemplate')->will($this->returnValue($isTemplate)); - $profile->expects($this->any())->method('getType')->will($this->returnValue($type)); - $profile->expects($this->any())->method('getTemplate')->will($this->returnValue($templateName)); - $profile->expects($this->any())->method('getProfiles')->will($this->returnValue($subProfiles)); - $profile->expects($this->any())->method('getIterator')->will($this->returnValue(new ArrayIterator($subProfiles))); - - return $profile; - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php deleted file mode 100644 index 1a1b9d2..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/BlackfireTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertStringMatchesFormat(<<index.twig//1 %d %d %d -index.twig==>embedded.twig::block(body)//1 %d %d 0 -index.twig==>embedded.twig//2 %d %d %d -embedded.twig==>included.twig//2 %d %d %d -index.twig==>index.twig::macro(foo)//1 %d %d %d -EOF - , $dumper->dump($this->getProfile())); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php deleted file mode 100644 index 66a68c4..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/HtmlTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertStringMatchesFormat(<<main %d.%dms/%d% -└ index.twig %d.%dms/%d% - └ embedded.twig::block(body) - └ embedded.twig - │ └ included.twig - └ index.twig::macro(foo) - └ embedded.twig - └ included.twig - -EOF - , $dumper->dump($this->getProfile())); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php deleted file mode 100644 index e2ea165..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/Dumper/TextTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertStringMatchesFormat(<<dump($this->getProfile())); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php b/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php deleted file mode 100644 index 08db96a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Profiler/ProfileTest.php +++ /dev/null @@ -1,110 +0,0 @@ -assertEquals('template', $profile->getTemplate()); - $this->assertEquals('type', $profile->getType()); - $this->assertEquals('name', $profile->getName()); - } - - public function testIsRoot() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertTrue($profile->isRoot()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); - $this->assertFalse($profile->isRoot()); - } - - public function testIsTemplate() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::TEMPLATE); - $this->assertTrue($profile->isTemplate()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isTemplate()); - } - - public function testIsBlock() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::BLOCK); - $this->assertTrue($profile->isBlock()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isBlock()); - } - - public function testIsMacro() - { - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::MACRO); - $this->assertTrue($profile->isMacro()); - - $profile = new Twig_Profiler_Profile('template', Twig_Profiler_Profile::ROOT); - $this->assertFalse($profile->isMacro()); - } - - public function testGetAddProfile() - { - $profile = new Twig_Profiler_Profile(); - $profile->addProfile($a = new Twig_Profiler_Profile()); - $profile->addProfile($b = new Twig_Profiler_Profile()); - - $this->assertSame(array($a, $b), $profile->getProfiles()); - $this->assertSame(array($a, $b), iterator_to_array($profile)); - } - - public function testGetDuration() - { - $profile = new Twig_Profiler_Profile(); - usleep(1); - $profile->leave(); - - $this->assertTrue($profile->getDuration() > 0, sprintf('Expected duration > 0, got: %f', $profile->getDuration())); - } - - public function testSerialize() - { - $profile = new Twig_Profiler_Profile('template', 'type', 'name'); - $profile1 = new Twig_Profiler_Profile('template1', 'type1', 'name1'); - $profile->addProfile($profile1); - $profile->leave(); - $profile1->leave(); - - $profile2 = unserialize(serialize($profile)); - $profiles = $profile->getProfiles(); - $this->assertCount(1, $profiles); - $profile3 = $profiles[0]; - - $this->assertEquals($profile->getTemplate(), $profile2->getTemplate()); - $this->assertEquals($profile->getType(), $profile2->getType()); - $this->assertEquals($profile->getName(), $profile2->getName()); - $this->assertEquals($profile->getDuration(), $profile2->getDuration()); - - $this->assertEquals($profile1->getTemplate(), $profile3->getTemplate()); - $this->assertEquals($profile1->getType(), $profile3->getType()); - $this->assertEquals($profile1->getName(), $profile3->getName()); - } - - public function testReset() - { - $profile = new Twig_Profiler_Profile(); - usleep(1); - $profile->leave(); - $profile->reset(); - - $this->assertEquals(0, $profile->getDuration()); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/vendor/twig/twig/test/Twig/Tests/TemplateTest.php deleted file mode 100644 index 292bddc..0000000 --- a/vendor/twig/twig/test/Twig/Tests/TemplateTest.php +++ /dev/null @@ -1,699 +0,0 @@ -getMockForAbstractClass('Twig_Template', array(), '', false); - $template->displayBlock('foo', array(), array('foo' => array(new stdClass(), 'foo'))); - } - - /** - * @dataProvider getAttributeExceptions - */ - public function testGetAttributeExceptions($template, $message) - { - $templates = array('index' => $template); - $env = new Twig_Environment(new Twig_Loader_Array($templates), array('strict_variables' => true)); - $template = $env->loadTemplate('index'); - - $context = array( - 'string' => 'foo', - 'null' => null, - 'empty_array' => array(), - 'array' => array('foo' => 'foo'), - 'array_access' => new Twig_TemplateArrayAccessObject(), - 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), - 'object' => new stdClass(), - ); - - try { - $template->render($context); - $this->fail('Accessing an invalid attribute should throw an exception.'); - } catch (Twig_Error_Runtime $e) { - $this->assertSame(sprintf($message, 'index'), $e->getMessage()); - } - } - - public function getAttributeExceptions() - { - return array( - array('{{ string["a"] }}', 'Impossible to access a key ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ null["a"] }}', 'Impossible to access a key ("a") on a null variable in "%s" at line 1.'), - array('{{ empty_array["a"] }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'), - array('{{ array["a"] }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ array_access["a"] }}', 'Key "a" in object with ArrayAccess of class "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1.'), - array('{{ string.a }}', 'Impossible to access an attribute ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ string.a() }}', 'Impossible to invoke a method ("a") on a string variable ("foo") in "%s" at line 1.'), - array('{{ null.a }}', 'Impossible to access an attribute ("a") on a null variable in "%s" at line 1.'), - array('{{ null.a() }}', 'Impossible to invoke a method ("a") on a null variable in "%s" at line 1.'), - array('{{ empty_array.a }}', 'Key "a" does not exist as the array is empty in "%s" at line 1.'), - array('{{ array.a }}', 'Key "a" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1.'), - array('{{ array_access.a }}', 'Neither the property "a" nor one of the methods "a()", "geta()"/"isa()"/"hasa()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'), - array('{% from _self import foo %}{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ foo(array_access) }}', 'Neither the property "missing_method" nor one of the methods "missing_method()", "getmissing_method()"/"ismissing_method()"/"hasmissing_method()" or "__call()" exist and have public access in class "Twig_TemplateArrayAccessObject" in "%s" at line 1.'), - array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.'), - array('{{ object["a"] }}', 'Impossible to access a key "a" on an object of class "stdClass" that does not implement ArrayAccess interface in "%s" at line 1.'), - ); - } - - /** - * @dataProvider getGetAttributeWithSandbox - */ - public function testGetAttributeWithSandbox($object, $item, $allowed) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array()); - $twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed)); - $template = new Twig_TemplateTest($twig); - - try { - twig_get_attribute($twig, $template->getSourceContext(), $object, $item, array(), 'any'); - - if (!$allowed) { - $this->fail(); - } else { - $this->addToAssertionCount(1); - } - } catch (Twig_Sandbox_SecurityError $e) { - if ($allowed) { - $this->fail(); - } else { - $this->addToAssertionCount(1); - } - - $this->assertContains('is not allowed', $e->getMessage()); - } - } - - public function getGetAttributeWithSandbox() - { - return array( - array(new Twig_TemplatePropertyObject(), 'defined', false), - array(new Twig_TemplatePropertyObject(), 'defined', true), - array(new Twig_TemplateMethodObject(), 'defined', false), - array(new Twig_TemplateMethodObject(), 'defined', true), - ); - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Block "unknown" on template "index.twig" does not exist in "index.twig". - */ - public function testRenderBlockWithUndefinedBlock() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig, 'index.twig'); - try { - $template->renderBlock('unknown', array()); - } catch (\Exception $e) { - ob_end_clean(); - - throw $e; - } - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Block "unknown" on template "index.twig" does not exist in "index.twig". - */ - public function testDisplayBlockWithUndefinedBlock() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig, 'index.twig'); - $template->displayBlock('unknown', array()); - } - - /** - * @expectedException Twig_Error_Runtime - * @expectedExceptionMessage Block "foo" should not call parent() in "index.twig" as the block does not exist in the parent template "parent.twig" - */ - public function testDisplayBlockWithUndefinedParentBlock() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig, 'parent.twig'); - $template->displayBlock('foo', array(), array('foo' => array(new Twig_TemplateTest($twig, 'index.twig'), 'block_foo')), false); - } - - public function testGetAttributeOnArrayWithConfusableKey() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig); - - $array = array('Zero', 'One', -1 => 'MinusOne', '' => 'EmptyString', '1.5' => 'FloatButString', '01' => 'IntegerButStringWithLeadingZeros'); - - $this->assertSame('Zero', $array[false]); - $this->assertSame('One', $array[true]); - $this->assertSame('One', $array[1.5]); - $this->assertSame('One', $array['1']); - $this->assertSame('MinusOne', $array[-1.5]); - $this->assertSame('FloatButString', $array['1.5']); - $this->assertSame('IntegerButStringWithLeadingZeros', $array['01']); - $this->assertSame('EmptyString', $array[null]); - - $this->assertSame('Zero', twig_get_attribute($twig, $template->getSourceContext(), $array, false), 'false is treated as 0 when accessing an array (equals PHP behavior)'); - $this->assertSame('One', twig_get_attribute($twig, $template->getSourceContext(), $array, true), 'true is treated as 1 when accessing an array (equals PHP behavior)'); - $this->assertSame('One', twig_get_attribute($twig, $template->getSourceContext(), $array, 1.5), 'float is casted to int when accessing an array (equals PHP behavior)'); - $this->assertSame('One', twig_get_attribute($twig, $template->getSourceContext(), $array, '1'), '"1" is treated as integer 1 when accessing an array (equals PHP behavior)'); - $this->assertSame('MinusOne', twig_get_attribute($twig, $template->getSourceContext(), $array, -1.5), 'negative float is casted to int when accessing an array (equals PHP behavior)'); - $this->assertSame('FloatButString', twig_get_attribute($twig, $template->getSourceContext(), $array, '1.5'), '"1.5" is treated as-is when accessing an array (equals PHP behavior)'); - $this->assertSame('IntegerButStringWithLeadingZeros', twig_get_attribute($twig, $template->getSourceContext(), $array, '01'), '"01" is treated as-is when accessing an array (equals PHP behavior)'); - $this->assertSame('EmptyString', twig_get_attribute($twig, $template->getSourceContext(), $array, null), 'null is treated as "" when accessing an array (equals PHP behavior)'); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttribute($defined, $value, $object, $item, $arguments, $type) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig); - - $this->assertEquals($value, twig_get_attribute($twig, $template->getSourceContext(), $object, $item, $arguments, $type)); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $exceptionMessage = null) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)); - $template = new Twig_TemplateTest($twig); - - if ($defined) { - $this->assertEquals($value, twig_get_attribute($twig, $template->getSourceContext(), $object, $item, $arguments, $type)); - } else { - if (method_exists($this, 'expectException')) { - $this->expectException('Twig_Error_Runtime'); - if (null !== $exceptionMessage) { - $this->expectExceptionMessage($exceptionMessage); - } - } else { - $this->setExpectedException('Twig_Error_Runtime', $exceptionMessage); - } - $this->assertEquals($value, twig_get_attribute($twig, $template->getSourceContext(), $object, $item, $arguments, $type)); - } - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig); - - $this->assertEquals($defined, twig_get_attribute($twig, $template->getSourceContext(), $object, $item, $arguments, $type, true)); - } - - /** - * @dataProvider getGetAttributeTests - */ - public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type) - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)); - $template = new Twig_TemplateTest($twig); - - $this->assertEquals($defined, twig_get_attribute($twig, $template->getSourceContext(), $object, $item, $arguments, $type, true)); - } - - public function testGetAttributeCallExceptions() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $template = new Twig_TemplateTest($twig); - - $object = new Twig_TemplateMagicMethodExceptionObject(); - - $this->assertNull(twig_get_attribute($twig, $template->getSourceContext(), $object, 'foo')); - } - - public function getGetAttributeTests() - { - $array = array( - 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - 'foo' => true, - 'baz' => 'baz', - 'baf' => 'baf', - '09' => '09', - '+4' => '+4', - ); - - $objectArray = new Twig_TemplateArrayAccessObject(); - $stdObject = (object) $array; - $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); - $propertyObject = new Twig_TemplatePropertyObject(); - $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); - $propertyObject2 = new Twig_TemplatePropertyObjectAndArrayAccess(); - $propertyObject3 = new Twig_TemplatePropertyObjectDefinedWithUndefinedValue(); - $methodObject = new Twig_TemplateMethodObject(); - $magicMethodObject = new Twig_TemplateMagicMethodObject(); - - $anyType = Twig_Template::ANY_CALL; - $methodType = Twig_Template::METHOD_CALL; - $arrayType = Twig_Template::ARRAY_CALL; - - $basicTests = array( - // array(defined, value, property to fetch) - array(true, 'defined', 'defined'), - array(false, null, 'undefined'), - array(false, null, 'protected'), - array(true, 0, 'zero'), - array(true, 1, 1), - array(true, 1, 1.0), - array(true, null, 'null'), - array(true, true, 'bar'), - array(true, true, 'foo'), - array(true, 'baz', 'baz'), - array(true, 'baf', 'baf'), - array(true, '09', '09'), - array(true, '+4', '+4'), - ); - $testObjects = array( - // array(object, type of fetch) - array($array, $arrayType), - array($objectArray, $arrayType), - array($stdObject, $anyType), - array($magicPropertyObject, $anyType), - array($methodObject, $methodType), - array($methodObject, $anyType), - array($propertyObject, $anyType), - array($propertyObject1, $anyType), - array($propertyObject2, $anyType), - ); - - $tests = array(); - foreach ($testObjects as $testObject) { - foreach ($basicTests as $test) { - // properties cannot be numbers - if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { - continue; - } - - if ('+4' === $test[2] && $methodObject === $testObject[0]) { - continue; - } - - $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); - } - } - - // additional properties tests - $tests = array_merge($tests, array( - array(true, null, $propertyObject3, 'foo', array(), $anyType), - )); - - // additional method tests - $tests = array_merge($tests, array( - array(true, 'defined', $methodObject, 'defined', array(), $methodType), - array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), - array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), - array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), - array(true, 'static', $methodObject, 'static', array(), $methodType), - array(true, 'static', $methodObject, 'getStatic', array(), $methodType), - - array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), - array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), - )); - - // add the same tests for the any type - foreach ($tests as $test) { - if ($anyType !== $test[5]) { - $test[5] = $anyType; - $tests[] = $test; - } - } - - $methodAndPropObject = new Twig_TemplateMethodAndPropObject(); - - // additional method tests - $tests = array_merge($tests, array( - array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), - array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), - array(false, null, $methodAndPropObject, 'a', array(), $arrayType), - - array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), - array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), - array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), - array(false, null, $methodAndPropObject, 'b', array(), $arrayType), - - array(false, null, $methodAndPropObject, 'c', array(), $anyType), - array(false, null, $methodAndPropObject, 'c', array(), $methodType), - array(false, null, $methodAndPropObject, 'c', array(), $arrayType), - )); - - // tests when input is not an array or object - $tests = array_merge($tests, array( - array(false, null, 42, 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'), - array(false, null, 'string', 'a', array(), $anyType, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'), - array(false, null, array(), 'a', array(), $anyType, 'Key "a" does not exist as the array is empty in "index.twig".'), - )); - - return $tests; - } - - /** - * @expectedException Twig_Error_Runtime - */ - public function testGetIsMethods() - { - $twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)); - $getIsObject = new Twig_TemplateGetIsMethods(); - $template = new Twig_TemplateTest($twig, array('strict_variables' => true)); - // first time should not create a cache for "get" - $this->assertNull(twig_get_attribute($twig, $template->getSourceContext(), $getIsObject, 'get')); - // 0 should be in the method cache now, so this should fail - $this->assertNull(twig_get_attribute($twig, $template->getSourceContext(), $getIsObject, 0)); - } -} - -class Twig_TemplateTest extends Twig_Template -{ - private $name; - - public function __construct(Twig_Environment $env, $name = 'index.twig') - { - parent::__construct($env); - self::$cache = array(); - $this->name = $name; - } - - public function getZero() - { - return 0; - } - - public function getEmpty() - { - return ''; - } - - public function getString() - { - return 'some_string'; - } - - public function getTrue() - { - return true; - } - - public function getTemplateName() - { - return $this->name; - } - - public function getDebugInfo() - { - return array(); - } - - protected function doGetParent(array $context) - { - return false; - } - - protected function doDisplay(array $context, array $blocks = array()) - { - } - - public function block_name($context, array $blocks = array()) - { - } -} - -class Twig_TemplateArrayAccessObject implements ArrayAccess -{ - protected $protected = 'protected'; - - public $attributes = array( - 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - 'foo' => true, - 'baz' => 'baz', - 'baf' => 'baf', - '09' => '09', - '+4' => '+4', - ); - - public function offsetExists($name) - { - return array_key_exists($name, $this->attributes); - } - - public function offsetGet($name) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; - } - - public function offsetSet($name, $value) - { - } - - public function offsetUnset($name) - { - } -} - -class Twig_TemplateMagicPropertyObject -{ - public $defined = 'defined'; - - public $attributes = array( - 'zero' => 0, - 'null' => null, - '1' => 1, - 'bar' => true, - 'foo' => true, - 'baz' => 'baz', - 'baf' => 'baf', - '09' => '09', - '+4' => '+4', - ); - - protected $protected = 'protected'; - - public function __isset($name) - { - return array_key_exists($name, $this->attributes); - } - - public function __get($name) - { - return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; - } -} - -class Twig_TemplateMagicPropertyObjectWithException -{ - public function __isset($key) - { - throw new Exception('Hey! Don\'t try to isset me!'); - } -} - -class Twig_TemplatePropertyObject -{ - public $defined = 'defined'; - public $zero = 0; - public $null = null; - public $bar = true; - public $foo = true; - public $baz = 'baz'; - public $baf = 'baf'; - - protected $protected = 'protected'; -} - -class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate -{ - public function getIterator() - { - return new ArrayIterator(array('foo', 'bar')); - } -} - -class Twig_TemplatePropertyObjectAndArrayAccess extends Twig_TemplatePropertyObject implements ArrayAccess -{ - private $data = array( - 'defined' => 'defined', - 'zero' => 0, - 'null' => null, - 'bar' => true, - 'baz' => 'baz', - ); - - public function offsetExists($offset) - { - return array_key_exists($offset, $this->data); - } - - public function offsetGet($offset) - { - return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a'; - } - - public function offsetSet($offset, $value) - { - } - - public function offsetUnset($offset) - { - } -} - -class Twig_TemplatePropertyObjectDefinedWithUndefinedValue -{ - public $foo; - - public function __construct() - { - $this->foo = @$notExist; - } -} - -class Twig_TemplateMethodObject -{ - public function getDefined() - { - return 'defined'; - } - - public function get1() - { - return 1; - } - - public function get09() - { - return '09'; - } - - public function getZero() - { - return 0; - } - - public function getNull() - { - } - - public function isBar() - { - return true; - } - - public function hasFoo() - { - return true; - } - - public function hasBaz() - { - return 'should never be returned (has)'; - } - - public function isBaz() - { - return 'should never be returned (is)'; - } - - public function getBaz() - { - return 'Baz'; - } - - public function baz() - { - return 'baz'; - } - - public function hasBaf() - { - return 'should never be returned (has)'; - } - - public function isBaf() - { - return 'baf'; - } - - protected function getProtected() - { - return 'protected'; - } - - public static function getStatic() - { - return 'static'; - } -} - -class Twig_TemplateGetIsMethods -{ - public function get() - { - } - - public function is() - { - } -} - -class Twig_TemplateMethodAndPropObject -{ - private $a = 'a_prop'; - - public function getA() - { - return 'a'; - } - - public $b = 'b_prop'; - - public function getB() - { - return 'b'; - } - - private $c = 'c_prop'; - - private function getC() - { - return 'c'; - } -} - -class Twig_TemplateMagicMethodObject -{ - public function __call($method, $arguments) - { - return '__call_'.$method; - } -} - -class Twig_TemplateMagicMethodExceptionObject -{ - public function __call($method, $arguments) - { - throw new BadMethodCallException(sprintf('Unknown method "%s".', $method)); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php b/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php deleted file mode 100644 index cc71052..0000000 --- a/vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php +++ /dev/null @@ -1,64 +0,0 @@ - '{% block foo %}{% endblock %}', - 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}', - 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}', - 'imported' => '{% block imported %}{% endblock %}', - 'extended' => '{% block extended %}{% endblock %}', - ))); - - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); - $this->assertTrue($wrapper->hasBlock('foo')); - $this->assertFalse($wrapper->hasBlock('bar')); - $this->assertEquals(array('foo'), $wrapper->getBlockNames()); - - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_use')); - $this->assertTrue($wrapper->hasBlock('foo')); - $this->assertTrue($wrapper->hasBlock('imported')); - $this->assertEquals(array('imported', 'foo'), $wrapper->getBlockNames()); - - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_extends')); - $this->assertTrue($wrapper->hasBlock('foo')); - $this->assertTrue($wrapper->hasBlock('extended')); - $this->assertEquals(array('foo', 'extended'), $wrapper->getBlockNames()); - } - - public function testRenderBlock() - { - $twig = new Twig_Environment(new Twig_Loader_Array(array( - 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', - ))); - $twig->addGlobal('bar', 'BAR'); - - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); - $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', array('foo' => 'FOO'))); - } - - public function testDisplayBlock() - { - $twig = new Twig_Environment(new Twig_Loader_Array(array( - 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}', - ))); - $twig->addGlobal('bar', 'BAR'); - - $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); - - ob_start(); - $wrapper->displayBlock('foo', array('foo' => 'FOO')); - - $this->assertEquals('FOOBAR', ob_get_clean()); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php deleted file mode 100644 index cf3593d..0000000 --- a/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php +++ /dev/null @@ -1,70 +0,0 @@ -isEOF()) { - $token = $stream->next(); - - $repr[] = $token->getValue(); - } - $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unexpected end of template - */ - public function testEndOfTemplateNext() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); - while (!$stream->isEOF()) { - $stream->next(); - } - } - - /** - * @expectedException Twig_Error_Syntax - * @expectedExceptionMessage Unexpected end of template - */ - public function testEndOfTemplateLook() - { - $stream = new Twig_TokenStream(array( - new Twig_Token(Twig_Token::BLOCK_START_TYPE, 1, 1), - )); - while (!$stream->isEOF()) { - $stream->look(); - $stream->next(); - } - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php b/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php deleted file mode 100644 index 887a90a..0000000 --- a/vendor/twig/twig/test/Twig/Tests/Util/DeprecationCollectorTest.php +++ /dev/null @@ -1,42 +0,0 @@ -getMockBuilder('Twig_LoaderInterface')->getMock()); - $twig->addFunction(new Twig_SimpleFunction('deprec', array($this, 'deprec'), array('deprecated' => true))); - - $collector = new Twig_Util_DeprecationCollector($twig); - $deprecations = $collector->collect(new Twig_Tests_Util_Iterator()); - - $this->assertEquals(array('Twig Function "deprec" is deprecated in deprec.twig at line 1.'), $deprecations); - } - - public function deprec() - { - } -} - -class Twig_Tests_Util_Iterator implements IteratorAggregate -{ - public function getIterator() - { - return new ArrayIterator(array( - 'ok.twig' => '{{ foo }}', - 'deprec.twig' => '{{ deprec("foo") }}', - )); - } -} diff --git a/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/vendor/twig/twig/test/Twig/Tests/escapingTest.php deleted file mode 100644 index 9b98ddd..0000000 --- a/vendor/twig/twig/test/Twig/Tests/escapingTest.php +++ /dev/null @@ -1,320 +0,0 @@ - ''', - '"' => '"', - '<' => '<', - '>' => '>', - '&' => '&', - ); - - protected $htmlAttrSpecialChars = array( - '\'' => ''', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => 'Ā', - /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '-' => '-', - '_' => '_', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => ' ', - "\n" => ' ', - "\t" => ' ', - "\0" => '�', // should use Unicode replacement char - /* Encode chars as named entities where possible */ - '<' => '<', - '>' => '>', - '&' => '&', - '"' => '"', - /* Encode spaces for quoteless attribute protection */ - ' ' => ' ', - ); - - protected $jsSpecialChars = array( - /* HTML special chars - escape without exception to hex */ - '<' => '\\x3C', - '>' => '\\x3E', - '\'' => '\\x27', - '"' => '\\x22', - '&' => '\\x26', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\u0100', - /* Immune chars excluded */ - ',' => ',', - '.' => '.', - '_' => '_', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '\\x0D', - "\n" => '\\x0A', - "\t" => '\\x09', - "\0" => '\\x00', - /* Encode spaces for quoteless attribute protection */ - ' ' => '\\x20', - ); - - protected $urlSpecialChars = array( - /* HTML special chars - escape without exception to percent encoding */ - '<' => '%3C', - '>' => '%3E', - '\'' => '%27', - '"' => '%22', - '&' => '%26', - /* Characters beyond ASCII value 255 to hex sequence */ - 'Ā' => '%C4%80', - /* Punctuation and unreserved check */ - ',' => '%2C', - '.' => '.', - '_' => '_', - '-' => '-', - ':' => '%3A', - ';' => '%3B', - '!' => '%21', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '%0D', - "\n" => '%0A', - "\t" => '%09', - "\0" => '%00', - /* PHP quirks from the past */ - ' ' => '%20', - '~' => '~', - '+' => '%2B', - ); - - protected $cssSpecialChars = array( - /* HTML special chars - escape without exception to hex */ - '<' => '\\3C ', - '>' => '\\3E ', - '\'' => '\\27 ', - '"' => '\\22 ', - '&' => '\\26 ', - /* Characters beyond ASCII value 255 to unicode escape */ - 'Ā' => '\\100 ', - /* Immune chars excluded */ - ',' => '\\2C ', - '.' => '\\2E ', - '_' => '\\5F ', - /* Basic alnums excluded */ - 'a' => 'a', - 'A' => 'A', - 'z' => 'z', - 'Z' => 'Z', - '0' => '0', - '9' => '9', - /* Basic control characters and null */ - "\r" => '\\D ', - "\n" => '\\A ', - "\t" => '\\9 ', - "\0" => '\\0 ', - /* Encode spaces for quoteless attribute protection */ - ' ' => '\\20 ', - ); - - protected $env; - - protected function setUp() - { - $this->env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - } - - public function testHtmlEscapingConvertsSpecialChars() - { - foreach ($this->htmlSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key); - } - } - - public function testHtmlAttributeEscapingConvertsSpecialChars() - { - foreach ($this->htmlAttrSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key); - } - } - - public function testJavascriptEscapingConvertsSpecialChars() - { - foreach ($this->jsSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key); - } - } - - public function testJavascriptEscapingReturnsStringIfZeroLength() - { - $this->assertEquals('', twig_escape_filter($this->env, '', 'js')); - } - - public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits() - { - $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js')); - } - - public function testCssEscapingConvertsSpecialChars() - { - foreach ($this->cssSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key); - } - } - - public function testCssEscapingReturnsStringIfZeroLength() - { - $this->assertEquals('', twig_escape_filter($this->env, '', 'css')); - } - - public function testCssEscapingReturnsStringIfContainsOnlyDigits() - { - $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css')); - } - - public function testUrlEscapingConvertsSpecialChars() - { - foreach ($this->urlSpecialChars as $key => $value) { - $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key); - } - } - - /** - * Range tests to confirm escaped range of characters is within OWASP recommendation. - */ - - /** - * Only testing the first few 2 ranges on this prot. function as that's all these - * other range tests require. - */ - public function testUnicodeCodepointConversionToUtf8() - { - $expected = ' ~ޙ'; - $codepoints = array(0x20, 0x7e, 0x799); - $result = ''; - foreach ($codepoints as $value) { - $result .= $this->codepointToUtf8($value); - } - $this->assertEquals($expected, $result); - } - - /** - * Convert a Unicode Codepoint to a literal UTF-8 character. - * - * @param int $codepoint Unicode codepoint in hex notation - * - * @return string UTF-8 literal string - */ - protected function codepointToUtf8($codepoint) - { - if ($codepoint < 0x80) { - return chr($codepoint); - } - if ($codepoint < 0x800) { - return chr($codepoint >> 6 & 0x3f | 0xc0) - .chr($codepoint & 0x3f | 0x80); - } - if ($codepoint < 0x10000) { - return chr($codepoint >> 12 & 0x0f | 0xe0) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); - } - if ($codepoint < 0x110000) { - return chr($codepoint >> 18 & 0x07 | 0xf0) - .chr($codepoint >> 12 & 0x3f | 0x80) - .chr($codepoint >> 6 & 0x3f | 0x80) - .chr($codepoint & 0x3f | 0x80); - } - throw new Exception('Codepoint requested outside of Unicode range.'); - } - - public function testJavascriptEscapingEscapesOwaspRecommendedRanges() - { - $immune = array(',', '.', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); - } else { - $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); - } else { - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'js'), - "$literal should be escaped!"); - } - } - } - } - - public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() - { - $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); - } else { - $literal = $this->codepointToUtf8($chr); - if (in_array($literal, $immune)) { - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); - } else { - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'html_attr'), - "$literal should be escaped!"); - } - } - } - } - - public function testCssEscapingEscapesOwaspRecommendedRanges() - { - // CSS has no exceptions to escaping ranges - for ($chr = 0; $chr < 0xFF; ++$chr) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A) { - $literal = $this->codepointToUtf8($chr); - $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css')); - } else { - $literal = $this->codepointToUtf8($chr); - $this->assertNotEquals( - $literal, - twig_escape_filter($this->env, $literal, 'css'), - "$literal should be escaped!"); - } - } - } -} diff --git a/www/index.php b/www/index.php deleted file mode 100644 index e69de29..0000000